diff options
author | Joonas Lahtinen <joonas.lahtinen@linux.intel.com> | 2015-03-27 14:09:22 +0300 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2015-03-27 17:05:22 +0300 |
commit | 9abc464854cf12273ebe66dc5e4a9d82b6e0c303 (patch) | |
tree | 0144e08f04e21fb2cd26c8711afb7d628b2c6518 /drivers/gpu/drm/i915/i915_gem.c | |
parent | 2f2cf68261acc4c5356dd07e8a8966612ae5a0d4 (diff) | |
download | linux-9abc464854cf12273ebe66dc5e4a9d82b6e0c303.tar.xz |
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.c')
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index c13e65994654..4ca3dab77fa4 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -4129,7 +4129,7 @@ i915_gem_object_do_pin(struct drm_i915_gem_object *obj, if (i915_vma_misplaced(vma, alignment, flags)) { unsigned long offset; - offset = ggtt_view ? i915_gem_obj_ggtt_offset_view(obj, ggtt_view->type) : + offset = ggtt_view ? i915_gem_obj_ggtt_offset_view(obj, ggtt_view) : i915_gem_obj_offset(obj, vm); WARN(vma->pin_count, "bo is already pinned in %s with incorrect alignment:" @@ -4228,7 +4228,7 @@ i915_gem_object_ggtt_unpin_view(struct drm_i915_gem_object *obj, BUG_ON(!vma); WARN_ON(vma->pin_count == 0); - WARN_ON(!i915_gem_obj_ggtt_bound_view(obj, view->type)); + WARN_ON(!i915_gem_obj_ggtt_bound_view(obj, view)); if (--vma->pin_count == 0 && view->type == I915_GGTT_VIEW_NORMAL) obj->pin_mappable = false; @@ -4550,7 +4550,8 @@ struct i915_vma *i915_gem_obj_to_ggtt_view(struct drm_i915_gem_object *obj, return ERR_PTR(-EINVAL); list_for_each_entry(vma, &obj->vma_list, vma_link) - if (vma->vm == ggtt && vma->ggtt_view.type == view->type) + if (vma->vm == ggtt && + i915_ggtt_view_equal(&vma->ggtt_view, view)) return vma; return NULL; } @@ -5107,13 +5108,14 @@ i915_gem_obj_offset(struct drm_i915_gem_object *o, unsigned long i915_gem_obj_ggtt_offset_view(struct drm_i915_gem_object *o, - enum i915_ggtt_view_type view) + const struct i915_ggtt_view *view) { struct i915_address_space *ggtt = i915_obj_to_ggtt(o); struct i915_vma *vma; list_for_each_entry(vma, &o->vma_list, vma_link) - if (vma->vm == ggtt && vma->ggtt_view.type == view) + if (vma->vm == ggtt && + i915_ggtt_view_equal(&vma->ggtt_view, view)) return vma->node.start; WARN(1, "global vma for this object not found.\n"); @@ -5137,14 +5139,14 @@ bool i915_gem_obj_bound(struct drm_i915_gem_object *o, } bool i915_gem_obj_ggtt_bound_view(struct drm_i915_gem_object *o, - enum i915_ggtt_view_type view) + const struct i915_ggtt_view *view) { struct i915_address_space *ggtt = i915_obj_to_ggtt(o); struct i915_vma *vma; list_for_each_entry(vma, &o->vma_list, vma_link) if (vma->vm == ggtt && - vma->ggtt_view.type == view && + i915_ggtt_view_equal(&vma->ggtt_view, view) && drm_mm_node_allocated(&vma->node)) return true; |