What is this?
DRM is the Direct Rendering kernel module, the operating system part necessary for the Direct Rendering Interface, which is used to render OpenGL under the X Window System. If you want accelerated graphics, e.g. to play games, this is what you're looking for.
Status of the driver
Warning: the FreeBSD code presented here is lacking proper
physaddr support! Use the version provided with FreeBSD 5.4 and later!
Current state is that the driver seems to work well when used as a loadable
kernel module. If you want to build it in, it clashes with the vga driver
which claims the same device, and thus VGA wins. You could of course disable
the VGA driver, but NetBSD relies on wscons to get the graphics, so you will
need a driver that provides it, and will thus claim our device.
The solution I'm following right now is to port radeonfb and friends so we
simply export a framebuffer device to wscons which we have under our
control, which might even help us with further deinitialization problems.
If you want a quick working solution, simply port the vga driver.
Technical details about changes
Apart from OS specific changes in the way the code is done, there were
two major changes: the first one is that the matching code now passes
bus specific information to the initialization functions so it can be
used to determine some values like memory addresses, vendor ID etc.
that wouldn't be easy to determine otherwise.
The other big change is the DMA code. DRM previously used the contigmalloc
hack to allocate memory for DMA. This does work on x86, but it's not
portable. While most people probably won't use DRM on other architectures,
NetBSD has no support for contigmalloc because people abused it for that
exact purpose so it got removed to force people to use busdma. Thus, I
simply converted the only two cases: the ATI GART initialization/cleanup
code and the PCI DMA buffer allocation. The latter required a change in
the API, DRM(pci_alloc) now returns a DMA handle rather than the virtual
address of the allocated object.
What's left to do
- Port the framebuffer drivers from Linux so we can export a device to wscons
Download
In order to use the Direct Rendering Interface, you will have to enable it in your X.Org build. It is not enabled by default! If you're using X.Org from pkgsrc, there is a patch that adds DRI support for X.Org 6.8.2 on NetBSD available on this website.
Patch against NetBSD 3.99.3
(bzip2 compressed, version 0.2)
GPG signature
MD5 sum
SHA1 sum
RipeMD160 sum
Old patch against
NetBSD 2.0.2 (bzip2 compressed)
GPG
signature
MD5 sum
SHA1
sum
RipeMD160
sum
WARNING: some people got this wrong. DO NOT USE THIS PATCH ANYMORE FOR
YOUR PRODUCTION SYSTEMS! It's old and outdated and the only reason why
it's still here is merely documentatory. As the name of the patch says,
it is PRELIMINARY!
Patch against current
FreeBSD DRM
GPG signature
MD5 sum
SHA1 sum
RipeMD160 sum
WARNING: don't use this patch either, it's just for people that
want to know how my version differs from the DRM version you get in the
wild, plus it's outdated too,
Eric Anholt
has a way better patch in the meanwhile.