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

EGL_BAD_SURFACE when swapping EGL buffers in a multithreaded context #418

Closed
elinorbgr opened this issue May 1, 2015 · 5 comments
Closed

Comments

@elinorbgr
Copy link
Contributor

I found this while working on wayland, but it also affects X11 (an maybe other platforms, could not test)

Steps to reproduce:

  • Apply this commit elinorbgr@8f87123 which forces the use of EGL with X11 and reduces the multiwindow example to a single thread
  • Run the multiwindow example

for me it results in:

OpenGL version 3.0 Mesa 10.3.7
thread '<unnamed>' panicked at 'eglSwapBuffers failed', src/api/egl/mod.rs:191

running with EGL_LOG_LEVEL=debug gives more information:

libEGL debug: EGL user error 0x300d (EGL_BAD_SURFACE) in eglSwapBuffers

I don't know if it's a glutin bug or a bug from my system (mesa bug ?), would probably be good if it could be tested on different setups to figure this out.

@tomaka
Copy link
Contributor

tomaka commented Aug 27, 2015

After some debugging, it seems that eglGetCurrentContext returns null even when called right after calling eglMakeCurrent with a non-null context.

The call to eglMakeCurrent in question returns EGL_TRUE and eglGetError returns EGL_SUCCESS.

Solution: call eglCurrentContext manually after each eglMakeCurrent to see if the make current operation worked?

@elinorbgr
Copy link
Contributor Author

It would appear this is actually a bug in Mesa's EGL implementation, I cannot reproduce it using Nvidia's libEGL.so

Cannot test on AMD though.

@meh
Copy link
Contributor

meh commented Dec 8, 2016

Does anyone have more information on this?

I'm getting this error and see no solution.

@OptimisticPeach
Copy link

OptimisticPeach commented Nov 11, 2018

Ah, I found a solution for the time being:
When matching the android_glue::Event and get a Event::LostFocus set a flag to false to signal to not draw, and then when drawing, only draw when the flag is true, and then when Event::GainedFocus is reached, set the flag to true.
Edit - Oops, I forgot that this wasn't an android-only repo. Well, it works for android

@goddessfreya
Copy link
Contributor

goddessfreya commented Apr 8, 2019

Can people still repo this? Can I get more more info? eglinfo && glxinfo && glinfo && lspci if on linux please. I can't repo this, and I'm using AMD and mesa.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

6 participants