Unmasking the GPU

Using Hardware Acceleration Correctly with CSS

@divya • Product Manager, Adobe

nimbu.in/html5devconf-oct/

Web Platform Team

html.adobe.com/webplatform

Mandate

Make the web awesome

(makethewebawesome.com)

Features we work on

My team has more than a passing knowledge of

Graphical Processing Unit (GPU)

Agenda Today

Change our understanding of browsers.

From

to

Paint the Pixels

How do the pixels render?

Layout/Reflow

Calculation of information required to display visible DOM nodes.

When does it happen?

Style changes

Fetching of layout values/scroll values.

Adding/removing elements

How to minimize Layout?

Move content away from the flow.

Use only on the element with least children.

Apply layout changes on requestAnimationFrame

requestAnimationFrame

60fps

Rendering without the lumpy bits

new frame every 16.67ms

setInterval, setTimeout Drops frames if not synched to Browser refresh rate

Batch reading/writing layout values

Demo - Fixed

Paints

Browser changes the pixel values of an area of the viewport

Two kinds of painting

When does it happen?

Typical Painting Experience

Stacking contexts create RenderLayer Objects

Traditional Stacking Contexts

Create Render Layers

Each Stacking context creates a Render Layer

CPU paints to ONE Bitmap

What happens to painting when GPU is involved?

New Stacking Contexts

How does the browser decide which bitmaps are painted by GPU?

How can you find out how many GPU-renderd bitmaps?

Demo

GPU!!

Like CPU but optimized for processing large blocks of data in parallel.

Flicker happens

GPU reduces burden on CPU, but

Memory

Reduce Memory Usage

Reduce CPU/GPU Communication

Animate only

Demo

Others

Why Opacity?

In Summary

Thanks!

Special thanks to the team @adobeweb for all these insights.

Use a spacebar or arrow keys to navigate