How to control scatter/gather list size

Hello World,

In my StartDma function I create a dma transaction using WdfDmaTransactionCreate then I initialize it with WdfDmaTransactionInitialize ( Status = WdfDmaTransactionInitialize(pDataBuffer_X->DmaTransaction, EvtProgramDmaFunction, Direction, pDataBuffer_X->user.pMdl, p MmGetMdlVirtualAddress(pDataBuffer_X->user.pMdl), pDataBuffer_X->user.BufferSize);
The kmdf framework call my EvtProgramDmaFunction callback (BOOLEAN EvtProgramDmaFunction(IN WDFDMATRANSACTION _Transaction, IN WDFDEVICE _Device, IN WDFCONTEXT _pContext, IN WDF_DMA_DIRECTION _Direction, IN PSCATTER_GATHER_LIST _pSgList)) and provide a scatter gather list (_pSgList) which map the user buffer provided in the pDataBuffer_X->user.pMdl memory zone. The list of scatter gather elements maps the different physical contiguous memory zones which compose the user data memory buffer.
I would like to be able to write/compute my own scatter gather list but as it is for now it seems impossible because the number of available entries (_pSgList->NumberOfElements) in this scatter list is fixed by the framework and linked to the user buffer physical page layout. Is it possible to ask for a scatter gather list of a given number of element (let's say 100) and fill this table with my own code.
Is it possible to give the maximum size of a scatter gather transfer size in byte ? For example I can transfer a maximum of 32MB BUT each scatter gather element cannot exceed 128KB (maximum burst size).

I would like to do that because I would like to use the dma transfer to deinterlace a video picture. This is a time consuming in software but it is easy and fast with the dma engine but I need more scatter gather entries. What do you think ?

Best regards

You are certainly free to allocate and create your own scatter/gather list from the one the framework delivers to you. In most cases, the kernel's scatter/gather list structure doesn't match the hardware's requirements, so you generally have to create your own anyway.

However, unless the scanlines are all 4096 bytes wide, I don't see how this helps with deinterlacing, and I'm not sure where you'd be getting an interlaced image from these days. Plus, deinterlacing in software doesn't cost any more than a copy.