Mesa (staging/19.3): util: call bind_sampler_states before setting sampler_views
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Jan 21 20:16:13 UTC 2020
Module: Mesa
Branch: staging/19.3
Commit: 9dc157bbbfec57c9034a62a75a0f2f64ab643ec9
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9dc157bbbfec57c9034a62a75a0f2f64ab643ec9
Author: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Date: Sat Feb 15 23:05:53 2020 +0100
util: call bind_sampler_states before setting sampler_views
Fixes the following valgrind error:
Invalid read of size 16
at 0x28F458A1: si_set_sampler_view_desc (in radeonsi_drv_video.so)
by 0x28F4657E: si_set_sampler_views (in radeonsi_drv_video.so)
by 0x28D62BF5: util_compute_blit (in radeonsi_drv_video.so)
by 0x28D3A944: vlVaHandleVAProcPipelineParameterBufferType (in radeonsi_drv_video.so)
by 0x28D34EE1: vlVaRenderPicture (in radeonsi_drv_video.so)
by 0x4B2582B: vaRenderPicture (in libva.so.2.500.0)
Address 0x18142a10 is 0 bytes inside a block of size 48 free'd
at 0x48369AB: free (vg_replace_malloc.c:540)
by 0x28D62D51: util_compute_blit (in radeonsi_drv_video.so)
by 0x28D3A944: vlVaHandleVAProcPipelineParameterBufferType (in radeonsi_drv_video.so)
by 0x28D34EE1: vlVaRenderPicture (in radeonsi_drv_video.so)
by 0x4B2582B: vaRenderPicture (in libva.so.2.500.0)
Block was alloc'd at
at 0x4837B65: calloc (vg_replace_malloc.c:762)
by 0x28EFB2EC: si_create_sampler_state (in radeonsi_drv_video.so)
by 0x28D62C30: util_compute_blit (in radeonsi_drv_video.so)
by 0x28D3A944: vlVaHandleVAProcPipelineParameterBufferType (in radeonsi_drv_video.so)
by 0x28D34EE1: vlVaRenderPicture (in radeonsi_drv_video.so)
by 0x4B2582B: vaRenderPicture (in libva.so.2.500.0)
Fixes: 69430d7e59e ("va: use a compute shader for the blit")
Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2321
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3428>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3428>
(cherry picked from commit 5b1c4e1b75fe3466e5eec799e091c7a8ec9acd0e)
---
.pick_status.json | 2 +-
src/gallium/auxiliary/util/u_compute.c | 12 ++++++------
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/.pick_status.json b/.pick_status.json
index 827c656d616..6c499b4c287 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1120,7 +1120,7 @@
"description": "util: call bind_sampler_states before setting sampler_views",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"master_sha": null,
"because_sha": "69430d7e59e8b4b38567cd1f8bb6d4e747b2650c"
},
diff --git a/src/gallium/auxiliary/util/u_compute.c b/src/gallium/auxiliary/util/u_compute.c
index ccf7119291b..2a8b70454aa 100644
--- a/src/gallium/auxiliary/util/u_compute.c
+++ b/src/gallium/auxiliary/util/u_compute.c
@@ -120,12 +120,6 @@ void util_compute_blit(struct pipe_context *ctx, struct pipe_blit_info *blit_inf
ctx->set_shader_images(ctx, PIPE_SHADER_COMPUTE, 0, 1, &image);
- /* Initialize the sampler view. */
- u_sampler_view_default_template(&src_templ, src, src->format);
- src_templ.format = util_format_linear(blit_info->src.format);
- src_view = ctx->create_sampler_view(ctx, src, &src_templ);
- ctx->set_sampler_views(ctx, PIPE_SHADER_COMPUTE, 0, 1, &src_view);
-
struct pipe_sampler_state sampler_state={0};
sampler_state.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
sampler_state.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
@@ -140,6 +134,12 @@ void util_compute_blit(struct pipe_context *ctx, struct pipe_blit_info *blit_inf
sampler_state_p = ctx->create_sampler_state(ctx, &sampler_state);
ctx->bind_sampler_states(ctx, PIPE_SHADER_COMPUTE, 0, 1, &sampler_state_p);
+ /* Initialize the sampler view. */
+ u_sampler_view_default_template(&src_templ, src, src->format);
+ src_templ.format = util_format_linear(blit_info->src.format);
+ src_view = ctx->create_sampler_view(ctx, src, &src_templ);
+ ctx->set_sampler_views(ctx, PIPE_SHADER_COMPUTE, 0, 1, &src_view);
+
if (!*compute_state)
*compute_state = blit_compute_shader(ctx);
ctx->bind_compute_state(ctx, *compute_state);
More information about the mesa-commit
mailing list