Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c4670ad0 authored by Chris Wilson's avatar Chris Wilson Committed by Daniel Vetter
Browse files

drm/i915: Add some sanity checks to unbound tracking



A pair of universally true checks that just need to be put in the right
place depending on where in the patch sequence you go. Note that
i915_gem_object_put_pages_gtt() already gains the
BUG_ON(obj->gtt_space), but on reflection that needed to migrate to
put_pages().

Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 6c085a72
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -1378,6 +1378,8 @@ i915_gem_object_put_pages_gtt(struct drm_i915_gem_object *obj)
	int page_count = obj->base.size / PAGE_SIZE;
	int page_count = obj->base.size / PAGE_SIZE;
	int ret, i;
	int ret, i;


	BUG_ON(obj->gtt_space);

	if (obj->pages == NULL)
	if (obj->pages == NULL)
		return 0;
		return 0;


@@ -2293,6 +2295,8 @@ i915_gem_object_unbind(struct drm_i915_gem_object *obj)
	if (obj->pin_count)
	if (obj->pin_count)
		return -EBUSY;
		return -EBUSY;


	BUG_ON(obj->pages == NULL);

	ret = i915_gem_object_finish_gpu(obj);
	ret = i915_gem_object_finish_gpu(obj);
	if (ret)
	if (ret)
		return ret;
		return ret;