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 <leo.liu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24626>
This commit is contained in:
David Rosca 2023-08-10 22:05:12 +02:00 committed by Marge Bot
parent 69fa48fbb1
commit cbb28eaeaf

View file

@ -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