aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2010-02-24 22:39:29 -0500
committerDave Airlie <airlied@redhat.com>2010-02-24 22:39:29 -0500
commitde19322d554fd0f449d17610823c38494c06db9e (patch)
treedf91899c274005adb02a7a8ca5d9e5609bc2d05b /include
parent60b341b778cc2929df16c0a504c91621b3c6a4ad (diff)
parent290e55056ec3d25c72088628245d8cae037b30db (diff)
Merge remote branch 'korg/drm-core-next' into drm-next-stage
* korg/drm-core-next: drm/ttm: handle OOM in ttm_tt_swapout drm/radeon/kms/atom: fix shr/shl ops drm/kms: fix spelling of "CLOCK" drm/kms: fix fb_changed = true else statement drivers/gpu/drm/drm_fb_helper.c: don't use private implementation of atoi() drm: switch all GEM/KMS ioctls to unlocked ioctl status. Use drm_gem_object_[handle_]unreference_unlocked where possible drm: introduce drm_gem_object_[handle_]unreference_unlocked
Diffstat (limited to 'include')
-rw-r--r--include/drm/drmP.h28
1 files changed, 25 insertions, 3 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index ffac157fb5b2..4a3c4e441027 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -801,6 +801,7 @@ struct drm_driver {
801 */ 801 */
802 int (*gem_init_object) (struct drm_gem_object *obj); 802 int (*gem_init_object) (struct drm_gem_object *obj);
803 void (*gem_free_object) (struct drm_gem_object *obj); 803 void (*gem_free_object) (struct drm_gem_object *obj);
804 void (*gem_free_object_unlocked) (struct drm_gem_object *obj);
804 805
805 /* vga arb irq handler */ 806 /* vga arb irq handler */
806 void (*vgaarb_irq)(struct drm_device *dev, bool state); 807 void (*vgaarb_irq)(struct drm_device *dev, bool state);
@@ -1427,6 +1428,7 @@ extern void drm_sysfs_connector_remove(struct drm_connector *connector);
1427int drm_gem_init(struct drm_device *dev); 1428int drm_gem_init(struct drm_device *dev);
1428void drm_gem_destroy(struct drm_device *dev); 1429void drm_gem_destroy(struct drm_device *dev);
1429void drm_gem_object_free(struct kref *kref); 1430void drm_gem_object_free(struct kref *kref);
1431void drm_gem_object_free_unlocked(struct kref *kref);
1430struct drm_gem_object *drm_gem_object_alloc(struct drm_device *dev, 1432struct drm_gem_object *drm_gem_object_alloc(struct drm_device *dev,
1431 size_t size); 1433 size_t size);
1432void drm_gem_object_handle_free(struct kref *kref); 1434void drm_gem_object_handle_free(struct kref *kref);
@@ -1443,10 +1445,15 @@ drm_gem_object_reference(struct drm_gem_object *obj)
1443static inline void 1445static inline void
1444drm_gem_object_unreference(struct drm_gem_object *obj) 1446drm_gem_object_unreference(struct drm_gem_object *obj)
1445{ 1447{
1446 if (obj == NULL) 1448 if (obj != NULL)
1447 return; 1449 kref_put(&obj->refcount, drm_gem_object_free);
1450}
1448 1451
1449 kref_put(&obj->refcount, drm_gem_object_free); 1452static inline void
1453drm_gem_object_unreference_unlocked(struct drm_gem_object *obj)
1454{
1455 if (obj != NULL)
1456 kref_put(&obj->refcount, drm_gem_object_free_unlocked);
1450} 1457}
1451 1458
1452int drm_gem_handle_create(struct drm_file *file_priv, 1459int drm_gem_handle_create(struct drm_file *file_priv,
@@ -1475,6 +1482,21 @@ drm_gem_object_handle_unreference(struct drm_gem_object *obj)
1475 drm_gem_object_unreference(obj); 1482 drm_gem_object_unreference(obj);
1476} 1483}
1477 1484
1485static inline void
1486drm_gem_object_handle_unreference_unlocked(struct drm_gem_object *obj)
1487{
1488 if (obj == NULL)
1489 return;
1490
1491 /*
1492 * Must bump handle count first as this may be the last
1493 * ref, in which case the object would disappear before we
1494 * checked for a name
1495 */
1496 kref_put(&obj->handlecount, drm_gem_object_handle_free);
1497 drm_gem_object_unreference_unlocked(obj);
1498}
1499
1478struct drm_gem_object *drm_gem_object_lookup(struct drm_device *dev, 1500struct drm_gem_object *drm_gem_object_lookup(struct drm_device *dev,
1479 struct drm_file *filp, 1501 struct drm_file *filp,
1480 u32 handle); 1502 u32 handle);