Mesa (master): r300: Fix Z buffer re-emit after window resize
Nicolai Hähnle
nh at kemper.freedesktop.org
Sat Aug 1 15:20:43 UTC 2009
Module: Mesa
Branch: master
Commit: 3d21e3d3a2785022c9a7af5b6a9db33cf6a3164e
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3d21e3d3a2785022c9a7af5b6a9db33cf6a3164e
Author: Nicolai Hähnle <nhaehnle at gmail.com>
Date: Sat Aug 1 16:50:21 2009 +0200
r300: Fix Z buffer re-emit after window resize
We used to not always correctly re-emit the Z buffer size in all cases,
in particular the clear path, and invalidated state was not always picked
up correctly.
This fixes a bug where the kernel CS checker correctly complains about
a Z buffer that is too small.
Note that this bug was probably only visible with ridiculously high
framerates, i.e. glxgears.
Signed-off-by: Nicolai Hähnle <nhaehnle at gmail.com>
---
src/mesa/drivers/dri/r300/r300_ioctl.c | 13 ++++++++-----
src/mesa/drivers/dri/r300/r300_state.c | 1 +
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/mesa/drivers/dri/r300/r300_ioctl.c b/src/mesa/drivers/dri/r300/r300_ioctl.c
index 5bded64..7558f9e 100644
--- a/src/mesa/drivers/dri/r300/r300_ioctl.c
+++ b/src/mesa/drivers/dri/r300/r300_ioctl.c
@@ -168,18 +168,21 @@ static void r300ClearBuffer(r300ContextPtr r300, int flags,
}
#if 1
if (flags & (CLEARBUFFER_DEPTH | CLEARBUFFER_STENCIL)) {
- assert(rrbd != 0);
- cbpitch = (rrbd->pitch / rrbd->cpp);
+ uint32_t zbpitch = (rrbd->pitch / rrbd->cpp);
if (rrbd->bo->flags & RADEON_BO_FLAGS_MACRO_TILE){
- cbpitch |= R300_DEPTHMACROTILE_ENABLE;
+ zbpitch |= R300_DEPTHMACROTILE_ENABLE;
}
if (rrbd->bo->flags & RADEON_BO_FLAGS_MICRO_TILE){
- cbpitch |= R300_DEPTHMICROTILE_TILED;
+ zbpitch |= R300_DEPTHMICROTILE_TILED;
}
BEGIN_BATCH_NO_AUTOSTATE(6);
OUT_BATCH_REGSEQ(R300_ZB_DEPTHOFFSET, 1);
OUT_BATCH_RELOC(0, rrbd->bo, 0, 0, RADEON_GEM_DOMAIN_VRAM, 0);
- OUT_BATCH_REGVAL(R300_ZB_DEPTHPITCH, cbpitch);
+ OUT_BATCH_REGSEQ(R300_ZB_DEPTHPITCH, 1);
+ if (!r300->radeon.radeonScreen->kernel_mm)
+ OUT_BATCH(zbpitch);
+ else
+ OUT_BATCH_RELOC(zbpitch, rrbd->bo, zbpitch, 0, RADEON_GEM_DOMAIN_VRAM, 0);
END_BATCH();
}
#endif
diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c
index b868b62..3c6e544 100644
--- a/src/mesa/drivers/dri/r300/r300_state.c
+++ b/src/mesa/drivers/dri/r300/r300_state.c
@@ -2234,6 +2234,7 @@ static void r300InvalidateState(GLcontext * ctx, GLuint new_state)
_mesa_update_draw_buffer_bounds(ctx);
R300_STATECHANGE(r300, cb);
+ R300_STATECHANGE(r300, zb);
}
r300->radeon.NewGLState |= new_state;
More information about the mesa-commit
mailing list