RB_FRAME_BUFFER_DIMENSION is not a banked context register, so we need
to wait for the GPU to idle before updating it. But we'd rather not
have unnecessary WFI's, so actually keep track if we need to emit it or
not.
Signed-off-by: Rob Clark <robclark@freedesktop.org>
emit_cache_flush(ring);
fd_wfi(ctx, ring);
emit_cache_flush(ring);
fd_wfi(ctx, ring);
+
+ ctx->needs_rb_fbd = true;
OUT_RING(ring, 0x00000000);
}
OUT_RING(ring, 0x00000000);
}
- OUT_PKT0(ring, REG_A3XX_RB_FRAME_BUFFER_DIMENSION, 1);
- OUT_RING(ring, A3XX_RB_FRAME_BUFFER_DIMENSION_WIDTH(pfb->width) |
- A3XX_RB_FRAME_BUFFER_DIMENSION_HEIGHT(pfb->height));
+ if (ctx->needs_rb_fbd) {
+ fd_wfi(ctx, ring);
+ OUT_PKT0(ring, REG_A3XX_RB_FRAME_BUFFER_DIMENSION, 1);
+ OUT_RING(ring, A3XX_RB_FRAME_BUFFER_DIMENSION_WIDTH(pfb->width) |
+ A3XX_RB_FRAME_BUFFER_DIMENSION_HEIGHT(pfb->height));
+ ctx->needs_rb_fbd = false;
+ }
OUT_PKT0(ring, REG_A3XX_RB_MODE_CONTROL, 1);
OUT_RING(ring, A3XX_RB_MODE_CONTROL_RENDER_MODE(RB_RENDERING_PASS) |
OUT_PKT0(ring, REG_A3XX_RB_MODE_CONTROL, 1);
OUT_RING(ring, A3XX_RB_MODE_CONTROL_RENDER_MODE(RB_RENDERING_PASS) |
+ /* Do we need to re-emit RB_FRAME_BUFFER_DIMENSION? At least on a3xx
+ * it is not a banked context register, so it needs a WFI to update.
+ * Keep track if it has actually changed, to avoid unneeded WFI.
+ * */
+ bool needs_rb_fbd;
+
/* Keep track of DRAW initiators that need to be patched up depending
* on whether we using binning or not:
*/
/* Keep track of DRAW initiators that need to be patched up depending
* on whether we using binning or not:
*/
pipe_surface_reference(&cso->cbufs[i], NULL);
cso->nr_cbufs = framebuffer->nr_cbufs;
pipe_surface_reference(&cso->cbufs[i], NULL);
cso->nr_cbufs = framebuffer->nr_cbufs;
+
+ if ((cso->width != framebuffer->width) ||
+ (cso->height != framebuffer->height))
+ ctx->needs_rb_fbd = true;
+
cso->width = framebuffer->width;
cso->height = framebuffer->height;
cso->width = framebuffer->width;
cso->height = framebuffer->height;