panfrost: Don't clobber RT0 if RTn is disabled
authorAlyssa Rosenzweig <alyssa@collabora.com>
Mon, 3 May 2021 16:37:59 +0000 (12:37 -0400)
committerMarge Bot <eric+marge@anholt.net>
Tue, 4 May 2021 20:04:03 +0000 (20:04 +0000)
Fixes: a124c47b9f9 ("panfrost: Fix NULL derefs in pan_cmdstream.c")
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10393>

src/gallium/drivers/panfrost/pan_cmdstream.c

index 6936dd0..973536a 100644 (file)
@@ -298,7 +298,7 @@ panfrost_emit_bifrost_blend(struct panfrost_batch *batch,
         for (unsigned i = 0; i < MAX2(rt_count, 1); ++i) {
                 /* Disable blending for unbacked render targets */
                 if (rt_count == 0 || !batch->key.cbufs[i]) {
-                        pan_pack(rts, BLEND, cfg) {
+                        pan_pack(rts + i * MALI_BLEND_LENGTH, BLEND, cfg) {
                                 cfg.enable = false;
                                 cfg.bifrost.internal.mode = MALI_BIFROST_BLEND_MODE_OFF;
                         }