panfrost: Always write reloaded tiles when making CRC data valid

If CRC data is currently invalid and the current batch will make it
valid, write even clean tiles to make sure CRC data is updated.

Fixes: 8ba2f9f698 ("panfrost: Create a blitter library to replace the existing preload helpers")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10566>
(cherry picked from commit e241ca6e9c)
This commit is contained in:
Icecream95 2021-05-01 22:45:11 +12:00 committed by Eric Engestrom
parent ca191e1254
commit dd696cea54
2 changed files with 21 additions and 1 deletions

View file

@ -4009,7 +4009,7 @@
"description": "panfrost: Always write reloaded tiles when making CRC data valid",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"master_sha": null,
"because_sha": "8ba2f9f698584d20830ef31bbc2fb8a6635c8314"
},

View file

@ -970,12 +970,31 @@ pan_preload_emit_bifrost_pre_frame_dcd(struct pan_pool *desc_pool,
mali_ptr coords, mali_ptr rsd,
mali_ptr tsd)
{
struct panfrost_device *dev = desc_pool->dev;
unsigned dcd_idx = zs ? 0 : 1;
pan_preload_fb_bifrost_alloc_pre_post_dcds(desc_pool, fb);
assert(fb->bifrost.pre_post.dcds.cpu);
void *dcd = fb->bifrost.pre_post.dcds.cpu +
(dcd_idx * (MALI_DRAW_LENGTH + MALI_DRAW_PADDING_LENGTH));
int crc_rt = pan_select_crc_rt(dev, fb);
bool always_write = false;
/* If CRC data is currently invalid and this batch will make it valid,
* write even clean tiles to make sure CRC data is updated. */
if (crc_rt >= 0) {
unsigned level = fb->rts[crc_rt].view->first_level;
bool valid = fb->rts[crc_rt].state->slices[level].crc_valid;
bool full = !fb->extent.minx && !fb->extent.miny &&
fb->extent.maxx == (fb->width - 1) &&
fb->extent.maxy == (fb->height - 1);
if (full && !valid)
always_write = true;
}
pan_preload_emit_dcd(desc_pool, fb, zs, coords, tsd, rsd, dcd);
if (zs) {
enum pipe_format fmt = fb->zs.view.zs->image->layout.format;
@ -1005,6 +1024,7 @@ pan_preload_emit_bifrost_pre_frame_dcd(struct pan_pool *desc_pool,
MALI_PRE_POST_FRAME_SHADER_MODE_INTERSECT;
} else {
fb->bifrost.pre_post.modes[dcd_idx] =
always_write ? MALI_PRE_POST_FRAME_SHADER_MODE_ALWAYS :
MALI_PRE_POST_FRAME_SHADER_MODE_INTERSECT;
}
}