diff options
author | Leo Liu <leo.liu@amd.com> | 2024-01-05 21:26:21 -0500 |
---|---|---|
committer | Eric Engestrom <eric@engestrom.ch> | 2024-01-09 19:37:45 +0000 |
commit | 884ca57174009435dcc07e2127dfb06042029ed8 (patch) | |
tree | 88854b8cd9da5d2eab8093ffa6cded5566e48849 | |
parent | ee4740fe2987342db4d67e4f6a6879ed999ac643 (diff) | |
download | mesa-884ca57174009435dcc07e2127dfb06042029ed8.tar.gz mesa-884ca57174009435dcc07e2127dfb06042029ed8.tar.bz2 mesa-884ca57174009435dcc07e2127dfb06042029ed8.zip |
gallium/vl: match YUYV/UYVY swizzle with change of color channels
Update the sampler views with the color channels, that fixes the issue
caused by: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20815
It fixes the case:
`gst-launch-1.0 -v -v filesrc location=file.jpg ! jpegparse ! vaapijpegdec ! imagefreeze ! vaapisink`
Fixes: dc2119bf3f ("util/format: Fix wrong colors when importing YUYV and UYVY")
Cc: mesa-stable
Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Sathishkumar S <sathishkumar.sundararaju@amd.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26911>
(cherry picked from commit 9eac06521a810ea5e2276cd82be1e21fedfe2710)
-rw-r--r-- | .pick_status.json | 2 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vl_video_buffer.c | 8 |
2 files changed, 8 insertions, 2 deletions
diff --git a/.pick_status.json b/.pick_status.json index 17bc59da44a..ca2ba7d7642 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -294,7 +294,7 @@ "description": "gallium/vl: match YUYV/UYVY swizzle with change of color channels", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "dc2119bf3fa9a7f18481b16b0b3e9e9900ad6d8e", "notes": null diff --git a/src/gallium/auxiliary/vl/vl_video_buffer.c b/src/gallium/auxiliary/vl/vl_video_buffer.c index a3d6109c335..4d95f762510 100644 --- a/src/gallium/auxiliary/vl/vl_video_buffer.c +++ b/src/gallium/auxiliary/vl/vl_video_buffer.c @@ -296,13 +296,19 @@ vl_video_buffer_sampler_view_components(struct pipe_video_buffer *buffer) nr_components = 3; for (j = 0; j < nr_components && component < VL_NUM_COMPONENTS; ++j, ++component) { + unsigned pipe_swizzle; + if (buf->sampler_view_components[component]) continue; memset(&sv_templ, 0, sizeof(sv_templ)); u_sampler_view_default_template(&sv_templ, res, sampler_format[plane_order[i]]); - sv_templ.swizzle_r = sv_templ.swizzle_g = sv_templ.swizzle_b = PIPE_SWIZZLE_X + j; + pipe_swizzle = (buf->base.buffer_format == PIPE_FORMAT_YUYV || buf->base.buffer_format == PIPE_FORMAT_UYVY) ? + (PIPE_SWIZZLE_X + j + 1) % 3 : + (PIPE_SWIZZLE_X + j); + sv_templ.swizzle_r = sv_templ.swizzle_g = sv_templ.swizzle_b = pipe_swizzle; sv_templ.swizzle_a = PIPE_SWIZZLE_1; + buf->sampler_view_components[component] = pipe->create_sampler_view(pipe, res, &sv_templ); if (!buf->sampler_view_components[component]) goto error; |