return pres->base.bind & PIPE_BIND_RENDER_TARGET &&
panfrost_is_2d(pres) &&
bytes_per_pixel <= bytes_per_pixel_max &&
+ pres->base.last_level == 0 &&
!(dev->debug & PAN_DBG_NO_CRC);
}
struct panfrost_device *dev = pan_device(pctx->screen);
if (transfer->usage & PIPE_MAP_WRITE)
- prsrc->state.slices[transfer->level].crc_valid = false;
+ prsrc->state.crc_valid = false;
/* AFBC will use a staging resource. `initialized` will be set when the
* fragment job is created; this is deferred to prevent useless surface
/* 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 valid = fb->rts[crc_rt].state->crc_valid;
bool full = !fb->extent.minx && !fb->extent.miny &&
fb->extent.maxx == (fb->width - 1) &&
fb->extent.maxy == (fb->height - 1);
fb->rts[i].view->image->layout.crc_mode == PAN_IMAGE_CRC_NONE)
continue;
- unsigned level = fb->rts[i].view->first_level;
- bool valid = fb->rts[i].state->slices[level].crc_valid;
+ bool valid = fb->rts[i].state->crc_valid;
bool full = !fb->extent.minx && !fb->extent.miny &&
fb->extent.maxx == (fb->width - 1) &&
fb->extent.maxy == (fb->height - 1);
unsigned internal_cbuf_size = pan_internal_cbuf_size(fb, &tile_size);
int crc_rt = pan_select_crc_rt(dev, fb);
bool has_zs_crc_ext = pan_fbd_has_zs_crc_ext(dev, fb);
- const struct pan_image_view *crc_view = crc_rt < 0 ? NULL : fb->rts[crc_rt].view;
- struct pan_image_slice_state *crc_slice =
- crc_rt < 0 ? NULL : &fb->rts[crc_rt].state->slices[crc_view->first_level];
pan_section_pack(fbd, MULTI_TARGET_FRAMEBUFFER, PARAMETERS, cfg) {
cfg.width = fb->width;
cfg.s_write_enable = (fb->zs.view.s && !fb->zs.discard.s);
cfg.has_zs_crc_extension = has_zs_crc_ext;
- if (crc_slice) {
- bool valid = crc_slice->crc_valid;
+ if (crc_rt >= 0) {
+ bool valid = fb->rts[crc_rt].state->crc_valid;
bool full = !fb->extent.minx && !fb->extent.miny &&
fb->extent.maxx == (fb->width - 1) &&
fb->extent.maxy == (fb->height - 1);
* valid for next time. */
cfg.crc_write_enable = valid || full;
- crc_slice->crc_valid = full;
+ fb->rts[crc_rt].state->crc_valid = full;
}
}
cbuf_offset += pan_bytes_per_pixel_tib(fb->rts[i].view->format) *
tile_size * fb->rts[i].view->image->layout.nr_samples;
- unsigned level = fb->rts[i].view->first_level;
- if (crc_slice != &fb->rts[i].state->slices[level])
- fb->rts[i].state->slices[level].crc_valid = false;
+ if (i != crc_rt)
+ fb->rts[i].state->crc_valid = false;
}
tags |= MALI_POSITIVE(MAX2(fb->rt_count, 1)) << 2;
};
struct pan_image_slice_state {
- /* Is the checksum for this slice valid? */
- bool crc_valid;
-
/* Has anything been written to this slice? */
bool data_valid;
};
struct pan_image_state {
+ /* Is the checksum for this image valid? Implicitly refers to the first
+ * slice, as we only checksum non-mipmapped 2D images */
+ bool crc_valid;
+
struct pan_image_slice_state slices[MAX_MIP_LEVELS];
};