Mesa (master): dri/nouveau: Force a "slow" Z clear if we' re getting a new depth buffer.

Francisco Jerez currojerez at kemper.freedesktop.org
Fri Oct 22 11:46:08 UTC 2010


Module: Mesa
Branch: master
Commit: a00eec529562532031370b25f5941a916d5399ab
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a00eec529562532031370b25f5941a916d5399ab

Author: Francisco Jerez <currojerez at riseup.net>
Date:   Fri Oct 22 13:43:57 2010 +0200

dri/nouveau: Force a "slow" Z clear if we're getting a new depth buffer.

---

 src/mesa/drivers/dri/nouveau/nouveau_context.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index d3e2c0d..0ace139 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -180,6 +180,7 @@ void
 nouveau_update_renderbuffers(__DRIcontext *dri_ctx, __DRIdrawable *draw)
 {
 	struct gl_context *ctx = dri_ctx->driverPrivate;
+	struct nouveau_context *nctx = to_nouveau_context(ctx);
 	__DRIscreen *screen = dri_ctx->driScreenPriv;
 	struct gl_framebuffer *fb = draw->driverPrivate;
 	struct nouveau_framebuffer *nfb = to_nouveau_framebuffer(fb);
@@ -211,6 +212,7 @@ nouveau_update_renderbuffers(__DRIcontext *dri_ctx, __DRIdrawable *draw)
 	for (i = 0; i < count; i++) {
 		struct gl_renderbuffer *rb;
 		struct nouveau_surface *s;
+		uint32_t old_name;
 		int index;
 
 		switch (buffers[i].attachment) {
@@ -240,6 +242,16 @@ nouveau_update_renderbuffers(__DRIcontext *dri_ctx, __DRIdrawable *draw)
 		s->pitch = buffers[i].pitch;
 		s->cpp = buffers[i].cpp;
 
+		if (index == BUFFER_DEPTH && s->bo) {
+			ret = nouveau_bo_handle_get(s->bo, &old_name);
+			/*
+			 * Disable fast Z clears in the next frame, the
+			 * depth buffer contents are undefined.
+			 */
+			if (!ret && old_name != buffers[i].name)
+				nctx->hierz.clear_seq = 0;
+		}
+
 		nouveau_bo_ref(NULL, &s->bo);
 		ret = nouveau_bo_handle_ref(context_dev(ctx),
 					    buffers[i].name, &s->bo);




More information about the mesa-commit mailing list