How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... ·...

45
How to embrace wayland for Tizen

Transcript of How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... ·...

Page 1: How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... · Web UI FW WebKit Cairo Freetype & Fontsconfig Xorg pixman ... • Thin architecture

How to embrace wayland

for Tizen

Page 2: How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... · Web UI FW WebKit Cairo Freetype & Fontsconfig Xorg pixman ... • Thin architecture

developers’ prove of concept demo

Page 3: How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... · Web UI FW WebKit Cairo Freetype & Fontsconfig Xorg pixman ... • Thin architecture

3

Agenda

• Wayland introduction

• Embracing wayland for tizen

• Performance enhancement

Page 4: How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... · Web UI FW WebKit Cairo Freetype & Fontsconfig Xorg pixman ... • Thin architecture

Wayland Introduction

Page 5: How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... · Web UI FW WebKit Cairo Freetype & Fontsconfig Xorg pixman ... • Thin architecture

5

Usage scope

……

Page 6: How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... · Web UI FW WebKit Cairo Freetype & Fontsconfig Xorg pixman ... • Thin architecture

6

What is wayland

• Protocols

• 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

server client

Page 7: How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... · Web UI FW WebKit Cairo Freetype & Fontsconfig Xorg pixman ... • Thin architecture

7

Xorg & Wayland architecture

Inter-process communication

Less IPC In wayland

Page 8: How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... · Web UI FW WebKit Cairo Freetype & Fontsconfig Xorg pixman ... • Thin architecture

8

How does wayland/weston work?

shell client

(wayland client)

drm backend

Customized backend Other Wayland clients

shell Wayland

protocols

Weston compositor

Page 9: How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... · Web UI FW WebKit Cairo Freetype & Fontsconfig Xorg pixman ... • Thin architecture

Embracing wayland for Tizen

Page 10: How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... · Web UI FW WebKit Cairo Freetype & Fontsconfig Xorg pixman ... • Thin architecture

10

Linux Kernel DRM GPU Driver G2D Driver

HW

Tizen graphics stack with Xorg

Page 11: How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... · Web UI FW WebKit Cairo Freetype & Fontsconfig Xorg pixman ... • Thin architecture

11

e17

(Compositor)

Native UI FW

Web UI FW

WebKit

Cairo

Freetype

&

Fontsconfig

Xorg pixman

Linux Kernel DRM GPU Driver G2D Driver

HW

Multimedia/

gstreamer elementary

edje ecore

eet

eina

evas

….

Open GL ES EGL

Tizen graphics stack with Xorg

Page 12: How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... · Web UI FW WebKit Cairo Freetype & Fontsconfig Xorg pixman ... • Thin architecture

12

Native Apps Web Apps

e17

(Compositor)

Native UI FW

Web UI FW

WebKit

Cairo

Freetype

&

Fontsconfig

Xorg pixman

Linux Kernel DRM GPU Driver G2D Driver

HW

Multimedia/

gstreamer elementary

edje ecore

eet

eina

evas

….

Open GL ES EGL

Tizen graphics stack with Xorg

Page 13: How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... · Web UI FW WebKit Cairo Freetype & Fontsconfig Xorg pixman ... • Thin architecture

13

EGL Xorg

WebKit

elementary

edje ecore

eet

eina

evas

….

Multimedia/

gstreamer e17

(Compositor)

Native Apps Web Apps

Native UI FW

Web UI FW

Cairo

Freetype

&

Fontsconfig

Wayland protocols Open GL ES pixman

Linux Kernel DRM GPU Driver G2D Driver

HW

EGL

Tizen graphics stack with Wayland

Page 14: How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... · Web UI FW WebKit Cairo Freetype & Fontsconfig Xorg pixman ... • Thin architecture

14

EGL Xorg

WebKit

elementary

edje ecore

eet

eina

evas

….

Multimedia/

gstreamer e17

(Compositor)

Native Apps Web Apps

Weston/e17

(Compositor)

Native UI FW

Web UI FW

Cairo

Freetype

&

Fontsconfig

Wayland protocols Open GL ES pixman

Linux Kernel DRM GPU Driver G2D Driver

HW

EGL

Tizen graphics stack with Wayland

Page 15: How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... · Web UI FW WebKit Cairo Freetype & Fontsconfig Xorg pixman ... • Thin architecture

15

EGL Xorg

WebKit

elementary

edje ecore

eet

eina

evas

….

Multimedia/

gstreamer e17

(Compositor)

Native Apps Web Apps

Weston/e17

(Compositor)

Native UI FW

Web UI FW

Cairo

Freetype

&

Fontsconfig

Wayland protocols Open GL ES pixman

Linux Kernel DRM GPU Driver G2D Driver

HW

elementary

edje ecore

eet

eina

evas

….

EGL

Tizen graphics stack with Wayland

Page 16: How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... · Web UI FW WebKit Cairo Freetype & Fontsconfig Xorg pixman ... • Thin architecture

16

EGL Xorg

WebKit

elementary

edje ecore

eet

eina

evas

….

Multimedia/

gstreamer e17

(Compositor)

Native Apps Web Apps

Weston/e17

(Compositor)

Native UI FW

Web UI FW

WebKit

Cairo

Freetype

&

Fontsconfig

Wayland protocols Open GL ES pixman

Linux Kernel DRM GPU Driver G2D Driver

HW

elementary

edje ecore

eet

eina

evas

….

EGL

Tizen graphics stack with Wayland

Page 17: How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... · Web UI FW WebKit Cairo Freetype & Fontsconfig Xorg pixman ... • Thin architecture

17

EGL Xorg

WebKit

elementary

edje ecore

eet

eina

evas

….

Multimedia/

gstreamer e17

(Compositor)

Native Apps Web Apps

Weston/e17

(Compositor)

Native UI FW

Web UI FW

WebKit

Cairo

Freetype

&

Fontsconfig

Wayland protocols Open GL ES pixman

Linux Kernel DRM GPU Driver G2D Driver

HW

Multimedia/

gstreamer elementary

edje ecore

eet

eina

evas

….

EGL

Tizen graphics stack with Wayland

Page 18: How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... · Web UI FW WebKit Cairo Freetype & Fontsconfig Xorg pixman ... • Thin architecture

18

Changes in general

• Remove hardcoded Xorg dependency

• Add wayland protocol

• Extend EGL

• Add compositor

• Upgrade EFL

• Tizen Frameworks porting to Wayland

• App FW, Multimedia FW, Webkit/WRT…

Page 19: How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... · Web UI FW WebKit Cairo Freetype & Fontsconfig Xorg pixman ... • Thin architecture

19

Weston compositor

Intel Software Professionals Conference - Intel

Confidential

19

weston

Drm

backend

tizen

Shell

HOME UX

Page 20: How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... · Web UI FW WebKit Cairo Freetype & Fontsconfig Xorg pixman ... • Thin architecture

20

Weston compositor

Intel Software Professionals Conference - Intel

Confidential

20

weston

Drm

backend

tizen

Shell

Menuscreen

+

Indicator

+

Lock screen

HOME UX

Page 21: How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... · Web UI FW WebKit Cairo Freetype & Fontsconfig Xorg pixman ... • Thin architecture

21

EFL with Wayland support

EGL

elementary

weston ecore

wayland

Ecore Evas

wayland

engine

surface commit

frame done

input event

APP

Page 22: How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... · Web UI FW WebKit Cairo Freetype & Fontsconfig Xorg pixman ... • Thin architecture

22

Native Applications

• EFL

• Add the patches from upstream

• APPFW

• Hide/show/Rotation to be re-implemented

• Remove X Related API dependencies

Page 23: How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... · Web UI FW WebKit Cairo Freetype & Fontsconfig Xorg pixman ... • Thin architecture

23

Webkit2

• Buffer sharing between web and browser process

• wl surface (with dummy wayland egl window) to fake X pixmap

Page 24: How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... · Web UI FW WebKit Cairo Freetype & Fontsconfig Xorg pixman ... • Thin architecture

24

MultiMedia (with libva)

• Driver render to wayland buffer

• Libva wayland backend

• setting up bridge between server and client

• Gstreamer vaapi video sink

• Attach wl_buffer to wl_surface

Page 25: How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... · Web UI FW WebKit Cairo Freetype & Fontsconfig Xorg pixman ... • Thin architecture

25

Video driver

Page 26: How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... · Web UI FW WebKit Cairo Freetype & Fontsconfig Xorg pixman ... • Thin architecture

26

wl_buffer

Video driver

Libva wayland backend

Page 27: How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... · Web UI FW WebKit Cairo Freetype & Fontsconfig Xorg pixman ... • Thin architecture

27

wl_buffer

attach

Video driver

Libva wayland backend

wl_surface

gstreamer vaapi

Page 28: How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... · Web UI FW WebKit Cairo Freetype & Fontsconfig Xorg pixman ... • Thin architecture

28

wl_buffer

attach

Video driver

Libva wayland backend

wl_surface

gstreamer vaapi

Page 29: How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... · Web UI FW WebKit Cairo Freetype & Fontsconfig Xorg pixman ... • Thin architecture

29

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

Page 30: How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... · Web UI FW WebKit Cairo Freetype & Fontsconfig Xorg pixman ... • Thin architecture

Performance Wayland’s thin architecture makes it possible and easier

Page 31: How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... · Web UI FW WebKit Cairo Freetype & Fontsconfig Xorg pixman ... • Thin architecture

31

Performance

• Frame Rate

• 60 FPS(Frames Per Second)

• 16ms for one frame from client to compositor

Page 32: How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... · Web UI FW WebKit Cairo Freetype & Fontsconfig Xorg pixman ... • Thin architecture

32

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

Page 33: How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... · Web UI FW WebKit Cairo Freetype & Fontsconfig Xorg pixman ... • Thin architecture

33

Live Demo for E-graph

Page 34: How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... · Web UI FW WebKit Cairo Freetype & Fontsconfig Xorg pixman ... • Thin architecture

34

Original state

• Fps curve and timing of critical events (drawn by E-Graph)

• For the scroll animation for org.tizen.Settings

Page 35: How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... · Web UI FW WebKit Cairo Freetype & Fontsconfig Xorg pixman ... • Thin architecture

35

The famous Triple buffering

• Add one buffer for the client and compositor to draw when the resource is

blocked by waiting VSync

busy busy Paint to me

Page 36: How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... · Web UI FW WebKit Cairo Freetype & Fontsconfig Xorg pixman ... • Thin architecture

36

Triple buffering

• Before

~40fps

• After

~48fps

Page 37: How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... · Web UI FW WebKit Cairo Freetype & Fontsconfig Xorg pixman ... • Thin architecture

37

Triple buffering

• Before

~40fps

• After

~48fps

Far away from 60fps

Page 38: How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... · Web UI FW WebKit Cairo Freetype & Fontsconfig Xorg pixman ... • Thin architecture

38

GPU usage

Time spend on

composition

~13ms!

Page 39: How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... · Web UI FW WebKit Cairo Freetype & Fontsconfig Xorg pixman ... • Thin architecture

39

Opaque region

• Weston needs opaque region information to do more efficient

compositing

Surface A(opaque)

Surface B Surface B will not be

drawn

Page 40: How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... · Web UI FW WebKit Cairo Freetype & Fontsconfig Xorg pixman ... • Thin architecture

40

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

Page 41: How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... · Web UI FW WebKit Cairo Freetype & Fontsconfig Xorg pixman ... • Thin architecture

41

Opaque region

• Compositing time

~13ms ~5ms

• FPS

40fps 60fps

Page 42: How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... · Web UI FW WebKit Cairo Freetype & Fontsconfig Xorg pixman ... • Thin architecture

Summary

Page 43: How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... · Web UI FW WebKit Cairo Freetype & Fontsconfig Xorg pixman ... • Thin architecture

43

Embracing wayland

• Prove of Concept result: it’s Doable

• Wayland brings thin architecture for compositor and clients

• Easier to get to the performance goal

Page 45: How to embrace wayland for Tizendownload.tizen.org › misc › media › conference2013 › ... · Web UI FW WebKit Cairo Freetype & Fontsconfig Xorg pixman ... • Thin architecture