Subject: Re: DRM... what's needed?
To: Juan RP <juan@xtrarom.org>
From: Michael Lorenz <macallan@netbsd.org>
List: tech-x11
Date: 03/22/2007 11:41:17
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

On Mar 21, 2007, at 14:17, Juan RP wrote:

> Hi, I have built a kernel with DRM support for my i945 chip.
>
> But xorg reports:
>
> drmOpenDevice: node name is /dev/dri/card0
> drmOpenDevice: open result is 9, (OK)
> drmOpenDevice: node name is /dev/dri/card0
> drmOpenDevice: open result is 9, (OK)
> drmOpenByBusid: Searching for BusID pci:0000:00:02.0
> drmOpenDevice: node name is /dev/dri/card0
> drmOpenDevice: open result is 9, (OK)
> drmOpenByBusid: drmOpenMinor returns 9
> drmOpenByBusid: drmGetBusid reports pci:0000:00:02.0
> (II) I810(0): [drm] DRM interface version 1.2
> (II) I810(0): [drm] created "i915" driver at busid "pci:0000:00:02.0"
> (II) I810(0): [drm] added 8192 byte SAREA at 0xffff800002956000
> (II) I810(0): [drm] drmMap failed
> (EE) I810(0): [dri] DRIScreenInit failed. Disabling DRI.

Smells like amd64.
I think we need to rewrite the memory management and mapping code. It 
makes a whole bunch of assumptions that are really only true on i386 ( 
and probably not even there )
So, in no particular order:
- - get rid of vtophys(), atop() and so on in *mmap(), that's very un-MI
- - use bus_dmamem_alloc() and friends to allocate DMA-happy memory 
instead of malloc()
   and vtophys()
- - do not assume that physical address == bus address - I think everyone 
can name at least
   two platforms where that's not true but where we'll want to have 3D 
graphics
I think for each DMA segment we need to store the kernel virtual 
address ( not sure if we always need that though ), something to hand 
to *mmap() and the bus address, bus_dma*() provides all that in a 
machine-independent manner.

Did I forget anything?

have fun
Michael
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)

iQEVAwUBRgKjncpnzkX8Yg2nAQLgRgf/QgRgWIcy/zLHQF0+B4Pg+5rxAycfDdav
6svjSZxZkTzwFloWiZmjG7frzz6yEpWVKdE6P7tzdizSQyrX4t9l4fL+FvXNhIWJ
38S0AVrKAq1/UtR8Jc86orNZJGQb8Lh8RDW6sGGKAzmOWQECQz0qInZy8JLIL972
d/9Ns8XxZ2Zwd5vtZve6Q1vEWV9EgO+Cwen3rnDgOZ9xP025s7CKMdjjMLBBWoG6
DbbFhb5eMl0AmpKGjqeLCaWP+egOq0BodWivEdZUClkOkL9DPQJTWJzPozdv7VZ2
wLmHkX7/7bKDgj6bTParBIqrdIvOZApN0umdLH/s4N34H9PAPA7x4w==
=sFAV
-----END PGP SIGNATURE-----