| 1 |
SandyBridge's New Acceleration |
| 2 |
------------------------------ |
| 3 |
|
| 4 |
The guiding principle behind the design is to avoid GPU context switches. |
| 5 |
On SandyBridge (and beyond), these are especially pernicious because the |
| 6 |
RENDER and BLT engine are now on different rings and require |
| 7 |
synchronisation of the various execution units when switching contexts. |
| 8 |
They were not cheap on early generation, but with the increasing |
| 9 |
complexity of the GPU, avoiding such serialisations is important. |
| 10 |
|
| 11 |
Furthermore, we try very hard to avoid migrating between the CPU and GPU. |
| 12 |
Every pixmap (apart from temporary "scratch" surfaces which we intend to |
| 13 |
use on the GPU) is created in system memory. All operations are then done |
| 14 |
upon this shadow copy until we are forced to move it onto the GPU. Such |
| 15 |
migration can only be first triggered by: setting the pixmap as the |
| 16 |
scanout (we obviously need a GPU buffer here), using the pixmap as a DRI |
| 17 |
buffer (the client expects to perform hardware acceleration and we do not |
| 18 |
want to disappoint) and lastly using the pixmap as a RENDER target. This |
| 19 |
last is chosen because when we know we are going to perform hardware |
| 20 |
acceleration and will continue to do so without fallbacks, using the GPU |
| 21 |
is much, much faster than the CPU. The heuristic I chose therefore was |
| 22 |
that if the application uses RENDER, i.e. cairo, then it will only be |
| 23 |
using those paths and not intermixing core drawing operations and so |
| 24 |
unlikely to trigger a fallback. |
| 25 |
|
| 26 |
The complicating case is front-buffer rendering. So in order to accommodate |
| 27 |
using RENDER on an application whilst running xterm without a composite |
| 28 |
manager redirecting all the pixmaps to backing surfaces, we have to |
| 29 |
perform damage tracking to avoid excess migration of portions of the |
| 30 |
buffer. |