Notes for porting DRI to Solaris
DRI stands for "Direct Rendering Infrastructure" for xfree86.
It allows all the supposedly portable 3d hardware acceleration
modules to talk to the actual hardware.
Official home page for DRI is at
http://dri.sourceforge.net/
A conceptual discussion of DRI is at
http://www.precisioninsight.com/dr/drill.html
Trouble is, you need a very non-portable driver written specifically for
your OS, to have this work. Linux has one. BSD has one. Solaris does not.
I may never have the time, or patience, to write a DRI kernel module for
solaris. But here
are some public notes for anyone thinking about doing the project. These
are things I'm writing down as I'm looking at the code. I do not have any
special "inside" knowlege - I did not work on either of the two working
drivers
Top-level directory
All filenames and directories referenced on this page assume that you are
sitting in the directory
xc/programs/Xserver/hw/xfree86/os-support/
You get this directory by extracting X410src-1.tgz from xfree86.org (or
whatever filename is the current "archive 1 of 3" when you read this)
Interesting files and directories
- xf86drm.h
-
This file is what the user-level library looks at. Eventually,
you must use everything in this file.
- linux/drm/xf86drm.c
-
This file is actually the USER-SIDE library.
You must implement the corresponding driver side to everything in
this file. There are card-specific extras in the same directory
that also must eventually be made happy.
Specific cards may require specific extra ioctl support at
driver level.
- bsd/drm/
-
This directory is a cheat. It SOFT-LINKS all the files in
linux/drm/
, and compiles them for bsd.
- linux/drm/kernel/
-
Finally, the actual kernel driver routines. You should really
look at the BSD drivers more, but there are
critical include files in this directory. Most importantly,
"drm.h"
- bsd/drm/kernel/ (and subdirectories)
-
Here is the actual BSD driver source, fairly nicely organized.
There are two gotchas:
- It softlinks all the .h files from the linux kernel dir, as
noted above
- There are no .c files here. The generic non-card-specific code
is in the drm subdirectory. The generic code currently
comprises 5000 lines of C code.
500 lines of that is non-needed "/proc" support, and another
500 lines is the BSD/xfree license preamble.
Functionality categories
There are a few conceptual areas of functionality that a DRI driver has to
support:
- Allowing memory mapping of device memory
- Allowing mapping of registers (not really treated separately from
device memory, I think)
- Handling DMA mapping and use (which means handling interrupts as
well). It is claimed that if memory mapping is used, DMA is
not required.
- AGP bus manipulation, if required
Dec 26, 2001: I have just released a prototype for a /dev/agpgart driver.
See my AGP driver section, on the main driver page.
There are other misc. little details, like access control to the device,
but I think for the first round, those should be unneccessary.
Thats what I have so far. I'll add more, as I discover more. Or hopefully,
someone else will :-)
Written by:Philip Brown
Visit the top level Solaris pages
at bolthole.com.
Visit the driver pages
Or Search Bolthole.com