[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241122-google-remove-crtc-index-from-parameter-v2-8-81540742535a@bootlin.com>
Date: Fri, 22 Nov 2024 18:20:12 +0100
From: Louis Chauvet <louis.chauvet@...tlin.com>
To: MaĆra Canal <mairacanal@...eup.net>,
Haneen Mohammed <hamohammed.sa@...il.com>, Simona Vetter <simona@...ll.ch>,
Melissa Wen <melissa.srw@...il.com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...il.com>
Cc: arthurgrillo@...eup.net, jeremie.dautheribes@...tlin.com,
miquel.raynal@...tlin.com, thomas.petazzoni@...tlin.com,
seanpaul@...gle.com, nicolejadeyee@...gle.com, linux-kernel@...r.kernel.org,
dri-devel@...ts.freedesktop.org, Louis Chauvet <louis.chauvet@...tlin.com>
Subject: [PATCH RFC v2 08/18] drm/vkms: Introduce config for plane color
range
VKMS driver supports all the color range on planes, but for testing it can
be useful to only advertise few of them. This new configuration interface
will allow configuring the color range per planes.
Signed-off-by: Louis Chauvet <louis.chauvet@...tlin.com>
---
drivers/gpu/drm/vkms/vkms_config.c | 14 +++++++++++++-
drivers/gpu/drm/vkms/vkms_config.h | 4 ++++
drivers/gpu/drm/vkms/vkms_plane.c | 5 ++---
3 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/vkms/vkms_config.c b/drivers/gpu/drm/vkms/vkms_config.c
index 9f9ebe674f6cbe03ac15e5380e4584c40a8bdea7..10fef173fba921e9abacb5e6dfd292b396694815 100644
--- a/drivers/gpu/drm/vkms/vkms_config.c
+++ b/drivers/gpu/drm/vkms/vkms_config.c
@@ -88,7 +88,9 @@ struct vkms_config_plane *vkms_config_create_plane(struct vkms_config *vkms_conf
BIT(DRM_COLOR_YCBCR_BT709) |
BIT(DRM_COLOR_YCBCR_BT2020);
vkms_config_overlay->default_color_encoding = DRM_COLOR_YCBCR_BT601;
-
+ vkms_config_overlay->supported_color_range = BIT(DRM_COLOR_YCBCR_LIMITED_RANGE) |
+ BIT(DRM_COLOR_YCBCR_FULL_RANGE);
+ vkms_config_overlay->default_color_range = DRM_COLOR_YCBCR_FULL_RANGE;
list_add(&vkms_config_overlay->link, &vkms_config->planes);
@@ -136,6 +138,12 @@ bool vkms_config_is_valid(struct vkms_config *config)
BIT(config_plane->default_color_encoding))
return false;
+ // Default color range not in supported color range
+ if ((BIT(config_plane->default_color_range) &
+ config_plane->supported_color_range) !=
+ BIT(config_plane->default_color_range))
+ return false;
+
if (config_plane->type == DRM_PLANE_TYPE_PRIMARY) {
// Multiple primary planes for only one CRTC
if (has_primary)
@@ -175,6 +183,10 @@ static int vkms_config_show(struct seq_file *m, void *data)
config_plane->supported_color_encoding);
seq_printf(m, "\tdefault color encoding: %d\n",
config_plane->default_color_encoding);
+ seq_printf(m, "\tsupported color range: 0x%x\n",
+ config_plane->supported_color_range);
+ seq_printf(m, "\tdefault color range: %d\n",
+ config_plane->default_color_range);
}
return 0;
diff --git a/drivers/gpu/drm/vkms/vkms_config.h b/drivers/gpu/drm/vkms/vkms_config.h
index 6cc9b89a996fe26c04951981cfeff7b603c6aec4..8a58c633f9d4649308ce0c536acfcffb03c0617f 100644
--- a/drivers/gpu/drm/vkms/vkms_config.h
+++ b/drivers/gpu/drm/vkms/vkms_config.h
@@ -34,6 +34,8 @@ struct vkms_config {
* @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
+ * @default_color_range: Default color range that should be used by this plane
+ * @supported_color_range: Color range 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.
@@ -47,6 +49,8 @@ struct vkms_config_plane {
unsigned int supported_rotations;
enum drm_color_encoding default_color_encoding;
unsigned int supported_color_encoding;
+ enum drm_color_range default_color_range;
+ unsigned int supported_color_range;
/* 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 77704ee2d49d2ce1551f67cab6308dc69b329ef5..90a5946481e47ab7cff9b9dc4942720b6bbcbe3f 100644
--- a/drivers/gpu/drm/vkms/vkms_plane.c
+++ b/drivers/gpu/drm/vkms/vkms_plane.c
@@ -240,10 +240,9 @@ struct vkms_plane *vkms_plane_init(struct vkms_device *vkmsdev,
drm_plane_create_color_properties(&plane->base,
config->supported_color_encoding,
- BIT(DRM_COLOR_YCBCR_LIMITED_RANGE) |
- BIT(DRM_COLOR_YCBCR_FULL_RANGE),
+ config->supported_color_range,
config->default_color_encoding,
- DRM_COLOR_YCBCR_FULL_RANGE);
+ config->default_color_range);
return plane;
}
--
2.47.0
Powered by blists - more mailing lists