From patchwork Tue Aug 6 05:23:24 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: 18786 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f72.google.com (mail-vb0-f72.google.com [209.85.212.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 234A525E5F for ; Tue, 6 Aug 2013 05:23:40 +0000 (UTC) Received: by mail-vb0-f72.google.com with SMTP id f12sf5415521vbg.3 for ; Mon, 05 Aug 2013 22:23:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state:x-removed-original-auth:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=U+zJqdZoqXEfPGrtNKRXjQIhssUuxYQd+BsA+ZpQXXI=; b=Nsrs38p5bOGkGgh4rC+sdoJGOfAuhDmcL63yBn2ZQSoeM1tovNK4qyoDc92DbvkYoy 6Pl+xPD1EEqmyojkMhT0Xyt9Dbq+NRQbsuKnLPApciNU85Ezta5pDY/Y4d1AHyT8rsW/ SHPQ3J4wVDDqFaEE3Q8lrADVaCVufOdLbwruwNz3EhlbomYeHU7EUsoIvojaqy82MjTO Pt+5LW2aZs0hDUj+OunOj3TkszMp83lkGzqDBEdZlEogdDFQR3oHVJH9hbMzYHKeALYQ 2w8thIRGFsLra9KEc+eVTOcm4cyzbehxdNP3j6UnzyvV0cu8To77YqBq7dptQs6vBxyw KgAA== X-Received: by 10.236.126.244 with SMTP id b80mr9746827yhi.31.1375766619471; Mon, 05 Aug 2013 22:23:39 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.129.233 with SMTP id nz9ls65632qeb.33.gmail; Mon, 05 Aug 2013 22:23:39 -0700 (PDT) X-Received: by 10.52.94.6 with SMTP id cy6mr5683685vdb.108.1375766619292; Mon, 05 Aug 2013 22:23:39 -0700 (PDT) Received: from mail-ve0-f170.google.com (mail-ve0-f170.google.com [209.85.128.170]) by mx.google.com with ESMTPS id w1si576709vei.110.2013.08.05.22.23.39 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 05 Aug 2013 22:23:39 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.170; Received: by mail-ve0-f170.google.com with SMTP id 15so4040074vea.1 for ; Mon, 05 Aug 2013 22:23:39 -0700 (PDT) X-Received: by 10.220.198.133 with SMTP id eo5mr6872986vcb.24.1375766619141; Mon, 05 Aug 2013 22:23:39 -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 pc8csp128046vcb; Mon, 5 Aug 2013 22:23:38 -0700 (PDT) X-Received: by 10.68.36.132 with SMTP id q4mr26131202pbj.118.1375766617987; Mon, 05 Aug 2013 22:23:37 -0700 (PDT) Received: from mail-pd0-f178.google.com (mail-pd0-f178.google.com [209.85.192.178]) by mx.google.com with ESMTPS id ql10si1644454pbb.40.2013.08.05.22.23.37 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 05 Aug 2013 22:23:37 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.178 is neither permitted nor denied by best guess record for domain of vikas.sajjan@linaro.org) client-ip=209.85.192.178; Received: by mail-pd0-f178.google.com with SMTP id w10so4080325pde.23 for ; Mon, 05 Aug 2013 22:23:37 -0700 (PDT) X-Received: by 10.68.34.97 with SMTP id y1mr26141464pbi.198.1375766617432; Mon, 05 Aug 2013 22:23:37 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPSA id qv4sm2879045pbc.16.2013.08.05.22.23.30 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 05 Aug 2013 22:23:36 -0700 (PDT) From: Vikas Sajjan To: linux-samsung-soc@vger.kernel.org, dri-devel@lists.freedesktop.org Cc: linux-media@vger.kernel.org, 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 v3] drm/exynos: Add fallback option to get non physically continous memory for fb Date: Tue, 6 Aug 2013 10:53:24 +0530 Message-Id: <1375766604-15455-1-git-send-email-vikas.sajjan@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQmiRum93U7i5iTj63LC0YZYpqHXHDUEMrs/owMPH8oWWCa6Mm73ARMD9R44vWMCUNwRom/k 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.128.170 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 continous memory MAY NOT be a mandatory requirement for fb, the patch adds a feature to get non physically continous memory for fb if IOMMU is supported and if CONTIG memory allocation fails. Signed-off-by: Vikas Sajjan Signed-off-by: Arun Kumar Reviewed-by: Rob Clark --- 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 | 14 ++++++++++++-- 1 file changed, 12 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..faec77e 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,17 @@ 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 IOMMU is supported then try to get buffer from non physically + * continous 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;