How to embrace wayland for Tizen

How to embrace wayland
for Tizen
developers’ prove of concept demo
Agenda
• Wayland introduction
• Embracing wayland for tizen
• Performance enhancement
3
Wayland Introduction
Usage scope
……
5
What is wayland
•
Protocols
server
6
client
•
Wayland is a protocol for a compositor to talk to its clients as well as a C library
implementation of that protocol. (Kristensen, Kristian)
•
Weston is one compositor (Kristensen, Kristian)
6
Xorg & Wayland architecture
Inter-process communication
Less IPC In wayland
7
How does wayland/weston work?
Weston compositor
shell client
(wayland client)
drm backend
shell
Wayland
protocols
Customized backend
Other Wayland clients
8
Embracing wayland for Tizen
Tizen graphics stack with Xorg
Linux Kernel
DRM
GPU Driver
HW
10
G2D Driver
Tizen graphics stack with Xorg
Web UI FW
Native UI FW
WebKit
e17
(Compositor)
Xorg
Linux Kernel
Multimedia/
gstreamer
elementary
edje
ecore
evas
eet
….
eina
EGL
DRM
HW
11
Cairo
Freetype
&
Fontsconfig
Open GL ES
pixman
GPU Driver
G2D Driver
Tizen graphics stack with Xorg
Native Apps
Web Apps
Web UI FW
Native UI FW
WebKit
e17
(Compositor)
Xorg
Linux Kernel
Multimedia/
gstreamer
elementary
edje
ecore
evas
eet
….
eina
EGL
DRM
HW
12
Cairo
Freetype
&
Fontsconfig
Open GL ES
pixman
GPU Driver
G2D Driver
Tizen graphics stack with Wayland
Native Apps
Web Apps
Web UI FW
Native UI FW
WebKit
e17
(Compositor)
Wayland
Xorg
protocols
Linux Kernel
Multimedia/
gstreamer
elementary
edje
ecore
evas
eet
….
eina
EGL
DRM
HW
13
Cairo
Freetype
&
Fontsconfig
Open GL ES
pixman
GPU Driver
G2D Driver
Tizen graphics stack with Wayland
Native Apps
Web Apps
Web UI FW
Native UI FW
WebKit
Weston/e17
e17
(Compositor)
Wayland
Xorg
protocols
Linux Kernel
Multimedia/
gstreamer
elementary
edje
ecore
evas
eet
….
eina
EGL
DRM
HW
14
Cairo
Freetype
&
Fontsconfig
Open GL ES
pixman
GPU Driver
G2D Driver
Tizen graphics stack with Wayland
Native Apps
Web Apps
Web UI FW
Native UI FW
WebKit
Weston/e17
e17
(Compositor)
Wayland
Xorg
protocols
Linux Kernel
Multimedia/
gstreamer
elementary
elementary
edje
edje
ecore
ecore
evas
evas
….
….
eet
eet
eina
eina
EGL
DRM
HW
15
Cairo
Freetype
&
Fontsconfig
Open GL ES
pixman
GPU Driver
G2D Driver
Tizen graphics stack with Wayland
Native Apps
Web Apps
Web UI FW
Native UI FW
WebKit
Weston/e17
e17
(Compositor)
Wayland
Xorg
protocols
Linux Kernel
Multimedia/
gstreamer
elementary
elementary
edje
edje
ecore
ecore
evas
evas
….
….
eet
eet
eina
eina
EGL
DRM
HW
16
Cairo
Freetype
&
Fontsconfig
Open GL ES
pixman
GPU Driver
G2D Driver
Tizen graphics stack with Wayland
Native Apps
Web Apps
Web UI FW
Native UI FW
WebKit
Weston/e17
e17
(Compositor)
Wayland
Xorg
protocols
Linux Kernel
Multimedia/
gstreamer
elementary
elementary
edje
edje
ecore
ecore
evas
evas
….
….
eet
eet
eina
eina
EGL
DRM
HW
17
Cairo
Freetype
&
Fontsconfig
Open GL ES
pixman
GPU Driver
G2D Driver
Changes in general
•
•
•
•
•
•
Remove hardcoded Xorg dependency
Add wayland protocol
Extend EGL
Add compositor
Upgrade EFL
Tizen Frameworks porting to Wayland
•
18
App FW, Multimedia FW, Webkit/WRT…
Weston compositor
HOME UX
weston
tizen
Shell
Drm
backend
19
Intel Software Professionals Conference - Intel
Confidential
19
Weston compositor
HOME UX
weston
Drm
backend
20
tizen
Shell
Menuscreen
+
Indicator
+
Lock screen
…
Intel Software Professionals Conference - Intel
Confidential
20
EFL with Wayland support
APP
elementary
wayland
engine
Ecore Evas
EGL
frame done
weston
ecore
wayland
21
surface commit
input event
Native Applications
• EFL
•
Add the patches from upstream
• APPFW
•
Hide/show/Rotation to be re-implemented
• Remove X Related API dependencies
22
Webkit2
• Buffer sharing between web and browser process
• wl surface (with dummy wayland egl window) to fake X pixmap
23
MultiMedia (with libva)
• Driver render to wayland buffer
• Libva wayland backend
•
setting up bridge between server and client
• Gstreamer vaapi video sink
•
24
Attach wl_buffer to wl_surface
Video driver
25
Libva wayland backend
wl_buffer
Video driver
26
gstreamer vaapi
Libva wayland backend
wl_surface
wl_buffer
attach
Video driver
27
gstreamer vaapi
Libva wayland backend
wl_surface
wl_buffer
attach
Video driver
28
Benefits
• Memory saving in video
•
•
Flexible buffer type(RGB/YUV), direction and size for composition
Inherent all benefits for overlay
• Thin architecture for performance tuning
29
Performance
Wayland’s thin architecture makes it possible and easier
Performance
• Frame Rate
•
•
31
60 FPS(Frames Per Second)
16ms for one frame from client to compositor
Performance: tool
• E-Graph
We developed a tool to visualize log information and draw FPS curve
Open source project hosted at https://gitorious.org/e-graph/e-graph
32
Live Demo for E-graph
33
Original state
•
•
34
Fps curve and timing of critical events (drawn by E-Graph)
For the scroll animation for org.tizen.Settings
The famous Triple buffering
•
Add one buffer for the client and compositor to draw when the resource is
blocked by waiting VSync
busy
35
busy
Paint to me
Triple buffering
• Before
~40fps
• After
~48fps
36
Triple buffering
• Before
~40fps
• After
~48fps
Far away from 60fps
37
GPU usage
Time spend on
composition
~13ms!
38
Opaque region
•
Weston needs opaque region information to do more efficient
compositing
Surface A(opaque)
Surface B
39
Surface B will not be
drawn
Root cause
• No opaque region set for surface
• Weston redraw the overlapped surface
• Heavy work load during composition
Action
to set the opaque region for wayland
surface in ecore
40
Opaque region
• Compositing time
~13ms  ~5ms
• FPS
40fps  60fps
41
Summary
Embracing wayland
• Prove of Concept result: it’s Doable
• Wayland brings thin architecture for compositor and clients
• Easier to get to the performance goal
43
Wayland Upstream Resources
• Maillist: [email protected]
• Wiki Page: wayland.freedesktop.org
• E-graph: https://gitorious.org/e-graph/e-graph
44