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: 2839374 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 68498BF535 for ; Tue, 6 Aug 2013 11:52:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7405F201EE for ; Tue, 6 Aug 2013 11:52:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 167C3201E7 for ; Tue, 6 Aug 2013 11:52:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756275Ab3HFLwZ (ORCPT ); Tue, 6 Aug 2013 07:52:25 -0400 Received: from mail-pb0-f52.google.com ([209.85.160.52]:43033 "EHLO mail-pb0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756282Ab3HFLwX (ORCPT ); Tue, 6 Aug 2013 07:52:23 -0400 Received: by mail-pb0-f52.google.com with SMTP id wz12so310127pbc.25 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=HCp17MMuHO/Q7HNX+BZzvUICwMhEK5yYtYRplHc51/notZg4k7mTmpYf/8B32mYWx+ LV5Xh8g9VVDvtiPoWZb+jCpq4wrPhYQiiyk2eJUT1tBXP3gXJENqsn1wOTG+VWWX1cjs lQLTPsT7yeZjXX8mutQ3rgLlla97MLOPQLHicrjpJ5jWZDWtlvpFHMxgnr2/GSMofx8u kVDDI7oXRFUklMfB7mxvNAUtbwWKoXY3dQazk3WuMAz61VdlHr/2f928WNUR2dIjeKf6 0EYKZQbN4hQ7xgU1k45tMVBE0CG9Y1p1LPvjayAb+EazRp5mgxAlrNasMv0OvXz6H2I2 ITNg== X-Gm-Message-State: ALoCoQlDwfDyCVCoCSogLMzkXSPS0rQCyhAXgJflf21rRlSyVOm7SB4/FcA4UOABIklzBhv3UCSu 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 Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00,KHOP_BIG_TO_CC, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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;