summaryrefslogtreecommitdiff
path: root/linux-core
diff options
context:
space:
mode:
authorDave Airlie <airlied@airlied2.(none)>2007-04-18 14:11:49 +1000
committerDave Airlie <airlied@airlied2.(none)>2007-04-18 14:11:49 +1000
commite46e028bd21552331ca4db409c2b45e54491ced6 (patch)
treebb80819c26bbfd9d6d7bcb92a216627b2b30e095 /linux-core
parentc71c44bb9288e0bf1b319ec19a2e25f4467d9583 (diff)
parent5a96d59ce9d9ad5816e2d0e195afa9902445f594 (diff)
Merge branch 'origin' into modesetting-101
Conflicts: linux-core/drm_bo.c Merge in changes from master from Thomas fixiing TTM problems
Diffstat (limited to 'linux-core')
-rw-r--r--linux-core/drm_bo.c45
1 files changed, 17 insertions, 28 deletions
diff --git a/linux-core/drm_bo.c b/linux-core/drm_bo.c
index d6dce10a..27016d8c 100644
--- a/linux-core/drm_bo.c
+++ b/linux-core/drm_bo.c
@@ -1039,30 +1039,23 @@ static int drm_bo_wait_unfenced(drm_buffer_object_t * bo, int no_wait,
int eagain_if_wait)
{
int ret = (bo->priv_flags & _DRM_BO_FLAG_UNFENCED);
- unsigned long _end = jiffies + 3 * DRM_HZ;
if (ret && no_wait)
return -EBUSY;
else if (!ret)
return 0;
- do {
- mutex_unlock(&bo->mutex);
- DRM_WAIT_ON(ret, bo->event_queue, 3 * DRM_HZ,
- !drm_bo_check_unfenced(bo));
- mutex_lock(&bo->mutex);
- if (ret == -EINTR)
- return -EAGAIN;
- if (ret) {
- DRM_ERROR
- ("Error waiting for buffer to become fenced\n");
- return ret;
- }
- ret = (bo->priv_flags & _DRM_BO_FLAG_UNFENCED);
- } while (ret && !time_after_eq(jiffies, _end));
+ ret = 0;
+ mutex_unlock(&bo->mutex);
+ DRM_WAIT_ON(ret, bo->event_queue, 3 * DRM_HZ,
+ !drm_bo_check_unfenced(bo));
+ mutex_lock(&bo->mutex);
+ if (ret == -EINTR)
+ return -EAGAIN;
+ ret = (bo->priv_flags & _DRM_BO_FLAG_UNFENCED);
if (ret) {
DRM_ERROR("Timeout waiting for buffer to become fenced\n");
- return ret;
+ return -EBUSY;
}
if (eagain_if_wait)
return -EAGAIN;
@@ -1421,7 +1414,10 @@ static int drm_buffer_object_validate(drm_buffer_object_t * bo,
} else if (bo->pinned_node != NULL) {
mutex_lock(&dev->struct_mutex);
- drm_mm_put_block(bo->pinned_node);
+
+ if (bo->pinned_node != bo->mem.mm_node)
+ drm_mm_put_block(bo->pinned_node);
+
list_del_init(&bo->pinned_lru);
bo->pinned_node = NULL;
mutex_unlock(&dev->struct_mutex);
@@ -1684,6 +1680,9 @@ int drm_bo_ioctl(DRM_IOCTL_ARGS)
rep.ret = 0;
switch (req->op) {
case drm_bo_create:
+ rep.ret = drm_bo_lock_test(dev, filp);
+ if (rep.ret)
+ break;
rep.ret =
drm_buffer_object_create(priv->head->dev,
req->size,
@@ -1735,17 +1734,7 @@ int drm_bo_ioctl(DRM_IOCTL_ARGS)
drm_buffer_type, &uo);
if (rep.ret)
break;
- mutex_lock(&dev->struct_mutex);
- uo = drm_lookup_user_object(priv, req->handle);
- entry =
- drm_user_object_entry(uo, drm_buffer_object_t,
- base);
- /* I don't think this is needed - D.A. */
- // atomic_dec(&entry->usage);
- mutex_unlock(&dev->struct_mutex);
- mutex_lock(&entry->mutex);
- drm_bo_fill_rep_arg(entry, &rep);
- mutex_unlock(&entry->mutex);
+ rep.ret = drm_bo_handle_info(priv, req->handle, &rep);
break;
case drm_bo_unreference:
rep.ret = drm_user_object_unref(priv, req->handle,