From: Timothy Arceri Date: Sat, 8 Apr 2017 00:13:24 +0000 (+1000) Subject: i915: take ownership rather than adding reference for new renderbuffers X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c35567544009cc1d17f03b4308bd3e8c5658f8f5;p=mesa.git i915: 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/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index fe861790074..7e17e95ee4c 100644 --- a/src/mesa/drivers/dri/i915/intel_screen.c +++ b/src/mesa/drivers/dri/i915/intel_screen.c @@ -875,11 +875,12 @@ intelCreateBuffer(__DRIscreen * driScrnPriv, /* setup the hardware-based renderbuffers */ rb = intel_create_renderbuffer(rgbFormat); - _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); - _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &rb->Base.Base); + _mesa_add_renderbuffer_without_ref(fb, BUFFER_BACK_LEFT, + &rb->Base.Base); } /* @@ -895,13 +896,13 @@ intelCreateBuffer(__DRIscreen * driScrnPriv, * attached to two attachment points. */ rb = intel_create_private_renderbuffer(MESA_FORMAT_Z24_UNORM_S8_UINT); - _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); } else if (mesaVis->depthBits == 16) { assert(mesaVis->stencilBits == 0); rb = intel_create_private_renderbuffer(MESA_FORMAT_Z_UNORM16); - _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);