From nobody Mon Feb 9 09:32:24 2026 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0E88D34AAF0; Wed, 29 Oct 2025 13:30:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.171.202.116 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761744661; cv=none; b=tJ1qM4m9ri2A6Nm9f11fCWpwRyFEN4V/4iCAdeTkqChevmE9UgIekZlk5zFfPlPJ2VH5jW30zqIRDULrNEvAF5GP5Qub41jQAJ8xwlrC9fek3D1IDU4+aUF+zCepjb3gARZowvvK7kDwCxNUl4TAjKGGv3Y5Chc0tIPs0ClNAyU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761744661; c=relaxed/simple; bh=mKwvYcW2Hz25Zl72QZxI3VVT1IcCPbam0gHPfRqJ4iY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dYursKXR2aqCp+rtWiEmvwh8+DTzV1Pzs7M0cKJ6cu1mTwv32Bf43sx8aah4iS34uw7Ddbj6AsTfNkC7NrxfQo9A5elAlh9hb08P9Zmog3+8o6xIKw3MdrYcWOTdoMrh9FSwAmkTo0bj1yhJgFmEvWQZWUpWjqdJd0bs8oTnqeQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=cA0YQQaM; arc=none smtp.client-ip=185.171.202.116 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="cA0YQQaM" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 84F32C0DB00; Wed, 29 Oct 2025 13:30:37 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id DB13E606E8; Wed, 29 Oct 2025 13:30:57 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 6BB4F117F809C; Wed, 29 Oct 2025 14:30:55 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1761744657; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=ZDoaOquusQDSLp7HQRJOshugz0KBDod0mdS1BtA/zy4=; b=cA0YQQaMNeEuA3kvPZ25VVCEA4XgzfRtSRGLgjhQ7CUhRgDpc9/rRPyMoLTT+iqMFupZ09 HK/aADi4XFfIejlSw9ELUyMHJPWXhZ8Z5wRu1Bsa1zI/S2NHcRr77zGhKm+PVlHYUFUm2g 9fk70L/IjC64kzTAvHGMq9CRfVhsWYNIXRNyYiThy/lxBt1gsysSQNOypXnVRIsV90ep4Y FGdEg28mUlHiK5ZCMlnyIOcVYaGaFmvC5xKRSP2jnJiWVqFZ7STQo7DTMDYiSOw5I05GJR eN9HQbNTNBpFdbZgvOlRwo/MOXhGSOZOJEpnXV4e1IIYnKuEBCvfeiP/wM7N6w== From: Louis Chauvet Date: Wed, 29 Oct 2025 14:30:29 +0100 Subject: [PATCH v2 19/32] drm/vkms: Introduce config for plane zpos property Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251029-vkms-all-config-v2-19-be20b9bf146e@bootlin.com> References: <20251029-vkms-all-config-v2-0-be20b9bf146e@bootlin.com> In-Reply-To: <20251029-vkms-all-config-v2-0-be20b9bf146e@bootlin.com> To: Haneen Mohammed , Simona Vetter , Melissa Wen , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , jose.exposito89@gmail.com, Jonathan Corbet Cc: victoria@system76.com, sebastian.wick@redhat.com, victoria@system76.com, airlied@gmail.com, thomas.petazzoni@bootlin.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Louis Chauvet X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=15646; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=mKwvYcW2Hz25Zl72QZxI3VVT1IcCPbam0gHPfRqJ4iY=; b=owEBbQKS/ZANAwAKASCtLsZbECziAcsmYgBpAhbrWkxSQvzUh1wyFwNkd1vouPNsL+DuviekT y/Il1+DyRGJAjMEAAEKAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCaQIW6wAKCRAgrS7GWxAs 4nTOD/40KcQkoGCrs2660aCejXv+bLHBcDL0sSHueGQabF7K2qY6YSV9/j6OIf7LhUHNQZ+g0Q3 0cURBj7T4NOCxqBGcNaKnYMzJPU93GCRCpwybgyE2MlPLoRc5zgZ22bMCOunEAsHJGE2ZihPcZC Oh0mG5OpsSmkJnCCHfbqziT8WGbnIkfXjStfONLC69GXPFPZhFaJM6BhNjOWcq4iJBLhmwS+azr 4Y4R8DmQSudRwkrdRdMMq9dLgsj9J287ZjpbNfl39AUOkmmESFpqC9g9YFZ5R+uBtb4dmkGhxiO AQt2W7ZALZDV+RYl3yVdkQPXmfcqseKaDlO7H2oPyWU3l7030Ui9pFEksRq3K5glXbF9/RAuVwk NUE0GCfvDNo7krZPTdwtQuek+267/mm3E8XQd0FjS/UxrvYZMRaL9CAzvU1lPGq+zMvVUTlZhqR 2O8w++/siRetV+nIX11a/3wWHKhR/0DopVIBu99/qaY5Wyqgwgb0L/oPWjqdUj1RDy39zDu31gC Btx5qlq4r8g+2jmKdgwVdf7dtTtnJPNL5mDsP8uMkwNqClC/CpauySMFD9sOcjtdog/b+b7OXt3 OsFPKtgQ6i8ips19ZsgLY8GDJyY+tLkjzsVQF1WPwfme43tIvImZokpTiK8awqg3owjzMBJtmSx rRigN9WMrvlhNyw== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-Last-TLS-Session-Version: TLSv1.3 VKMS can render plane in any order. Introduce the appropriate configuration. Signed-off-by: Louis Chauvet --- drivers/gpu/drm/vkms/tests/vkms_config_test.c | 92 ++++++++++++++++ drivers/gpu/drm/vkms/vkms_config.c | 47 ++++++++ drivers/gpu/drm/vkms/vkms_config.h | 147 ++++++++++++++++++++++= ++++ drivers/gpu/drm/vkms/vkms_plane.c | 11 ++ 4 files changed, 297 insertions(+) diff --git a/drivers/gpu/drm/vkms/tests/vkms_config_test.c b/drivers/gpu/dr= m/vkms/tests/vkms_config_test.c index d962fec8d3b3..518e68c17122 100644 --- a/drivers/gpu/drm/vkms/tests/vkms_config_test.c +++ b/drivers/gpu/drm/vkms/tests/vkms_config_test.c @@ -188,6 +188,9 @@ static void vkms_config_test_default_config(struct kuni= t *test) KUNIT_EXPECT_EQ(test, vkms_config_plane_get_default_color_encoding(plane_cfg), DRM_COLOR_YCBCR_BT601); + KUNIT_EXPECT_EQ(test, vkms_config_plane_get_zpos_enabled(plane_cfg), fal= se); + // No need to test the other zpos configurations as they are discarded if + // the zpos property is not created. } =20 /* Encoders */ @@ -606,6 +609,94 @@ static void vkms_config_test_valid_plane_color_range(s= truct kunit *test) vkms_config_destroy(config); } =20 +static void vkms_config_test_valid_plane_zpos(struct kunit *test) +{ + struct vkms_config *config; + struct vkms_config_plane *plane_cfg; + + config =3D vkms_config_default_create(false, false, false); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, config); + + plane_cfg =3D get_first_plane(config); + + /* Valid, all color range supported */ + plane_cfg =3D get_first_plane(config); + + /* Valid, zpos disabled */ + vkms_config_plane_set_zpos_enabled(plane_cfg, false); + vkms_config_plane_set_zpos_mutable(plane_cfg, false); + vkms_config_plane_set_zpos_initial(plane_cfg, 0); + vkms_config_plane_set_zpos_min(plane_cfg, 0); + vkms_config_plane_set_zpos_max(plane_cfg, 0); + KUNIT_EXPECT_TRUE(test, vkms_config_is_valid(config)); + + /* Valid, zpos disabled, min/max are ignored */ + vkms_config_plane_set_zpos_enabled(plane_cfg, false); + vkms_config_plane_set_zpos_mutable(plane_cfg, false); + vkms_config_plane_set_zpos_initial(plane_cfg, 8); + vkms_config_plane_set_zpos_min(plane_cfg, 3); + vkms_config_plane_set_zpos_max(plane_cfg, 2); + KUNIT_EXPECT_TRUE(test, vkms_config_is_valid(config)); + + /* Valid, zpos enabled but initial value is out of range */ + vkms_config_plane_set_zpos_enabled(plane_cfg, true); + vkms_config_plane_set_zpos_mutable(plane_cfg, false); + vkms_config_plane_set_zpos_initial(plane_cfg, 1); + vkms_config_plane_set_zpos_min(plane_cfg, 0); + vkms_config_plane_set_zpos_max(plane_cfg, 0); + KUNIT_EXPECT_TRUE(test, vkms_config_is_valid(config)); + + /* Valid, zpos enabled with valid initial value */ + vkms_config_plane_set_zpos_enabled(plane_cfg, true); + vkms_config_plane_set_zpos_mutable(plane_cfg, false); + vkms_config_plane_set_zpos_initial(plane_cfg, 0); + vkms_config_plane_set_zpos_min(plane_cfg, 0); + vkms_config_plane_set_zpos_max(plane_cfg, 0); + KUNIT_EXPECT_TRUE(test, vkms_config_is_valid(config)); + + /* Invalid, zpos enabled with min > max */ + vkms_config_plane_set_zpos_enabled(plane_cfg, true); + vkms_config_plane_set_zpos_mutable(plane_cfg, true); + vkms_config_plane_set_zpos_initial(plane_cfg, 0); + vkms_config_plane_set_zpos_min(plane_cfg, 1); + vkms_config_plane_set_zpos_max(plane_cfg, 0); + KUNIT_EXPECT_FALSE(test, vkms_config_is_valid(config)); + + /* Valid, zpos enabled with min <=3D max */ + vkms_config_plane_set_zpos_enabled(plane_cfg, true); + vkms_config_plane_set_zpos_mutable(plane_cfg, true); + vkms_config_plane_set_zpos_initial(plane_cfg, 0); + vkms_config_plane_set_zpos_min(plane_cfg, 0); + vkms_config_plane_set_zpos_max(plane_cfg, 1); + KUNIT_EXPECT_TRUE(test, vkms_config_is_valid(config)); + + /* Invalid, zpos enabled with initial < min */ + vkms_config_plane_set_zpos_enabled(plane_cfg, true); + vkms_config_plane_set_zpos_mutable(plane_cfg, true); + vkms_config_plane_set_zpos_initial(plane_cfg, 0); + vkms_config_plane_set_zpos_min(plane_cfg, 1); + vkms_config_plane_set_zpos_max(plane_cfg, 2); + KUNIT_EXPECT_FALSE(test, vkms_config_is_valid(config)); + + /* Invalid, zpos enabled with initial > max */ + vkms_config_plane_set_zpos_enabled(plane_cfg, true); + vkms_config_plane_set_zpos_mutable(plane_cfg, true); + vkms_config_plane_set_zpos_initial(plane_cfg, 3); + vkms_config_plane_set_zpos_min(plane_cfg, 1); + vkms_config_plane_set_zpos_max(plane_cfg, 2); + KUNIT_EXPECT_FALSE(test, vkms_config_is_valid(config)); + + /* Valid, zpos enabled with initial between min and max */ + vkms_config_plane_set_zpos_enabled(plane_cfg, true); + vkms_config_plane_set_zpos_mutable(plane_cfg, true); + vkms_config_plane_set_zpos_initial(plane_cfg, 1); + vkms_config_plane_set_zpos_min(plane_cfg, 0); + vkms_config_plane_set_zpos_max(plane_cfg, 2); + KUNIT_EXPECT_TRUE(test, vkms_config_is_valid(config)); + + vkms_config_destroy(config); +} + static void vkms_config_test_valid_plane_possible_crtcs(struct kunit *test) { struct vkms_config *config; @@ -1131,6 +1222,7 @@ static struct kunit_case vkms_config_test_cases[] =3D= { KUNIT_CASE(vkms_config_test_valid_plane_rotations), KUNIT_CASE(vkms_config_test_valid_plane_color_encoding), KUNIT_CASE(vkms_config_test_valid_plane_color_range), + KUNIT_CASE(vkms_config_test_valid_plane_zpos), KUNIT_CASE(vkms_config_test_valid_plane_possible_crtcs), KUNIT_CASE(vkms_config_test_invalid_crtc_number), KUNIT_CASE(vkms_config_test_invalid_encoder_number), diff --git a/drivers/gpu/drm/vkms/vkms_config.c b/drivers/gpu/drm/vkms/vkms= _config.c index a3fb80451b30..801019cf04c1 100644 --- a/drivers/gpu/drm/vkms/vkms_config.c +++ b/drivers/gpu/drm/vkms/vkms_config.c @@ -90,6 +90,7 @@ struct vkms_config *vkms_config_default_create(bool enabl= e_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); =20 crtc_cfg =3D vkms_config_create_crtc(config); if (IS_ERR(crtc_cfg)) @@ -107,6 +108,7 @@ struct vkms_config *vkms_config_default_create(bool ena= ble_cursor, =20 vkms_config_plane_set_type(plane_cfg, DRM_PLANE_TYPE_OVERLAY); + vkms_config_plane_set_zpos_enabled(plane_cfg, false); =20 if (vkms_config_plane_attach_crtc(plane_cfg, crtc_cfg)) goto err_alloc; @@ -119,6 +121,7 @@ struct vkms_config *vkms_config_default_create(bool ena= ble_cursor, goto err_alloc; =20 vkms_config_plane_set_type(plane_cfg, DRM_PLANE_TYPE_CURSOR); + vkms_config_plane_set_zpos_enabled(plane_cfg, false); =20 if (vkms_config_plane_attach_crtc(plane_cfg, crtc_cfg)) goto err_alloc; @@ -249,6 +252,37 @@ bool vkms_config_valid_plane_color_range(const struct = vkms_config *config, } EXPORT_SYMBOL_IF_KUNIT(vkms_config_valid_plane_color_range); =20 +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 =3D 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)) { + 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; + } + + return true; +} + static bool valid_planes_for_crtc(const struct vkms_config *config, struct vkms_config_crtc *crtc_cfg) { @@ -425,6 +459,9 @@ bool vkms_config_is_valid(const struct vkms_config *con= fig) "Both supported color encoding and color range must be set, or none\n= "); return false; } + + if (!vkms_config_valid_plane_zpos(config, plane_cfg)) + return false; } =20 if (!valid_plane_number(config)) @@ -526,6 +563,16 @@ static int vkms_config_show(struct seq_file *m, void *= data) show_formats(m, vkms_config_plane_get_supported_formats(plane_cfg), vkms_config_plane_get_supported_formats_count(plane_cfg)); seq_puts(m, "\n"); + seq_printf(m, "\tzpos_enabled=3D%s\n", + str_true_false(vkms_config_plane_get_zpos_enabled(plane_cfg))); + seq_printf(m, "\tzpos_mutable=3D%s\n", + str_true_false(vkms_config_plane_get_zpos_mutable(plane_cfg))); + seq_printf(m, "\tzpos_min=3D%d\n", + vkms_config_plane_get_zpos_min(plane_cfg)); + seq_printf(m, "\tzpos_initial=3D%d\n", + vkms_config_plane_get_zpos_initial(plane_cfg)); + seq_printf(m, "\tzpos_max=3D%d\n", + vkms_config_plane_get_zpos_max(plane_cfg)); } =20 vkms_config_for_each_crtc(vkmsdev->config, crtc_cfg) { diff --git a/drivers/gpu/drm/vkms/vkms_config.h b/drivers/gpu/drm/vkms/vkms= _config.h index 2d9e35b7caad..baed036a07cd 100644 --- a/drivers/gpu/drm/vkms/vkms_config.h +++ b/drivers/gpu/drm/vkms/vkms_config.h @@ -51,6 +51,11 @@ struct vkms_config { * @supported_color_ranges: Color range that this plane will support * @supported_formats: List of supported formats * @supported_formats_count: Length of @supported_formats + * @zpos_enabled: Enable or disable the zpos property + * @zpos_mutable: Make the zpos property mutable or not (ignored if @zpos_= enabled is false) + * @zpos_initial: Initial value for zpos property (ignored if @zpos_enable= d is false) + * @zpos_min: Minimal value for zpos property (ignored if @zpos_enabled is= false) + * @zpos_max: Maximal value for zpos property (ignored if @zpos_enabled is= false) */ struct vkms_config_plane { struct list_head link; @@ -67,6 +72,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; =20 /* Internal usage */ struct vkms_plane *plane; @@ -523,6 +533,143 @@ vkms_config_plane_get_name(const struct vkms_config_p= lane *plane_cfg) return plane_cfg->name; } =20 +/** + * 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_cf= g, + bool zpos_enabled) +{ + plane_cfg->zpos_enabled =3D zpos_enabled; +} + +/** + * vkms_config_plane_set_zpos_mutable() - Set whether zpos property is mut= able + * @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_cf= g, + bool zpos_mutable) +{ + plane_cfg->zpos_mutable =3D 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_cf= g, + unsigned int zpos_initial) +{ + plane_cfg->zpos_initial =3D 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 =3D 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 =3D 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(const struct vkms_config_plane *pl= ane_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(const struct vkms_config_plane *pl= ane_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(const struct vkms_config_p= lane *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 unde= fined + * if zpos is disabled. + */ +static inline +unsigned int vkms_config_plane_get_zpos_min(const 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 unde= fined + * if zpos is disabled. + */ +static inline +unsigned int vkms_config_plane_get_zpos_max(const struct vkms_config_plane= *plane_cfg) +{ + return plane_cfg->zpos_max; +} + +#if IS_ENABLED(CONFIG_KUNIT) +bool vkms_config_valid_plane_zpos(const struct vkms_config *config, + const struct vkms_config_plane *plane_cfg); +#endif + /** * 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 945abbbeac99..11a6b7bc74a7 100644 --- a/drivers/gpu/drm/vkms/vkms_plane.c +++ b/drivers/gpu/drm/vkms/vkms_plane.c @@ -211,5 +211,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)); =20 + 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; } --=20 2.51.0