In DWM, each window is represented by a Surface, which can be seen as a 3D mesh. Although each window is still a rectangle, they are all located in a 3D space. Window operations, such as maximization and restoration, have all changed. They all implement 3D transformation of the mesh. There is a big difference from the past.
In Windows Vista, the window glass effect is brilliant. At the border of the window, we can see the content below the window. In this case, both transparent and fuzzy effects are provided. However, in order to prevent the content of the window below from being too clear and affecting the window above, the DWM group also blur the window below. The implementation points include:
1. blur the following content, which is implemented by a custom pixel Shader. This Shader is a small program completely running on the GPU, which can process multiple pixels in parallel.
2. Blur is only partial content under the window boundary. These contents need to be extracted from different caches.
3. The method is similar to the average value processing: the value of a pixel is equal to the value of a neighboring pixel.
As we all know, Direct3D supports multiple surfaces. When different surfaces are displayed, they are implemented through Flip (Flip), as is DWM. The result of this implementation is that the previous Tearing will not appear. Make the desktop smoother.
Now, although our desktop is a full screen Direct3D application. Whether it's an old-fashioned graphics processor that only supports post image acceleration or a new high-speed graphics processor, we all need to operate the storage system of the graphics processor. There are two important problems:
1. When there are many windows, the memory required to run DWM will be a problem. It will increase with the increase in the number of windows.
2. DWM shares memory resources with other applications. Such as DirectX applications, video playback, and WPF applications.
To solve these problems, Microsoft proposed the Windows Display Driver Model ). WDDM is a new DirectX Driver Model for Vista and later operating systems. WDDM mainly provides three functions: 1. virtualized video memory. 2. allow interaction with the GPU. 3. allow cross-process sharing on the DirectX surface.
In WDDM, the displayed content is virtualized. This indicates that the display content is the same as the system memory. We know that if the memory allocation is complete in the system memory and there are new allocation requirements, a second storage page will be generated, then, the system manages the page algorithms and Mechanisms of storage pages and primary storage. Currently, the primary storage displays the memory, while the second storage page displays the system memory. After the storage and system memory are allocated, the disk is used as the video memory surface. Of course, this situation is rare. However, this design ensures that WDDM is robust enough to enhance the reliability of applications. In WDDM, it implements a key function: memory allocation, memory allocation, and real Display memory control. WDDM itself is constantly improving.
Since WDDM has achieved the virtualization of Display memory, this means that WDDM has the function of adjusting the GPU command priority of the application. This function is usually implemented by the WDDM scheduler. Therefore, WDDM must be able to interrupt some GPU operations and save the operation context for resuming operations as necessary. Based on this function, WDDM provides two levels of scheduling support:
1. Basic scheduling. It is the scheduling granularity supported by the WDDM driver and hardware based on DirectX9. That is to say, separate Primitive and Shader programs cannot be interrupted, and context switching must be performed after they are completed.
2. Advanced scheduling. It is the scheduling granularity supported by the WDDM driver and hardware based on DirectX10. Such calls support more fine-grained interruptions than Primitive and Shader. Note: Although DirectX10 supports advanced scheduling, it is not required by DirecX10. That is to say, only some hardware supports advanced scheduling. The desktop window manager uses DirectX9, so it supports basic scheduling.