diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2016-08-04 02:52:44 -0400 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2016-08-04 03:09:32 -0400 |
commit | b0decaf75bd902a11c932005c88924947ac00b8c (patch) | |
tree | fe69c80e77949921947ea4340cfe445b4c7649f3 /drivers/gpu/drm/i915/i915_gem_gtt.h | |
parent | 5cf3d28098695f4e0641f164367ebb821185789b (diff) |
drm/i915: Track active vma requests
Hook the vma itself into the i915_gem_request_retire() so that we can
accurately track when a solitary vma is inactive (as opposed to having
to wait for the entire object to be idle). This improves the interaction
when using multiple contexts (with full-ppgtt) and eliminates some
frequent list walking when retiring objects after a completed request.
A side-effect is that we get an active vma reference for free. The
consequence of this is shown in the next patch...
v2: Update inline names to be consistent with
i915_gem_object_get_active()
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1470293567-10811-25-git-send-email-chris@chris-wilson.co.uk
Diffstat (limited to 'drivers/gpu/drm/i915/i915_gem_gtt.h')
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem_gtt.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.h b/drivers/gpu/drm/i915/i915_gem_gtt.h index cf8e3fc0692d..bfd3c112e33c 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.h +++ b/drivers/gpu/drm/i915/i915_gem_gtt.h | |||
@@ -36,6 +36,8 @@ | |||
36 | 36 | ||
37 | #include <linux/io-mapping.h> | 37 | #include <linux/io-mapping.h> |
38 | 38 | ||
39 | #include "i915_gem_request.h" | ||
40 | |||
39 | struct drm_i915_file_private; | 41 | struct drm_i915_file_private; |
40 | 42 | ||
41 | typedef uint32_t gen6_pte_t; | 43 | typedef uint32_t gen6_pte_t; |
@@ -179,6 +181,9 @@ struct i915_vma { | |||
179 | struct i915_address_space *vm; | 181 | struct i915_address_space *vm; |
180 | void __iomem *iomap; | 182 | void __iomem *iomap; |
181 | 183 | ||
184 | unsigned int active; | ||
185 | struct i915_gem_active last_read[I915_NUM_ENGINES]; | ||
186 | |||
182 | /** Flags and address space this VMA is bound to */ | 187 | /** Flags and address space this VMA is bound to */ |
183 | #define GLOBAL_BIND (1<<0) | 188 | #define GLOBAL_BIND (1<<0) |
184 | #define LOCAL_BIND (1<<1) | 189 | #define LOCAL_BIND (1<<1) |
@@ -222,6 +227,34 @@ struct i915_vma { | |||
222 | #define DRM_I915_GEM_OBJECT_MAX_PIN_COUNT 0xf | 227 | #define DRM_I915_GEM_OBJECT_MAX_PIN_COUNT 0xf |
223 | }; | 228 | }; |
224 | 229 | ||
230 | static inline unsigned int i915_vma_get_active(const struct i915_vma *vma) | ||
231 | { | ||
232 | return vma->active; | ||
233 | } | ||
234 | |||
235 | static inline bool i915_vma_is_active(const struct i915_vma *vma) | ||
236 | { | ||
237 | return i915_vma_get_active(vma); | ||
238 | } | ||
239 | |||
240 | static inline void i915_vma_set_active(struct i915_vma *vma, | ||
241 | unsigned int engine) | ||
242 | { | ||
243 | vma->active |= BIT(engine); | ||
244 | } | ||
245 | |||
246 | static inline void i915_vma_clear_active(struct i915_vma *vma, | ||
247 | unsigned int engine) | ||
248 | { | ||
249 | vma->active &= ~BIT(engine); | ||
250 | } | ||
251 | |||
252 | static inline bool i915_vma_has_active_engine(const struct i915_vma *vma, | ||
253 | unsigned int engine) | ||
254 | { | ||
255 | return vma->active & BIT(engine); | ||
256 | } | ||
257 | |||
225 | struct i915_page_dma { | 258 | struct i915_page_dma { |
226 | struct page *page; | 259 | struct page *page; |
227 | union { | 260 | union { |