Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This topic describes common usage scenarios and the sequence of operations necessary to implement them.
Updating page table entries of a process
Here is the sequence of operations to update page table entries to map an allocation that belong to a process (P) to physical memory. It is assumed that the page table allocations are already resident in a graphics processing unit (GPU) memory segment.
- The video memory manager allocates a virtual address range in the paging process context for the root page table allocation of the process P.
- The video memory manager allocates a virtual address range in the paging process context for the page table allocations of the process P.
- The video memory manager calls DxgkDdiBuildPagingBuffer with the UpdatePageTable command to map the paging process page table entries to the process P page tables and the page directory.
- The video memory manager calls DxgkDdiBuildPagingBuffer with the FlushTLB(PagingProcessRootPageTable) command.
- The video memory manager calls DxgkDdiBuildPagingBuffer with the UpdatePageTable command to fill the process page table entries with physical address information.
- The video memory manager calls DxgkDdiBuildPagingBuffer with the FlushTLB(process P root page table) command.
- The paging buffer is submitted for execution in the paging process context.
Transferring allocation content from one location to another
Here is the sequence of operations when transferring an allocation content from one location to another (ex. from local memory to system memory).
- The video memory manager allocates virtual address ranges for the source allocation and the destination allocation in the paging process virtual address scratch area.
- The video memory manager calls DxgkDdiBuildPagingBuffer with the UpdatePageTable command. The command maps the paging process page table entries for the source virtual address range to the allocation physical address in the local GPU memory.
- The video memory manager calls DxgkDdiBuildPagingBuffer with UpdatePageTable command. The command maps the paging process page table entries for the destination virtual address to system memory.
- The video memory manager calls DxgkDdiBuildPagingBuffer with the FlushTLB(paging process root page table).
- The video memory manager calls DxgkDdiBuildPagingBuffer with the TransferVirtual command to perform a transfer operation.
- The paging buffer is submitted to the GPU for execution in the paging process context.
Filling an allocation with a pattern
Here is the sequence of operations when an allocation needs to be filled with a pattern.
- The video memory manager allocates a virtual address range for the destination allocation in the paging process virtual address scratch area.
- The video memory manager calls DxgkDdiBuildPagingBuffer with the UpdatePageTable command. The command maps the paging process page table entries for the destination virtual address.
- The video memory manager calls DxgkDdiBuildPagingBuffer with the FlushTLB(paging process root page table).
- The video memory manager calls DxgkDdiBuildPagingBuffer with the FillVirtual command to perform the operation.
- The paging buffer is submitted to the GPU for execution in the paging process context.
Making an allocation resident in system memory
The following operations are performed when D3DKMTMakeResident is called to make an allocation resident. It is assumed that the application process page tables are resident in memory.
In the application thread context:
- Allocate and pin physical system memory pages for the allocation virtual address range (if the allocation is resident in system memory).
- Generate a new paging fence ID for the application device.
- Submit a MakeResident command to the video memory manager worked thread.
- Return to the application.
In the video memory manager worker thread context:
- Update the application process page table entries (see the corresponding section above).
- If the allocation is resident in a local memory segment, fill the allocation with zeros (see the corresponding section above).
- Submit the SignalSynchronizationObject command to the scheduler with the paging fence ID.
Initialization of the memory manager control structures
The paging process initialization
The DirectX graphics kernel initializes the paging process virtual address space when the graphics device is switched to the D0 power device state
- The paging process is created with DxgkDdiCreateProcess.
- The system device is created with DxgkDdiCreateDevice. At this point the kernel mode driver can reserve a virtual address range in the paging process address space.
- Page table allocations are created for the paging process.
- The page table allocations are committed to the memory segments that are defined in the virtual addressing capability structure.
- UpdatePageTable operations are called to initialize the page tables.
A client process initialization
When a new process is created, the DirectX graphics kernel will:
- Create the initial page table allocations.
- Initialize the page table allocations when the first allocation from the process is made resident.