From patchwork Mon Nov 9 19:50:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Heiko_St=C3=BCbner?= X-Patchwork-Id: 7586401 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 66272C05C6 for ; Mon, 9 Nov 2015 19:52:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A168A2068C for ; Mon, 9 Nov 2015 19:52:19 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 9D5A920693 for ; Mon, 9 Nov 2015 19:52:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D716F6E6C3; Mon, 9 Nov 2015 11:52:16 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from gloria.sntech.de (gloria.sntech.de [95.129.55.99]) by gabe.freedesktop.org (Postfix) with ESMTPS id EAD8C6E6C3 for ; Mon, 9 Nov 2015 11:52:14 -0800 (PST) Received: from ip545477c2.speed.planet.nl ([84.84.119.194] helo=phil.localnet) by gloria.sntech.de with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1ZvsU4-0001mD-DE; Mon, 09 Nov 2015 20:52:08 +0100 From: Heiko Stuebner To: Mark Yao Subject: [PATCH 1/2] drm/rockchip: create the fake mmap offset during gem creation Date: Mon, 09 Nov 2015 20:50:43 +0100 Message-ID: <4982827.0pnZflEOSR@phil> User-Agent: KMail/4.14.10 (Linux/4.2.0-1-amd64; KDE/4.14.13; x86_64; ; ) MIME-Version: 1.0 Cc: linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 Similarly to the equivalent exynos-fix in commit 48cf53f4343a ("drm/exynos: create a fake mmap offset with gem creation") the rockchip drm driver also calls the drm_gem_create_mmap_offset fake-offset creation on every invocation of rockchip_gem_dumb_map_offset. Move that to the creation of the gem to only create that offset once. Signed-off-by: Heiko Stuebner --- drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c index 4ab2f20..e50d113 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c @@ -126,8 +126,14 @@ struct rockchip_gem_object * if (ret) goto err_free_rk_obj; + ret = drm_gem_create_mmap_offset(obj); + if (ret) + goto err_free_buf; + return rk_obj; +err_free_buf: + rockchip_gem_free_buf(rk_obj); err_free_rk_obj: kfree(rk_obj); return ERR_PTR(ret); @@ -196,7 +202,6 @@ int rockchip_gem_dumb_map_offset(struct drm_file *file_priv, uint64_t *offset) { struct drm_gem_object *obj; - int ret; obj = drm_gem_object_lookup(dev, file_priv, handle); if (!obj) { @@ -204,14 +209,9 @@ int rockchip_gem_dumb_map_offset(struct drm_file *file_priv, return -EINVAL; } - ret = drm_gem_create_mmap_offset(obj); - if (ret) - goto out; - *offset = drm_vma_node_offset_addr(&obj->vma_node); DRM_DEBUG_KMS("offset = 0x%llx\n", *offset); -out: drm_gem_object_unreference_unlocked(obj); return 0;