backend-drm: Add support for YUV plane color properties

The drm_color_encoding and drm_color_range enums are used for
YUV->RGB conversion and mirror what EGL_YUV_COLOR_SPACE_HINT_EXT
and EGL_SAMPLE_RANGE_HINT_EXT as well as our `yuva2rgba()`
shader func do. Add the necessary boiler plate for them.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
This commit is contained in:
Robert Mader 2024-11-27 07:37:01 +01:00 committed by Marius Vlad
parent 264c205add
commit 16e5406877
2 changed files with 53 additions and 1 deletions

View file

@ -56,6 +56,8 @@ enum wdrm_plane_property {
WDRM_PLANE_ZPOS,
WDRM_PLANE_ROTATION,
WDRM_PLANE_ALPHA,
WDRM_PLANE_COLOR_ENCODING,
WDRM_PLANE_COLOR_RANGE,
WDRM_PLANE__COUNT
};
@ -82,6 +84,25 @@ enum wdrm_plane_rotation {
WDRM_PLANE_ROTATION__COUNT,
};
/**
* Possible values for the WDRM_PLANE_COLOR_ENCODING property.
*/
enum wdrm_plane_color_encoding {
WDRM_PLANE_COLOR_ENCODING_BT601 = 0,
WDRM_PLANE_COLOR_ENCODING_BT709,
WDRM_PLANE_COLOR_ENCODING_BT2020,
WDRM_PLANE_COLOR_ENCODING__COUNT
};
/**
* Possible values for the WDRM_PLANE_COLOR_RANGE property.
*/
enum wdrm_plane_color_range {
WDRM_PLANE_COLOR_RANGE_LIMITED = 0,
WDRM_PLANE_COLOR_RANGE_FULL,
WDRM_PLANE_COLOR_RANGE__COUNT
};
/**
* List of properties attached to a DRM connector
*/

View file

@ -79,6 +79,27 @@ struct drm_property_enum_info plane_rotation_enums[] = {
},
};
struct drm_property_enum_info plane_color_encoding_enums[] = {
[WDRM_PLANE_COLOR_ENCODING_BT601] = {
.name = "ITU-R BT.601 YCbCr",
},
[WDRM_PLANE_COLOR_ENCODING_BT709] = {
.name = "ITU-R BT.709 YCbCr",
},
[WDRM_PLANE_COLOR_ENCODING_BT2020] = {
.name = "ITU-R BT.2020 YCbCr",
},
};
struct drm_property_enum_info plane_color_range_enums[] = {
[WDRM_PLANE_COLOR_RANGE_LIMITED] = {
.name = "YCbCr limited range",
},
[WDRM_PLANE_COLOR_RANGE_FULL] = {
.name = "YCbCr full range",
},
};
const struct drm_property_info plane_props[] = {
[WDRM_PLANE_TYPE] = {
.name = "type",
@ -103,8 +124,18 @@ const struct drm_property_info plane_props[] = {
.name = "rotation",
.enum_values = plane_rotation_enums,
.num_enum_values = WDRM_PLANE_ROTATION__COUNT,
},
},
[WDRM_PLANE_ALPHA] = { .name = "alpha" },
[WDRM_PLANE_COLOR_ENCODING] = {
.name = "COLOR_ENCODING",
.enum_values = plane_color_encoding_enums,
.num_enum_values = WDRM_PLANE_COLOR_ENCODING__COUNT,
},
[WDRM_PLANE_COLOR_RANGE] = {
.name = "COLOR_RANGE",
.enum_values = plane_color_range_enums,
.num_enum_values = WDRM_PLANE_COLOR_RANGE__COUNT,
},
};
struct drm_property_enum_info dpms_state_enums[] = {