summaryrefslogtreecommitdiff
path: root/linux-core
diff options
context:
space:
mode:
Diffstat (limited to 'linux-core')
-rw-r--r--linux-core/drm_bo.c21
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;