diff options
author | Thomas Hellstrom <thomas-at-tungstengraphics-dot-com> | 2007-02-09 12:43:18 +0100 |
---|---|---|
committer | Thomas Hellstrom <thomas-at-tungstengraphics-dot-com> | 2007-02-09 12:43:18 +0100 |
commit | 57df3980724d3da446c4576b3fadcd89c5da414e (patch) | |
tree | 617f103e52f8d841a7627f876d7aa0dfeef6aca1 /linux-core | |
parent | d32b21e016c371b8676f42da5fc3aeded039a6c8 (diff) |
Reinstate some LRU handling.
Diffstat (limited to 'linux-core')
-rw-r--r-- | linux-core/drm_bo.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/linux-core/drm_bo.c b/linux-core/drm_bo.c index 3339d5a8..8d2b544e 100644 --- a/linux-core/drm_bo.c +++ b/linux-core/drm_bo.c @@ -1145,6 +1145,7 @@ static void drm_buffer_user_object_unmap(drm_file_t * priv, /* * bo->mutex locked. + * Note that new_mem_flags are NOT transferred to the bo->mem.mask. */ static int drm_bo_move_buffer(drm_buffer_object_t * bo, uint32_t new_mem_flags, @@ -1200,6 +1201,7 @@ static int drm_bo_move_buffer(drm_buffer_object_t * bo, uint32_t new_mem_flags, mem.mm_node = NULL; } DRM_FLAG_MASKED(bo->priv_flags, 0, _DRM_BO_FLAG_UNFENCED); + DRM_WAKEUP(&bo->event_queue); list_del(&bo->lru); drm_bo_add_to_lru(bo, bm); mutex_unlock(&dev->struct_mutex); @@ -1329,6 +1331,25 @@ static int drm_buffer_object_validate(drm_buffer_object_t * bo, return ret; } + /* + * Adjust lru to be sure. + */ + + mutex_lock(&dev->struct_mutex); + list_del(&bo->lru); + if (move_unfenced) { + list_add_tail(&bo->lru, &bm->unfenced); + DRM_FLAG_MASKED(bo->priv_flags, _DRM_BO_FLAG_UNFENCED, + _DRM_BO_FLAG_UNFENCED); + } else { + drm_bo_add_to_lru(bo, bm); + if (bo->priv_flags & _DRM_BO_FLAG_UNFENCED) { + DRM_WAKEUP(&bo->event_queue); + DRM_FLAG_MASKED(bo->priv_flags, 0, _DRM_BO_FLAG_UNFENCED); + } + } + mutex_unlock(&dev->struct_mutex); + DRM_FLAG_MASKED(bo->mem.flags, bo->mem.mask, ~DRM_BO_MASK_MEMTYPE); return 0; |