-
Notifications
You must be signed in to change notification settings - Fork 45
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
Support for EGL contexts in GrDirectContext.MakeGL #287
Comments
I don't think we have the resource to look at it at all, for a special use case. I suggest you ask the moderngl people. Also, it would be a good idea to make sure you can run upstream's EGL related code in your setup. I found this on a quick search: https://github.com/google/skia/blob/master/tests/EGLImageTest.cpp Maybe reading upstream EGL related code could give you some ideas. Sorry. |
@Swarzox two comments: (1) I am not familiar with moderngl, but your code probably are missing a step along the line of "make this glcontext current"? Immediately making it current is probably implicit for the other ways of creating a context, but maybe not "hand-crafted" ones like you did, (2) glfw itself apparently support egl backend too; you may need to compile glfw yourself to get that - and in turn, pass it along to pyglfw, etc Either way, if you find out how to do it, please share. |
I wrote the above because "MakeGL" is supposed to just get the current. If that fails, it is either that you created a context but did not make it current, or the current isn't compatible with skia. So one direction of trying to fix your code, is to dump "what is current" between your moderngl code and the skia code. |
How to dump the egl context in glfw: |
@Swarzox okay, I looked at the upstream skia example code - the urls I posted - and I think this is the definitive answer: you need to build skia itself differently (editing Btw, glfw (and pyglfw) has a egl mode too, but you probably should use the latest of both. I suggest you try rebuilding skia and skia-python that way, and see if it will do the job. If you need help on that, we can always talk about it separately/privately as a paid commercial commission, as I'll need to know a bit more about your platform, and you may need to arrange for me to have remote login access to it, etc. Depending on your budget, I suppose it might even be possible to patch skia itself, and carry a change permanently, to make egl and x11 switchable at run time. I think it is do-able but will take multiple days of work and testing. And, you can file upstream at https://issues.skia.org and ask them to make skia switchable between egl and x11 at runtime, rather than either/or at build-time, too. Cc @kyamagu |
@Swarzox AFAIC, I needed to make two changes (1) adding In fact in x11, it seems to behaves just like glx build, too, as far as our test suite goes. In headless console login, our test suite fails to initialize glfw, but that seems to be a glfw wheel problem. Anyway, your example works as is on my headless console, if you build skia-python as I outlined with those two additional lines. The libEGL libraries on my system comes from libglvnd , and libGL from mesa3d. It is likely you'll have either or both from your GPU vendor, and you should build skia against your GPU vendor's provision, instead of mesa. |
…L contexts with EGL There are two ways of enabling EGL support on Linux AFAIK: `skia_use_egl=true` switches over to X11 completely. Or we just add `GrGLInterfaces::MakeEGL` to GLX builds. This is the 2nd approach. `skia_use_egl=true` is simpler, but modifies existing X11 behavior. Fixes kyamagu#287
Description
I'm encountering an issue while trying to use Skia-Python in headless mode with EGL. The ModernGL context is created successfully, but Skia is unable to detect it when the
backend="egl"
is used. However, it works correctly with non-EGL backends (e.g.,glx
or usingglfw
).Here is the test code I'm using:
Steps to Reproduce
moderngl.create_standalone_context(backend="egl")
.skia.GrDirectContext.MakeGL()
context isNone
.Expected Behavior
Skia should detect the EGL-based ModernGL context and render as expected.
Actual Behavior
Skia fails to detect the EGL context, and
skia.GrDirectContext.MakeGL()
returnsNone
.Additional Notes
backend="glx"
or when usingglfw
, which relies onxorg
and GLX.Let me know if more details or logs are needed.
The text was updated successfully, but these errors were encountered: