Hardware Acceleration in WebKit

26
Hardware Acceleration in WebKit 허준회 (Joone Hur) 2011. 12/16

description

How accelerated compositing works in WebKit. Introduction to WebKit-Clutter

Transcript of Hardware Acceleration in WebKit

Page 1: Hardware Acceleration in WebKit

Hardware Acceleration in WebKit

허준회 (Joone Hur)

2011. 12/16

Page 2: Hardware Acceleration in WebKit

about me

• 허준회 Joone Hur ([email protected], @joone) • WebKit Committer• Working on WebKitGtk+, webkit-clutter

http://collabora.com

Page 3: Hardware Acceleration in WebKit

Contents

• Accelerating Browsing• Video Acceleration• 2D Acceleration• Accelerated Compositing• WebKit-Clutter• Demo

Page 4: Hardware Acceleration in WebKit

Accelerating Browsing

• Off-screen buffer (Backing Store)• JavaScript engine with JIT (Just-in-Time)

compilation• Graphics Acceleration

Page 5: Hardware Acceleration in WebKit

Graphics Acceleration?

• Reducing memory copy• Rendering by GPU instead of CPU

o alpha blendingo matrix transformso color space conversion

Page 6: Hardware Acceleration in WebKit

Graphics Acceleration in WebKit

Page 7: Hardware Acceleration in WebKit

Video Acceleration

video stream => main memory => video memory (CPU) (CPU)

video stream => decoder (or GPU) => video memory (DMA)

Page 8: Hardware Acceleration in WebKit

iPad plays only one video due to hardware acceleration

http://shapeshed.com/examples/HTML5-video-element/

Page 9: Hardware Acceleration in WebKit

2D Acceleration in WebKit

• GPU accelerated 2D canvaso https://bugs.webkit.org/show_bug.cgi?id=43210

• Can be tested in Chrome browsero about:flags => Enable "GPU Accelerated Canvas 2D"

Page 10: Hardware Acceleration in WebKit

How 2D acceleration works

Page 11: Hardware Acceleration in WebKit

Major steps in HTML page rendering in IE9

http://blogs.msdn.com/b/ie/archive/2010/09/10/the-architecture-of-full-hardware-acceleration-of-all-web-page-content.aspx

Page 12: Hardware Acceleration in WebKit

Tree structures in WebCore

• Document Treeo DOM Tree, Shadow DOM Tree

• Render Treeo RenderObject Treeo RenderStyle Treeo RenderLayer Treeo GraphicsLayer Treeo LineBox Tree

Page 13: Hardware Acceleration in WebKit

RenderLayer Tree

A RenderLayer is created if: It's the root object for the page (RenderView)  It has explicit CSS position properties (relative, absolute, fixed)  It has CSS3 transforms property It is transparent (CSS opacity)  It has overflow, an alpha mask or reflection Corresponds to <canvas> element that has a 3D (WebGL) context Corresponds to a <video> element

Page 14: Hardware Acceleration in WebKit

How it works

Page 15: Hardware Acceleration in WebKit

Accelerated CSS3 with AC

• CSS3 3D transforms• CSS3 Transitions• CSS3 Animations

• HTML5 Video

Page 16: Hardware Acceleration in WebKit

Enabling AC in Chrome => about:flags

Page 17: Hardware Acceleration in WebKit

WebKit-Clutter

Page 18: Hardware Acceleration in WebKit

Webkit-Clutter

• A WebKit port based on Clutter• The same APIs as WebKitGTK+• Allows clutter applications to embed a webview

Page 19: Hardware Acceleration in WebKit

Why Webkit-Clutter

• Embedding applications can animate webviews• It allows a web page to scroll faster and animations to run

smoothly with GPU acceleration

Page 20: Hardware Acceleration in WebKit

Accelerating Compositing in WebKit-Clutter

Page 21: Hardware Acceleration in WebKit

How to implement AC using Clutter

CSS3 3D Transforms : ClutterActor, ClutterStage, CoglCSS3 Transitions: ClutterStateCSS3 Animations: ClutterAnimator

Page 22: Hardware Acceleration in WebKit

Demo

• http://www.webkit.org/blog-files/3d-transforms/morphing-cubes.html

• http://www.webkit.org/blog-files/3d-transforms/poster-circle.html

• http://www.paulrhayes.com/experiments/cube/multiCubes.html

Page 23: Hardware Acceleration in WebKit

Where do I get it?

https://gitorious.org/webkit-clutter

Accelerated Compositing Branchhttps://gitorious.org/webkit-clutter/webkit-clutter/commits/ac2

Build instructions here:

http://trac.webkit.org/wiki/clutter

Page 24: Hardware Acceleration in WebKit

Hacking Accelerated Compositing in WebKit• ~/git/WebKit/Source/WebCore/platform/graphics

o cao chromiumo cluttero eflo qto textmap

Page 25: Hardware Acceleration in WebKit

Etc

• Use OpenCL to HW accelerate SVG and CSS Filters

Page 26: Hardware Acceleration in WebKit

References

• Rendering in WebKit, http://www.youtube.com/watch?v=RVnARGhhs9w

• The Architecture of Full Hardware Acceleration of All Web Page Content, http://blogs.msdn.com/b/ie/archive/2010/09/10/the-architecture-of-full-hardware-acceleration-of-all-web-page-content.aspx

• http://www.webkit.org/blog/386/3d-transforms/• https://sites.google.com/a/chromium.org/dev/developers/des

ign-documents/gpu-accelerated-compositing-in-chrome