Windows Vista desktop window manager (3)

Source: Internet
Author: User

As mentioned above, WDDM supports cross-process sharing of Surface. Shared DirectX is important for redirecting DirectX applications. Because Vista must be compatible with previous applications, it must support applications previously written in GDI, DirectX. WDM must redirect the windows of these applications to the Surface, and then combine them by WDM to display a single Surface.

Note that WDM only redirects Top-level windows. For an MDI application, all its Top-level windows and subwindows are merged into a separate Surface and then handed over to DWM for merging. Based on the previous Windows graphics system. Redirection is divided into the following three types:

1. Only use the display window of GDI

There is no doubt that the GDI application is the mainstream today. The basic process of WDM redirection for a GDI-based application is as follows:
A. Allocate A memory block of the same size as the window in the system memory and associate it with the window.
B. A video memory block of the same size and specified pixel format is also allocated in the display memory.
C. Then, when the application obtains the DC of the window, because the window has not been involved in the WDM synthesis, the active DC is not in the main video memory, and the memory block previously allocated in the system memory.
D. After the GDI operation, a Surface is formed in the system memory.
E. The system copies the displayed content from the system memory to the video memory according to the window parameters.
F. In this way, the video memory data is consistent with the window, and the rest of the work is done by WDM: the Surface is merged to form the final desktop.

There are also two additional notes:

(1) double buffer window. Currently, the dual-buffer technology displays a lot of windows, which can effectively avoid flickering. Indeed, in a dual-buffer GDI window, it has two memory blocks, one in the system and the other in the video card. So the question is: why don't I directly use the Display memory block in the dual buffer when redirecting? There are two main problems in this way: first, the format is different, and the display format of GDI is different from that of DirectX. GDI does not support submission in DirectX format. Second, many GDI operations (XOR, text, Alpha, and so on) are three steps such as "Read-Modify-Write-Back. If you directly use the video memory block during redirection, you must read the original display content from the video memory to the CPU (or system memory) during display by GDI, modify the content, and write the content back to the video memory. This operation is very inefficient. So it is not used.

(2) Minimize the window. In general, the minimized window is only displayed in a very small range of the taskbar. We need to estimate the size of the window to be drawn only 130X30. However, this method is not used in DWM. If the window is minimized, we change the Surface size to x 30 and then display it as needed. This will cause a problem in Filp3D or thumbnails, so the window has been modified. Therefore, DWM saves the last updated Sureface content after minimizing the window.

2. Only display windows using DirectX

Because DirectX applications usually call the Present () function to submit the Surface, such applications usually only need a window buffer to implement redirection. The redirection of the DirectX window is handled by the DirectX System (actually DirectX 10). When DirectX10 decides to display a Surface, it will call the DWM interface to achieve cross-process sharing. The "Furface sharing" of DirectX 10 is a unique feature built on WDDM. This is also one of the key reasons why WDDM is required to run DWM.

When Present () displays the Surface, DWM will be notified that it should update its original window Surface, and then DWM will be merged again. Note that the WPF application is also a DirectX application. They also adopt this redirection method.

3. Mixed GDI and DirectX windows

Currently, many Top-level windows use the GDI + DirectX mode for content display. The result varies depending on the mixing method. If the Top-Level window and its sub-window are displayed in a unique way, for example, the main window only uses DirectX, and the sub-window only uses GDI, DWM forms its own "synthetic" tree for such a window. No subwindow is displayed separately, and the Surface of the entire Tree is merged and passed to the desktop. This hybrid method can be well implemented.

It is troublesome to use GDI + DirectX to display a single Top-level window at the same time. In particular, GDI + DirectX repeatedly displays a certain area of the window. DWM usually does not support such a window.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.