Mesa (master): dri/nouveau: Cleanup references to the old FBOs on glMakeCurrent().

Francisco Jerez currojerez at kemper.freedesktop.org
Thu Sep 16 17:48:11 UTC 2010


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

Author: Francisco Jerez <currojerez at riseup.net>
Date:   Wed Sep 15 18:03:59 2010 +0200

dri/nouveau: Cleanup references to the old FBOs on glMakeCurrent().

---

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

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index 244733e..eff1016 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -212,7 +212,6 @@ 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_handle;
 		int index;
 
 		switch (buffers[i].attachment) {
@@ -242,19 +241,10 @@ nouveau_update_renderbuffers(__DRIcontext *dri_ctx, __DRIdrawable *draw)
 		s->pitch = buffers[i].pitch;
 		s->cpp = buffers[i].cpp;
 
-		/* Don't bother to reopen the bo if it happens to be
-		 * the same. */
-		if (s->bo) {
-			ret = nouveau_bo_handle_get(s->bo, &old_handle);
-			assert(!ret);
-		}
-
-		if (!s->bo || old_handle != buffers[i].name) {
-			nouveau_bo_ref(NULL, &s->bo);
-			ret = nouveau_bo_handle_ref(context_dev(ctx),
-						    buffers[i].name, &s->bo);
-			assert(!ret);
-		}
+		nouveau_bo_ref(NULL, &s->bo);
+		ret = nouveau_bo_handle_ref(context_dev(ctx),
+					    buffers[i].name, &s->bo);
+		assert(!ret);
 	}
 
 	_mesa_resize_framebuffer(NULL, fb, draw->w, draw->h);
@@ -293,13 +283,15 @@ nouveau_context_make_current(__DRIcontext *dri_ctx, __DRIdrawable *dri_draw,
 			update_framebuffer(dri_ctx, dri_read,
 					   &dri_ctx->dri2.read_stamp);
 
+		/* Clean up references to the old framebuffer objects. */
+		context_bctx(ctx, FRAMEBUFFER);
+		FIRE_RING(context_chan(ctx));
+
 		/* Pass it down to mesa. */
 		_mesa_make_current(ctx, dri_draw->driverPrivate,
 				   dri_read->driverPrivate);
 		_mesa_update_state(ctx);
 
-		FIRE_RING(context_chan(ctx));
-
 	} else {
 		_mesa_make_current(NULL, NULL, NULL);
 	}




More information about the mesa-commit mailing list