Re: [Mesa-dev] XMesaBufferList

2000-01-27 Thread Brian Paul

Michael Vance wrote:
> 
> On Thu, Jan 27, 2000 at 12:19:48PM -0700, Brian Paul wrote:
> 
> > So, you're all set now?
> 
> Yep. Offhand, do you know if similar problems exist with other glX
> implementations?

A real implementation of GLX shouldn't have any such problems.

-Brian


___
Mesa-dev maillist  -  [EMAIL PROTECTED]
http://lists.mesa3d.org/mailman/listinfo/mesa-dev



Re: [Mesa-dev] XMesaBufferList

2000-01-27 Thread Michael Vance

On Thu, Jan 27, 2000 at 12:19:48PM -0700, Brian Paul wrote:

> So, you're all set now?

Yep. Offhand, do you know if similar problems exist with other glX
implementations?

> And since Mesa can't know when X Drawables and Visuals are destroyed,
> it doesn't know when to free the private associated data.

Yech.

Thanks,

m.

-- 
Programmer "I wrote a song about dental floss,
Loki Entertainment Software but did anyone's teeth get cleaner?"
http://lokigames.com/~briareos/  - Frank Zappa, re: the PMRC


___
Mesa-dev maillist  -  [EMAIL PROTECTED]
http://lists.mesa3d.org/mailman/listinfo/mesa-dev



Re: [Mesa-dev] XMesaBufferList

2000-01-27 Thread Brian Paul

Michael Vance wrote:
> 
> On Thu, Jan 27, 2000 at 11:49:45AM -0700, Brian Paul wrote:

> > Have you looked at glXReleaseBuffersMESA(Display, GLXDrawable)?
> > If you call this function after destroying your window, Mesa
> > will free the internal XMesaBuffer associated with the drawable.
> 
> No, I have not. This did the trick, though, thanks! I just did it
> after the destroy context call.

So, you're all set now?


> > has been closed is a problem.  I don't know of a way to determine
> > if a given Display * is valid.
> 
> Neither do I, and a quick scan of the XLib manual didn't clue me in. I
> take it this stuff is a result of the 3Dfx drawable weirdness because
> of Glide?

It's not Glide related.  Mesa needs to associate a bunch of private
data with each X Drawable, Visual, etc.  Being a client-side library,
Mesa has no way to offically attach its data to those X data types.
And since Mesa can't know when X Drawables and Visuals are destroyed,
it doesn't know when to free the private associated data.

The garbage collection routine tries to determine when X drawables
have been destroyed.  When Mesa detects that an X drawable has been
destroyed, the associated data gets freed.  As you've found, there
are ways to foil this.

Since traditional Mesa on X is just an Xlib client, it can't make
all the hooks it needs in order to work just like real GLX.
Every so often, somebody falls into one of these traps.

-Brian


___
Mesa-dev maillist  -  [EMAIL PROTECTED]
http://lists.mesa3d.org/mailman/listinfo/mesa-dev



Re: [Mesa-dev] XMesaBufferList

2000-01-27 Thread Michael Vance

On Thu, Jan 27, 2000 at 11:49:45AM -0700, Brian Paul wrote:

> So you're using XFree 3.9 with DRI?  I haven't examined how the
> X/Mesa garbage collection mechanism works in there.

No, sorry, I misunderstood the meaning of the define. I'm using the
3.3.5 stuff.

> Have you looked at glXReleaseBuffersMESA(Display, GLXDrawable)?
> If you call this function after destroying your window, Mesa
> will free the internal XMesaBuffer associated with the drawable.

No, I have not. This did the trick, though, thanks! I just did it
after the destroy context call.

> has been closed is a problem.  I don't know of a way to determine
> if a given Display * is valid.

Neither do I, and a quick scan of the XLib manual didn't clue me in. I
take it this stuff is a result of the 3Dfx drawable weirdness because
of Glide?

m.

-- 
Programmer "I wrote a song about dental floss,
Loki Entertainment Software but did anyone's teeth get cleaner?"
http://lokigames.com/~briareos/  - Frank Zappa, re: the PMRC


___
Mesa-dev maillist  -  [EMAIL PROTECTED]
http://lists.mesa3d.org/mailman/listinfo/mesa-dev



Re: [Mesa-dev] XMesaBufferList

2000-01-27 Thread Brian Paul

Michael Vance wrote:

> 
> Another odd thing is that the XSync() is on the flip side of an #ifdef
> Xfree86Server guard--and I'm using the XFree servers for 3Dfx.

So you're using XFree 3.9 with DRI?  I haven't examined how the
X/Mesa garbage collection mechanism works in there.



> On Thu, Jan 27, 2000 at 11:17:47AM -0700, Brian Paul wrote:
> 
> > Yes, XMesaBufferList should be set to NULL when the last XMesaBuffer
> > is removed from the list.
> 
> Hm, free_xmesa_buffer() is never called after the
> glXDestroyContext(). It seems that because I delete my window and
> display after the glXDestroyContext, the garbage collector doesn't get
> rid of it. Then when we try to garbage collect again, the XSync call
> is on a bad display/window, and hangs.
> 
> Comments?

Have you looked at glXReleaseBuffersMESA(Display, GLXDrawable)?

If you call this function after destroying your window, Mesa
will free the internal XMesaBuffer associated with the drawable.

However, when using the DRI, this really shouldn't be needed.

Calling the XMesaGarbageCollect() function after the display
has been closed is a problem.  I don't know of a way to determine
if a given Display * is valid.

-Brian


___
Mesa-dev maillist  -  [EMAIL PROTECTED]
http://lists.mesa3d.org/mailman/listinfo/mesa-dev



Re: [Mesa-dev] XMesaBufferList

2000-01-27 Thread Michael Vance

On Thu, Jan 27, 2000 at 11:17:47AM -0700, Brian Paul wrote:

> Yes, XMesaBufferList should be set to NULL when the last XMesaBuffer
> is removed from the list.

Hm, free_xmesa_buffer() is never called after the
glXDestroyContext(). It seems that because I delete my window and
display after the glXDestroyContext, the garbage collector doesn't get
rid of it. Then when we try to garbage collect again, the XSync call
is on a bad display/window, and hangs.

Comments?

m.

-- 
Programmer "I wrote a song about dental floss,
Loki Entertainment Software but did anyone's teeth get cleaner?"
http://lokigames.com/~briareos/  - Frank Zappa, re: the PMRC


___
Mesa-dev maillist  -  [EMAIL PROTECTED]
http://lists.mesa3d.org/mailman/listinfo/mesa-dev



Re: [Mesa-dev] XMesaBufferList

2000-01-27 Thread Michael Vance

On Thu, Jan 27, 2000 at 11:17:47AM -0700, Brian Paul wrote:

> Yes, XMesaBufferList should be set to NULL when the last XMesaBuffer
> is removed from the list.

I'll look at this.

> Do you have a test program?

I do, but it's written using SDL's OpenGL support. If you're still
interested, let me know. I'll look to see why the buffer isn't being
reset.

Another odd thing is that the XSync() is on the flip side of an #ifdef
Xfree86Server guard--and I'm using the XFree servers for 3Dfx.

m.

-- 
Programmer "I wrote a song about dental floss,
Loki Entertainment Software but did anyone's teeth get cleaner?"
http://lokigames.com/~briareos/  - Frank Zappa, re: the PMRC


___
Mesa-dev maillist  -  [EMAIL PROTECTED]
http://lists.mesa3d.org/mailman/listinfo/mesa-dev



Re: [Mesa-dev] XMesaBufferList

2000-01-27 Thread Brian Paul

Michael Vance wrote:
> 
> Does the XMesaBufferList ever get reset to NULL when the last context
> is destroyed?
> 
> I'm seeing lockups in XSync() inside of XMesaGarbageCollect() after
> creating, then destroying, then trying to create again... the first
> time through, XMesaBufferList is NULL, I would assume this would be
> true the second time, also?

Yes, XMesaBufferList should be set to NULL when the last XMesaBuffer
is removed from the list.

>From free_xmesa_buffer():

   for (b=XMesaBufferList; b; b=b->Next) {
  if (b==buffer) {
 /* unlink bufer from list */
 if (prev)
prev->Next = buffer->Next;
 else
XMesaBufferList = buffer->Next;   <=== here


The indicated line will cause XMesaBufferList to be set to
NULL if buffer was the only buffer in the list (since its
Next pointer will be NULL).

Do you have a test program?

-Brian


___
Mesa-dev maillist  -  [EMAIL PROTECTED]
http://lists.mesa3d.org/mailman/listinfo/mesa-dev