Bug 240313

Summary: [GTK][WPE] Make ANGLE backend EGL context initialization work
Product: WebKit Reporter: Alejandro G. Castro <alex>
Component: New BugsAssignee: Alejandro G. Castro <alex>
Status: RESOLVED FIXED    
Severity: Normal CC: clord, dino, ews-watchlist, glenn, jbedard, kondapallykalyan, webkit-bug-importer, zdobersek
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 237649    
Attachments:
Description Flags
Patch
none
Patch none

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>