diff options
Diffstat (limited to 'include/drm/drmP.h')
-rw-r--r-- | include/drm/drmP.h | 28 |
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); | |||
1427 | int drm_gem_init(struct drm_device *dev); | 1428 | int drm_gem_init(struct drm_device *dev); |
1428 | void drm_gem_destroy(struct drm_device *dev); | 1429 | void drm_gem_destroy(struct drm_device *dev); |
1429 | void drm_gem_object_free(struct kref *kref); | 1430 | void drm_gem_object_free(struct kref *kref); |
1431 | void drm_gem_object_free_unlocked(struct kref *kref); | ||
1430 | struct drm_gem_object *drm_gem_object_alloc(struct drm_device *dev, | 1432 | struct drm_gem_object *drm_gem_object_alloc(struct drm_device *dev, |
1431 | size_t size); | 1433 | size_t size); |
1432 | void drm_gem_object_handle_free(struct kref *kref); | 1434 | void drm_gem_object_handle_free(struct kref *kref); |
@@ -1443,10 +1445,15 @@ drm_gem_object_reference(struct drm_gem_object *obj) | |||
1443 | static inline void | 1445 | static inline void |
1444 | drm_gem_object_unreference(struct drm_gem_object *obj) | 1446 | drm_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); | 1452 | static inline void |
1453 | drm_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 | ||
1452 | int drm_gem_handle_create(struct drm_file *file_priv, | 1459 | int 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 | ||
1485 | static inline void | ||
1486 | drm_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 | |||
1478 | struct drm_gem_object *drm_gem_object_lookup(struct drm_device *dev, | 1500 | struct 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); |