From patchwork Fri Jul 29 08:55:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 73026 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp1274108qga; Fri, 29 Jul 2016 01:57:19 -0700 (PDT) X-Received: by 10.98.73.131 with SMTP id r3mr66826875pfi.112.1469782639296; Fri, 29 Jul 2016 01:57:19 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id kc15si17326983pad.246.2016.07.29.01.57.19; Fri, 29 Jul 2016 01:57:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752543AbcG2I5S (ORCPT + 4 others); Fri, 29 Jul 2016 04:57:18 -0400 Received: from mail-wm0-f51.google.com ([74.125.82.51]:35362 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752424AbcG2I5R (ORCPT ); Fri, 29 Jul 2016 04:57:17 -0400 Received: by mail-wm0-f51.google.com with SMTP id f65so281552634wmi.0 for ; Fri, 29 Jul 2016 01:57:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=GDrnj8Ndvx8PUY4qE1LSdwHH0FuPu+NL1qFo+sCwBNI=; b=Qfb345j0osZ16lUQyQI7uc4VB2GTPBJrj+yu7VSxNZQBkyVd6a4hjdSaif4IRx5tvN Sc0aJ48Sw2JLYyXMUr/Kaco35Ya0UcnlPCB3uTbTrhzDpHbnxuXq4Dr/piZj3HJkYNLt YHHu96Yg8Cx1ptoHfpx/l2/JtKJcTxV2gTWVE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GDrnj8Ndvx8PUY4qE1LSdwHH0FuPu+NL1qFo+sCwBNI=; b=WJPr86l9sBIQx6mRm6YTJa7viRS1dZw9b3R3xIAK/QTxovDtj0JBuyZMSCojsbPEAV 8DVjLSONIqU9e2X60o9R6khwXVBLTJRcmcLLJTFOW+0ijEzSCmDqj4M3eyrnNUcyEqhV ES9seHbvFGP3P9sQOwYrQ+9uYXKFyr12juIbNstzk3CWhMDpX51hLJViHqmC7GaaYmfq 3lTNBstieRQGWaJtqEnuQoXdqMNOqPbFdGVJkTd18wQ5fWljyPvq3QFSlatmITtYoOFV QyWmy/Y4lhWZQ/+acM4j4Vs2egP0ejlD5F4E/13jbaO/144XQqU7ezpf1Z7UBWL0UCq+ Eggg== X-Gm-Message-State: AEkooustziXrR4PTEG4LvFF04TbvKs0TzpoHdI5T72CF66GPanOCctZrijiEk7/U9Di+rbrs X-Received: by 10.194.77.174 with SMTP id t14mr40490551wjw.146.1469782636012; Fri, 29 Jul 2016 01:57:16 -0700 (PDT) Received: from lmenx321.st.com. ([80.215.65.117]) by smtp.gmail.com with ESMTPSA id a21sm1987903wma.10.2016.07.29.01.57.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Jul 2016 01:57:15 -0700 (PDT) From: Benjamin Gaignard To: dri-devel@lists.freedesktop.org, vincent.abriou@st.com, fabien.dessenne@st.com, linux-samsung-soc@vger.kernel.org, emil.l.velikov@gmail.com Cc: linaro-mm-sig@lists.linaro.org, Benjamin Gaignard , Daniel Vetter , Ville Syrjala , Marek Szyprowski Subject: [PATCH v8 4/4] drm: rcar: use generic code for managing zpos plane property Date: Fri, 29 Jul 2016 10:55:39 +0200 Message-Id: <1469782539-9698-5-git-send-email-benjamin.gaignard@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1469782539-9698-1-git-send-email-benjamin.gaignard@linaro.org> References: <1469782539-9698-1-git-send-email-benjamin.gaignard@linaro.org> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org version 6: rebased patch on top rcar-du changes for zpos version 4: fix null pointer issue while setting zpos in plane reset function This patch replaces zpos property handling custom code in rcar DRM driver with calls to generic DRM code. Signed-off-by: Benjamin Gaignard Reviewed-by: Laurent Pinchart Tested-by: Laurent Pinchart Cc: Daniel Vetter Cc: Ville Syrjala Cc: Marek Szyprowski --- drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 2 +- drivers/gpu/drm/rcar-du/rcar_du_drv.h | 1 - drivers/gpu/drm/rcar-du/rcar_du_kms.c | 5 ----- drivers/gpu/drm/rcar-du/rcar_du_plane.c | 9 ++------- drivers/gpu/drm/rcar-du/rcar_du_plane.h | 2 -- drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 14 +++++--------- 6 files changed, 8 insertions(+), 25 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c index e39fcef..7316fc7 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c @@ -196,7 +196,7 @@ void rcar_du_crtc_route_output(struct drm_crtc *crtc, static unsigned int plane_zpos(struct rcar_du_plane *plane) { - return to_rcar_plane_state(plane->plane.state)->zpos; + return plane->plane.state->normalized_zpos; } static const struct rcar_du_format_info * diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.h b/drivers/gpu/drm/rcar-du/rcar_du_drv.h index ed35467..c843c31 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.h +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.h @@ -92,7 +92,6 @@ struct rcar_du_device { struct { struct drm_property *alpha; struct drm_property *colorkey; - struct drm_property *zpos; } props; unsigned int dpad0_source; diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c index 6bb032d..f03eb55 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c @@ -527,11 +527,6 @@ static int rcar_du_properties_init(struct rcar_du_device *rcdu) if (rcdu->props.colorkey == NULL) return -ENOMEM; - rcdu->props.zpos = - drm_property_create_range(rcdu->ddev, 0, "zpos", 1, 7); - if (rcdu->props.zpos == NULL) - return -ENOMEM; - return 0; } diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c b/drivers/gpu/drm/rcar-du/rcar_du_plane.c index bfe31ca..a74f8ed 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c @@ -652,7 +652,7 @@ static void rcar_du_plane_reset(struct drm_plane *plane) state->source = RCAR_DU_PLANE_MEMORY; state->alpha = 255; state->colorkey = RCAR_DU_COLORKEY_NONE; - state->zpos = plane->type == DRM_PLANE_TYPE_PRIMARY ? 0 : 1; + state->state.zpos = plane->type == DRM_PLANE_TYPE_PRIMARY ? 0 : 1; plane->state = &state->state; plane->state->plane = plane; @@ -670,8 +670,6 @@ static int rcar_du_plane_atomic_set_property(struct drm_plane *plane, rstate->alpha = val; else if (property == rcdu->props.colorkey) rstate->colorkey = val; - else if (property == rcdu->props.zpos) - rstate->zpos = val; else return -EINVAL; @@ -690,8 +688,6 @@ static int rcar_du_plane_atomic_get_property(struct drm_plane *plane, *val = rstate->alpha; else if (property == rcdu->props.colorkey) *val = rstate->colorkey; - else if (property == rcdu->props.zpos) - *val = rstate->zpos; else return -EINVAL; @@ -763,8 +759,7 @@ int rcar_du_planes_init(struct rcar_du_group *rgrp) drm_object_attach_property(&plane->plane.base, rcdu->props.colorkey, RCAR_DU_COLORKEY_NONE); - drm_object_attach_property(&plane->plane.base, - rcdu->props.zpos, 1); + drm_plane_create_zpos_property(&plane->plane, 1, 1, 7); } return 0; diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.h b/drivers/gpu/drm/rcar-du/rcar_du_plane.h index b18b7b2..8b91dd3 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_plane.h +++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.h @@ -51,7 +51,6 @@ static inline struct rcar_du_plane *to_rcar_plane(struct drm_plane *plane) * @hwindex: 0-based hardware plane index, -1 means unused * @alpha: value of the plane alpha property * @colorkey: value of the plane colorkey property - * @zpos: value of the plane zpos property */ struct rcar_du_plane_state { struct drm_plane_state state; @@ -62,7 +61,6 @@ struct rcar_du_plane_state { unsigned int alpha; unsigned int colorkey; - unsigned int zpos; }; static inline struct rcar_du_plane_state * diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c index 6ac717f..83ebd16 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c @@ -43,12 +43,12 @@ void rcar_du_vsp_enable(struct rcar_du_crtc *crtc) .src_y = 0, .src_w = mode->hdisplay << 16, .src_h = mode->vdisplay << 16, + .zpos = 0, }, .format = rcar_du_format_info(DRM_FORMAT_ARGB8888), .source = RCAR_DU_PLANE_VSPD1, .alpha = 255, .colorkey = 0, - .zpos = 0, }; if (rcdu->info->gen >= 3) @@ -152,7 +152,7 @@ static void rcar_du_vsp_plane_setup(struct rcar_du_vsp_plane *plane) .pixelformat = 0, .pitch = fb->pitches[0], .alpha = state->alpha, - .zpos = state->zpos, + .zpos = state->state.zpos, }; unsigned int i; @@ -267,7 +267,7 @@ static void rcar_du_vsp_plane_reset(struct drm_plane *plane) return; state->alpha = 255; - state->zpos = plane->type == DRM_PLANE_TYPE_PRIMARY ? 0 : 1; + state->state.zpos = plane->type == DRM_PLANE_TYPE_PRIMARY ? 0 : 1; plane->state = &state->state; plane->state->plane = plane; @@ -282,8 +282,6 @@ static int rcar_du_vsp_plane_atomic_set_property(struct drm_plane *plane, if (property == rcdu->props.alpha) rstate->alpha = val; - else if (property == rcdu->props.zpos) - rstate->zpos = val; else return -EINVAL; @@ -300,8 +298,6 @@ static int rcar_du_vsp_plane_atomic_get_property(struct drm_plane *plane, if (property == rcdu->props.alpha) *val = rstate->alpha; - else if (property == rcdu->props.zpos) - *val = rstate->zpos; else return -EINVAL; @@ -381,8 +377,8 @@ int rcar_du_vsp_init(struct rcar_du_vsp *vsp) drm_object_attach_property(&plane->plane.base, rcdu->props.alpha, 255); - drm_object_attach_property(&plane->plane.base, - rcdu->props.zpos, 1); + drm_plane_create_zpos_property(&plane->plane, 1, 1, + vsp->num_planes - 1); } return 0;