drm/kms, fb and v4l2: how to select a graphics and video api · how to select a graphics and video...

47
DRM/KMS, FB and V4L2: How to Select a Graphics and Video API Embedded Linux Conference Europe 2012 Laurent Pinchart [email protected]

Upload: others

Post on 15-Jun-2020

33 views

Category:

Documents


0 download

TRANSCRIPT

DRM/KMS, FB and V4L2:How to Select a Graphics and

Video API

Embedded Linux Conference Europe 2012

Laurent [email protected]

Disclaimer

Personal opinion

Flame war possibleHandle with care

Problem Definition

Problem Definition

Problem - Purpose

display / graphics / video

Problem - Source

formatmemory / deep pipeline

device / CPU

Problem - Processing

rotationscaling

composing

Problem - Stack

X11WaylandDirectFBRaw API

Problem - API

DRMFBDEVV4L2

Origins

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

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 – FBDEV

FBDEV, L

inux 1

.3.9

4

1996 2012

4CC F

orm

ats

2000

Blankin

g

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

v2.6.12v2.6.14

v2.6.16v2.6.18

v2.6.20v2.6.22

v2.6.24v2.6.26

v2.6.28v2.6.30

v2.6.32v2.6.34

v2.6.36v2.6.38

v3.0v3.2

v3.4v3.6-rc3

0

500

1000

1500

2000

2500

3000

3500

4000

drm

fb

v4l2

drmfbv4l2

Cumulative Changes - Core

v2.6.12v2.6.14

v2.6.16v2.6.18

v2.6.20v2.6.22

v2.6.24v2.6.26

v2.6.28v2.6.30

v2.6.32v2.6.34

v2.6.36v2.6.38

v3.0v3.2

v3.4v3.6-rc3

0

5000

10000

15000

20000

25000

30000

35000

40000

45000

drm

fb

v4l2

drmfbv4l2

Cumulative Changes - Drivers

v2.6.12v2.6.14

v2.6.16v2.6.18

v2.6.20v2.6.22

v2.6.24v2.6.26

v2.6.28v2.6.30

v2.6.32v2.6.34

v2.6.36v2.6.38

v3.0v3.2

v3.4v3.6-rc3

0

100000

200000

300000

400000

500000

600000

700000

800000

900000

1000000

drm

fb

v4l2

drmfbv4l2

Mailing List Traffic

2009-112010-01

2010-032010-05

2010-072010-09

2010-112011-01

2011-032011-05

2011-072011-09

2011-112012-01

2012-032012-05

2012-07

0

200

400

600

800

1000

1200

1400

1600

drmfbv4l2drm+bug

Device Model – FBDEV

Frame Buffer(memory)

DisplayDevice

Device Model – DRM/KMS

Frame Buffer(memory) CRTC Encoder Connector

Plane(memory)

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

FB vs. DRM - sloccount

fbdev0

500

1000

1500

2000

2500

2370

FB vs. DRM - sloccount

fbdev drm0

500

1000

1500

2000

2500

2370

1659

Use Cases - FBDEV

Use Cases - FBDEV

(that's it...)

Use Cases - V4L2

Video

Use Cases – DRM/KMS

Everything else

KMS – Device Model

Frame Buffer(memory) CRTC Encoder Connector

Plane(memory)

SoCMemory Off-Chip

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

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

Work In Progress

panel & backlighthttp://lwn.net/Articles/512363/

WIP – Display Framework

DPI/LVDSDISPC PanelDSI/LVDS

Panel Module

PanelController

Transmitter

? !

thx.