From patchwork Fri Aug 23 06:35:06 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: 2848627 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 148449F271 for ; Fri, 23 Aug 2013 08:49:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0FBF5202C8 for ; Fri, 23 Aug 2013 08:49:22 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id E51C4202C7 for ; Fri, 23 Aug 2013 08:49:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 168ABE806E for ; Fri, 23 Aug 2013 01:49:17 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pa0-f48.google.com (mail-pa0-f48.google.com [209.85.220.48]) by gabe.freedesktop.org (Postfix) with ESMTP id 9817DE7ABD for ; Thu, 22 Aug 2013 23:35:16 -0700 (PDT) Received: by mail-pa0-f48.google.com with SMTP id kp13so288971pab.21 for ; Thu, 22 Aug 2013 23:35:16 -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=3l9oM5DDTXC4myxBN4IHfo23NdvqTuJOqeiLxGak9nQ=; b=jTZXyQF1fa6C7ScpZAol+rRu5vFwwYZiVncZOZrCVi6ziHYm5uOf3TS0OLl4YNahsD Q0fBGCDA38kV5qAk4m7+cTvZzzzj0jKVZr9RFBjctxIdPfMeTSK8jGzvzQu+At8lruYz 0LPgYx1FvW1C95I8LNcYQd6i0v330564UzVbSdMacheQYJ1W8iFjEpU90fHZ2FKJdIdd Zp7lj7YNTHwugArsy8lwrGBe1CB3xuVWPvKylKsaU6QB6vVJHIqiNjMCB2IJWWfv+fIJ 9L5wb2fU+2DE2fEZYqe+1kBcKX5wOfyr4xw8keNqhAUUBjp/W3/AjcS23OAKT3gd48V5 LwmA== X-Gm-Message-State: ALoCoQlNO5lGf+qQqTl4dy+c8Ly9qeAcjcEcznzu3zxrqKNSnt4eYZZ4owSPVJxnSRjNe2rLZY13 X-Received: by 10.68.194.104 with SMTP id hv8mr9393549pbc.168.1377239716417; Thu, 22 Aug 2013 23:35:16 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPSA id ht5sm19341653pbb.29.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 22 Aug 2013 23:35:15 -0700 (PDT) From: Vikas Sajjan To: dri-devel@lists.freedesktop.org, inki.dae@samsung.com Subject: [PATCH] drm/exynos: Add fallback option to get non physically contiguous memory for gem_dumb_create Date: Fri, 23 Aug 2013 12:05:06 +0530 Message-Id: <1377239706-17804-1-git-send-email-vikas.sajjan@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Mailman-Approved-At: Fri, 23 Aug 2013 01:47:35 -0700 Cc: kgene.kim@samsung.com, linaro-dev@lists.linaro.org, patches@linaro.org, laurent.pinchart@ideasonboard.com, s.nawrocki@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=-5.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY, URIBL_RHS_DOB 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 To address the case where physically contiguous memory MAY NOT be a mandatory requirement for framebuffer for the application calling exynos_drm_gem_dumb_create, the patch adds a feature to get non physically contiguous memory for framebuffer, if physically contiguous memory allocation fails and if IOMMU is supported. Signed-off-by: Vikas Sajjan Signed-off-by: Arun Kumar --- drivers/gpu/drm/exynos/exynos_drm_gem.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c index 2eabe1a..66d1b40 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c @@ -17,6 +17,7 @@ #include "exynos_drm_drv.h" #include "exynos_drm_gem.h" #include "exynos_drm_buf.h" +#include "exynos_drm_iommu.h" static unsigned int convert_to_vm_err_msg(int msg) { @@ -666,6 +667,18 @@ int exynos_drm_gem_dumb_create(struct drm_file *file_priv, exynos_gem_obj = exynos_drm_gem_create(dev, EXYNOS_BO_CONTIG | EXYNOS_BO_WC, args->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(dev->dev, "contiguous FB allocation failed, falling back to non-contiguous\n"); + exynos_gem_obj = exynos_drm_gem_create(dev, + EXYNOS_BO_NONCONTIG | EXYNOS_BO_WC, + args->size); + } + if (IS_ERR(exynos_gem_obj)) return PTR_ERR(exynos_gem_obj);