SLIDE 1 QtWayland
Creating Window Compositors with the QtWayland module
Andy Nichols 2012
SLIDE 2 A little about me...
- Andy Nichols
- Software Engineer at Digia
- 6 years of Qt experience
- Former Qt Support Engineer
- Maintainer of QtWayland
SLIDE 3 Outline
- The past (QWS)
- What is wayland?
- The QtWayland Module
- How do you use QtWayland?
SLIDE 4
In case you have not heard...
SLIDE 5
QWS has been removed in Qt 5.0
SLIDE 6
QWS Graphics Stack
SLIDE 7 Direct Rendering with QWS
- Clients map regions of the framebuffer
- Regions are written to directly by client
SLIDE 8 Accelerated Graphics in QWS
- Custom QScreen plugin
- Custom paint engine
- Custom paint device
SLIDE 9
If that is the case, then why replace QWS?
SLIDE 10
It works great for its original use case
SLIDE 11
But we are not living in that world anymore
SLIDE 12
Have you ever actually had to support OpenGL in QWS?
SLIDE 13 QWS is inflexible
- Supporting new hardware
- Customization of look and feel
SLIDE 14 Lack of OpenGL Support
- OpenGL QScreen Plugins do exist
- Limited to particular hardware
- Require specific API's
- Limited to a single process
SLIDE 15 QWS: Does it still make sense?
- Overlap with QPA
- Few QWS developers
- Protocol design is hard
SLIDE 16
And then came a project called Wayland
SLIDE 17 What is Wayland?
"Wayland is a protocol for a compositor to talk to its clients as well as a C library implementation of that protocol."
SLIDE 18 Wayland Compositors can be
- a standalone display server
- an X11 application
- a wayland client
Weston Compositor
SLIDE 19 Wayland Clients can be
- Traditional applications
- X servers
○ rootless ○ fullscreen
SLIDE 20 How does Wayland work?
- 1. Input events
- 2. Direct events to client
- a. Location in scenegraph
- b. Inverse transform
- 3. Respond to UI events
- a. Render changes
- b. notify compositor of
changed regions
- 4. Post composition to output
src: wayland.freedesktop.org
SLIDE 21 The Wayland Compositor
- Composes output
- Handles Input devices
- Forwards input events to clients
- Coordinates client buffers
SLIDE 22 The Wayland Clients
- Renders to a surface buffer
○ Shared Memory buffers ○ native buffers (GPU memory)
- Notifies compositor of changes
SLIDE 23 Wayland Buffer Sharing
○ Raster based toolkits
○ shared between processes with EGL ○ mapped as a texture ○ no additional upload costs
SLIDE 24 Why choose Wayland?
- Lightweight
- Fast and Smooth
- External Open Source Project
- Easy to make customized Compositor
- Protocol is extendable
SLIDE 25
but the best reason is...
SLIDE 26
Cross toolkit compatibility
SLIDE 27
Try doing that with QWS!
SLIDE 28 The QtWayland Module
- Wayland platform plugin
- QtCompositor API
SLIDE 29
Running Qt Applications in a Wayland Compositor
Just add "-platform wayland" To run as a wayland client
SLIDE 30
Demo Time
SLIDE 31
QtCompositor API
SLIDE 32 WaylandCompositor
- Subclass to create your own compositor
- reimplement
○ surfaceCreated(WaylandSurface *surface)
- Call frameFinished() after all surfaces are
rendered.
SLIDE 33 WaylandSurface
- Emits signals when client's state has
changed
○ mapped ○ unmapped ○ damaged
- Contains data needed to render surface
SLIDE 34
SLIDE 35
WaylandSurface data
SLIDE 36 WaylandInputDevice
WaylandCompositor::defaultInputDevice()
- Forward events to Wayland clients.
- Focus management
SLIDE 37
QWindow Compositor Demo
SLIDE 38 WaylandSurfaceItem
- QtQuick 2.0 Item for WaylandSurface
SLIDE 39
QML Compositor Demo
SLIDE 40 QtWayland on new hardware
- Wayland-EGL
- Hardware Integrations
○ Client ■ QWaylandGLIntegration ■ native window surface ■ native OpenGL Context ○ Server ■ GraphicsHardwareIntegration ■ native buffer ■ how to map native buffer to texture
SLIDE 41 Hardware without OpenGL
- No native GPU buffers are used
- No QtQuick 2.0
- Mesa + LLVM software rendered OpenGL
possible
SLIDE 42
Compositor Creativity Demo
SLIDE 43 The Future of QtWayland
- Full wayland 1.0.0 spec support
- Proper client side decorations
- qt-wayland-scanner
- Fullscreen direct rendering
SLIDE 44
Questions?
SLIDE 45
Thanks for coming!
email: andy.nichols@digia.com freenode irc: nezticle