libretro / libretro/RetroArch

[META] Wayland

Open
#17,310 1 comment 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug: wayland feature request
Dominant language
C
Stars
14.1k
Forks
2.2k
Avg merge
7h 35m
Merged PRs (30d)
51

Description

Tasks

Here are some things I've been thinking about regarding wayland, I may add more if they occur to me.

  • Don't destroy wl_display and wl_surface until quit
    Currently gfx drivers are destroyed on core launch and fullscreen transitions.
    This would allow the splash screen to be displayed on launch rather than on fullscreen and core transitions.
    Currently the android keeps it's surface as a single surface is provided on application launch. It does this will a global if I recall correctly. Maybe window management should be split out of the gfx driver.

  • Remove the splashscreen.

  • xdg_toplevel configure events should stored until the xdg_surface configure at which point they're applied and acked
    I think is handled correctly by libdecor but without libdecor currently RetroArch just acks the configure.
    https://github.com/libretro/RetroArch/blob/3e6486db2be523829bc22841c4a30b674978e9bf/input/common/wayland_common.c#L664-L669

  • Bumb protocol versions
    This can require implementing new event handlers, some of which are okay to ignore. However it can also require larger changes.

  • Use wl_event_queue to decouple display and input threads
    When threaded video is enabled the wayland fd is read from the video and input threads.

    • Take more care with queue and dispatch, use libdecor_dispatch where appropriate.
  • Drag and drop https://github.com/libretro/RetroArch/pull/16443
    My attempt at implementing this crashes RetroArch and depends on glib for URI decoding.

  • wp_presentation

  • wp_color_manager

  • Rewrite wl_output structs

  • xdg_toplevel_icon

  • Stop dynamically loading libdecor?

  • Version gate libdecor features

  • Use XDG_TOPLEVEL_STATE_RESIZING to rate limit framebuffer allocation

Links

Wayland Vulkan WSI docs
mesa Wayland Vulkan WSI implementation
Wayland protocols

Testing strategy

Run nested kwin (env WAYLAND_DISPLAY=wayland-1):

kwin_wayland --xwayland --no-lockscreen  --width 1920 --height 1080 --output-count 2

--output-count 2 will cause retroarch to show a splash screen. --output-count 1 will forego the splash screen.

Run nested mutter (env WAYLAND_DISPLAY=wayland-1):

MUTTER_DEBUG_DUMMY_MODE_SPECS=1920x1080 dbus-run-session -- mutter --nested --wayland

Run with limited CPU, useful for debugging race conditions:

systemd-run --user --pty --same-dir -p CPUQuota=1% --setenv=WAYLAND_DISPLAY=wayland-1 ./retroarch

Build without libdecor for testing raw xdg-toplevel implementation:

./configure --enable-debug --disable-libdecor

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

This is a broad Wayland task list rather than a single scoped change. Start with input/common/wayland_common.c for the configure-event item, or choose another unchecked task and trace its relevant entry point. Use the nested kwin or mutter commands in the issue, and consider the selected task done when its behavior is implemented and tested in the described environment.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
desktop, operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.