mesa: rename _mesa_add_renderbuffer* functions
authorTimothy Arceri <tarceri@itsqueeze.com>
Fri, 14 Apr 2017 03:33:32 +0000 (13:33 +1000)
committerTimothy Arceri <tarceri@itsqueeze.com>
Tue, 18 Apr 2017 00:01:55 +0000 (10:01 +1000)
These names make it easier to understand what is going on in
regards to references.

Reviewed-by: Brian Paul <brianp@vmware.com>
src/mesa/drivers/dri/i915/intel_screen.c
src/mesa/drivers/dri/i965/intel_screen.c
src/mesa/drivers/dri/nouveau/nouveau_screen.c
src/mesa/drivers/dri/radeon/radeon_screen.c
src/mesa/drivers/dri/swrast/swrast.c
src/mesa/drivers/osmesa/osmesa.c
src/mesa/drivers/x11/xm_api.c
src/mesa/main/renderbuffer.c
src/mesa/main/renderbuffer.h
src/mesa/state_tracker/st_manager.c
src/mesa/swrast/s_renderbuffer.c

index 7e17e95ee4c005c10cccd06031fa798601e29e9b..cba5434b5e1bee29e0fb4609cb8e66e9a409053c 100644 (file)
@@ -875,12 +875,11 @@ intelCreateBuffer(__DRIscreen * driScrnPriv,
 
    /* setup the hardware-based renderbuffers */
    rb = intel_create_renderbuffer(rgbFormat);
-   _mesa_add_renderbuffer_without_ref(fb, BUFFER_FRONT_LEFT, &rb->Base.Base);
+   _mesa_attach_and_own_rb(fb, BUFFER_FRONT_LEFT, &rb->Base.Base);
 
    if (mesaVis->doubleBufferMode) {
       rb = intel_create_renderbuffer(rgbFormat);
-      _mesa_add_renderbuffer_without_ref(fb, BUFFER_BACK_LEFT,
-                                            &rb->Base.Base);
+      _mesa_attach_and_own_rb(fb, BUFFER_BACK_LEFT, &rb->Base.Base);
    }
 
    /*
@@ -896,13 +895,13 @@ intelCreateBuffer(__DRIscreen * driScrnPriv,
        * attached to two attachment points.
        */
       rb = intel_create_private_renderbuffer(MESA_FORMAT_Z24_UNORM_S8_UINT);
-      _mesa_add_renderbuffer_without_ref(fb, BUFFER_DEPTH, &rb->Base.Base);
-      _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &rb->Base.Base);
+      _mesa_attach_and_own_rb(fb, BUFFER_DEPTH, &rb->Base.Base);
+      _mesa_attach_and_reference_rb(fb, BUFFER_STENCIL, &rb->Base.Base);
    }
    else if (mesaVis->depthBits == 16) {
       assert(mesaVis->stencilBits == 0);
       rb = intel_create_private_renderbuffer(MESA_FORMAT_Z_UNORM16);
-      _mesa_add_renderbuffer_without_ref(fb, BUFFER_DEPTH, &rb->Base.Base);
+      _mesa_attach_and_own_rb(fb, BUFFER_DEPTH, &rb->Base.Base);
    }
    else {
       assert(mesaVis->depthBits == 0);
index 39e463d264dd44b2f260cb1f8b3b4dc78e039ff6..34a5f18af234400e67298a89fe1f8a79dbc05de5 100644 (file)
@@ -1162,11 +1162,11 @@ intelCreateBuffer(__DRIscreen *dri_screen,
 
    /* setup the hardware-based renderbuffers */
    rb = intel_create_renderbuffer(rgbFormat, num_samples);
-   _mesa_add_renderbuffer_without_ref(fb, BUFFER_FRONT_LEFT, &rb->Base.Base);
+   _mesa_attach_and_own_rb(fb, BUFFER_FRONT_LEFT, &rb->Base.Base);
 
    if (mesaVis->doubleBufferMode) {
       rb = intel_create_renderbuffer(rgbFormat, num_samples);
-      _mesa_add_renderbuffer_without_ref(fb, BUFFER_BACK_LEFT, &rb->Base.Base);
+      _mesa_attach_and_own_rb(fb, BUFFER_BACK_LEFT, &rb->Base.Base);
    }
 
    /*
@@ -1180,11 +1180,10 @@ intelCreateBuffer(__DRIscreen *dri_screen,
       if (screen->devinfo.has_hiz_and_separate_stencil) {
          rb = intel_create_private_renderbuffer(MESA_FORMAT_Z24_UNORM_X8_UINT,
                                                 num_samples);
-         _mesa_add_renderbuffer_without_ref(fb, BUFFER_DEPTH, &rb->Base.Base);
+         _mesa_attach_and_own_rb(fb, BUFFER_DEPTH, &rb->Base.Base);
          rb = intel_create_private_renderbuffer(MESA_FORMAT_S_UINT8,
                                                 num_samples);
-         _mesa_add_renderbuffer_without_ref(fb, BUFFER_STENCIL,
-                                            &rb->Base.Base);
+         _mesa_attach_and_own_rb(fb, BUFFER_STENCIL, &rb->Base.Base);
       } else {
          /*
           * Use combined depth/stencil. Note that the renderbuffer is
@@ -1192,15 +1191,15 @@ intelCreateBuffer(__DRIscreen *dri_screen,
           */
          rb = intel_create_private_renderbuffer(MESA_FORMAT_Z24_UNORM_S8_UINT,
                                                 num_samples);
-         _mesa_add_renderbuffer_without_ref(fb, BUFFER_DEPTH, &rb->Base.Base);
-         _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &rb->Base.Base);
+         _mesa_attach_and_own_rb(fb, BUFFER_DEPTH, &rb->Base.Base);
+         _mesa_attach_and_reference_rb(fb, BUFFER_STENCIL, &rb->Base.Base);
       }
    }
    else if (mesaVis->depthBits == 16) {
       assert(mesaVis->stencilBits == 0);
       rb = intel_create_private_renderbuffer(MESA_FORMAT_Z_UNORM16,
                                              num_samples);
-      _mesa_add_renderbuffer_without_ref(fb, BUFFER_DEPTH, &rb->Base.Base);
+      _mesa_attach_and_own_rb(fb, BUFFER_DEPTH, &rb->Base.Base);
    }
    else {
       assert(mesaVis->depthBits == 0);
index 2dbd9d13b675beec2f81915bdf9a700b7ef4ccd8..375f640f3d08667336d21a26b7743c9f9a839a1b 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_without_ref(fb, BUFFER_FRONT_LEFT, rb);
+       _mesa_attach_and_own_rb(fb, BUFFER_FRONT_LEFT, rb);
 
        /* Back buffer */
        if (visual->doubleBufferMode) {
                rb = nouveau_renderbuffer_dri_new(color_format, drawable);
-               _mesa_add_renderbuffer_without_ref(fb, BUFFER_BACK_LEFT, rb);
+               _mesa_attach_and_own_rb(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_without_ref(fb, BUFFER_DEPTH, rb);
-               _mesa_add_renderbuffer(fb, BUFFER_STENCIL, rb);
+               _mesa_attach_and_own_rb(fb, BUFFER_DEPTH, rb);
+               _mesa_attach_and_reference_rb(fb, BUFFER_STENCIL, rb);
 
        } else if (visual->depthBits == 24) {
                rb = nouveau_renderbuffer_dri_new(GL_DEPTH_COMPONENT24, drawable);
-               _mesa_add_renderbuffer_without_ref(fb, BUFFER_DEPTH, rb);
+               _mesa_attach_and_own_rb(fb, BUFFER_DEPTH, rb);
 
        } else if (visual->depthBits == 16) {
                rb = nouveau_renderbuffer_dri_new(GL_DEPTH_COMPONENT16, drawable);
-               _mesa_add_renderbuffer_without_ref(fb, BUFFER_DEPTH, rb);
+               _mesa_attach_and_own_rb(fb, BUFFER_DEPTH, rb);
        }
 
        /* Software renderbuffers. */
index fab2eeab6c9db12a358621e170efa8cfb56a6f57..79e388988a0484ee44a5fa2706378b35b894f7b0 100644 (file)
@@ -677,13 +677,13 @@ radeonCreateBuffer( __DRIscreen *driScrnPriv,
 
     /* front color renderbuffer */
     rfb->color_rb[0] = radeon_create_renderbuffer(rgbFormat, driDrawPriv);
-    _mesa_add_renderbuffer_without_ref(&rfb->base, BUFFER_FRONT_LEFT, &rfb->color_rb[0]->base.Base);
+    _mesa_attach_and_own_rb(&rfb->base, BUFFER_FRONT_LEFT, &rfb->color_rb[0]->base.Base);
     rfb->color_rb[0]->has_surface = 1;
 
     /* back color renderbuffer */
     if (mesaVis->doubleBufferMode) {
       rfb->color_rb[1] = radeon_create_renderbuffer(rgbFormat, driDrawPriv);
-       _mesa_add_renderbuffer_without_ref(&rfb->base, BUFFER_BACK_LEFT, &rfb->color_rb[1]->base.Base);
+       _mesa_attach_and_own_rb(&rfb->base, BUFFER_BACK_LEFT, &rfb->color_rb[1]->base.Base);
        rfb->color_rb[1]->has_surface = 1;
     }
 
@@ -691,21 +691,21 @@ radeonCreateBuffer( __DRIscreen *driScrnPriv,
       if (mesaVis->stencilBits == 8) {
        struct radeon_renderbuffer *depthStencilRb =
            radeon_create_renderbuffer(MESA_FORMAT_Z24_UNORM_S8_UINT, driDrawPriv);
-       _mesa_add_renderbuffer_without_ref(&rfb->base, BUFFER_DEPTH, &depthStencilRb->base.Base);
-       _mesa_add_renderbuffer(&rfb->base, BUFFER_STENCIL, &depthStencilRb->base.Base);
+       _mesa_attach_and_own_rb(&rfb->base, BUFFER_DEPTH, &depthStencilRb->base.Base);
+       _mesa_attach_and_reference_rb(&rfb->base, BUFFER_STENCIL, &depthStencilRb->base.Base);
        depthStencilRb->has_surface = screen->depthHasSurface;
       } else {
        /* depth renderbuffer */
        struct radeon_renderbuffer *depth =
            radeon_create_renderbuffer(MESA_FORMAT_Z24_UNORM_X8_UINT, driDrawPriv);
-       _mesa_add_renderbuffer_without_ref(&rfb->base, BUFFER_DEPTH, &depth->base.Base);
+       _mesa_attach_and_own_rb(&rfb->base, BUFFER_DEPTH, &depth->base.Base);
        depth->has_surface = screen->depthHasSurface;
       }
     } else if (mesaVis->depthBits == 16) {
         /* just 16-bit depth buffer, no hw stencil */
        struct radeon_renderbuffer *depth =
            radeon_create_renderbuffer(MESA_FORMAT_Z_UNORM16, driDrawPriv);
-       _mesa_add_renderbuffer_without_ref(&rfb->base, BUFFER_DEPTH, &depth->base.Base);
+       _mesa_attach_and_own_rb(&rfb->base, BUFFER_DEPTH, &depth->base.Base);
        depth->has_surface = screen->depthHasSurface;
     }
 
index f43ac608cf2fee4cb1204f817dad310ad6d9c2fd..de1fe4c918c49bbdb3f8e569151c804cbf403937 100644 (file)
@@ -569,14 +569,12 @@ dri_create_buffer(__DRIscreen * sPriv,
 
     /* add front renderbuffer */
     frontrb = swrast_new_renderbuffer(visual, dPriv, GL_TRUE);
-    _mesa_add_renderbuffer_without_ref(fb, BUFFER_FRONT_LEFT,
-                                       &frontrb->Base.Base);
+    _mesa_attach_and_own_rb(fb, BUFFER_FRONT_LEFT, &frontrb->Base.Base);
 
     /* add back renderbuffer */
     if (visual->doubleBufferMode) {
        backrb = swrast_new_renderbuffer(visual, dPriv, GL_FALSE);
-        _mesa_add_renderbuffer_without_ref(fb, BUFFER_BACK_LEFT,
-                                           &backrb->Base.Base);
+        _mesa_attach_and_own_rb(fb, BUFFER_BACK_LEFT, &backrb->Base.Base);
     }
 
     /* add software renderbuffers */
index 68fca3e63263f06a7e6326f5d79f1632b1182d6b..a3d4facdea0b13dd775fbd2fa8a758a8cd06aed0 100644 (file)
@@ -1020,15 +1020,15 @@ OSMesaMakeCurrent( OSMesaContext osmesa, void *buffer, GLenum type,
     * There is no back color buffer.
     * If the user tries to use a 8, 16 or 32-bit/channel buffer that
     * doesn't match what Mesa was compiled for (CHAN_BITS) the
-    * _mesa_add_renderbuffer() function will create a "wrapper" renderbuffer
-    * that converts rendering from CHAN_BITS to the user-requested channel
-    * size.
+    * _mesa_attach_and_reference_rb() function will create a "wrapper"
+    * renderbuffer that converts rendering from CHAN_BITS to the
+    * user-requested channel size.
     */
    if (!osmesa->srb) {
       osmesa->srb = new_osmesa_renderbuffer(&osmesa->mesa, osmesa->format, type);
       _mesa_remove_renderbuffer(osmesa->gl_buffer, BUFFER_FRONT_LEFT);
-      _mesa_add_renderbuffer(osmesa->gl_buffer, BUFFER_FRONT_LEFT,
-                             &osmesa->srb->Base);
+      _mesa_attach_and_reference_rb(osmesa->gl_buffer, BUFFER_FRONT_LEFT,
+                                    &osmesa->srb->Base);
       assert(osmesa->srb->Base.RefCount == 2);
    }
 
@@ -1051,8 +1051,8 @@ OSMesaMakeCurrent( OSMesaContext osmesa, void *buffer, GLenum type,
     * renderbuffer adaptor/wrapper if needed (for bpp conversion).
     */
    _mesa_remove_renderbuffer(osmesa->gl_buffer, BUFFER_FRONT_LEFT);
-   _mesa_add_renderbuffer(osmesa->gl_buffer, BUFFER_FRONT_LEFT,
-                          &osmesa->srb->Base);
+   _mesa_attach_and_reference_rb(osmesa->gl_buffer, BUFFER_FRONT_LEFT,
+                                 &osmesa->srb->Base);
 
 
    /* this updates the visual's red/green/blue/alphaBits fields */
index 5be8aa95de1cf9593795535817d23113591789c5..b54900b2aeb425d0fdc772fd6912e2a63f362861 100644 (file)
@@ -311,8 +311,8 @@ create_xmesa_buffer(XMesaDrawable d, BufferType type,
    b->frontxrb->Parent = b;
    b->frontxrb->drawable = d;
    b->frontxrb->pixmap = (XMesaPixmap) d;
-   _mesa_add_renderbuffer_without_ref(&b->mesa_buffer, BUFFER_FRONT_LEFT,
-                                      &b->frontxrb->Base.Base);
+   _mesa_attach_and_own_rb(&b->mesa_buffer, BUFFER_FRONT_LEFT,
+                           &b->frontxrb->Base.Base);
 
    /*
     * Back renderbuffer
@@ -328,8 +328,8 @@ create_xmesa_buffer(XMesaDrawable d, BufferType type,
       /* determine back buffer implementation */
       b->db_mode = vis->ximage_flag ? BACK_XIMAGE : BACK_PIXMAP;
       
-      _mesa_add_renderbuffer_without_ref(&b->mesa_buffer, BUFFER_BACK_LEFT,
-                                         &b->backxrb->Base.Base);
+      _mesa_attach_and_own_rb(&b->mesa_buffer, BUFFER_BACK_LEFT,
+                              &b->backxrb->Base.Base);
    }
 
    /*
index b58b3f3e91398a4baf0f86f55cf7f5b1e1e1be53..5046f9d5f4227bf2da64e4db1f604b1d0d44584f 100644 (file)
@@ -144,9 +144,9 @@ validate_and_init_renderbuffer_attachment(struct gl_framebuffer *fb,
  * used with a freshly created renderbuffer.
  */
 void
-_mesa_add_renderbuffer_without_ref(struct gl_framebuffer *fb,
-                                   gl_buffer_index bufferName,
-                                   struct gl_renderbuffer *rb)
+_mesa_attach_and_own_rb(struct gl_framebuffer *fb,
+                        gl_buffer_index bufferName,
+                        struct gl_renderbuffer *rb)
 {
    assert(rb->RefCount == 1);
 
@@ -162,8 +162,9 @@ _mesa_add_renderbuffer_without_ref(struct gl_framebuffer *fb,
  * \param bufferName  one of the BUFFER_x tokens
  */
 void
-_mesa_add_renderbuffer(struct gl_framebuffer *fb,
-                       gl_buffer_index bufferName, struct gl_renderbuffer *rb)
+_mesa_attach_and_reference_rb(struct gl_framebuffer *fb,
+                              gl_buffer_index bufferName,
+                              struct gl_renderbuffer *rb)
 {
    validate_and_init_renderbuffer_attachment(fb, bufferName, rb);
    _mesa_reference_renderbuffer(&fb->Attachment[bufferName].Renderbuffer, rb);
index a6f14394982d01d5c61c39f5c05ca0bfa9568cef..f9a6462d536a089f966b33d413b149aa4eae929e 100644 (file)
@@ -47,13 +47,14 @@ extern void
 _mesa_delete_renderbuffer(struct gl_context *ctx, struct gl_renderbuffer *rb);
 
 extern void
-_mesa_add_renderbuffer_without_ref(struct gl_framebuffer *fb,
-                                   gl_buffer_index bufferName,
-                                   struct gl_renderbuffer *rb);
+_mesa_attach_and_own_rb(struct gl_framebuffer *fb,
+                        gl_buffer_index bufferName,
+                        struct gl_renderbuffer *rb);
 
 extern void
-_mesa_add_renderbuffer(struct gl_framebuffer *fb,
-                       gl_buffer_index bufferName, struct gl_renderbuffer *rb);
+_mesa_attach_and_reference_rb(struct gl_framebuffer *fb,
+                              gl_buffer_index bufferName,
+                              struct gl_renderbuffer *rb);
 
 extern void
 _mesa_remove_renderbuffer(struct gl_framebuffer *fb,
index b9e46fd07e65109d565398da1704ec574cfa72b6..86a82c2374c83ba9eacbc848ca27d8a8c5dd79a6 100644 (file)
@@ -315,21 +315,21 @@ st_framebuffer_add_renderbuffer(struct st_framebuffer *stfb,
       return FALSE;
 
    if (idx != BUFFER_DEPTH) {
-      _mesa_add_renderbuffer_without_ref(&stfb->Base, idx, rb);
+      _mesa_attach_and_own_rb(&stfb->Base, idx, rb);
       return TRUE;
    }
 
    bool rb_ownership_taken = false;
    if (util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_ZS, 0)) {
-      _mesa_add_renderbuffer_without_ref(&stfb->Base, BUFFER_DEPTH, rb);
+      _mesa_attach_and_own_rb(&stfb->Base, BUFFER_DEPTH, rb);
       rb_ownership_taken = true;
    }
 
    if (util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_ZS, 1)) {
       if (rb_ownership_taken)
-         _mesa_add_renderbuffer(&stfb->Base, BUFFER_STENCIL, rb);
+         _mesa_attach_and_reference_rb(&stfb->Base, BUFFER_STENCIL, rb);
       else
-         _mesa_add_renderbuffer_without_ref(&stfb->Base, BUFFER_STENCIL, rb);
+         _mesa_attach_and_own_rb(&stfb->Base, BUFFER_STENCIL, rb);
    }
 
    return TRUE;
index 940c7b710c8f43e039a180dbab06fdf7f54c3d78..66a823def32ae47ad8e288be03399d66c5b283fb 100644 (file)
@@ -274,7 +274,7 @@ add_color_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb,
       rb->InternalFormat = GL_RGBA;
 
       rb->AllocStorage = soft_renderbuffer_storage;
-      _mesa_add_renderbuffer_without_ref(fb, b, rb);
+      _mesa_attach_and_own_rb(fb, b, rb);
    }
 
    return GL_TRUE;
@@ -320,7 +320,7 @@ add_depth_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
    }
 
    rb->AllocStorage = soft_renderbuffer_storage;
-   _mesa_add_renderbuffer_without_ref(fb, BUFFER_DEPTH, rb);
+   _mesa_attach_and_own_rb(fb, BUFFER_DEPTH, rb);
 
    return GL_TRUE;
 }
@@ -358,7 +358,7 @@ add_stencil_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
    rb->InternalFormat = GL_STENCIL_INDEX8;
 
    rb->AllocStorage = soft_renderbuffer_storage;
-   _mesa_add_renderbuffer_without_ref(fb, BUFFER_STENCIL, rb);
+   _mesa_attach_and_own_rb(fb, BUFFER_STENCIL, rb);
 
    return GL_TRUE;
 }
@@ -382,8 +382,8 @@ add_depth_stencil_renderbuffer(struct gl_context *ctx,
    rb->InternalFormat = GL_DEPTH_STENCIL;
 
    rb->AllocStorage = soft_renderbuffer_storage;
-   _mesa_add_renderbuffer_without_ref(fb, BUFFER_DEPTH, rb);
-   _mesa_add_renderbuffer(fb, BUFFER_STENCIL, rb);
+   _mesa_attach_and_own_rb(fb, BUFFER_DEPTH, rb);
+   _mesa_attach_and_reference_rb(fb, BUFFER_STENCIL, rb);
 
    return GL_TRUE;
 }
@@ -420,7 +420,7 @@ add_accum_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
 
    rb->InternalFormat = GL_RGBA16_SNORM;
    rb->AllocStorage = soft_renderbuffer_storage;
-   _mesa_add_renderbuffer_without_ref(fb, BUFFER_ACCUM, rb);
+   _mesa_attach_and_own_rb(fb, BUFFER_ACCUM, rb);
 
    return GL_TRUE;
 }
@@ -465,7 +465,7 @@ add_aux_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb,
       rb->InternalFormat = GL_RGBA;
 
       rb->AllocStorage = soft_renderbuffer_storage;
-      _mesa_add_renderbuffer_without_ref(fb, BUFFER_AUX0 + i, rb);
+      _mesa_attach_and_own_rb(fb, BUFFER_AUX0 + i, rb);
    }
    return GL_TRUE;
 }