From patchwork Thu May 22 06:31:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Sharma X-Patchwork-Id: 4220631 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 79DBDBEEAB for ; Thu, 22 May 2014 06:32:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 99B7820127 for ; Thu, 22 May 2014 06:32:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9BAC320123 for ; Thu, 22 May 2014 06:32:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752095AbaEVGcU (ORCPT ); Thu, 22 May 2014 02:32:20 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:62700 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751056AbaEVGcR (ORCPT ); Thu, 22 May 2014 02:32:17 -0400 Received: from epcpsbgr5.samsung.com (u145.gpu120.samsung.co.kr [203.254.230.145]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N5Y007ROQ5RGM80@mailout1.samsung.com> for linux-samsung-soc@vger.kernel.org; Thu, 22 May 2014 15:32:15 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.125]) by epcpsbgr5.samsung.com (EPCPMTA) with SMTP id 26.8B.16580.FE99D735; Thu, 22 May 2014 15:32:15 +0900 (KST) X-AuditID: cbfee691-b7f2f6d0000040c4-07-537d99efec67 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 98.8E.08203.EE99D735; Thu, 22 May 2014 15:32:14 +0900 (KST) Received: from localhost.localdomain ([107.108.83.245]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N5Y00524Q54QW20@mmp2.samsung.com>; Thu, 22 May 2014 15:32:14 +0900 (KST) From: Rahul Sharma To: dri-devel@lists.freedesktop.org Cc: linux-samsung-soc@vger.kernel.org, inki.dae@samsung.com, kgene.kim@samsung.com, joshi@samsung.com, r.sh.open@gmail.com, Rahul Sharma , Rahul Sharma Subject: [PATCH v2] drm:exynos: allocate non-contigous buffer when iommu is enabled Date: Thu, 22 May 2014 12:01:15 +0530 Message-id: <1400740275-11663-1-git-send-email-rahul.sharma@samsung.com> X-Mailer: git-send-email 1.7.9.5 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrJLMWRmVeSWpSXmKPExsWyRsSkVvf9zNpgg+nzuCyufH3PZjHp/gQW i++7vrBb9C64ymYx4/w+JouFL+Itpiw6zOrA7rFz1l12j/vdx5k8+rasYvT4vEkugCWKyyYl NSezLLVI3y6BK6Pl/FzWgscCFa8e9rI3MP7j7WLk5JAQMJFovL+DCcIWk7hwbz1bFyMXh5DA UkaJ85vussIUHf37ngkiMZ1RYtOZThYIp51J4m7jTbB2NgFdidkHnzGC2CICyhJ/J65iBCli FrjEKLFq8RmwImGBUIkzR9eB2SwCqhJfty9hAbF5BTwk1vffZ+5i5ABapyAxZ5INSK+EwG82 iVMTPzNC1AtIfJt8iAWiRlZi0wFmiOskJQ6uuMEygVFwASPDKkbR1ILkguKk9CJTveLE3OLS vHS95PzcTYzAYD3979nEHYz3D1gfYkwGGjeRWUo0OR8Y7Hkl8YbGZkYWpiamxkbmlmakCSuJ 86Y/SgoSEkhPLEnNTk0tSC2KLyrNSS0+xMjEwSnVwGiwTJvZnmGK3BrVXfz6s3V8PVwedRUc 7f/0yIP76r2s3ns/5XSydy1S4qiafevPubVTyzzKZ03L4XHTF01W3db506y0IScwXJ47vHB3 zw3WMyaaRZFBGiuY9m/52Xp19s6OdW3sXn9mzVq70WW5V/Fsuf+dr9dUdshfyfcPs8o1Mav5 2vuER4mlOCPRUIu5qDgRAMH3gOBsAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrGIsWRmVeSWpSXmKPExsVy+t9jQd13M2uDDS7MsLG48vU9m8Wk+xNY LL7v+sJu0bvgKpvFjPP7mCwWvoi3mLLoMKsDu8fOWXfZPe53H2fy6NuyitHj8ya5AJaoBkab jNTElNQihdS85PyUzLx0WyXv4HjneFMzA0NdQ0sLcyWFvMTcVFslF58AXbfMHKALlBTKEnNK gUIBicXFSvp2mCaEhrjpWsA0Ruj6hgTB9RgZoIGENYwZLefnshY8Fqh49bCXvYHxH28XIyeH hICJxNG/75kgbDGJC/fWs3UxcnEICUxnlNh0ppMFwmlnkrjbeBOsik1AV2L2wWeMILaIgLLE 34mrGEGKmAUuMUqsWnwGrEhYIFTizNF1YDaLgKrE1+1LWEBsXgEPifX995m7GDmA1ilIzJlk M4GRewEjwypG0dSC5ILipPRcQ73ixNzi0rx0veT83E2M4Fh4JrWDcWWDxSFGAQ5GJR7eG+dr goVYE8uKK3MPMUpwMCuJ8G6rqQ0W4k1JrKxKLcqPLyrNSS0+xJgMtHwis5Rocj4wTvNK4g2N TcxNjU0tTSxMzCxJE1YS5z3Qah0oJJCeWJKanZpakFoEs4WJg1OqgbHqtZGGqLi2hUojBwev kP68C4pfc4/rMr/lzpr8pu9ZkvIzUbWu2o2tv4JvTlKwfHOVXd5k/y9GUSPvTVrr33grCaf4 Hjs5V6D44LFctY65O+/Jbyj3C859xrZO8khrqdS9kwflNU/KrmUJcyxYceTp9JVCWsGZa+8v udTFniqw68hhz9J1fUosxRmJhlrMRcWJABZBf9XJAgAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected 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=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 From: Rahul Sharma Allow to allocate non-contigous buffers when iommu is enabled. Currently, it tries to allocates contigous buffer which consistently fail for large buffers and then fall back to non contigous. Apart from being slow, this implementation is also very noisy and fills the screen with alloc fail logs. Signed-off-by: Rahul Sharma Reviewed-by: Sachin Kamat --- drivers/gpu/drm/exynos/exynos_drm_gem.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c index 42d2904..f323b32 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c @@ -612,22 +612,25 @@ int exynos_drm_gem_dumb_create(struct drm_file *file_priv, args->pitch = args->width * ((args->bpp + 7) / 8); args->size = args->pitch * args->height; - 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"); + * If iommu is supported, allocate non-contigous buffer else + * allocate physically contiguous memory. + */ + + if (is_drm_iommu_supported(dev)) { + exynos_gem_obj = exynos_drm_gem_create(dev, + EXYNOS_BO_NONCONTIG | EXYNOS_BO_WC, + args->size); + } else { exynos_gem_obj = exynos_drm_gem_create(dev, - EXYNOS_BO_NONCONTIG | EXYNOS_BO_WC, - args->size); + EXYNOS_BO_CONTIG | EXYNOS_BO_WC, + args->size); } - if (IS_ERR(exynos_gem_obj)) + if (IS_ERR(exynos_gem_obj)) { + dev_warn(dev->dev, "FB allocation failed.\n"); return PTR_ERR(exynos_gem_obj); + } ret = exynos_drm_gem_handle_create(&exynos_gem_obj->base, file_priv, &args->handle);