summaryrefslogtreecommitdiff
path: root/linux-core
diff options
context:
space:
mode:
Diffstat (limited to 'linux-core')
-rw-r--r--linux-core/drm_bo.c7
-rw-r--r--linux-core/drm_bo_lock.c10
2 files changed, 9 insertions, 8 deletions
diff --git a/linux-core/drm_bo.c b/linux-core/drm_bo.c
index 0853d748..6f287532 100644
--- a/linux-core/drm_bo.c
+++ b/linux-core/drm_bo.c
@@ -1244,6 +1244,7 @@ static int drm_buffer_object_map(struct drm_file *file_priv, uint32_t handle,
mutex_unlock(&bo->mutex);
drm_bo_usage_deref_unlocked(&bo);
+
return ret;
}
@@ -1541,8 +1542,9 @@ static int drm_bo_prepare_for_validate(struct drm_buffer_object *bo,
ftype,
no_wait);
}
- if (ret && ret != -EAGAIN)
+ if (ret && ret != -EAGAIN)
ret = drm_bo_wait(bo, 0, 1, no_wait, 1);
+
if (ret)
return ret;
}
@@ -1622,6 +1624,7 @@ out:
drm_bo_fill_rep_arg(bo, rep);
mutex_unlock(&bo->mutex);
+
return ret;
}
EXPORT_SYMBOL(drm_bo_do_validate);
@@ -1816,7 +1819,7 @@ int drm_buffer_object_create(struct drm_device *dev,
}
mutex_unlock(&bo->mutex);
- ret = drm_bo_do_validate(bo, 0, 0, hint & DRM_BO_HINT_DONT_BLOCK,
+ ret = drm_bo_do_validate(bo, 0, 0, hint | DRM_BO_HINT_DONT_FENCE,
0, NULL);
if (ret)
goto out_err_unlocked;
diff --git a/linux-core/drm_bo_lock.c b/linux-core/drm_bo_lock.c
index 32ebfbe2..08b1c6be 100644
--- a/linux-core/drm_bo_lock.c
+++ b/linux-core/drm_bo_lock.c
@@ -68,9 +68,7 @@ void drm_bo_init_lock(struct drm_bo_lock *lock)
void drm_bo_read_unlock(struct drm_bo_lock *lock)
{
- if (unlikely(atomic_add_negative(-1, &lock->readers)))
- BUG();
- if (atomic_read(&lock->readers) == 0)
+ if (atomic_dec_and_test(&lock->readers))
wake_up_all(&lock->queue);
}
EXPORT_SYMBOL(drm_bo_read_unlock);
@@ -79,7 +77,7 @@ int drm_bo_read_lock(struct drm_bo_lock *lock, int interruptible)
{
while (unlikely(atomic_read(&lock->write_lock_pending) != 0)) {
int ret;
-
+
if (!interruptible) {
wait_event(lock->queue,
atomic_read(&lock->write_lock_pending) == 0);
@@ -93,7 +91,6 @@ int drm_bo_read_lock(struct drm_bo_lock *lock, int interruptible)
while (unlikely(!atomic_add_unless(&lock->readers, 1, -1))) {
int ret;
-
if (!interruptible) {
wait_event(lock->queue,
atomic_read(&lock->readers) != -1);
@@ -156,7 +153,8 @@ int drm_bo_write_lock(struct drm_bo_lock *lock, int interruptible,
* while holding it.
*/
- atomic_dec(&lock->write_lock_pending);
+ if (atomic_dec_and_test(&lock->write_lock_pending))
+ wake_up_all(&lock->queue);
dev = file_priv->minor->dev;
mutex_lock(&dev->struct_mutex);
ret = drm_add_user_object(file_priv, &lock->base, 0);