* [igt-dev] [PATCH i-g-t v8] lib/igt_fb: Added XYUV format support for testing
@ 2018-10-04 12:53 Stanislav Lisovskiy
2018-10-04 14:27 ` [igt-dev] ✗ Fi.CI.BAT: failure for lib/igt_fb: Added XYUV format support for testing (rev8) Patchwork
0 siblings, 1 reply; 2+ messages in thread
From: Stanislav Lisovskiy @ 2018-10-04 12:53 UTC (permalink / raw)
To: igt-dev; +Cc: stanislav.lisovskiy, ville.syrjala, martin.peres
XYUV format support has been added to DRM, modified
IGT to reflect those changes.
v2: Fixed merge conflict, started to use new yuv<=>rgb
conversion functions.
v3: Fixed kms_available_modes_crc test to support new XYUV
format. Fixed a problem, where test complains that two
outputs might use same pipe at the same time.
v4: Fixed convertion procedure in igt_fb to support XYUV
properly.
v5: Fixed a coding typo.
v6: Set depth equal to -1 for XYUV format in order to prevent
it to be used by igt_bpp_depth_to_drm_format, as we do not
want YUV formats to be used in that case.
v7: Fix "black" color initialization for create_bo_for_fb with
proper value. Changed naming "planar_stride" to "xyuv_stride".
v8: Change naming from DRM_FORMAT_XYUV to DRM_FORMAT_XYUV8888
Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
---
include/drm-uapi/drm_fourcc.h | 1 +
lib/igt_fb.c | 89 +++++++++++++++++++++++++++++++++++
2 files changed, 90 insertions(+)
diff --git a/include/drm-uapi/drm_fourcc.h b/include/drm-uapi/drm_fourcc.h
index e04613d3..03e5466c 100644
--- a/include/drm-uapi/drm_fourcc.h
+++ b/include/drm-uapi/drm_fourcc.h
@@ -112,6 +112,7 @@ extern "C" {
#define DRM_FORMAT_VYUY fourcc_code('V', 'Y', 'U', 'Y') /* [31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian */
#define DRM_FORMAT_AYUV fourcc_code('A', 'Y', 'U', 'V') /* [31:0] A:Y:Cb:Cr 8:8:8:8 little endian */
+#define DRM_FORMAT_XYUV8888 fourcc_code('X', 'Y', 'U', 'V') /* [31:0] X:Y:Cb:Cr 8:8:8:8 little endian */
/*
* 2 plane RGB + A
diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index ae71d967..4348bd78 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -72,6 +72,10 @@ static struct format_desc_struct {
.cairo_id = CAIRO_FORMAT_RGB16_565,
.num_planes = 1, .plane_bpp = { 16, },
},
+ { .name = "XYUV8888", .depth = -1, .drm_id = DRM_FORMAT_XYUV8888,
+ .cairo_id = CAIRO_FORMAT_RGB24,
+ .num_planes = 1, .plane_bpp = { 32, },
+ },
{ .name = "XRGB8888", .depth = 24, .drm_id = DRM_FORMAT_XRGB8888,
.cairo_id = CAIRO_FORMAT_RGB24,
.num_planes = 1, .plane_bpp = { 32, },
@@ -415,6 +419,10 @@ static int create_bo_for_fb(int fd, int width, int height,
memset(ptr + offsets[1], 0x80,
calculated_stride * height/2);
break;
+ case DRM_FORMAT_XYUV8888:
+ wmemset(ptr, full_range ? 0x00008080 : 0x00108080,
+ calculated_stride * height / sizeof(wchar_t));
+ break;
case DRM_FORMAT_YUYV:
case DRM_FORMAT_YVYU:
wmemset(ptr, full_range ? 0x80008000 : 0x80108010,
@@ -1500,6 +1508,79 @@ static void convert_nv12_to_rgb24(struct igt_fb *fb, struct fb_convert_blit_uplo
free(buf);
}
+static void convert_yuv444_to_rgb24(struct igt_fb *fb, struct fb_convert_blit_upload *blit)
+{
+ int i, j;
+ uint8_t *yuv24;
+ uint8_t *rgb24 = blit->rgb24.map;
+ unsigned rgb24_stride = blit->rgb24.stride, xyuv_stride = blit->linear.stride;
+ uint8_t *buf = malloc(blit->linear.size);
+ struct igt_mat4 m = igt_ycbcr_to_rgb_matrix(fb->color_encoding,
+ fb->color_range);
+
+ /*
+ * Reading from the BO is awfully slow because of lack of read caching,
+ * it's faster to copy the whole BO to a temporary buffer and convert
+ * from there.
+ */
+ igt_memcpy_from_wc(buf, blit->linear.map, blit->linear.size);
+ yuv24 = &buf[blit->linear.offsets[0]];
+
+ for (i = 0; i < fb->plane_height[0]; i++) {
+ for (j = 0; j < fb->plane_width[0]; j++) {
+ float y, u, v;
+ struct igt_vec4 yuv;
+ struct igt_vec4 rgb;
+
+ v = yuv24[i * xyuv_stride + j*sizeof(uint32_t)];
+ u = yuv24[i * xyuv_stride + j*sizeof(uint32_t) + 1];
+ y = yuv24[i * xyuv_stride + j*sizeof(uint32_t) + 2];
+ yuv.d[0] = y;
+ yuv.d[1] = u;
+ yuv.d[2] = v;
+ yuv.d[3] = 1.0f;
+
+ rgb = igt_matrix_transform(&m, &yuv);
+
+ write_rgb(&rgb24[i * rgb24_stride + j*sizeof(uint32_t)], &rgb);
+ }
+ }
+
+ free(buf);
+}
+
+
+static void convert_rgb24_to_yuv444(struct igt_fb *fb, struct fb_convert_blit_upload *blit)
+{
+ int i, j;
+ uint8_t *rgb24;
+ uint8_t *yuv444 = blit->linear.map;
+ unsigned rgb24_stride = blit->rgb24.stride, xyuv_stride = blit->linear.stride;
+ struct igt_mat4 m = igt_rgb_to_ycbcr_matrix(fb->color_encoding,
+ fb->color_range);
+
+ rgb24 = blit->rgb24.map;
+
+ for (i = 0; i < fb->plane_height[0]; i++) {
+ for (j = 0; j < fb->plane_width[0]; j++) {
+ struct igt_vec4 rgb;
+ struct igt_vec4 yuv;
+ float y, u, v;
+
+ read_rgb(&rgb, &rgb24[i * rgb24_stride + j*sizeof(uint32_t)]);
+
+ yuv = igt_matrix_transform(&m, &rgb);
+
+ yuv444[i * xyuv_stride + j*sizeof(uint32_t)] = yuv.d[2];
+ yuv444[i * xyuv_stride + j*sizeof(uint32_t) + 1] = yuv.d[1];
+ yuv444[i * xyuv_stride + j*sizeof(uint32_t) + 2] = yuv.d[0];
+ }
+ }
+}
+
+
+
+
static void convert_rgb24_to_nv12(struct igt_fb *fb, struct fb_convert_blit_upload *blit)
{
int i, j;
@@ -1756,6 +1837,9 @@ static void destroy_cairo_surface__convert(void *arg)
case DRM_FORMAT_VYUY:
convert_rgb24_to_yuyv(fb, blit, yuyv_swizzle(fb->drm_format));
break;
+ case DRM_FORMAT_XYUV8888:
+ convert_rgb24_to_yuv444(fb, blit);
+ break;
default:
igt_assert_f(false, "Conversion not implemented for formats 0x%x\n",
fb->drm_format);
@@ -1809,6 +1893,9 @@ static void create_cairo_surface__convert(int fd, struct igt_fb *fb)
case DRM_FORMAT_VYUY:
convert_yuyv_to_rgb24(fb, blit, yuyv_swizzle(fb->drm_format));
break;
+ case DRM_FORMAT_XYUV8888:
+ convert_yuv444_to_rgb24(fb, blit);
+ break;
default:
igt_assert_f(false, "Conversion not implemented for formats 0x%x\n",
fb->drm_format);
@@ -1825,6 +1912,7 @@ static void create_cairo_surface__convert(int fd, struct igt_fb *fb)
blit, destroy_cairo_surface__convert);
}
+
/**
* igt_get_cairo_surface:
* @fd: open drm file descriptor
@@ -2011,6 +2099,7 @@ bool igt_format_is_yuv(uint32_t drm_format)
case DRM_FORMAT_YVYU:
case DRM_FORMAT_UYVY:
case DRM_FORMAT_VYUY:
+ case DRM_FORMAT_XYUV8888:
return true;
default:
return false;
--
2.17.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 2+ messages in thread* [igt-dev] ✗ Fi.CI.BAT: failure for lib/igt_fb: Added XYUV format support for testing (rev8)
2018-10-04 12:53 [igt-dev] [PATCH i-g-t v8] lib/igt_fb: Added XYUV format support for testing Stanislav Lisovskiy
@ 2018-10-04 14:27 ` Patchwork
0 siblings, 0 replies; 2+ messages in thread
From: Patchwork @ 2018-10-04 14:27 UTC (permalink / raw)
To: Stanislav Lisovskiy; +Cc: igt-dev
== Series Details ==
Series: lib/igt_fb: Added XYUV format support for testing (rev8)
URL : https://patchwork.freedesktop.org/series/48789/
State : failure
== Summary ==
IGT patchset build failed on latest successful build
5f40e617cd9c1e089f4a2d79c53a417d891e3e3c meson.sh: Add support for install/uninstall
ninja: Entering directory `build'
[1/344] Generating version.h with a custom command.
[2/341] Compiling C object 'lib/igt-igt_fb_c@sta/igt_fb.c.o'.
FAILED: lib/igt-igt_fb_c@sta/igt_fb.c.o
ccache cc -Ilib/igt-igt_fb_c@sta -Ilib -I../lib -I. -I../ -I../lib/stubs/syscalls -I../include/drm-uapi -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/opt/igt/include -I/opt/igt/include/libdrm -I/usr/include/x86_64-linux-gnu -I/usr/include -I/home/cidrm/kernel_headers/include -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -O0 -g -D_GNU_SOURCE -include config.h -Wno-unused-parameter -Wno-sign-compare -Wno-missing-field-initializers -Wno-clobbered -Wno-type-limits -Wimplicit-fallthrough=0 -fPIC -pthread '-DIGT_DATADIR="/opt/igt/share/igt-gpu-tools"' '-DIGT_SRCDIR="/home/cidrm/igt-gpu-tools/tests"' '-DIGT_LOG_DOMAIN="igt_fb"' -MD -MQ 'lib/igt-igt_fb_c@sta/igt_fb.c.o' -MF 'lib/igt-igt_fb_c@sta/igt_fb.c.o.d' -o 'lib/igt-igt_fb_c@sta/igt_fb.c.o' -c ../lib/igt_fb.c
../lib/igt_fb.c: In function ‘create_bo_for_fb’:
../lib/igt_fb.c:462:6: error: ‘calculated_stride’ undeclared (first use in this function); did you mean ‘calc_plane_stride’?
calculated_stride * height / sizeof(wchar_t));
^~~~~~~~~~~~~~~~~
calc_plane_stride
../lib/igt_fb.c:462:6: note: each undeclared identifier is reported only once for each function it appears in
../lib/igt_fb.c:462:26: error: ‘height’ undeclared (first use in this function)
calculated_stride * height / sizeof(wchar_t));
^~~~~~
../lib/igt_fb.c: In function ‘convert_yuv444_to_rgb24’:
../lib/igt_fb.c:1526:64: error: ‘struct fb_convert_blit_upload’ has no member named ‘linear’
unsigned rgb24_stride = blit->rgb24.stride, xyuv_stride = blit->linear.stride;
^~
../lib/igt_fb.c:1527:28: error: ‘struct fb_convert_blit_upload’ has no member named ‘linear’
uint8_t *buf = malloc(blit->linear.size);
^~
../lib/igt_fb.c:1536:30: error: ‘struct fb_convert_blit_upload’ has no member named ‘linear’
igt_memcpy_from_wc(buf, blit->linear.map, blit->linear.size);
^~
../lib/igt_fb.c:1536:48: error: ‘struct fb_convert_blit_upload’ has no member named ‘linear’
igt_memcpy_from_wc(buf, blit->linear.map, blit->linear.size);
^~
../lib/igt_fb.c:1537:19: error: ‘struct fb_convert_blit_upload’ has no member named ‘linear’
yuv24 = &buf[blit->linear.offsets[0]];
^~
../lib/igt_fb.c: In function ‘convert_rgb24_to_yuv444’:
../lib/igt_fb.c:1567:24: error: ‘struct fb_convert_blit_upload’ has no member named ‘linear’
uint8_t *yuv444 = blit->linear.map;
^~
../lib/igt_fb.c:1568:64: error: ‘struct fb_convert_blit_upload’ has no member named ‘linear’
unsigned rgb24_stride = blit->rgb24.stride, xyuv_stride = blit->linear.stride;
^~
../lib/igt_fb.c:1578:16: warning: unused variable ‘v’ [-Wunused-variable]
float y, u, v;
^
../lib/igt_fb.c:1578:13: warning: unused variable ‘u’ [-Wunused-variable]
float y, u, v;
^
../lib/igt_fb.c:1578:10: warning: unused variable ‘y’ [-Wunused-variable]
float y, u, v;
^
ninja: build stopped: subcommand failed.
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-10-04 14:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-04 12:53 [igt-dev] [PATCH i-g-t v8] lib/igt_fb: Added XYUV format support for testing Stanislav Lisovskiy
2018-10-04 14:27 ` [igt-dev] ✗ Fi.CI.BAT: failure for lib/igt_fb: Added XYUV format support for testing (rev8) Patchwork
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox