summaryrefslogtreecommitdiff
path: root/src/panfrost/lib/pan_cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/panfrost/lib/pan_cs.c')
-rw-r--r--src/panfrost/lib/pan_cs.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/panfrost/lib/pan_cs.c b/src/panfrost/lib/pan_cs.c
index 63b311509c3..41babe5d836 100644
--- a/src/panfrost/lib/pan_cs.c
+++ b/src/panfrost/lib/pan_cs.c
@@ -83,8 +83,22 @@ pan_sample_pattern(unsigned samples)
}
int
-GENX(pan_select_crc_rt)(const struct pan_fb_info *fb)
+GENX(pan_select_crc_rt)(const struct pan_fb_info *fb, unsigned tile_size)
{
+ /* Disable CRC when the tile size is not 16x16. In the hardware, CRC
+ * tiles are the same size as the tiles of the framebuffer. However,
+ * our code only handles 16x16 tiles. Therefore under the current
+ * implementation, we must disable CRC when 16x16 tiles are not used.
+ *
+ * This may hurt performance. However, smaller tile sizes are rare, and
+ * CRCs are more expensive at smaller tile sizes, reducing the benefit.
+ * Restricting CRC to 16x16 should work in practice.
+ */
+ if (tile_size != 16 * 16) {
+ assert(tile_size < 16 * 16);
+ return -1;
+ }
+
#if PAN_ARCH <= 6
if (fb->rt_count == 1 && fb->rts[0].view && !fb->rts[0].discard &&
fb->rts[0].view->image->layout.crc_mode != PAN_IMAGE_CRC_NONE)
@@ -636,7 +650,7 @@ GENX(pan_emit_fbd)(const struct panfrost_device *dev,
unsigned tile_size;
unsigned internal_cbuf_size = pan_internal_cbuf_size(fb, &tile_size);
- int crc_rt = GENX(pan_select_crc_rt)(fb);
+ int crc_rt = GENX(pan_select_crc_rt)(fb, tile_size);
bool has_zs_crc_ext = (fb->zs.view.zs || fb->zs.view.s || crc_rt >= 0);
pan_section_pack(fbd, FRAMEBUFFER, PARAMETERS, cfg) {