r300g: do not use fastfill if ZMask RAM is not properly initialized

z_fastfill -> dirty_zmask[level].
This commit is contained in:
Marek Olšák 2010-08-14 18:37:04 +02:00
parent 0d699e8ee9
commit 5f8ccf1e27
4 changed files with 31 additions and 18 deletions

View file

@ -99,9 +99,6 @@ static boolean r300_cbzb_clear_allowed(struct r300_context *r300,
struct pipe_framebuffer_state *fb =
(struct pipe_framebuffer_state*)r300->fb_state.state;
if (r300->z_fastfill)
clear_buffers &= ~(PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL);
/* Only color clear allowed, and only one colorbuffer. */
if (clear_buffers != PIPE_CLEAR_COLOR || fb->nr_cbufs != 1)
return FALSE;
@ -186,8 +183,10 @@ static void r300_clear(struct pipe_context* pipe,
r300_depth_clear_value(fb->zsbuf->format, depth, stencil);
r300_mark_fb_state_dirty(r300, R300_CHANGED_ZCLEAR_FLAG);
if (r300->z_compression || r300->z_fastfill)
if (r300_texture(fb->zsbuf->texture)->zmask_mem[fb->zsbuf->level]) {
r300->zmask_clear.dirty = TRUE;
buffers &= ~PIPE_CLEAR_DEPTHSTENCIL;
}
if (r300->hiz_enable)
r300->hiz_clear.dirty = TRUE;
}
@ -222,6 +221,15 @@ static void r300_clear(struct pipe_context* pipe,
r300_mark_fb_state_dirty(r300, R300_CHANGED_CBZB_FLAG);
}
/* Enable fastfill.
*
* If we cleared the zmask, it's dirty now. The Hyper-Z state update
* looks for a dirty zmask and enables fastfill accordingly. */
if (fb->zsbuf &&
r300_texture(fb->zsbuf->texture)->dirty_zmask[fb->zsbuf->level]) {
r300->hyperz_state.dirty = TRUE;
}
/* XXX this flush "fixes" a hardlock in the cubestorm xscreensaver */
if (r300->flush_counter == 0)
pipe->flush(pipe, 0, NULL);

View file

@ -565,8 +565,6 @@ struct r300_context {
boolean two_sided_color;
/* Incompatible vertex buffer layout? (misaligned stride or buffer_offset) */
boolean incompatible_vb_layout;
/* Whether fast zclear is enabled. */
boolean z_fastfill;
#define R300_Z_COMPRESS_44 1
#define RV350_Z_COMPRESS_88 2
int z_compression;

View file

@ -129,6 +129,9 @@ static void r300_update_hyperz(struct r300_context* r300)
{
struct r300_hyperz_state *z =
(struct r300_hyperz_state*)r300->hyperz_state.state;
struct pipe_framebuffer_state *fb =
(struct pipe_framebuffer_state*)r300->fb_state.state;
boolean dirty_zmask = FALSE;
z->gb_z_peq_config = 0;
z->zb_bw_cntl = 0;
@ -140,23 +143,29 @@ static void r300_update_hyperz(struct r300_context* r300)
return;
}
if (!fb->zsbuf)
return;
if (!r300->rws->get_value(r300->rws, R300_CAN_HYPERZ))
return;
dirty_zmask = r300_texture(fb->zsbuf->texture)->dirty_zmask[fb->zsbuf->level];
/* Z fastfill. */
if (dirty_zmask) {
z->zb_bw_cntl |= R300_FAST_FILL_ENABLE; /* | R300_FORCE_COMPRESSED_STENCIL_VALUE_ENABLE;*/
}
/* Zbuffer compression. */
if (r300->z_compression) {
if (dirty_zmask && r300->z_compression) {
z->zb_bw_cntl |= R300_RD_COMP_ENABLE;
if (r300->z_decomp_rd == false)
z->zb_bw_cntl |= R300_WR_COMP_ENABLE;
/* RV350 and up optimizations. */
if (r300->z_compression == RV350_Z_COMPRESS_88)
z->gb_z_peq_config |= R300_GB_Z_PEQ_CONFIG_Z_PEQ_SIZE_8_8;
}
/* Z fastfill. */
if (r300->z_fastfill) {
z->zb_bw_cntl |= R300_FAST_FILL_ENABLE; /* | R300_FORCE_COMPRESSED_STENCIL_VALUE_ENABLE;*/
}
/* RV350 and up optimizations. */
/* The section 10.4.9 in the docs is a lie. */
if (r300->z_compression == RV350_Z_COMPRESS_88)
z->gb_z_peq_config |= R300_GB_Z_PEQ_CONFIG_Z_PEQ_SIZE_8_8;
if (r300->hiz_enable) {
bool can_hiz = r300_can_hiz(r300);

View file

@ -753,7 +753,6 @@ static void
r300_mark_fb_state_dirty(r300, R300_CHANGED_FB_STATE);
r300->hiz_enable = false;
r300->z_fastfill = false;
r300->z_compression = false;
if (state->zsbuf) {
@ -785,7 +784,6 @@ static void
}
if (tex->zmask_mem[level]) {
r300->z_fastfill = 1;
/* compression causes hangs on 16-bit */
if (zbuffer_bpp == 24)
r300->z_compression = compress;
@ -793,7 +791,7 @@ static void
DBG(r300, DBG_HYPERZ,
"hyper-z features: hiz: %d @ %08x z-compression: %d z-fastfill: %d @ %08x\n", r300->hiz_enable,
tex->hiz_mem[level] ? tex->hiz_mem[level]->ofs : 0xdeadbeef,
r300->z_compression, r300->z_fastfill,
r300->z_compression, tex->zmask_mem[level] ? 1 : 0,
tex->zmask_mem[level] ? tex->zmask_mem[level]->ofs : 0xdeadbeef);
}