[PATCH RFC 09/15] drm/vkms: Introduce configuration for plane color encoding
Louis Chauvet
louis.chauvet at bootlin.com
Wed Aug 14 14:36:31 UTC 2024
VKMS driver supports all the color encoding on planes, but for testing it
can be useful to only advertise few of them. This new configuration
interface will allow configuring the color encoding per planes.
Signed-off-by: Louis Chauvet <louis.chauvet at bootlin.com>
---
drivers/gpu/drm/vkms/vkms_config.c | 15 +++++++++++++++
drivers/gpu/drm/vkms/vkms_config.h | 4 ++++
drivers/gpu/drm/vkms/vkms_plane.c | 6 ++----
3 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/vkms/vkms_config.c b/drivers/gpu/drm/vkms/vkms_config.c
index 2a24da9c0fc9..dabb8cb13314 100644
--- a/drivers/gpu/drm/vkms/vkms_config.c
+++ b/drivers/gpu/drm/vkms/vkms_config.c
@@ -82,6 +82,11 @@ struct vkms_config_plane *vkms_config_create_plane(struct vkms_config *vkms_conf
vkms_config_overlay->type = DRM_PLANE_TYPE_OVERLAY;
vkms_config_overlay->supported_rotations = DRM_MODE_ROTATE_MASK | DRM_MODE_REFLECT_MASK;
vkms_config_overlay->default_rotation = DRM_MODE_ROTATE_0;
+ vkms_config_overlay->supported_color_encoding = BIT(DRM_COLOR_YCBCR_BT601) |
+ BIT(DRM_COLOR_YCBCR_BT709) |
+ BIT(DRM_COLOR_YCBCR_BT2020);
+ vkms_config_overlay->default_color_encoding = DRM_COLOR_YCBCR_BT601;
+
list_add(&vkms_config_overlay->link, &vkms_config->planes);
@@ -121,6 +126,12 @@ bool vkms_config_is_valid(struct vkms_config *config)
config_plane->default_rotation)
return false;
+ // Default color range not in supported color range
+ if ((BIT(config_plane->default_color_encoding) &
+ config_plane->supported_color_encoding) !=
+ BIT(config_plane->default_color_encoding))
+ return false;
+
if (config_plane->type == DRM_PLANE_TYPE_PRIMARY) {
// Multiple primary planes for only one CRTC
if (has_primary)
@@ -155,6 +166,10 @@ static int vkms_config_show(struct seq_file *m, void *data)
seq_printf(m, "\ttype: %d\n", config_plane->type);
seq_printf(m, "\tsupported rotations: 0x%x\n", config_plane->supported_rotations);
seq_printf(m, "\tdefault rotation: 0x%x\n", config_plane->default_rotation);
+ seq_printf(m, "\tsupported color encoding: 0x%x\n",
+ config_plane->supported_color_encoding);
+ seq_printf(m, "\tdefault color encoding: %d\n",
+ config_plane->default_color_encoding);
}
return 0;
diff --git a/drivers/gpu/drm/vkms/vkms_config.h b/drivers/gpu/drm/vkms/vkms_config.h
index 77a72a3a637c..c8802bfb9ab2 100644
--- a/drivers/gpu/drm/vkms/vkms_config.h
+++ b/drivers/gpu/drm/vkms/vkms_config.h
@@ -30,6 +30,8 @@ struct vkms_config {
* plane is primary.
* @default_rotation: Default rotation that should be used by this plane
* @supported_rotation: Rotation that this plane will support
+ * @default_color_encoding: Default color encoding that should be used by this plane
+ * @supported_color_encoding: Color encoding that this plane will support
* @plane: Internal usage. This pointer should never be considered as valid. It can be used to
* store a temporary reference to a vkms plane during device creation. This pointer is
* not managed by the configuration and must be managed by other means.
@@ -41,6 +43,8 @@ struct vkms_config_plane {
enum drm_plane_type type;
unsigned int default_rotation;
unsigned int supported_rotations;
+ enum drm_color_encoding default_color_encoding;
+ unsigned int supported_color_encoding;
/* Internal usage */
struct vkms_plane *plane;
diff --git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_plane.c
index 3a2b8b0b5980..ef20da7ccb17 100644
--- a/drivers/gpu/drm/vkms/vkms_plane.c
+++ b/drivers/gpu/drm/vkms/vkms_plane.c
@@ -242,12 +242,10 @@ struct vkms_plane *vkms_plane_init(struct vkms_device *vkmsdev,
config->supported_rotations);
drm_plane_create_color_properties(&plane->base,
- BIT(DRM_COLOR_YCBCR_BT601) |
- BIT(DRM_COLOR_YCBCR_BT709) |
- BIT(DRM_COLOR_YCBCR_BT2020),
+ config->supported_color_encoding,
BIT(DRM_COLOR_YCBCR_LIMITED_RANGE) |
BIT(DRM_COLOR_YCBCR_FULL_RANGE),
- DRM_COLOR_YCBCR_BT601,
+ config->default_color_encoding,
DRM_COLOR_YCBCR_FULL_RANGE);
return plane;
--
2.44.2
More information about the dri-devel
mailing list