[Mesa-dev] leak of gem_objects on intel i965

Chad Versace chad at chad-versace.us
Wed Jun 15 15:43:35 PDT 2011


On Wed, 15 Jun 2011 10:53:13 +0200, Lampersperger Andreas <lampersperger.andreas at heidenhain.de> wrote:
> Hello,
> 
> I've tried 2.6.39.1 and the gem_objects leak still exists.
> 
> I found the leak also on a i915 not only on a i965.

I recommend focusing your debugging efforts on i965. If we solve the
problem in the new driver, and still find that the leaks occur in the
old driver, only then should we begin digging through the old driver.
> 
> It only disappears if I set LIBGL_ALLWAYS_SOFTWARE (not really an
> opinion ;-).

Nope ;)
 
> Now I can try to update user space libraries, what lib would you suspect most?
> 
> libdrm 2.4.23
> xorg-server 1.10.2
> xf86-video-intel-2.15
> gtkglext-1.2.0
> mesa-7.10.2

xorg-server: I highly doubt this is guilty.

libdrm: All calls out to libdrm are made directly by xf86-video-intel or
mesa. So, if a problem exists with libdrm, that problem will be solved
by debugging xf86-video-intel or mesa.

gtkglext: Can't say.

xf86-video-intel and mesa: Likely culprits. I am more suspicious of Mesa
than the X driver.
 
> Or I can continue debugging, if anyone can give me a hint to the
> following question:

Great!

> In which function are the buffers freed, which are received 
> from xserver via DRI2GetBuffersWithFormat(..) at dri2.c:431?
> -Andreas

Ah... In Mesa, the buffers are never freed, actually. Mesa just
decrements the gem buffer's refcount with drm_intel_bo_unreference(),
and the kernel does the freeing at garbage collection. (Chris,
correct me if I'm wrong here.)

The buffers obtained by DRI2GetBuffersWithFormat get referenced in
exactly one location. Here's the callstack, as I understand it. "gem_bo"
means "gem buffer object".

intel_udpate_renderbuffers
    intel_query_dri2_buffers_no_separate_stencil
        dri2GetBuffersWithFormat
            DRI2GetBuffersWithFormat # Referencing happens later
    intel_process_dri2_buffers_no_separate_stencil
        intel_region_alloc_for_handle
            intel_bo_gem_create_from_name
                drm_intel_gem_bo_reference # Reference gem buffer
        intel_renderbuffer_set_region
                intel_region_reference # Reference current region
                intel_region_release # Release old region
                    drm_intel_bo_unreference # Release old gem buffer

The buffers can get released from two possible paths: 1) The
intel_update_renderbuffers path above, and 2) from within
intel_delete_renderbuffer().

Good luck chasing this down. And don't prematurely eliminate the
possiblity that the problem may lie in xf86-video-intel or gtkglext.

- Chad



More information about the mesa-dev mailing list