From: Felix <fx...@gm...> - 2004-10-15 23:24:03
|
Am Fr, den 15.10.2004 schrieb Keith Whitwell um 15:50: > Felix K=FChling wrote: > > Am Fr, den 15.10.2004 schrieb Vladimir Dergachev um 5:27: > >=20 > >>On Fri, 15 Oct 2004, Felix [ISO-8859-1] K=FChling wrote: > >> > >> > >>>Am Fr, den 15.10.2004 schrieb Jon Smirl um 3:58: > >>> > >>>>On Fri, 15 Oct 2004 03:55:37 +0200, Felix K=FChling <fx...@gm...> = wrote: > >>>> > >>>>>I'm trying to get Shadow status working in the savage driver. I'd li= ke > >>>>>to put the status page into locked shared memory and tell the Savage > >>>>>chips about its physical address. I used a drmAddMap call copied fro= m > >>>>>the MGA driver that looked like it did what I wanted. But I had to f= ind > >>>>>out that the handle returned by drmAddMap is a kernel virtual addres= s, > >>>>>not a physical address. Later I saw that the status page seems to be > >>>>>unused in the MGA driver. The code to get the physical address from = the > >>>>>kernel virtual address is #if-ed out, probably for portability reaso= ns. > >>>> > >>>>Does the code in drm_pci.c apply? It's only used by the via driver. > >>>>I'm not sure what it does. > >>> > >>>I guess if I was only going to use that memory in kernel drm_pci_alloc > >>>would be fine. But I want to map the status page at least in the > >>>Xserver, maybe also in clients. > >> > >>Take a look at km or v4l drivers - maybe there is something you can use= . > >> > >>With 2.4 I used rvmalloc - I don't recall whether there is a standard=20 > >>mechanism for this in 2.6. > >=20 > >=20 > > The point is that I'm not just looking for a way to get a physical > > address in Linux. In that case I'd just use virt_to_bus on the map > > handle. Since I only need a single page I also don't need to worry abou= t > > allocating consistent memory. However, I want to use the mechanisms > > available in the DRM abstraction layer so that the savage driver stays > > (at least theoretically) portable to BSD and so that I can use > > drmMap/drmMapBufs to map the status page in the Xserver and/or in DRI > > clients. >=20 > I'm not sure that such a mechanism exists. If it doesn't, I think the on= us=20 > falls on the porter to provide one, if a port is ever attempted. I see two alternatives for providing what I need. 1. A new map type _DRM_PCI (or _DRM_CONSISTENT if you prefer that in contrast to _DRM_SCATTER_GATHER) that allocates pages with drm_alloc_pages and returns the physical address as handle. 2. A new map flag for the _DRM_SHM map type, say _DRM_CONSISTENT that makes it allocate with drm_alloc_pages and return the physical address as handle. I think the first one sounds cleaner. If we can agree on this I'd prepare a patch for the linux-core implementation and the corresponding headers in Xorg for review.(*) When BSD gets ported to the core/personality model it would need to get the new PCI map type too in order to support any drivers that use it. >=20 > Keith Regards, Felix (*) In fact I'm starting right now. --=20 | Felix K=FChling <fx...@gm...> http://fxk.de.vu | | PGP Fingerprint: 6A3C 9566 5B30 DDED 73C3 B152 151C 5CC1 D888 E595 | |