Michel Dänzer wrote:
> On Wed, 2007-02-28 at 10:58 -0800, Brian Paul wrote:
>> diff-tree f30e31276304696558abffdd9a6e3df21d41c0f5 (from
>> e21096b07c5854d01114b58f87d08709e370f8b7)
>> Author: Brian <[EMAIL PROTECTED]>
>> Date: Tue Feb 27 11:09:28 2007 -0700
>>
>> assert that fb->RefCount==0 in _mesa_free_framebuffer_data()
>>
>> diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
>> index d061d22..3fe70f4 100644
>> --- a/src/mesa/main/framebuffer.c
>> +++ b/src/mesa/main/framebuffer.c
>> @@ -216,6 +216,7 @@ _mesa_free_framebuffer_data(struct gl_fr
>> GLuint i;
>>
>> assert(fb);
>> + assert(fb->RefCount == 0);
>>
>> _glthread_DESTROY_MUTEX(fb->Mutex);
>
> This triggers for me with AIGLX (resulting in instant X server death)
> when a client goes away without explicitly destroying its DRI drawables.
> Here's a backtrace:
>
> #0 0x0fc6cf6c in raise () from /lib/tls/libc.so.6
> #1 0x0fc6ea0c in abort () from /lib/tls/libc.so.6
> #2 0x0fc652d8 in __assert_fail () from /lib/tls/libc.so.6
> #3 0x0f527c2c in _mesa_free_framebuffer_data (fb=0x10ac8e98) at
> main/framebuffer.c:219
> #4 0x0f527c48 in _mesa_destroy_framebuffer (fb=0x10ac8e98) at
> main/framebuffer.c:203
> #5 0x0f4d91a0 in radeonDestroyBuffer (driDrawPriv=<value optimized out>) at
> radeon_screen.c:911
> #6 0x0f4d5828 in driDestroyDrawable (dpy=0x0, drawablePrivate=0x1072ae18) at
> ../common/dri_util.c:710
> #7 0x0f4d5194 in __driGarbageCollectDrawables (drawHash=0x102054f0) at
> ../common/dri_util.c:138
> #8 0x0f4d53b0 in driDestroyContext (dpy=0x0, scrn=0,
> contextPrivate=0x106c6158) at ../common/dri_util.c:752
> #9 0x0f96d334 in __glXDRIcontextDestroy (baseContext=0x0) at glxdri.c:281
> #10 0x0f92bb38 in __glXFreeContext (cx=0x0) at glxext.c:244
> #11 0x0f92c0c0 in ClientGone (clientIndex=258957664, id=<value optimized
> out>) at glxext.c:146
> #12 0x10028724 in FreeClientResources (client=0x106c6190) at resource.c:837
> #13 0x1003c184 in CloseDownClient (client=0x106c6190) at dispatch.c:3626
> #14 0x100431f8 in Dispatch () at dispatch.c:483
> #15 0x100265d0 in main (argc=11, argv=0x7fb6ece4, envp=<value optimized out>)
> at main.c:469
>
> radeonDestroyBuffer is called when the reference count is 1. Changing
> radeonDestroyBuffer to call _mesa_dereference_framebuffer instead of
> _mesa_destroy_framebuffer seems to work so far, but I'm not sure that's
> the correct fix. Any ideas?
That's the right fix. Framebuffer objects are reference counted since
they can be referenced by multiple rendering contexts at any given time.
_mesa_dereference_framebuffer() takes care of the locking, RefCount--,
and deleting when RefCount hits zero. All the DRI drivers should
probably be changed.
It would be good to look into why the refcount is still 1 when we get to
that point, though. You could do something like this to see if the
current context is still referencing the buffer:
static void
radeonDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
{
GET_CURRENT_CONTEXT(ctx);
if (ctx)
printf("DrawBuf: %p ReadBuf: %p\n", ctx->DrawBuffer,
ctx->ReadBuffer);
_mesa_destroy_framebuffer((GLframebuffer *)
(driDrawPriv->driverPrivate));
}
I see another issue in src/mesa/context.c - when a rendering context is
destroyed, we should call _mesa_dereference_framebuffer() on the
ctx->DrawBuffer and ctx->ReadBuffer to make sure we don't leave any
orphaned framebuffer objects. I'll look at that...
-Brian
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev