Re: mesa garbage collection - pardon the silly questions...

Marc Aurele La France <[email protected]>
Newsgroups gmane.comp.xfree86.devel
Message-ID <[email protected]>
On Fri, 18 May 2007, leon zadorin wrote:

> I am in a process of investigating some strange app's behaviour, where 
> having
> 1) opened display connecton
> 2) initialised glx
> 3) attached window to glx and made the glx context current, etc.
> 4) then de-initialised glx, destroyed window, closed display
> connecton, etc. etc.
> 5) then opened display connection again
> 6) then trying to initialise glx crashes (at glx creating a context)
> on NetBSD-current/macppc port...

> I have traced the crash to XSync call in mesa garbage colleciton...
> anyway... in a process of my learning (so pardon if my questions ar
> rather silly) the whole X thing :-) I have a question about the
> following code in:

> xc/extras/Mesa/src/mesa/drivers/x11/xm_api.c
> or 
> http://cvsweb.xfree86.org/cvsweb/xc/extras/Mesa/src/mesa/drivers/x11/xm_api.c?rev=HEAD&content-type=text/vnd.viewcvs-markup

> void XMesaGarbageCollect( void )
> {
>  XMesaBuffer b, next;
>  for (b=XMesaBufferList; b; b=next) {
>     next = b->Next;
>     if (b->display && b->frontbuffer && b->type == WINDOW) {
> #ifdef XFree86Server
> 	 /* NOT_NEEDED */
> #else
>        XSync(b->display, False);
>        if (!window_exists( b->display, b->frontbuffer )) {
>           /* found a dead window, free the ancillary info */
>           XMesaDestroyBuffer( b );
>        }
> #endif
>     }
>  }
> }

> The above code checks for vaild (non-null) "display" and "frontbuffer"
> before calling Xsync... but how does it know that "b->display" is
> still in the open state (i.e. that XCloseDisplay was not called on
> "b->display")... or is it guaranteed by some other code that
> XMesaBufferList will only have open displays... or is it OK to call
> XSync on a closed display?

All my build logs show that xm_api.c is always compiled with 
-DXFree86Server, making XMesaGarbageCollect() a no-op.  So it would seem 
that the way this is built on NetBSD is incorrect.

Marc.

+----------------------------------+----------------------------------+
|  Marc Aurele La France           |  work:   1-780-492-9310          |
|  Academic Information and        |  fax:    1-780-492-1729          |
|    Communications Technologies   |  email:  [email protected]         |
|  352 General Services Building   +----------------------------------+
|  University of Alberta           |                                  |
|  Edmonton, Alberta               |    Standard disclaimers apply    |
|  T6G 2H1                         |                                  |
|  CANADA                          |                                  |
+----------------------------------+----------------------------------+
XFree86 developer and VP.  ATI driver and X server internals.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.