Windows Display Driver Model (WDDM) Operation Flow

Diagram illustrating the WDDM operation flow

Creating a Rendering Device

1.

After an application requests to create a rendering device, the display miniport driver receives a DxgkDdiCreateDevice call. The display miniport driver initializes direct memory access (DMA) by returning a pointer to a filled DXGK_DEVICEINFO structure in the pInfo member of theDXGKARG_CREATEDEVICE structure.

应用程序请求创建渲染设备,DX调用 miniport驱动的DxgkDdiCreateDevice,miniport驱动初始化DMA

2.

If the call to the display miniport driver's DxgkDdiCreateDevice succeeds, the Microsoft Direct3D runtime calls the user-mode display driver's CreateDevice function.

DxgkDdiCreateDevice 成功,D3D调用用户模式显示驱动的CreateDevice

3.

In the CreateDevice call, the user-mode display driver must explicitly call thepfnCreateContextCb function to create one or more contexts—GPU threads of execution on the newly created device. The Direct3D runtime returns information in the pCommandBufferand CommandBufferSize members of the D3DDDICB_CREATECONTEXT structure to initialize the command buffer.

CreateDevice ,用户模式显示驱动必须调用pfnCreateContextCb 创建一个或多个context



Creating Surfaces for a Device

4.

After an application requests to create surfaces for the rendering device, the Direct3D runtime calls the user-mode display driver's CreateResource function.

应用程序为渲染设备请求创建surfaces, D3D调用用户模式显示驱动的CreateResource 

5.

The user-mode display driver's CreateResource calls the pfnAllocateCb runtime-supplied function.

6.

The display miniport driver receives a DxgkDdiCreateAllocation call, which indicates the number and types of allocations to create. DxgkDdiCreateAllocation returns information about the allocations in an array of DXGK_ALLOCATIONINFO structures in the pAllocationInfomember of the DXGKARG_CREATEALLOCATION structure.

DX调用miniport驱动的,


(总结:
应用程序为渲染设备请求创建surfaces --> 用户模式显示驱动创建资源  --> Miniport驱动实际创建资源

应用程序申请的资源肯定需要显卡来提供,因此最终会调用显卡的接口


Submitting the Command Buffer to Kernel Mode

7.

After an application requests to draw to a surface, the Direct3D runtime calls the user-mode display driver function related to the drawing operation, for example, DrawPrimitive2.

应用程序请求在surface上画图,D3D调用用户模式显示驱动的DrawPrimitive2

8.

To submit the command buffer to kernel-mode, the Direct3D runtime calls either the user-mode display driver's Present or Flush function. Also, the user-mode display driver submits the command buffer if the command buffer is full.

因为数据最终要由用户层传递到内核层,最终到达显卡。D3D调用PresentFlush,用户模式显示驱动在命令缓冲满时,自动commit.

9.

The user-mode display driver calls the pfnPresentCb runtime-supplied function if Presentwas called, or the pfnRenderCb runtime-supplied function if Flush was called or the command buffer is full.

应用           用户模式显示驱动

Present -->pfnPresentCb

Flush    -->pfnRenderCb

10.

The display miniport driver receives a call to the DxgkDdiPresent function if pfnPresentCbwas called, or the DxgkDdiRender or DxgkDdiRenderKm function if pfnRenderCb was called. The display miniport driver validates the command buffer, writes to the DMA buffer in the hardware's format, and produces an allocation list that describes the surfaces used.

用户模式显示驱动      miniport驱动

pfnPresentCb-->DxgkDdiPresent 

pfnRenderCb-->DxgkDdiRenderDxgkDdiRenderKm

  

Submitting the DMA Buffer to Hardware

11.

The Microsoft DirectX graphics kernel subsystem calls the display miniport driver's DxgkDdiBuildPagingBuffer function to create special purpose DMA buffers, known as paging buffers, that move the allocations specified in the allocation list to and from GPU-accessible memory.

Note   DxgkDdiBuildPagingBuffer is not called for every frame.
 DX调用miniport驱动的 DxgkDdiBuildPagingBuffer  ,创建包含硬件相关传输指令的DMA buffers

12.

The DirectX graphics kernel subsystem calls the display miniport driver's DxgkDdiSubmitCommand function to queue the paging buffers to the GPU execution unit.

DX调用miniport驱动的DxgkDdiSubmitCommand ,将paging buffer以队列的形式传给GPU

13.

The DirectX graphics kernel subsystem calls the display miniport driver's DxgkDdiPatch function to assign physical addresses to the resources in the DMA buffer.

DX调用miniport驱动的 DxgkDdiPatch ,分配物理地址给DMA buffer内的资源

14.

The DirectX graphics kernel subsystem calls the display miniport driver's DxgkDdiSubmitCommand function to queue the DMA buffer to the GPU execution unit. Each DMA buffer submitted to the GPU contains a fence identifier, which is a number. After the GPU finishes processing the DMA buffer, the GPU generates an interrupt.

DX调用miniport驱动的DxgkDdiSubmitCommand DMA buffer以队列的形式传给GPU。每个提交给GPU的DMA buffer包含一个fence id, 是一个数字。GPU处理DMA buffer结束后,产生一个中断

15.

The display miniport driver is notified of the interrupt in its DxgkDdiInterruptRoutine function. The display miniport driver should read, from the GPU, the fence identifier of the DMA buffer that just completed.

miniport驱动由DxgkDdiInterruptRoutine 的中断通知。驱动应该获取已处理过的DMA buffer内的fence id.

16.

The display miniport driver should call the DxgkCbNotifyInterrupt function to notify the DirectX graphics kernel subsystem that the DMA buffer completed. The display miniport driver should also call the DxgkCbQueueDpc function to queue a deferred procedure call (DPC).

Miniport驱动调用DxgkCbNotifyInterrupt通知DXGK子系统 DMA buffer处理结束。

驱动调用DxgkCbQueueDpc 获取一个DPC。通知DXGK处理下一个DPC


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值