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: 2839890 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DB6249F3B9 for ; Wed, 7 Aug 2013 05:47:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EBD6E201B3 for ; Wed, 7 Aug 2013 05:47:20 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id C0E8C201B2 for ; Wed, 7 Aug 2013 05:47:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 982B9E61BB for ; Tue, 6 Aug 2013 22:47:19 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pd0-f179.google.com (mail-pd0-f179.google.com [209.85.192.179]) by gabe.freedesktop.org (Postfix) with ESMTP id 594DAE69C4 for ; Tue, 6 Aug 2013 04:52:23 -0700 (PDT) Received: by mail-pd0-f179.google.com with SMTP id v10so241934pde.38 for ; Tue, 06 Aug 2013 04:52:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=MBRgWn793e2XNj5HwVuahmeBZ692R4SOBiALr9eNAPA=; b=IEgAWVuQayFkQhm2p6dvsUDk2K4s6r5yz2Dl8OIyNtkW/PridAQSgk+RKWHL4xPFc8 W3bd8/broZfbhkh8jRtVc9/5Yj7E8Fw7X14KztOLmERWfrrizHnd/N9dwXS995gPXRO8 beWpYbT6xMDlSVG/svuUbjXI9L/aceeAOD07hB85PoriIOaEGLB63oJawK1UsCJruMn5 RGm9RtQ5SCeC3dyuJ5OxmWgrxjfkYcfgwRWNgGeRe7rwSWwlBYbycHmN/ybhwwZOLeY3 t+0fP3ejRuoBtwJBSA6WJThMTbqRGHeeWXf0htY5ZIuF4dRSyhNBVWgAfMsXV4fKGnqL Nfug== X-Gm-Message-State: ALoCoQlJidjx+Xha60eZkO6AH2C36hpAJ1sFQKtFos4Ri8J3+F3uWiHZoDwEJ7TDWIVDrwwljAGS 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 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-Mailman-Approved-At: Tue, 06 Aug 2013 22:45:04 -0700 Cc: kgene.kim@samsung.com, patches@linaro.org, joshi@samsung.com, linaro-kernel@lists.linaro.org, s.nawrocki@samsung.com, arun.kk@samsung.com, m.szyprowski@samsung.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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;