All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t v6] lib/igt_fb: Added XYUV format support for testing
@ 2018-09-12  8:40 Stanislav Lisovskiy
  2018-09-12  9:17 ` [igt-dev] ✓ Fi.CI.BAT: success for lib/igt_fb: Added XYUV format support for testing (rev6) Patchwork
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Stanislav Lisovskiy @ 2018-09-12  8:40 UTC (permalink / raw)
  To: igt-dev
  Cc: stanislav.lisovskiy, ville.syrjala, martin.peres, juha-pekka.heikkila

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.

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..0bf66de2 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_XYUV		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..36a44613 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 = "XYUV", .depth = -1, .drm_id = DRM_FORMAT_XYUV,
+	  .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_XYUV:
+				wmemset(ptr, full_range ? 0x000f8080 : 0x000f8080,
+					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, planar_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 * planar_stride + j*sizeof(uint32_t)];
+			u = yuv24[i * planar_stride + j*sizeof(uint32_t) + 1];
+			y = yuv24[i * planar_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, planar_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 * planar_stride + j*sizeof(uint32_t)] = yuv.d[2];
+			yuv444[i * planar_stride + j*sizeof(uint32_t) + 1] = yuv.d[1];
+			yuv444[i * planar_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_XYUV:
+		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_XYUV:
+		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_XYUV:
 		return true;
 	default:
 		return false;
-- 
2.17.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [igt-dev] ✓ Fi.CI.BAT: success for lib/igt_fb: Added XYUV format support for testing (rev6)
  2018-09-12  8:40 [igt-dev] [PATCH i-g-t v6] lib/igt_fb: Added XYUV format support for testing Stanislav Lisovskiy
@ 2018-09-12  9:17 ` Patchwork
  2018-09-12 11:40 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  2018-09-12 13:47 ` [igt-dev] [PATCH i-g-t v6] lib/igt_fb: Added XYUV format support for testing Ville Syrjälä
  2 siblings, 0 replies; 4+ messages in thread
From: Patchwork @ 2018-09-12  9:17 UTC (permalink / raw)
  To: Stanislav Lisovskiy; +Cc: igt-dev

== Series Details ==

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

== Summary ==

= CI Bug Log - changes from CI_DRM_4807 -> IGTPW_1828 =

== Summary - SUCCESS ==

  No regressions found.

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

== Known issues ==

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

  === IGT changes ===

    ==== Issues hit ====

    igt@amdgpu/amd_basic@userptr:
      fi-kbl-8809g:       PASS -> INCOMPLETE (fdo#107402)

    igt@gem_exec_suspend@basic-s3:
      fi-kbl-soraka:      NOTRUN -> INCOMPLETE (fdo#107774, fdo#107556)

    igt@gem_mmap@basic-small-bo:
      fi-glk-dsi:         PASS -> INCOMPLETE (fdo#103359, k.org#198133)

    igt@kms_pipe_crc_basic@hang-read-crc-pipe-b:
      fi-byt-clapper:     PASS -> FAIL (fdo#103191, fdo#107362)

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
      fi-ilk-650:         PASS -> DMESG-WARN (fdo#106387)

    igt@kms_psr@primary_mmap_gtt:
      {fi-cnl-u}:         NOTRUN -> FAIL (fdo#107383) +3

    igt@kms_psr@sprite_plane_onoff:
      fi-bdw-samus:       NOTRUN -> FAIL (fdo#107360, fdo#107383)

    igt@pm_rpm@module-reload:
      fi-bdw-samus:       NOTRUN -> DMESG-WARN (fdo#107603)

    
    ==== Possible fixes ====

    igt@gem_exec_suspend@basic-s3:
      fi-blb-e6850:       INCOMPLETE (fdo#107718) -> PASS

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
      fi-cfl-8109u:       INCOMPLETE (fdo#106070) -> PASS

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
      fi-byt-clapper:     FAIL (fdo#103191, fdo#107362) -> PASS

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-c:
      fi-bxt-dsi:         INCOMPLETE (fdo#103927) -> PASS

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

  fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
  fdo#103359 https://bugs.freedesktop.org/show_bug.cgi?id=103359
  fdo#103927 https://bugs.freedesktop.org/show_bug.cgi?id=103927
  fdo#106070 https://bugs.freedesktop.org/show_bug.cgi?id=106070
  fdo#106387 https://bugs.freedesktop.org/show_bug.cgi?id=106387
  fdo#107360 https://bugs.freedesktop.org/show_bug.cgi?id=107360
  fdo#107362 https://bugs.freedesktop.org/show_bug.cgi?id=107362
  fdo#107383 https://bugs.freedesktop.org/show_bug.cgi?id=107383
  fdo#107402 https://bugs.freedesktop.org/show_bug.cgi?id=107402
  fdo#107556 https://bugs.freedesktop.org/show_bug.cgi?id=107556
  fdo#107603 https://bugs.freedesktop.org/show_bug.cgi?id=107603
  fdo#107718 https://bugs.freedesktop.org/show_bug.cgi?id=107718
  fdo#107774 https://bugs.freedesktop.org/show_bug.cgi?id=107774
  k.org#198133 https://bugzilla.kernel.org/show_bug.cgi?id=198133


== Participating hosts (46 -> 45) ==

  Additional (4): fi-kbl-soraka fi-cnl-u fi-icl-u fi-bdw-samus 
  Missing    (5): fi-ctg-p8600 fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-hsw-4200u 


== Build changes ==

    * IGT: IGT_4639 -> IGTPW_1828

  CI_DRM_4807: 55b148b84b254f61adbfeb89c4f6674664f01c46 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_1828: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1828/
  IGT_4639: c7fa2ea9fbce87206474748100b825558eebe08e @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [igt-dev] ✓ Fi.CI.IGT: success for lib/igt_fb: Added XYUV format support for testing (rev6)
  2018-09-12  8:40 [igt-dev] [PATCH i-g-t v6] lib/igt_fb: Added XYUV format support for testing Stanislav Lisovskiy
  2018-09-12  9:17 ` [igt-dev] ✓ Fi.CI.BAT: success for lib/igt_fb: Added XYUV format support for testing (rev6) Patchwork
@ 2018-09-12 11:40 ` Patchwork
  2018-09-12 13:47 ` [igt-dev] [PATCH i-g-t v6] lib/igt_fb: Added XYUV format support for testing Ville Syrjälä
  2 siblings, 0 replies; 4+ messages in thread
From: Patchwork @ 2018-09-12 11:40 UTC (permalink / raw)
  To: Stanislav Lisovskiy; +Cc: igt-dev

== Series Details ==

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

== Summary ==

= CI Bug Log - changes from IGT_4639_full -> IGTPW_1828_full =

== Summary - WARNING ==

  Minor unknown changes coming with IGTPW_1828_full need to be verified
  manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in IGTPW_1828_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/6/mbox/

== Possible new issues ==

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

  === IGT changes ===

    ==== Warnings ====

    igt@pm_rc6_residency@rc6-accuracy:
      shard-snb:          PASS -> SKIP

    
== Known issues ==

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

  === IGT changes ===

    ==== Issues hit ====

    igt@drv_suspend@shrink:
      shard-snb:          PASS -> FAIL (fdo#106886)
      shard-glk:          PASS -> FAIL (fdo#106886)

    igt@gem_shrink@reclaim:
      shard-snb:          PASS -> INCOMPLETE (fdo#105411)

    igt@kms_draw_crc@draw-method-rgb565-mmap-gtt-ytiled:
      shard-glk:          PASS -> FAIL (fdo#103184)

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

    igt@kms_vblank@pipe-c-ts-continuation-idle-hang:
      shard-apl:          PASS -> DMESG-WARN (fdo#103558, fdo#105602) +29

    igt@testdisplay:
      shard-glk:          PASS -> INCOMPLETE (fdo#107093, k.org#198133, fdo#103359)

    
    ==== Possible fixes ====

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

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

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

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

    igt@perf_pmu@all-busy-check-all:
      shard-snb:          INCOMPLETE (fdo#105411) -> PASS

    
    ==== Warnings ====

    igt@kms_ccs@pipe-b-crc-sprite-planes-basic:
      shard-apl:          FAIL (fdo#106510, fdo#105458) -> DMESG-WARN (fdo#103558, fdo#105602)

    
  fdo#103166 https://bugs.freedesktop.org/show_bug.cgi?id=103166
  fdo#103184 https://bugs.freedesktop.org/show_bug.cgi?id=103184
  fdo#103359 https://bugs.freedesktop.org/show_bug.cgi?id=103359
  fdo#103558 https://bugs.freedesktop.org/show_bug.cgi?id=103558
  fdo#103925 https://bugs.freedesktop.org/show_bug.cgi?id=103925
  fdo#105411 https://bugs.freedesktop.org/show_bug.cgi?id=105411
  fdo#105458 https://bugs.freedesktop.org/show_bug.cgi?id=105458
  fdo#105602 https://bugs.freedesktop.org/show_bug.cgi?id=105602
  fdo#105767 https://bugs.freedesktop.org/show_bug.cgi?id=105767
  fdo#106510 https://bugs.freedesktop.org/show_bug.cgi?id=106510
  fdo#106886 https://bugs.freedesktop.org/show_bug.cgi?id=106886
  fdo#107093 https://bugs.freedesktop.org/show_bug.cgi?id=107093
  fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
  k.org#198133 https://bugzilla.kernel.org/show_bug.cgi?id=198133


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

  No changes in participating hosts


== Build changes ==

    * IGT: IGT_4639 -> IGTPW_1828
    * Linux: CI_DRM_4806 -> CI_DRM_4807

  CI_DRM_4806: feeccde66999c5e87be3550f2159e5d7eeb61c67 @ git://anongit.freedesktop.org/gfx-ci/linux
  CI_DRM_4807: 55b148b84b254f61adbfeb89c4f6674664f01c46 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_1828: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1828/
  IGT_4639: c7fa2ea9fbce87206474748100b825558eebe08e @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [igt-dev] [PATCH i-g-t v6] lib/igt_fb: Added XYUV format support for testing
  2018-09-12  8:40 [igt-dev] [PATCH i-g-t v6] lib/igt_fb: Added XYUV format support for testing Stanislav Lisovskiy
  2018-09-12  9:17 ` [igt-dev] ✓ Fi.CI.BAT: success for lib/igt_fb: Added XYUV format support for testing (rev6) Patchwork
  2018-09-12 11:40 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
@ 2018-09-12 13:47 ` Ville Syrjälä
  2 siblings, 0 replies; 4+ messages in thread
From: Ville Syrjälä @ 2018-09-12 13:47 UTC (permalink / raw)
  To: Stanislav Lisovskiy
  Cc: igt-dev, ville.syrjala, martin.peres, juha-pekka.heikkila

On Wed, Sep 12, 2018 at 11:40:26AM +0300, Stanislav Lisovskiy wrote:
> 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.
> 
> 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..0bf66de2 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_XYUV		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..36a44613 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 = "XYUV", .depth = -1, .drm_id = DRM_FORMAT_XYUV,
> +	  .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_XYUV:
> +				wmemset(ptr, full_range ? 0x000f8080 : 0x000f8080,

Shouldn't that be 'full_range ? 0x8080 : 0x108080' ?

> +					calculated_stride * height / sizeof(wchar_t));

And I just realized that I missed these when doing the 32bit
overflow fixes.

> +				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, planar_stride = blit->linear.stride;

planar_stride is a bit of a poor name for something that's not planar.
yuv_stride/xyuv_stride/something like that would seem better. Same for
the other function.

Otherwise lgtm, so with thosse fixed
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>


> +	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 * planar_stride + j*sizeof(uint32_t)];
> +			u = yuv24[i * planar_stride + j*sizeof(uint32_t) + 1];
> +			y = yuv24[i * planar_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, planar_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 * planar_stride + j*sizeof(uint32_t)] = yuv.d[2];
> +			yuv444[i * planar_stride + j*sizeof(uint32_t) + 1] = yuv.d[1];
> +			yuv444[i * planar_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_XYUV:
> +		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_XYUV:
> +		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_XYUV:
>  		return true;
>  	default:
>  		return false;
> -- 
> 2.17.0
> 
> _______________________________________________
> igt-dev mailing list
> igt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev

-- 
Ville Syrjälä
Intel
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-09-12 13:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-12  8:40 [igt-dev] [PATCH i-g-t v6] lib/igt_fb: Added XYUV format support for testing Stanislav Lisovskiy
2018-09-12  9:17 ` [igt-dev] ✓ Fi.CI.BAT: success for lib/igt_fb: Added XYUV format support for testing (rev6) Patchwork
2018-09-12 11:40 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2018-09-12 13:47 ` [igt-dev] [PATCH i-g-t v6] lib/igt_fb: Added XYUV format support for testing Ville Syrjälä

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.