aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_gem_gtt.h
diff options
context:
space:
mode:
authorJoonas Lahtinen <joonas.lahtinen@linux.intel.com>2015-03-27 07:09:22 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2015-03-27 10:05:22 -0400
commit9abc464854cf12273ebe66dc5e4a9d82b6e0c303 (patch)
tree0144e08f04e21fb2cd26c8711afb7d628b2c6518 /drivers/gpu/drm/i915/i915_gem_gtt.h
parent2f2cf68261acc4c5356dd07e8a8966612ae5a0d4 (diff)
drm/i915: Compare GGTT view structs instead of types
To allow for views where the view type is not defined by the view type only, like it is in stereo or rotated 90 degree view, change the semantic to require the whole view structure for comparison when we match a GGTT view. This allows including parameters like offset to be included in the view which is useful for eg. partial views. v3: - Rely on ggtt_view type being 0 for non-GGTT vma's, which equals to I915_GGTT_VIEW_NORMAL. (Daniel Vetter) - Do not use potentially slower comparison when we only want to know if something is or is not a normal view. - Rebase on top of rotated view patches. Add rotated view singleton. - If one view is missing in comparison they're equal only if both are missing. v4: - Use comparison helper in obj_to_ggtt_view too. (Tvrtko Ursulin) - Do WARN_ON if one view is NULL. (Tvrtko Ursulin) Cc: Daniel Vetter <daniel@ffwll.ch> Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_gem_gtt.h')
-rw-r--r--drivers/gpu/drm/i915/i915_gem_gtt.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.h b/drivers/gpu/drm/i915/i915_gem_gtt.h
index 3f0ad9f25441..fc03c99317c9 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.h
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.h
@@ -138,6 +138,7 @@ struct i915_ggtt_view {
138}; 138};
139 139
140extern const struct i915_ggtt_view i915_ggtt_view_normal; 140extern const struct i915_ggtt_view i915_ggtt_view_normal;
141extern const struct i915_ggtt_view i915_ggtt_view_rotated;
141 142
142enum i915_cache_level; 143enum i915_cache_level;
143 144
@@ -424,4 +425,14 @@ void i915_gem_restore_gtt_mappings(struct drm_device *dev);
424int __must_check i915_gem_gtt_prepare_object(struct drm_i915_gem_object *obj); 425int __must_check i915_gem_gtt_prepare_object(struct drm_i915_gem_object *obj);
425void i915_gem_gtt_finish_object(struct drm_i915_gem_object *obj); 426void i915_gem_gtt_finish_object(struct drm_i915_gem_object *obj);
426 427
428static inline bool
429i915_ggtt_view_equal(const struct i915_ggtt_view *a,
430 const struct i915_ggtt_view *b)
431{
432 if (WARN_ON(!a || !b))
433 return false;
434
435 return a->type == b->type;
436}
437
427#endif 438#endif