lib/igt_fb: Add support for P01x formats, v2.
PATCH 1/1 lib/igt_fb: Add support for P01x formats, v2.
The P01x formats are planar 16 bits per component, with the unused lower bits set to 0. This means they can all be converted the same way. Only the range is slightly different, and this is handled in the color_encoding implementation.
This requires cairo 1.17.2 and pixman 0.36. This works but doesn't give extra precision. For more than 8 bits precision a few more patches are required to pixman, pending review:
https://lists.freedesktop.org/archives/pixman/2019-January/004815.html
https://lists.freedesktop.org/archives/pixman/2019-January/004809.html
Once those are merged, we will require the next pixman release for better precision.
Changes since v1:
- Add fallback color definitions when compiling on cairo version < 1.17.2.
- Skip when FB creation fails on HDR formats, instead of failing.
--- include/drm-uapi/drm_fourcc.h | 10 ++ lib/igt_color_encoding.c | 4 + lib/igt_fb.c | 234 ++++++++++++++++++++++++++++++++-- lib/igt_fb.h | 6 + 4 files changed, 243 insertions(+), 11 deletions(-)
include/drm-uapi/drm_fourcc.h +10 -0
@@ -195,6 +195,16 @@ 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 +* index 0 = Y plane, [15:0] Y little endian where Pxxx indicate +* component xxx msb Y [xxx:16-xxx] +* index 1 = Cr:Cb plane, [31:0] Cr:Cb little endian [xxx:16-xxx:xxx:16-xxx] +*/ +#define DRM_FORMAT_P010 fourcc_code('P', '0', '1', '0')/* 2x2 subsampled Cr:Cb plane, 10 bit per channel */ +#define DRM_FORMAT_P012 fourcc_code('P', '0', '1', '2')/* 2x2 subsampled Cr:Cb plane, 12 bit per channel */ +#define DRM_FORMAT_P016 fourcc_code('P', '0', '1', '6')/* 2x2 subsampled Cr:Cb plane, 16 bit per channel */ +/* * 3 plane YCbCr * index 0: Y plane, [7:0] Y
lib/igt_color_encoding.c +4 -0
@@ -135,11 +135,15 @@ static const struct color_encoding_format {float ofs_y, max_y, ofs_cbcr, mid_cbcr, max_cbcr; } formats[] = { { DRM_FORMAT_XRGB8888, 255.f, }, + { IGT_FORMAT_FLOAT, 1.f, }, { DRM_FORMAT_NV12, 255.f, 16.f, 235.f, 16.f, 128.f, 240.f }, { DRM_FORMAT_YUYV, 255.f, 16.f, 235.f, 16.f, 128.f, 240.f }, { DRM_FORMAT_YVYU, 255.f, 16.f, 235.f, 16.f, 128.f, 240.f }, { DRM_FORMAT_UYVY, 255.f, 16.f, 235.f, 16.f, 128.f, 240.f }, { DRM_FORMAT_VYUY, 255.f, 16.f, 235.f, 16.f, 128.f, 240.f }, + { 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 }, }; static const struct color_encoding_format *lookup_fourcc(uint32_t fourcc)
lib/igt_fb.c +223 -11
316 lines not on this page · raw message
lib/igt_fb.h +6 -0
@@ -38,6 +38,12 @@#include "igt_color_encoding.h" +/* +* Internal format to denote a buffer compatible with pixman's +* floating point format. Range [0-1]. +*/ +#define IGT_FORMAT_FLOAT fourcc_code('I', 'G', 'F', 'x') +/** * igt_fb_t: * @fb_id: KMS ID of the framebuffer
Signature · 6 lines
2.20.1 _______________________________________________ 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: Add support for P01x formats, v2.
== Series Details ==
== Series Details ==
Series: lib/igt_fb: Add support for P01x formats, v2.
URL : https://patchwork.freedesktop.org/series/56181/
State : failure
== Summary ==
Applying: lib/igt_fb: Add support for P01x formats, v2. Using index info to reconstruct a base tree...
M lib/igt_color_encoding.c
M lib/igt_fb.c
Falling back to patching base and 3-way merge... Auto-merging lib/igt_fb.c
Auto-merging lib/igt_color_encoding.c
CONFLICT (content): Merge conflict in lib/igt_color_encoding.c Patch failed at 0001 lib/igt_fb: Add support for P01x formats, v2. When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev