Bug 240313 - [GTK][WPE] Make ANGLE backend EGL context initialization work
Summary: [GTK][WPE] Make ANGLE backend EGL context initialization work
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alejandro G. Castro
URL:
Keywords: InRadar
Depends on:
Blocks: DMA-BUF
  Show dependency treegraph
 
Reported: 2022-05-11 12:43 PDT by Alejandro G. Castro
Modified: 2022-05-16 11:01 PDT (History)
8 users (show)

See Also:


Attachments
Patch (2.47 KB, patch)
2022-05-11 12:51 PDT, Alejandro G. Castro
no flags Details | Formatted Diff | Diff
Patch (2.03 KB, patch)
2022-05-13 13:05 PDT, Alejandro G. Castro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alejandro G. Castro 2022-05-11 12:43:50 PDT
Currently there are issues when running tests with our headless backend, we need to review the way we create the display and choose configuration.
Comment 1 Alejandro G. Castro 2022-05-11 12:51:07 PDT
Created attachment 459178 [details]
Patch
Comment 2 Zan Dobersek (Reviews) 2022-05-12 05:50:08 PDT
Comment on attachment 459178 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=459178&action=review

> Source/WebCore/platform/graphics/gbm/GraphicsContextGLGBM.cpp:222
> -    m_displayObj = EGL_GetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, displayAttributes.data());
> +    m_displayObj = EGL_GetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, PlatformDisplay::sharedDisplay().eglDisplay(), displayAttributes.data());

EGL_DEFAULT_DISPLAY is a native display identifier for the default display, it's cast to EGLNativeDisplayType. The change now pushes an EGLDisplay value into the EGL call, which is not how the entrypoint works. There has to be a different way taken of avoiding X11 in Mesa.
Comment 3 Alejandro G. Castro 2022-05-13 09:51:25 PDT
(In reply to Zan Dobersek (Reviews) from comment #2)
> Comment on attachment 459178 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=459178&action=review
> 
> > Source/WebCore/platform/graphics/gbm/GraphicsContextGLGBM.cpp:222
> > -    m_displayObj = EGL_GetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, displayAttributes.data());
> > +    m_displayObj = EGL_GetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, PlatformDisplay::sharedDisplay().eglDisplay(), displayAttributes.data());
> 
> EGL_DEFAULT_DISPLAY is a native display identifier for the default display,
> it's cast to EGLNativeDisplayType. The change now pushes an EGLDisplay value
> into the EGL call, which is not how the entrypoint works. There has to be a
> different way taken of avoiding X11 in Mesa.

Right, I made the mistake to think the Display was the same Egl display, but it is just used to make sure we return the same EGLDisplay for the same NativeDisplay; just tested even passing (void *) 1, makes the tests work, because it just stores the pointer as an Id and allows the code path to be different using a guessing function, avoiding the building default like when you pass EGL_DEFAULT_DISPLAY, which is 0x0. I can try and environment variable in the script to try to avoid it if I do not find other code path that can be used.

Thanks for the review!
Comment 4 Alejandro G. Castro 2022-05-13 13:05:39 PDT
Created attachment 459320 [details]
Patch
Comment 5 EWS 2022-05-16 10:59:57 PDT
Committed r294245 (250603@main): <https://commits.webkit.org/250603@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 459320 [details].
Comment 6 Radar WebKit Bug Importer 2022-05-16 11:01:14 PDT
<rdar://problem/93357585>