QtWayland Creating Window Compositors with the QtWayland module - - PowerPoint PPT Presentation

qtwayland
SMART_READER_LITE
LIVE PREVIEW

QtWayland Creating Window Compositors with the QtWayland module - - PowerPoint PPT Presentation

QtWayland Creating Window Compositors with the QtWayland module Andy Nichols 2012 A little about me... Andy Nichols Software Engineer at Digia 6 years of Qt experience Former Qt Support Engineer Maintainer of QtWayland


slide-1
SLIDE 1

QtWayland

Creating Window Compositors with the QtWayland module

Andy Nichols 2012

slide-2
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
SLIDE 3

Outline

  • The past (QWS)
  • What is wayland?
  • The QtWayland Module
  • How do you use QtWayland?
slide-4
SLIDE 4

In case you have not heard...

slide-5
SLIDE 5

QWS has been removed in Qt 5.0

slide-6
SLIDE 6

QWS Graphics Stack

slide-7
SLIDE 7

Direct Rendering with QWS

  • Clients map regions of the framebuffer
  • Regions are written to directly by client
slide-8
SLIDE 8

Accelerated Graphics in QWS

  • Custom QScreen plugin
  • Custom paint engine
  • Custom paint device
slide-9
SLIDE 9

If that is the case, then why replace QWS?

slide-10
SLIDE 10

It works great for its original use case

slide-11
SLIDE 11

But we are not living in that world anymore

slide-12
SLIDE 12

Have you ever actually had to support OpenGL in QWS?

slide-13
SLIDE 13

QWS is inflexible

  • Supporting new hardware
  • Customization of look and feel
slide-14
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
SLIDE 15

QWS: Does it still make sense?

  • Overlap with QPA
  • Few QWS developers
  • Protocol design is hard
slide-16
SLIDE 16

And then came a project called Wayland

slide-17
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."

  • wayland.freedesktop.org
slide-18
SLIDE 18

Wayland Compositors can be

  • a standalone display server
  • an X11 application
  • a wayland client

Weston Compositor

slide-19
SLIDE 19

Wayland Clients can be

  • Traditional applications
  • X servers

○ rootless ○ fullscreen

  • other display servers
slide-20
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
SLIDE 21

The Wayland Compositor

  • Composes output
  • Handles Input devices
  • Forwards input events to clients
  • Coordinates client buffers
slide-22
SLIDE 22

The Wayland Clients

  • Renders to a surface buffer

○ Shared Memory buffers ○ native buffers (GPU memory)

  • Notifies compositor of changes
slide-23
SLIDE 23

Wayland Buffer Sharing

  • Shared Memory buffers

○ Raster based toolkits

  • GPU buffers

○ shared between processes with EGL ○ mapped as a texture ○ no additional upload costs

  • Wayland-EGL
slide-24
SLIDE 24

Why choose Wayland?

  • Lightweight
  • Fast and Smooth
  • External Open Source Project
  • Easy to make customized Compositor
  • Protocol is extendable
slide-25
SLIDE 25

but the best reason is...

slide-26
SLIDE 26

Cross toolkit compatibility

slide-27
SLIDE 27

Try doing that with QWS!

slide-28
SLIDE 28

The QtWayland Module

  • Wayland platform plugin
  • QtCompositor API
slide-29
SLIDE 29

Running Qt Applications in a Wayland Compositor

Just add "-platform wayland" To run as a wayland client

slide-30
SLIDE 30

Demo Time

slide-31
SLIDE 31

QtCompositor API

slide-32
SLIDE 32

WaylandCompositor

  • Subclass to create your own compositor
  • reimplement

○ surfaceCreated(WaylandSurface *surface)

  • Call frameFinished() after all surfaces are

rendered.

slide-33
SLIDE 33

WaylandSurface

  • Emits signals when client's state has

changed

○ mapped ○ unmapped ○ damaged

  • Contains data needed to render surface
slide-34
SLIDE 34
slide-35
SLIDE 35

WaylandSurface data

slide-36
SLIDE 36

WaylandInputDevice

  • Get instance from:

WaylandCompositor::defaultInputDevice()

  • Forward events to Wayland clients.
  • Focus management
slide-37
SLIDE 37

QWindow Compositor Demo

slide-38
SLIDE 38

WaylandSurfaceItem

  • QtQuick 2.0 Item for WaylandSurface
slide-39
SLIDE 39

QML Compositor Demo

slide-40
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
SLIDE 41

Hardware without OpenGL

  • No native GPU buffers are used
  • No QtQuick 2.0
  • Mesa + LLVM software rendered OpenGL

possible

slide-42
SLIDE 42

Compositor Creativity Demo

slide-43
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
SLIDE 44

Questions?

slide-45
SLIDE 45

Thanks for coming!

email: andy.nichols@digia.com freenode irc: nezticle