From patchwork Tue Jan 17 16:25:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liviu Dudau X-Patchwork-Id: 91703 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp526503obz; Tue, 17 Jan 2017 08:40:13 -0800 (PST) X-Received: by 10.84.236.76 with SMTP id h12mr60161211pln.173.1484671213846; Tue, 17 Jan 2017 08:40:13 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u19si25447944plj.101.2017.01.17.08.40.13; Tue, 17 Jan 2017 08:40:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751424AbdAQQkG (ORCPT + 25 others); Tue, 17 Jan 2017 11:40:06 -0500 Received: from fw-tnat.cambridge.arm.com ([217.140.96.140]:53818 "EHLO cam-smtp0.cambridge.arm.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751115AbdAQQkE (ORCPT ); Tue, 17 Jan 2017 11:40:04 -0500 X-Greylist: delayed 873 seconds by postgrey-1.27 at vger.kernel.org; Tue, 17 Jan 2017 11:39:36 EST Received: from e110455-lin.cambridge.arm.com (e110455-lin.cambridge.arm.com [10.2.131.175]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id v0HGOvUk022705; Tue, 17 Jan 2017 16:24:57 GMT From: Liviu Dudau To: Brian Starkey Cc: Mali DP Maintainers , David Airlie , DRI devel , LKML , Shailendra Verma , Shailendra Verma Subject: [PATCH 1/8] drm/arm/malidp: Fix possible dereference of NULL Date: Tue, 17 Jan 2017 16:25:00 +0000 Message-Id: <20170117162507.31961-2-Liviu.Dudau@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170117162507.31961-1-Liviu.Dudau@arm.com> References: <20170117162507.31961-1-Liviu.Dudau@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Shailendra Verma There is possible deference of NULL pointer on return of malidp_duplicate_plane_state() if kmalloc fails. Check the returned kmalloc pointer before continuing. Signed-off-by: Shailendra Verma [cleaned up the code and re-formatted the commit message] Signed-off-by: Liviu Dudau --- drivers/gpu/drm/arm/malidp_planes.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) -- 2.11.0 diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c index eff2fe47e26a..d1cc15724dc3 100644 --- a/drivers/gpu/drm/arm/malidp_planes.c +++ b/drivers/gpu/drm/arm/malidp_planes.c @@ -67,13 +67,14 @@ drm_plane_state *malidp_duplicate_plane_state(struct drm_plane *plane) return NULL; state = kmalloc(sizeof(*state), GFP_KERNEL); - if (state) { - m_state = to_malidp_plane_state(plane->state); - __drm_atomic_helper_plane_duplicate_state(plane, &state->base); - state->rotmem_size = m_state->rotmem_size; - state->format = m_state->format; - state->n_planes = m_state->n_planes; - } + if (!state) + return NULL; + + m_state = to_malidp_plane_state(plane->state); + __drm_atomic_helper_plane_duplicate_state(plane, &state->base); + state->rotmem_size = m_state->rotmem_size; + state->format = m_state->format; + state->n_planes = m_state->n_planes; return &state->base; } From patchwork Tue Jan 17 16:25:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liviu Dudau X-Patchwork-Id: 91697 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp526319obz; Tue, 17 Jan 2017 08:39:45 -0800 (PST) X-Received: by 10.98.111.194 with SMTP id k185mr44089353pfc.83.1484671185133; Tue, 17 Jan 2017 08:39:45 -0800 (PST) Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id d12si16691259pfe.248.2017.01.17.08.39.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Jan 2017 08:39:45 -0800 (PST) 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 B92526E6B5; Tue, 17 Jan 2017 16:39:43 +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 420466E6B5 for ; Tue, 17 Jan 2017 16:39:42 +0000 (UTC) Received: from e110455-lin.cambridge.arm.com (e110455-lin.cambridge.arm.com [10.2.131.175]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id v0HGOvUl022705; Tue, 17 Jan 2017 16:24:58 GMT From: Liviu Dudau To: Brian Starkey Subject: [PATCH 2/8] drm: malidp: Remove event_list member from struct malidp_drm Date: Tue, 17 Jan 2017 16:25:01 +0000 Message-Id: <20170117162507.31961-3-Liviu.Dudau@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170117162507.31961-1-Liviu.Dudau@arm.com> References: <20170117162507.31961-1-Liviu.Dudau@arm.com> Cc: Mali DP Maintainers , LKML , DRI devel 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" This struct member managed to outlive the submission process without being removed. It is useless. Signed-off-by: Liviu Dudau --- drivers/gpu/drm/arm/malidp_drv.c | 2 -- drivers/gpu/drm/arm/malidp_drv.h | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c index 32f746e31379..080f7631c672 100644 --- a/drivers/gpu/drm/arm/malidp_drv.c +++ b/drivers/gpu/drm/arm/malidp_drv.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -286,7 +285,6 @@ static int malidp_bind(struct device *dev) memcpy(hwdev, of_device_get_match_data(dev), sizeof(*hwdev)); malidp->dev = hwdev; - INIT_LIST_HEAD(&malidp->event_list); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); hwdev->regs = devm_ioremap_resource(dev, res); diff --git a/drivers/gpu/drm/arm/malidp_drv.h b/drivers/gpu/drm/arm/malidp_drv.h index 9fc8a2e405e4..dbc617c6e4ef 100644 --- a/drivers/gpu/drm/arm/malidp_drv.h +++ b/drivers/gpu/drm/arm/malidp_drv.h @@ -15,12 +15,12 @@ #include #include +#include #include "malidp_hw.h" struct malidp_drm { struct malidp_hw_device *dev; struct drm_fbdev_cma *fbdev; - struct list_head event_list; struct drm_crtc crtc; wait_queue_head_t wq; atomic_t config_valid; From patchwork Tue Jan 17 16:25:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liviu Dudau X-Patchwork-Id: 91704 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp526547obz; Tue, 17 Jan 2017 08:40:21 -0800 (PST) X-Received: by 10.84.168.129 with SMTP id f1mr48407265plb.7.1484671221167; Tue, 17 Jan 2017 08:40:21 -0800 (PST) Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id m22si11244616pli.290.2017.01.17.08.40.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Jan 2017 08:40:21 -0800 (PST) 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 1EE146E6BA; Tue, 17 Jan 2017 16:39:50 +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 5A88B6E6BA for ; Tue, 17 Jan 2017 16:39:49 +0000 (UTC) Received: from e110455-lin.cambridge.arm.com (e110455-lin.cambridge.arm.com [10.2.131.175]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id v0HGOvUm022705; Tue, 17 Jan 2017 16:24:58 GMT From: Liviu Dudau To: Brian Starkey Subject: [PATCH 3/8] drm: mali-dp: Check more use cases in the plane's ->atomic_check() Date: Tue, 17 Jan 2017 16:25:02 +0000 Message-Id: <20170117162507.31961-4-Liviu.Dudau@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170117162507.31961-1-Liviu.Dudau@arm.com> References: <20170117162507.31961-1-Liviu.Dudau@arm.com> Cc: Mali DP Maintainers , LKML , DRI devel 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" Mali DP's plane ->atomic_check() only checks for the new state submitting frame buffers with supported pixel formats and if there is enough rotation memory for rotated planes. Add a call to drm_plane_helper_check_state() to add additional checks for plane state validity and clipping issues. Signed-off-by: Liviu Dudau --- drivers/gpu/drm/arm/malidp_planes.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c index d1cc15724dc3..f684fe4a80d2 100644 --- a/drivers/gpu/drm/arm/malidp_planes.c +++ b/drivers/gpu/drm/arm/malidp_planes.c @@ -11,6 +11,7 @@ */ #include +#include #include #include #include @@ -103,8 +104,10 @@ static int malidp_de_plane_check(struct drm_plane *plane, { struct malidp_plane *mp = to_malidp_plane(plane); struct malidp_plane_state *ms = to_malidp_plane_state(state); + struct drm_crtc_state *crtc_state; struct drm_framebuffer *fb; - int i; + struct drm_rect clip = { 0 }; + int i, ret; u32 src_w, src_h; if (!state->crtc || !state->fb) @@ -142,6 +145,16 @@ static int malidp_de_plane_check(struct drm_plane *plane, fb->format->format == DRM_FORMAT_BGR888)) return -EINVAL; + crtc_state = drm_atomic_get_existing_crtc_state(state->state, state->crtc); + clip.x2 = crtc_state->adjusted_mode.hdisplay; + clip.y2 = crtc_state->adjusted_mode.vdisplay; + ret = drm_plane_helper_check_state(state, &clip, + DRM_PLANE_HELPER_NO_SCALING, + DRM_PLANE_HELPER_NO_SCALING, + true, true); + if (ret) + return ret; + ms->rotmem_size = 0; if (state->rotation & MALIDP_ROTATED_MASK) { int val; From patchwork Tue Jan 17 16:25:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liviu Dudau X-Patchwork-Id: 91702 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp526454obz; Tue, 17 Jan 2017 08:40:07 -0800 (PST) X-Received: by 10.99.174.4 with SMTP id q4mr46472260pgf.178.1484671207568; Tue, 17 Jan 2017 08:40:07 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b3si25444444plb.131.2017.01.17.08.40.07; Tue, 17 Jan 2017 08:40:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751403AbdAQQj7 (ORCPT + 25 others); Tue, 17 Jan 2017 11:39:59 -0500 Received: from fw-tnat.cambridge.arm.com ([217.140.96.140]:53818 "EHLO cam-smtp0.cambridge.arm.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751227AbdAQQj5 (ORCPT ); Tue, 17 Jan 2017 11:39:57 -0500 X-Greylist: delayed 873 seconds by postgrey-1.27 at vger.kernel.org; Tue, 17 Jan 2017 11:39:36 EST Received: from e110455-lin.cambridge.arm.com (e110455-lin.cambridge.arm.com [10.2.131.175]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id v0HGOvUn022705; Tue, 17 Jan 2017 16:24:58 GMT From: Liviu Dudau To: Brian Starkey Cc: Mali DP Maintainers , David Airlie , DRI devel , LKML , Liviu Dudau Subject: [PATCH 4/8] drm: mali-dp: Don't force source size == crtc size Date: Tue, 17 Jan 2017 16:25:03 +0000 Message-Id: <20170117162507.31961-5-Liviu.Dudau@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170117162507.31961-1-Liviu.Dudau@arm.com> References: <20170117162507.31961-1-Liviu.Dudau@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Brian Starkey Remove the check enforcing that src_w and src_h match crtc_w and crtc_h, as this prevents rotation from working. The check was intended to disallow scaling, but drm_plane_helper_check_state() does that for us, while also taking rotation into account, so the removed check was redundant in any case. Signed-off-by: Brian Starkey Signed-off-by: Liviu Dudau --- drivers/gpu/drm/arm/malidp_planes.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.11.0 diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c index f684fe4a80d2..69eba71253c9 100644 --- a/drivers/gpu/drm/arm/malidp_planes.c +++ b/drivers/gpu/drm/arm/malidp_planes.c @@ -135,8 +135,7 @@ static int malidp_de_plane_check(struct drm_plane *plane, if ((state->crtc_w > mp->hwdev->max_line_size) || (state->crtc_h > mp->hwdev->max_line_size) || (state->crtc_w < mp->hwdev->min_line_size) || - (state->crtc_h < mp->hwdev->min_line_size) || - (state->crtc_w != src_w) || (state->crtc_h != src_h)) + (state->crtc_h < mp->hwdev->min_line_size)) return -EINVAL; /* packed RGB888 / BGR888 can't be rotated or flipped */ From patchwork Tue Jan 17 16:25:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liviu Dudau X-Patchwork-Id: 91699 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp526326obz; Tue, 17 Jan 2017 08:39:46 -0800 (PST) X-Received: by 10.98.70.12 with SMTP id t12mr31087218pfa.47.1484671186340; Tue, 17 Jan 2017 08:39:46 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1si18143959plj.177.2017.01.17.08.39.45; Tue, 17 Jan 2017 08:39:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751302AbdAQQjn (ORCPT + 25 others); Tue, 17 Jan 2017 11:39:43 -0500 Received: from fw-tnat.cambridge.arm.com ([217.140.96.140]:53818 "EHLO cam-smtp0.cambridge.arm.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751227AbdAQQjl (ORCPT ); Tue, 17 Jan 2017 11:39:41 -0500 X-Greylist: delayed 873 seconds by postgrey-1.27 at vger.kernel.org; Tue, 17 Jan 2017 11:39:36 EST Received: from e110455-lin.cambridge.arm.com (e110455-lin.cambridge.arm.com [10.2.131.175]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id v0HGOvUo022705; Tue, 17 Jan 2017 16:24:58 GMT From: Liviu Dudau To: Brian Starkey Cc: Mali DP Maintainers , David Airlie , DRI devel , LKML Subject: [PATCH 5/8] drm: mali-dp: Fix destination size handling when rotating Date: Tue, 17 Jan 2017 16:25:04 +0000 Message-Id: <20170117162507.31961-6-Liviu.Dudau@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170117162507.31961-1-Liviu.Dudau@arm.com> References: <20170117162507.31961-1-Liviu.Dudau@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Brian Starkey The destination rectangle provided by userspace in the CRTC_X/Y/W/H properties is already expressed as the dimensions after rotation. This means we shouldn't swap the width and height ourselves when a 90/270 degree rotation is requested, so remove the code doing the swap. Fixes: ad49f8602fe8 ("drm/arm: Add support for Mali Display Processors") Signed-off-by: Brian Starkey Signed-off-by: Liviu Dudau --- drivers/gpu/drm/arm/malidp_planes.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) -- 2.11.0 diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c index 69eba71253c9..8c5ce36147f3 100644 --- a/drivers/gpu/drm/arm/malidp_planes.c +++ b/drivers/gpu/drm/arm/malidp_planes.c @@ -187,13 +187,8 @@ static void malidp_de_plane_update(struct drm_plane *plane, /* convert src values from Q16 fixed point to integer */ src_w = plane->state->src_w >> 16; src_h = plane->state->src_h >> 16; - if (plane->state->rotation & MALIDP_ROTATED_MASK) { - dest_w = plane->state->crtc_h; - dest_h = plane->state->crtc_w; - } else { - dest_w = plane->state->crtc_w; - dest_h = plane->state->crtc_h; - } + dest_w = plane->state->crtc_w; + dest_h = plane->state->crtc_h; malidp_hw_write(mp->hwdev, ms->format, mp->layer->base); From patchwork Tue Jan 17 16:25:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liviu Dudau X-Patchwork-Id: 91698 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp526323obz; Tue, 17 Jan 2017 08:39:45 -0800 (PST) X-Received: by 10.99.127.71 with SMTP id p7mr47184610pgn.125.1484671185840; Tue, 17 Jan 2017 08:39:45 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1si18143959plj.177.2017.01.17.08.39.45; Tue, 17 Jan 2017 08:39:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751258AbdAQQjl (ORCPT + 25 others); Tue, 17 Jan 2017 11:39:41 -0500 Received: from fw-tnat.cambridge.arm.com ([217.140.96.140]:53818 "EHLO cam-smtp0.cambridge.arm.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750741AbdAQQjj (ORCPT ); Tue, 17 Jan 2017 11:39:39 -0500 X-Greylist: delayed 873 seconds by postgrey-1.27 at vger.kernel.org; Tue, 17 Jan 2017 11:39:36 EST Received: from e110455-lin.cambridge.arm.com (e110455-lin.cambridge.arm.com [10.2.131.175]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id v0HGOvUp022705; Tue, 17 Jan 2017 16:24:58 GMT From: Liviu Dudau To: Brian Starkey Cc: Mali DP Maintainers , David Airlie , DRI devel , LKML Subject: [PATCH 6/8] drm: mali-dp: Fix transposed horizontal/vertical flip Date: Tue, 17 Jan 2017 16:25:05 +0000 Message-Id: <20170117162507.31961-7-Liviu.Dudau@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170117162507.31961-1-Liviu.Dudau@arm.com> References: <20170117162507.31961-1-Liviu.Dudau@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Brian Starkey The horizontal and vertical flip flags were the wrong way around, causing reflect-x to result in reflect-y being applied and vice-versa. Fix them. Fixes: ad49f8602fe8 ("drm/arm: Add support for Mali Display Processors") Signed-off-by: Brian Starkey Signed-off-by: Liviu Dudau --- drivers/gpu/drm/arm/malidp_planes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.11.0 diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c index 8c5ce36147f3..629f634872a4 100644 --- a/drivers/gpu/drm/arm/malidp_planes.c +++ b/drivers/gpu/drm/arm/malidp_planes.c @@ -221,9 +221,9 @@ static void malidp_de_plane_update(struct drm_plane *plane, if (plane->state->rotation & DRM_ROTATE_MASK) val = ilog2(plane->state->rotation & DRM_ROTATE_MASK) << LAYER_ROT_OFFSET; if (plane->state->rotation & DRM_REFLECT_X) - val |= LAYER_V_FLIP; - if (plane->state->rotation & DRM_REFLECT_Y) val |= LAYER_H_FLIP; + if (plane->state->rotation & DRM_REFLECT_Y) + val |= LAYER_V_FLIP; /* * always enable pixel alpha blending until we have a way to change From patchwork Tue Jan 17 16:25:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liviu Dudau X-Patchwork-Id: 91701 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp526432obz; Tue, 17 Jan 2017 08:40:04 -0800 (PST) X-Received: by 10.98.74.84 with SMTP id x81mr36593508pfa.172.1484671204629; Tue, 17 Jan 2017 08:40:04 -0800 (PST) Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id g33si25436221plb.206.2017.01.17.08.40.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Jan 2017 08:40:04 -0800 (PST) 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 D14706E6C5; Tue, 17 Jan 2017 16:39:55 +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 8DDC46E6BC for ; Tue, 17 Jan 2017 16:39:53 +0000 (UTC) Received: from e110455-lin.cambridge.arm.com (e110455-lin.cambridge.arm.com [10.2.131.175]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id v0HGOvUq022705; Tue, 17 Jan 2017 16:24:58 GMT From: Liviu Dudau To: Brian Starkey Subject: [PATCH 7/8] drm: mali-dp: fix Lx_CONTROL register fields clobber Date: Tue, 17 Jan 2017 16:25:06 +0000 Message-Id: <20170117162507.31961-8-Liviu.Dudau@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170117162507.31961-1-Liviu.Dudau@arm.com> References: <20170117162507.31961-1-Liviu.Dudau@arm.com> Cc: Mihail Atanassov , Mali DP Maintainers , LKML , DRI devel 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" From: Mihail Atanassov When updating the rotation fields, one of the assignments zeroes out the rest of the register fields, which include settings for chroma siting, inverse gamma, AMBA AXI caching, and alpha blending. Signed-off-by: Mihail Atanassov Signed-off-by: Liviu Dudau --- drivers/gpu/drm/arm/malidp_planes.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c index 629f634872a4..1db8b6977efc 100644 --- a/drivers/gpu/drm/arm/malidp_planes.c +++ b/drivers/gpu/drm/arm/malidp_planes.c @@ -219,7 +219,8 @@ static void malidp_de_plane_update(struct drm_plane *plane, /* setup the rotation and axis flip bits */ if (plane->state->rotation & DRM_ROTATE_MASK) - val = ilog2(plane->state->rotation & DRM_ROTATE_MASK) << LAYER_ROT_OFFSET; + val |= ilog2(plane->state->rotation & DRM_ROTATE_MASK) << + LAYER_ROT_OFFSET; if (plane->state->rotation & DRM_REFLECT_X) val |= LAYER_H_FLIP; if (plane->state->rotation & DRM_REFLECT_Y) From patchwork Tue Jan 17 16:25:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liviu Dudau X-Patchwork-Id: 91700 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp526366obz; Tue, 17 Jan 2017 08:39:54 -0800 (PST) X-Received: by 10.84.128.66 with SMTP id 60mr45183098pla.34.1484671194590; Tue, 17 Jan 2017 08:39:54 -0800 (PST) Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id u17si18558952pgn.198.2017.01.17.08.39.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Jan 2017 08:39:54 -0800 (PST) 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 B66946E6BE; Tue, 17 Jan 2017 16:39:53 +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 765326E6BC for ; Tue, 17 Jan 2017 16:39:51 +0000 (UTC) Received: from e110455-lin.cambridge.arm.com (e110455-lin.cambridge.arm.com [10.2.131.175]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id v0HGOvUr022705; Tue, 17 Jan 2017 16:24:58 GMT From: Liviu Dudau To: Brian Starkey Subject: [PATCH 8/8] drm: mali-dp: Rename malidp_input_format to malidp_pixel_format Date: Tue, 17 Jan 2017 16:25:07 +0000 Message-Id: <20170117162507.31961-9-Liviu.Dudau@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170117162507.31961-1-Liviu.Dudau@arm.com> References: <20170117162507.31961-1-Liviu.Dudau@arm.com> Cc: Mali DP Maintainers , LKML , DRI devel 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" From: Brian Starkey We're going to use the same format list for output formats, so rename everything related to input formats to avoid confusion. Signed-off-by: Brian Starkey [touched commit message to clarify the final struct name] Signed-off-by: Liviu Dudau --- drivers/gpu/drm/arm/malidp_hw.c | 24 ++++++++++++------------ drivers/gpu/drm/arm/malidp_hw.h | 8 ++++---- drivers/gpu/drm/arm/malidp_planes.c | 8 ++++---- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/arm/malidp_hw.c b/drivers/gpu/drm/arm/malidp_hw.c index 4bdf531f7844..9ec6d6904f5e 100644 --- a/drivers/gpu/drm/arm/malidp_hw.c +++ b/drivers/gpu/drm/arm/malidp_hw.c @@ -21,7 +21,7 @@ #include "malidp_drv.h" #include "malidp_hw.h" -static const struct malidp_input_format malidp500_de_formats[] = { +static const struct malidp_format_id malidp500_de_formats[] = { /* fourcc, layers supporting the format, internal id */ { DRM_FORMAT_ARGB2101010, DE_VIDEO1 | DE_GRAPHICS1 | DE_GRAPHICS2, 0 }, { DRM_FORMAT_ABGR2101010, DE_VIDEO1 | DE_GRAPHICS1 | DE_GRAPHICS2, 1 }, @@ -69,7 +69,7 @@ static const struct malidp_input_format malidp500_de_formats[] = { { DRM_FORMAT_NV12, DE_VIDEO1 | DE_VIDEO2, MALIDP_ID(5, 6) }, \ { DRM_FORMAT_YUV420, DE_VIDEO1 | DE_VIDEO2, MALIDP_ID(5, 7) } -static const struct malidp_input_format malidp550_de_formats[] = { +static const struct malidp_format_id malidp550_de_formats[] = { MALIDP_COMMON_FORMATS, }; @@ -436,8 +436,8 @@ const struct malidp_hw_device malidp_device[MALIDP_MAX_DEVICES] = { .irq_mask = MALIDP500_DE_IRQ_CONF_VALID, .vsync_irq = MALIDP500_DE_IRQ_CONF_VALID, }, - .input_formats = malidp500_de_formats, - .n_input_formats = ARRAY_SIZE(malidp500_de_formats), + .pixel_formats = malidp500_de_formats, + .n_pixel_formats = ARRAY_SIZE(malidp500_de_formats), .bus_align_bytes = 8, }, .query_hw = malidp500_query_hw, @@ -469,8 +469,8 @@ const struct malidp_hw_device malidp_device[MALIDP_MAX_DEVICES] = { .irq_mask = MALIDP550_DC_IRQ_CONF_VALID, .vsync_irq = MALIDP550_DC_IRQ_CONF_VALID, }, - .input_formats = malidp550_de_formats, - .n_input_formats = ARRAY_SIZE(malidp550_de_formats), + .pixel_formats = malidp550_de_formats, + .n_pixel_formats = ARRAY_SIZE(malidp550_de_formats), .bus_align_bytes = 8, }, .query_hw = malidp550_query_hw, @@ -503,8 +503,8 @@ const struct malidp_hw_device malidp_device[MALIDP_MAX_DEVICES] = { .irq_mask = MALIDP550_DC_IRQ_CONF_VALID, .vsync_irq = MALIDP550_DC_IRQ_CONF_VALID, }, - .input_formats = malidp550_de_formats, - .n_input_formats = ARRAY_SIZE(malidp550_de_formats), + .pixel_formats = malidp550_de_formats, + .n_pixel_formats = ARRAY_SIZE(malidp550_de_formats), .bus_align_bytes = 16, }, .query_hw = malidp650_query_hw, @@ -522,10 +522,10 @@ u8 malidp_hw_get_format_id(const struct malidp_hw_regmap *map, { unsigned int i; - for (i = 0; i < map->n_input_formats; i++) { - if (((map->input_formats[i].layer & layer_id) == layer_id) && - (map->input_formats[i].format == format)) - return map->input_formats[i].id; + for (i = 0; i < map->n_pixel_formats; i++) { + if (((map->pixel_formats[i].layer & layer_id) == layer_id) && + (map->pixel_formats[i].format == format)) + return map->pixel_formats[i].id; } return MALIDP_INVALID_FORMAT_ID; diff --git a/drivers/gpu/drm/arm/malidp_hw.h b/drivers/gpu/drm/arm/malidp_hw.h index 087e1202db3d..4f8c884d1960 100644 --- a/drivers/gpu/drm/arm/malidp_hw.h +++ b/drivers/gpu/drm/arm/malidp_hw.h @@ -35,7 +35,7 @@ enum { DE_SMART = BIT(4), }; -struct malidp_input_format { +struct malidp_format_id { u32 format; /* DRM fourcc */ u8 layer; /* bitmask of layers supporting it */ u8 id; /* used internally */ @@ -85,9 +85,9 @@ struct malidp_hw_regmap { const struct malidp_irq_map se_irq_map; const struct malidp_irq_map dc_irq_map; - /* list of supported input formats for each layer */ - const struct malidp_input_format *input_formats; - const u8 n_input_formats; + /* list of supported pixel formats for each layer */ + const struct malidp_format_id *pixel_formats; + const u8 n_pixel_formats; /* pitch alignment requirement in bytes */ const u8 bus_align_bytes; diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c index 1db8b6977efc..8845647d5bef 100644 --- a/drivers/gpu/drm/arm/malidp_planes.c +++ b/drivers/gpu/drm/arm/malidp_planes.c @@ -267,7 +267,7 @@ int malidp_de_planes_init(struct drm_device *drm) u32 *formats; int ret, i, j, n; - formats = kcalloc(map->n_input_formats, sizeof(*formats), GFP_KERNEL); + formats = kcalloc(map->n_pixel_formats, sizeof(*formats), GFP_KERNEL); if (!formats) { ret = -ENOMEM; goto cleanup; @@ -283,9 +283,9 @@ int malidp_de_planes_init(struct drm_device *drm) } /* build the list of DRM supported formats based on the map */ - for (n = 0, j = 0; j < map->n_input_formats; j++) { - if ((map->input_formats[j].layer & id) == id) - formats[n++] = map->input_formats[j].format; + for (n = 0, j = 0; j < map->n_pixel_formats; j++) { + if ((map->pixel_formats[j].layer & id) == id) + formats[n++] = map->pixel_formats[j].format; } plane_type = (i == 0) ? DRM_PLANE_TYPE_PRIMARY :