From patchwork Tue Aug 6 11:52:04 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vikas C Sajjan X-Patchwork-Id: 18795 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f200.google.com (mail-qc0-f200.google.com [209.85.216.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2514025DF6 for ; Tue, 6 Aug 2013 11:52:25 +0000 (UTC) Received: by mail-qc0-f200.google.com with SMTP id n1sf305838qcx.7 for ; Tue, 06 Aug 2013 04:52:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=MBRgWn793e2XNj5HwVuahmeBZ692R4SOBiALr9eNAPA=; b=kiPgLd50X+hfxQRBR0iIDLAxr2lecUQI3X5uqBqCL5FnQXMuoONqkCixThfgqCzqG/ W6R9IASz2ZdZBNt/jzpjJiD4zvrt7Wsiz3prk97FRiGog2eJAPZ4Fi41vAO+21QmEgUZ 9C06nirko/M5tf7d9X2E8vkmWYo2ViQPyZvmrEoPDODoIhZM7LTv0yKIOBChA3YK3uyY FZjQ7noErJY+L1PYEIrJb7CtXJIDwLmPNh7BwjOy6jW6vo1ZfHHoMviyfSqspdJ7tEkk YrlP75jz6YEaUdva+d6PEMPx0Y8UhsnnZe2V97rojE5boFpBlp70lflU0bM4E1XgdaGx FL2Q== X-Received: by 10.236.127.108 with SMTP id c72mr342622yhi.16.1375789944879; Tue, 06 Aug 2013 04:52:24 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.107.71 with SMTP id ha7ls181551qeb.77.gmail; Tue, 06 Aug 2013 04:52:24 -0700 (PDT) X-Received: by 10.220.206.195 with SMTP id fv3mr269057vcb.15.1375789944795; Tue, 06 Aug 2013 04:52:24 -0700 (PDT) Received: from mail-vb0-f52.google.com (mail-vb0-f52.google.com [209.85.212.52]) by mx.google.com with ESMTPS id r1si190977vco.63.2013.08.06.04.52.24 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 06 Aug 2013 04:52:24 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.52 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.52; Received: by mail-vb0-f52.google.com with SMTP id f12so249252vbg.11 for ; Tue, 06 Aug 2013 04:52:24 -0700 (PDT) X-Gm-Message-State: ALoCoQmvYH4Uw7gThoxYrhdXQeMamOeJnVI5dCxZHY+jHtG3Z6z0cjbJNNdsgGriPIjgQGFd6n24 X-Received: by 10.221.47.193 with SMTP id ut1mr267750vcb.8.1375789944649; Tue, 06 Aug 2013 04:52:24 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.221.11.8 with SMTP id pc8csp141329vcb; Tue, 6 Aug 2013 04:52:24 -0700 (PDT) X-Received: by 10.68.28.1 with SMTP id x1mr1021222pbg.113.1375789943681; Tue, 06 Aug 2013 04:52:23 -0700 (PDT) Received: from mail-pd0-f176.google.com (mail-pd0-f176.google.com [209.85.192.176]) by mx.google.com with ESMTPS id or6si2064799pac.276.2013.08.06.04.52.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 06 Aug 2013 04:52:23 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.176 is neither permitted nor denied by best guess record for domain of vikas.sajjan@linaro.org) client-ip=209.85.192.176; Received: by mail-pd0-f176.google.com with SMTP id q10so245231pdj.7 for ; Tue, 06 Aug 2013 04:52:23 -0700 (PDT) X-Received: by 10.68.234.102 with SMTP id ud6mr1121625pbc.50.1375789943184; Tue, 06 Aug 2013 04:52:23 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPSA id nv6sm1597741pbc.6.2013.08.06.04.52.17 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 06 Aug 2013 04:52:22 -0700 (PDT) From: Vikas Sajjan To: linux-samsung-soc@vger.kernel.org, dri-devel@lists.freedesktop.org Cc: kgene.kim@samsung.com, inki.dae@samsung.com, s.nawrocki@samsung.com, m.szyprowski@samsung.com, tomasz.figa@gmail.com, robdclark@gmail.com, arun.kk@samsung.com, patches@linaro.org, linaro-kernel@lists.linaro.org, joshi@samsung.com Subject: [PATCH v4] drm/exynos: Add fallback option to get non physically contiguous memory for fb Date: Tue, 6 Aug 2013 17:22:04 +0530 Message-Id: <1375789924-10515-1-git-send-email-vikas.sajjan@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: vikas.sajjan@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.52 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , While trying to get boot-logo up on exynos5420 SMDK which has eDP panel connected with resolution 2560x1600, following error occured even with IOMMU enabled: [0.880000] [drm:lowlevel_buffer_allocate] *ERROR* failed to allocate buffer. [0.890000] [drm] Initialized exynos 1.0.0 20110530 on minor 0 To address the cases where physically contiguous memory MAY NOT be a mandatory requirement for fb, the patch adds a feature to get non physically contiguous memory for fb if physically contiguous memory allocation fails and if IOMMU is supported. Signed-off-by: Vikas Sajjan Signed-off-by: Arun Kumar Reviewed-by: Rob Clark --- changes since v3: - addressed nits pointed out by Sylwester Nawrocki and Sachin Kamat . changes since v2: - addressed comments given by Tomasz Figa . changes since v1: - Modified to add the fallback patch if CONTIG alloc fails as suggested by Rob Clark robdclark@gmail.com and Tomasz Figa . - changed the commit message. --- drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c index 8e60bd6..5292fc7 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c @@ -16,6 +16,7 @@ #include #include #include +#include #include "exynos_drm_drv.h" #include "exynos_drm_fb.h" @@ -165,8 +166,18 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper, size = mode_cmd.pitches[0] * mode_cmd.height; - /* 0 means to allocate physically continuous memory */ - exynos_gem_obj = exynos_drm_gem_create(dev, 0, size); + exynos_gem_obj = exynos_drm_gem_create(dev, EXYNOS_BO_CONTIG, size); + /* + * If physically contiguous memory allocation fails and if IOMMU is + * supported then try to get buffer from non physically contiguous + * memory area. + */ + if (IS_ERR(exynos_gem_obj) && is_drm_iommu_supported(dev)) { + dev_warn(&pdev->dev, "contiguous FB allocation failed, falling back to non-contiguous\n"); + exynos_gem_obj = exynos_drm_gem_create(dev, EXYNOS_BO_NONCONTIG, + size); + } + if (IS_ERR(exynos_gem_obj)) { ret = PTR_ERR(exynos_gem_obj); goto err_release_framebuffer;