[PATCH V10 17/30] lib/igt_color: Support color transform for XRGB2101010

Aurabindo Pillai aurabindo.pillai at amd.com
Tue Aug 26 16:28:13 UTC 2025



On 8/15/25 12:06 AM, Alex Hung wrote:
> From: Harry Wentland <harry.wentland at amd.com>
> 
> Support color format XRGB2101010.
> 
> Signed-off-by: Alex Hung <alex.hung at amd.com>
> Signed-off-by: Harry Wentland <harry.wentland at amd.com>
> ---
>   lib/igt_color.c     | 113 +++++++++++++++++++++++++++-----------------
>   tests/kms_colorop.c |   3 ++
>   2 files changed, 73 insertions(+), 43 deletions(-)
> 
> diff --git a/lib/igt_color.c b/lib/igt_color.c
> index bc90fbdca..adf08fa2a 100644
> --- a/lib/igt_color.c
> +++ b/lib/igt_color.c
> @@ -132,6 +132,74 @@ void igt_color_ctm_3x4_bt709_dec(igt_pixel_t *pixel)
>   	igt_color_apply_3x4_ctm(pixel, &igt_matrix_3x4_bt709_dec);
>   }
>   
> +static void
> +igt_color_fourcc_to_pixel(uint32_t raw_pixel, uint32_t drm_format, igt_pixel_t *pixel)
> +{
> +	if (drm_format == DRM_FORMAT_XRGB8888) {
> +		raw_pixel &= 0x00ffffff;
> +
> +		pixel->r = (raw_pixel & 0x00ff0000) >> 16;
> +		pixel->g = (raw_pixel & 0x0000ff00) >> 8;
> +		pixel->b = (raw_pixel & 0x000000ff);
> +
> +		/* normalize for 8-bit */
> +		pixel->r /= (0xff);
> +		pixel->g /= (0xff);
> +		pixel->b /= (0xff);
> +	} else if (drm_format == DRM_FORMAT_XRGB2101010) {
> +		raw_pixel &= 0x3fffffff;
> +
> +		pixel->r = (raw_pixel & 0x3ff00000) >> 20;
> +		pixel->g = (raw_pixel & 0x000ffc00) >> 10;
> +		pixel->b = (raw_pixel & 0x000003ff);
> +
> +		/* normalize for 10-bit */
> +		pixel->r /= (0x3ff);
> +		pixel->g /= (0x3ff);
> +		pixel->b /= (0x3ff);
> +	} else {
> +		igt_skip("pixel format support not implemented");
> +	}
> +}
> +
> +static uint32_t
> +igt_color_pixel_to_fourc(uint32_t drm_format, igt_pixel_t *pixel)

Maybe rename this to fourcc?



More information about the igt-dev mailing list