Tech Support > Microsoft Windows > Drivers > Move the content between the allocations in the display miniport driver
Move the content between the allocations in the display miniport driver
Posted by zhoufreefly@hotmail.com on September 27th, 2007


hi all. i am trying to move the content of an allocation from one
location to another in the display mini-port driver, so i use the
DxgkDdiBuildPagingBuffer to do it, unfortunately,it doesn't work.i do
it according to the sample code that the WDK giving, but i don't know
how to use the functions VidSchSubmitPagingBuffer and
VidMmAcquirePagingBuffer, how to get the address of the
VidSchSubmitPagingBuffer and VidMmAcquirePagingBuffer in the
dxgkrnl.sys.
The following code example shows how to use DxgkDdiBuildPagingBuffer
in the WDK.
////
NTSTATUS ntStatus;
DXGKARG_BUILDPAGINGBUFFER param;

// The driver receives the following paging operation to build:
//
param.Flags = 0;
param.pDmaBuffer= CurrentPagingBuffer;
param.DmaSize = CurrentPagingBufferSizeLeft;
param.pDmaBufferPrivateData = CurrentPagingBufferPrivateData;
param.DmaBufferPrivateDataSize =
CurrentPagingBufferPrivateDataSizeLeft;
param.Operation = DXGK_OPERATION_TRANSFER;
param.Transfer.Flags = 0;
param.Transfer.TransferOffset =
CurrentOffsetInAllocationBeingTransfered;
param.Transfer.hAllocation = DriverContextForAllocationBeingMoved;
param.Transfer.Source.SegmentId = 0; // Source is an MDL.
param.Transfer.Source.pMdl =
MDLDescribingPagesForAllocationBeingMoved;
param.Transfer.Destination.SegmentId = 1; // Source to segment #1.
param.Transfer.Destination.SegmentAddress = 0; // Source to offset 0
of segment #1.

// The driver receives MultipassOffset when it is initialized to zero
// and uses it for multiple iterations of the paging operation.
//
param.MultipassOffset = 0;

do {
// Call the driver's BuildPagingBuffer function to build a paging
buffer.
//
ntStatus = BuildPagingBuffer(hAdapter, &param);
// BuildPagingBuffer updates the size that is left in the
// paging buffer with the amount of bytes that were written.
//
if (NT_SUCCESS(ntStatus)) {
//
// If STATUS_SUCCESS, batch the paging buffer to the
// scheduler after multiple paging operations are batched.
}
else if (ntStatus == STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER) {

//
// If STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER, submit the
current paging buffer to the scheduler to let
// the GPU start working on a partial transfer.

VidSchSubmitPagingBuffer(CurrentPagingBuffer,
CurrentPagingBufferSizeLeft);////?????????

// Acquire a new paging buffer to complete the transfer.
//
VidMmAcquirePagingBuffer(&CurrentPagingBuffer,
&CurrentPagingBufferSizeLeft);///?????
}
else {
//
// A critical failure occurred, so bugcheck the system.
// This situation should never occur because the driver can
// fail the call only if it requires more DMA buffer space.
}
} while(!NT_SUCCESS(ntStatus))