Skip to content

Commit 45f8f69

Browse files
tursulindanvet
authored andcommitted
drm/i915: Documentation for multiple GGTT views
A short section describing background, implementation and intended usage. v2: * Align section name between template and DOC comment. (Michel Thierry) For: VIZ-4544 Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Michel Thierry <michel.thierry@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
1 parent fe14d5f commit 45f8f69

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed

Documentation/DocBook/drm.tmpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4038,6 +4038,11 @@ int num_ioctls;</synopsis>
40384038
!Pdrivers/gpu/drm/i915/intel_lrc.c Logical Rings, Logical Ring Contexts and Execlists
40394039
!Idrivers/gpu/drm/i915/intel_lrc.c
40404040
</sect2>
4041+
<sect2>
4042+
<title>Global GTT views</title>
4043+
!Pdrivers/gpu/drm/i915/i915_gem_gtt.c Global GTT views
4044+
!Idrivers/gpu/drm/i915/i915_gem_gtt.c
4045+
</sect2>
40414046
</sect1>
40424047

40434048
<sect1>

drivers/gpu/drm/i915/i915_gem_gtt.c

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,66 @@
3030
#include "i915_trace.h"
3131
#include "intel_drv.h"
3232

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+
3393
const struct i915_ggtt_view i915_ggtt_view_normal;
3494

3595
static void bdw_setup_private_ppat(struct drm_i915_private *dev_priv);

0 commit comments

Comments
 (0)