Mesa (main): panfrost: Skip blit shader labelling if the buffer has no space

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri May 14 06:48:37 UTC 2021


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

Author: Icecream95 <ixn at disroot.org>
Date:   Fri May 14 09:11:00 2021 +1200

panfrost: Skip blit shader labelling if the buffer has no space

Fixes stack corruption in dEQP-GLES31.functional.draw_buffers_indexed.
random.max_implementation_draw_buffers.10

Fixes: 8ba2f9f6985 ("panfrost: Create a blitter library to replace the existing preload helpers")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10792>

---

 src/panfrost/lib/pan_blitter.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/panfrost/lib/pan_blitter.c b/src/panfrost/lib/pan_blitter.c
index 63fd89c7f5f..22b87b6d932 100644
--- a/src/panfrost/lib/pan_blitter.c
+++ b/src/panfrost/lib/pan_blitter.c
@@ -468,6 +468,14 @@ pan_blitter_get_blit_shader(struct panfrost_device *dev,
                 default: unreachable("Invalid dim\n");
                 }
 
+                coord_comps = MAX2(coord_comps,
+                                   (key->surfaces[i].dim ? : 3) +
+                                   (key->surfaces[i].array ? 1 : 0));
+                first = false;
+
+                if (sig_offset >= sizeof(sig))
+                        continue;
+
                 sig_offset += snprintf(sig + sig_offset, sizeof(sig) - sig_offset,
                                        "%s[%s;%s;%s%s;src_samples=%d,dst_samples=%d]",
                                        first ? "" : ",",
@@ -476,10 +484,6 @@ pan_blitter_get_blit_shader(struct panfrost_device *dev,
                                        key->surfaces[i].array ? "[]" : "",
                                        key->surfaces[i].src_samples,
                                        key->surfaces[i].dst_samples);
-                first = false;
-                coord_comps = MAX2(coord_comps,
-                                   (key->surfaces[i].dim ? : 3) +
-                                   (key->surfaces[i].array ? 1 : 0));
         }
 
         nir_builder b =



More information about the mesa-commit mailing list