Bug 1677314 Comment 32 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

(In reply to Darkspirit from comment #31)
> Or other thought: Could eglCreateContext keep using its wrong EGLconfig, but eglCreateWindowSurface get a different EGLconfig that is compatible to its xWindow? CreateSurfaceFromNativeWindow gets passed in a widget, so it might be posstible to create a compatible EGLconfig at this point for its window?

printf debugging:
```
CreateGLContextEGL
CreateForCompositorWidget
no aCompositorWidget
no window
GLContextEGLFactory::CreateImpl
no aWindow
calling CreateConfig with visualID 0
CreateConfig: aVisual: 0
want 32 depth
got 33 egl fb configs
config[0]
no aEnableDepthBuffer
EGL_CONFIG_ID: 0x7 <---------------------- CreateConfig in GLContextProviderEGL.cpp
found egl fb config
x_visual_ptr->visualid: 0x82 <------------- gdk_screen_get_rgba_visual in nsWindow.cpp
RenderCompositor::Create
RenderCompositor::Create: have aWidget
have eglCompositor
CreateEGLSurfaceForCompositorWidget
Crash Annotation GraphicsCriticalError: |[0][GFX1-]: Failed to create EGLSurface!: 0x3009 (t=24.8237) [GFX1-]: Failed to create EGLSurface!: 0x3009
Crash Annotation GraphicsCriticalError: |[0][GFX1-]: Failed to create EGLSurface!: 0x3009 (t=24.8237) |[1][GFX1-]: Failed to create EGLSurface (t=24.8238) [GFX1-]: Failed to create EGLSurface
Crash Annotation GraphicsCriticalError: |[0][GFX1-]: Failed to create EGLSurface!: 0x3009 (t=24.8237) |[1][GFX1-]: Failed to create EGLSurface (t=24.8238) |[2][GFX1-]: Fallback WR to SW-WR (t=25.4984) [GFX1-]: Fallback WR to SW-WR
RenderCompositor::Create
RenderCompositor::Create
```
meaning:
1. Because aVisual is 0, CreateConfig selects first suitable egl fb config 0x007 which wants opaque xvisual 0x02c.
2. gdk_screen_get_rgba_visual sets transparent xvisual 0x082 on the widget which would be wanted by egl fb config 0x008.
3. CreateSurfaceFromNativeWindow then fails to combine egl fb config 0x007 (which wants opaque xvisual 0x02c) with the Xwindow with transparent xvisual 0x082 (which would be supported by egl fb config 0x008).

Idea from comment 31: Could CreateSurfaceFromNativeWindow query its widget's xvisual to call CreateConfig for itself to get a compatible EGLconfig for itself?
Then, both egl fb configs, the one for the EGLContext (0x007) and the one for the EGLSurface (0x008) would have the same contents except that they want different xisuals:


```
nvidia-settings --eglinfo
--fc- --vi- --vt-- buf lv rgb colorbuffer am lm dp st -bind cfrm sb sm cav -----pbuffer----- swapin nv   rn   su -transparent--
  id    id         siz l  lum  r  g  b  a sz sz th en  -  a            eat widt hght max-pxs  mx mn rd   ty   ty typ  r  g  b  
-------------------------------------------------------------------------------------------------------------------------------

0x007 0x02c 0x8002  32  0 rgb  8  8  8  8  0  0  0  0  .  . 0x4D  0  0   . 8000 8000 40000000  8  0  .   4d  807   .  0  0  0
0x008 0x082 0x8002  32  0 rgb  8  8  8  8  0  0  0  0  .  . 0x4D  0  0   . 8000 8000 40000000  8  0  .   4d  807   .  0  0  0

```

```
$ glxinfo
132 GLX Visuals
    visual  x   bf lv rg d st  colorbuffer  sr ax dp st accumbuffer  ms  cav
  id dep cl sp  sz l  ci b ro  r  g  b  a F gb bf th cl  r  g  b  a ns b eat
----------------------------------------------------------------------------
0x02c 24 tc  0  32  0 r  y .   8  8  8  8 .  s  4  0  0 16 16 16 16  0 0 None
0x082 32 tc  0  32  0 r  y .   8  8  8  8 .  s  4  0  0 16 16 16 16  0 0 None
```
(In reply to Darkspirit from comment #31)
> Or other thought: Could eglCreateContext keep using its wrong EGLconfig, but eglCreateWindowSurface get a different EGLconfig that is compatible to its xWindow? CreateSurfaceFromNativeWindow gets passed in a widget, so it might be posstible to create a compatible EGLconfig at this point for its window?

printf debugging:
```
CreateGLContextEGL
CreateForCompositorWidget
no aCompositorWidget
no window
GLContextEGLFactory::CreateImpl
no aWindow
calling CreateConfig with visualID 0
CreateConfig: aVisual: 0
want 32 depth
got 33 egl fb configs
config[0]
no aEnableDepthBuffer
EGL_CONFIG_ID: 0x7 <---------------------- CreateConfig in GLContextProviderEGL.cpp
found egl fb config
x_visual_ptr->visualid: 0x82 <------------- gdk_screen_get_rgba_visual in nsWindow.cpp
RenderCompositor::Create
RenderCompositor::Create: have aWidget
have eglCompositor
CreateEGLSurfaceForCompositorWidget
Crash Annotation GraphicsCriticalError: |[0][GFX1-]: Failed to create EGLSurface!: 0x3009 (t=24.8237) [GFX1-]: Failed to create EGLSurface!: 0x3009
Crash Annotation GraphicsCriticalError: |[0][GFX1-]: Failed to create EGLSurface!: 0x3009 (t=24.8237) |[1][GFX1-]: Failed to create EGLSurface (t=24.8238) [GFX1-]: Failed to create EGLSurface
Crash Annotation GraphicsCriticalError: |[0][GFX1-]: Failed to create EGLSurface!: 0x3009 (t=24.8237) |[1][GFX1-]: Failed to create EGLSurface (t=24.8238) |[2][GFX1-]: Fallback WR to SW-WR (t=25.4984) [GFX1-]: Fallback WR to SW-WR
RenderCompositor::Create
RenderCompositor::Create
```
meaning:
1. Because aVisual is 0, CreateConfig selects first suitable egl fb config 0x007 which wants opaque xvisual 0x02c.
2. gdk_screen_get_rgba_visual sets transparent xvisual 0x082 on the widget which would be wanted by egl fb config 0x008.
3. CreateSurfaceFromNativeWindow then fails to combine egl fb config 0x007 (which wants opaque xvisual 0x02c) with the Xwindow with transparent xvisual 0x082 (which would be supported by egl fb config 0x008).

Idea from comment 31: Could CreateSurfaceFromNativeWindow query its widget's xvisual to call CreateConfig for itself to get a compatible EGLconfig for itself?
Then, both egl fb configs, the one for the EGLContext (0x007) and the one for the EGLSurface (0x008) would have the same contents except that they want different xvisuals:


```
nvidia-settings --eglinfo
--fc- --vi- --vt-- buf lv rgb colorbuffer am lm dp st -bind cfrm sb sm cav -----pbuffer----- swapin nv   rn   su -transparent--
  id    id         siz l  lum  r  g  b  a sz sz th en  -  a            eat widt hght max-pxs  mx mn rd   ty   ty typ  r  g  b  
-------------------------------------------------------------------------------------------------------------------------------

0x007 0x02c 0x8002  32  0 rgb  8  8  8  8  0  0  0  0  .  . 0x4D  0  0   . 8000 8000 40000000  8  0  .   4d  807   .  0  0  0
0x008 0x082 0x8002  32  0 rgb  8  8  8  8  0  0  0  0  .  . 0x4D  0  0   . 8000 8000 40000000  8  0  .   4d  807   .  0  0  0

```

```
$ glxinfo
132 GLX Visuals
    visual  x   bf lv rg d st  colorbuffer  sr ax dp st accumbuffer  ms  cav
  id dep cl sp  sz l  ci b ro  r  g  b  a F gb bf th cl  r  g  b  a ns b eat
----------------------------------------------------------------------------
0x02c 24 tc  0  32  0 r  y .   8  8  8  8 .  s  4  0  0 16 16 16 16  0 0 None
0x082 32 tc  0  32  0 r  y .   8  8  8  8 .  s  4  0  0 16 16 16 16  0 0 None
```

Back to Bug 1677314 Comment 32