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

glscopeclient fails to run under Wayland due to GLEW init failure #277

Closed
azonenberg opened this issue Nov 4, 2020 · 3 comments · Fixed by #391
Closed

glscopeclient fails to run under Wayland due to GLEW init failure #277

azonenberg opened this issue Nov 4, 2020 · 3 comments · Fixed by #391
Labels
bug Something isn't working rendering Changes to display capabilities
Milestone

Comments

@azonenberg
Copy link
Collaborator

glewInit returns GLEW_ERROR_NO_GLX_DISPLAY. Seems like something is looking for GLX when we're using Wayland and things bork.

@azonenberg azonenberg added bug Something isn't working rendering Changes to display capabilities labels Nov 4, 2020
@xzcvczx
Copy link
Contributor

xzcvczx commented Apr 24, 2021

GDK_BACKEND="x11" seems to work if you have xwayland

@azonenberg azonenberg added this to the v1.0 milestone Apr 28, 2021
@azonenberg
Copy link
Collaborator Author

Do we have a working flow for getting glscopeclient to run under Wayland, perhaps using xwayland? If so, please submit a PR to scopehal-docs with instructions on how to get this working.

Keeping this issue open and tagged for the v1.0 release because I want better native Wayland compatibility long term.

@azonenberg azonenberg changed the title glscopeclient fails to run on Fedora under Wayland due to GLEW init failure glscopeclient fails to run under Wayland due to GLEW init failure Apr 28, 2021
@dannas
Copy link
Contributor

dannas commented Oct 20, 2021

Over at the GLEW repo, nigels-com/glew#172, the supertux folks reports that GLEW seems to be usable even if glewInit returns GLEW_ERROR_NO_GLX_DISPLAY.

I can start glscopeclient and display the waveforms for the demo device, if I make this modification:

diff --git a/src/glscopeclient/WaveformArea.cpp b/src/glscopeclient/WaveformArea.cpp
index e68601b..d8dfc09 100644
--- a/src/glscopeclient/WaveformArea.cpp
+++ b/src/glscopeclient/WaveformArea.cpp
@@ -504,7 +504,7 @@ void WaveformArea::on_realize()
 
                //Initialize GLEW
                GLenum glewResult = glewInit();
-               if (glewResult != GLEW_OK)
+        if (glewResult != GLEW_OK && glewResult != 4)
                {
                        string err =
                                "glscopeclient was unable to initialize GLEW and cannot continue.\n"

The Glew maintainer said that he would expose glewContextInit in the public API which would allow for both EGL and GLX to be used (if I understood him correctly). But that was back in 2018 and no such change has been committed.

I guess we can use the glew-patch that supertux uses: supertuxkart/stk-code@961ac4d, but then we'd have to package our own version of glew.

Or we can check for $XDG_SESSION_TYPE == wayland and in that case ignore GLEW_ERROR_NO_GLX_DISPLAY? I'll google a bit to check what is the most reliable way of detecting if a program is running under wayland.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working rendering Changes to display capabilities
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants