From 7682a5de0449658f17bdcf4e591df523208528df Mon Sep 17 00:00:00 2001 From: Italo Nicola Date: Mon, 20 Sep 2021 07:18:56 +0000 Subject: [PATCH] panfrost: fix null deref when no color buffer is attached Do not dereference color buffer #0 in the SFBD code path if no color buffer is attached, as with depth-only attachments. Fixes a crash running glmark2 -b shadow on Mali T720. Signed-off-by: Italo Nicola Fixes: c746747cb82 ("panfrost: fix GL_EXT_multisampled_render_to_texture regression") Reviewed-by: Boris Brezillon Part-of: --- src/panfrost/lib/pan_cs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/panfrost/lib/pan_cs.c b/src/panfrost/lib/pan_cs.c index 5eb37a25099..33461361412 100644 --- a/src/panfrost/lib/pan_cs.c +++ b/src/panfrost/lib/pan_cs.c @@ -793,8 +793,8 @@ pan_emit_sfbd(const struct panfrost_device *dev, cfg.sample_count = fb->nr_samples; - /* XXX: different behaviour from MFBD and probably wrong... */ - cfg.msaa = mali_sampling_mode(fb->rts[0].view); + if (fb->rt_count) + cfg.msaa = mali_sampling_mode(fb->rts[0].view); } pan_emit_sfbd_tiler(dev, fb, tiler_ctx, fbd); pan_section_pack(fbd, SINGLE_TARGET_FRAMEBUFFER, PADDING_2, padding);