summaryrefslogtreecommitdiff
path: root/linux-core/drm_object.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@linux.ie>2007-07-11 11:23:41 +1000
committerDave Airlie <airlied@linux.ie>2007-07-11 11:23:41 +1000
commit2c9e05cf4c6eb18c941321f764ed1b282a314ba9 (patch)
treed5bcbe9114fac7e03549ae05a9e6dffc793fcbaf /linux-core/drm_object.c
parent9b9a127ed0fe9a6a8e2fde84739ccff6fa0bc5ac (diff)
parent694e1c5c3f768436651ddf95e11ab5a89ccc8ffa (diff)
Merge branch 'master' into cleanupdrm-ttm-cleanup-branch
Conflicts: libdrm/xf86drm.c linux-core/drm_bo.c linux-core/drm_fence.c
Diffstat (limited to 'linux-core/drm_object.c')
-rw-r--r--linux-core/drm_object.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/linux-core/drm_object.c b/linux-core/drm_object.c
index 039060344..567a7d2b0 100644
--- a/linux-core/drm_object.c
+++ b/linux-core/drm_object.c
@@ -36,6 +36,8 @@ int drm_add_user_object(drm_file_t * priv, drm_user_object_t * item,
drm_device_t *dev = priv->head->dev;
int ret;
+ DRM_ASSERT_LOCKED(&dev->struct_mutex);
+
atomic_set(&item->refcount, 1);
item->shareable = shareable;
item->owner = priv;
@@ -56,6 +58,8 @@ drm_user_object_t *drm_lookup_user_object(drm_file_t * priv, uint32_t key)
int ret;
drm_user_object_t *item;
+ DRM_ASSERT_LOCKED(&dev->struct_mutex);
+
ret = drm_ht_find_item(&dev->object_hash, key, &hash);
if (ret) {
return NULL;
@@ -88,6 +92,8 @@ static void drm_deref_user_object(drm_file_t * priv, drm_user_object_t * item)
int drm_remove_user_object(drm_file_t * priv, drm_user_object_t * item)
{
+ DRM_ASSERT_LOCKED(&priv->head->dev->struct_mutex);
+
if (item->owner != priv) {
DRM_ERROR("Cannot destroy object not owned by you.\n");
return -EINVAL;
@@ -125,6 +131,7 @@ int drm_add_ref_object(drm_file_t * priv, drm_user_object_t * referenced_object,
drm_ref_object_t *item;
drm_open_hash_t *ht = &priv->refd_object_hash[ref_action];
+ DRM_ASSERT_LOCKED(&priv->head->dev->struct_mutex);
if (!referenced_object->shareable && priv != referenced_object->owner) {
DRM_ERROR("Not allowed to reference this object\n");
return -EINVAL;
@@ -181,6 +188,7 @@ drm_ref_object_t *drm_lookup_ref_object(drm_file_t * priv,
drm_hash_item_t *hash;
int ret;
+ DRM_ASSERT_LOCKED(&priv->head->dev->struct_mutex);
ret = drm_ht_find_item(&priv->refd_object_hash[ref_action],
(unsigned long)referenced_object, &hash);
if (ret)
@@ -213,6 +221,7 @@ void drm_remove_ref_object(drm_file_t * priv, drm_ref_object_t * item)
drm_open_hash_t *ht = &priv->refd_object_hash[item->unref_action];
drm_ref_t unref_action;
+ DRM_ASSERT_LOCKED(&priv->head->dev->struct_mutex);
unref_action = item->unref_action;
if (atomic_dec_and_test(&item->refcount)) {
ret = drm_ht_remove_item(ht, &item->hash);