* [PATCH LIBDRM 2/3] modetest: Add support for YUV422 and YUV444
2018-05-04 23:40 [PATCH LIBDRM 0/3] Enable more formats in modetest Hyun Kwon
@ 2018-05-04 23:40 ` Hyun Kwon
0 siblings, 0 replies; 5+ messages in thread
From: Hyun Kwon @ 2018-05-04 23:40 UTC (permalink / raw)
To: dri-devel; +Cc: Hyun Kwon
This allows dumb buffer allocation for YUV422 and YUV444 with correct
subsampling values.
Signed-off-by: Hyun Kwon <hyun.kwon@xilinx.com>
---
tests/modetest/buffers.c | 29 ++++++++++++++++++++++++++---
1 file changed, 26 insertions(+), 3 deletions(-)
diff --git a/tests/modetest/buffers.c b/tests/modetest/buffers.c
index 9b635c0..769399e 100644
--- a/tests/modetest/buffers.c
+++ b/tests/modetest/buffers.c
@@ -127,7 +127,7 @@ bo_create(int fd, unsigned int format,
unsigned int handles[4], unsigned int pitches[4],
unsigned int offsets[4], enum util_fill_pattern pattern)
{
- unsigned int virtual_height;
+ unsigned int virtual_height, hsub, vsub;
struct bo *bo;
unsigned int bpp;
void *planes[3] = { 0, };
@@ -141,6 +141,10 @@ bo_create(int fd, unsigned int format,
case DRM_FORMAT_NV61:
case DRM_FORMAT_YUV420:
case DRM_FORMAT_YVU420:
+ case DRM_FORMAT_YUV422:
+ case DRM_FORMAT_YVU422:
+ case DRM_FORMAT_YUV444:
+ case DRM_FORMAT_YVU444:
bpp = 8;
break;
@@ -204,15 +208,30 @@ bo_create(int fd, unsigned int format,
case DRM_FORMAT_YUV420:
case DRM_FORMAT_YVU420:
virtual_height = height * 3 / 2;
+ hsub = 2;
+ vsub = 2;
break;
case DRM_FORMAT_NV16:
case DRM_FORMAT_NV61:
+ case DRM_FORMAT_YUV422:
+ case DRM_FORMAT_YVU422:
virtual_height = height * 2;
+ hsub = 2;
+ vsub = 1;
+ break;
+
+ case DRM_FORMAT_YUV444:
+ case DRM_FORMAT_YVU444:
+ virtual_height = height * 3;
+ hsub = 1;
+ vsub = 1;
break;
default:
virtual_height = height;
+ hsub = 1;
+ vsub = 1;
break;
}
@@ -260,14 +279,18 @@ bo_create(int fd, unsigned int format,
case DRM_FORMAT_YUV420:
case DRM_FORMAT_YVU420:
+ case DRM_FORMAT_YUV422:
+ case DRM_FORMAT_YVU422:
+ case DRM_FORMAT_YUV444:
+ case DRM_FORMAT_YVU444:
offsets[0] = 0;
handles[0] = bo->handle;
pitches[0] = bo->pitch;
- pitches[1] = pitches[0] / 2;
+ pitches[1] = pitches[0] / hsub;
offsets[1] = pitches[0] * height;
handles[1] = bo->handle;
pitches[2] = pitches[1];
- offsets[2] = offsets[1] + pitches[1] * height / 2;
+ offsets[2] = offsets[1] + pitches[1] * height / vsub;
handles[2] = bo->handle;
planes[0] = virtual;
--
2.7.4
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH libdrm 0/3] Enable more formats in modetest
@ 2018-07-08 2:35 Hyun Kwon
2018-07-08 2:35 ` [PATCH libdrm 1/3] tests: util: pattern: Use 64bit RGB samples Hyun Kwon
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Hyun Kwon @ 2018-07-08 2:35 UTC (permalink / raw)
To: dri-devel; +Cc: Hyun Kwon
Hi,
This is a reminder of previously submitted patch [1]. The set is
just rebased on the lastet master branch, but nothing still changed.
This set adds more formats for modetest, including fixes for
10bit RGB formats and adding 422/444 YUV formats.
Thanks,
-hyun
[1] https://www.mail-archive.com/dri-devel@lists.freedesktop.org/msg219340.html
Hyun Kwon (3):
tests: util: pattern: Use 64bit RGB samples
modetest: Add support for YUV422 and YUV444
tests: util: Add support for YUV422 and YUV444
tests/modetest/buffers.c | 29 ++++++++++++++++++++++++++---
tests/util/format.c | 4 ++++
tests/util/pattern.c | 22 ++++++++++++++++++----
3 files changed, 48 insertions(+), 7 deletions(-)
--
2.7.4
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH libdrm 1/3] tests: util: pattern: Use 64bit RGB samples
2018-07-08 2:35 [PATCH libdrm 0/3] Enable more formats in modetest Hyun Kwon
@ 2018-07-08 2:35 ` Hyun Kwon
2018-07-08 2:35 ` [PATCH libdrm 2/3] modetest: Add support for YUV422 and YUV444 Hyun Kwon
2018-07-08 2:35 ` [PATCH libdrm 3/3] tests: util: " Hyun Kwon
2 siblings, 0 replies; 5+ messages in thread
From: Hyun Kwon @ 2018-07-08 2:35 UTC (permalink / raw)
To: dri-devel; +Cc: Hyun Kwon
Use of 32bit RGB samples, where each component is 8bit, cannot
support formats with components greater than 8bit (ex, XRGB2101010).
Introduce MAKE_RGBA_64() which creates pixels from a 64bit sample.
Each component in a 64bit sample is 16bit long, thus a pixel with 10bit
components can be generated correctly.
MAKE_RGBA() can use MAKE_RGBA_64() by scaling each 8bit component
to 16bit, for compatilbity.
Signed-off-by: Hyun Kwon <hyun.kwon@xilinx.com>
---
tests/util/pattern.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/tests/util/pattern.c b/tests/util/pattern.c
index 9fa0a41..aa067c9 100644
--- a/tests/util/pattern.c
+++ b/tests/util/pattern.c
@@ -60,11 +60,17 @@ struct color_yuv {
.u = MAKE_YUV_601_U(r, g, b), \
.v = MAKE_YUV_601_V(r, g, b) }
+#define COLOR_MASK(value, color) \
+ ((value & ((1 << (color).length) - 1)) << (color).offset)
+
+#define MAKE_RGBA_64(rgb, r, g, b, a) \
+ (COLOR_MASK(((r) >> (16 - (rgb)->red.length)), (rgb)->red) | \
+ COLOR_MASK(((g) >> (16 - (rgb)->green.length)), (rgb)->green) | \
+ COLOR_MASK(((b) >> (16 - (rgb)->blue.length)), (rgb)->blue) | \
+ COLOR_MASK(((a) >> (16 - (rgb)->alpha.length)), (rgb)->alpha))
+
#define MAKE_RGBA(rgb, r, g, b, a) \
- ((((r) >> (8 - (rgb)->red.length)) << (rgb)->red.offset) | \
- (((g) >> (8 - (rgb)->green.length)) << (rgb)->green.offset) | \
- (((b) >> (8 - (rgb)->blue.length)) << (rgb)->blue.offset) | \
- (((a) >> (8 - (rgb)->alpha.length)) << (rgb)->alpha.offset))
+ MAKE_RGBA_64(rgb, (r) * 0x101, (g) * 0x101, (b) * 0x101, (a) * 0x101)
#define MAKE_RGB24(rgb, r, g, b) \
{ .value = MAKE_RGBA(rgb, r, g, b, 0) }
--
2.7.4
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH libdrm 2/3] modetest: Add support for YUV422 and YUV444
2018-07-08 2:35 [PATCH libdrm 0/3] Enable more formats in modetest Hyun Kwon
2018-07-08 2:35 ` [PATCH libdrm 1/3] tests: util: pattern: Use 64bit RGB samples Hyun Kwon
@ 2018-07-08 2:35 ` Hyun Kwon
2018-07-08 2:35 ` [PATCH libdrm 3/3] tests: util: " Hyun Kwon
2 siblings, 0 replies; 5+ messages in thread
From: Hyun Kwon @ 2018-07-08 2:35 UTC (permalink / raw)
To: dri-devel; +Cc: Hyun Kwon
This allows dumb buffer allocation for YUV422 and YUV444 with correct
subsampling values.
Signed-off-by: Hyun Kwon <hyun.kwon@xilinx.com>
---
tests/modetest/buffers.c | 29 ++++++++++++++++++++++++++---
1 file changed, 26 insertions(+), 3 deletions(-)
diff --git a/tests/modetest/buffers.c b/tests/modetest/buffers.c
index 9b635c0..769399e 100644
--- a/tests/modetest/buffers.c
+++ b/tests/modetest/buffers.c
@@ -127,7 +127,7 @@ bo_create(int fd, unsigned int format,
unsigned int handles[4], unsigned int pitches[4],
unsigned int offsets[4], enum util_fill_pattern pattern)
{
- unsigned int virtual_height;
+ unsigned int virtual_height, hsub, vsub;
struct bo *bo;
unsigned int bpp;
void *planes[3] = { 0, };
@@ -141,6 +141,10 @@ bo_create(int fd, unsigned int format,
case DRM_FORMAT_NV61:
case DRM_FORMAT_YUV420:
case DRM_FORMAT_YVU420:
+ case DRM_FORMAT_YUV422:
+ case DRM_FORMAT_YVU422:
+ case DRM_FORMAT_YUV444:
+ case DRM_FORMAT_YVU444:
bpp = 8;
break;
@@ -204,15 +208,30 @@ bo_create(int fd, unsigned int format,
case DRM_FORMAT_YUV420:
case DRM_FORMAT_YVU420:
virtual_height = height * 3 / 2;
+ hsub = 2;
+ vsub = 2;
break;
case DRM_FORMAT_NV16:
case DRM_FORMAT_NV61:
+ case DRM_FORMAT_YUV422:
+ case DRM_FORMAT_YVU422:
virtual_height = height * 2;
+ hsub = 2;
+ vsub = 1;
+ break;
+
+ case DRM_FORMAT_YUV444:
+ case DRM_FORMAT_YVU444:
+ virtual_height = height * 3;
+ hsub = 1;
+ vsub = 1;
break;
default:
virtual_height = height;
+ hsub = 1;
+ vsub = 1;
break;
}
@@ -260,14 +279,18 @@ bo_create(int fd, unsigned int format,
case DRM_FORMAT_YUV420:
case DRM_FORMAT_YVU420:
+ case DRM_FORMAT_YUV422:
+ case DRM_FORMAT_YVU422:
+ case DRM_FORMAT_YUV444:
+ case DRM_FORMAT_YVU444:
offsets[0] = 0;
handles[0] = bo->handle;
pitches[0] = bo->pitch;
- pitches[1] = pitches[0] / 2;
+ pitches[1] = pitches[0] / hsub;
offsets[1] = pitches[0] * height;
handles[1] = bo->handle;
pitches[2] = pitches[1];
- offsets[2] = offsets[1] + pitches[1] * height / 2;
+ offsets[2] = offsets[1] + pitches[1] * height / vsub;
handles[2] = bo->handle;
planes[0] = virtual;
--
2.7.4
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH libdrm 3/3] tests: util: Add support for YUV422 and YUV444
2018-07-08 2:35 [PATCH libdrm 0/3] Enable more formats in modetest Hyun Kwon
2018-07-08 2:35 ` [PATCH libdrm 1/3] tests: util: pattern: Use 64bit RGB samples Hyun Kwon
2018-07-08 2:35 ` [PATCH libdrm 2/3] modetest: Add support for YUV422 and YUV444 Hyun Kwon
@ 2018-07-08 2:35 ` Hyun Kwon
2 siblings, 0 replies; 5+ messages in thread
From: Hyun Kwon @ 2018-07-08 2:35 UTC (permalink / raw)
To: dri-devel; +Cc: Hyun Kwon
Enable YUV422 and YUV444 formats by adding to the format table
and pattern generation calls.
Signed-off-by: Hyun Kwon <hyun.kwon@xilinx.com>
---
tests/util/format.c | 4 ++++
tests/util/pattern.c | 8 ++++++++
2 files changed, 12 insertions(+)
diff --git a/tests/util/format.c b/tests/util/format.c
index 15ac5e1..b48594c 100644
--- a/tests/util/format.c
+++ b/tests/util/format.c
@@ -52,6 +52,10 @@ static const struct util_format_info format_info[] = {
/* YUV planar */
{ DRM_FORMAT_YUV420, "YU12", MAKE_YUV_INFO(YUV_YCbCr, 2, 2, 1) },
{ DRM_FORMAT_YVU420, "YV12", MAKE_YUV_INFO(YUV_YCrCb, 2, 2, 1) },
+ { DRM_FORMAT_YUV422, "YU16", MAKE_YUV_INFO(YUV_YCbCr, 2, 1, 1) },
+ { DRM_FORMAT_YVU422, "YV16", MAKE_YUV_INFO(YUV_YCrCb, 2, 1, 1) },
+ { DRM_FORMAT_YUV444, "YU24", MAKE_YUV_INFO(YUV_YCbCr, 1, 1, 1) },
+ { DRM_FORMAT_YVU444, "YV24", MAKE_YUV_INFO(YUV_YCrCb, 1, 1, 1) },
/* RGB16 */
{ DRM_FORMAT_ARGB4444, "AR12", MAKE_RGB_INFO(4, 8, 4, 4, 4, 0, 4, 12) },
{ DRM_FORMAT_XRGB4444, "XR12", MAKE_RGB_INFO(4, 8, 4, 4, 4, 0, 0, 0) },
diff --git a/tests/util/pattern.c b/tests/util/pattern.c
index aa067c9..2805724 100644
--- a/tests/util/pattern.c
+++ b/tests/util/pattern.c
@@ -487,10 +487,14 @@ static void fill_smpte(const struct util_format_info *info, void *planes[3],
width, height, stride);
case DRM_FORMAT_YUV420:
+ case DRM_FORMAT_YUV422:
+ case DRM_FORMAT_YUV444:
return fill_smpte_yuv_planar(&info->yuv, planes[0], planes[1],
planes[2], width, height, stride);
case DRM_FORMAT_YVU420:
+ case DRM_FORMAT_YVU422:
+ case DRM_FORMAT_YVU444:
return fill_smpte_yuv_planar(&info->yuv, planes[0], planes[2],
planes[1], width, height, stride);
@@ -772,10 +776,14 @@ static void fill_tiles(const struct util_format_info *info, void *planes[3],
width, height, stride);
case DRM_FORMAT_YUV420:
+ case DRM_FORMAT_YUV422:
+ case DRM_FORMAT_YUV444:
return fill_tiles_yuv_planar(info, planes[0], planes[1],
planes[2], width, height, stride);
case DRM_FORMAT_YVU420:
+ case DRM_FORMAT_YVU422:
+ case DRM_FORMAT_YVU444:
return fill_tiles_yuv_planar(info, planes[0], planes[2],
planes[1], width, height, stride);
--
2.7.4
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-07-08 2:37 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-08 2:35 [PATCH libdrm 0/3] Enable more formats in modetest Hyun Kwon
2018-07-08 2:35 ` [PATCH libdrm 1/3] tests: util: pattern: Use 64bit RGB samples Hyun Kwon
2018-07-08 2:35 ` [PATCH libdrm 2/3] modetest: Add support for YUV422 and YUV444 Hyun Kwon
2018-07-08 2:35 ` [PATCH libdrm 3/3] tests: util: " Hyun Kwon
-- strict thread matches above, loose matches on Subject: below --
2018-05-04 23:40 [PATCH LIBDRM 0/3] Enable more formats in modetest Hyun Kwon
2018-05-04 23:40 ` [PATCH LIBDRM 2/3] modetest: Add support for YUV422 and YUV444 Hyun Kwon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).