@@ -84,6 +84,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);
@@ -125,6 +130,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)
@@ -160,6 +171,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;
@@ -32,6 +32,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.
@@ -43,6 +45,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;
@@ -239,12 +239,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;
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@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(-)