frontends/va: Set csc matrix in PutSurface

Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11889
Acked-by: Ruijing Dong <ruijing.dong@amd.com>
(cherry picked from commit a1af33775e)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33113>
This commit is contained in:
David Rosca
2025-01-06 09:28:45 +01:00
committed by Dylan Baker
parent 75a0bde863
commit 26b10842a9
2 changed files with 12 additions and 1 deletions

View File

@@ -844,7 +844,7 @@
"description": "frontends/va: Set csc matrix in PutSurface",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View File

@@ -416,6 +416,7 @@ vlVaPutSurface(VADriverContextP ctx, VASurfaceID surface_id, void* draw, short s
struct u_rect dst_rect = {destx, destx + destw, desty, desty + desth};
enum pipe_format format;
VAStatus status;
enum VL_CSC_COLOR_STANDARD color_standard;
if (!ctx)
return VA_STATUS_ERROR_INVALID_CONTEXT;
@@ -456,6 +457,16 @@ vlVaPutSurface(VADriverContextP ctx, VASurfaceID surface_id, void* draw, short s
format = surf->buffer->buffer_format;
if (flags & VA_SRC_BT601)
color_standard = VL_CSC_COLOR_STANDARD_BT_601;
else if (flags & VA_SRC_SMPTE_240)
color_standard = VL_CSC_COLOR_STANDARD_SMPTE_240M;
else
color_standard = VL_CSC_COLOR_STANDARD_BT_709;
vl_csc_get_matrix(color_standard, NULL, true, &drv->csc);
vl_compositor_set_csc_matrix(&drv->cstate, (const vl_csc_matrix *)&drv->csc, 1.0f, 0.0f);
vl_compositor_clear_layers(&drv->cstate);
if (format == PIPE_FORMAT_B8G8R8A8_UNORM || format == PIPE_FORMAT_B8G8R8X8_UNORM ||