Skip to content

linux: osr: Default to use-angle=gl-egl and ozone-platform=x11 with shared textures #3953

@agiyengar

Description

@agiyengar

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.

Wayland
https://source.chromium.org/chromium/chromium/src/+/main:ui/ozone/platform/wayland/gpu/wayland_surface_factory.cc;drc=a533a36dfe878045cd210166b8c3f1678fc987e7;bpv=1;bpt=1;l=218

X11
https://source.chromium.org/chromium/chromium/src/+/main:ui/ozone/platform/x11/x11_surface_factory.cc;l=181;drc=a533a36dfe878045cd210166b8c3f1678fc987e7

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug reportcefclientRelated to the cefclient sample apphas fixA fix has been proposedlinuxLinux platformosrRelated to off-screen rendering

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions