diff --git a/.pick_status.json b/.pick_status.json index f80e0abc536..127050e4057 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -54,7 +54,7 @@ "description": "panfrost: do not over-estimate memory needed for dummy-rt", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "9ec6197a0b553e2d6037d04a4eca68998021ba33", "notes": null diff --git a/src/panfrost/lib/pan_desc.c b/src/panfrost/lib/pan_desc.c index 4215d11d8b0..f2a31cfcfae 100644 --- a/src/panfrost/lib/pan_desc.c +++ b/src/panfrost/lib/pan_desc.c @@ -470,23 +470,20 @@ pan_bytes_per_pixel_tib(enum pipe_format format) static unsigned pan_cbuf_bytes_per_pixel(const struct pan_fb_info *fb) { - /* dummy/non-existent render-targets use RGBA8 UNORM, e.g 4 bytes */ - const unsigned dummy_rt_size = 4 * fb->nr_samples; - + bool need_dummy = false; unsigned sum = 0; - if (!fb->rt_count) { - /* The HW needs at least one render-target */ - return dummy_rt_size; - } - - for (int cb = 0; cb < fb->rt_count; ++cb) { - unsigned rt_size = dummy_rt_size; + for (int cb = 0; cb < MAX2(fb->rt_count, 1); ++cb) { const struct pan_image_view *rt = fb->rts[cb].view; if (rt) - rt_size = pan_bytes_per_pixel_tib(rt->format) * rt->nr_samples; + sum += pan_bytes_per_pixel_tib(rt->format) * rt->nr_samples; + else + need_dummy = true; + } - sum += rt_size; + if (need_dummy) { + /* dummy/non-existent render-targets use RGBA8 UNORM, e.g 4 bytes */ + sum = MAX2(sum, 4 * fb->nr_samples); } return sum;