Linux Graphics Drivers: an Introduction

Linux Graphics Drivers: an Introduction

Version 3

St?phane Marchesin

March 15, 2012

2

Contents

1 Introduction

7

1.1 Book overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

1.2 What this book does not cover . . . . . . . . . . . . . . . . . . . . . . . . . 8

2 A Look at the Hardware

9

2.1 Hardware Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

2.2 Bus types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

2.3 Virtual and Physical Memory . . . . . . . . . . . . . . . . . . . . . . . . . 12

2.4 Anatomy of a Graphics Card . . . . . . . . . . . . . . . . . . . . . . . . . 15

2.5 Programming the card . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

2.6 Graphics Hardware Examples . . . . . . . . . . . . . . . . . . . . . . . . . 21

2.6.1 Forward renderers . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

2.6.2 Deferred Renderers . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

3 The Big Picture

25

3.1 The X11 infrastructure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

3.2 The DRI/DRM infrastructure . . . . . . . . . . . . . . . . . . . . . . . . . 26

4 Framebuffer Drivers

31

4.1 Creating a framebuffer driver . . . . . . . . . . . . . . . . . . . . . . . . . 31

4.2 Framebuffer operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

3

CONTENTS

5 The Direct Rendering Manager

35

5.1 DRM batch buffer submission model . . . . . . . . . . . . . . . . . . . . . 36

5.1.1 Hardware sharing . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

5.1.2 Memory management and security . . . . . . . . . . . . . . . . . 37

5.2 Modesetting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

5.3 libdrm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

6 Drivers

39

6.1 Creating a basic driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

6.2 ShadowFB acceleration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

6.3 XAA acceleration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

6.4 EXA acceleration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

7 Video Decoding

45

7.1 Video Standards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

7.2 Video decoding pipeline . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

7.2.1 Entropy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

7.2.2 Inverse DCT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46

7.2.3 Motion Compensation . . . . . . . . . . . . . . . . . . . . . . . . . 46

7.2.4 Color Space Conversion . . . . . . . . . . . . . . . . . . . . . . . . 46

7.3 Video decoding APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

8 OpenGL

51

8.1 The OpenGL Rendering Pipeline . . . . . . . . . . . . . . . . . . . . . . . 51

8.1.1 Vertex processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51

8.1.2 Geometry processing . . . . . . . . . . . . . . . . . . . . . . . . . . 51

8.1.3 Fragment processing . . . . . . . . . . . . . . . . . . . . . . . . . . 51

9 Mesa

53

9.1 Mesa . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

9.2 Mesa internals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

9.2.1 Textures in mesa . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

4

CONTENTS

10 Gallium 3D

55

10.1 Gallium3D: a plan for a new generation of hardware . . . . . . . . . . . . 55

10.2 State trackers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

10.3 Pipe driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

10.4 Winsys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

10.5 Vertex submission . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

10.6 Writing Gallium3D drivers . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

10.7 Shaders in Gallium . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

11 GPU Computing

59

12 Suspend and Resume

61

13 Technical Specifications

63

13.1 Obtaining official specifications . . . . . . . . . . . . . . . . . . . . . . . . 63

13.2 Reverse engineering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

14 Beyond Development

67

14.1 Testing for conformance . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67

14.2 Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67

14.3 Upstreaming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68

15 Conclusions

69

5

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download