Dear group members,
Another DMA buffer memory question…: How is it possible to ‘present’ several AllocateCommonBuffer-blocks to a usermode-app as one contigous virtual memory?
I want to extend an existing WDM driver for a PCI framegrabber device. Acutally the driver allocates one buffer using AllocateCommonBuffer and creates a MDL using IoAllocateMdl and MmBuildMdlForNonPagedPool to map it into virtual memoryspace.
My device is capable to copy the requested data (a raw bitmap image) to several physical datablocks. To avoid fragmentation I want to pre-allocate a ‘list of AllocateCommonBuffer pages’ (all of the same size) once, for example each with 512kB. When the usermode-app requests an image with for example 1280x1024 pixel (1.3MB), the driver ‘takes 3 preallocated pages’, passes the physical adress of them to the PCI device. The image is split by the PCI device into 3 512kB ‘pages’ - the first 512kB are copied to the first block, the second 512kB to the second and the remaining about 260kB to the 3rd Block. The usermode-app should be able to access the complete image in one contigous virtual memory.
(fyi: in Linux, I use pci_alloc_consistent to allocate the ‘pages’ and remap_pfn_range
to map several of them to one contigous virutal memory.)
best regards,
Thomas