question about the /drivers/gpu/drm/radeon/ and xf86-video-ati-7.1.0
I want to understand how the open-source radeon drivers work under linux. Unfortunately, there is not much documentation about them. So, I resorted to reading the source code.
I managed to locate two different chunks of radeon-related source code:
1) The code under the directory /drivers/gpu/drm/radeon/ in linux source tree.
2) The source code in xf86-video-ati-7.1.0, downloadable from internet.
My question is: what is the relation and the difference between these two different sources? Which one is lower level? Which one calls the other?
The radeon graphics stack includes a number of components. The first link is the kernel driver, while the second is the X driver. I'm not 100% sure, but I believe the X driver still talks to the kernel driver via "libdrm", which is basically the userspace interface to the kernel driver :
You also need the Gallium3D drivers in mesa (basically the hardware layer for the 3D or GL driver) :
drivers/r300, drivers/r600 and drivers/radeonsi are the "pipe" drivers aka the HW drivers for the graphics pipeline. r300 covers 3xx-5xx, r600 covers 6xx through NI, while radeonsi covers SI and above.
winsys/radeon is the "OS interface" or "windowing system interface", ie the interface for things like memory management and command submission. It talks to the kernel driver. Note that winsys code could potentially go through libdrm (see above) to get to the kernel driver but my understanding is that it contains some newer code than libdrm and goes directly to the kernel driver.
So... something like :
2D path : ati X driver => radeon libdrm => radeon kernel driver
3D direct rendering path : GL driver common (in mesa/mesa) => r600 (for example) pipe driver => radeon winsys => radeon kernel driver
(indirect rendering would work the same way except the application talks to the GL driver via the X protocol and X server rather than having the application call the GL driver directly)
not exactly what I was looking for.
The info was great, but not exactly what I was looking for. I'd rather liked to know what was the difference between
--the code located in the files located in xf86-video-ati-7.1.0
--the code located in the linux source directory drivers/gpu/drm/radeon
My guess is that the real drm driver is in drivers/gpu/drm/radeon, and xf86-video-ati-7.1.0 is for 2D acceleration only. But the code in xf86-video-ati-7.1.0 is so sparsely commented that there is no way to know what it does..
I think my best tack is to just read drivers/gpu/drm/radeon.
xf86-video-ati ==> ati X driver from Bridgman explanation.
Originally Posted by sourcecodereader
And it do what ever X.org need from GPU. X.org talk with actual GPU only by xf86-video-ati (it can also talk by xf86-vesa but its very old mode and very limited, still there for cases when nothing else do not work).
Buffers management, painting on screen, displaying video, anything else X.org do will int the end go via xf86-video-ati. Which can accelerate it on GPU, or can do all operations on CPU and then only send bitmaps ready to display on the screen to the GPU.
Something like this :
Note the drawing is simplified a bit, particularly on the mesa/pipe/winsys side.
The core "open source radeon drivers" include the X driver, libdrm code, the kernel driver, pipe and winsys drivers, along with additional code for things like OpenCL and UVD acceleration support.
Last edited by bridgman; 04-13-2013 at 12:43 PM.
Thanks a lot to everyone who replied. Things are a bit more understandable now, especially after bridgman's diagram.
If I manage to understand the source, I plan to write an exposition of linux graphics stack.