Running Android on the Mainline Graphics Stack€¦ · Mainline Atomic KMS ABI introduced ... -...

Preview:

Citation preview

Open First

Running Android on theMainline Graphics StackRobert FossSenior Software Engineer

robert.foss@collabora.com@memcpy_io

● Android History● Android on Mainline● Current Status● Big Picture

Agenda

Android History

v3.10 v3.14 v3.18 v4.4 v4.90

500000

1000000

1500000

2000000

2500000

3000000

3500000

4000000

Qualcomm diff against mainline, # lines

Android History

Android History

● Android forked the Kernel

Android History

● Android forked the Kernel– Better Graphics stack was needed

Android History

● Android forked the Kernel– Better Graphics stack was needed– Support for low power was lacking

Android History

● Android forked the Kernel– Better Graphics stack was needed– Support for low power was lacking– Support for atomic operations missing

Android History

● Android forked the Kernel● Android Atomic Display Framework created

Android History

● Android forked the Kernel● Android Atomic Display Framework created

– Not extensible or generic

Android History

● Android forked the Kernel● Android Atomic Display Framework created

– Not extensible or generic– Only atomic for plane updates

Android History

● Android forked the Kernel● Android Atomic Display Framework created

– Not extensible or generic– Only atomic for plane updates– Not compatible with current ABI

Android History

● Android forked the Kernel● Android Atomic Display Framework created

– Not extensible or generic– Only atomic for plane updates– Not compatible with current ABI– Not upstreamable

Android History

● Android forked the Kernel● Android Atomic Display Framework created● Mainline Atomic KMS ABI introduced

Android History

● Android forked the Kernel● Android Atomic Display Framework created● Mainline Atomic KMS ABI introduced

– Supports the ADF usecases

Android History

● Android forked the Kernel● Android Atomic Display Framework created● Mainline Atomic KMS ABI introduced

– Supports the ADF usecases– Uses Properties to be generic

Android History

● Android forked the Kernel● Android Atomic Display Framework created● Mainline Atomic KMS ABI introduced

– Supports the ADF usecases– Uses Properties to be generic– Is now replacing ADF in vendor drivers

Android on Mainline

Android Graphics Stack

Kernel

Vendor driver

HWC2

SurfaceFlinger

Apps

HWC2

Android Graphics Stack

Kernel

Vendor driver

HWC2

SurfaceFlinger

Apps

HWC2

Subtitle Karla regular28pt

The Really Good Stuff ™

Android Graphics Stack

Kernel

Vendor driver

HWC2

SurfaceFlinger

Apps

HWC2

Subtitle Karla regular28pt

The Really Good Stuff ™ - No really, this is the whole point!

Android Graphics Stack

Kernel

Vendor driver

HWC2

SurfaceFlinger

Apps

HWC2

Subtitle Karla regular28pt

Interface between applications and hardware

Android Graphics Stack

Kernel

Vendor driver

HWC2

SurfaceFlinger

Apps

HWC2

Subtitle Karla regular28pt

Android Graphics Stack

Kernel

Vendor driver

HWC2

SurfaceFlinger

Apps

HWC2

Subtitle Karla regular28pt

Status Bar

Android Graphics Stack

Kernel

Vendor driver

HWC2

SurfaceFlinger

Apps

HWC2

Subtitle Karla regular28pt

Na

vig

ati

on B

ar

Status Bar

Android Graphics Stack

Kernel

Vendor driver

HWC2

SurfaceFlinger

Apps

HWC2

Subtitle Karla regular28pt

Na

vig

ati

on B

ar

Status Bar

Background

Android Graphics Stack

Kernel

Vendor driver

HWC2

SurfaceFlinger

Apps

HWC2

Subtitle Karla regular28pt

SurfaceFlinger speaks HWC to the Composer

Android Graphics StackWhat does the Hardware Composer do?

Android Graphics StackWhat does the Hardware Composer do?

Get LayersThrough HWC API

Android Graphics StackWhat does the Hardware Composer do?

Get LayersThrough HWC API

 Optimize Layers forDisplay

Android Graphics StackWhat does the Hardware Composer do?

Get LayersThroughHWC API

 Optimize Layers forDisplay

OutputLayers ToDisplay HW

Android Graphics Stack

Kernel

Vendor driver

HWC2

SurfaceFlinger

Apps

HWC2

Subtitle Karla regular28pt

The non-kernel part of the graphics driver

Android Graphics Stack

Kernel

Vendor driver

HWC2

SurfaceFlinger

Apps

HWC2

Subtitle Karla regular28pt

The non-kernel part of the graphics driver - Hardware Composer

Android Graphics Stack

Kernel

Vendor driver

HWC2

SurfaceFlinger

Apps

HWC2

Subtitle Karla regular28pt

The non-kernel part of the graphics driver - Hardware Composer - OpenGL, Vulkan, memory allocator, etc.

Android Graphics Stack

Kernel

Vendor driver

HWC2

SurfaceFlinger

Apps

HWC2

Subtitle Karla regular28pt

The Linux Kernel

Mainline Graphics Stack

● Mainline now has good Graphics ABI

Mainline Graphics Stack

● Mainline now has good Graphics ABI● Google Pixel C shipped using Atomic KMS

Mainline Graphics Stack

● Mainline now has good Graphics ABI● Google Pixel C shipped using Atomic KMS

– Android requires HWC implementation

Mainline Graphics Stack

● Mainline now has good Graphics ABI● Google Pixel C shipped using Atomic KMS

– Android requires HWC implementation– Mesa and the Kernel does not implement it

Mainline Graphics Stack

● Mainline now has good Graphics ABI● Google Pixel C shipped using Atomic KMS

– Android requires HWC implementation– Mesa and the Kernel does not implement it– drm_hwcomposer does!

Mainline Graphics StackWhat is the Hardware Composer?

Kernel

Vendor driver

HWC2

SurfaceFlinger

Apps

HWC2

Mainline Graphics Stack

Proprietary}

What is the Hardware Composer?

Kernel

Vendor driver

HWC2

SurfaceFlinger

Apps

HWC2

Mainline Graphics Stack

Kernel

SurfaceFlinger

Apps

HWC2

???

What is the Hardware Composer?

Kernel

Vendor driver

HWC2

SurfaceFlinger

Apps

HWC2

Mainline Graphics StackWhat is the Hardware Composer?

Kernel

SurfaceFlinger

Apps

HWC2

drm_hwc

Kernel

Vendor driver

HWC2

SurfaceFlinger

Apps

HWC2

Driver

Mainline Graphics Stack

Kernel

SurfaceFlinger

Apps

HWC2

DRM

drm_hwc

libdrmmesa{

What is the Hardware Composer?

Kernel

Vendor driver

HWC2

SurfaceFlinger

Apps

HWC2

Kernel

SurfaceFlinger

Apps

HWC2

drm_hwc

Driver

Mainline Graphics Stack

Kernel

SurfaceFlinger

Apps

HWC2

DRM

drm_hwc

libdrmmesa {

What is the Hardware Composer?

Kernel

Vendor driver

HWC2

SurfaceFlinger

Apps

HWC2

Kernel

SurfaceFlinger

Apps

HWC2

drm_hwc

Driver

Kernel

SurfaceFlinger

Apps

HWC2

DRM

drm_hwc

mesagralloc libdrm

drm_hwcomposerWhat is HWC2?

drm_hwcomposerWhat is HWC2?

● Android added buffer Fence support

drm_hwcomposerWhat is HWC2?

● Android added buffer Fence support– Ensures ordering between operations

drm_hwcomposerWhat is HWC2?

● Android added buffer Fence support– Ensures ordering between operations– Synchronizes buffer sharing

drm_hwcomposerWhat is HWC2?

● Android added buffer Fence support● HWC version 2 is improved using Fences

drm_hwcomposerWhat is HWC2?

● Android added buffer Fence support● HWC version 2 is improved using Fences● Mainline received Fence support

drm_hwcomposerWhat is HWC2?

● Android added buffer Fence support● HWC version 2 is improved using Fences● Mainline received Fence support● drm_hwcomposer implemented HWC2

drm_hwcomposer

● Previously hosted within ChromiumOS

Project Hosting

drm_hwcomposer

● Previously hosted within ChromiumOS● Now hosted on Freedesktop.org

Project Hosting

drm_hwcomposer

● Previously hosted within ChromiumOS● Now hosted on Freedesktop.org

– Thanks Google:● Sean Paul● Puneet Kumar● Marissa Wall

Project Hosting

drm_hwcomposer

● Previously hosted within ChromiumOS● Now hosted on Freedesktop.org● Contribute at gitlab.freedesktop.org

Project Hosting

Current Status

Current statusTested platforms

Current status

● iMX6– GPU: Vivante GC3000

Tested platforms

Current status

● Dragonboard 410c– GPU: Adreno 306

Tested platforms

Current status

● HiKey 960– GPU: Mali G71

Under Development

Big Picture

Big PictureMerging Android Features

Big PictureMerging Android Features

● A new feature is introduced in Android

Big PictureMerging Android Features

● A new feature is introduced in Android● Slowly migrated into the kernel

Big PictureMerging Android Features

● A new feature is introduced in Android● Slowly migrated into the kernel● This does not to apply to all subsystems

5.00%

6.50%

3.50%

13.40%

11.90%

11.90%

3.30%

7.10%

5.40%

Qualcomm v4.9 Diff

arch/arm64/

arch/

drivers/clk/

drivers/gpu/

drivers/media/

drivers/platform/

drivers/power/

drivers/soc/qcom/

include/

Big PictureMerging Android Features

Big PictureMerging Android Features

● A new feature is introduced in Android● Slowly migrated into the kernel● This does not to apply to all subsystems● The diff size for drivers seem fairly constant

v3.10 v3.14 v3.18 v4.4 v4.90

500000

1000000

1500000

2000000

2500000

3000000

3500000

4000000

Qualcomm diff against mainline, # lines

Big PictureMerging Android Features

Big PicturePush industry towards Open Source

Big PicturePush industry towards Open Source

● Increase device development speed

Big PicturePush industry towards Open Source

● Increase device development speed● Lower driver development costs

Big PicturePush industry towards Open Source

● Increase device development speed● Lower driver development costs● Increase driver quality

Big PicturePush industry towards Open Source

● Increase device development speed● Lower driver development costs● Increase driver quality● Push Open Source adoption forward

Thank you!@memcpy_io

Recommended