r300_depth_clear_value(fb->zsbuf->format, depth, stencil);
r300_mark_atom_dirty(r300, &r300->zmask_clear);
+ r300_mark_atom_dirty(r300, &r300->gpu_flush);
buffers &= ~PIPE_CLEAR_DEPTHSTENCIL;
}
if (hiz_clear) {
r300->hiz_clear_value = r300_hiz_clear_value(depth);
r300_mark_atom_dirty(r300, &r300->hiz_clear);
+ r300_mark_atom_dirty(r300, &r300->gpu_flush);
}
r300->num_z_clears++;
}
if (r300->screen->cmask_resource == fb->cbufs[0]->texture) {
r300_set_clear_color(r300, color);
r300_mark_atom_dirty(r300, &r300->cmask_clear);
+ r300_mark_atom_dirty(r300, &r300->gpu_flush);
buffers &= ~PIPE_CLEAR_COLOR;
}
}
* procedure. */
/* Calculate zmask_clear and hiz_clear atom sizes. */
unsigned dwords =
+ r300->gpu_flush.size +
(r300->zmask_clear.dirty ? r300->zmask_clear.size : 0) +
(r300->hiz_clear.dirty ? r300->hiz_clear.size : 0) +
(r300->cmask_clear.dirty ? r300->cmask_clear.size : 0) +
}
/* Emit clear packets. */
+ r300_emit_gpu_flush(r300, r300->gpu_flush.size, r300->gpu_flush.state);
+ r300->gpu_flush.dirty = FALSE;
+
if (r300->zmask_clear.dirty) {
r300_emit_zmask_clear(r300, r300->zmask_clear.size,
r300->zmask_clear.state);
R300_INIT_ATOM(texture_cache_inval, 2);
R300_INIT_ATOM(textures_state, 0);
/* Clear commands */
- R300_INIT_ATOM(hiz_clear, r300->screen->caps.hiz_ram > 0 ? 6 : 0);
- R300_INIT_ATOM(zmask_clear, r300->screen->caps.zmask_ram > 0 ? 6 : 0);
- R300_INIT_ATOM(cmask_clear, 6);
+ R300_INIT_ATOM(hiz_clear, r300->screen->caps.hiz_ram > 0 ? 4 : 0);
+ R300_INIT_ATOM(zmask_clear, r300->screen->caps.zmask_ram > 0 ? 4 : 0);
+ R300_INIT_ATOM(cmask_clear, 4);
/* ZB (unpipelined), SU. */
R300_INIT_ATOM(query_start, 4);
* performance and stability if not handled with care. */
/* GPU flush. */
struct r300_atom gpu_flush;
+ /* Clears must be emitted immediately after the flush. */
+ /* HiZ clear */
+ struct r300_atom hiz_clear;
+ /* zmask clear */
+ struct r300_atom zmask_clear;
+ /* cmask clear */
+ struct r300_atom cmask_clear;
/* Anti-aliasing (MSAA) state. */
struct r300_atom aa_state;
/* Framebuffer state. */
struct r300_atom texture_cache_inval;
/* Textures state. */
struct r300_atom textures_state;
- /* HiZ clear */
- struct r300_atom hiz_clear;
- /* zmask clear */
- struct r300_atom zmask_clear;
- /* cmask clear */
- struct r300_atom cmask_clear;
/* Occlusion query. */
struct r300_atom query_start;
tex = r300_resource(fb->zsbuf->texture);
BEGIN_CS(size);
- OUT_CS_REG(R300_ZB_ZCACHE_CTLSTAT,
- R300_ZB_ZCACHE_CTLSTAT_ZC_FLUSH_FLUSH_AND_FREE |
- R300_ZB_ZCACHE_CTLSTAT_ZC_FREE_FREE);
OUT_CS_PKT3(R300_PACKET3_3D_CLEAR_HIZ, 2);
OUT_CS(0);
OUT_CS(tex->tex.hiz_dwords[fb->zsbuf->u.tex.level]);
tex = r300_resource(fb->zsbuf->texture);
BEGIN_CS(size);
- OUT_CS_REG(R300_ZB_ZCACHE_CTLSTAT,
- R300_ZB_ZCACHE_CTLSTAT_ZC_FLUSH_FLUSH_AND_FREE |
- R300_ZB_ZCACHE_CTLSTAT_ZC_FREE_FREE);
OUT_CS_PKT3(R300_PACKET3_3D_CLEAR_ZMASK, 2);
OUT_CS(0);
OUT_CS(tex->tex.zmask_dwords[fb->zsbuf->u.tex.level]);
tex = r300_resource(fb->cbufs[0]->texture);
BEGIN_CS(size);
- OUT_CS_REG(R300_RB3D_DSTCACHE_CTLSTAT,
- R300_RB3D_DSTCACHE_CTLSTAT_DC_FREE_FREE_3D_TAGS |
- R300_RB3D_DSTCACHE_CTLSTAT_DC_FLUSH_FLUSH_DIRTY_3D);
OUT_CS_PKT3(R300_PACKET3_3D_CLEAR_CMASK, 2);
OUT_CS(0);
OUT_CS(tex->tex.cmask_dwords);