|
30 | 30 | #include "i915_trace.h"
|
31 | 31 | #include "intel_drv.h"
|
32 | 32 |
|
| 33 | +/** |
| 34 | + * DOC: Global GTT views |
| 35 | + * |
| 36 | + * Background and previous state |
| 37 | + * |
| 38 | + * Historically objects could exists (be bound) in global GTT space only as |
| 39 | + * singular instances with a view representing all of the object's backing pages |
| 40 | + * in a linear fashion. This view will be called a normal view. |
| 41 | + * |
| 42 | + * To support multiple views of the same object, where the number of mapped |
| 43 | + * pages is not equal to the backing store, or where the layout of the pages |
| 44 | + * is not linear, concept of a GGTT view was added. |
| 45 | + * |
| 46 | + * One example of an alternative view is a stereo display driven by a single |
| 47 | + * image. In this case we would have a framebuffer looking like this |
| 48 | + * (2x2 pages): |
| 49 | + * |
| 50 | + * 12 |
| 51 | + * 34 |
| 52 | + * |
| 53 | + * Above would represent a normal GGTT view as normally mapped for GPU or CPU |
| 54 | + * rendering. In contrast, fed to the display engine would be an alternative |
| 55 | + * view which could look something like this: |
| 56 | + * |
| 57 | + * 1212 |
| 58 | + * 3434 |
| 59 | + * |
| 60 | + * In this example both the size and layout of pages in the alternative view is |
| 61 | + * different from the normal view. |
| 62 | + * |
| 63 | + * Implementation and usage |
| 64 | + * |
| 65 | + * GGTT views are implemented using VMAs and are distinguished via enum |
| 66 | + * i915_ggtt_view_type and struct i915_ggtt_view. |
| 67 | + * |
| 68 | + * A new flavour of core GEM functions which work with GGTT bound objects were |
| 69 | + * added with the _view suffix. They take the struct i915_ggtt_view parameter |
| 70 | + * encapsulating all metadata required to implement a view. |
| 71 | + * |
| 72 | + * As a helper for callers which are only interested in the normal view, |
| 73 | + * globally const i915_ggtt_view_normal singleton instance exists. All old core |
| 74 | + * GEM API functions, the ones not taking the view parameter, are operating on, |
| 75 | + * or with the normal GGTT view. |
| 76 | + * |
| 77 | + * Code wanting to add or use a new GGTT view needs to: |
| 78 | + * |
| 79 | + * 1. Add a new enum with a suitable name. |
| 80 | + * 2. Extend the metadata in the i915_ggtt_view structure if required. |
| 81 | + * 3. Add support to i915_get_vma_pages(). |
| 82 | + * |
| 83 | + * New views are required to build a scatter-gather table from within the |
| 84 | + * i915_get_vma_pages function. This table is stored in the vma.ggtt_view and |
| 85 | + * exists for the lifetime of an VMA. |
| 86 | + * |
| 87 | + * Core API is designed to have copy semantics which means that passed in |
| 88 | + * struct i915_ggtt_view does not need to be persistent (left around after |
| 89 | + * calling the core API functions). |
| 90 | + * |
| 91 | + */ |
| 92 | + |
33 | 93 | const struct i915_ggtt_view i915_ggtt_view_normal;
|
34 | 94 |
|
35 | 95 | static void bdw_setup_private_ppat(struct drm_i915_private *dev_priv);
|
|
0 commit comments