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: 19430 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f198.google.com (mail-vc0-f198.google.com [209.85.220.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 85E55246AD for ; Fri, 23 Aug 2013 06:35:19 +0000 (UTC) Received: by mail-vc0-f198.google.com with SMTP id ht10sf191129vcb.9 for ; Thu, 22 Aug 2013 23:35:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=3l9oM5DDTXC4myxBN4IHfo23NdvqTuJOqeiLxGak9nQ=; b=pqNLP4mh8VbrYryaWh9ESPJl4GaqiSgJN3JrSxswy6+0mBIXfGfagCPiDTdcZ2um5Y C6j+G8YC5sXNb0hb8iIxwlsJu9Ks1VyvNeSU4qJBFKxi0cKaRUSI3bJYxUdLLZJBsAa6 jPOenet2rgnQKETIP0ijWUzm612SDhrur9imih8oXhO8NoDvMLFeR/6QiZmz9F0vFoiz l9wxkikfWG/nfiqR+siPTkl8FuiN+dWXiSJv3wWjRba8JxzKjP1b0a05BILe0rtekdCQ 7nSaKZJIQFS4yjbiWxubK3QUbb6YNIsLklRhnhb0GtKyV0ukyn3ff4Uc0PZ8Ek3+n49j +52g== X-Received: by 10.236.75.97 with SMTP id y61mr846600yhd.45.1377239718778; Thu, 22 Aug 2013 23:35:18 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.82.202 with SMTP id k10ls1414252qey.10.gmail; Thu, 22 Aug 2013 23:35:18 -0700 (PDT) X-Received: by 10.220.206.195 with SMTP id fv3mr14904678vcb.15.1377239718668; Thu, 22 Aug 2013 23:35:18 -0700 (PDT) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id rx3si5178472vcb.5.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 22 Aug 2013 23:35:18 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.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.220.170; Received: by mail-vc0-f170.google.com with SMTP id kw10so181927vcb.1 for ; Thu, 22 Aug 2013 23:35:18 -0700 (PDT) X-Gm-Message-State: ALoCoQlD2HZQZTcnRvzAyjKHcfRMfpeJRAr+PNOSyiL3VWfySrH01q/NcIxvHwYLjWyqsi9hextE X-Received: by 10.221.40.10 with SMTP id to10mr5633388vcb.22.1377239718458; Thu, 22 Aug 2013 23:35:18 -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.220.174.196 with SMTP id u4csp75571vcz; Thu, 22 Aug 2013 23:35:17 -0700 (PDT) X-Received: by 10.66.27.43 with SMTP id q11mr9278949pag.97.1377239717072; Thu, 22 Aug 2013 23:35:17 -0700 (PDT) Received: from mail-pb0-f49.google.com (mail-pb0-f49.google.com [209.85.160.49]) by mx.google.com with ESMTPS id ie10si10968197pbc.251.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 22 Aug 2013 23:35:17 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.49 is neither permitted nor denied by best guess record for domain of vikas.sajjan@linaro.org) client-ip=209.85.160.49; Received: by mail-pb0-f49.google.com with SMTP id xb4so290802pbc.36 for ; Thu, 22 Aug 2013 23:35:16 -0700 (PDT) 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 Cc: kgene.kim@samsung.com, s.nawrocki@samsung.com, robdclark@gmail.com, tomasz.figa@gmail.com, laurent.pinchart@ideasonboard.com, patches@linaro.org, linaro-dev@lists.linaro.org 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-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.220.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: , 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);