From: "José Expósito" <jose.exposito89@gmail.com>
To: Louis Chauvet <louis.chauvet@bootlin.com>
Cc: Haneen Mohammed <hamohammed.sa@gmail.com>,
Simona Vetter <simona@ffwll.ch>,
Melissa Wen <melissa.srw@gmail.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>,
Jonathan Corbet <corbet@lwn.net>,
victoria@system76.com, sebastian.wick@redhat.com,
thomas.petazzoni@bootlin.com, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org
Subject: Re: [PATCH 12/22] drm/vkms: Introduce config for plane zpos property
Date: Mon, 27 Oct 2025 10:12:30 +0100 [thread overview]
Message-ID: <aP83fl899vwZKsD1@fedora> (raw)
In-Reply-To: <20251018-vkms-all-config-v1-12-a7760755d92d@bootlin.com>
On Sat, Oct 18, 2025 at 04:01:12AM +0200, Louis Chauvet wrote:
> VKMS can render plane in any order. Introduce the appropriate
> configuration.
>
> Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
> ---
> drivers/gpu/drm/vkms/tests/vkms_config_test.c | 3 +
> drivers/gpu/drm/vkms/vkms_config.c | 21 ++++
> drivers/gpu/drm/vkms/vkms_config.h | 142 ++++++++++++++++++++++++++
> drivers/gpu/drm/vkms/vkms_plane.c | 11 ++
> 4 files changed, 177 insertions(+)
>
> diff --git a/drivers/gpu/drm/vkms/tests/vkms_config_test.c b/drivers/gpu/drm/vkms/tests/vkms_config_test.c
> index d75a6252e4d2..f2b38b436252 100644
> --- a/drivers/gpu/drm/vkms/tests/vkms_config_test.c
> +++ b/drivers/gpu/drm/vkms/tests/vkms_config_test.c
> @@ -172,6 +172,9 @@ static void vkms_config_test_default_config(struct kunit *test)
> n_possible_crtcs++;
> }
> KUNIT_EXPECT_EQ(test, n_possible_crtcs, 1);
> + KUNIT_EXPECT_EQ(test, vkms_config_plane_get_zpos_enabled(plane_cfg), false);
> + // No need to test the other zpos configurations as they are discarded if
> + // the zpos property is not created.
> }
>
> /* Encoders */
> diff --git a/drivers/gpu/drm/vkms/vkms_config.c b/drivers/gpu/drm/vkms/vkms_config.c
> index 0b975a0d47aa..5da34a3e8114 100644
> --- a/drivers/gpu/drm/vkms/vkms_config.c
> +++ b/drivers/gpu/drm/vkms/vkms_config.c
> @@ -86,6 +86,7 @@ struct vkms_config *vkms_config_default_create(bool enable_cursor,
> if (IS_ERR(plane_cfg))
> goto err_alloc;
> vkms_config_plane_set_type(plane_cfg, DRM_PLANE_TYPE_PRIMARY);
> + vkms_config_plane_set_zpos_enabled(plane_cfg, false);
>
> crtc_cfg = vkms_config_create_crtc(config);
> if (IS_ERR(crtc_cfg))
> @@ -103,6 +104,7 @@ struct vkms_config *vkms_config_default_create(bool enable_cursor,
>
> vkms_config_plane_set_type(plane_cfg,
> DRM_PLANE_TYPE_OVERLAY);
> + vkms_config_plane_set_zpos_enabled(plane_cfg, false);
>
> if (vkms_config_plane_attach_crtc(plane_cfg, crtc_cfg))
> goto err_alloc;
> @@ -115,6 +117,7 @@ struct vkms_config *vkms_config_default_create(bool enable_cursor,
> goto err_alloc;
>
> vkms_config_plane_set_type(plane_cfg, DRM_PLANE_TYPE_CURSOR);
> + vkms_config_plane_set_zpos_enabled(plane_cfg, false);
>
> if (vkms_config_plane_attach_crtc(plane_cfg, crtc_cfg))
> goto err_alloc;
> @@ -206,6 +209,24 @@ static bool valid_plane_properties(const struct vkms_config *config)
> drm_info(dev, "Configured default color range is not supported by the plane\n");
> return false;
> }
> + if (vkms_config_plane_get_zpos_initial(plane_cfg) >
> + vkms_config_plane_get_zpos_max(plane_cfg)) {
> + drm_info(dev, "Configured initial zpos value bigger than zpos max\n");
> + return false;
> + }
> +
> + if (vkms_config_plane_get_zpos_max(plane_cfg) <
> + vkms_config_plane_get_zpos_min(plane_cfg)) {
> + drm_info(dev, "Configured zpos max value smaller than zpos min\n");
> + return false;
> + }
> +
> + if (vkms_config_plane_get_zpos_initial(plane_cfg) <
> + vkms_config_plane_get_zpos_min(plane_cfg)) {
> + drm_info(dev, "Configured initial zpos value smaller than zpos min\n");
> + return false;
> + }
> +
Like I suggested with other validations, it'd be nice to extract this to a
helper to simplify testing.
Also, these properties are not listed in vkms_config_show().
> }
> return true;
> }
> diff --git a/drivers/gpu/drm/vkms/vkms_config.h b/drivers/gpu/drm/vkms/vkms_config.h
> index 0b7067508e5f..267e45f5a617 100644
> --- a/drivers/gpu/drm/vkms/vkms_config.h
> +++ b/drivers/gpu/drm/vkms/vkms_config.h
> @@ -49,6 +49,11 @@ struct vkms_config {
> * @supported_color_encoding: Color encoding that this plane will support
> * @default_color_range: Default color range that should be used by this plane
> * @supported_color_range: Color range that this plane will support
> + * @zpos_enable: Enable or disable the zpos property
@zpos_enabled
> + * @zpos_mutable: Make the zpos property mutable or not (ignored if @zpos_enable is false)
> + * @zpos_initial: Initial value for zpos property (ignored if @zpos_enable is false)
> + * @zpos_min: Minimal value for zpos property (ignored if @zpos_enable is false)
> + * @zpos_max: Maximal value for zpos property (ignored if @zpos_enable is false)
For these 4 as well: "(ignored if @zpos_enabled...".
> */
> struct vkms_config_plane {
> struct list_head link;
> @@ -65,6 +70,11 @@ struct vkms_config_plane {
> u32 *supported_formats;
> unsigned int supported_formats_count;
> struct xarray possible_crtcs;
> + bool zpos_enabled;
> + bool zpos_mutable;
> + unsigned int zpos_initial;
> + unsigned int zpos_min;
> + unsigned int zpos_max;
>
> /* Internal usage */
> struct vkms_plane *plane;
> @@ -477,6 +487,138 @@ vkms_config_plane_get_name(struct vkms_config_plane *plane_cfg)
> return plane_cfg->name;
> }
>
> +/**
> + * vkms_config_plane_set_zpos_enabled() - Enable or disable zpos property for a plane
> + * @plane_cfg: Plane configuration to modify
> + * @zpos_enabled: Whether to enable the zpos property
> + */
> +static inline
> +void vkms_config_plane_set_zpos_enabled(struct vkms_config_plane *plane_cfg,
> + bool zpos_enabled)
> +{
> + plane_cfg->zpos_enabled = zpos_enabled;
> +}
> +
> +/**
> + * vkms_config_plane_set_zpos_mutable() - Set whether zpos property is mutable
> + * @plane_cfg: Plane configuration to modify
> + * @zpos_mutable: Whether the zpos property should be mutable
> + */
> +static inline
> +void vkms_config_plane_set_zpos_mutable(struct vkms_config_plane *plane_cfg,
> + bool zpos_mutable)
> +{
> + plane_cfg->zpos_mutable = zpos_mutable;
> +}
> +
> +/**
> + * vkms_config_plane_set_zpos_initial() - Set the initial zpos value
> + * @plane_cfg: Plane configuration to modify
> + * @zpos_initial: Initial zpos value
> + */
> +static inline
> +void vkms_config_plane_set_zpos_initial(struct vkms_config_plane *plane_cfg,
> + unsigned int zpos_initial)
> +{
> + plane_cfg->zpos_initial = zpos_initial;
> +}
> +
> +/**
> + * vkms_config_plane_set_zpos_min() - Set the minimum zpos value
> + * @plane_cfg: Plane configuration to modify
> + * @zpos_min: Minimum zpos value
> + */
> +static inline
> +void vkms_config_plane_set_zpos_min(struct vkms_config_plane *plane_cfg,
> + unsigned int zpos_min)
> +{
> + plane_cfg->zpos_min = zpos_min;
> +}
> +
> +/**
> + * vkms_config_plane_set_zpos_max() - Set the maximum zpos value
> + * @plane_cfg: Plane configuration to modify
> + * @zpos_max: Maximum zpos value
> + *
> + * Sets the maximum allowed value for the zpos property. This setting is
> + * ignored if zpos is disabled.
> + */
> +static inline
> +void vkms_config_plane_set_zpos_max(struct vkms_config_plane *plane_cfg,
> + unsigned int zpos_max)
> +{
> + plane_cfg->zpos_max = zpos_max;
> +}
> +
> +/**
> + * vkms_config_plane_get_zpos_enabled() - Check if zpos property is enabled
> + * @plane_cfg: Plane configuration to check
> + *
> + * Returns:
> + * True if the zpos property is enabled for this plane, false otherwise.
> + */
> +static inline
> +bool vkms_config_plane_get_zpos_enabled(struct vkms_config_plane *plane_cfg)
> +{
> + return plane_cfg->zpos_enabled;
> +}
> +
> +/**
> + * vkms_config_plane_get_zpos_mutable() - Check if zpos property is mutable
> + * @plane_cfg: Plane configuration to check
> + *
> + * Returns:
> + * True if the zpos property is mutable for this plane, false otherwise.
> + * Returns false if zpos is disabled.
> + */
> +static inline
> +bool vkms_config_plane_get_zpos_mutable(struct vkms_config_plane *plane_cfg)
> +{
> + return plane_cfg->zpos_mutable;
> +}
> +
> +/**
> + * vkms_config_plane_get_zpos_initial() - Get the initial zpos value
> + * @plane_cfg: Plane configuration to check
> + *
> + * Returns:
> + * The initial zpos value for this plane. The return value is undefined if
> + * zpos is disabled.
> + */
> +static inline
> +unsigned int vkms_config_plane_get_zpos_initial(struct vkms_config_plane *plane_cfg)
> +{
> + return plane_cfg->zpos_initial;
> +}
> +
> +/**
> + * vkms_config_plane_get_zpos_min() - Get the minimum zpos value
> + * @plane_cfg: Plane configuration to check
> + *
> + * Returns:
> + * The minimum allowed zpos value for this plane. The return value is undefined
> + * if zpos is disabled.
> + */
> +static inline
> +unsigned int vkms_config_plane_get_zpos_min(struct vkms_config_plane *plane_cfg)
> +{
> + return plane_cfg->zpos_min;
> +}
> +
> +/**
> + * vkms_config_plane_get_zpos_max() - Get the maximum zpos value
> + * @plane_cfg: Plane configuration to check
> + *
> + * Returns:
> + * The maximum allowed zpos value for this plane. The return value is undefined
> + * if zpos is disabled.
> + */
> +static inline
> +unsigned int vkms_config_plane_get_zpos_max(struct vkms_config_plane *plane_cfg)
> +{
> + return plane_cfg->zpos_max;
> +}
> +
> /**
> * vkms_config_plane_attach_crtc - Attach a plane to a CRTC
> * @plane_cfg: Plane to attach
> diff --git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_plane.c
> index 0414865915d8..51f6372a6f72 100644
> --- a/drivers/gpu/drm/vkms/vkms_plane.c
> +++ b/drivers/gpu/drm/vkms/vkms_plane.c
> @@ -209,5 +209,16 @@ struct vkms_plane *vkms_plane_init(struct vkms_device *vkmsdev,
> vkms_config_plane_get_default_color_encoding(config),
> vkms_config_plane_get_default_color_range(config));
>
> + if (vkms_config_plane_get_zpos_enabled(config)) {
> + if (vkms_config_plane_get_zpos_mutable(config))
> + drm_plane_create_zpos_property(&plane->base,
> + vkms_config_plane_get_zpos_initial(config),
> + vkms_config_plane_get_zpos_min(config),
> + vkms_config_plane_get_zpos_max(config));
> + else
> + drm_plane_create_zpos_immutable_property(&plane->base,
> + vkms_config_plane_get_zpos_initial(config));
> + }
> +
> return plane;
> }
>
> --
> 2.51.0
>
next prev parent reply other threads:[~2025-10-27 9:12 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-18 2:01 [PATCH 00/22] VKMS: Introduce multiple configFS attributes Louis Chauvet
2025-10-18 2:01 ` [PATCH 01/22] drm/vkms: Introduce config for plane name Louis Chauvet
2025-10-24 11:16 ` José Expósito
2025-10-27 10:15 ` Jani Nikula
2025-10-18 2:01 ` [PATCH 02/22] drm/vkms: Introduce configfs " Louis Chauvet
2025-10-24 11:20 ` José Expósito
2025-10-18 2:01 ` [PATCH 03/22] drm/vkms: Introduce config for plane rotation Louis Chauvet
2025-10-24 11:53 ` José Expósito
2025-10-18 2:01 ` [PATCH 04/22] drm/vkms: Introduce configfs " Louis Chauvet
2025-10-24 14:50 ` José Expósito
2025-10-18 2:01 ` [PATCH 05/22] drm/vkms: Introduce config for plane color encoding Louis Chauvet
2025-10-24 15:14 ` José Expósito
2025-10-18 2:01 ` [PATCH 06/22] drm/vkms: Introduce configfs " Louis Chauvet
2025-10-24 15:16 ` José Expósito
2025-10-18 2:01 ` [PATCH 07/22] drm/vkms: Introduce config for plane color range Louis Chauvet
2025-10-24 15:25 ` José Expósito
2025-10-18 2:01 ` [PATCH 08/22] drm/vkms: Introduce configfs " Louis Chauvet
2025-10-24 15:27 ` José Expósito
2025-10-18 2:01 ` [PATCH 09/22] drm/vkms: Introduce config for plane format Louis Chauvet
2025-10-24 15:44 ` José Expósito
2025-10-18 2:01 ` [PATCH 10/22] drm/vkms: Introduce configfs " Louis Chauvet
2025-10-27 8:55 ` José Expósito
2025-10-18 2:01 ` [PATCH 11/22] drm/vkms: Properly render plane using their zpos Louis Chauvet
2025-10-18 2:01 ` [PATCH 12/22] drm/vkms: Introduce config for plane zpos property Louis Chauvet
2025-10-27 9:12 ` José Expósito [this message]
2025-10-18 2:01 ` [PATCH 13/22] drm/vkms: Introduce configfs " Louis Chauvet
2025-10-27 9:19 ` José Expósito
2025-10-18 2:01 ` [PATCH 14/22] drm/vkms: Introduce config for connector type Louis Chauvet
2025-10-27 9:27 ` José Expósito
2025-10-18 2:01 ` [PATCH 15/22] drm/vkms: Introduce configfs " Louis Chauvet
2025-10-18 2:01 ` [PATCH 16/22] drm/vkms: Introduce config for connector supported colorspace Louis Chauvet
2025-10-27 9:35 ` José Expósito
2025-10-27 9:38 ` José Expósito
2025-10-18 2:01 ` [PATCH 17/22] drm/vkms: Introduce configfs " Louis Chauvet
2025-10-18 2:01 ` [PATCH 18/22] drm/vkms: Introduce config for connector EDID Louis Chauvet
2025-10-27 10:02 ` José Expósito
2025-10-18 2:01 ` [PATCH 19/22] drm/vkms: Introduce configfs " Louis Chauvet
2025-10-27 10:16 ` José Expósito
2025-10-27 17:18 ` Louis Chauvet
2025-10-18 2:01 ` [PATCH 20/22] drm/vkms: Store the enabled/disabled status for connector Louis Chauvet
2025-10-27 14:52 ` José Expósito
2025-10-18 2:01 ` [PATCH 21/22] drm/vkms: Allow to hot-add connectors Louis Chauvet
2025-10-27 15:01 ` José Expósito
2025-10-18 2:01 ` [PATCH 22/22] drm/vkms: Allows the creation of connector at runtime Louis Chauvet
2025-10-27 15:17 ` José Expósito
2025-10-27 15:22 ` [PATCH 00/22] VKMS: Introduce multiple configFS attributes José Expósito
2025-10-27 15:53 ` Louis Chauvet
2025-10-28 7:32 ` José Expósito
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aP83fl899vwZKsD1@fedora \
--to=jose.exposito89@gmail.com \
--cc=airlied@gmail.com \
--cc=corbet@lwn.net \
--cc=dri-devel@lists.freedesktop.org \
--cc=hamohammed.sa@gmail.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=louis.chauvet@bootlin.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=melissa.srw@gmail.com \
--cc=mripard@kernel.org \
--cc=sebastian.wick@redhat.com \
--cc=simona@ffwll.ch \
--cc=thomas.petazzoni@bootlin.com \
--cc=tzimmermann@suse.de \
--cc=victoria@system76.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).