-
Notifications
You must be signed in to change notification settings - Fork 520
Description
Summary:
When using off-screen rendering with shared texture support in CEF on Linux, rendering fails unless the command-line switch --use-angle=gl-egl is explicitly passed.
This happens because:
The GPU process imports shared textures using OzoneImageBacking::ProduceSkia().
https://source.chromium.org/chromium/chromium/src/+/main:gpu/command_buffer/service/shared_image/shared_image_manager.cc;l=394?q=SharedImageManager::ProduceSkia&ss=chromium
This path requires GetGLOzone() to return a valid object for the current Ozone platform (X11 or Wayland).
GetGLOzone() only works when ANGLE (via EGL) is enabled, i.e., when gl::GetGLImplementation() returns kGLImplementationEGLANGLE.
Without use-angle=gl-egl, GetGLOzone() returns nullptr, leading to SharedImageManager::ProduceSkia() failure and a broken rendering pipeline.
In addition we also see crashes caused by assertions on GTK macros like GDK_SCREEN_XDISPLAY, GDK_SCREEN_XNUMBER etc. The reason for the GTK assertions is the objects being returned are Wayland objects instead of X11. Example assertions
invalid cast from GdkWaylandScreen to GdkX11Screen etc.
Additional Context:
Even with --use-angle=gl-egl and --ozone-platform=x11, rendering on Linux with NVIDIA drivers fails in shared texture OSR mode due to limitations in the GBM backend:
Chromium uses gfx::BufferUsage::SCANOUT_CPU_READ_WRITE in the shared texture offscreen rendering path, which translates to the GBM flag combination GBM_BO_USE_LINEAR | GBM_BO_USE_SCANOUT | GBM_BO_USE_TEXTURING.
https://source.chromium.org/chromium/chromium/src/+/main:ui/gfx/linux/gbm_util.cc;l=24?q=GBM_BO_USE_LINEAR&ss=chromium
This combination does not work on Nvidia. We need to change this to GBM_BO_USE_RENDERING which works correctly on AMD as well.
Proposal:
Add logic in CEF to automatically append --use-angle=gl-egl and ozone-platform=X11 when:
off_screen_rendering_enabled is true, and
GPU compositing is enabled (shared texture mode), and
the switches --use-angle and ozone-backend are not already present.
This would ensure that both vulkan and EGL based applications can render images correctly.