Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try even harder to not load GLX #133

Merged
merged 3 commits into from
Jul 13, 2017
Merged

Conversation

nwnk
Copy link
Collaborator

@nwnk nwnk commented Jul 12, 2017

This doesn't quite eliminate X11 libraries from EGL applications, since
Mesa's libEGL has an X11 backend. But it does eliminate libGL and libGLX.

nwnk added 3 commits July 12, 2017 14:02
Broke the build on OSX, oops.

Resolves: anholt#132
Signed-off-by: Adam Jackson <ajax@redhat.com>
This path should also only load libGLX.so if possible.

Signed-off-by: Adam Jackson <ajax@redhat.com>
This code attempts not to dlopen anything if it can find the appropriate
winsys symbols in the global namespace. That's nice. However we normally
do dlopen(RTLD_LOCAL) when we open lib{GLX,EGL} so those symbols will
_not_ in fact be in the global namespace. The code also prefers checking
GLX to EGL, which means even if we initialize EGL through epoxy, and
even if we're using glvnd, we'll still dlopen libGL the first time we
hit epoxy_is_desktop_gl().

There's a couple of ways to skin this cat, let's take the easy one. If
either-but-not-both of the glx or egl handles in the global API state
are initialized, then we know we're already in one or the other. If
neither or both are initialized, then the current heuristic should work
fine.

Note that epoxy_is_desktop_gl() is only bothering to check for GLX to
work around PowerVR's broken GLES. One suspects a better way to do that
would be to check GL_VENDOR or GL_RENDERER and avoid probing the window
system at all.

Signed-off-by: Adam Jackson <ajax@redhat.com>
@ebassi
Copy link
Collaborator

ebassi commented Jul 13, 2017

Thanks, it looks good.

There are a few whitespace snafus — probably tabs vs spaces — but as we don't have a coding style document, I'm not in a position to ask for a change.

@ebassi ebassi merged commit e0426c9 into anholt:master Jul 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants