From patchwork Mon Jun 13 09:21:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 69854 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp1443779qgf; Mon, 13 Jun 2016 02:21:52 -0700 (PDT) X-Received: by 10.98.103.66 with SMTP id b63mr4615688pfc.141.1465809706960; Mon, 13 Jun 2016 02:21:46 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id mv18si16906535pab.17.2016.06.13.02.21.46; Mon, 13 Jun 2016 02:21:46 -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 S964807AbcFMJVq (ORCPT + 4 others); Mon, 13 Jun 2016 05:21:46 -0400 Received: from mail-wm0-f46.google.com ([74.125.82.46]:36698 "EHLO mail-wm0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965256AbcFMJVp (ORCPT ); Mon, 13 Jun 2016 05:21:45 -0400 Received: by mail-wm0-f46.google.com with SMTP id n184so69349976wmn.1 for ; Mon, 13 Jun 2016 02:21:44 -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=yHkvU9gkxurHxS1tzyU+2kpjfhj0gaGbJO0ccT5fyUI=; b=F1dilZHHffBPBSZPA40UdyPmKhJ+UEWsNz6Oa+7Ij2nHOsjrwM8uXOIlcAVVvUMnDS qGjvPEOD8qm7Tbn8hJ+46baGKKk4Ze3f6JAeWYOkSFWlKlGvY4LKOIgAv0f5dX4zet8A tnhW4oHQXcl7veLKDnTLZBXdEtA1k6sR1Gs4k= 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=yHkvU9gkxurHxS1tzyU+2kpjfhj0gaGbJO0ccT5fyUI=; b=cmMsPU8yVWUZ2Jq2Y9q9R8GUVuEa7Xwbs7Uruy7wjuyoNoHmUlgkPfPblqyUKEMDMN XHVzEFe4VbdIJ6HHJIhgiGZj6wp/Q5hS1blOBWz+yfU4FbzcgrxL2ZNBDQf73yZYklcW Syhxv03MLkpTjFoLWS4zcV1rRI4rFiXwQHJp20atX8QnZawHPr52+IyUibUpTyR6C2oR SwNPqklTy3wg88i+SZqI2IoA4B+JZn8B6bahJvkY0vOMv0IoHXQymU9mRcuq4IsudQLR 5NF53W7cCuQDQnTCgVQ1MgfItLG/LcSmen/4TFOjkxGEmrFBuAWZBVTVH3GJ7P5vkLN8 aXLw== X-Gm-Message-State: ALyK8tKeWrntNm9S0uEI0t1qdZvZixoXApA3jJymuZ3H7Txxg5mI8zg7THD3kniNKqKVeVqW X-Received: by 10.194.89.5 with SMTP id bk5mr57281wjb.55.1465809704007; Mon, 13 Jun 2016 02:21:44 -0700 (PDT) Received: from lmenx321.st.com. ([80.12.39.174]) by smtp.gmail.com with ESMTPSA id f1sm13352412wmf.22.2016.06.13.02.21.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 13 Jun 2016 02:21:43 -0700 (PDT) From: Benjamin Gaignard To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org Cc: linaro-mm-sig@lists.linaro.org, Benjamin Gaignard , Inki Dae , Daniel Vetter , Ville Syrjala , Joonyoung Shim , Seung-Woo Kim , Andrzej Hajda , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Tobias Jakobi , Gustavo Padovan , vincent.abriou@st.com, fabien.dessenne@st.com, Laurent Pinchart Subject: [PATCH v4 2/4] drm: sti: use generic zpos for plane Date: Mon, 13 Jun 2016 11:21:24 +0200 Message-Id: <1465809686-22507-3-git-send-email-benjamin.gaignard@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1465809686-22507-1-git-send-email-benjamin.gaignard@linaro.org> References: <1465809686-22507-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 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 Cc: Inki Dae Cc: Daniel Vetter Cc: Ville Syrjala Cc: Joonyoung Shim Cc: Seung-Woo Kim Cc: Andrzej Hajda Cc: Krzysztof Kozlowski Cc: Bartlomiej Zolnierkiewicz Cc: Tobias Jakobi Cc: Gustavo Padovan Cc: vincent.abriou@st.com Cc: fabien.dessenne@st.com Cc: Laurent Pinchart --- drivers/gpu/drm/sti/sti_mixer.c | 9 ++--- drivers/gpu/drm/sti/sti_plane.c | 80 +++++++++++++++-------------------------- drivers/gpu/drm/sti/sti_plane.h | 2 -- 3 files changed, 31 insertions(+), 60 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/sti/sti_mixer.c b/drivers/gpu/drm/sti/sti_mixer.c index 6f86f2b..1e4a9f0 100644 --- a/drivers/gpu/drm/sti/sti_mixer.c +++ b/drivers/gpu/drm/sti/sti_mixer.c @@ -239,13 +239,10 @@ 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; unsigned int i; u32 mask, val; - if ((depth < 1) || (depth > GAM_MIXER_NB_DEPTH_LEVEL)) - return 1; - switch (plane->desc) { case STI_GDP_0: plane_id = GAM_DEPTH_GDP0_ID; @@ -278,8 +275,8 @@ int sti_mixer_set_plane_depth(struct sti_mixer *mixer, struct sti_plane *plane) break; } - mask |= GAM_DEPTH_MASK_ID << (3 * (depth - 1)); - plane_id = plane_id << (3 * (depth - 1)); + mask |= GAM_DEPTH_MASK_ID << (3 * depth); + plane_id = plane_id << (3 * depth); DRM_DEBUG_DRIVER("%s %s depth=%d\n", sti_mixer_to_str(mixer), sti_plane_to_str(plane), depth); diff --git a/drivers/gpu/drm/sti/sti_plane.c b/drivers/gpu/drm/sti/sti_plane.c index f10c98d..0e447d9 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,54 @@ 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 7; } + 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: + case DRM_PLANE_TYPE_OVERLAY: + drm_plane_create_zpos_property(drm_plane, 0, 6); + break; + case DRM_PLANE_TYPE_CURSOR: + drm_plane_create_zpos_immutable_property(drm_plane, 7, 7); + 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; };