Hi,
at the beginning I must explain that I am not an expert in driver subject so please do not expect that I know too much.
Here’ s my problem:
I have old TV tuner PCI card based on Zoran ZR36120 multimedia controller. Because the company doesn’t exist any more and the driver was 16-bit and yet I wanted to train myself a little bit I decided to implement WDM streaming minidriver for my hardware (actually my job is not far away from it). After some time I managed to do it - my driver works but the problem is that display is not smooth enough.
ZR36120 chip enables DMA transfers to contiguous memory areas (no scatter/gather support) - top & bottom video fields. Hence I have requested in DriverEntry allocation of common DMA buffer (DmaBufferSize in HW_INITIALIZATION_DATA structure) and I have setup ZR36120 to do DMA transfers to this buffer. Next I mapped SRB data buffer using “write combining” when SRB is queued by the driver.
pSrbExt->pMDL = IoAllocateMdl(pDataPacket->Data, biWidthBytes VIDEO_HEIGHT, FALSE, FALSE, NULL);
if(pSrbExt-pMDL != NULL) {
MmProbeAndLockPages(pSrbExt->pMDL, KernelMode, IoWriteAccess);
pSrbExt->pvData = MmMapLockedPagesSpecifyCache(pSrbExt->pMDL, KernelMode, MmWriteCombined, NULL, FALSE, NormalPagePriority);
};
then in DPC, after DMA transfer of video field is completed I simply copy the field to SRB data buffer using mapped pSrbExt->pvData
when SRB is completed I call:
if(pSrbExt->pvData != NULL) {
MmUnmapLockedPages(pSrbExt->pvData, pSrbExt->pMDL);
};
MmUnlockPages(pSrbExt->pMDL);
IoFreeMdl(pSrbExt->pMDL);
OK, the problem is that it takes a long time, ab. 14 ms (without “write comining” it was 18 ms) to copy field so I have only 6 ms for OS left. I have 720x288x2 bytes to copy for every field what gives 29.6 MB/s. Is it all what I can expect for AGP (x2) ?
I have also notived that when only line line per field is DMA transfered copying of the same field buffer from common DMA buffer to SRB buffer takes 10 ms ? Shouldn’t PCI & AGP be independent ? Shoulnd’t I achieve bigger transfers (up to 512 MB/s) ? Copying the same block between memory takes only 5 ms. But when I use optimized (what doesn’t help at all when I copy to SRB data buffer) memory copying procedure (MMX,SIMD,prefetching) it takes only 1-2 ms.
Can it be improved ?
I use PIII 800 MHz with VIA chipsets.
Thanks in advance and best regards
Dariusz Dziara