nouveau: take ownership rather than adding reference for new renderbuffers
authorTimothy Arceri <tarceri@itsqueeze.com>
Sat, 8 Apr 2017 00:26:34 +0000 (10:26 +1000)
committerTimothy Arceri <tarceri@itsqueeze.com>
Mon, 10 Apr 2017 00:55:34 +0000 (10:55 +1000)
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)
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
src/mesa/drivers/dri/nouveau/nouveau_screen.c

index 1f4cbe8a61dcfa4fa441055d27619eb4b7f8cd48..2dbd9d13b675beec2f81915bdf9a700b7ef4ccd8 100644 (file)
@@ -259,27 +259,27 @@ nouveau_create_buffer(__DRIscreen *dri_screen,
 
        /* 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. */