From: Timothy Arceri Date: Sat, 8 Apr 2017 00:22:16 +0000 (+1000) Subject: i965: take ownership rather than adding reference for new renderbuffers X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3387f66cab058d5e3bfa5fee5d8a9ea5c8ce9568;p=mesa.git i965: take ownership rather than adding reference for new renderbuffers 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 --- diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index 811a9c5a867..e2b70dbb819 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -1158,11 +1158,11 @@ intelCreateBuffer(__DRIscreen *dri_screen, /* setup the hardware-based renderbuffers */ rb = intel_create_renderbuffer(rgbFormat, num_samples); - _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &rb->Base.Base); + _mesa_add_renderbuffer_without_ref(fb, BUFFER_FRONT_LEFT, &rb->Base.Base); if (mesaVis->doubleBufferMode) { rb = intel_create_renderbuffer(rgbFormat, num_samples); - _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &rb->Base.Base); + _mesa_add_renderbuffer_without_ref(fb, BUFFER_BACK_LEFT, &rb->Base.Base); } /* @@ -1176,10 +1176,11 @@ 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(fb, BUFFER_DEPTH, &rb->Base.Base); + _mesa_add_renderbuffer_without_ref(fb, BUFFER_DEPTH, &rb->Base.Base); rb = intel_create_private_renderbuffer(MESA_FORMAT_S_UINT8, num_samples); - _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &rb->Base.Base); + _mesa_add_renderbuffer_without_ref(fb, BUFFER_STENCIL, + &rb->Base.Base); } else { /* * Use combined depth/stencil. Note that the renderbuffer is @@ -1187,7 +1188,7 @@ intelCreateBuffer(__DRIscreen *dri_screen, */ rb = intel_create_private_renderbuffer(MESA_FORMAT_Z24_UNORM_S8_UINT, num_samples); - _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &rb->Base.Base); + _mesa_add_renderbuffer_without_ref(fb, BUFFER_DEPTH, &rb->Base.Base); _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &rb->Base.Base); } } @@ -1195,7 +1196,7 @@ intelCreateBuffer(__DRIscreen *dri_screen, assert(mesaVis->stencilBits == 0); rb = intel_create_private_renderbuffer(MESA_FORMAT_Z_UNORM16, num_samples); - _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &rb->Base.Base); + _mesa_add_renderbuffer_without_ref(fb, BUFFER_DEPTH, &rb->Base.Base); } else { assert(mesaVis->depthBits == 0);