[PATCH i-g-t v6 12/12] lib/igt_fb: Add non sub-sampled YUV formats
Arthur Grillo
arthurgrillo at riseup.net
Fri Sep 13 00:39:36 UTC 2024
This adds support for the formats:
- NV24
- NV42
- YU24
- YU42
Signed-off-by: Arthur Grillo <arthurgrillo at riseup.net>
---
lib/igt_fb.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 7f87d40ed3d6..b1301d08d9f8 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -257,6 +257,16 @@ static const struct format_desc_struct {
.num_planes = 2, .plane_bpp = { 8, 16, },
.hsub = 2, .vsub = 2,
},
+ { .name = "NV24", .depth = -1, .drm_id = DRM_FORMAT_NV24,
+ .cairo_id = CAIRO_FORMAT_RGB24, .convert = true,
+ .num_planes = 2, .plane_bpp = { 8, 16, },
+ .hsub = 1, .vsub = 1,
+ },
+ { .name = "NV42", .depth = -1, .drm_id = DRM_FORMAT_NV42,
+ .cairo_id = CAIRO_FORMAT_RGB24, .convert = true,
+ .num_planes = 2, .plane_bpp = { 8, 16, },
+ .hsub = 1, .vsub = 1,
+ },
{ .name = "NV61", .depth = -1, .drm_id = DRM_FORMAT_NV61,
.cairo_id = CAIRO_FORMAT_RGB24, .convert = true,
.num_planes = 2, .plane_bpp = { 8, 16, },
@@ -292,6 +302,11 @@ static const struct format_desc_struct {
.num_planes = 3, .plane_bpp = { 8, 8, 8, },
.hsub = 2, .vsub = 1,
},
+ { .name = "YU24", .depth = -1, .drm_id = DRM_FORMAT_YUV444,
+ .cairo_id = CAIRO_FORMAT_RGB24, .convert = true,
+ .num_planes = 3, .plane_bpp = { 8, 8, 8, },
+ .hsub = 1, .vsub = 1,
+ },
{ .name = "YV12", .depth = -1, .drm_id = DRM_FORMAT_YVU420,
.cairo_id = CAIRO_FORMAT_RGB24, .convert = true,
.num_planes = 3, .plane_bpp = { 8, 8, 8, },
@@ -302,6 +317,11 @@ static const struct format_desc_struct {
.num_planes = 3, .plane_bpp = { 8, 8, 8, },
.hsub = 2, .vsub = 1,
},
+ { .name = "YV24", .depth = -1, .drm_id = DRM_FORMAT_YVU444,
+ .cairo_id = CAIRO_FORMAT_RGB24, .convert = true,
+ .num_planes = 3, .plane_bpp = { 8, 8, 8, },
+ .hsub = 1, .vsub = 1,
+ },
{ .name = "Y410", .depth = -1, .drm_id = DRM_FORMAT_Y410,
.cairo_id = CAIRO_FORMAT_RGBA128F, .convert = true,
.num_planes = 1, .plane_bpp = { 32, },
@@ -1166,8 +1186,10 @@ static void clear_yuv_buffer(struct igt_fb *fb)
break;
case DRM_FORMAT_YUV420:
case DRM_FORMAT_YUV422:
+ case DRM_FORMAT_YUV444:
case DRM_FORMAT_YVU420:
case DRM_FORMAT_YVU422:
+ case DRM_FORMAT_YVU444:
igt_assert(ARRAY_SIZE(plane_size) == 3);
memset(ptr + fb->offsets[0],
full_range ? 0x00 : 0x10,
@@ -3495,6 +3517,8 @@ static void get_yuv_parameters(struct igt_fb *fb, struct yuv_parameters *params)
case DRM_FORMAT_NV12:
case DRM_FORMAT_NV16:
case DRM_FORMAT_NV21:
+ case DRM_FORMAT_NV24:
+ case DRM_FORMAT_NV42:
case DRM_FORMAT_NV61:
case DRM_FORMAT_P010:
case DRM_FORMAT_P012:
@@ -3505,8 +3529,10 @@ static void get_yuv_parameters(struct igt_fb *fb, struct yuv_parameters *params)
case DRM_FORMAT_YUV420:
case DRM_FORMAT_YUV422:
+ case DRM_FORMAT_YUV444:
case DRM_FORMAT_YVU420:
case DRM_FORMAT_YVU422:
+ case DRM_FORMAT_YVU444:
params->ay_inc = 1;
params->uv_inc = 1;
break;
@@ -3536,11 +3562,15 @@ static void get_yuv_parameters(struct igt_fb *fb, struct yuv_parameters *params)
case DRM_FORMAT_NV12:
case DRM_FORMAT_NV16:
case DRM_FORMAT_NV21:
+ case DRM_FORMAT_NV24:
+ case DRM_FORMAT_NV42:
case DRM_FORMAT_NV61:
case DRM_FORMAT_YUV420:
case DRM_FORMAT_YUV422:
+ case DRM_FORMAT_YUV444:
case DRM_FORMAT_YVU420:
case DRM_FORMAT_YVU422:
+ case DRM_FORMAT_YVU444:
case DRM_FORMAT_P010:
case DRM_FORMAT_P012:
case DRM_FORMAT_P016:
@@ -3568,12 +3598,14 @@ static void get_yuv_parameters(struct igt_fb *fb, struct yuv_parameters *params)
switch (fb->drm_format) {
case DRM_FORMAT_NV12:
case DRM_FORMAT_NV16:
+ case DRM_FORMAT_NV24:
params->y_offset = fb->offsets[0];
params->u_offset = fb->offsets[1];
params->v_offset = fb->offsets[1] + 1;
break;
case DRM_FORMAT_NV21:
+ case DRM_FORMAT_NV42:
case DRM_FORMAT_NV61:
params->y_offset = fb->offsets[0];
params->u_offset = fb->offsets[1] + 1;
@@ -3582,6 +3614,7 @@ static void get_yuv_parameters(struct igt_fb *fb, struct yuv_parameters *params)
case DRM_FORMAT_YUV420:
case DRM_FORMAT_YUV422:
+ case DRM_FORMAT_YUV444:
params->y_offset = fb->offsets[0];
params->u_offset = fb->offsets[1];
params->v_offset = fb->offsets[2];
@@ -3589,6 +3622,7 @@ static void get_yuv_parameters(struct igt_fb *fb, struct yuv_parameters *params)
case DRM_FORMAT_YVU420:
case DRM_FORMAT_YVU422:
+ case DRM_FORMAT_YVU444:
params->y_offset = fb->offsets[0];
params->u_offset = fb->offsets[2];
params->v_offset = fb->offsets[1];
@@ -4322,14 +4356,18 @@ static void fb_convert(struct fb_convert *cvt)
case DRM_FORMAT_NV12:
case DRM_FORMAT_NV16:
case DRM_FORMAT_NV21:
+ case DRM_FORMAT_NV24:
+ case DRM_FORMAT_NV42:
case DRM_FORMAT_NV61:
case DRM_FORMAT_UYVY:
case DRM_FORMAT_VYUY:
case DRM_FORMAT_YUV420:
case DRM_FORMAT_YUV422:
+ case DRM_FORMAT_YUV444:
case DRM_FORMAT_YUYV:
case DRM_FORMAT_YVU420:
case DRM_FORMAT_YVU422:
+ case DRM_FORMAT_YVU444:
case DRM_FORMAT_YVYU:
convert_yuv_to_rgb24(cvt);
return;
@@ -4340,14 +4378,18 @@ static void fb_convert(struct fb_convert *cvt)
case DRM_FORMAT_NV12:
case DRM_FORMAT_NV16:
case DRM_FORMAT_NV21:
+ case DRM_FORMAT_NV24:
+ case DRM_FORMAT_NV42:
case DRM_FORMAT_NV61:
case DRM_FORMAT_UYVY:
case DRM_FORMAT_VYUY:
case DRM_FORMAT_YUV420:
case DRM_FORMAT_YUV422:
+ case DRM_FORMAT_YUV444:
case DRM_FORMAT_YUYV:
case DRM_FORMAT_YVU420:
case DRM_FORMAT_YVU422:
+ case DRM_FORMAT_YVU444:
case DRM_FORMAT_YVYU:
convert_rgb24_to_yuv(cvt);
return;
@@ -4921,11 +4963,15 @@ bool igt_format_is_yuv(uint32_t drm_format)
case DRM_FORMAT_NV12:
case DRM_FORMAT_NV16:
case DRM_FORMAT_NV21:
+ case DRM_FORMAT_NV24:
+ case DRM_FORMAT_NV42:
case DRM_FORMAT_NV61:
case DRM_FORMAT_YUV420:
case DRM_FORMAT_YUV422:
+ case DRM_FORMAT_YUV444:
case DRM_FORMAT_YVU420:
case DRM_FORMAT_YVU422:
+ case DRM_FORMAT_YVU444:
case DRM_FORMAT_P010:
case DRM_FORMAT_P012:
case DRM_FORMAT_P016:
--
2.46.0
More information about the igt-dev
mailing list