lib/igt_fb: Added XYUV format support for testing
PATCH v5 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.
--- include/drm-uapi/drm_fourcc.h | 1 + lib/igt_fb.c | 89 +++++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+)
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_XYUV 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
Signature · 6 lines
2.17.0 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Patchwork
CI[igt-dev] ✗ Fi.CI.BAT: failure for lib/igt_fb: Added XYUV format support for testing (rev5)
== Series Details ==
== Series Details ==
Series: lib/igt_fb: Added XYUV format support for testing (rev5)
URL : https://patchwork.freedesktop.org/series/48789/
State : failure
== Summary ==
= CI Bug Log - changes from CI_DRM_4791 -> IGTPW_1817 =
== Summary - FAILURE ==
Serious unknown changes coming with IGTPW_1817 absolutely need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in IGTPW_1817, 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/5/mbox/
== Possible new issues ==
Here are the unknown changes that may have been introduced in IGTPW_1817:
=== IGT changes ===
==== Possible regressions ====
igt@kms_flip@basic-flip-vs-dpms:
fi-ilk-650: PASS -> FAIL +4
fi-pnv-d510: PASS -> FAIL +3
fi-skl-6770hq: PASS -> FAIL +3
fi-ivb-3520m: PASS -> FAIL +3
fi-snb-2520m: PASS -> FAIL +3
fi-gdg-551: PASS -> FAIL +3
fi-kbl-7500u: PASS -> FAIL +4
fi-bdw-gvtdvm: PASS -> FAIL +3
fi-glk-dsi: NOTRUN -> FAIL +3
igt@kms_flip@basic-flip-vs-modeset:
fi-blb-e6850: NOTRUN -> FAIL +3
fi-byt-j1900: PASS -> FAIL +3
fi-ivb-3770: PASS -> FAIL +3
fi-glk-j4005: PASS -> FAIL +3
fi-bxt-j4205: PASS -> FAIL +3
fi-hsw-4770: PASS -> FAIL +3
fi-cfl-s3: PASS -> FAIL +3
igt@kms_flip@basic-flip-vs-wf_vblank:
fi-icl-u: PASS -> FAIL +3
fi-snb-2600: PASS -> FAIL +3
fi-skl-6260u: PASS -> FAIL +3
fi-hsw-4770r: PASS -> FAIL +3
fi-bdw-samus: PASS -> FAIL +3
fi-cfl-8109u: PASS -> FAIL +4
fi-kbl-r: PASS -> FAIL +3
fi-bwr-2160: PASS -> FAIL +3
fi-bdw-5557u: PASS -> FAIL +3
fi-bsw-kefka: PASS -> FAIL +3
fi-skl-gvtdvm: PASS -> FAIL +3
fi-byt-clapper: PASS -> FAIL +3
igt@kms_flip@basic-plain-flip:
fi-bsw-n3050: PASS -> FAIL +3
fi-byt-n2820: PASS -> FAIL +3
fi-cfl-guc: PASS -> FAIL +3
fi-skl-iommu: PASS -> FAIL +3
fi-cnl-psr: PASS -> FAIL +3
fi-bxt-dsi: PASS -> FAIL +3
fi-kbl-7560u: PASS -> FAIL +3
fi-skl-6600u: PASS -> FAIL +3
fi-whl-u: PASS -> FAIL +3
fi-cfl-8700k: PASS -> FAIL +3
fi-skl-guc: PASS -> FAIL +4
fi-kbl-7567u: PASS -> FAIL +3
fi-elk-e7500: PASS -> FAIL +3
igt@kms_setmode@basic-clone-single-crtc:
fi-skl-6700k2: PASS -> FAIL +4== Known issues ==
Here are the changes found in IGTPW_1817 that come from known issues:
=== IGT changes ===
==== Issues hit ====
igt@amdgpu/amd_prime@amd-to-i915:
fi-kbl-8809g: NOTRUN -> FAIL (fdo#107341)
igt@drv_selftest@live_guc:
fi-cfl-guc: PASS -> DMESG-WARN (fdo#107258)
igt@drv_selftest@live_hangcheck:
fi-skl-guc: PASS -> DMESG-FAIL (fdo#106685)
igt@gem_exec_suspend@basic-s3:
fi-skl-caroline: NOTRUN -> INCOMPLETE (fdo#107556, fdo#104108)
fi-kbl-soraka: NOTRUN -> INCOMPLETE (fdo#107774, fdo#107556)
igt@kms_chamelium@hdmi-hpd-fast:
fi-kbl-7500u: SKIP -> FAIL (fdo#103841, fdo#102672)
igt@kms_pipe_crc_basic@nonblocking-crc-pipe-a:
fi-byt-clapper: PASS -> FAIL (fdo#107362)
igt@kms_psr@primary_page_flip:
fi-kbl-r: PASS -> FAIL (fdo#107336)
igt@pm_rpm@module-reload:
fi-glk-j4005: PASS -> DMESG-WARN (fdo#106000)
==== Possible fixes ====
igt@amdgpu/amd_basic@cs-sdma:
fi-skl-6700k2: FAIL (fdo#107888) -> SKIP +7
igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
fi-byt-clapper: FAIL (fdo#103191, fdo#107362) -> PASS
igt@kms_psr@primary_page_flip:
fi-whl-u: FAIL (fdo#107336) -> PASS fdo#102672 https://bugs.freedesktop.org/show_bug.cgi?id=102672
fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
fdo#103841 https://bugs.freedesktop.org/show_bug.cgi?id=103841
fdo#104108 https://bugs.freedesktop.org/show_bug.cgi?id=104108
fdo#106000 https://bugs.freedesktop.org/show_bug.cgi?id=106000
fdo#106685 https://bugs.freedesktop.org/show_bug.cgi?id=106685
fdo#107258 https://bugs.freedesktop.org/show_bug.cgi?id=107258
fdo#107336 https://bugs.freedesktop.org/show_bug.cgi?id=107336
fdo#107341 https://bugs.freedesktop.org/show_bug.cgi?id=107341
fdo#107362 https://bugs.freedesktop.org/show_bug.cgi?id=107362
fdo#107556 https://bugs.freedesktop.org/show_bug.cgi?id=107556
fdo#107774 https://bugs.freedesktop.org/show_bug.cgi?id=107774
fdo#107888 https://bugs.freedesktop.org/show_bug.cgi?id=107888
== Participating hosts (46 -> 47) ==
Additional (5): fi-kbl-soraka fi-skl-caroline fi-blb-e6850 fi-glk-dsi fi-kbl-8809g
Missing (4): fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-hsw-4200u
== Build changes ==
* IGT: IGT_4636 -> IGTPW_1817
CI_DRM_4791: 07cf212bc704357ee60aba52ec40bab538222040 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_1817: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1817/
IGT_4636: 40de31df52ffed5e392d607a83e3aea4efb150e6 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1817/issues.html
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Quoted 6 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.
Quoted 8 lines
v3: Fixed
kms_available_modes_crctest 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_fbto support XYUV
properly.v5: Fixed a coding typo.
Minor comment: this change will fail all test cases where drmModeAddFB2 is called with DRM_FORMAT_XYUV until correspondent kernel patch is not in use, as many igt test cases do not check if that kernel format is supported or not, so drmModeAddFB2 will simply fail.
Quoted 201 lines
Signed-off-by Stanislav Lisovskiy <[email protected]>--- include/drm-uapi/drm_fourcc.h | 1 + lib/igt_fb.c | 89 +++++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+)include/drm- renamed from include/drm-uapi/drm_fourcc.h +0
-0
uapi/drm_fourcc.h
indexe04613d3..0bf66de2100644include/drm-uapi/drm_fourcc.h +0
-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_AYUVfourcc_code('A', 'Y', 'U',
'V') /* [31:0] A:Y:Cb:Cr 8:8:8:8 little endian */
+#defineDRM_FORMAT_XYUVfourcc_code('X', 'Y', 'U',
'V') /* [31:0] X:Y:Cb:Cr 8:8:8:8 little endian *//*
* 2 plane RGB + Alib/igt_fb.c +4
-0@@ -72,6 +72,10 @@ static struct format_desc_struct { .cairo_id = CAIRO_FORMAT_RGB16_565, .num_planes = 1, .plane_bpp = { 16, }, }, + { .name = "XYUV", .depth = 24, .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,lib/igt_fb.c +3
-0.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));lib/igt_fb.c +1
-0+break ;case DRM_FORMAT_YUYV :case DRM_FORMAT_YVYU : wmemset(ptr, full_range ? 0x80008000:
0x80108010,lib/igt_fb.c +0
-0@@ -1500,6 +1508,79 @@ static void convert_nv12_to_rgb24(struct
igt_fb*fb, structfb_convert_blit_uplolib/igt_fb.c +1
-0free (buf); } +static void convert_yuv444_to_rgb24(struct igt_fb *fb, struct
fb_convert_blit_upload*blit)lib/igt_fb.c +5
-0+{ +int i, j; +uint8_t *yuv24; +uint8_t *rgb24 = blit->rgb24.map; + unsigned rgb24_stride = blit->rgb24.stride, planar_stride =
blit->linear.stride;lib/igt_fb.c +2
-0+uint8_t *buf =malloc (blit->linear.size); + struct igt_mat4 m = igt_ycbcr_to_rgb_matrix(fb-Quoted 1 line
color_encoding,lib/igt_fb.c +1
-0+ fb-Quoted 1 line
color_range);lib/igt_fb.c +3
-0+ +/* +* Reading from the BO is awfully slow because of lack of read caching,
lib/igt_fb.c +1
-0+* it's faster to copy the whole BO to a temporary buffer and convert
lib/igt_fb.c +3
-0+* from there. +*/ + igt_memcpy_from_wc(buf, blit->linear.map, blit-Quoted 1 line
linear.size);
lib/igt_fb.c +9
-0+ 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)];
lib/igt_fb.c +1
-0+ u = yuv24[i * planar_stride +j*sizeof(uint32_t) + 1];
lib/igt_fb.c +1
-0+ y = yuv24[i * planar_stride +j*sizeof(uint32_t) + 2];
lib/igt_fb.c +8
-0+ 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);
lib/igt_fb.c +8
-0+ } + } + +free (buf); +} + + +static void convert_rgb24_to_yuv444(struct igt_fb *fb, struct
fb_convert_blit_upload*blit)lib/igt_fb.c +5
-0+{ +int i, j; +uint8_t *rgb24; +uint8_t *yuv444 = blit->linear.map; + unsigned rgb24_stride = blit->rgb24.stride, planar_stride =
blit->linear.stride;lib/igt_fb.c +1
-0+ struct igt_mat4 m = igt_rgb_to_ycbcr_matrix(fb-Quoted 1 line
color_encoding,lib/igt_fb.c +1
-0+ fb-Quoted 1 line
color_range);lib/igt_fb.c +10
-0+ + 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)]);
lib/igt_fb.c +4
-0+ + yuv =igt_matrix_transform (&m, &rgb); + + yuv444[i * planar_stride +j*sizeof(uint32_t)] = yuv.d[2];
lib/igt_fb.c +1
-0+ yuv444[i * planar_stride +j*sizeof(uint32_t) + 1] = yuv.d[1];
lib/igt_fb.c +1
-0+ yuv444[i * planar_stride +j*sizeof(uint32_t) + 2] = yuv.d[0];
lib/igt_fb.c +7
-0+ } + } +} + + + + static void convert_rgb24_to_nv12(struct igt_fb *fb, struct
fb_convert_blit_upload*blit)
{lib/igt_fb.c +3
-0int 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",lib/igt_fb.c +3
-0fb->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",lib/igt_fb.c +1
-0fb->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 descriptorlib/igt_fb.c +1
-0@@ -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;
Signature · 7 lines
Best Regards, Lisovskiy Stanislav _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Quoted 14 lines · Stanislav
Quoted 13 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_crctest 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_fbto support XYUV
properly.
Quoted 7 lines
Quoted 1 line
v5: Fixed a coding typo.
Minor comment: this change will fail all test cases where drmModeAddFB2 is called with
DRM_FORMAT_XYUVuntil correspondent kernel patch is not in use, as many igt test cases do not check if that kernel format is supported or not, so drmModeAddFB2 will simply fail.
Which tests are those? They should be fixed.
Quoted 210 lines
Quoted 202 lines
Signed-off-by Stanislav Lisovskiy <[email protected]>--- include/drm-uapi/drm_fourcc.h | 1 + lib/igt_fb.c | 89 +++++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+)include/drm- renamed from include/drm-uapi/drm_fourcc.h +0
-0
uapi/drm_fourcc.h
indexe04613d3..0bf66de2100644include/drm-uapi/drm_fourcc.h +0
-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_AYUVfourcc_code('A', 'Y', 'U',
'V') /* [31:0] A:Y:Cb:Cr 8:8:8:8 little endian */
+#defineDRM_FORMAT_XYUVfourcc_code('X', 'Y', 'U',
'V') /* [31:0] X:Y:Cb:Cr 8:8:8:8 little endian *//*
* 2 plane RGB + Alib/igt_fb.c +4
-0@@ -72,6 +72,10 @@ static struct format_desc_struct { .cairo_id = CAIRO_FORMAT_RGB16_565, .num_planes = 1, .plane_bpp = { 16, }, }, + { .name = "XYUV", .depth = 24, .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,lib/igt_fb.c +3
-0.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));lib/igt_fb.c +1
-0+break ;case DRM_FORMAT_YUYV :case DRM_FORMAT_YVYU : wmemset(ptr, full_range ? 0x80008000:
0x80108010,lib/igt_fb.c +0
-0@@ -1500,6 +1508,79 @@ static void convert_nv12_to_rgb24(struct
igt_fb*fb, structfb_convert_blit_uplolib/igt_fb.c +1
-0free (buf); } +static void convert_yuv444_to_rgb24(struct igt_fb *fb, struct
fb_convert_blit_upload*blit)lib/igt_fb.c +5
-0+{ +int i, j; +uint8_t *yuv24; +uint8_t *rgb24 = blit->rgb24.map; + unsigned rgb24_stride = blit->rgb24.stride, planar_stride =
blit->linear.stride;lib/igt_fb.c +2
-0+uint8_t *buf =malloc (blit->linear.size); + struct igt_mat4 m = igt_ycbcr_to_rgb_matrix(fb-Quoted 1 line
color_encoding,lib/igt_fb.c +1
-0+ fb-Quoted 1 line
color_range);lib/igt_fb.c +3
-0+ +/* +* Reading from the BO is awfully slow because of lack of read caching,
lib/igt_fb.c +1
-0+* it's faster to copy the whole BO to a temporary buffer and convert
lib/igt_fb.c +3
-0+* from there. +*/ + igt_memcpy_from_wc(buf, blit->linear.map, blit-Quoted 1 line
linear.size);
lib/igt_fb.c +9
-0+ 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)];
lib/igt_fb.c +1
-0+ u = yuv24[i * planar_stride +j*sizeof(uint32_t) + 1];
lib/igt_fb.c +1
-0+ y = yuv24[i * planar_stride +j*sizeof(uint32_t) + 2];
lib/igt_fb.c +8
-0+ 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);
lib/igt_fb.c +8
-0+ } + } + +free (buf); +} + + +static void convert_rgb24_to_yuv444(struct igt_fb *fb, struct
fb_convert_blit_upload*blit)lib/igt_fb.c +5
-0+{ +int i, j; +uint8_t *rgb24; +uint8_t *yuv444 = blit->linear.map; + unsigned rgb24_stride = blit->rgb24.stride, planar_stride =
blit->linear.stride;lib/igt_fb.c +1
-0+ struct igt_mat4 m = igt_rgb_to_ycbcr_matrix(fb-Quoted 1 line
color_encoding,lib/igt_fb.c +1
-0+ fb-Quoted 1 line
color_range);lib/igt_fb.c +10
-0+ + 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)]);
lib/igt_fb.c +4
-0+ + yuv =igt_matrix_transform (&m, &rgb); + + yuv444[i * planar_stride +j*sizeof(uint32_t)] = yuv.d[2];
lib/igt_fb.c +1
-0+ yuv444[i * planar_stride +j*sizeof(uint32_t) + 1] = yuv.d[1];
lib/igt_fb.c +1
-0+ yuv444[i * planar_stride +j*sizeof(uint32_t) + 2] = yuv.d[0];
lib/igt_fb.c +7
-0+ } + } +} + + + + static void convert_rgb24_to_nv12(struct igt_fb *fb, struct
fb_convert_blit_upload*blit)
{lib/igt_fb.c +3
-0int 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",lib/igt_fb.c +3
-0fb->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",lib/igt_fb.c +1
-0fb->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 descriptorlib/igt_fb.c +1
-0@@ -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;Signature · 7 lines
Best Regards, Lisovskiy Stanislav _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Signature · 6 lines
Ville Syrjälä Intel _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Quoted 17 lines · Ville Syrjälä
Quoted 16 lines · Stanislav
Quoted 14 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_crctest 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_fbto support XYUV
properly.v5: Fixed a coding typo.
Quoted 7 lines
Quoted 5 lines
Minor comment: this change will fail all test cases where drmModeAddFB2 is called with
DRM_FORMAT_XYUVuntil correspondent kernel patch is not in use, as many igt test cases do not check if that kernel format is supported or not, so drmModeAddFB2 will simply fail.Which tests are those? They should be fixed.
Those are:
igt@kms_flip@basic-flip-vs-dpms
igt@kms_flip@basic-flip-vs-modeset
igt@kms_flip@basic-flip-vs-wf_vblank
igt@kms_flip@basic-plain-flip
igt@kms_setmode@basic-clone-single-crtc
Probably good idea to fix it so that it chooses only formats specified in drm_plane->formats and igt_fb_supported_format, like in kms_plane.
Otherwise for example in kms_flip, it uses igt_bpp_depth_to_drm_format which chooses any format with matching bpp and depth, which in case of XRGB8888, also is the same for XYUV.
Quoted 236 lines
Quoted 234 lines
Quoted 225 lines
Signed-off-by Stanislav Lisovskiy <[email protected]Quoted 1 line
--- include/drm-uapi/drm_fourcc.h | 1 + lib/igt_fb.c | 89 +++++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+)include/drm- renamed from include/drm-uapi/drm_fourcc.h +0
-0
uapi/drm_fourcc.h
indexe04613d3..0bf66de2100644include/drm-uapi/drm_fourcc.h +0
-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_AYUVfourcc_code('A', 'Y',
'U',
'V') /* [31:0] A:Y:Cb:Cr 8:8:8:8 little endian */
+#defineDRM_FORMAT_XYUVfourcc_code('X', 'Y',
'U',
'V') /* [31:0] X:Y:Cb:Cr 8:8:8:8 little endian *//*
* 2 plane RGB + Alib/igt_fb.c +4
-0@@ -72,6 +72,10 @@ static struct format_desc_struct { .cairo_id = CAIRO_FORMAT_RGB16_565, .num_planes = 1, .plane_bpp = { 16, }, }, + { .name = "XYUV", .depth = 24, .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,lib/igt_fb.c +2
-0.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,lib/igt_fb.c +1
-0+ calculated_stride *height /
sizeof(wchar_t));lib/igt_fb.c +1
-0+break ;case DRM_FORMAT_YUYV :case DRM_FORMAT_YVYU : wmemset(ptr, full_range ?
0x80008000
:0x80108010,lib/igt_fb.c +0
-0@@ -1500,6 +1508,79 @@ static void convert_nv12_to_rgb24(struct
igt_fb*fb, structfb_convert_blit_uplolib/igt_fb.c +1
-0free (buf); } +static void convert_yuv444_to_rgb24(struct igt_fb *fb, struct
fb_convert_blit_upload*blit)lib/igt_fb.c +5
-0+{ +int i, j; +uint8_t *yuv24; +uint8_t *rgb24 = blit->rgb24.map; + unsigned rgb24_stride = blit->rgb24.stride,
planar_stride=blit->linear.stride;lib/igt_fb.c +2
-0+uint8_t *buf =malloc (blit->linear.size); + struct igt_mat4 m = igt_ycbcr_to_rgb_matrix(fb-Quoted 1 line
color_encoding,lib/igt_fb.c +1
-0+ fb-Quoted 1 line
color_range);lib/igt_fb.c +3
-0+ +/* +* Reading from the BO is awfully slow because of lack of
read caching,lib/igt_fb.c +1
-0+* it's faster to copy the whole BO to a temporary buffer
and convertlib/igt_fb.c +3
-0+* from there. +*/ + igt_memcpy_from_wc(buf, blit->linear.map, blit-Quoted 1 line
linear.size);
lib/igt_fb.c +9
-0+ 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)];
lib/igt_fb.c +1
-0+ u = yuv24[i * planar_stride +j*sizeof(uint32_t) + 1];
lib/igt_fb.c +1
-0+ y = yuv24[i * planar_stride +j*sizeof(uint32_t) + 2];
lib/igt_fb.c +8
-0+ 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);
lib/igt_fb.c +8
-0+ } + } + +free (buf); +} + + +static void convert_rgb24_to_yuv444(struct igt_fb *fb, struct
fb_convert_blit_upload*blit)lib/igt_fb.c +5
-0+{ +int i, j; +uint8_t *rgb24; +uint8_t *yuv444 = blit->linear.map; + unsigned rgb24_stride = blit->rgb24.stride,
planar_stride=blit->linear.stride;lib/igt_fb.c +1
-0+ struct igt_mat4 m = igt_rgb_to_ycbcr_matrix(fb-Quoted 1 line
color_encoding,lib/igt_fb.c +1
-0+ fb-Quoted 1 line
color_range);lib/igt_fb.c +10
-0+ + 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)]);
lib/igt_fb.c +4
-0+ + yuv =igt_matrix_transform (&m, &rgb); + + yuv444[i * planar_stride +j*sizeof(uint32_t)] = yuv.d[2];
lib/igt_fb.c +1
-0+ yuv444[i * planar_stride +j*sizeof(uint32_t) + 1] = yuv.d[1];
lib/igt_fb.c +1
-0+ yuv444[i * planar_stride +j*sizeof(uint32_t) + 2] = yuv.d[0];
lib/igt_fb.c +7
-0+ } + } +} + + + + static void convert_rgb24_to_nv12(struct igt_fb *fb, struct
fb_convert_blit_upload*blit)
{lib/igt_fb.c +0
-0int i, j;@@ -1756,6 +1837,9 @@ static voiddestroy_cairo_surface__convert(void
*arg)lib/igt_fb.c +0
-0case DRM_FORMAT_VYUY : convert_rgb24_to_yuyv(fb, blit, yuyv_swizzle(fb-Quoted 1 line
drm_format));lib/igt_fb.c +3
-0break ; +case DRM_FORMAT_XYUV : +convert_rgb24_to_yuv444 (fb, blit); +break ;default : igt_assert_f(false, "Conversion not implementedfor
formats 0x%x\n",lib/igt_fb.c +0
-0fb->drm_format);@@ -1809,6 +1893,9 @@ static voidcreate_cairo_surface__convert(int
fd, structigt_fb*fb)lib/igt_fb.c +0
-0case DRM_FORMAT_VYUY : convert_yuyv_to_rgb24(fb, blit, yuyv_swizzle(fb-Quoted 1 line
drm_format));lib/igt_fb.c +3
-0break ; +case DRM_FORMAT_XYUV : +convert_yuv444_to_rgb24 (fb, blit); +break ;default : igt_assert_f(false, "Conversion not implementedfor
formats 0x%x\n",lib/igt_fb.c +0
-0fb->drm_format);@@ -1825,6 +1912,7 @@ static voidcreate_cairo_surface__convert(int
fd, structigt_fb*fb)
blit,destroy_cairo_surface__convert);
}lib/igt_fb.c +2
-0+/** * 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;Signature · 7 lines
Best Regards, Lisovskiy Stanislav _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Signature · 7 lines
Best Regards, Lisovskiy Stanislav _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Quoted 36 lines · Stanislav
Quoted 17 lines · Ville Syrjälä
Quoted 16 lines · Stanislav
Quoted 14 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_crctest 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_fbto support XYUV
properly.v5: Fixed a coding typo.
Quoted 7 lines
Quoted 5 lines
Minor comment: this change will fail all test cases where drmModeAddFB2 is called with
DRM_FORMAT_XYUVuntil correspondent kernel patch is not in use, as many igt test cases do not check if that kernel format is supported or not, so drmModeAddFB2 will simply fail.Which tests are those? They should be fixed.
Those are:
igt@kms_flip@basic-flip-vs-dpms
igt@kms_flip@basic-flip-vs-modeset
igt@kms_flip@basic-flip-vs-wf_vblank
igt@kms_flip@basic-plain-flip
Quoted 8 lines
igt@kms_setmode@basic-clone-single-crtc
Probably good idea to fix it so that it chooses only formats specified in
drm_plane->formatsandigt_fb_supported_format, like inkms_plane.
Otherwise for example inkms_flip, it usesigt_bpp_depth_to_drm_formatwhich chooses any format with matching bpp and depth, which in case of XRGB8888, also is the same for XYUV.
IIRC all YUV formats should have a depth of -1 in that table, pretty much exactly for this reason. You never want to pick an YUV format when just specifying depth/bpp.
Quoted 242 lines
Quoted 238 lines
Quoted 236 lines
Quoted 227 lines
Signed-off-by Stanislav Lisovskiy <[email protected]Quoted 1 line
--- include/drm-uapi/drm_fourcc.h | 1 + lib/igt_fb.c | 89 +++++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+)include/drm- renamed from include/drm-uapi/drm_fourcc.h +0
-0
uapi/drm_fourcc.h
indexe04613d3..0bf66de2100644include/drm-uapi/drm_fourcc.h +0
-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_AYUVfourcc_code('A', 'Y',
'U',
'V') /* [31:0] A:Y:Cb:Cr 8:8:8:8 little endian */
+#defineDRM_FORMAT_XYUVfourcc_code('X', 'Y',
'U',
'V') /* [31:0] X:Y:Cb:Cr 8:8:8:8 little endian *//*
* 2 plane RGB + Alib/igt_fb.c +4
-0@@ -72,6 +72,10 @@ static struct format_desc_struct { .cairo_id = CAIRO_FORMAT_RGB16_565, .num_planes = 1, .plane_bpp = { 16, }, }, + { .name = "XYUV", .depth = 24, .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,lib/igt_fb.c +2
-0.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,lib/igt_fb.c +1
-0+ calculated_stride *height /
sizeof(wchar_t));lib/igt_fb.c +1
-0+break ;case DRM_FORMAT_YUYV :case DRM_FORMAT_YVYU : wmemset(ptr, full_range ?
0x80008000
:0x80108010,lib/igt_fb.c +0
-0@@ -1500,6 +1508,79 @@ static void convert_nv12_to_rgb24(struct
igt_fb*fb, structfb_convert_blit_uplolib/igt_fb.c +1
-0free (buf); } +static void convert_yuv444_to_rgb24(struct igt_fb *fb, struct
fb_convert_blit_upload*blit)lib/igt_fb.c +5
-0+{ +int i, j; +uint8_t *yuv24; +uint8_t *rgb24 = blit->rgb24.map; + unsigned rgb24_stride = blit->rgb24.stride,
planar_stride=blit->linear.stride;lib/igt_fb.c +2
-0+uint8_t *buf =malloc (blit->linear.size); + struct igt_mat4 m = igt_ycbcr_to_rgb_matrix(fb-Quoted 1 line
color_encoding,lib/igt_fb.c +1
-0+ fb-Quoted 1 line
color_range);lib/igt_fb.c +3
-0+ +/* +* Reading from the BO is awfully slow because of lack of
read caching,lib/igt_fb.c +1
-0+* it's faster to copy the whole BO to a temporary buffer
and convertlib/igt_fb.c +3
-0+* from there. +*/ + igt_memcpy_from_wc(buf, blit->linear.map, blit-Quoted 1 line
linear.size);
lib/igt_fb.c +9
-0+ 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)];
lib/igt_fb.c +1
-0+ u = yuv24[i * planar_stride +j*sizeof(uint32_t) + 1];
lib/igt_fb.c +1
-0+ y = yuv24[i * planar_stride +j*sizeof(uint32_t) + 2];
lib/igt_fb.c +8
-0+ 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);
lib/igt_fb.c +8
-0+ } + } + +free (buf); +} + + +static void convert_rgb24_to_yuv444(struct igt_fb *fb, struct
fb_convert_blit_upload*blit)lib/igt_fb.c +5
-0+{ +int i, j; +uint8_t *rgb24; +uint8_t *yuv444 = blit->linear.map; + unsigned rgb24_stride = blit->rgb24.stride,
planar_stride=blit->linear.stride;lib/igt_fb.c +1
-0+ struct igt_mat4 m = igt_rgb_to_ycbcr_matrix(fb-Quoted 1 line
color_encoding,lib/igt_fb.c +1
-0+ fb-Quoted 1 line
color_range);lib/igt_fb.c +10
-0+ + 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)]);
lib/igt_fb.c +4
-0+ + yuv =igt_matrix_transform (&m, &rgb); + + yuv444[i * planar_stride +j*sizeof(uint32_t)] = yuv.d[2];
lib/igt_fb.c +1
-0+ yuv444[i * planar_stride +j*sizeof(uint32_t) + 1] = yuv.d[1];
lib/igt_fb.c +1
-0+ yuv444[i * planar_stride +j*sizeof(uint32_t) + 2] = yuv.d[0];
lib/igt_fb.c +7
-0+ } + } +} + + + + static void convert_rgb24_to_nv12(struct igt_fb *fb, struct
fb_convert_blit_upload*blit)
{lib/igt_fb.c +0
-0int i, j;@@ -1756,6 +1837,9 @@ static voiddestroy_cairo_surface__convert(void
*arg)lib/igt_fb.c +0
-0case DRM_FORMAT_VYUY : convert_rgb24_to_yuyv(fb, blit, yuyv_swizzle(fb-Quoted 1 line
drm_format));lib/igt_fb.c +3
-0break ; +case DRM_FORMAT_XYUV : +convert_rgb24_to_yuv444 (fb, blit); +break ;default : igt_assert_f(false, "Conversion not implementedfor
formats 0x%x\n",lib/igt_fb.c +0
-0fb->drm_format);@@ -1809,6 +1893,9 @@ static voidcreate_cairo_surface__convert(int
fd, structigt_fb*fb)lib/igt_fb.c +0
-0case DRM_FORMAT_VYUY : convert_yuyv_to_rgb24(fb, blit, yuyv_swizzle(fb-Quoted 1 line
drm_format));lib/igt_fb.c +3
-0break ; +case DRM_FORMAT_XYUV : +convert_yuv444_to_rgb24 (fb, blit); +break ;default : igt_assert_f(false, "Conversion not implementedfor
formats 0x%x\n",lib/igt_fb.c +0
-0fb->drm_format);@@ -1825,6 +1912,7 @@ static voidcreate_cairo_surface__convert(int
fd, structigt_fb*fb)
blit,destroy_cairo_surface__convert);
}lib/igt_fb.c +2
-0+/** * 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;Signature · 7 lines
Best Regards, Lisovskiy Stanislav _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-devSignature · 3 lines
Best Regards, Lisovskiy Stanislav
Signature · 6 lines
Ville Syrjälä Intel _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Quoted 52 lines · Ville Syrjälä
Quoted 41 lines · Stanislav
Quoted 26 lines · Ville Syrjälä
Quoted 16 lines · Stanislav
Quoted 6 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.Quoted 8 lines
v3: Fixed
kms_available_modes_crctest 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_fbto support XYUV
properly.v5: Fixed a coding typo.
Quoted 7 lines
Minor comment: this change will fail all test cases where drmModeAddFB2 is called with
DRM_FORMAT_XYUVuntil correspondent
kernel patch is not in use, as many igt test cases do not check if that kernel format is supported or not, so drmModeAddFB2 will
simply fail.Quoted 1 line
Which tests are those? They should be fixed.
Those are:
igt@kms_flip@basic-flip-vs-dpms
igt@kms_flip@basic-flip-vs-modeset
igt@kms_flip@basic-flip-vs-wf_vblank
igt@kms_flip@basic-plain-flip
igt@kms_setmode@basic-clone-single-crtc
Quoted 9 lines
Probably good idea to fix it so that it chooses only formats specified in
drm_plane->formatsandigt_fb_supported_format, like inkms_plane.
Otherwise for example inkms_flip, it usesigt_bpp_depth_to_drm_format
which chooses any format with matching bpp and depth, which in case of
XRGB8888, also is the same for XYUV.
Quoted 4 lines
IIRC all YUV formats should have a depth of -1 in that table, pretty much exactly for this reason. You never want to pick an YUV format when
just specifying depth/bpp.
Ok, this sounds much easier. I will change it to -1 then and check that it still works after that.
Quoted 261 lines
Quoted 259 lines
Quoted 254 lines
Quoted 252 lines
Quoted 243 lines
Signed-off-by Stanislav Lisovskiy <stanislav.lisovskiy@intel.com
Quoted 1 line
--- include/drm-uapi/drm_fourcc.h | 1 + lib/igt_fb.c | 89 +++++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+)include/drm- renamed from include/drm-uapi/drm_fourcc.h +0
-0
uapi/drm_fourcc.h
indexe04613d3..0bf66de2100644include/drm-uapi/drm_fourcc.h +0
-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_AYUVfourcc_code('A', 'Y',
'U',
'V') /* [31:0] A:Y:Cb:Cr 8:8:8:8 little endian */
+#defineDRM_FORMAT_XYUVfourcc_code('X', 'Y',
'U',
'V') /* [31:0] X:Y:Cb:Cr 8:8:8:8 little endian *//*
* 2 plane RGB + Alib/igt_fb.c +4
-0@@ -72,6 +72,10 @@ static struct format_desc_struct { .cairo_id = CAIRO_FORMAT_RGB16_565, .num_planes = 1, .plane_bpp = { 16, }, }, + { .name = "XYUV", .depth = 24, .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,lib/igt_fb.c +2
-0.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,lib/igt_fb.c +1
-0+ calculated_stride *height /
sizeof(wchar_t));lib/igt_fb.c +1
-0+break ;case DRM_FORMAT_YUYV :case DRM_FORMAT_YVYU : wmemset(ptr, full_range ?
0x80008000
:0x80108010,lib/igt_fb.c +0
-0@@ -1500,6 +1508,79 @@ static voidconvert_nv12_to_rgb24(struct
igt_fb*fb, structfb_convert_blit_uplolib/igt_fb.c +1
-0free (buf); } +static void convert_yuv444_to_rgb24(struct igt_fb *fb,struct
fb_convert_blit_upload*blit)lib/igt_fb.c +5
-0+{ +int i, j; +uint8_t *yuv24; +uint8_t *rgb24 = blit->rgb24.map; + unsigned rgb24_stride = blit->rgb24.stride,
planar_stride=blit->linear.stride;lib/igt_fb.c +2
-0+uint8_t *buf =malloc (blit->linear.size); + struct igt_mat4 m = igt_ycbcr_to_rgb_matrix(fb-Quoted 1 line
color_encoding,lib/igt_fb.c +1
-0+ fb-Quoted 1 line
color_range);lib/igt_fb.c +3
-0+ +/* +* Reading from the BO is awfully slow because of lack
of
read caching,lib/igt_fb.c +1
-0+* it's faster to copy the whole BO to a temporary buffer
and convertlib/igt_fb.c +3
-0+* from there. +*/ + igt_memcpy_from_wc(buf, blit->linear.map, blit-Quoted 1 line
linear.size);
lib/igt_fb.c +9
-0+ 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)];
lib/igt_fb.c +1
-0+ u = yuv24[i * planar_stride +j*sizeof(uint32_t) + 1];
lib/igt_fb.c +1
-0+ y = yuv24[i * planar_stride +j*sizeof(uint32_t) + 2];
lib/igt_fb.c +6
-0+ yuv.d[0 ] = y; + yuv.d[1 ] = u; + yuv.d[2 ] = v; + yuv.d[3 ] =1.0f ; + + rgb = igt_matrix_transform(&m,&yuv);
lib/igt_fb.c +2
-0+ + write_rgb(&rgb24[i * rgb24_stride +j*sizeof(uint32_t)], &rgb);
lib/igt_fb.c +8
-0+ } + } + +free (buf); +} + + +static void convert_rgb24_to_yuv444(struct igt_fb *fb,struct
fb_convert_blit_upload*blit)lib/igt_fb.c +5
-0+{ +int i, j; +uint8_t *rgb24; +uint8_t *yuv444 = blit->linear.map; + unsigned rgb24_stride = blit->rgb24.stride,
planar_stride=blit->linear.stride;lib/igt_fb.c +1
-0+ struct igt_mat4 m = igt_rgb_to_ycbcr_matrix(fb-Quoted 1 line
color_encoding,lib/igt_fb.c +1
-0+ fb-Quoted 1 line
color_range);lib/igt_fb.c +10
-0+ + 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)]);lib/igt_fb.c +2
-0+ + yuv = igt_matrix_transform(&m,&rgb);
lib/igt_fb.c +2
-0+ + yuv444[i * planar_stride +j*sizeof(uint32_t)] = yuv.d[2];
lib/igt_fb.c +1
-0+ yuv444[i * planar_stride +j*sizeof(uint32_t) + 1] = yuv.d[1];
lib/igt_fb.c +1
-0+ yuv444[i * planar_stride +j*sizeof(uint32_t) + 2] = yuv.d[0];
lib/igt_fb.c +7
-0+ } + } +} + + + + static void convert_rgb24_to_nv12(struct igt_fb *fb, struct
fb_convert_blit_upload*blit)
{lib/igt_fb.c +0
-0int i, j;@@ -1756,6 +1837,9 @@ static voiddestroy_cairo_surface__convert(void
*arg)lib/igt_fb.c +0
-0case DRM_FORMAT_VYUY : convert_rgb24_to_yuyv(fb, blit,yuyv_swizzle(fb-
Quoted 1 line
drm_format));lib/igt_fb.c +3
-0break ; +case DRM_FORMAT_XYUV : +convert_rgb24_to_yuv444 (fb, blit); +break ;default : igt_assert_f(false, "Conversion notimplemented
for
formats 0x%x\n",lib/igt_fb.c +0
-0fb->drm_format);@@ -1809,6 +1893,9 @@ static voidcreate_cairo_surface__convert(int
fd, structigt_fb*fb)lib/igt_fb.c +0
-0case DRM_FORMAT_VYUY : convert_yuyv_to_rgb24(fb, blit,yuyv_swizzle(fb-
Quoted 1 line
drm_format));lib/igt_fb.c +3
-0break ; +case DRM_FORMAT_XYUV : +convert_yuv444_to_rgb24 (fb, blit); +break ;default : igt_assert_f(false, "Conversion notimplemented
for
formats 0x%x\n",lib/igt_fb.c +0
-0fb->drm_format);@@ -1825,6 +1912,7 @@ static voidcreate_cairo_surface__convert(int
fd, structigt_fb*fb)
blit,destroy_cairo_surface__convert);
}lib/igt_fb.c +2
-0+/** * 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;
Signature · 7 lines
Best Regards, Lisovskiy Stanislav _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-devSignature · 3 lines
Best Regards, Lisovskiy Stanislav
Signature · 7 lines
Best Regards, Lisovskiy Stanislav _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev