mirror of
https://gitlab.freedesktop.org/mesa/drm.git
synced 2026-02-03 19:30:27 +01:00
tests/modetest: Add support for RGB332 and BGR233 formats
They're only yet more rearrangements of the components, so add in the required support. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
This commit is contained in:
parent
45c2474b03
commit
dd49ca7602
3 changed files with 104 additions and 0 deletions
|
|
@ -151,6 +151,8 @@ bo_create(int fd, unsigned int format,
|
|||
case DRM_FORMAT_YVU422:
|
||||
case DRM_FORMAT_YUV444:
|
||||
case DRM_FORMAT_YVU444:
|
||||
case DRM_FORMAT_RGB332:
|
||||
case DRM_FORMAT_BGR233:
|
||||
bpp = 8;
|
||||
break;
|
||||
|
||||
|
|
@ -337,6 +339,8 @@ bo_create(int fd, unsigned int format,
|
|||
case DRM_FORMAT_C2:
|
||||
case DRM_FORMAT_C4:
|
||||
case DRM_FORMAT_C8:
|
||||
case DRM_FORMAT_RGB332:
|
||||
case DRM_FORMAT_BGR233:
|
||||
case DRM_FORMAT_ARGB4444:
|
||||
case DRM_FORMAT_XRGB4444:
|
||||
case DRM_FORMAT_ABGR4444:
|
||||
|
|
|
|||
|
|
@ -66,6 +66,9 @@ static const struct util_format_info format_info[] = {
|
|||
{ 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) },
|
||||
/* RGB8 */
|
||||
{ DRM_FORMAT_RGB332, "RGB8", MAKE_RGB_INFO(3, 5, 3, 2, 2, 0, 0, 0) },
|
||||
{ DRM_FORMAT_BGR233, "BGR8", MAKE_RGB_INFO(3, 0, 3, 3, 2, 6, 0, 0) },
|
||||
/* 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) },
|
||||
|
|
|
|||
|
|
@ -548,6 +548,67 @@ static void fill_smpte_yuv_packed(const struct util_yuv_info *yuv, void *mem,
|
|||
}
|
||||
}
|
||||
|
||||
static void fill_smpte_rgb8(const struct util_rgb_info *rgb, void *mem,
|
||||
unsigned int width, unsigned int height,
|
||||
unsigned int stride)
|
||||
{
|
||||
const uint8_t colors_top[] = {
|
||||
MAKE_RGBA(rgb, 192, 192, 192, 255), /* grey */
|
||||
MAKE_RGBA(rgb, 192, 192, 0, 255), /* yellow */
|
||||
MAKE_RGBA(rgb, 0, 192, 192, 255), /* cyan */
|
||||
MAKE_RGBA(rgb, 0, 192, 0, 255), /* green */
|
||||
MAKE_RGBA(rgb, 192, 0, 192, 255), /* magenta */
|
||||
MAKE_RGBA(rgb, 192, 0, 0, 255), /* red */
|
||||
MAKE_RGBA(rgb, 0, 0, 192, 255), /* blue */
|
||||
};
|
||||
const uint8_t colors_middle[] = {
|
||||
MAKE_RGBA(rgb, 0, 0, 192, 127), /* blue */
|
||||
MAKE_RGBA(rgb, 19, 19, 19, 127), /* black */
|
||||
MAKE_RGBA(rgb, 192, 0, 192, 127), /* magenta */
|
||||
MAKE_RGBA(rgb, 19, 19, 19, 127), /* black */
|
||||
MAKE_RGBA(rgb, 0, 192, 192, 127), /* cyan */
|
||||
MAKE_RGBA(rgb, 19, 19, 19, 127), /* black */
|
||||
MAKE_RGBA(rgb, 192, 192, 192, 127), /* grey */
|
||||
};
|
||||
const uint8_t colors_bottom[] = {
|
||||
MAKE_RGBA(rgb, 0, 33, 76, 255), /* in-phase */
|
||||
MAKE_RGBA(rgb, 255, 255, 255, 255), /* super white */
|
||||
MAKE_RGBA(rgb, 50, 0, 106, 255), /* quadrature */
|
||||
MAKE_RGBA(rgb, 19, 19, 19, 255), /* black */
|
||||
MAKE_RGBA(rgb, 9, 9, 9, 255), /* 3.5% */
|
||||
MAKE_RGBA(rgb, 19, 19, 19, 255), /* 7.5% */
|
||||
MAKE_RGBA(rgb, 29, 29, 29, 255), /* 11.5% */
|
||||
MAKE_RGBA(rgb, 19, 19, 19, 255), /* black */
|
||||
};
|
||||
unsigned int x;
|
||||
unsigned int y;
|
||||
|
||||
for (y = 0; y < height * 6 / 9; ++y) {
|
||||
for (x = 0; x < width; ++x)
|
||||
((uint8_t *)mem)[x] = colors_top[x * 7 / width];
|
||||
mem += stride;
|
||||
}
|
||||
|
||||
for (; y < height * 7 / 9; ++y) {
|
||||
for (x = 0; x < width; ++x)
|
||||
((uint8_t *)mem)[x] = colors_middle[x * 7 / width];
|
||||
mem += stride;
|
||||
}
|
||||
|
||||
for (; y < height; ++y) {
|
||||
for (x = 0; x < width * 5 / 7; ++x)
|
||||
((uint8_t *)mem)[x] =
|
||||
colors_bottom[x * 4 / (width * 5 / 7)];
|
||||
for (; x < width * 6 / 7; ++x)
|
||||
((uint8_t *)mem)[x] =
|
||||
colors_bottom[(x - width * 5 / 7) * 3
|
||||
/ (width / 7) + 4];
|
||||
for (; x < width; ++x)
|
||||
((uint8_t *)mem)[x] = colors_bottom[7];
|
||||
mem += stride;
|
||||
}
|
||||
}
|
||||
|
||||
static void fill_smpte_rgb16(const struct util_rgb_info *rgb, void *mem,
|
||||
unsigned int width, unsigned int height,
|
||||
unsigned int stride, bool fb_be)
|
||||
|
|
@ -1259,6 +1320,11 @@ static void fill_smpte(const struct util_format_info *info, void *planes[3],
|
|||
return fill_smpte_yuv_planar(&info->yuv, planes[0], planes[2],
|
||||
planes[1], width, height, stride);
|
||||
|
||||
case DRM_FORMAT_RGB332:
|
||||
case DRM_FORMAT_BGR233:
|
||||
return fill_smpte_rgb8(&info->rgb, planes[0],
|
||||
width, height, stride);
|
||||
|
||||
case DRM_FORMAT_ARGB4444:
|
||||
case DRM_FORMAT_XRGB4444:
|
||||
case DRM_FORMAT_ABGR4444:
|
||||
|
|
@ -1537,6 +1603,32 @@ static void fill_tiles_yuv_packed(const struct util_format_info *info,
|
|||
}
|
||||
}
|
||||
|
||||
static void fill_tiles_rgb8(const struct util_format_info *info, void *mem,
|
||||
unsigned int width, unsigned int height,
|
||||
unsigned int stride)
|
||||
{
|
||||
const struct util_rgb_info *rgb = &info->rgb;
|
||||
void *mem_base = mem;
|
||||
unsigned int x, y;
|
||||
|
||||
for (y = 0; y < height; ++y) {
|
||||
for (x = 0; x < width; ++x) {
|
||||
div_t d = div(x+y, width);
|
||||
uint32_t rgb32 = 0x00130502 * (d.quot >> 6)
|
||||
+ 0x000a1120 * (d.rem >> 6);
|
||||
uint8_t color =
|
||||
MAKE_RGBA(rgb, (rgb32 >> 16) & 0xff,
|
||||
(rgb32 >> 8) & 0xff, rgb32 & 0xff,
|
||||
255);
|
||||
|
||||
((uint8_t *)mem)[x] = color;
|
||||
}
|
||||
mem += stride;
|
||||
}
|
||||
|
||||
make_pwetty(mem_base, width, height, stride, info->format);
|
||||
}
|
||||
|
||||
static void fill_tiles_rgb16(const struct util_format_info *info, void *mem,
|
||||
unsigned int width, unsigned int height,
|
||||
unsigned int stride, bool fb_be)
|
||||
|
|
@ -1680,6 +1772,11 @@ static void fill_tiles(const struct util_format_info *info, void *planes[3],
|
|||
return fill_tiles_yuv_planar(info, planes[0], planes[2],
|
||||
planes[1], width, height, stride);
|
||||
|
||||
case DRM_FORMAT_RGB332:
|
||||
case DRM_FORMAT_BGR233:
|
||||
return fill_tiles_rgb8(info, planes[0],
|
||||
width, height, stride);
|
||||
|
||||
case DRM_FORMAT_ARGB4444:
|
||||
case DRM_FORMAT_XRGB4444:
|
||||
case DRM_FORMAT_ABGR4444:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue