From patchwork Wed Mar 30 11:34:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 8695421 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E4882C0553 for ; Wed, 30 Mar 2016 11:35:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A7F5220386 for ; Wed, 30 Mar 2016 11:35:02 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id A250E20383 for ; Wed, 30 Mar 2016 11:35:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BC6CC6E7AE; Wed, 30 Mar 2016 11:34:54 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x22b.google.com (mail-wm0-x22b.google.com [IPv6:2a00:1450:400c:c09::22b]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8B7366E1DD for ; Wed, 30 Mar 2016 11:34:51 +0000 (UTC) Received: by mail-wm0-x22b.google.com with SMTP id r72so95157138wmg.0 for ; Wed, 30 Mar 2016 04:34:51 -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=dRe8i7kdlbEWGpsh0R0tOrU63gIx/u4Hjd2xNn96Zuk=; b=Enwcmsg8BmBGg5jxh3G5I6Q/4WFY82aM4lL5e3NUYFaWxMlblgX+UFF1Gq7IbLNSaU Wi2Bw2Y68GEnu229QgiPpWYWSVzZHL/9NynwEE13ayBVS9Jw3EyBY6iNn3thXzS2wq3L DxyoG5Z/GGIdJm7iqXbuwdoYtKtb+cfNNziRo= 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=dRe8i7kdlbEWGpsh0R0tOrU63gIx/u4Hjd2xNn96Zuk=; b=PidYkbwR4G1gSmggAgQKsFWDJokt8efjIc7sMLnOQ6o/VDaRIUuf7x2OEYQGZoyFEe Ahw63AAw4N2HUjxFIoVKkynSyxzXgXpsyYptPehSRTPH0yE28llozh34NIjocQL+D0sU 79TUTK9kpeQMz/uvRZOJh4sYc63jheLIj/KvsGHdwPI3VnB1G8/1x4PKmZFbn8/dAsp7 xhahQqhaQbXDw468bQK5AnHN3i5NkjfS331pLr/7YOS1K9FWM/DDtAS8TrscEKRD9bFi DEmNNRiAh91BzRRE8aMONTIlO9Fk4s5rCR6Cury2DqRrpEeLloCNfpiIijIEjA0Bty94 lL6Q== X-Gm-Message-State: AD7BkJLucFgP5EHtI8uKggPyNNTEsz9fzWcoTWCcjl0Zl5pgSlmDBx8fit5G/dHDbsqmp2dw X-Received: by 10.28.90.68 with SMTP id o65mr22013649wmb.70.1459337689473; Wed, 30 Mar 2016 04:34:49 -0700 (PDT) Received: from lmenx321.st.com. ([80.12.43.145]) by smtp.gmail.com with ESMTPSA id u4sm3527115wjz.4.2016.03.30.04.34.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 30 Mar 2016 04:34:48 -0700 (PDT) From: Benjamin Gaignard To: m.szyprowski@samsung.com, ville.syrjala@linux.intel.com, dri-devel@lists.freedesktop.org, daniel@ffwll.ch Subject: [PATCH 2/2] drm: sti: use generic zpos for plane Date: Wed, 30 Mar 2016 13:34:32 +0200 Message-Id: <1459337672-22672-3-git-send-email-benjamin.gaignard@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1459337672-22672-1-git-send-email-benjamin.gaignard@linaro.org> References: <1459337672-22672-1-git-send-email-benjamin.gaignard@linaro.org> Cc: linaro-mm-sig@lists.linaro.org, Benjamin Gaignard 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" X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,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 remove private zpos property and use instead the generic new. zpos range is now fixed per plane type and normalized before being using in mixer. Signed-off-by: Benjamin Gaignard --- drivers/gpu/drm/sti/sti_mixer.c | 2 +- drivers/gpu/drm/sti/sti_plane.c | 82 +++++++++++++++-------------------------- drivers/gpu/drm/sti/sti_plane.h | 2 - 3 files changed, 31 insertions(+), 55 deletions(-) diff --git a/drivers/gpu/drm/sti/sti_mixer.c b/drivers/gpu/drm/sti/sti_mixer.c index e7425c3..040abfe 100644 --- a/drivers/gpu/drm/sti/sti_mixer.c +++ b/drivers/gpu/drm/sti/sti_mixer.c @@ -245,7 +245,7 @@ static void sti_mixer_set_background_area(struct sti_mixer *mixer, int sti_mixer_set_plane_depth(struct sti_mixer *mixer, struct sti_plane *plane) { - int plane_id, depth = plane->zorder; + int plane_id, depth = plane->drm_plane.state->normalized_zpos + 1; unsigned int i; u32 mask, val; diff --git a/drivers/gpu/drm/sti/sti_plane.c b/drivers/gpu/drm/sti/sti_plane.c index f10c98d..ee35ba3 100644 --- a/drivers/gpu/drm/sti/sti_plane.c +++ b/drivers/gpu/drm/sti/sti_plane.c @@ -14,15 +14,6 @@ #include "sti_drv.h" #include "sti_plane.h" -/* (Background) < GDP0 < GDP1 < HQVDP0 < GDP2 < GDP3 < (ForeGround) */ -enum sti_plane_desc sti_plane_default_zorder[] = { - STI_GDP_0, - STI_GDP_1, - STI_HQVDP_0, - STI_GDP_2, - STI_GDP_3, -}; - const char *sti_plane_to_str(struct sti_plane *plane) { switch (plane->desc) { @@ -114,69 +105,56 @@ static void sti_plane_destroy(struct drm_plane *drm_plane) drm_plane_cleanup(drm_plane); } -static int sti_plane_set_property(struct drm_plane *drm_plane, - struct drm_property *property, - uint64_t val) +static int sti_plane_get_default_zpos(enum drm_plane_type type) { - struct drm_device *dev = drm_plane->dev; - struct sti_private *private = dev->dev_private; - struct sti_plane *plane = to_sti_plane(drm_plane); - - DRM_DEBUG_DRIVER("\n"); - - if (property == private->plane_zorder_property) { - plane->zorder = val; + switch (type) { + case DRM_PLANE_TYPE_PRIMARY: return 0; + case DRM_PLANE_TYPE_OVERLAY: + return 1; + case DRM_PLANE_TYPE_CURSOR: + return 8; } + return 0; +} - return -EINVAL; +static void sti_plane_reset(struct drm_plane *plane) +{ + drm_atomic_helper_plane_reset(plane); + plane->state->zpos = sti_plane_get_default_zpos(plane->type); } -static void sti_plane_attach_zorder_property(struct drm_plane *drm_plane) +static void sti_plane_attach_zorder_property(struct drm_plane *drm_plane, + enum drm_plane_type type) { - struct drm_device *dev = drm_plane->dev; - struct sti_private *private = dev->dev_private; - struct sti_plane *plane = to_sti_plane(drm_plane); - struct drm_property *prop; - - prop = private->plane_zorder_property; - if (!prop) { - prop = drm_property_create_range(dev, 0, "zpos", 1, - GAM_MIXER_NB_DEPTH_LEVEL); - if (!prop) - return; - - private->plane_zorder_property = prop; + switch (type) { + case DRM_PLANE_TYPE_PRIMARY: + drm_plane_create_zpos_immutable_property(drm_plane, 0, 0); + break; + case DRM_PLANE_TYPE_OVERLAY: + drm_plane_create_zpos_property(drm_plane, 1, 7); + break; + case DRM_PLANE_TYPE_CURSOR: + drm_plane_create_zpos_immutable_property(drm_plane, 8, 8); + break; } - - drm_object_attach_property(&drm_plane->base, prop, plane->zorder); } void sti_plane_init_property(struct sti_plane *plane, enum drm_plane_type type) { - unsigned int i; - - for (i = 0; i < ARRAY_SIZE(sti_plane_default_zorder); i++) - if (sti_plane_default_zorder[i] == plane->desc) - break; - - plane->zorder = i + 1; - - if (type == DRM_PLANE_TYPE_OVERLAY) - sti_plane_attach_zorder_property(&plane->drm_plane); + sti_plane_attach_zorder_property(&plane->drm_plane, type); - DRM_DEBUG_DRIVER("drm plane:%d mapped to %s with zorder:%d\n", - plane->drm_plane.base.id, - sti_plane_to_str(plane), plane->zorder); + DRM_DEBUG_DRIVER("drm plane:%d mapped to %s\n", + plane->drm_plane.base.id, sti_plane_to_str(plane)); } struct drm_plane_funcs sti_plane_helpers_funcs = { .update_plane = drm_atomic_helper_update_plane, .disable_plane = drm_atomic_helper_disable_plane, .destroy = sti_plane_destroy, - .set_property = sti_plane_set_property, - .reset = drm_atomic_helper_plane_reset, + .set_property = drm_atomic_helper_plane_set_property, + .reset = sti_plane_reset, .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, }; diff --git a/drivers/gpu/drm/sti/sti_plane.h b/drivers/gpu/drm/sti/sti_plane.h index c50a3b9..2747773 100644 --- a/drivers/gpu/drm/sti/sti_plane.h +++ b/drivers/gpu/drm/sti/sti_plane.h @@ -68,14 +68,12 @@ struct sti_fps_info { * @plane: drm plane it is bound to (if any) * @desc: plane type & id * @status: to know the status of the plane - * @zorder: plane z-order * @fps_info: frame per second info */ struct sti_plane { struct drm_plane drm_plane; enum sti_plane_desc desc; enum sti_plane_status status; - int zorder; struct sti_fps_info fps_info; };