Commit a907a2e7 authored by Dave Airlie's avatar Dave Airlie

Merge branch 'drm-intel-lru' into drm-testing

* drm-intel-lru:
  drm: implement helper functions for scanning lru list
  drm_mm: extract check_free_mm_node
  drm: sane naming for drm_mm.c
  drm: kill dead code in drm_mm.c
  drm: kill drm_mm_node->private
  drm: use list_for_each_entry in drm_mm.c
parents db8cc27b 709ea971
This diff is collapsed.
...@@ -2633,11 +2633,9 @@ i915_gem_object_bind_to_gtt(struct drm_gem_object *obj, unsigned alignment) ...@@ -2633,11 +2633,9 @@ i915_gem_object_bind_to_gtt(struct drm_gem_object *obj, unsigned alignment)
if (free_space != NULL) { if (free_space != NULL) {
obj_priv->gtt_space = drm_mm_get_block(free_space, obj->size, obj_priv->gtt_space = drm_mm_get_block(free_space, obj->size,
alignment); alignment);
if (obj_priv->gtt_space != NULL) { if (obj_priv->gtt_space != NULL)
obj_priv->gtt_space->private = obj;
obj_priv->gtt_offset = obj_priv->gtt_space->start; obj_priv->gtt_offset = obj_priv->gtt_space->start;
} }
}
if (obj_priv->gtt_space == NULL) { if (obj_priv->gtt_space == NULL) {
/* If the gtt is empty and we're still having trouble /* If the gtt is empty and we're still having trouble
* fitting our object in, we're out of memory. * fitting our object in, we're out of memory.
......
...@@ -476,7 +476,6 @@ static int ttm_bo_cleanup_refs(struct ttm_buffer_object *bo, bool remove_all) ...@@ -476,7 +476,6 @@ static int ttm_bo_cleanup_refs(struct ttm_buffer_object *bo, bool remove_all)
++put_count; ++put_count;
} }
if (bo->mem.mm_node) { if (bo->mem.mm_node) {
bo->mem.mm_node->private = NULL;
drm_mm_put_block(bo->mem.mm_node); drm_mm_put_block(bo->mem.mm_node);
bo->mem.mm_node = NULL; bo->mem.mm_node = NULL;
} }
...@@ -670,7 +669,6 @@ static int ttm_bo_evict(struct ttm_buffer_object *bo, bool interruptible, ...@@ -670,7 +669,6 @@ static int ttm_bo_evict(struct ttm_buffer_object *bo, bool interruptible,
printk(KERN_ERR TTM_PFX "Buffer eviction failed\n"); printk(KERN_ERR TTM_PFX "Buffer eviction failed\n");
spin_lock(&glob->lru_lock); spin_lock(&glob->lru_lock);
if (evict_mem.mm_node) { if (evict_mem.mm_node) {
evict_mem.mm_node->private = NULL;
drm_mm_put_block(evict_mem.mm_node); drm_mm_put_block(evict_mem.mm_node);
evict_mem.mm_node = NULL; evict_mem.mm_node = NULL;
} }
...@@ -929,8 +927,6 @@ int ttm_bo_mem_space(struct ttm_buffer_object *bo, ...@@ -929,8 +927,6 @@ int ttm_bo_mem_space(struct ttm_buffer_object *bo,
mem->mm_node = node; mem->mm_node = node;
mem->mem_type = mem_type; mem->mem_type = mem_type;
mem->placement = cur_flags; mem->placement = cur_flags;
if (node)
node->private = bo;
return 0; return 0;
} }
...@@ -973,7 +969,6 @@ int ttm_bo_mem_space(struct ttm_buffer_object *bo, ...@@ -973,7 +969,6 @@ int ttm_bo_mem_space(struct ttm_buffer_object *bo,
interruptible, no_wait_reserve, no_wait_gpu); interruptible, no_wait_reserve, no_wait_gpu);
if (ret == 0 && mem->mm_node) { if (ret == 0 && mem->mm_node) {
mem->placement = cur_flags; mem->placement = cur_flags;
mem->mm_node->private = bo;
return 0; return 0;
} }
if (ret == -ERESTARTSYS) if (ret == -ERESTARTSYS)
...@@ -1029,7 +1024,6 @@ int ttm_bo_move_buffer(struct ttm_buffer_object *bo, ...@@ -1029,7 +1024,6 @@ int ttm_bo_move_buffer(struct ttm_buffer_object *bo,
out_unlock: out_unlock:
if (ret && mem.mm_node) { if (ret && mem.mm_node) {
spin_lock(&glob->lru_lock); spin_lock(&glob->lru_lock);
mem.mm_node->private = NULL;
drm_mm_put_block(mem.mm_node); drm_mm_put_block(mem.mm_node);
spin_unlock(&glob->lru_lock); spin_unlock(&glob->lru_lock);
} }
......
...@@ -353,8 +353,6 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo, ...@@ -353,8 +353,6 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo,
fbo->vm_node = NULL; fbo->vm_node = NULL;
fbo->sync_obj = driver->sync_obj_ref(bo->sync_obj); fbo->sync_obj = driver->sync_obj_ref(bo->sync_obj);
if (fbo->mem.mm_node)
fbo->mem.mm_node->private = (void *)fbo;
kref_init(&fbo->list_kref); kref_init(&fbo->list_kref);
kref_init(&fbo->kref); kref_init(&fbo->kref);
fbo->destroy = &ttm_transfered_destroy; fbo->destroy = &ttm_transfered_destroy;
......
...@@ -42,21 +42,31 @@ ...@@ -42,21 +42,31 @@
#endif #endif
struct drm_mm_node { struct drm_mm_node {
struct list_head fl_entry; struct list_head free_stack;
struct list_head ml_entry; struct list_head node_list;
int free; unsigned free : 1;
unsigned scanned_block : 1;
unsigned scanned_prev_free : 1;
unsigned scanned_next_free : 1;
unsigned long start; unsigned long start;
unsigned long size; unsigned long size;
struct drm_mm *mm; struct drm_mm *mm;
void *private;
}; };
struct drm_mm { struct drm_mm {
struct list_head fl_entry; /* List of free memory blocks, most recently freed ordered. */
struct list_head ml_entry; struct list_head free_stack;
/* List of all memory nodes, ordered according to the (increasing) start
* address of the memory node. */
struct list_head node_list;
struct list_head unused_nodes; struct list_head unused_nodes;
int num_unused; int num_unused;
spinlock_t unused_lock; spinlock_t unused_lock;
unsigned scan_alignment;
unsigned long scan_size;
unsigned long scan_hit_start;
unsigned scan_hit_size;
unsigned scanned_blocks;
}; };
/* /*
...@@ -133,6 +143,11 @@ static inline struct drm_mm *drm_get_mm(struct drm_mm_node *block) ...@@ -133,6 +143,11 @@ static inline struct drm_mm *drm_get_mm(struct drm_mm_node *block)
return block->mm; return block->mm;
} }
void drm_mm_init_scan(struct drm_mm *mm, unsigned long size,
unsigned alignment);
int drm_mm_scan_add_block(struct drm_mm_node *node);
int drm_mm_scan_remove_block(struct drm_mm_node *node);
extern void drm_mm_debug_table(struct drm_mm *mm, const char *prefix); extern void drm_mm_debug_table(struct drm_mm *mm, const char *prefix);
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
int drm_mm_dump_table(struct seq_file *m, struct drm_mm *mm); int drm_mm_dump_table(struct seq_file *m, struct drm_mm *mm);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment