From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH v2 3/4] lib/igt_fb: Add support for Y21x formats as well, v2.
Date: Thu, 7 Feb 2019 10:21:35 +0100 [thread overview]
Message-ID: <20190207092136.10659-3-maarten.lankhorst@linux.intel.com> (raw)
In-Reply-To: <20190207092136.10659-1-maarten.lankhorst@linux.intel.com>
Those formats are packed like YUYV, but only 16 bits per component.
Changes since v1:
- Rebase on top of upstream YUV changes.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
include/drm-uapi/drm_fourcc.h | 6 ++++-
lib/igt_color_encoding.c | 3 +++
lib/igt_fb.c | 46 +++++++++++++++++++++++++++++++++++
3 files changed, 54 insertions(+), 1 deletion(-)
diff --git a/include/drm-uapi/drm_fourcc.h b/include/drm-uapi/drm_fourcc.h
index fe6b66ef1756..ff9ea02766ee 100644
--- a/include/drm-uapi/drm_fourcc.h
+++ b/include/drm-uapi/drm_fourcc.h
@@ -149,10 +149,14 @@ extern "C" {
#define DRM_FORMAT_YVYU fourcc_code('Y', 'V', 'Y', 'U') /* [31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian */
#define DRM_FORMAT_UYVY fourcc_code('U', 'Y', 'V', 'Y') /* [31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian */
#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 */
+/* Like YUYV, but 16 bpc, lowest bits unused like in DRM_FORMAT_P01X */
+#define DRM_FORMAT_Y210 fourcc_code('Y', '2', '1', '0')
+#define DRM_FORMAT_Y212 fourcc_code('Y', '2', '1', '2')
+#define DRM_FORMAT_Y216 fourcc_code('Y', '2', '1', '6')
+
/*
* packed YCbCr420 2x2 tiled formats
* first 64 bits will contain Y,Cb,Cr components for a 2x2 tile
diff --git a/lib/igt_color_encoding.c b/lib/igt_color_encoding.c
index b7a12a1e07f7..6f82fcec62e4 100644
--- a/lib/igt_color_encoding.c
+++ b/lib/igt_color_encoding.c
@@ -144,6 +144,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 12763cc85c86..cccd6bb98395 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -184,6 +184,21 @@ static const struct format_desc_struct {
.num_planes = 1, .plane_bpp = { 16, },
.hsub = 2, .vsub = 1,
},
+ { .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 = "P010", .depth = -1, .drm_id = DRM_FORMAT_P010,
.cairo_id = CAIRO_FORMAT_RGB96F,
.num_planes = 2, .plane_bpp = { 16, 32 },
@@ -561,6 +576,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);
@@ -1652,6 +1675,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;
@@ -1675,6 +1701,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];
@@ -1720,6 +1749,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;
@@ -2121,6 +2158,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;
}
@@ -2129,6 +2169,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;
}
@@ -2518,6 +2561,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
next prev parent reply other threads:[~2019-02-07 9:21 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-07 9:21 [igt-dev] [PATCH v2 1/4] lib/color_encoding: Prepare support for HDR modes Maarten Lankhorst
2019-02-07 9:21 ` [igt-dev] [PATCH v2 2/4] lib/igt_fb: Add support for P01x formats, v4 Maarten Lankhorst
2019-02-07 11:52 ` Juha-Pekka Heikkila
2019-02-07 12:10 ` Maarten Lankhorst
2019-02-07 12:20 ` Juha-Pekka Heikkila
2019-02-08 8:07 ` Sharma, Swati2
2019-02-07 9:21 ` Maarten Lankhorst [this message]
2019-02-07 12:29 ` [igt-dev] [PATCH v2 3/4] lib/igt_fb: Add support for Y21x formats as well, v2 Juha-Pekka Heikkila
2019-02-08 8:15 ` Sharma, Swati2
2019-02-07 9:21 ` [igt-dev] [PATCH v2 4/4] lib/igt_fb: Add support for Y410/Y416 formats, v2 Maarten Lankhorst
2019-02-07 12:43 ` Juha-Pekka Heikkila
2019-02-08 9:29 ` Sharma, Swati2
2019-02-07 9:46 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [v2,1/4] lib/color_encoding: Prepare support for HDR modes Patchwork
2019-02-07 12:45 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-02-07 13:12 ` [igt-dev] [PATCH v2 1/4] " Juha-Pekka Heikkila
2019-02-08 7:06 ` Sharma, Swati2
2019-02-08 7:10 ` Sharma, Swati2
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190207092136.10659-3-maarten.lankhorst@linux.intel.com \
--to=maarten.lankhorst@linux.intel.com \
--cc=igt-dev@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox