Skip to content

fix: expose EGL_WL_bind_wayland_display for Qt Wayland clients#248

Merged
paperbenni merged 2 commits intomainfrom
fix-egl-wayland-display-4200173433058344887
Mar 23, 2026
Merged

fix: expose EGL_WL_bind_wayland_display for Qt Wayland clients#248
paperbenni merged 2 commits intomainfrom
fix-egl-wayland-display-4200173433058344887

Conversation

@paperbenni
Copy link
Copy Markdown
Member

@paperbenni paperbenni commented Mar 23, 2026

Exposes the EGL_WL_bind_wayland_display Wayland extension to clients by explicitly calling bind_wl_display(&display_handle) on the GlesRenderer through the smithay::backend::renderer::ImportEgl trait. This fixes rendering issues and qt.waylandcompositor.hardwareintegration crashes with Qt5/Qt6 applications (like Telegram).


PR created automatically by Jules for task 4200173433058344887 started by @paperbenni

Summary by Sourcery

Bind the EGL renderer to the Wayland display in both DRM and winit runtimes to expose the EGL_WL_bind_wayland_display extension to clients.

New Features:

  • Expose the EGL_WL_bind_wayland_display Wayland extension to Qt and other Wayland clients by binding EGL to the compositor display handle.

Bug Fixes:

  • Prevent rendering issues and crashes in Qt Wayland compositor hardware integration by ensuring the renderer is bound to the Wayland display.

Summary by CodeRabbit

  • Improvements
    • Enhanced error handling during display initialization, with failures now logged as warnings instead of being silently ignored or aborting.
    • Improved stability of the rendering setup process by ensuring proper binding of the EGL rendering context to the Wayland display.

Qt applications and browsers require the `EGL_WL_bind_wayland_display`
extension to properly initialize hardware acceleration natively on
Wayland.

This explicitly calls `bind_wl_display()` on the `GlesRenderer`
(using the `ImportEgl` trait) in both the DRM and Winit backends,
making this extension available to Wayland clients.

Co-authored-by: paperbenni <15818888+paperbenni@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai bot commented Mar 23, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR ensures the EGL_WL_bind_wayland_display extension is actually bound for Wayland clients by invoking bind_wl_display on the renderer in both the DRM and winit Wayland runtimes, with warnings logged on failure.

Sequence diagram for DRM runtime initialization with EGL_WL_bind_wayland_display

sequenceDiagram
    participant DrmRuntime as DrmRuntime_run
    participant State as WaylandState
    participant Renderer as GlesRenderer
    participant WlDisplay as WaylandDisplay

    DrmRuntime->>State: init_dmabuf_global(dmabuf_formats, egl_display)
    Note over State: dmabuf global initialized

    DrmRuntime->>State: with_renderer(callback)
    activate State
    State->>Renderer: provide_mut_renderer_to_callback
    activate Renderer
    State->>Renderer: bind_wl_display(display_handle)
    Renderer-->>State: Result<(), Error>
    deactivate Renderer

    alt bind_wl_display fails
        State->>State: log::warn("failed to bind egl to wayland display")
    else bind_wl_display succeeds
        Note over State,WlDisplay: EGL_WL_bind_wayland_display extension bound
    end
    deactivate State

    DrmRuntime->>State: init_screencopy_manager()
    Note over State: screencopy manager ready
Loading

Sequence diagram for winit runtime initialization with EGL_WL_bind_wayland_display

sequenceDiagram
    participant WinitRuntime as WinitRuntime_run
    participant State as WaylandState
    participant Backend as WinitBackend
    participant Renderer as GlesRenderer
    participant WlDisplay as WaylandDisplay

    WinitRuntime->>State: init_dmabuf_global(dmabuf_formats, egl_display)
    Note over State: dmabuf global initialized

    WinitRuntime->>Backend: renderer()
    Backend-->>WinitRuntime: &mut Renderer

    WinitRuntime->>Renderer: bind_wl_display(state.display_handle)
    Renderer-->>WinitRuntime: Result<(), Error>

    alt bind_wl_display fails
        WinitRuntime->>WinitRuntime: log::warn("failed to bind egl to wayland display")
    else bind_wl_display succeeds
        Note over Renderer,WlDisplay: EGL_WL_bind_wayland_display extension bound
    end

    WinitRuntime->>State: init_screencopy_manager()
    Note over State: screencopy manager ready
Loading

File-Level Changes

Change Details Files
Bind the EGL renderer to the Wayland display in the DRM runtime to expose EGL_WL_bind_wayland_display to clients.
  • After initializing the dmabuf global, invoke state.with_renderer to access the renderer
  • Call renderer.bind_wl_display with the state's display_handle
  • Log a warning if bind_wl_display returns an error instead of failing hard
src/wayland/runtime/drm.rs
Bind the EGL renderer to the Wayland display in the winit runtime to expose EGL_WL_bind_wayland_display to clients.
  • After initializing the dmabuf global, call backend.renderer().bind_wl_display with the state's display_handle
  • Log a warning if bind_wl_display returns an error instead of failing hard
src/wayland/runtime/winit.rs

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 23, 2026

Warning

Rate limit exceeded

@paperbenni has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 19 minutes and 55 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: faad1660-3285-468e-a83e-cdba1c12cbe0

📥 Commits

Reviewing files that changed from the base of the PR and between 6a13b33 and 06ec5da.

📒 Files selected for processing (3)
  • src/backend/wayland/compositor/state.rs
  • src/wayland/runtime/drm.rs
  • src/wayland/runtime/winit.rs
📝 Walkthrough

Walkthrough

The DRM and Winit runtime backends now import ImportEgl and bind the EGL renderer to the Wayland display after initializing DMABUF globals. Binding failures are logged as warnings rather than silently failing, allowing execution to continue with subsequent initialization steps.

Changes

Cohort / File(s) Summary
EGL Renderer Binding
src/wayland/runtime/drm.rs, src/wayland/runtime/winit.rs
Added ImportEgl import and EGL-to-Wayland display binding after DMABUF initialization, with non-fatal warning logging on binding failures.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Poem

🐰 The EGL threads now bind with care,
To Wayland's grand display so fair,
No silent fails in this new dance,
Just warnings logged—a second chance! 🎪

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: exposing the EGL_WL_bind_wayland_display extension for Qt Wayland clients by binding the EGL renderer to the display.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-egl-wayland-display-4200173433058344887

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • The new bind_wl_display calls in both drm.rs and winit.rs are nearly identical; consider extracting this into a shared helper on the state/backend (e.g. state.bind_egl_to_display()) so the behavior and logging stay consistent and easier to maintain.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new `bind_wl_display` calls in both `drm.rs` and `winit.rs` are nearly identical; consider extracting this into a shared helper on the state/backend (e.g. `state.bind_egl_to_display()`) so the behavior and logging stay consistent and easier to maintain.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@paperbenni
Copy link
Copy Markdown
Member Author

@jules
Please address the comments from this code review:

Overall Comments

  • The new bind_wl_display calls in both drm.rs and winit.rs are nearly identical; consider extracting this into a shared helper on the state/backend (e.g. state.bind_egl_to_display()) so the behavior and logging stay consistent and easier to maintain.

@google-labs-jules
Copy link
Copy Markdown
Contributor

@jules
Please address the comments from this code review:

Overall Comments

  • The new bind_wl_display calls in both drm.rs and winit.rs are nearly identical; consider extracting this into a shared helper on the state/backend (e.g. state.bind_egl_to_display()) so the behavior and logging stay consistent and easier to maintain.

I have extracted the bind_wl_display logic into a shared helper state.bind_egl_to_display(renderer) on WaylandState. Both drm.rs and winit.rs now use this unified helper, keeping the behavior and logging consistent.

Qt applications and browsers require the `EGL_WL_bind_wayland_display`
extension to properly initialize hardware acceleration natively on
Wayland.

This explicitly calls `bind_wl_display()` on the `GlesRenderer`
(using the `ImportEgl` trait) in both the DRM and Winit backends,
making this extension available to Wayland clients.

Co-authored-by: Claude <claude@anthropic.com>

Co-authored-by: paperbenni <15818888+paperbenni@users.noreply.github.com>
@paperbenni paperbenni merged commit f52502e into main Mar 23, 2026
3 of 5 checks passed
@paperbenni paperbenni deleted the fix-egl-wayland-display-4200173433058344887 branch March 23, 2026 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant