From patchwork Thu Jul 21 08:52:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 9241159 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 65BD36077C for ; Thu, 21 Jul 2016 08:52:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 551EA2074F for ; Thu, 21 Jul 2016 08:52:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 49EC527C0B; Thu, 21 Jul 2016 08:52:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C85B22074F for ; Thu, 21 Jul 2016 08:52:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751570AbcGUIwb (ORCPT ); Thu, 21 Jul 2016 04:52:31 -0400 Received: from mail-wm0-f52.google.com ([74.125.82.52]:34869 "EHLO mail-wm0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751553AbcGUIw3 (ORCPT ); Thu, 21 Jul 2016 04:52:29 -0400 Received: by mail-wm0-f52.google.com with SMTP id f65so14366488wmi.0 for ; Thu, 21 Jul 2016 01:52:28 -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=Dite9+aSuR5S8hxXRx5ectsI0U+V8Z3RN8dhhDhdIOA=; b=KeS5Lqqi3SjDmBTbQH863K18zQzqjlueOtqOHshuyzdHSLXGAOiI/f4ewQ+yQOHfHG oplijvQf7Q/zOlc0NviL1jUCJmV91yksEb22HpWQMY/W1I9oaCes5twgU/vvtF0A3y39 lm0Gx3tXDDaHNLa/UoFBgMBkxpG0A4uRMfSRQ= 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=Dite9+aSuR5S8hxXRx5ectsI0U+V8Z3RN8dhhDhdIOA=; b=YREt/m7X/Ds9oKNsNu5gWEs4lFvimvKaUI0XB0gXGwBx7Ooe6ehQ1m3K9LIU7KGgDE mYAUIFHmse7n3DB/s7zI6HMzB6By5lReGxp2OrkcDW9jqx0Ceq8EJVupBshjrX0r3YIE pNwmwMpw9v1oNtxl29J/eejGB1AabsTPiY2egCZLkpSvpZggo9mTnLE+oALbYTq+wL3N bZlUMTvkuOJQhzDTkq3krVdeCvx01HNveF0sjTFz7DAWCltMVEmlFvjmByCc8Nu2ZZvX y0cAOoJM2xr26lRf1Wq7rW30WSFYWuDiQfrUnODkR2/5jk9Q2D9iGUGtB3qWX87TrZzp j1Aw== X-Gm-Message-State: ALyK8tI+gmV4/h5MA3u9iNnycvHb58qm9h4w6Lz+3GqyBw8G/WJZEhnJh7NANba9xX//vFCl X-Received: by 10.28.113.135 with SMTP id d7mr15560974wmi.43.1469091147642; Thu, 21 Jul 2016 01:52:27 -0700 (PDT) Received: from lmenx321.st.com. ([80.214.125.4]) by smtp.gmail.com with ESMTPSA id a194sm2204779wmd.24.2016.07.21.01.52.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 21 Jul 2016 01:52:27 -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 Cc: linaro-mm-sig@lists.linaro.org, Benjamin Gaignard , Daniel Vetter , Ville Syrjala , Laurent Pinchart , Marek Szyprowski Subject: [PATCH v6 4/4] drm: rcar: use generic code for managing zpos plane property Date: Thu, 21 Jul 2016 10:52:03 +0200 Message-Id: <1469091123-4909-5-git-send-email-benjamin.gaignard@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1469091123-4909-1-git-send-email-benjamin.gaignard@linaro.org> References: <1469091123-4909-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 X-Virus-Scanned: ClamAV using ClamSMTP 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 Cc: Daniel Vetter Cc: Ville Syrjala Cc: Laurent Pinchart 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 -- 5 files changed, 3 insertions(+), 16 deletions(-) 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 *