From patchwork Fri Jun 16 11:29:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liviu Dudau X-Patchwork-Id: 105713 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp1253798qgd; Fri, 16 Jun 2017 04:29:44 -0700 (PDT) X-Received: by 10.84.202.163 with SMTP id x32mr12343523pld.112.1497612584175; Fri, 16 Jun 2017 04:29:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497612584; cv=none; d=google.com; s=arc-20160816; b=x3+FghsdI68huftT5Cp9GHH0xshESJCTAC7R8LsdY2m+LFvUn7RaoCCyp6O3S2QMXr 775iFE4D2H663sFZgD0/y7iUwIeQgG0Hkto6i3W5wrQuHAZMArF7Fo3GEDf6+3cINkwq Mrp2Mm0Pr0k6dPeiOEpmoomSztDoMyJ38A2UhuOUtAJS5V9aOxveq4v595PqqAS21oB0 kaHGlRy3Mij/Y1mQ/i9x2Ouu3gLtjRYGjk/cE77iBfI3Mb3WPM8D1iAUALV/Fvs8eSRx xvnDpCctUmc+fyGt7DlxgvzKj/u34B6JTlk5huzS4YliEHIzzl7C5Gaiv9JQ+6pE0hsa 1zKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:cc:message-id:date:subject:to:from:delivered-to :arc-authentication-results; bh=0dkUsT9cZR7pov9OnpXg+eGdWiyN9k/S/WbUJTsM/lo=; b=BPrL8u1kFRzbMl8UH9LjZEBYngUaZR9LuIn/0gjqEB79VXmdr+Vet0XcwOMbYHRbOt eaWWl64dDmz5e1HZ3H4MDSYmwPNj6JrtOF39A/3ycSRxtDgKXbJEmTxSkcNt/wA6SffI 2MB/spMVgudntCdfP1+PV04dvd+1KFqpL+2z5JkOlzuJZP/xmjXgpQlK6tzxnaKRmHW6 FYcYSl9fKxF+7e0lXpeAbvv2JIQf934+5JET0PGWZDNyCmVM7WMVP4mILsncTSSu4OIE h6J2n33CImssP6LSGxBVTEB2wQU9CfIrGr+JOf6Z4Jj4o6nX9MJ3ZXYcro9I8LTfOa3t pzDA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id t5si1877869plm.353.2017.06.16.04.29.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Jun 2017 04:29:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2091C6E033; Fri, 16 Jun 2017 11:29:41 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from cam-smtp0.cambridge.arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by gabe.freedesktop.org (Postfix) with ESMTPS id AD4BD6E033 for ; Fri, 16 Jun 2017 11:29:39 +0000 (UTC) Received: from e110455-lin.cambridge.arm.com (e110455-lin.cambridge.arm.com [10.2.131.9]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id v5GBTZkY024713; Fri, 16 Jun 2017 12:29:35 +0100 From: Liviu Dudau To: Mali DP Maintainers Subject: [PATCH] drm/arm: mali-dp: Use CMA helper for plane buffer address calculation Date: Fri, 16 Jun 2017 12:29:35 +0100 Message-Id: <20170616112935.25356-1-Liviu.Dudau@arm.com> X-Mailer: git-send-email 2.13.1 Cc: Liviu Dudau , DRI devel , LKML 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: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" CMA has gained a recent helper function for calculating the start of a plane buffer's physical address. Use that instead of the hand rolled version. Cc: Brian Starkey Signed-off-by: Liviu Dudau --- drivers/gpu/drm/arm/malidp_planes.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c index 063a8d2b0be3..600fa7bd7f52 100644 --- a/drivers/gpu/drm/arm/malidp_planes.c +++ b/drivers/gpu/drm/arm/malidp_planes.c @@ -264,11 +264,9 @@ static void malidp_de_set_plane_pitches(struct malidp_plane *mp, static void malidp_de_plane_update(struct drm_plane *plane, struct drm_plane_state *old_state) { - struct drm_gem_cma_object *obj; struct malidp_plane *mp; const struct malidp_hw_regmap *map; struct malidp_plane_state *ms = to_malidp_plane_state(plane->state); - u16 ptr; u32 src_w, src_h, dest_w, dest_h, val; int i; @@ -285,12 +283,12 @@ static void malidp_de_plane_update(struct drm_plane *plane, for (i = 0; i < ms->n_planes; i++) { /* calculate the offset for the layer's plane registers */ - ptr = mp->layer->ptr + (i << 4); + u16 ptr = mp->layer->ptr + (i << 4); + dma_addr_t fb_addr = drm_fb_cma_get_gem_addr(plane->state->fb, + plane->state, i); - obj = drm_fb_cma_get_gem_obj(plane->state->fb, i); - obj->paddr += plane->state->fb->offsets[i]; - malidp_hw_write(mp->hwdev, lower_32_bits(obj->paddr), ptr); - malidp_hw_write(mp->hwdev, upper_32_bits(obj->paddr), ptr + 4); + malidp_hw_write(mp->hwdev, lower_32_bits(fb_addr), ptr); + malidp_hw_write(mp->hwdev, upper_32_bits(fb_addr), ptr + 4); } malidp_de_set_plane_pitches(mp, ms->n_planes, plane->state->fb->pitches);