Bug 100988 - glXGetCurrentDisplay() no longer works for FakeGLX contexts?
Summary: glXGetCurrentDisplay() no longer works for FakeGLX contexts?
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: GLX (show other bugs)
Version: 17.0
Hardware: Other All
: medium normal
Assignee: Brian Paul
QA Contact: mesa-dev
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-05-10 13:24 UTC by Tom Hudson
Modified: 2017-06-02 14:23 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Fix for glxGetCurrentDisplay() (2.65 KB, patch)
2017-05-22 17:52 UTC, Brian Paul
Details | Splinter Review

Description Tom Hudson 2017-05-10 13:24:44 UTC
I'm trying to upgrade a Mesa 10 installation to Mesa 17. There have been plenty of changes, but only one breakage that's left me perplexed.

https://cgit.freedesktop.org/mesa/mesa/commit/?id=c00b250c8061d042d9905e61b9077462ee91008b

In this CL, Mesa stopped maintaining a __GLXcontext for FakeGLX; there's just an XMesaContext.

Fake_glXGetCurrentContext() casts the XMesaContext to a __GLXContext and returns it. Perhaps the reasonable assumption is that a context is an opaque object.

However, glXGetCurrentDisplay() doesn't respect that assumption; it assumes it is getting a valid __GLXContext and returns __GLXContext::currentDpy, the first pointer.

The first pointer in an XMesaContext is *not* a pointer to a Display, and so any code that relies on this code path seems doomed to disappointment.

This is hitting us in open-source projects based on Ogre, but seems like a breakage in the public API that other users would have run into in the 3 years since that commit?
Comment 1 Brian Paul 2017-05-22 17:52:50 UTC
Created attachment 131440 [details] [review]
Fix for glxGetCurrentDisplay()

Hi Tom,

Looks like this has been broken for a long time.  Can you try the attached patch?

I hacked glxgears.c to call glXGetCurrentDisplay() and it seemed to work, but it would be great if you could check too.

Thanks.  Sorry for the slow reply.  I was out for a couple weeks.
Comment 2 Tom Hudson 2017-05-31 13:19:54 UTC
Awesome, unless I'm missing something this fixes all our tests, and is a lot simpler than anything we'd tried.
Comment 3 Brian Paul 2017-06-01 19:28:47 UTC
(In reply to Tom Hudson from comment #2)
> Awesome, unless I'm missing something this fixes all our tests, and is a lot
> simpler than anything we'd tried.

Great.  I'll put Tested-by: Tom Hudson <tom.hudson.phd@gmail.com> on the patch and push it soon.
Comment 4 Brian Paul 2017-06-02 14:23:05 UTC
Pushed as commit c6ba85a8c0f02b3b7058dae7afb6c49f56567319


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.