49
Introduction Background Wayland Full-Screen Shell Jason Ekstrand Intel Corporation Open-Source 3D Driver Team October 6, 2014 Jason Ekstrand Wayland Full-Screen Shell

Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

Wayland Full-Screen Shell

Jason Ekstrand

Intel CorporationOpen-Source 3D Driver Team

October 6, 2014

Jason Ekstrand Wayland Full-Screen Shell

Page 2: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

About Me

I Ph.D. student in mathematics at Iowa State UniversityI Involved in Wayland since early 2013I Working for Intel on the i965 driver since June

Jason Ekstrand Wayland Full-Screen Shell

Page 3: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

X Server

X Client X Client WindowManager(X Client)

X Client

Device Drivers

OutputInputInput

Jason Ekstrand Wayland Full-Screen Shell

Page 4: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

Compositor

Client

Open GL

KMS

libinput

Client Client

(mutter, KWin, etc.)

evdev DRM

Jason Ekstrand Wayland Full-Screen Shell

Page 5: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

What about code re-use?

We push the common functionality into external libraries:

I KMS for modesettingI DRM for buffer graphics buffer managementI OpenGL [ES] for GPU-accelerated compositingI pixman for CPU-accelerated compositingI libinput for handling different input devices

X is using these too!

Jason Ekstrand Wayland Full-Screen Shell

Page 6: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

What about code re-use?

We push the common functionality into external libraries:

I KMS for modesettingI DRM for buffer graphics buffer managementI OpenGL [ES] for GPU-accelerated compositingI pixman for CPU-accelerated compositingI libinput for handling different input devices

X is using these too!

Jason Ekstrand Wayland Full-Screen Shell

Page 7: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

What about code re-use?

We push the common functionality into external libraries:

I KMS for modesettingI DRM for buffer graphics buffer managementI OpenGL [ES] for GPU-accelerated compositingI pixman for CPU-accelerated compositingI libinput for handling different input devices

X is using these too!

Jason Ekstrand Wayland Full-Screen Shell

Page 8: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

Why not just use X?

X is a fine compositor if you want to let it handle input andcompositing.

Modern desktop environments (GNOME, KDE, E) want tohandle input and compositing themselves.

Jason Ekstrand Wayland Full-Screen Shell

Page 9: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

Why not just use X?

X is a fine compositor if you want to let it handle input andcompositing.

Modern desktop environments (GNOME, KDE, E) want tohandle input and compositing themselves.

Jason Ekstrand Wayland Full-Screen Shell

Page 10: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

Why not just use X?

X is a fine compositor if you want to let it handle input andcompositing.

Modern desktop environments (GNOME, KDE, E) want tohandle input and compositing themselves.

Jason Ekstrand Wayland Full-Screen Shell

Page 11: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

X uses a common global namespace for everything

I Any client can resize/reposition any windowI Any client can get the contents of any windowI Any client can give any other client input

Window managers are just clients that manage other clientswindows using the above mechanisms

Jason Ekstrand Wayland Full-Screen Shell

Page 12: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

X uses a common global namespace for everything

I Any client can resize/reposition any windowI Any client can get the contents of any windowI Any client can give any other client input

Window managers are just clients that manage other clientswindows using the above mechanisms

Jason Ekstrand Wayland Full-Screen Shell

Page 13: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

X uses a common global namespace for everything

I Any client can resize/reposition any windowI Any client can get the contents of any windowI Any client can give any other client input

Window managers are just clients that manage other clientswindows using the above mechanisms

Jason Ekstrand Wayland Full-Screen Shell

Page 14: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

In Wayland...

I The compositor is at the center and each client has its ownnamespace

I Clients get input directly from the compositorI Clients aren’t, in general, aware of other clients’ existenceI A client’s surface contents is kept between the compositor

and the client

This has all sorts of security and other benefits

Jason Ekstrand Wayland Full-Screen Shell

Page 15: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

In Wayland...

I The compositor is at the center and each client has its ownnamespace

I Clients get input directly from the compositorI Clients aren’t, in general, aware of other clients’ existenceI A client’s surface contents is kept between the compositor

and the client

This has all sorts of security and other benefits

Jason Ekstrand Wayland Full-Screen Shell

Page 16: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

In Wayland...

I The compositor is at the center and each client has its ownnamespace

I Clients get input directly from the compositorI Clients aren’t, in general, aware of other clients’ existenceI A client’s surface contents is kept between the compositor

and the client

This has all sorts of security and other benefits

Jason Ekstrand Wayland Full-Screen Shell

Page 17: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

The problem

I X provided a common userspace input/output layerI ”All you have to do” is implement a DDX and everything

just runs on it (more-or-less)I DRM, KMS, and OpenGL are focused on getting images to

hardwareI Not all output devices are hardware

Jason Ekstrand Wayland Full-Screen Shell

Page 18: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

The problem

I X provided a common userspace input/output layerI ”All you have to do” is implement a DDX and everything

just runs on it (more-or-less)I DRM, KMS, and OpenGL are focused on getting images to

hardwareI Not all output devices are hardware

Jason Ekstrand Wayland Full-Screen Shell

Page 19: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

The problem

I X provided a common userspace input/output layerI ”All you have to do” is implement a DDX and everything

just runs on it (more-or-less)I DRM, KMS, and OpenGL are focused on getting images to

hardwareI Not all output devices are hardware

Jason Ekstrand Wayland Full-Screen Shell

Page 20: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

The problem

I X provided a common userspace input/output layerI ”All you have to do” is implement a DDX and everything

just runs on it (more-or-less)I DRM, KMS, and OpenGL are focused on getting images to

hardwareI Not all output devices are hardware

Jason Ekstrand Wayland Full-Screen Shell

Page 21: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

Case Study 1: VNC/RDP Sessions

How this is done on X:

I Implement either a full X server or a DDX for X.orgI Lives entirely in userspace and doesn’t require rootI Clients and window managers talk to it like any other X

server

Several projects such as FreeRDP or x11vnc have done this

Jason Ekstrand Wayland Full-Screen Shell

Page 22: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

Case Study 1: VNC/RDP Sessions

How this is done on X:

I Implement either a full X server or a DDX for X.orgI Lives entirely in userspace and doesn’t require rootI Clients and window managers talk to it like any other X

server

Several projects such as FreeRDP or x11vnc have done this

Jason Ekstrand Wayland Full-Screen Shell

Page 23: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

Case Study 1: VNC/RDP Sessions

How this is done on X:

I Implement either a full X server or a DDX for X.orgI Lives entirely in userspace and doesn’t require rootI Clients and window managers talk to it like any other X

server

Several projects such as FreeRDP or x11vnc have done this

Jason Ekstrand Wayland Full-Screen Shell

Page 24: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

Case Study 1: VNC/RDP Sessions

This poses some problems for Wayland:

I Current input/output abstractions assume hardwareI DRM and KMS require a kernel driverI External libraries exist, but require native support in every

compositor.

Yes, Weston has an RDP backend, but adding backends forevery network protocol to every compositor isn’t a long-termsolution.

Jason Ekstrand Wayland Full-Screen Shell

Page 25: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

Case Study 1: VNC/RDP Sessions

This poses some problems for Wayland:

I Current input/output abstractions assume hardwareI DRM and KMS require a kernel driverI External libraries exist, but require native support in every

compositor.

Yes, Weston has an RDP backend, but adding backends forevery network protocol to every compositor isn’t a long-termsolution.

Jason Ekstrand Wayland Full-Screen Shell

Page 26: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

Case Study 1: VNC/RDP Sessions

This poses some problems for Wayland:

I Current input/output abstractions assume hardwareI DRM and KMS require a kernel driverI External libraries exist, but require native support in every

compositor.

Yes, Weston has an RDP backend, but adding backends forevery network protocol to every compositor isn’t a long-termsolution.

Jason Ekstrand Wayland Full-Screen Shell

Page 27: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

Case Study 2: Screen recording/sharing

How this is done on X:

I Implemented as a regular clientI Any client can grab any other clients contents or the entire

front bufferI Any client can send ”input” to any other client

This raises huge security concerns:

I Clients can grab sensitive information displayed by otherclients

I Clients can fake input and control other clients. (What ifthey are running as root?)

Jason Ekstrand Wayland Full-Screen Shell

Page 28: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

Case Study 2: Screen recording/sharing

How this is done on X:

I Implemented as a regular clientI Any client can grab any other clients contents or the entire

front bufferI Any client can send ”input” to any other client

This raises huge security concerns:

I Clients can grab sensitive information displayed by otherclients

I Clients can fake input and control other clients. (What ifthey are running as root?)

Jason Ekstrand Wayland Full-Screen Shell

Page 29: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

Case Study 2: Screen recording/sharing

How this is done on X:

I Implemented as a regular clientI Any client can grab any other clients contents or the entire

front bufferI Any client can send ”input” to any other client

This raises huge security concerns:

I Clients can grab sensitive information displayed by otherclients

I Clients can fake input and control other clients. (What ifthey are running as root?)

Jason Ekstrand Wayland Full-Screen Shell

Page 30: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

Case Study 2: Screen recording/sharing

How this is done on X:

I Implemented as a regular clientI Any client can grab any other clients contents or the entire

front bufferI Any client can send ”input” to any other client

This raises huge security concerns:

I Clients can grab sensitive information displayed by otherclients

I Clients can fake input and control other clients. (What ifthey are running as root?)

Jason Ekstrand Wayland Full-Screen Shell

Page 31: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

How this is works in Wayland:

I Clients are isolated and no regular client can grab thescreen

I Screen capturing is done by the compositorI The result may be processed by the compositor directly or

handed to a special trusted client

Weston has support for some of this:

I Screen recording via a trusted weston-screenshooter clientI Screen recording to h.264 via libva

All this is Weston and format specific

Jason Ekstrand Wayland Full-Screen Shell

Page 32: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

How this is works in Wayland:

I Clients are isolated and no regular client can grab thescreen

I Screen capturing is done by the compositorI The result may be processed by the compositor directly or

handed to a special trusted client

Weston has support for some of this:

I Screen recording via a trusted weston-screenshooter clientI Screen recording to h.264 via libva

All this is Weston and format specific

Jason Ekstrand Wayland Full-Screen Shell

Page 33: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

How this is works in Wayland:

I Clients are isolated and no regular client can grab thescreen

I Screen capturing is done by the compositorI The result may be processed by the compositor directly or

handed to a special trusted client

Weston has support for some of this:

I Screen recording via a trusted weston-screenshooter clientI Screen recording to h.264 via libva

All this is Weston and format specific

Jason Ekstrand Wayland Full-Screen Shell

Page 34: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

How this is works in Wayland:

I Clients are isolated and no regular client can grab thescreen

I Screen capturing is done by the compositorI The result may be processed by the compositor directly or

handed to a special trusted client

Weston has support for some of this:

I Screen recording via a trusted weston-screenshooter clientI Screen recording to h.264 via libva

All this is Weston and format specific

Jason Ekstrand Wayland Full-Screen Shell

Page 35: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

How do we do this in Wayland?

Someone suggested writing trusted protocol:

I Only accessible by trusted clientsI Allow a client to capture the screen and provide inputI Compositors implement one protocolI Many people can write sharing/recording clientsI Everyone’s happy?

This is a lot of protocol!

Jason Ekstrand Wayland Full-Screen Shell

Page 36: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

How do we do this in Wayland?

Someone suggested writing trusted protocol:

I Only accessible by trusted clientsI Allow a client to capture the screen and provide inputI Compositors implement one protocolI Many people can write sharing/recording clientsI Everyone’s happy?

This is a lot of protocol!

Jason Ekstrand Wayland Full-Screen Shell

Page 37: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

How do we do this in Wayland?

Someone suggested writing trusted protocol:

I Only accessible by trusted clientsI Allow a client to capture the screen and provide inputI Compositors implement one protocolI Many people can write sharing/recording clientsI Everyone’s happy?

This is a lot of protocol!

Jason Ekstrand Wayland Full-Screen Shell

Page 38: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

How do we do this in Wayland?

Suggestion: Use the Wayland protocol

I VNC/RDP servers, etc. implement a Wayland compositorI Compositors launch the subsidiary compositor and

connect as a Wayland clientI The compositor is still in control of who gets the screen

contentsI The protocol is already written!

Jason Ekstrand Wayland Full-Screen Shell

Page 39: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

How do we do this in Wayland?

Suggestion: Use the Wayland protocol

I VNC/RDP servers, etc. implement a Wayland compositorI Compositors launch the subsidiary compositor and

connect as a Wayland clientI The compositor is still in control of who gets the screen

contentsI The protocol is already written!

Jason Ekstrand Wayland Full-Screen Shell

Page 40: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

Compositor

Client

Open GL

KMS

libinput

Client Client

(mutter, KWin, etc.)

evdev DRM

VNC/RDPCompositor

Jason Ekstrand Wayland Full-Screen Shell

Page 41: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

How do we do this in Wayland?

Enter: wl fullscreen shell

I present surface:Presents a surface a single surface on an output with apossible scaling mode.

I present surface for mode:Provides similar functionality but gives the client controlover modesetting

Jason Ekstrand Wayland Full-Screen Shell

Page 42: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

How do we do this in Wayland?

Enter: wl fullscreen shell

I present surface:Presents a surface a single surface on an output with apossible scaling mode.

I present surface for mode:Provides similar functionality but gives the client controlover modesetting

Jason Ekstrand Wayland Full-Screen Shell

Page 43: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

How do we do this in Wayland?

Enter: wl fullscreen shell

I present surface:Presents a surface a single surface on an output with apossible scaling mode.

I present surface for mode:Provides similar functionality but gives the client controlover modesetting

Jason Ekstrand Wayland Full-Screen Shell

Page 44: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

Demo!

Jason Ekstrand Wayland Full-Screen Shell

Page 45: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

Screen recording/sharing is just the beginning!

I Easier to write compositors:I Write as a Wayland client and let Weston handle

input/outputI Userspace MiracastI Modesetting when kernel modules aren’t an option

Note: This is not a replacement for DRM/KMS!

Jason Ekstrand Wayland Full-Screen Shell

Page 46: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

Screen recording/sharing is just the beginning!

I Easier to write compositors:I Write as a Wayland client and let Weston handle

input/outputI Userspace MiracastI Modesetting when kernel modules aren’t an option

Note: This is not a replacement for DRM/KMS!

Jason Ekstrand Wayland Full-Screen Shell

Page 47: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

Screen recording/sharing is just the beginning!

I Easier to write compositors:I Write as a Wayland client and let Weston handle

input/outputI Userspace MiracastI Modesetting when kernel modules aren’t an option

Note: This is not a replacement for DRM/KMS!

Jason Ekstrand Wayland Full-Screen Shell

Page 48: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

Screen recording/sharing is just the beginning!

I Easier to write compositors:I Write as a Wayland client and let Weston handle

input/outputI Userspace MiracastI Modesetting when kernel modules aren’t an option

Note: This is not a replacement for DRM/KMS!

Jason Ekstrand Wayland Full-Screen Shell

Page 49: Wayland Full-Screen Shell - X.Org...I The compositor is at the center and each client has its own namespace I Clients get input directly from the compositor I Clients aren’t, in

IntroductionBackground

Questions?

Jason Ekstrand Wayland Full-Screen Shell