From cbb28eaeaf35ca5581e6d75a1fa15533984d66ce Mon Sep 17 00:00:00 2001 From: David Rosca Date: Thu, 10 Aug 2023 22:05:12 +0200 Subject: [PATCH] gallium/auxiliary/vl: Set correct csc matrix in set_buffer_layer Shaders used in set_buffer_layer will apply colorspace conversion, so we need to set correct matrix depending on the input and output surface formats. Use BT.601 (default) for YUV to RGB and identity for RGB to RGB. Reviewed-by: Leo Liu Part-of: --- src/gallium/auxiliary/vl/vl_compositor.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c index 894df6dc295..cf2fdc08559 100644 --- a/src/gallium/auxiliary/vl/vl_compositor.c +++ b/src/gallium/auxiliary/vl/vl_compositor.c @@ -561,6 +561,7 @@ vl_compositor_set_buffer_layer(struct vl_compositor_state *s, { struct pipe_sampler_view **sampler_views; unsigned i; + vl_csc_matrix csc_matrix; assert(s && c && buffer); @@ -617,6 +618,12 @@ vl_compositor_set_buffer_layer(struct vl_compositor_state *s, else if (c->pipe_gfx_supported) s->layers[layer].fs = c->fs_video_buffer; } + + vl_csc_get_matrix(util_format_is_yuv(buffer->buffer_format) ? + VL_CSC_COLOR_STANDARD_BT_601 : + VL_CSC_COLOR_STANDARD_IDENTITY, + NULL, true, &csc_matrix); + vl_compositor_set_csc_matrix(s, &csc_matrix, 1.0f, 0.0f); } void