Messages in this thread |  | | From | Ian Reid <> | Subject | Re: Mapping kernel memory into user space | Date | Thu, 18 Jul 1996 16:14:36 +0100 |
| |
Linus Torvalds wrote: > > On Tue, 16 Jul 1996 Thomas.Koenig@ciw.uni-karlsruhe.de wrote writing for > Hubert Schreier: > > > > I am writing a device driver for a PCI video capture board that writes image > > data directly into the memory of the computer. As it is impossible to obtain > > large contiguos memory areas in kernel space, I use blocks of 4k and program > > the framegrabber's processor to write to them. To obtain fast acces to the > > image data, I want to use memory mapped acces. However, I cannot figure out > > how to map these 4k blocks to a contiguos area in user space memory. For > > allocating the blocks I use > > ..... > > > Q2: Is there a way to use shared memory, so I could use XShmPutImage() > > to write to a window? > > No. If you want that, then you shouldn't mmap() the device, instead you > should just create a shared memory area in your application and do a > "read()" on the device. The device could look up the physical addresses > of the pages etc.. HOWEVER: BE VERY CAREFUL WHEN DOING THIS! > > Linus
I just posted a very similar question before I noticed this thread (sorry). I want to write directly to an XShmImage but I don't know how to "look up the physical address" of the pages. How is this done??
With reference to the earlier poster's questions, Matt Welsh wrote a simple kernel patch called "bigphysarea" which reserves a contiguous large block of memory at boot time for just such uses as yours. I use it to provide a nice big buffer for frame on the Matrox Meteor. The patch is distributed with the meteor driver at ftp.rwii.com in /pub/linux/system/Meteor (currentl driver version is 1.4).
Cheers, Ian
|  |