From patchwork Mon Aug 5 09:44:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vikas Sajjan X-Patchwork-Id: 19547 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1V6HM3-00029y-7N; Mon, 05 Aug 2013 11:45:31 +0200 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.72/mailfrontend-6) with esmtp id 1V6HM1-0003Cc-4D; Mon, 05 Aug 2013 11:45:31 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753715Ab3HEJpZ (ORCPT + 1 other); Mon, 5 Aug 2013 05:45:25 -0400 Received: from mail-pa0-f44.google.com ([209.85.220.44]:52293 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751345Ab3HEJo7 (ORCPT ); Mon, 5 Aug 2013 05:44:59 -0400 Received: by mail-pa0-f44.google.com with SMTP id jh10so3090540pab.3 for ; Mon, 05 Aug 2013 02:44:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=B0MdbltWETHU8XDSiuZRg4SzopXsDAKKyX/v0SYDYqk=; b=nV+TeeapWz8JD5p9xS3MTeot4UHDqk0Tl3kqNeiZNAnZC4vCeUvpormbXiXQkyzw9Z uEpqb41FlBbbbEiEgRchyZG6bQYi7FBjb4VsyNepCfTA9yzPG8R68mU1D26BpwZ3ojIj 2opxDBZPgCHeF8em7zcEM5x2iZ0lwtOQZ6/joWKlZhl8qIp2OHl/PSmzmh6BQsCYBWAO dkg57Uhd57JWSCzocKrl+W2LstWIxakmj49pTym+5hjMooOkot6zvYc4r/bODHld+T9E rgkEbgnMc9pdKT6ltO3YDTY5eWbSycC5BRVcFfc18QPV2vZURuPM8W8wbwnC9pp0rXOE TMgg== X-Received: by 10.68.143.131 with SMTP id se3mr17113993pbb.39.1375695899446; Mon, 05 Aug 2013 02:44:59 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPSA id tr10sm26437241pbc.22.2013.08.05.02.44.52 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 05 Aug 2013 02:44:58 -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 Subject: [PATCH V2] drm/exynos: Add fallback option to get non physically continous memory for fb Date: Mon, 5 Aug 2013 15:14:42 +0530 Message-Id: <1375695882-16004-1-git-send-email-vikas.sajjan@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQlAIuJ+0f4S42kzog8sD7WRmJXHnr+oVA2m/0qc+KkBbsTIxLlTr59Mlhuh9kuKNd0pSAWj Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2013.8.5.91907 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_2000_2999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __FRAUD_BODY_WEBMAIL 0, __FRAUD_WEBMAIL 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __MULTIPLE_RCPTS_CC_X2 0, __SANE_MSGID 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS , __YOUTUBE_RCVD 0' 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 case 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 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 | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c index 8e60bd6..9a4b886 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,11 +166,21 @@ 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 (IS_ERR(exynos_gem_obj)) { - ret = PTR_ERR(exynos_gem_obj); - goto err_release_framebuffer; + /* + * If IOMMU is supported then try to get buffer from + * non-continous memory area + */ + if (is_drm_iommu_supported(dev)) + 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; + } + dev_warn(&pdev->dev, "exynos_gem_obj for FB is allocated with\n" + "non physically continuous memory\n"); } exynos_fbdev->exynos_gem_obj = exynos_gem_obj;