Mesa (main): panfrost: Handle NULL samplers

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Feb 24 23:10:11 UTC 2022


Module: Mesa
Branch: main
Commit: 5536852d60e59dad52feb63e1e88150ece1fec15
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5536852d60e59dad52feb63e1e88150ece1fec15

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Mon Sep 27 20:26:54 2021 -0400

panfrost: Handle NULL samplers

Fixes a NULL dereference in Piglit fp-fragment-position, getting the
test to pass.

Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13203>

---

 src/gallium/drivers/panfrost/pan_cmdstream.c | 7 +++++--
 src/panfrost/ci/panfrost-g52-fails.txt       | 2 --
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c
index 3ef83c3f4e1..fdf235e3328 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.c
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.c
@@ -1429,8 +1429,11 @@ panfrost_emit_sampler_descriptors(struct panfrost_batch *batch,
                                           SAMPLER);
         struct mali_sampler_packed *out = (struct mali_sampler_packed *) T.cpu;
 
-        for (unsigned i = 0; i < ctx->sampler_count[stage]; ++i)
-                out[i] = ctx->samplers[stage][i]->hw;
+        for (unsigned i = 0; i < ctx->sampler_count[stage]; ++i) {
+                struct panfrost_sampler_state *st = ctx->samplers[stage][i];
+
+                out[i] = st ? st->hw : (struct mali_sampler_packed){0};
+        }
 
         return T.gpu;
 }
diff --git a/src/panfrost/ci/panfrost-g52-fails.txt b/src/panfrost/ci/panfrost-g52-fails.txt
index 7fb9c9c7c1d..f2d37a28e3f 100644
--- a/src/panfrost/ci/panfrost-g52-fails.txt
+++ b/src/panfrost/ci/panfrost-g52-fails.txt
@@ -86,8 +86,6 @@ spec at arb_es2_compatibility@texwrap formats bordercolor,Fail
 spec at arb_es2_compatibility@texwrap formats bordercolor at GL_RGB565- border color only,Fail
 spec at arb_es2_compatibility@texwrap formats bordercolor-swizzled,Fail
 spec at arb_es2_compatibility@texwrap formats bordercolor-swizzled at GL_RGB565- swizzled- border color only,Fail
-spec at arb_fragment_program@fp-fragment-position,Crash
-spec at arb_fragment_program@sparse-samplers,Crash
 spec at arb_framebuffer_object@arb_framebuffer_object-depth-stencil-blit depth gl_depth32f_stencil8,Fail
 spec at arb_framebuffer_object@arb_framebuffer_object-depth-stencil-blit depth_stencil gl_depth32f_stencil8,Fail
 spec at arb_framebuffer_object@arb_framebuffer_object-depth-stencil-blit stencil gl_depth32f_stencil8,Fail



More information about the mesa-commit mailing list