@@ -629,6 +629,9 @@ static const struct format_info format_info[] = {
{ DRM_FORMAT_XRGB1555, "XR15", MAKE_RGB_INFO(5, 10, 5, 5, 5, 0, 0, 0) },
{ DRM_FORMAT_RGB888, "RG24", MAKE_RGB_INFO(8, 16, 8, 8, 8, 0, 0, 0) },
{ DRM_FORMAT_XRGB8888, "XR24", MAKE_RGB_INFO(8, 16, 8, 8, 8, 0, 0, 0) },
+ { DRM_FORMAT_BGRX8888, "BX24", MAKE_RGB_INFO(8, 8, 8, 16, 8, 24, 0, 0) },
+ { DRM_FORMAT_ARGB8888, "AR24", MAKE_RGB_INFO(8, 16, 8, 8, 8, 0, 8, 24) },
+ { DRM_FORMAT_BGRA8888, "BA24", MAKE_RGB_INFO(8, 8, 8, 16, 8, 24, 8, 0) },
};
unsigned int format_fourcc(const char *name)
@@ -915,35 +918,36 @@ fill_smpte_rgb24(const struct rgb_info *rgb, void *mem,
static void
fill_smpte_rgb32(const struct rgb_info *rgb, void *mem,
- unsigned int width, unsigned int height, unsigned int stride)
+ unsigned int width, unsigned int height, unsigned int stride,
+ uint8_t alpha)
{
const uint32_t colors_top[] = {
- MAKE_RGBA(rgb, 192, 192, 192, 0), /* grey */
- MAKE_RGBA(rgb, 192, 192, 0, 0), /* yellow */
- MAKE_RGBA(rgb, 0, 192, 192, 0), /* cyan */
- MAKE_RGBA(rgb, 0, 192, 0, 0), /* green */
- MAKE_RGBA(rgb, 192, 0, 192, 0), /* magenta */
- MAKE_RGBA(rgb, 192, 0, 0, 0), /* red */
- MAKE_RGBA(rgb, 0, 0, 192, 0), /* blue */
+ MAKE_RGBA(rgb, 192, 192, 192, alpha), /* grey */
+ MAKE_RGBA(rgb, 192, 192, 0, alpha), /* yellow */
+ MAKE_RGBA(rgb, 0, 192, 192, alpha), /* cyan */
+ MAKE_RGBA(rgb, 0, 192, 0, alpha), /* green */
+ MAKE_RGBA(rgb, 192, 0, 192, alpha), /* magenta */
+ MAKE_RGBA(rgb, 192, 0, 0, alpha), /* red */
+ MAKE_RGBA(rgb, 0, 0, 192, alpha), /* blue */
};
const uint32_t colors_middle[] = {
- MAKE_RGBA(rgb, 0, 0, 192, 0), /* blue */
- MAKE_RGBA(rgb, 19, 19, 19, 0), /* black */
- MAKE_RGBA(rgb, 192, 0, 192, 0), /* magenta */
- MAKE_RGBA(rgb, 19, 19, 19, 0), /* black */
- MAKE_RGBA(rgb, 0, 192, 192, 0), /* cyan */
- MAKE_RGBA(rgb, 19, 19, 19, 0), /* black */
- MAKE_RGBA(rgb, 192, 192, 192, 0), /* grey */
+ MAKE_RGBA(rgb, 0, 0, 192, alpha), /* blue */
+ MAKE_RGBA(rgb, 19, 19, 19, alpha), /* black */
+ MAKE_RGBA(rgb, 192, 0, 192, alpha), /* magenta */
+ MAKE_RGBA(rgb, 19, 19, 19, alpha), /* black */
+ MAKE_RGBA(rgb, 0, 192, 192, alpha), /* cyan */
+ MAKE_RGBA(rgb, 19, 19, 19, alpha), /* black */
+ MAKE_RGBA(rgb, 192, 192, 192, alpha), /* grey */
};
const uint32_t colors_bottom[] = {
- MAKE_RGBA(rgb, 0, 33, 76, 0), /* in-phase */
- MAKE_RGBA(rgb, 255, 255, 255, 0), /* super white */
- MAKE_RGBA(rgb, 50, 0, 106, 0), /* quadrature */
- MAKE_RGBA(rgb, 19, 19, 19, 0), /* black */
- MAKE_RGBA(rgb, 9, 9, 9, 0), /* 3.5% */
- MAKE_RGBA(rgb, 19, 19, 19, 0), /* 7.5% */
- MAKE_RGBA(rgb, 29, 29, 29, 0), /* 11.5% */
- MAKE_RGBA(rgb, 19, 19, 19, 0), /* black */
+ MAKE_RGBA(rgb, 0, 33, 76, alpha), /* in-phase */
+ MAKE_RGBA(rgb, 255, 255, 255, alpha), /* super white */
+ MAKE_RGBA(rgb, 50, 0, 106, alpha), /* quadrature */
+ MAKE_RGBA(rgb, 19, 19, 19, alpha), /* black */
+ MAKE_RGBA(rgb, 9, 9, 9, alpha), /* 3.5% */
+ MAKE_RGBA(rgb, 19, 19, 19, alpha), /* 7.5% */
+ MAKE_RGBA(rgb, 29, 29, 29, alpha), /* 11.5% */
+ MAKE_RGBA(rgb, 19, 19, 19, alpha), /* black */
};
unsigned int x;
unsigned int y;
@@ -992,10 +996,12 @@ fill_smpte(const struct format_info *info, void *planes[3], unsigned int width,
case DRM_FORMAT_BGR888:
return fill_smpte_rgb24(&info->rgb, planes[0],
width, height, stride);
+ case DRM_FORMAT_ARGB8888:
+ case DRM_FORMAT_BGRA8888:
case DRM_FORMAT_XRGB8888:
case DRM_FORMAT_BGRX8888:
return fill_smpte_rgb32(&info->rgb, planes[0],
- width, height, stride);
+ width, height, stride, 255);
}
}
@@ -1085,9 +1091,9 @@ fill_tile_xrgb8888(unsigned char *virtual, int width, int height, int stride)
uint32_t *ptr = (uint32_t*)((char*)virtual + j * stride);
for (i = 0; i < width; i++) {
div_t d = div(i, width);
- ptr[i] =
- 0x00130502 * (d.quot >> 6) +
- 0x000a1120 * (d.rem >> 6);
+ ptr[i] = 0xff000000
+ | (0x00130502 * (d.quot >> 6) +
+ 0x000a1120 * (d.rem >> 6));
}
}
@@ -1116,6 +1122,7 @@ fill_tiles(const struct format_info *info, void *planes[3], unsigned int width,
case DRM_FORMAT_ARGB1555:
case DRM_FORMAT_XRGB1555:
return fill_tiles_xrgb1555(planes[0], width, height, stride);
+ case DRM_FORMAT_ARGB8888:
case DRM_FORMAT_XRGB8888:
return fill_tile_xrgb8888(planes[0], width, height, stride);
}
@@ -1293,7 +1300,10 @@ create_test_buffer(struct kms_driver *kms, unsigned int format,
planes[0] = virtual;
break;
+ case DRM_FORMAT_ARGB8888:
+ case DRM_FORMAT_BGRA8888:
case DRM_FORMAT_XRGB8888:
+ case DRM_FORMAT_BGRX8888:
pitches[0] = width * 4;
offsets[0] = 0;
kms_bo_get_prop(bo, KMS_HANDLE, &handles[0]);
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> --- tests/modetest/modetest.c | 64 ++++++++++++++++++++++++++------------------- 1 files changed, 37 insertions(+), 27 deletions(-)