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 <italonicola@collabora.com>
Fixes: c746747cb8 ("panfrost: fix GL_EXT_multisampled_render_to_texture regression")
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12927>
This commit is contained in:
Italo Nicola 2021-09-20 07:18:56 +00:00 committed by Marge Bot
parent bdb37c862f
commit 7682a5de04

View file

@ -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);