[PATCH i-g-t 4/9] lib/color_encoding: Add support for NV24 and NV42 pixel formats
Louis Chauvet
louis.chauvet at bootlin.com
Wed Mar 6 17:28:38 UTC 2024
The current conversion algorithm is able to convert NV24 and NV42
formats. Add those format in the list so they can also be tested.
Signed-off-by: Louis Chauvet <louis.chauvet at bootlin.com>
---
lib/igt_color_encoding.c | 2 ++
lib/igt_fb.c | 22 ++++++++++++++++++++++
2 files changed, 24 insertions(+)
diff --git a/lib/igt_color_encoding.c b/lib/igt_color_encoding.c
index a7bd2b22f73b..43105de34889 100644
--- a/lib/igt_color_encoding.c
+++ b/lib/igt_color_encoding.c
@@ -138,8 +138,10 @@ static const struct color_encoding_format {
{ IGT_FORMAT_FLOAT, 1.f, },
{ DRM_FORMAT_NV12, 255.f, 16.f, 235.f, 16.f, 128.f, 240.f },
{ DRM_FORMAT_NV16, 255.f, 16.f, 235.f, 16.f, 128.f, 240.f },
+ { DRM_FORMAT_NV24, 255.f, 16.f, 235.f, 16.f, 128.f, 240.f },
{ DRM_FORMAT_NV21, 255.f, 16.f, 235.f, 16.f, 128.f, 240.f },
{ DRM_FORMAT_NV61, 255.f, 16.f, 235.f, 16.f, 128.f, 240.f },
+ { DRM_FORMAT_NV42, 255.f, 16.f, 235.f, 16.f, 128.f, 240.f },
{ DRM_FORMAT_YUV420, 255.f, 16.f, 235.f, 16.f, 128.f, 240.f },
{ DRM_FORMAT_YUV422, 255.f, 16.f, 235.f, 16.f, 128.f, 240.f },
{ DRM_FORMAT_YVU420, 255.f, 16.f, 235.f, 16.f, 128.f, 240.f },
diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 0ac2a76b0c52..b6f28cf3ee52 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -252,6 +252,11 @@ static const struct format_desc_struct {
.num_planes = 2, .plane_bpp = { 8, 16, },
.hsub = 2, .vsub = 1,
},
+ { .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 = "NV21", .depth = -1, .drm_id = DRM_FORMAT_NV21,
.cairo_id = CAIRO_FORMAT_RGB24, .convert = true,
.num_planes = 2, .plane_bpp = { 8, 16, },
@@ -262,6 +267,11 @@ static const struct format_desc_struct {
.num_planes = 2, .plane_bpp = { 8, 16, },
.hsub = 2, .vsub = 1,
},
+ { .name = "NV42", .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 = "YUYV", .depth = -1, .drm_id = DRM_FORMAT_YUYV,
.cairo_id = CAIRO_FORMAT_RGB24, .convert = true,
.num_planes = 1, .plane_bpp = { 16, },
@@ -3398,8 +3408,10 @@ 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:
case DRM_FORMAT_NV21:
case DRM_FORMAT_NV61:
+ case DRM_FORMAT_NV42:
case DRM_FORMAT_P010:
case DRM_FORMAT_P012:
case DRM_FORMAT_P016:
@@ -3439,8 +3451,10 @@ 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:
case DRM_FORMAT_NV21:
case DRM_FORMAT_NV61:
+ case DRM_FORMAT_NV42:
case DRM_FORMAT_YUV420:
case DRM_FORMAT_YUV422:
case DRM_FORMAT_YVU420:
@@ -3472,6 +3486,7 @@ 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;
@@ -3479,6 +3494,7 @@ static void get_yuv_parameters(struct igt_fb *fb, struct yuv_parameters *params)
case DRM_FORMAT_NV21:
case DRM_FORMAT_NV61:
+ case DRM_FORMAT_NV42:
params->y_offset = fb->offsets[0];
params->u_offset = fb->offsets[1] + 1;
params->v_offset = fb->offsets[1];
@@ -4224,9 +4240,11 @@ static void fb_convert(struct fb_convert *cvt)
switch (cvt->src.fb->drm_format) {
case DRM_FORMAT_XYUV8888:
case DRM_FORMAT_NV12:
+ case DRM_FORMAT_NV24:
case DRM_FORMAT_NV16:
case DRM_FORMAT_NV21:
case DRM_FORMAT_NV61:
+ case DRM_FORMAT_NV42:
case DRM_FORMAT_UYVY:
case DRM_FORMAT_VYUY:
case DRM_FORMAT_YUV420:
@@ -4243,8 +4261,10 @@ static void fb_convert(struct fb_convert *cvt)
case DRM_FORMAT_XYUV8888:
case DRM_FORMAT_NV12:
case DRM_FORMAT_NV16:
+ case DRM_FORMAT_NV24:
case DRM_FORMAT_NV21:
case DRM_FORMAT_NV61:
+ case DRM_FORMAT_NV42:
case DRM_FORMAT_UYVY:
case DRM_FORMAT_VYUY:
case DRM_FORMAT_YUV420:
@@ -4823,8 +4843,10 @@ bool igt_format_is_yuv(uint32_t drm_format)
switch (drm_format) {
case DRM_FORMAT_NV12:
case DRM_FORMAT_NV16:
+ case DRM_FORMAT_NV24:
case DRM_FORMAT_NV21:
case DRM_FORMAT_NV61:
+ case DRM_FORMAT_NV42:
case DRM_FORMAT_YUV420:
case DRM_FORMAT_YUV422:
case DRM_FORMAT_YVU420:
--
2.43.0
More information about the igt-dev
mailing list