diff options
-rw-r--r-- | linux-core/drmP.h | 4 | ||||
-rw-r--r-- | linux-core/drm_memrange.c | 27 | ||||
-rw-r--r-- | linux-core/i915_gem.c | 40 |
3 files changed, 15 insertions, 56 deletions
diff --git a/linux-core/drmP.h b/linux-core/drmP.h index 21a4dcd0..ffeafc18 100644 --- a/linux-core/drmP.h +++ b/linux-core/drmP.h @@ -1315,10 +1315,6 @@ extern int drm_memrange_remove_space_from_tail(struct drm_memrange *mm, unsigned long size); extern int drm_memrange_add_space_to_tail(struct drm_memrange *mm, unsigned long size); -extern int drm_memrange_for_each(struct drm_memrange *mm, - int (*callback)(struct drm_memrange_node *node, - void *data), - void *data); static inline struct drm_memrange *drm_get_mm(struct drm_memrange_node *block) { diff --git a/linux-core/drm_memrange.c b/linux-core/drm_memrange.c index 7304cbaa..7014c4e2 100644 --- a/linux-core/drm_memrange.c +++ b/linux-core/drm_memrange.c @@ -275,33 +275,6 @@ int drm_memrange_init(struct drm_memrange * mm, unsigned long start, unsigned lo return drm_memrange_create_tail_node(mm, start, size); } -/** - * Walks the list of allocated memory ranges and calls the callback on - * one. - */ -int drm_memrange_for_each(struct drm_memrange *mm, - int (*callback)(struct drm_memrange_node *node, - void *data), - void *data) -{ - struct list_head *list, *next; - - list_for_each_safe(list, next, &mm->ml_entry) { - struct drm_memrange_node *cur; - int ret; - - cur = list_entry(list, struct drm_memrange_node, ml_entry); - if (!cur->free) { - ret = callback(cur, data); - if (ret != 0) - return ret; - } - } - - return 0; -} -EXPORT_SYMBOL(drm_memrange_for_each); - EXPORT_SYMBOL(drm_memrange_init); void drm_memrange_takedown(struct drm_memrange * mm) diff --git a/linux-core/i915_gem.c b/linux-core/i915_gem.c index 8d606f85..fabbaf9b 100644 --- a/linux-core/i915_gem.c +++ b/linux-core/i915_gem.c @@ -290,36 +290,17 @@ i915_gem_reloc_and_validate_object(struct drm_gem_object *obj, } static int -evict_callback(struct drm_memrange_node *node, void *data) -{ - struct drm_gem_object *obj = node->private; - struct drm_i915_gem_object *obj_priv = obj->driver_private; - - if (obj_priv->pin_count == 0) - i915_gem_object_unbind(obj); - - return 0; -} - -static int -i915_gem_sync_and_evict(struct drm_device *dev) +i915_gem_sync(struct drm_device *dev) { drm_i915_private_t *dev_priv = dev->dev_private; - int ret; RING_LOCALS; BEGIN_LP_RING(2); OUT_RING(CMD_MI_FLUSH | MI_READ_FLUSH | MI_EXE_FLUSH); OUT_RING(0); /* noop */ ADVANCE_LP_RING(); - ret = i915_quiescent(dev); - if (ret != 0) - return ret; - /* Evict everything so we have space for sure. */ - drm_memrange_for_each(&dev_priv->mm.gtt_space, evict_callback, NULL); - - return 0; + return i915_quiescent(dev); } static int @@ -407,9 +388,9 @@ i915_gem_execbuffer(struct drm_device *dev, void *data, /* Big hammer: flush and idle the hardware so we can map things in/out. */ - ret = i915_gem_sync_and_evict(dev); + ret = i915_gem_sync(dev); if (ret != 0) { - DRM_ERROR ("i915_gem_sync_and_evict failed %d\n", ret); + DRM_ERROR ("i915_gem_sync failed %d\n", ret); return ret; } @@ -474,9 +455,18 @@ i915_gem_execbuffer(struct drm_device *dev, void *data, args->buffer_count, ret); /* Clean up and return */ - ret = i915_gem_sync_and_evict(dev); + ret = i915_gem_sync(dev); if (ret) - DRM_ERROR ("failed to sync/evict buffers %d\n", ret); + DRM_ERROR ("failed to sync %d\n", ret); + + /* Evict all the buffers we moved in, leaving room for the next guy. */ + for (i = 0; i < args->buffer_count; i++) { + struct drm_gem_object *obj = object_list[i]; + struct drm_i915_gem_object *obj_priv = obj->driver_private; + + if (obj_priv->pin_count == 0) + i915_gem_object_unbind(obj); + } err: if (object_list != NULL) { for (i = 0; i < args->buffer_count; i++) |