summaryrefslogtreecommitdiff
path: root/lib/igt_fb.c
diff options
context:
space:
mode:
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2018-06-07 16:25:22 +0200
committerMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2019-02-13 13:01:56 +0100
commitb0033d9310c13eee8fd8268ec0ea16af91c92e6e (patch)
tree4e93d47c0f132a181f28ff7035a78efd425aafc6 /lib/igt_fb.c
parent368237db1149033d8274248489ffec671ea1f7d8 (diff)
lib/color_encoding: Prepare support for HDR modes, v2.
We're starting to add support for 10, 12 and 16-bits formats that all have different values for the Y offset and range. Some 10 bits formats go from [0...1023], others go to [0...1023] shifted left by 6. To accomodate all formats add a struct definition for all various formats, this can be extended further when we add new formats. Changes since v1: - Rebase on top of added yuv changes. - Add commit description (swatish) - Add missing newline. (swatish) Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com> #v1
Diffstat (limited to 'lib/igt_fb.c')
-rw-r--r--lib/igt_fb.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index cad8bfea..3a4827c3 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -1564,7 +1564,7 @@ static void *igt_fb_create_cairo_shadow_buffer(int fd,
DRM_FORMAT_XRGB8888, LOCAL_DRM_FORMAT_MOD_NONE,
IGT_COLOR_YCBCR_BT709, IGT_COLOR_YCBCR_LIMITED_RANGE);
- shadow->strides[0] = ALIGN(width * 4, 16);
+ shadow->strides[0] = ALIGN(width * shadow->plane_bpp[0], 16);
shadow->size = ALIGN(shadow->strides[0] * height,
sysconf(_SC_PAGESIZE));
ptr = mmap(NULL, shadow->size, PROT_READ | PROT_WRITE,
@@ -1777,7 +1777,9 @@ static void convert_yuv_to_rgb24(struct fb_convert *cvt)
uint8_t *y, *u, *v;
uint8_t *rgb24 = cvt->dst.ptr;
unsigned int rgb24_stride = cvt->dst.fb->strides[0];
- struct igt_mat4 m = igt_ycbcr_to_rgb_matrix(cvt->src.fb->color_encoding,
+ struct igt_mat4 m = igt_ycbcr_to_rgb_matrix(cvt->src.fb->drm_format,
+ cvt->dst.fb->drm_format,
+ cvt->src.fb->color_encoding,
cvt->src.fb->color_range);
uint8_t *buf;
struct yuv_parameters params = { };
@@ -1838,7 +1840,9 @@ static void convert_rgb24_to_yuv(struct fb_convert *cvt)
const uint8_t *rgb24 = cvt->src.ptr;
uint8_t bpp = 4;
unsigned rgb24_stride = cvt->src.fb->strides[0];
- struct igt_mat4 m = igt_rgb_to_ycbcr_matrix(cvt->dst.fb->color_encoding,
+ struct igt_mat4 m = igt_rgb_to_ycbcr_matrix(cvt->src.fb->drm_format,
+ cvt->dst.fb->drm_format,
+ cvt->dst.fb->color_encoding,
cvt->dst.fb->color_range);
struct yuv_parameters params = { };