Detailed analysis of Windows 7 core graphics Architecture

Source: Internet
Author: User
Tags processing text
In-depth explanation-detailed analysis of Windows 7 core graphics Architecture

Edit: Ma Zhiwen

Time:

Connection: http://technet.microsoft.com/zh-cn/library/ee921514.aspx

As we all think, Windows 7 is actually the ultimate version of Windows Vista. On the basis of Windows Vista, Windows 7 has made a lot of improvements and added many new features. Compared with the previous generation of XP, Vista provides great improvements. However, on the one hand, these improvements are too huge, and users and even corresponding software vendors (such as DirectX 10 app developers) cannot fully accept them at the moment, on the other hand, because the features are not fully available, Vista is not as good as imagined. In Windows 7, including the operating system itself, software vendors and users are ready, so it is easier to understand the response than Vista.

Graphical interfaces have always been the core of Windows systems. Since Windows Vista, Windows has started to provide a graphic desktop GUI, not only is the desktop of Vista and 7 itself a 3D application, but because Vista and 7 can better play the role of graphics acceleration hardware. From Windows Vista to Windows 7, the operating system and GPU are becoming closer and closer together.

Although people often hear that the major update of Windows 7 is a DirectX 11.0 API, DirectX is also very important for the graphic architecture of Windows systems, but this is not all. A graphic architecture includes how to use GPU to accelerate a variety of graphic applications (2d, 3D, printing, etc.), how to display to the final display device, and including device detection and control. Window 7 updates the graphic architecture in the following aspects:

Wddm 1.1: New Driver Model
DirectX 11: Updated direct3d 11 and related new direct2d APIs
DXVA-HD: HD video playback Acceleration
Display Device connection and Configuration
Color Management
High DPI output and readability
Multi-GPU System
Combined display adapter (also called combined rendering)

Next, we will give a brief introduction to these improvements.


Windows 7 core graphics Architecture

Windows applications use APIs such as GDI (the main graphic interface of the 2D era), direct3d, and OpenGL to communicate with system graphics components, the system components interact with hardware through wddm (Windows display driver model, also known as Longhorn display driver model, windows adopts a new driver model different from the xpdm used by XP: wddm. The driver model used determines the graphics characteristics of a system to a large extent. The wddm version used by Vista is 1.0, and the ultimate version used by Windows 7 is wddm 1.1.


Wddm 1.1 has many changes. Let's take a look at the changes of wddm 1.0 to xpdm, that is, the changes of Vista to XP.


Xpdm: Non-synthetic Model

 


Wddm: merging Model

In the vertical synchronization puzzle XP/Vista and 3D performance tests, I have explained the Differences Between XP/Vista models. In the wddm model, the display screen generated by all applications is finally merged into a single final output screen in DWM (desktop Windows Manager, desktop window manager, therefore, it achieves better display effects (vertical synchronization of all programs by nature), additional effects (thumbnails, scaling), and support for larger left surfaces. However, the original wddm 1.0 only implements the conversion of this big architecture, and the details are still not perfect:

In Vista, GDI (an API for drawing common 2D windows, and using GDI for many other graphic operations) and DirectX (3D application API) have different processing methods: direct3d is accelerated by hardware, while GDI is not (GDI is accelerated by hardware in xpdm). Therefore, Vista users may feel slower than XP in some graphics programs; furthermore, the GDI application is first processed by the CPU software to the system memory, and then transmitted to the GDI display area allocated by the graphics card driver (also in the system memory ), DWM is responsible for merging the screen and outputting it to the display.

In Windows 7, GDI has achieved hardware acceleration (see below)-however, when using both the GDI and direct3d APIs, GDI still cannot achieve hardware acceleration. However, GDI directly outputs the output to the driver's GDI display area, reducing one step and memory consumption (also effective for the direct3d APIs). Obviously, it is not a good idea to use a hybrid API to program graphics (of course, using both GDI and direct3d means that this is an old, window-mode 3D application, such as Windows-based old 3D games)

The old wddm 1.0 processes the GDI application as mentioned earlier.

In the Windows 7 wddm 1.1 model, a separate GDI will use wddm and GPU for hardware acceleration and output to DWM through the GDI display area, as shown in actual operations, that is, most window operations become smoother than Vista, and daily work is faster (most 2D applications use the gdi api, because the GDI contains too much content, so it must be compatible; for more information about GDI, see the following content)


Windows XP direct3d/GDI driver architecture


Windows Vista core graphics architecture is much richer than XP

Windows 7 core graphics architecture, the old GDI/GDI + is still independently supported, however, Windows 7 provides a new implementation method for their corresponding functions, compared to the DirectX 10 in Vista, windows 7 comes with DirectX 11, which is different from wddm 1.0 to 1.1. The version number of DirectX 11 indicates that the change is larger. Windows 7 DirectX 11 has changed the previous working mode and upgraded direct3d 10.1 to direct3d 11, at the same time, we need to re-divide the work of GDI/GDI + that previously could not be accelerated by hardware by Vista, and introduce new direct2d and directwrite APIs to accomplish this:

Most of the previous graphic operations were completed by diredt3d and GDI/GDI + (In addition, there is a WIC-Windows Image component, which manages scanning, printing, and image decoding). In Vista, GDI cannot accelerate hardware. Therefore, Vista is very slow. In Windows 7, in addition to obtaining hardware acceleration by changing the wddm model, they are also divided into direct2d (2d acceleration), directwrite (text processing), and dxgi 1.1 (Device Control) based on oriented applications ), these new APIs or newly assigned APIs have hardware acceleration. For example, direct2d actually uses direct3d 10 for acceleration:

Direct2d: 
The real-time mode of hardware acceleration is a 2-dimensional graphics API, which has high performance and quality in 2D geometric images, bitmaps, and text. Direct2d APIs are designed for interoperability with GDI, GDI +, and direct3d.

Directwrite: 
Directwrite provides high-quality text rendering, contour fonts with independent resolutions, complete Unicode text, and layout support. When using direct2d, directwrite is accelerated by hardware.

When the system does not support direct3d 10, Windows 7 will use d3d9 on an additional 10level9 software layer. Obviously, for the best efficiency, you need to use the direct3d10 video card, because Windows 7 DWM is based on direct3d 10


Font anti-aliasing: directwrite Effect


Direct3d 11

Windows 7 with direct3d 11 is a superset of d3d10. It features that it can run on both the Direct3D9 and direct3d10.1 hardware. In fact, DirectX 11 will provide Vista support, instead of supporting only Vista and not being compatible with the previous generation of systems as when direct 10 came out, this led to a slow transfer from software development vendors to DirectX 10. DirectX 11 supports multiple hardware platforms and features of multiple operating systems to make it more acceptable. At the same time, direc3d 11 also has many improvements, which will be discussed in a special article (in the Plan). Here we will first talk about Windows 7's improvements to the entire graphic operation, by incorporating more GDI/GDI + into the DirectX System for hardware acceleration, the graphic interface performance will get better and better (of course, this requires software vendors to write with the new direct2d/directwrite ). Microsoft wants to build all graphic operations on DirectX.

Integrate the missing GDI hardware acceleration in Vista into the DirectX System for hardware acceleration again, and the performance will be faster. In the future, graphics card manufacturers will no longer need to provide GDI Acceleration

Display Technology

Windows 7 supports a series of display technologies, including digital output as native output (supports hdmi and displayport, while the old VGA analog output is recommended to be discarded ), windows 7 also supports more native content sources such as Blu-ray, JPEG-XR, HDR images, etc.

In Windows 7, the default sRGB color space is used as a unified workflow for all devices, but the precision is increased to 30 bits-two more entries are added for each color channel; windows 7 supports up to 48-bit scrgb mode, high precision + extended range + high dynamic


Wddm 1.1 requires that the driver support bgra, and bgra is the fastest color format.

Display Device connection and Configuration


In Windows 7, all applications are displayed in a unified virtual desktop with a resolution of 64 k x 64 K (65536x65536)

A virtual desktop is divided into different views by display. Each view corresponds to an adapter. An adapter does not mean a video card. When a video card is connected to multiple monitors, it contains multiple adapters. Similarly, A single display connected to SLI or crossfirex means that it is a single adapter (added from Vista, called the linked-adapter feature)


However, in Vista, you cannot use multiple graphics cards of different GPU manufacturers, while in Windows 7, you can

In LDA configuration, the program interface roaming in different outputs is basically transparent, called dynamic adapter switching dynamic adapter Switching

Under Multiple monitors, Windows 7 provides a new global shortcut key function: Win + P, which allows you to quickly set the working status of multiple monitors. This shortcut key was originally designed for projector applications.

In general, the graphic architecture of Windows 7 is more perfect than Vista, and its applications are more convenient. The most obvious thing is the change of the gdi api, and now the GDI application has also achieved hardware acceleration, just like in XP, it can only be processed by the processor under its vista, therefore, users can feel that their daily applications will become smoother.

 

II:

Original article: 2D drawing APIs in Windows

In Windows 7, Microsoft has made great efforts to build a new 2D drawing API. We call it direct2d and belong to the DirectX family. The development of this API fills in some defects of the Windows graphics platform. One of the most important points is that normal 2D rendering no longer lacks hardware acceleration. In Windows Vista, we know that GDI cannot accelerate hardware. Microsoft hopes that the developed API has many modern features. For example, it supports 2D rendering of anti-aliasing and Alpha blend, interaction with other modern graphics APIs, server-side rendering, and so on.

To help understand why Microsoft developed direct2d, let's review the history of Windows development. The original rendering system is called GDI (graphical device interface), which still exists today. It was initially written for 16-bit windows and then upgraded to 32-bit windows (Windows 95 and Windows NT ). Because GDI was developed for computers with low computing power a long time ago, it does not have features such as anti-aliasing, and most APIs do not support alpha channels.

During Windows 95, DirectX released the first version. DirectDraw is one of the earliest components. It was originally intended that, when hardware acceleration was enabled, developers could bypass wing's permission to directly access the hardware. Such a protocol stack can be in the same status as the GDI protocol stack.

With the evolution of graphics hardware (graphics card), GDI achieves hardware acceleration through DDI (Device Driver Interface. Many video cards implement these DDI, and it is common to purchase a video card to improve your Windows performance. Next, direct3d enters DirectX 2. Of course, it also creates its own DDI set. As a result, the video card began to invest more and more energy to make 3D graphics faster and faster, in order to maintain the huge demand of the game market. Finally, two different areas emerged: hardware acceleration and Graphic programming. The former is built around direct3d, and the latter is centered around GDI.

Direct3d and GDI are built on different targets. The fact that they are in different locations means they cannot work together as well as expected. Although many help bridging features such as getdc are implemented, there are always some problems in many cross-rendering scenarios. However, Microsoft did not remove these needs to be addressed.

At the turn of the century, the limitations of GDI have become increasingly apparent. Microsoft has developed a GDI extension to address these functional defects, that is, GDI +. These extensions provide support for different pixel depth formats and Alpha blend in primitive rendering, such as bitmap operations, paint brushes, anti-aliasing, and increasingly complex ones. In addition, GDI + supports image operations such as opening PNG and jpg files. However, all newly added operations of GDI + are not supported by hardware acceleration.

GDI + is very popular in the hosting world, mainly because it is the main force of the system. Windows. Drawing namespace. Every user-defined rendering of a very beautiful windows form program uses GDI + for this purpose. However, the GDI + built on GDI also inherits all the issues of interaction with direct3d. In fact, it gets worse in some scenarios because it is always soft-rendered.

When it comes to planning to develop Windows 7, it is obvious that Microsoft needs to solve a lot of lack of interoperability and unbalanced hardware acceleration capabilities. It is quite difficult to retain existing APIs and achieve the above purpose. GDI has a long history, which needs to cope with compatibility issues of massive applications. If we want to integrate Alpha blend support (for example) into the core API set of GDI, and do not offend existing customers, it is no different from the rest of the night. Because GDI + is built on top of GDI, the old bad habits make it hard to achieve hardware acceleration capabilities. (In this Article, if GDI does not implement hardware acceleration, it means that before win7, win7 has been implemented .).

The solution is to create new APIs to include the features we want and handle interoperability problems. Mil Code (the native component for processing rendering by WPF) is a very convenient start point. It has the rendering features we want and provides both software rendering and hardware acceleration.

The first thing to do is to make the rendering code based on d3d 10.1 instead of d3d 9. The reason for this decision is that some other technologies built on this runtime version use d3d 10.1 as the basis (10level9, warp, d3d primitive remoting ). We can also see that the future hardware is also built on this architecture. This allows us to design d3d 10.1 interoperability. Therefore, you can allow interaction with other technologies, such as direct2d.

Another interoperability task is to use the window manager and dxgi to ensure that direct2d and GDI can work together. You can use direct2d to draw a graph to the GDI target. Likewise, the opposite is acceptable. However, from the performance perspective, these features are not free. It just allows applications built on these two hybrid APIs to smoothly transition to the new world.

An important part of the previous work is to try to make this API expressive in terms of performance. For developers, the advantage of WPF is that it manages very important resources, but it makes it difficult to directly control hardware. This sounds simple, but there are a lot of design decisions behind it to ensure that the GPU memory is not allocated to people who don't need it and can still allow people to construct what they think. Therefore, the direct2d design and resource/thread model that follow this principle can allow server rendering for proper scaling. But it cannot.

In addition, directwrite and WIC can be used for processing text and images respectively. This indicates that the Microsoft DirectX family is more componentized. Direct2d provides hardware acceleration support for directwrite text and WIC bitmap operations in a complementary manner.

Finally, we have built a 2D rendering API (with soft rendering) that supports hardware acceleration ). It has a collection of modern rendering primitives and can interact with previous APIs. We believe that it can completely replace the GDI/GDI + API used in most application development scenarios, and can also be used as a supplement to d3d 10.1 in some game development scenarios. A set of componentized technologies built by Microsoft completely allows developers to mix and construct previously difficult things. For example, you can render the positioned text pixels directly to the direct3d texture without the support of any fonts.

Http://blog.csdn.net/poem_of_sunshine/article/details/8018533

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.