27

Wayland support in WebKit2GTK+ (GUADEC 2014)

  • Upload
    igalia

  • View
    111

  • Download
    3

Embed Size (px)

DESCRIPTION

By Žan Doberšek. Although most of the Wayland porting work will be solved by UI toolkits like GTK+, when X dependencies go beyond an implementation detail and have an influence on how a particular feature was designed, porting the software to Wayland can be more challenging. WebKit2GTK+ is one such case due to the split process architecture that comes with WebKit2, where rendering happens across two processes that need optimal (zero-copy) mechanisms to share an accelerated graphics surface for its Accelerated Compositing feature. This talk is intended for developers interested in porting applications to Wayland that need to share accelerated graphics between two processes. The talk will focus on WebKit2GTK+ as a case study, explaining how WebKit2’s architecture and X influenced the original design and implementation of Accelerated Compositing and how this feature is redesigned and implemented for Wayland.

Citation preview

Page 1: Wayland support in WebKit2GTK+ (GUADEC 2014)
Page 2: Wayland support in WebKit2GTK+ (GUADEC 2014)

Wayland support in WebKitGTK+Žan DoberšekIgalia

Strasbourg, July 28th, 2014

Page 3: Wayland support in WebKit2GTK+ (GUADEC 2014)

I - Overview of WebKit

3/27

Page 4: Wayland support in WebKit2GTK+ (GUADEC 2014)

WebKit - a portable Web engine

In memoriam: Chromium, Qt

PCs, phones, TVs, IVI, smartwatchesMac, iOS, 2 flavors of the Windows port, EFL, GTK

··

4/27

Page 5: Wayland support in WebKit2GTK+ (GUADEC 2014)

About the fork

via WebKit Memes

5/27

Page 6: Wayland support in WebKit2GTK+ (GUADEC 2014)

WebKitGTK+, the GTK+ port

... but really a GNOME port.

Web, Evolution, Yelp, Liferea ...

Highlights of the past year:

WebKit1 removedMultiple WebProcessesThe NetworkProcessCMake replaced Autotools

····

6/27

Page 7: Wayland support in WebKit2GTK+ (GUADEC 2014)

WebKitGTK+, the GNOME port

Future work

Stability and securityPerformanceWebRTC, WebCrypto and other W3C/WHATWG standardsMore processes! (storage, workers)Wayland support

·····

7/27

Page 8: Wayland support in WebKit2GTK+ (GUADEC 2014)

II - Overview of Wayland

8/27

Page 9: Wayland support in WebKit2GTK+ (GUADEC 2014)

Wayland

The successor to the X windowing systemPCs, phones, TVs, IVI

··

9/27

Page 10: Wayland support in WebKit2GTK+ (GUADEC 2014)

Wayland support in GNOME

Ever improving!

10/27

Page 11: Wayland support in WebKit2GTK+ (GUADEC 2014)

III - Wayland support in WebKitGTK+

11/27

Page 12: Wayland support in WebKit2GTK+ (GUADEC 2014)

General overview

Basic support relies on GTK+Accelerated Compositing requires an inventive approachThe problem with the Netscape plugins

···

12/27

Page 13: Wayland support in WebKit2GTK+ (GUADEC 2014)

Accelerated Compositing

Triggered by specific content - HTML video, HTML canvas, WebGL, CSStransforms, CSS filters ...Also enforcable (no need for triggers)Hardware-accelerated compositing of rendered layers throughOpenGL/OpenGLES

·

··

13/27

Page 14: Wayland support in WebKit2GTK+ (GUADEC 2014)

The obligatory WebKit2 diagram

via WebKit Trac

14/27

Page 15: Wayland support in WebKit2GTK+ (GUADEC 2014)

Implementation under X

Relies on XcompositeUIProcess prepares an X windowThe window handle is passed to the WebProcessThe WebProcess creates a GL context for that handle

····

15/27

Page 16: Wayland support in WebKit2GTK+ (GUADEC 2014)

Implementation under Wayland

Implemented using a nested Wayland compositor in the UIProcessWebProcess essentially an EGL client of that compositor

··

16/27

Page 17: Wayland support in WebKit2GTK+ (GUADEC 2014)

Implementation under Wayland

A small extension to the Wayland protocol is required.

Necessary to map the compositor client to the correspondingWebKitWebViewAppropriate for 1:1 and 1:N UIProcess-to-WebProcess mappings

·

·

17/27

Page 18: Wayland support in WebKit2GTK+ (GUADEC 2014)

Necessary bits

Basic Wayland support by your driver.

Hopefully you're using Intel.

Some additional EGL extensions are required.

GL_OES_EGL_image_externalEGL_KHR_image_baseEGL_WL_bind_wayland_display

···

18/27

Page 19: Wayland support in WebKit2GTK+ (GUADEC 2014)

Testing under Wayland

WebKit has a large suite of layout tests (> 30,000).

Many of these compare pixel output to a specified baseline or a reftest.

Performance tests should measure performance - correctness ensured bythe layout tests.

Hardware rasterizer can produce varying results over different runsRunning the tests will probably require the software rasterizer

··

19/27

Page 20: Wayland support in WebKit2GTK+ (GUADEC 2014)

Future work

The target is WebKitGTK+ 2.6.

Bug polishImprovements in performanceWebGL supportPossible subsurface-based implementationNetscape plugins?

·····

20/27

Page 21: Wayland support in WebKit2GTK+ (GUADEC 2014)

III.I - Demos

21/27

Page 22: Wayland support in WebKit2GTK+ (GUADEC 2014)

IV - Putting it all on Raspberry Pi

22/27

Page 23: Wayland support in WebKit2GTK+ (GUADEC 2014)

Because why not?

Everyone's favourite mini-computer.

Only prototyping for now.

23/27

Page 24: Wayland support in WebKit2GTK+ (GUADEC 2014)

State of the drivers

Current drivers are only partially openWayland support is presentMesa drivers are on their way

···

24/27

Page 25: Wayland support in WebKit2GTK+ (GUADEC 2014)

Alas, problems

The GtkWidget's Cairo surface draws into a shared memory buffer.

This buffer is attached to the wl_surface.

Constant redraws become inefficient.

The subsurface-based nested compositor allows to avoid queueingconstant redraws on the GtkWidget.

25/27

Page 26: Wayland support in WebKit2GTK+ (GUADEC 2014)

Alas, more problems

Hardware.

Solution - treat it as a challenge.

Support for JavaScriptCore on non-iOS ARM targets.

Single-core 700MHz ARMv6 CPU512MB RAM(No complaints with the GPU)

···

26/27

Page 27: Wayland support in WebKit2GTK+ (GUADEC 2014)

V - QuestionsThank you.

27/27