Mesa (staging/22.0): panfrost: Handle NULL sampler views
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Feb 25 21:11:15 UTC 2022
Module: Mesa
Branch: staging/22.0
Commit: f47fdc49a9f462e74740d19347178357290e3494
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f47fdc49a9f462e74740d19347178357290e3494
Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date: Mon Sep 27 20:24:01 2021 -0400
panfrost: Handle NULL sampler views
Fixes a NULL dereference in Piglit fp-fragment-position.
Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13203>
(cherry picked from commit 53ef20f08d4340c1bad0b45a2501f4daba7fb479)
---
.pick_status.json | 2 +-
src/gallium/drivers/panfrost/pan_cmdstream.c | 11 ++++++++++-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/.pick_status.json b/.pick_status.json
index 0bb15a74525..75d1dff7936 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -238,7 +238,7 @@
"description": "panfrost: Handle NULL sampler views",
"nominated": true,
"nomination_type": 0,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": null
},
diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c
index 569492e8816..e6e220c889b 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.c
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.c
@@ -1373,6 +1373,12 @@ panfrost_emit_texture_descriptors(struct panfrost_batch *batch,
for (int i = 0; i < ctx->sampler_view_count[stage]; ++i) {
struct panfrost_sampler_view *view = ctx->sampler_views[stage][i];
+
+ if (!view) {
+ memset(&out[i], 0, sizeof(out[i]));
+ continue;
+ }
+
struct pipe_sampler_view *pview = &view->base;
struct panfrost_resource *rsrc = pan_resource(pview->texture);
@@ -1385,11 +1391,14 @@ panfrost_emit_texture_descriptors(struct panfrost_batch *batch,
return T.gpu;
#else
- uint64_t trampolines[PIPE_MAX_SHADER_SAMPLER_VIEWS];
+ uint64_t trampolines[PIPE_MAX_SHADER_SAMPLER_VIEWS] = { 0 };
for (int i = 0; i < ctx->sampler_view_count[stage]; ++i) {
struct panfrost_sampler_view *view = ctx->sampler_views[stage][i];
+ if (!view)
+ continue;
+
panfrost_update_sampler_view(view, &ctx->base);
trampolines[i] = panfrost_get_tex_desc(batch, stage, view);
More information about the mesa-commit
mailing list