Re: [PATCH v3 20/33] drm/vkms: Introduce config for plane zpos property

Luca Ceresoli
2025-12-23T15:18:09Z

On Mon Dec 22, 2025 at 11:11 AM CET, Louis Chauvet wrote:
> VKMS can render plane in any order. Introduce the appropriate
> configuration.
>
> Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>

> @@ -253,6 +256,33 @@ bool vkms_config_valid_plane_color_range(const struct vkms_config *config,
> }
> EXPORT_SYMBOL_IF_KUNIT(vkms_config_valid_plane_color_range);
>
> +VISIBLE_IF_KUNIT
> +bool vkms_config_valid_plane_zpos(const struct vkms_config *config,
> + const struct vkms_config_plane *plane_cfg)
> +{
> + struct drm_device *dev = config->dev ? &config->dev->drm : NULL;
> +
> + if (!vkms_config_plane_get_zpos_enabled(plane_cfg) ||
> + !vkms_config_plane_get_zpos_mutable(plane_cfg))
> + return true;
> +
> + 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) ||
> + vkms_config_plane_get_zpos_initial(plane_cfg) <
> + vkms_config_plane_get_zpos_min(plane_cfg)) {
> + drm_info(dev, "Configured zpos value outside (zpos min; zpos max)\n");
> + return false;
> + }

Weird grouping. It should rather be:

if (max < min) {...}

if (initial > max || initial < min) {...}

Luca

--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering