diff options
author | Thomas Hellstrom <thomas-at-tungstengraphics-dot-com> | 2007-11-06 09:47:57 +0100 |
---|---|---|
committer | Thomas Hellstrom <thomas-at-tungstengraphics-dot-com> | 2007-11-06 09:47:57 +0100 |
commit | 40fb079aebae4277813e6a32e2e93c81dc0038e3 (patch) | |
tree | c0a5bf749cfc24b4b643d22413e8457b23880c6c | |
parent | 20eecf2b884193d865419312290b2bb9f94ebf37 (diff) |
Avoid buffers not ending up on a list in some cases.
-rw-r--r-- | linux-core/drm_bo.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/linux-core/drm_bo.c b/linux-core/drm_bo.c index 6bfc6df5..b1077987 100644 --- a/linux-core/drm_bo.c +++ b/linux-core/drm_bo.c @@ -1331,16 +1331,25 @@ int drm_bo_move_buffer(struct drm_buffer_object *bo, uint64_t new_mem_flags, ret = drm_bo_handle_move_mem(bo, &mem, 0, no_wait); out_unlock: + mutex_lock(&dev->struct_mutex); if (ret || !move_unfenced) { - mutex_lock(&dev->struct_mutex); if (mem.mm_node) { if (mem.mm_node != bo->pinned_node) drm_mm_put_block(mem.mm_node); mem.mm_node = NULL; } - mutex_unlock(&dev->struct_mutex); + drm_bo_add_to_lru(bo); + if (bo->priv_flags & _DRM_BO_FLAG_UNFENCED) { + DRM_WAKEUP(&bo->event_queue); + DRM_FLAG_MASKED(bo->priv_flags, 0, + _DRM_BO_FLAG_UNFENCED); + } + } else { + list_add_tail(&bo->lru, &bm->unfenced); + DRM_FLAG_MASKED(bo->priv_flags, _DRM_BO_FLAG_UNFENCED, + _DRM_BO_FLAG_UNFENCED); } - + mutex_unlock(&dev->struct_mutex); mutex_unlock(&bm->evict_mutex); return ret; } |