提交 401c29f6 编写于 作者: B Ben Widawsky 提交者: Daniel Vetter

drm/i915: unpin pages at unbind

If we properly keep track of the pages_pin_count, then when we later add
multiple address spaces, the put_pages doesn't need any special checks
to be able to perform it's job.

CC: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
[danvet: Rebased on top of the fix for stolen memory pinning.]
Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
上级 1d64ae71
...@@ -2511,6 +2511,7 @@ i915_gem_object_unbind(struct drm_i915_gem_object *obj) ...@@ -2511,6 +2511,7 @@ i915_gem_object_unbind(struct drm_i915_gem_object *obj)
obj->has_aliasing_ppgtt_mapping = 0; obj->has_aliasing_ppgtt_mapping = 0;
} }
i915_gem_gtt_finish_object(obj); i915_gem_gtt_finish_object(obj);
i915_gem_object_unpin_pages(obj);
list_del(&obj->mm_list); list_del(&obj->mm_list);
list_move_tail(&obj->gtt_list, &dev_priv->mm.unbound_list); list_move_tail(&obj->gtt_list, &dev_priv->mm.unbound_list);
...@@ -3060,7 +3061,6 @@ i915_gem_object_bind_to_gtt(struct drm_i915_gem_object *obj, ...@@ -3060,7 +3061,6 @@ i915_gem_object_bind_to_gtt(struct drm_i915_gem_object *obj,
obj->map_and_fenceable = mappable && fenceable; obj->map_and_fenceable = mappable && fenceable;
i915_gem_object_unpin_pages(obj);
trace_i915_gem_object_bind(obj, map_and_fenceable); trace_i915_gem_object_bind(obj, map_and_fenceable);
i915_gem_verify_gtt(dev); i915_gem_verify_gtt(dev);
return 0; return 0;
...@@ -3865,7 +3865,8 @@ void i915_gem_free_object(struct drm_gem_object *gem_obj) ...@@ -3865,7 +3865,8 @@ void i915_gem_free_object(struct drm_gem_object *gem_obj)
if (obj->stolen) if (obj->stolen)
i915_gem_object_unpin_pages(obj); i915_gem_object_unpin_pages(obj);
obj->pages_pin_count = 0; if (WARN_ON(obj->pages_pin_count))
obj->pages_pin_count = 0;
i915_gem_object_put_pages(obj); i915_gem_object_put_pages(obj);
i915_gem_object_free_mmap_offset(obj); i915_gem_object_free_mmap_offset(obj);
i915_gem_object_release_stolen(obj); i915_gem_object_release_stolen(obj);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册