running android graphics stack - fosdem · – not compatible with current abi. ... - opengl,...

Post on 17-Aug-2020

12 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Running Android on the Mainline Graphics Stack

Robert Foss

@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 with 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

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

Navig

ati

on

Bar

Status Bar

Android Graphics Stack

Kernel

Vendor driver

HWC2

SurfaceFlinger

Apps

HWC2

Subtitle Karla regular28pt

Navig

ati

on

Bar

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 for

Display

Android Graphics StackWhat does the Hardware Composer do?

Get LayersThroughHWC API

Optimize Layers for

Display

OutputLayers To

Display 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 - OpenGL, Vulkan, memory allocator, etc.

Android Graphics Stack

Kernel

Vendor driver

HWC2

SurfaceFlinger

Apps

HWC2

Subtitle Karla regular28pt

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

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_hwcomposerHWC2

drm_hwcomposerHWC2

● Android added bufer Fence support

drm_hwcomposerHWC2

● Android added bufer Fence support– Ensures ordering between operations

drm_hwcomposerHWC2

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

drm_hwcomposerHWC2

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

drm_hwcomposerHWC2

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

drm_hwcomposerHWC2

● Android added bufer 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● GitLab instance on Freedesktop.org soon!

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 PictureMerge Android Features

Big PictureMerge Android Features

● A new feature is introduced in Android

Big PictureMerge Android Features

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

Big PictureMerge 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 PictureMerge Android Features

Big PictureMerge Android Features

● A new feature is introduced in Android● Slowly migrated into the kernel● This does not to apply to all subsystems● The dif 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 with mainline, # lines

Big PictureMerge 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

Running Android on the Mainline Graphics Stack

Any questions?

top related