[Mesa-dev] [PATCH 4/9] nouveau: take ownership rather than adding reference for new renderbuffers

Timothy Arceri tarceri at itsqueeze.com
Sat Apr 8 01:04:35 UTC 2017


This avoids locking in the reference calls and fixes a leak after the
RefCount initialisation was change from 0 to 1.

Fixes: 32141e53d1520 (mesa: tidy up renderbuffer RefCount initialisation)
---
 src/mesa/drivers/dri/nouveau/nouveau_screen.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_screen.c b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
index 1f4cbe8a..2dbd9d1 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_screen.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
@@ -252,41 +252,41 @@ nouveau_create_buffer(__DRIscreen *dri_screen,
 		color_format = GL_RGB8;
 	else
 		color_format = GL_RGBA8;
 
 	fb = nouveau_framebuffer_dri_new(visual);
 	if (!fb)
 		return GL_FALSE;
 
 	/* Front buffer. */
 	rb = nouveau_renderbuffer_dri_new(color_format, drawable);
-	_mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, rb);
+	_mesa_add_renderbuffer_without_ref(fb, BUFFER_FRONT_LEFT, rb);
 
 	/* Back buffer */
 	if (visual->doubleBufferMode) {
 		rb = nouveau_renderbuffer_dri_new(color_format, drawable);
-		_mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, rb);
+		_mesa_add_renderbuffer_without_ref(fb, BUFFER_BACK_LEFT, rb);
 	}
 
 	/* Depth/stencil buffer. */
 	if (visual->depthBits == 24 && visual->stencilBits == 8) {
 		rb = nouveau_renderbuffer_dri_new(GL_DEPTH24_STENCIL8_EXT, drawable);
-		_mesa_add_renderbuffer(fb, BUFFER_DEPTH, rb);
+		_mesa_add_renderbuffer_without_ref(fb, BUFFER_DEPTH, rb);
 		_mesa_add_renderbuffer(fb, BUFFER_STENCIL, rb);
 
 	} else if (visual->depthBits == 24) {
 		rb = nouveau_renderbuffer_dri_new(GL_DEPTH_COMPONENT24, drawable);
-		_mesa_add_renderbuffer(fb, BUFFER_DEPTH, rb);
+		_mesa_add_renderbuffer_without_ref(fb, BUFFER_DEPTH, rb);
 
 	} else if (visual->depthBits == 16) {
 		rb = nouveau_renderbuffer_dri_new(GL_DEPTH_COMPONENT16, drawable);
-		_mesa_add_renderbuffer(fb, BUFFER_DEPTH, rb);
+		_mesa_add_renderbuffer_without_ref(fb, BUFFER_DEPTH, rb);
 	}
 
 	/* Software renderbuffers. */
 	_swrast_add_soft_renderbuffers(fb, GL_FALSE, GL_FALSE, GL_FALSE,
                                        visual->accumRedBits > 0,
                                        GL_FALSE, GL_FALSE);
 
 	drawable->driverPrivate = fb;
 
 	return GL_TRUE;
-- 
2.9.3



More information about the mesa-dev mailing list