New wayland backend for threaded EGL/GLSL emulator

Scott Moreau oreaus at
Sun Feb 17 09:35:16 PST 2013


For the past week, I've been working on porting Dolphin (the gamecube
to run as a wayland client. I am pleased to announce the code is now in a
state. There are a few issues but fairly minor, considering this is a
EGL/GLSL application that works as an X client or a Wayland client. The same
binary can be run in X or Weston, selectable at runtime.

Since dolphin is a threaded application, timing is critical.
I suspect this is related to the bug I ran into, outlined here
For now, the wayland mainloop seems to be relatively stable using
roundtrips and
usleep. Hopefully I can track down what's going on there so it can dispatch
as intended.

This is quite possibly the first real world application to run as a threaded
wayland-egl client. It is also possibly the first standalone client to
X and Wayland platforms simultaneously.

Following is a summary of the current status of the Wayland client features:

What works:

Build time configuration switches for X and Wayland support
Run time platform switch configurable with environment variable

Core Functionality:
Video output
Audio output
Keyboard input
Joystick input

UI Functionality:
Toggle Fullscreen
Pause/Resume Emulation
Save/Load State
Esc to Exit

What doesn't work:

Mouse input
Resizing the window

More Information:


Exit:                   Esc
Toggle Fullscreen:      'f' or Alt+Enter
Pause:                  'p'
Save State:             Shift+F1-8
Load State:             F1-8


1) Dolphin has high system requirements for cpu and gpu. It is recommended
to first
   install Dolphin from the official channels configured with wxWidgets
frontend in X.
   This will let you get familiarized and see if it works at all with your

2) Grab the code from wayland-egl
branch and build it.


export PKG_CONFIG_PATH=$prefix/lib/pkgconfig

git checkout git:// -b wayland-egl
cd dolphin-emu
mkdir build
cd build

cmake ..                \
    -DCMAKE_INSTALL_PREFIX=$prefix    \
    -DCMAKE_PREFIX_PATH=$prefix    \
    -DUSE_EGL=1 -DDISABLE_WX=1    \
    -DUSE_X11=1 -DUSE_WAYLAND=1    \
    -DCMAKE_BUILD_TYPE=Debug    \

make install

3) Run it:

LD_LIBRARY_PATH=$prefix/lib $prefix/bin/dolphin-emu-nogui -e /path/to/gcm


The platform may be selected by setting the environment variable
DOLPHIN_EGL_PLATFORM to "x11" or "wayland".
If this environment variable is not set, it will attempt to select an
appropriate platform automatically.
Gamepad devices with force feedback capabilities work when Dolphin is built
against SDL2.
Resizing shouldn't be too difficult to implement.
This is a first attempt and WIP so the code isn't perfect and there may be
some bugs.


Dolphin seems to produce invalid image files for screenshots, though weston
screenshooter works fine even when in fullscreen.
The emulator segfaults on exit in wayland, after a hack to work around
stalling on exit.
There is a bug in mesa with GLSL using UBO's that affects Sandybridge. It
causes relatively minor rendering artifacts and does not inhibit

Video Clip:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the wayland-devel mailing list