Kernel Recipes 2013 - Overview display in the Linux kernel

Post on 10-May-2015

1,365 views 9 download

Tags:

description

The Linux kernel has adapted in recent years to cope with the arrival of the embedded platforms using more and more advanced graphics capabilities. This presentation will explore the past challenges, but also the present and future, focusing on the current situation, the problems we face and the solutions that are currently proposed and considered.

transcript

Display and KernelReview and Future

Kernel Recipes 2013Paris

Laurent Pinchartlaurent.pinchart@ideasonboard.com

Problem Definition

display /

/ graphics /

/ video

Problem - Purpose

display / graphics / video

format

memory / deep pipeline

device / CPU

Problem - Source

formatmemory / deep pipeline

device / CPU

rotation /

/ scaling /

/ composing

Problem - Processing

rotationscaling

composing

X11 /

/ Wayland /

/ MIR /

/ SDL /

/ DirectFB /

/ Raw API

Problem - Stack

X11Wayland

SDLDirectFBRaw API

DRM /

/ FBDEV /

/ V4L2

Problem - API

DRMFBDEVV4L2

Display – Scanout

Frame Buffer

Display – Composition

CRTC

Plane(s)

Composition

Origins

Origins – FBDEV

FBDEV, L

inux 1

.3.9

4

1996 2012

4CC F

orm

ats

2000

Blankin

g

Origins – V4L2

V4L, L

inux 2

.2.0

1999 2002 2006

V4L2,

Linu

x 2.4

.0

V4L d

epre

cate

d

2008

V4L2

subd

ev

2011

Med

ia co

ntro

ller

video

buf2

2012

DMABUF

Origins – DRM/KMS

2000

DRM, L

inux 2

.2.1

8

2009

KMS, T

TM

2008

GEMPlan

es, D

MABUF

2011 2012

Dumb

Buffe

rs

Features

Memory Management

DRM FB V4L2

Dynamic Allocation Yes No Yes

Multiple Buffers Yes panning Yes

Import dmabuf No userptr

Exportdmabufmmap

mmap mmap

Mode Setting

DRM FB V4L2

Formats 4CCRGB4CC

4CC

Enumeration Planes No Yes

Negotiation No No Yes

Atomicity Yes No No

Transformations

DRM FB V4L2

Overlays Yes No Yes

Rotation Yes No Yes

Scaling Yes No Yes

Cropping/Panning Yes Yes Yes

Documentation

api core drivers

drmfbv4l2

DRM API Documentation

The DRM core exports several interfaces to applications, generally intended to be used through corresponding libdrm wrapper functions. In addition, drivers export device-specific interfaces for use by userspace drivers & device-aware applications through ioctls and sysfs files.

External interfaces include: memory mapping, context management, DMA operations, AGP management, vblank control, fence management, memory management, and output management.

Cover generic ioctls and sysfs layout here. We only need high-level info, since man pages should cover the rest.

Documentation

api core drivers

drmfbv4l2

Code Size

api core drivers

drmfbv4l2

Cumulative Changes - API

0

1000

2000

3000

4000

5000

6000

drm

fb

v4l2

drmfbv4l2

Cumulative Changes - Core

0

5000

10000

15000

20000

25000

30000

35000

40000

45000

50000

drm

fb

v4l2

drmfbv4l2

Cumulative Changes - Drivers

0

200000

400000

600000

800000

1000000

1200000

1400000

1600000

1800000

drm

fb

v4l2

drmfbv4l2

Mailing List Traffic

0

200

400

600

800

1000

1200

1400

1600

1800

drmfbv4l2drm+bug

Device Model – FBDEV

Frame Buffer(memory)

DisplayDevice

Device Model – DRM/KMS

Frame Buffer(memory) CRTC Encoder Connector

Planes(memory)

Encoder

Connector

Connector

Device Model – V4L2

Buffers(memory)

DisplayDevice

Connector

Device Model – V4L2/MC

V4L2subdev

0

1

2V4L2

subdev0 1

V4L2queue

0

Device Model – V4L2/MC

Use Cases

Use Cases - FBDEV

Use Cases - FBDEV

(that's it...)

Use Cases - V4L2

Video

Use Cases – DRM/KMS

Everything else

FB vs. DRM - sloccount

fbdev0

500

1000

1500

2000

2500

2370

FB vs. DRM - sloccount

fbdev drm0

500

1000

1500

2000

2500

2370

1659

DRM/KMS API

drmkmsexynosi810i915mganouveaur128radeonsavagesisvia

KMS - Device Model

Frame Buffer(memory) CRTC Encoder Connector

Plane(memory)

SoCMemory Off-Chip

Encoder Connector

KMS – Frame Buffer

CRTC

Frame Buffer

GEMObject(s)

Memory

● width● height● format● pitches● offsets

Properties

DRM/KMS – GEM Object

CRTC

Frame Buffer

GEM Object

● width● height● bpp● pitch● size

Properties

Memory

DRM – Handles

Process A

LocalHandle

GEMObject

Process B

Send FDSCM_RIGHTS

GlobalFD

1 2Global

FD4

LocalHandle

3

ActiveArea

KMS – Modes (1/2)

sync

back porch

front porch

active area

ActiveArea

KMS – Modes (2/2)

sync

back porch

front porch

active area

hdisplayhsync_start

htotal

hsync_end

KMS – Mode Setting

crtc

fb

ActiveArea

x

y

mode.hdisplay

mo

de

. vdisp

l ay

*connectorsnum_connectors

mode

struct drm_mode_set { struct drm_framebuffer *fb; struct drm_crtc *crtc; struct drm_display_mode *mode; uint32_t x; uint32_t y; struct drm_connector **connectors; size_t num_connectors;};

Source: http://www.flickr.com/photos/buckaroobay/3721809183/

WIP – Display Framework

Common Display Framework

http://lwn.net/Articles/512363/

Entity

Entity

Link Port

CDF - Entity Model

CDF - Device Tree

hdmi_encoder { ports { #address-cells = <1>; #size-cells = <0>;

port@0 { hdmi_input: endpoint@0 { remote = <&display_output>; }; }; port@1 { endpoint@0 { ... }; endpoint@1 { ... }; }; };};

Display Controller

VideoEntity

Pipeline Controller

controlcontrol

Entity Entity

CDF - Configuration Model

Display Controller

VideoEntity

streaming control

streaming control

Entity Entity

CDF - Streaming Control

CDF - Integration

DisplayController

DriverControl Bus API

FBDEV DRM

SPI/I2C Mem Map

Panel Driver

DT

pdata

DSI

• dri-devel@listsfreedesktop.org• linux-fbdev@vger.kernel.org• linux-media@vger.kernel.org

• laurent.pinchart@ideasonboard.com

Contact

? !

merci.