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: 7586411 Return-Path: X-Original-To: patchwork-linux-rockchip@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 12A369F1AF for ; Mon, 9 Nov 2015 19:52:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3337120690 for ; Mon, 9 Nov 2015 19:52:38 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5E3412068C for ; Mon, 9 Nov 2015 19:52:37 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZvsUW-0008Va-HS; Mon, 09 Nov 2015 19:52:36 +0000 Received: from gloria.sntech.de ([95.129.55.99]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZvsUV-0008QI-Kl; Mon, 09 Nov 2015 19:52:36 +0000 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151109_115235_863429_C6CBC627 X-CRM114-Status: GOOD ( 10.55 ) X-Spam-Score: -2.9 (--) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org 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;