Skip to contentSkip to conversation

lib/igt_fb: Added XYUV format support for testing

PATCH Superseded Stanislav Lisovskiy 3 participants 4 messages Oct 5, 2018 Library code

v9 of 13 Superseded Latest is v13 →

lore
Share & tools
lore
#0 lore raw

PATCH v9 1/1 lib/igt_fb: Added XYUV format support for testing

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

v9: Fixed compilation errors by rebasing to recent master.

---
 include/drm-uapi/drm_fourcc.h |  1 +
 lib/igt_fb.c                  | 89 +++++++++++++++++++++++++++++++++++
 tests/kms_plane.c             |  3 ++
 3 files changed, 93 insertions(+)
include/drm-uapi/drm_fourcc.h +1 -0
index e04613d3..03e5466c 100644
@@ -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
lib/igt_fb.c +89 -0

131 lines not on this page · raw message

tests/kms_plane.c +3 -0
index 5a0bc05b..a40f10ad 100644
@@ -483,6 +483,9 @@ static void test_format_plane(data_t *data, enum pipe pipe,
 
 		format = plane->drm_plane->formats[i];
 
+		if (format != DRM_FORMAT_XYUV8888)
+			continue;
+
 		if (format == ref_format)
 			continue;
 
Signature · 6 lines
2.17.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#1 lore raw
Quoted 38 lines · Stanislav Lisovskiy

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

v9: Fixed compilation errors by rebasing to recent master.

---
 include/drm-uapi/drm_fourcc.h |  1 +
 lib/igt_fb.c                  | 89 +++++++++++++++++++++++++++++++++++
 tests/kms_plane.c             |  3 ++
 3 files changed, 93 insertions(+)
include/drm-uapi/drm_fourcc.h +0 -0
index e04613d3..03e5466c 100644

include/drm-uapi/drm_fourcc.h extern "C" { · line 115

Quoted 4 lines
include/drm-uapi/drm_fourcc.h +1 -0
@@ -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 */

drm-uapi files should be direct copies from the kernel. Include the kernel commit id in the IGT commit message. See 'git log include/drm-uapi'.

Signature · 1 line
Petri Latvala
Quoted 166 lines
include/drm-uapi/drm_fourcc.h +0 -0
 /*
  * 2 plane RGB + A
lib/igt_fb.c +89 -0
index cba67f41..7d72ee2f 100644
@@ -72,6 +72,10 @@ static const 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, },
@@ -453,6 +457,10 @@ static int create_bo_for_fb(struct igt_fb *fb)
 				       0x80,
 				       fb->strides[1] * fb->plane_height[1]);
 				break;
+			case DRM_FORMAT_XYUV8888:
+				wmemset(ptr + fb->offsets[0], full_range ? 0x00008080 : 0x00108080,
+					fb->strides[0] * fb->plane_height[0] / sizeof(wchar_t));
+				break;
 			case DRM_FORMAT_YUYV:
 			case DRM_FORMAT_YVYU:
 				wmemset(ptr + fb->offsets[0],
@@ -1510,6 +1518,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->base.linear.fb.strides[0];
+	uint8_t *buf = malloc(blit->base.linear.fb.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->base.linear.map[blit->base.linear.fb.offsets[0]], blit->base.linear.fb.size);
+	yuv24 = buf;
+
+	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->base.linear.map[blit->base.linear.fb.offsets[0]];
+	unsigned int rgb24_stride = blit->rgb24.stride, xyuv_stride = blit->base.linear.fb.strides[0];
+	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;
@@ -1766,6 +1847,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);
@@ -1821,6 +1905,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);
@@ -1837,6 +1924,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
@@ -2019,6 +2107,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;
tests/kms_plane.c +3 -0
index 5a0bc05b..a40f10ad 100644
@@ -483,6 +483,9 @@ static void test_format_plane(data_t *data, enum pipe pipe,
 
 		format = plane->drm_plane->formats[i];
 
+		if (format != DRM_FORMAT_XYUV8888)
+			continue;
+
 		if (format == ref_format)
 			continue;
 
Signature · 6 lines
2.17.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#2 lore raw

[igt-dev] ✓ Fi.CI.BAT: success for lib/igt_fb: Added XYUV format support for testing (rev9)

In reply to Stanislav Lisovskiy
== Series Details ==

== Series Details ==

Series: lib/igt_fb: Added XYUV format support for testing (rev9)
URL : https://patchwork.freedesktop.org/series/48789/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4933 -> IGTPW_1918 =

== Summary - SUCCESS ==

No regressions found.

External URL: https://patchwork.freedesktop.org/api/1.0/series/48789/revisions/9/mbox/

== Known issues ==

Here are the changes found in IGTPW_1918 that come from known issues:

=== IGT changes ===

    ==== Issues hit ====

    igt@drv_selftest@live_evict:
      fi-bsw-kefka:       PASS -> DMESG-WARN (fdo#107709)

    igt@gem_exec_suspend@basic-s3:
      fi-bdw-samus:       NOTRUN -> INCOMPLETE (fdo#107773)

    igt@prime_vgem@basic-fence-flip:
      fi-cfl-8700k:       PASS -> FAIL (fdo#104008)

fdo#104008 https://bugs.freedesktop.org/show_bug.cgi?id=104008
fdo#107709 https://bugs.freedesktop.org/show_bug.cgi?id=107709
fdo#107773 https://bugs.freedesktop.org/show_bug.cgi?id=107773

== Participating hosts (44 -> 39) ==

Additional (2): fi-glk-j4005 fi-bdw-samus
Missing (7): fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-icl-u2 fi-ctg-p8600 fi-byt-clapper fi-kbl-r

== Build changes ==

* IGT: IGT_4669 -> IGTPW_1918

CI_DRM_4933: 6b7a44d1597791524f46d7ea17620db54dffdc8c @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_1918: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1918/
IGT_4669: 5f40e617cd9c1e089f4a2d79c53a417d891e3e3c @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1918/issues.html
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#3 lore raw

[igt-dev] ✗ Fi.CI.IGT: failure for lib/igt_fb: Added XYUV format support for testing (rev9)

In reply to Stanislav Lisovskiy
== Series Details ==

== Series Details ==

Series: lib/igt_fb: Added XYUV format support for testing (rev9)
URL : https://patchwork.freedesktop.org/series/48789/
State : failure

== Summary ==

= CI Bug Log - changes from IGT_4669_full -> IGTPW_1918_full =

== Summary - FAILURE ==

Serious unknown changes coming with IGTPW_1918_full absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in IGTPW_1918_full, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://patchwork.freedesktop.org/api/1.0/series/48789/revisions/9/mbox/

== Possible new issues ==

Here are the unknown changes that may have been introduced in IGTPW_1918_full:

=== IGT changes ===

    ==== Possible regressions ====

    igt@gem_eio@reset-stress:
      shard-glk:          PASS -> FAIL

    
    ==== Warnings ====

    igt@kms_atomic_transition@1x-modeset-transitions-fencing:
      shard-snb:          PASS -> SKIP

== Known issues ==

Here are the changes found in IGTPW_1918_full that come from known issues:

=== IGT changes ===

    ==== Issues hit ====

    igt@kms_atomic_interruptible@legacy-cursor:
      shard-kbl:          PASS -> DMESG-WARN (fdo#105602, fdo#103558) +2

    igt@kms_color@pipe-a-degamma:
      shard-apl:          PASS -> FAIL (fdo#104782, fdo#108145)

    igt@kms_cursor_crc@cursor-128x128-suspend:
      shard-apl:          PASS -> FAIL (fdo#103232, fdo#103191)
      shard-kbl:          PASS -> FAIL (fdo#103232, fdo#103191)

    igt@kms_cursor_crc@cursor-128x42-sliding:
      shard-apl:          PASS -> FAIL (fdo#103232) +1

    igt@kms_cursor_crc@cursor-256x256-onscreen:
      shard-glk:          PASS -> FAIL (fdo#103232) +1

    igt@kms_cursor_legacy@2x-long-cursor-vs-flip-atomic:
      shard-hsw:          PASS -> FAIL (fdo#105767)

    igt@kms_flip@flip-vs-expired-vblank:
      shard-glk:          PASS -> FAIL (fdo#105363, fdo#102887)

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-render:
      shard-apl:          PASS -> FAIL (fdo#103167) +1

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-pwrite:
      shard-kbl:          PASS -> FAIL (fdo#103167)

    igt@kms_frontbuffer_tracking@fbc-2p-primscrn-spr-indfb-draw-pwrite:
      shard-glk:          PASS -> FAIL (fdo#103167) +1

    igt@kms_plane@plane-position-covered-pipe-a-planes:
      shard-apl:          PASS -> FAIL (fdo#103166) +1

    igt@kms_plane@plane-position-covered-pipe-b-planes:
      shard-glk:          PASS -> FAIL (fdo#103166) +1

    {igt@kms_plane_alpha_blend@pipe-a-alpha-opaque-fb}:
      shard-apl:          PASS -> FAIL (fdo#108145)
      shard-glk:          PASS -> FAIL (fdo#108145) +1

    igt@kms_plane_multiple@atomic-pipe-a-tiling-x:
      shard-snb:          PASS -> FAIL (fdo#103166)

    igt@kms_rotation_crc@primary-rotation-180:
      shard-snb:          PASS -> FAIL (fdo#103925)

    igt@kms_setmode@basic:
      shard-kbl:          PASS -> FAIL (fdo#99912)

    
    ==== Possible fixes ====

    igt@gem_eio@in-flight-internal-10ms:
      shard-glk:          FAIL (fdo#105957) -> PASS

    igt@gem_eio@reset-stress:
      shard-snb:          INCOMPLETE (fdo#105411) -> PASS

    igt@kms_busy@extended-pageflip-hang-newfb-render-a:
      shard-glk:          DMESG-WARN (fdo#107956) -> PASS

    igt@kms_ccs@pipe-a-crc-sprite-planes-basic:
      shard-glk:          FAIL (fdo#108145) -> PASS

    igt@kms_cursor_crc@cursor-64x21-random:
      shard-kbl:          FAIL (fdo#103232) -> PASS +1

    igt@kms_cursor_crc@cursor-64x21-sliding:
      shard-apl:          FAIL (fdo#103232) -> PASS +2

    igt@kms_cursor_crc@cursor-64x64-onscreen:
      shard-glk:          FAIL (fdo#103232) -> PASS +2

    igt@kms_cursor_legacy@cursora-vs-flipa-atomic:
      shard-glk:          DMESG-WARN (fdo#106538, fdo#105763) -> PASS +3

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-mmap-gtt:
      shard-apl:          FAIL (fdo#103167) -> PASS

    igt@kms_frontbuffer_tracking@fbc-2p-primscrn-spr-indfb-onoff:
      shard-glk:          FAIL (fdo#103167) -> PASS +8

    igt@kms_plane@pixel-format-pipe-a-planes:
      shard-snb:          FAIL (fdo#107749, fdo#103166) -> PASS

    igt@kms_plane_multiple@atomic-pipe-b-tiling-x:
      shard-glk:          FAIL (fdo#103166) -> PASS +1

    igt@kms_plane_multiple@atomic-pipe-b-tiling-yf:
      shard-apl:          FAIL (fdo#103166) -> PASS +2

    igt@kms_rotation_crc@sprite-rotation-180:
      shard-snb:          FAIL (fdo#103925) -> PASS

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

fdo#102887 https://bugs.freedesktop.org/show_bug.cgi?id=102887
fdo#103166 https://bugs.freedesktop.org/show_bug.cgi?id=103166
fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
fdo#103232 https://bugs.freedesktop.org/show_bug.cgi?id=103232
fdo#103558 https://bugs.freedesktop.org/show_bug.cgi?id=103558
fdo#103925 https://bugs.freedesktop.org/show_bug.cgi?id=103925
fdo#104782 https://bugs.freedesktop.org/show_bug.cgi?id=104782
fdo#105363 https://bugs.freedesktop.org/show_bug.cgi?id=105363
fdo#105411 https://bugs.freedesktop.org/show_bug.cgi?id=105411
fdo#105602 https://bugs.freedesktop.org/show_bug.cgi?id=105602
fdo#105763 https://bugs.freedesktop.org/show_bug.cgi?id=105763
fdo#105767 https://bugs.freedesktop.org/show_bug.cgi?id=105767
fdo#105957 https://bugs.freedesktop.org/show_bug.cgi?id=105957
fdo#106538 https://bugs.freedesktop.org/show_bug.cgi?id=106538
fdo#107749 https://bugs.freedesktop.org/show_bug.cgi?id=107749
fdo#107956 https://bugs.freedesktop.org/show_bug.cgi?id=107956
fdo#108145 https://bugs.freedesktop.org/show_bug.cgi?id=108145
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912

== Participating hosts (6 -> 5) ==

Missing (1): shard-skl

== Build changes ==

* IGT: IGT_4669 -> IGTPW_1918
* Linux: CI_DRM_4931 -> CI_DRM_4933

CI_DRM_4931: 826702bf60ae2b37841c051ed769b44af194fbb1 @ git://anongit.freedesktop.org/gfx-ci/linux
CI_DRM_4933: 6b7a44d1597791524f46d7ea17620db54dffdc8c @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_1918: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1918/
IGT_4669: 5f40e617cd9c1e089f4a2d79c53a417d891e3e3c @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1918/shards.html
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev