@@ -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;
@@ -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;
@@ -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;
}
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@bootlin.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(-)