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

Do X11 display detection like Wayland display detection #102

Closed
wants to merge 4 commits into from

Conversation

nwnk
Copy link
Contributor

@nwnk nwnk commented Oct 19, 2016

Same trick as the wayland path, look up a known function pointer at a known offset.

Signed-off-by: Adam Jackson <ajax@redhat.com>
No functional change.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Display::resource_alloc is libX11 ABI; the XAllocID() macro looks like:

  #define XAllocID(dpy) ((*((_XPrivDisplay)(dpy))->resource_alloc)((dpy)))

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

@aaronp24 aaronp24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This direction seems reasonable to me, but your editor looks like it's configured to add tabs.

return EGL_PLATFORM_WAYLAND_KHR;
}
if (vendor->supportsPlatformWayland &&
IsWaylandDisplay(display_id)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going to complain about this dlopening libwayland-client.so.0 more often than necessary, but then I noticed the RTLD_NOLOAD thing, and there presumably aren't too many Wayland vendors at once anyway.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplicity and ease of maintenance are probably a more important concern here than performance. I wouldn't expect eglGetDisplay to be a performance-critical function.

Another option to avoid repeating work would be to move supportsPlatformWayland to be a global variable. The flag doesn't change after loading the vendors, so there's no need to recompute it every time. I'm not sure which one would be simpler.

kbrenneman added a commit to kbrenneman/libglvnd that referenced this pull request Oct 27, 2016
In eglGetDisplay, try to identify an X11 display based on a known function
pointer.

This is based on a patch by ajax@redhat.com:
NVIDIA#102
@kbrenneman kbrenneman closed this Dec 15, 2016
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

3 participants