Transcription of Linux Graphics Drivers: an Introduction
1 Linux Graphics Drivers: an IntroductionVersion 3St phane 15, 20122 Contents1 overview .. this book does not cover ..82 A Look at the Overview .. types .. and Physical Memory .. of a Graphics Card .. the card .. Hardware Examples .. renderers .. Renderers ..223 The Big X11 infrastructure .. DRI/DRM infrastructure ..264 Framebuffer a framebuffer driver .. operations ..323 CONTENTS5 The Direct Rendering batch buffer submission model .. sharing .. management and security.
2 386 a basic driver .. acceleration .. acceleration .. acceleration ..417 Video Standards .. decoding pipeline .. DCT .. Compensation .. Space Conversion .. decoding APIs ..498 OpenGL Rendering Pipeline .. processing .. processing .. processing ..519 .. internals .. in mesa ..534 CONTENTS10 Gallium Gallium3D: a plan for a new generation of hardware .. State trackers .. Pipe driver .. Winsys .. Vertex submission .. Writing Gallium3D drivers .. Shaders in Gallium.
3 5611 GPU Computing5912 Suspend and Resume6113 Technical Obtaining official specifications .. Reverse engineering ..6414 Beyond Testing for conformance .. Debugging .. Upstreaming ..6815 Conclusions695 CONTENTS6 Chapter1 IntroductionAccelerating Graphics is a complex art which suffers a mostly unjustified reputationof being voodoo magic. This book is intended as an Introduction to the inner work-ings and development of Graphics drivers under Linux . Throughout this whole book,knowledge of C programming is expected, along with some familiarity with graphicsprocessors.
4 Although its primary audience is the Graphics driver developer, this bookdetails the internals of the full Linux Graphics stack and therefore can also be usefulto application developers seeking to enhance their vision of the Linux Graphics world:one can hope to improve the performance of one s applications through better under-standing the Linux Graphics stack. In this day and age of pervasive 3D Graphics andGPU computing, a better comprehension of Graphics is a must have! Book overviewThe book starts with an Introduction of relevant hardware concepts (Chapter 2).
5 Onlyconcepts directly relevant to the Graphics driver business are presented there. Then wepaint a high-level view of the Linux Graphics stack in Chapter 3 and its evolution overthe years. Chapter 4 introduces framebuffer drivers, a basic form of Graphics driversunder Linux that, although primitive, sees wide usage in the embedded space. Chap-ter 5 introduces the Direct Rendering Manager (or DRM), a kernel module which is incharge of arbitrating all Graphics activity going on in a Linux system. The next chap-ter (Chapter 6) focuses on drivers and the existing acceleration APIs availableto the developper.
6 Video decoding sees its own dedicated part in Chapter 7. We thenmove on to 3D acceleration with Chapter 8 where we introduce the basic concepts ofOpenGL. Chapter 9 and 10 are dedicated to Mesa and Gallium 3D, the two founda-tions of 3D Graphics acceleration under Linux used as the framework for 3D 11 tackles an emerging field, GPU computing. Next, we discuss suspend andresume in Chapter 12. We then discuss two side issues with Linux Graphics Drivers: technical specifications in Chapter 13 and what you should do aside pure developmentin Chapter 14.
7 Finally, we conclude in Chapter chapter finishes with the takeaways , a number of relevant points that we madeduring said What this book does not coverComputer Graphics move at a fast pace, and this book is not about the past. Obsoletehardware (isa, vlb, ..), old standards (the vga standard and its dreadful int10, vesa),outdated techniques (user space modesetting) and old X11 servers (Xsun, XFree86, ) will not be Look at the HardwareBefore diving any further into the subject of Graphics drivers, we need to understandthe graphcs hardware.
8 This chapter is by no means intended to be a complete descrip-tion of all the inner workings of your average computer and its Graphics hardware, butonly as an Introduction thereof. The goal of this section is just to cover the bases onthe knowledge we will require later on. Notably, most hardware concepts that will sub-sequently be needed are introduced here. Although we sometimes have to go througharchitecture-specific hoops, we try to stay as generic as possible and the concepts de-tailed thereafter should generalize Hardware OverviewToday all computers are architectured the same way: a central processor and a numberof peripherals.
9 In order to exchange data, these peripherals are interconnected by a busover which all communications go. Figure outlines the layout of peripherals in astandard first user of the bus is the CPU. The CPU uses the bus to access system mem-ory and other peripherals. However, the CPU is not the only one able to write andCPUS ystemMemoryGraphicsCardNetworkCard BusFigure : Peripheral interconnection in a typical A Look at the Hardwareread data to the peripherals, the peripherals themselves also have the capability to ex-change information directly.
10 In particular, a peripheral which has the ability to readand write to memory without the CPU intervention is said to be DMA (Direct Mem-ory Access) capable, and the memory transaction is usually called a DMA. This typeof transaction is interesting, because it allows the driver to use the GPU instead of theCPU to do memory transfers. Since the CPU doesn t need to actively work any moreto achieve those transfers, and since it allows better asynchronicity between the CPUand the GPU, better performance can be attained. Common uses of DMA include im-proving the performance of texture uploads or streaming video.