Enable more formats in modetest
cover Enable more formats in modetest
Hi,
This set adds more format support for modetest, including fixes for 10bit RGB formats and addition of 422/444 YUV formats.
Thanks,
-hyun
Hyun Kwon (3):
tests: util: pattern: Use 64bit RGB samples
modetest: Add support for YUV422 and YUV444
tests: util: Add support for YUV422 and YUV444
tests/modetest/buffers.c | 29 ++++++++++++++++++++++++++--- tests/util/format.c | 4 ++++ tests/util/pattern.c | 22 ++++++++++++++++++---- 3 files changed, 48 insertions(+), 7 deletions(-)
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/3 tests: util: pattern: Use 64bit RGB samples
Use of 32bit RGB samples, where each component is 8bit, cannot support formats with components greater than 8bit (ex, XRGB2101010). Introduce MAKE_RGBA_64() which creates pixels from a 64bit sample. Each component in a 64bit sample is 16bit long, thus a pixel with 10bit components can be generated correctly.
MAKE_RGBA() can use MAKE_RGBA_64() by scaling each 8bit component to 16bit, for compatilbity.
--- tests/util/pattern.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
tests/util/pattern.c +10 -4
@@ -60,11 +60,17 @@ struct color_yuv { .u = MAKE_YUV_601_U(r, g, b), \ .v = MAKE_YUV_601_V(r, g, b) } +#define COLOR_MASK (value, color) \ + ((value & ((1 << (color).length) - 1)) << (color).offset) + +#define MAKE_RGBA_64 (rgb, r, g, b, a) \ + (COLOR_MASK(((r) >> (16 - (rgb)->red.length)), (rgb)->red) | \ + COLOR_MASK(((g) >> (16 - (rgb)->green.length)), (rgb)->green) | \ + COLOR_MASK(((b) >> (16 - (rgb)->blue.length)), (rgb)->blue) | \ + COLOR_MASK(((a) >> (16 - (rgb)->alpha.length)), (rgb)->alpha)) +#define MAKE_RGBA (rgb, r, g, b, a) \ - ((((r) >> (8 - (rgb)->red.length)) << (rgb)->red.offset) | \ - (((g) >> (8 - (rgb)->green.length)) << (rgb)->green.offset) | \ - (((b) >> (8 - (rgb)->blue.length)) << (rgb)->blue.offset) | \ - (((a) >> (8 - (rgb)->alpha.length)) << (rgb)->alpha.offset)) + MAKE_RGBA_64(rgb, (r) * 0x101, (g) * 0x101, (b) * 0x101, (a) * 0x101)#define MAKE_RGB24 (rgb, r, g, b) \ { .value = MAKE_RGBA(rgb, r, g, b, 0) }
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/3 modetest: Add support for YUV422 and YUV444
In reply to Hyun KwonThis allows dumb buffer allocation for YUV422 and YUV444 with correct subsampling values.
--- tests/modetest/buffers.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-)
tests/modetest/buffers.c +26 -3
@@ -127,7 +127,7 @@ bo_create(int fd, unsigned int format, unsigned int handles[4], unsigned int pitches[4], unsigned int offsets[4], enum util_fill_pattern pattern) { - unsigned int virtual_height; + unsigned int virtual_height, hsub, vsub;struct bo *bo;unsigned int bpp;void *planes[3 ] = {0 , };
@@ -141,6 +141,10 @@ bo_create(int fd, unsigned int format,case DRM_FORMAT_NV61 :case DRM_FORMAT_YUV420 :case DRM_FORMAT_YVU420 : +case DRM_FORMAT_YUV422 : +case DRM_FORMAT_YVU422 : +case DRM_FORMAT_YUV444 : +case DRM_FORMAT_YVU444 : bpp =8 ;break ;
@@ -204,15 +208,30 @@ bo_create(int fd, unsigned int format,case DRM_FORMAT_YUV420 :case DRM_FORMAT_YVU420 : virtual_height = height *3 /2 ; + hsub =2 ; + vsub =2 ;break ;case DRM_FORMAT_NV16 :case DRM_FORMAT_NV61 : +case DRM_FORMAT_YUV422 : +case DRM_FORMAT_YVU422 : virtual_height = height *2 ; + hsub =2 ; + vsub =1 ; +break ; + +case DRM_FORMAT_YUV444 : +case DRM_FORMAT_YVU444 : + virtual_height = height *3 ; + hsub =1 ; + vsub =1 ;break ;default : virtual_height = height; + hsub =1 ; + vsub =1 ;break ; }
@@ -260,14 +279,18 @@ bo_create(int fd, unsigned int format,case DRM_FORMAT_YUV420 :case DRM_FORMAT_YVU420 : +case DRM_FORMAT_YUV422 : +case DRM_FORMAT_YVU422 : +case DRM_FORMAT_YUV444 : +case DRM_FORMAT_YVU444 : offsets[0 ] =0 ; handles[0 ] = bo->handle; pitches[0 ] = bo->pitch; - pitches[1 ] = pitches[0 ] /2 ; + pitches[1 ] = pitches[0 ] / hsub; offsets[1 ] = pitches[0 ] * height; handles[1 ] = bo->handle; pitches[2 ] = pitches[1 ]; - offsets[2 ] = offsets[1 ] + pitches[1 ] * height /2 ; + offsets[2 ] = offsets[1 ] + pitches[1 ] * height / vsub; handles[2 ] = bo->handle; planes[0 ] = virtual;
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/3 tests: util: Add support for YUV422 and YUV444
In reply to Hyun KwonEnable YUV422 and YUV444 formats by adding to the format table and pattern generation calls.
--- tests/util/format.c | 4 ++++ tests/util/pattern.c | 8 ++++++++ 2 files changed, 12 insertions(+)
tests/util/format.c +4 -0
@@ -52,6 +52,10 @@ static const struct util_format_info format_info[] = {/* YUV planar */ { DRM_FORMAT_YUV420, "YU12", MAKE_YUV_INFO(YUV_YCbCr, 2, 2, 1) }, { DRM_FORMAT_YVU420, "YV12", MAKE_YUV_INFO(YUV_YCrCb, 2, 2, 1) }, + { DRM_FORMAT_YUV422, "YU16", MAKE_YUV_INFO(YUV_YCbCr, 2, 1, 1) }, + { DRM_FORMAT_YVU422, "YV16", MAKE_YUV_INFO(YUV_YCrCb, 2, 1, 1) }, + { DRM_FORMAT_YUV444, "YU24", MAKE_YUV_INFO(YUV_YCbCr, 1, 1, 1) }, + { DRM_FORMAT_YVU444, "YV24", MAKE_YUV_INFO(YUV_YCrCb, 1, 1, 1) },/* RGB16 */ { DRM_FORMAT_ARGB4444, "AR12", MAKE_RGB_INFO(4, 8, 4, 4, 4, 0, 4, 12) }, { DRM_FORMAT_XRGB4444, "XR12", MAKE_RGB_INFO(4, 8, 4, 4, 4, 0, 0, 0) },
tests/util/pattern.c +8 -0
@@ -487,10 +487,14 @@ static void fill_smpte(const struct util_format_info *info, void *planes[3], width, height, stride);case DRM_FORMAT_YUV420 : +case DRM_FORMAT_YUV422 : +case DRM_FORMAT_YUV444 :return fill_smpte_yuv_planar (&info->yuv, planes[0 ], planes[1 ], planes[2 ], width, height, stride);case DRM_FORMAT_YVU420 : +case DRM_FORMAT_YVU422 : +case DRM_FORMAT_YVU444 :return fill_smpte_yuv_planar (&info->yuv, planes[0 ], planes[2 ], planes[1 ], width, height, stride);
@@ -772,10 +776,14 @@ static void fill_tiles(const struct util_format_info *info, void *planes[3], width, height, stride);case DRM_FORMAT_YUV420 : +case DRM_FORMAT_YUV422 : +case DRM_FORMAT_YUV444 :return fill_tiles_yuv_planar (info, planes[0 ], planes[1 ], planes[2 ], width, height, stride);case DRM_FORMAT_YVU420 : +case DRM_FORMAT_YVU422 : +case DRM_FORMAT_YVU444 :return fill_tiles_yuv_planar (info, planes[0 ], planes[2 ], planes[1 ], width, height, stride);
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel