Mesa (staging/22.0): panfrost: Handle NULL samplers

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Mar 1 23:52:39 UTC 2022


Module: Mesa
Branch: staging/22.0
Commit: 4fee724fafeb04f9ef64c7ca2afc1d0f46202aa1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4fee724fafeb04f9ef64c7ca2afc1d0f46202aa1

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>
(cherry picked from commit 5536852d60e59dad52feb63e1e88150ece1fec15)

---

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

diff --git a/.pick_status.json b/.pick_status.json
index 75d1dff7936..793fd846309 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -229,7 +229,7 @@
         "description": "panfrost: Handle NULL samplers",
         "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 e6e220c889b..3bc030eda65 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.c
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.c
@@ -1426,8 +1426,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 d5f85f621f6..b228b93a5f5 100644
--- a/src/panfrost/ci/panfrost-g52-fails.txt
+++ b/src/panfrost/ci/panfrost-g52-fails.txt
@@ -85,8 +85,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