From: Andrew S. <str...@as...> - 2006-10-24 17:06:15
|
David Cournapeau wrote: > I don't know anything about your device, but a driver directly accessing > a memory buffer from a userland program sounds like a bug to me. David, DMA memory (yes, I know thats an example of RAS Syndrome, apologies) allows hardware to fill a chunk of RAM and then hand it over to a userspace program. In my experience, RAM used for this purpose must be pre-allocated, usually in a ring-buffer type arrangement. So this is normal operating procedure for something like a frame grabber and not a bug at all. However, the fact that Lars is able to elicit blue screens from a user-mode program indicates driver bugs to me. It's likely, however, that once he gets his program operating within the bounds of what the developers tested, it'll work fine. Lars, for now I suggest doing what AM Archibald suggests and doing a memcpy to copy your framebuffers immediately into non-DMA memory and then hand that DMA memory back to the hardware driver. (Typically these drivers have function calls that indicate whether you "own" that part of memory -- this is, confusingly also called "locking" in the thread sense, as opposed to "locking" in the memory page sense.) Finally, whether you allocate memory in C or in numpy makes little difference. But if you want to use numpy, empty() will be presumably faster than zeros(). And it will have the advantage of doing memory management via Python's standard ref-counting. Cheers! Andrew |