Display and 2D acceleration in the window
If we consider a two-dimensional representation within a window, only two coordinates exist: X and Y. Width and height. What is missing, however, is additional depth information. Width and height are sufficient for the time being:
The drawing of these objects is done via the so-called GDI (Graphics Device Interface). This interface for all higher programming languages contains all important functions that are needed for the representation of two-dimensional drawing objects. Further developments such as GDI and Direct2D are not to be discussed here for the time being, since the GDI plays the most important role for the 2D output of the applications until today. The most important drawing functions for pixels, lines, curves, polygons, rectangles, ellipses etc. were calculated exclusively by the CPU in the beginning.
Later, a targeted specialization of the graphics cards made it possible to achieve a hardware-based and thus also faster calculation of these two-dimensional objects. This original form of 2D acceleration is still important today, but no longer represents the sole task field of 2D acceleration. More about this in the next chapter. If Windows consisted of only one full-screen window, then we would not have to worry about the problem of different drawing layers. However, since we also want to work non-exclusively, this two-dimensional information alone is no longer sufficient. We need one more coordinate.
Simple representation of several windows without hardware acceleration:
Here, the original method behind overlapping windows is actually quite simple and obvious. You only need to know two things, namely which area of the screen or which window has changed (and thus needs to be redrawn), and which window or which object is ultimately overlapped or behind each other, or partially or completely obscured, in which order. This information is also called 2.5D layer or plane. This Z-coordinate, which is 0 or 1, is a kind of third auxiliary dimension. Therefore one speaks also of 2.5D. The Z-order can be used to determine the sequence.
First, the window content is drawn with pure 2D functions, as already known. However, it is not only the task to create full-surface content, but one must also manage this multitude of information and communicate it within the windows. So what happens when you move windows? Whenever a part of a fully or partially hidden window becomes visible (again), this window receives the system event WM_PAINT and the exact information which rectangular area has to be redrawn (“dirty rectangle”). Optimized applications will now redraw or build exactly this area. Unfortunately, there are many applications that redraw the entire window in spite of everything – no matter if it is completely visible or not. However, this is at the expense of the display speed. The consequence of this is, among other things, the well known and hated trailing effect when windows are moved quickly without hardware acceleration.
Let’s summarize what we have so far. There are individual windows that have to be brought to life by two-dimensional content. These windows, in turn, can move freely, overlap, cover each other completely or partially. Their contents have to be managed and, if necessary, displayed on the screen with as little delay as possible. We also know that the CPU itself, even though it may be fast, is actually overtaxed with this complex task. What could be more obvious than outsourcing all these tasks to the graphics card? That this reads easier than it can be implemented is what you’ll learn next.
The specialization of graphics cards initially took place in the pure 2D area. It’s no secret that these cards still perform excellently when it comes to outputting complex drawings. Many a sweetheart from days long gone has survived to this day because of this. However, these cards quickly fail in everyday use when it comes to the general interface display of current Windows versions. On the one hand, this has to do with the graphical upgrading of the interface, and on the other hand, with a limited range of functions. But first things first..
2D acceleration of drawing functions
This refers to the part of the 2D hardware acceleration that is responsible for the native output of drawing tasks of the GDI via the graphics card. This concerns on the one hand simple geometrical objects such as pixels, lines, curves, polygons, rectangles, ellipses and on the other hand the scaling, rendering and edge smoothing of fonts (TrueType, OpenType). If in the beginning one still spoke of so-called 2D units on the graphics accelerators, this specialized unit has meanwhile completely disappeared on the home user cards. The acceleration of these 2D drawing functions is done analogously to the 3D acceleration on an identical hardware and the implementation is done solely via the graphics driver.
In the second part of our article, we will present a benchmark test that we developed especially for this area, which will comprehensively test these important functions and show that drivers can fail blatantly and unexpectedly if the most basic functions are criminally neglected. Below is a small selection of a total of 9 test criteria: Text output, rectangles and curves
2.5D acceleration of surface rendering
Meanwhile, the implementation of the drawing functions is only a part of the 2D acceleration. A visible and subjectively very well perceptible acceleration can be achieved with current 3D graphics cards, which are also capable of generating the 2.5D layers mentioned in the previous section themselves in terms of hardware, managing them and displaying them as required. Initially, everything is rendered.
How does this work? Similar to the 3D display, the non-visible parts of a window are initially transferred to the graphics card in one piece as a virtual rectangular section representing the window in question, where they are completely rendered and saved. So nothing has to be “redrawn” later. The graphics card knows the size and position of these virtual rectangles at all times, and the so-called depth buffer (Z-buffer) is used to tell the card in which order (Z-order) the windows or objects are superimposed and displayed. The graphics card alone then decides on the visibility of the contents.
Let’s summarize briefly:
The 2D hardware acceleration at that time included both the implementation of the most important 2D drawing functions and the implementation of the 2.5D layer technique for the window or surface display.
It would certainly be tedious to go into detail about every single Windows version. Since the current problems, which prompted us to this test, mainly occur under Windows 7, we have limited ourselves in the following to the consideration of Windows XP, Windows Vista and of course Windows 7.
16 Antworten
Kommentar
Lade neue Kommentare
Mitglied
Veteran
Urgestein
1
Urgestein
1
Urgestein
Urgestein
Urgestein
Urgestein
Mitglied
Urgestein
1
Urgestein
Mitglied
1
Alle Kommentare lesen unter igor´sLAB Community →