RFR: 8329820: [Linux] Prefer EGL over GLX [v16]

Thiago Milczarek Sayao tsayao at openjdk.org
Sun Aug 25 20:48:11 UTC 2024


On Sun, 25 Aug 2024 20:00:44 GMT, Thiago Milczarek Sayao <tsayao at openjdk.org> wrote:

>> Wayland implementation will require EGL. 
>> 
>> EGL works with Xorg as well. The idea is to be EGL first and if it fails, fallback to GLX. A force flag `prism.es2.forceGLX=true` is available.
>> 
>> 
>> See:
>> [Switching the Linux graphics stack from GLX to EGL](https://mozillagfx.wordpress.com/2021/10/30/switching-the-linux-graphics-stack-from-glx-to-egl/)
>> [Prefer EGL to GLX for the GL support on X11](https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/3540)
>
> Thiago Milczarek Sayao has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 11 commits:
> 
>  - Merge branch 'master' into egl
>  - Merge branch 'refs/heads/master' into egl
>  - Merge branch 'refs/heads/master' into egl
>  - Merge branch 'refs/heads/master' into egl
>  - Merge branch 'refs/heads/master' into egl
>  - Use prismES2EGLX11 as build name
>  - Merge branch 'master' into egl
>  - Prefer EGL over GLX
>  - Merge branch 'master' into egl
>  - Merge branch 'master' into egl
>    
>    # Conflicts:
>    #	modules/javafx.graphics/src/main/native-prism-es2/x11/X11GLContext.c
>  - ... and 1 more: https://git.openjdk.org/jfx/compare/3261e940...3d30397c

Found the problem:

`createDrawable` is being called twice on the same X Window.

>From the DOCS:

> EGL_BAD_ALLOC is generated if there is already an EGLSurface associated with native_window (as a result of a previous eglCreatePlatformWindowSurface call).

This also happens on the current GLX implementation and is probably a leak.

Place ` fprintf(stderr, "Window XID %ld\n", nativeWindow);` on ` X11GLDrawable.c` line 51 and run the `SetSceneScalingTest` - it gets printed twice.

-------------

PR Comment: https://git.openjdk.org/jfx/pull/1381#issuecomment-2308987931


More information about the openjfx-dev mailing list