All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t 0/3] Add support for more YUV tests.
@ 2019-03-27  9:29 Maarten Lankhorst
  2019-03-27  9:29 ` [igt-dev] [PATCH i-g-t 1/3] lib/igt_fb: Add support for Y21x formats as well, v3 Maarten Lankhorst
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Maarten Lankhorst @ 2019-03-27  9:29 UTC (permalink / raw)
  To: igt-dev

Add Y21x/Y41x/XVYU hdr format support, and some tests to excercise these features.

Test-with: 20190322135954.20434-1-maarten.lankhorst@linux.intel.com

Maarten Lankhorst (3):
  lib/igt_fb: Add support for Y21x formats as well, v3.
  lib/igt_fb: Add support for Y410/Y416 formats, v4.
  tests/kms_yuv: Add yuv specific tests, v3.

 include/drm-uapi/drm_fourcc.h |  51 +-
 lib/igt_color_encoding.c      |   9 +
 lib/igt_fb.c                  | 309 ++++++++++++-
 tests/Makefile.sources        |   1 +
 tests/kms_yuv.c               | 843 ++++++++++++++++++++++++++++++++++
 tests/meson.build             |   1 +
 6 files changed, 1188 insertions(+), 26 deletions(-)
 create mode 100644 tests/kms_yuv.c

-- 
2.20.1

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

^ permalink raw reply	[flat|nested] 11+ messages in thread
* [igt-dev] [PATCH i-g-t 1/3] lib/igt_fb: Add support for Y21x formats as well, v3.
@ 2019-03-28 18:08 Maarten Lankhorst
  0 siblings, 0 replies; 11+ messages in thread
From: Maarten Lankhorst @ 2019-03-28 18:08 UTC (permalink / raw)
  To: igt-dev

Those formats are packed like YUYV, but only 16 bits per component.

Changes since v1:
- Rebase on top of upstream YUV changes.
Changes since v2:
- Use drm_fourcc.h from upstream.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 include/drm-uapi/drm_fourcc.h | 51 ++++++++++++++++++++++++++++++++++-
 lib/igt_color_encoding.c      |  3 +++
 lib/igt_fb.c                  | 46 +++++++++++++++++++++++++++++++
 3 files changed, 99 insertions(+), 1 deletion(-)

diff --git a/include/drm-uapi/drm_fourcc.h b/include/drm-uapi/drm_fourcc.h
index bab20298f422..3feeaa3f987a 100644
--- a/include/drm-uapi/drm_fourcc.h
+++ b/include/drm-uapi/drm_fourcc.h
@@ -144,6 +144,17 @@ extern "C" {
 #define DRM_FORMAT_RGBA1010102	fourcc_code('R', 'A', '3', '0') /* [31:0] R:G:B:A 10:10:10:2 little endian */
 #define DRM_FORMAT_BGRA1010102	fourcc_code('B', 'A', '3', '0') /* [31:0] B:G:R:A 10:10:10:2 little endian */
 
+/*
+ * Floating point 64bpp RGB
+ * IEEE 754-2008 binary16 half-precision float
+ * [15:0] sign:exponent:mantissa 1:5:10
+ */
+#define DRM_FORMAT_XRGB16161616F fourcc_code('X', 'R', '4', 'H') /* [63:0] x:R:G:B 16:16:16:16 little endian */
+#define DRM_FORMAT_XBGR16161616F fourcc_code('X', 'B', '4', 'H') /* [63:0] x:B:G:R 16:16:16:16 little endian */
+
+#define DRM_FORMAT_ARGB16161616F fourcc_code('A', 'R', '4', 'H') /* [63:0] A:R:G:B 16:16:16:16 little endian */
+#define DRM_FORMAT_ABGR16161616F fourcc_code('A', 'B', '4', 'H') /* [63:0] A:B:G:R 16:16:16:16 little endian */
+
 /* packed YCbCr */
 #define DRM_FORMAT_YUYV		fourcc_code('Y', 'U', 'Y', 'V') /* [31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian */
 #define DRM_FORMAT_YVYU		fourcc_code('Y', 'V', 'Y', 'U') /* [31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian */
@@ -151,7 +162,29 @@ 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 */
+#define DRM_FORMAT_XYUV8888	fourcc_code('X', 'Y', 'U', 'V') /* [31:0] X:Y:Cb:Cr 8:8:8:8 little endian */
+#define DRM_FORMAT_VUY888	fourcc_code('V', 'U', '2', '4') /* [23:0] Cr:Cb:Y 8:8:8 little endian */
+#define DRM_FORMAT_VUY101010	fourcc_code('V', 'U', '3', '0') /* Y followed by U then V, 10:10:10. Non-linear modifier only */
+
+/*
+ * packed Y2xx indicate for each component, xx valid data occupy msb
+ * 16-xx padding occupy lsb
+ */
+#define DRM_FORMAT_Y210         fourcc_code('Y', '2', '1', '0') /* [63:0] Cr0:0:Y1:0:Cb0:0:Y0:0 10:6:10:6:10:6:10:6 little endian per 2 Y pixels */
+#define DRM_FORMAT_Y212         fourcc_code('Y', '2', '1', '2') /* [63:0] Cr0:0:Y1:0:Cb0:0:Y0:0 12:4:12:4:12:4:12:4 little endian per 2 Y pixels */
+#define DRM_FORMAT_Y216         fourcc_code('Y', '2', '1', '6') /* [63:0] Cr0:Y1:Cb0:Y0 16:16:16:16 little endian per 2 Y pixels */
+
+/*
+ * packed Y4xx indicate for each component, xx valid data occupy msb
+ * 16-xx padding occupy lsb except Y410
+ */
+#define DRM_FORMAT_Y410         fourcc_code('Y', '4', '1', '0') /* [31:0] A:Cr:Y:Cb 2:10:10:10 little endian */
+#define DRM_FORMAT_Y412         fourcc_code('Y', '4', '1', '2') /* [63:0] A:0:Cr:0:Y:0:Cb:0 12:4:12:4:12:4:12:4 little endian */
+#define DRM_FORMAT_Y416         fourcc_code('Y', '4', '1', '6') /* [63:0] A:Cr:Y:Cb 16:16:16:16 little endian */
+
+#define DRM_FORMAT_XVYU2101010	fourcc_code('X', 'V', '3', '0') /* [31:0] X:Cr:Y:Cb 2:10:10:10 little endian */
+#define DRM_FORMAT_XVYU12_16161616	fourcc_code('X', 'V', '3', '6') /* [63:0] X:0:Cr:0:Y:0:Cb:0 12:4:12:4:12:4:12:4 little endian */
+#define DRM_FORMAT_XVYU16161616	fourcc_code('X', 'V', '4', '8') /* [63:0] X:Cr:Y:Cb 16:16:16:16 little endian */
 
 /*
  * packed YCbCr420 2x2 tiled formats
@@ -167,6 +200,15 @@ extern "C" {
 /* [63:0]   X3:X2:Y3:Cr0:Y2:X1:X0:Y1:Cb0:Y0  1:1:10:10:10:1:1:10:10:10 little endian */
 #define DRM_FORMAT_X0L2		fourcc_code('X', '0', 'L', '2')
 
+/*
+ * 1-plane YUV 4:2:0
+ * In these formats, the component ordering is specified (Y, followed by U
+ * then V), but the exact Linear layout is undefined.
+ * These formats can only be used with a non-Linear modifier.
+ */
+#define DRM_FORMAT_YUV420_8BIT	fourcc_code('Y', 'U', '0', '8')
+#define DRM_FORMAT_YUV420_10BIT	fourcc_code('Y', 'U', '1', '0')
+
 /*
  * 2 plane RGB + A
  * index 0 = RGB plane, same format as the corresponding non _A8 format has
@@ -195,6 +237,13 @@ extern "C" {
 #define DRM_FORMAT_NV24		fourcc_code('N', 'V', '2', '4') /* non-subsampled Cr:Cb plane */
 #define DRM_FORMAT_NV42		fourcc_code('N', 'V', '4', '2') /* non-subsampled Cb:Cr plane */
 
+/*
+ * 2 plane YCbCr MSB aligned
+ * index 0 = Y plane, [15:0] Y:x [10:6] little endian
+ * index 1 = Cr:Cb plane, [31:0] Cr:x:Cb:x [10:6:10:6] little endian
+ */
+#define DRM_FORMAT_P210		fourcc_code('P', '2', '1', '0') /* 2x1 subsampled Cr:Cb plane, 10 bit per channel */
+
 /*
  * 2 plane YCbCr MSB aligned
  * index 0 = Y plane, [15:0] Y:x [10:6] little endian
diff --git a/lib/igt_color_encoding.c b/lib/igt_color_encoding.c
index cc76a9919242..9f9dc1439ee4 100644
--- a/lib/igt_color_encoding.c
+++ b/lib/igt_color_encoding.c
@@ -151,6 +151,9 @@ static const struct color_encoding_format {
 	{ DRM_FORMAT_P010, 65472.f, 4096.f, 60160.f, 4096.f, 32768.f, 61440.f },
 	{ DRM_FORMAT_P012, 65520.f, 4096.f, 60160.f, 4096.f, 32768.f, 61440.f },
 	{ DRM_FORMAT_P016, 65535.f, 4096.f, 60160.f, 4096.f, 32768.f, 61440.f },
+	{ DRM_FORMAT_Y210, 65472.f, 4096.f, 60160.f, 4096.f, 32768.f, 61440.f },
+	{ DRM_FORMAT_Y212, 65520.f, 4096.f, 60160.f, 4096.f, 32768.f, 61440.f },
+	{ DRM_FORMAT_Y216, 65535.f, 4096.f, 60160.f, 4096.f, 32768.f, 61440.f },
 };
 
 static const struct color_encoding_format *lookup_fourcc(uint32_t fourcc)
diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index fcd7c4c5d187..c5b1e169a5ff 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -236,6 +236,21 @@ static const struct format_desc_struct {
 	  .num_planes = 2, .plane_bpp = { 16, 32 },
 	  .vsub = 2, .hsub = 2,
 	},
+	{ .name = "Y210", .depth = -1, .drm_id = DRM_FORMAT_Y210,
+	  .cairo_id = CAIRO_FORMAT_RGB96F,
+	  .num_planes = 1, .plane_bpp = { 32, },
+	  .hsub = 2, .vsub = 1,
+	},
+	{ .name = "Y212", .depth = -1, .drm_id = DRM_FORMAT_Y212,
+	  .cairo_id = CAIRO_FORMAT_RGB96F,
+	  .num_planes = 1, .plane_bpp = { 32, },
+	  .hsub = 2, .vsub = 1,
+	},
+	{ .name = "Y216", .depth = -1, .drm_id = DRM_FORMAT_Y216,
+	  .cairo_id = CAIRO_FORMAT_RGB96F,
+	  .num_planes = 1, .plane_bpp = { 32, },
+	  .hsub = 2, .vsub = 1,
+	},
 	{ .name = "IGT-FLOAT", .depth = -1, .drm_id = IGT_FORMAT_FLOAT,
 	  .cairo_id = CAIRO_FORMAT_INVALID,
 	  .num_planes = 1, .plane_bpp = { 128 },
@@ -667,6 +682,14 @@ static void clear_yuv_buffer(struct igt_fb *fb)
 		wmemset(ptr + fb->offsets[1], 0x80008000,
 			fb->strides[1] * fb->plane_height[1] / sizeof(wchar_t));
 		break;
+	case DRM_FORMAT_Y210:
+	case DRM_FORMAT_Y212:
+	case DRM_FORMAT_Y216:
+		wmemset(ptr + fb->offsets[0],
+			full_range ? 0x80000000 : 0x80001000,
+			fb->strides[0] * fb->plane_height[0] / sizeof(wchar_t));
+		break;
+
 	}
 
 	igt_fb_unmap_buffer(fb, ptr);
@@ -1917,6 +1940,9 @@ static void get_yuv_parameters(struct igt_fb *fb, struct yuv_parameters *params)
 	case DRM_FORMAT_YVYU:
 	case DRM_FORMAT_UYVY:
 	case DRM_FORMAT_VYUY:
+	case DRM_FORMAT_Y210:
+	case DRM_FORMAT_Y212:
+	case DRM_FORMAT_Y216:
 		params->y_inc = 2;
 		params->uv_inc = 4;
 		break;
@@ -1947,6 +1973,9 @@ static void get_yuv_parameters(struct igt_fb *fb, struct yuv_parameters *params)
 	case DRM_FORMAT_YVYU:
 	case DRM_FORMAT_UYVY:
 	case DRM_FORMAT_VYUY:
+	case DRM_FORMAT_Y210:
+	case DRM_FORMAT_Y212:
+	case DRM_FORMAT_Y216:
 	case DRM_FORMAT_XYUV8888:
 		params->y_stride = fb->strides[0];
 		params->uv_stride = fb->strides[0];
@@ -2014,6 +2043,14 @@ static void get_yuv_parameters(struct igt_fb *fb, struct yuv_parameters *params)
 		params->v_offset = fb->offsets[0];
 		break;
 
+	case DRM_FORMAT_Y210:
+	case DRM_FORMAT_Y212:
+	case DRM_FORMAT_Y216:
+		params->y_offset = fb->offsets[0];
+		params->u_offset = fb->offsets[0] + 2;
+		params->v_offset = fb->offsets[0] + 6;
+		break;
+
 	case DRM_FORMAT_XYUV8888:
 		params->y_offset = fb->offsets[0] + 1;
 		params->u_offset = fb->offsets[0] + 2;
@@ -2429,6 +2466,9 @@ static void fb_convert(struct fb_convert *cvt)
 		case DRM_FORMAT_P010:
 		case DRM_FORMAT_P012:
 		case DRM_FORMAT_P016:
+		case DRM_FORMAT_Y210:
+		case DRM_FORMAT_Y212:
+		case DRM_FORMAT_Y216:
 			convert_yuv16_to_float(cvt);
 			return;
 		}
@@ -2437,6 +2477,9 @@ static void fb_convert(struct fb_convert *cvt)
 		case DRM_FORMAT_P010:
 		case DRM_FORMAT_P012:
 		case DRM_FORMAT_P016:
+		case DRM_FORMAT_Y210:
+		case DRM_FORMAT_Y212:
+		case DRM_FORMAT_Y216:
 			convert_float_to_yuv16(cvt);
 			return;
 		}
@@ -2901,6 +2944,9 @@ bool igt_format_is_yuv(uint32_t drm_format)
 	case DRM_FORMAT_P010:
 	case DRM_FORMAT_P012:
 	case DRM_FORMAT_P016:
+	case DRM_FORMAT_Y210:
+	case DRM_FORMAT_Y212:
+	case DRM_FORMAT_Y216:
 	case DRM_FORMAT_YUYV:
 	case DRM_FORMAT_YVYU:
 	case DRM_FORMAT_UYVY:
-- 
2.20.1

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

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

end of thread, other threads:[~2019-03-28 18:08 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-27  9:29 [igt-dev] [PATCH i-g-t 0/3] Add support for more YUV tests Maarten Lankhorst
2019-03-27  9:29 ` [igt-dev] [PATCH i-g-t 1/3] lib/igt_fb: Add support for Y21x formats as well, v3 Maarten Lankhorst
2019-03-27 17:21   ` Ville Syrjälä
2019-03-27  9:29 ` [igt-dev] [PATCH i-g-t 2/3] lib/igt_fb: Add support for Y410/Y416 formats, v4 Maarten Lankhorst
2019-03-27 17:20   ` Ville Syrjälä
2019-03-28 10:53     ` Maarten Lankhorst
2019-03-27  9:29 ` [igt-dev] [PATCH i-g-t 3/3] tests/kms_yuv: Add yuv specific tests, v3 Maarten Lankhorst
2019-03-27 17:34   ` Ville Syrjälä
2019-03-27 10:55 ` [igt-dev] ✓ Fi.CI.BAT: success for Add support for more YUV tests Patchwork
2019-03-27 20:52 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2019-03-28 18:08 [igt-dev] [PATCH i-g-t 1/3] lib/igt_fb: Add support for Y21x formats as well, v3 Maarten Lankhorst

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.