summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/dev/drm2/drm_gem.c2
-rw-r--r--sys/dev/drm2/drm_irq.c4
-rw-r--r--sys/dev/drm2/ttm/ttm_bo.c7
-rw-r--r--sys/dev/drm2/ttm/ttm_bo_util.c3
-rw-r--r--sys/dev/drm2/ttm/ttm_bo_vm.c3
5 files changed, 11 insertions, 8 deletions
diff --git a/sys/dev/drm2/drm_gem.c b/sys/dev/drm2/drm_gem.c
index 5215a41..04b7659 100644
--- a/sys/dev/drm2/drm_gem.c
+++ b/sys/dev/drm2/drm_gem.c
@@ -121,7 +121,7 @@ drm_gem_private_object_init(struct drm_device *dev, struct drm_gem_object *obj,
obj->vm_obj = NULL;
obj->refcount = 1;
- atomic_set(&obj->handle_count, 0);
+ atomic_store_rel_int(&obj->handle_count, 0);
obj->size = size;
return (0);
diff --git a/sys/dev/drm2/drm_irq.c b/sys/dev/drm2/drm_irq.c
index 0324e8c..130c20f 100644
--- a/sys/dev/drm2/drm_irq.c
+++ b/sys/dev/drm2/drm_irq.c
@@ -786,7 +786,7 @@ int drm_vblank_get(struct drm_device *dev, int crtc)
mtx_lock(&dev->vbl_lock);
/* Going from 0->1 means we have to enable interrupts again */
- if (atomic_fetchadd_int(&dev->vblank_refcount[crtc], 1) == 0) {
+ if (atomic_add_return(1, &dev->vblank_refcount[crtc]) == 1) {
mtx_lock(&dev->vblank_time_lock);
if (!dev->vblank_enabled[crtc]) {
/* Enable vblank irqs under vblank_time_lock protection.
@@ -831,7 +831,7 @@ void drm_vblank_put(struct drm_device *dev, int crtc)
("Too many drm_vblank_put for crtc %d", crtc));
/* Last user schedules interrupt disable */
- if (atomic_fetchadd_int(&dev->vblank_refcount[crtc], -1) == 1 &&
+ if (atomic_dec_and_test(&dev->vblank_refcount[crtc]) &&
(drm_vblank_offdelay > 0))
callout_reset(&dev->vblank_disable_callout,
(drm_vblank_offdelay * DRM_HZ) / 1000,
diff --git a/sys/dev/drm2/ttm/ttm_bo.c b/sys/dev/drm2/ttm/ttm_bo.c
index 3b13540..f598748 100644
--- a/sys/dev/drm2/ttm/ttm_bo.c
+++ b/sys/dev/drm2/ttm/ttm_bo.c
@@ -1723,7 +1723,8 @@ int ttm_bo_wait(struct ttm_buffer_object *bo,
if (driver->sync_obj_signaled(bo->sync_obj)) {
void *tmp_obj = bo->sync_obj;
bo->sync_obj = NULL;
- clear_bit(TTM_BO_PRIV_FLAG_MOVING, &bo->priv_flags);
+ atomic_clear_long(&bo->priv_flags,
+ 1UL << TTM_BO_PRIV_FLAG_MOVING);
mtx_unlock(&bdev->fence_lock);
driver->sync_obj_unref(&tmp_obj);
mtx_lock(&bdev->fence_lock);
@@ -1746,8 +1747,8 @@ int ttm_bo_wait(struct ttm_buffer_object *bo,
if (likely(bo->sync_obj == sync_obj)) {
void *tmp_obj = bo->sync_obj;
bo->sync_obj = NULL;
- clear_bit(TTM_BO_PRIV_FLAG_MOVING,
- &bo->priv_flags);
+ atomic_clear_long(&bo->priv_flags,
+ 1UL << TTM_BO_PRIV_FLAG_MOVING);
mtx_unlock(&bdev->fence_lock);
driver->sync_obj_unref(&sync_obj);
driver->sync_obj_unref(&tmp_obj);
diff --git a/sys/dev/drm2/ttm/ttm_bo_util.c b/sys/dev/drm2/ttm/ttm_bo_util.c
index aed8e0e..15b4d48 100644
--- a/sys/dev/drm2/ttm/ttm_bo_util.c
+++ b/sys/dev/drm2/ttm/ttm_bo_util.c
@@ -637,7 +637,8 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
* operation has completed.
*/
- set_bit(TTM_BO_PRIV_FLAG_MOVING, &bo->priv_flags);
+ atomic_set_long(&bo->priv_flags,
+ 1UL << TTM_BO_PRIV_FLAG_MOVING);
mtx_unlock(&bdev->fence_lock);
if (tmp_obj)
driver->sync_obj_unref(&tmp_obj);
diff --git a/sys/dev/drm2/ttm/ttm_bo_vm.c b/sys/dev/drm2/ttm/ttm_bo_vm.c
index b87380c..8c64181 100644
--- a/sys/dev/drm2/ttm/ttm_bo_vm.c
+++ b/sys/dev/drm2/ttm/ttm_bo_vm.c
@@ -153,7 +153,8 @@ reserve:
*/
mtx_lock(&bdev->fence_lock);
- if (test_bit(TTM_BO_PRIV_FLAG_MOVING, &bo->priv_flags)) {
+ if ((atomic_load_acq_long(&bo->priv_flags) &
+ (1UL << TTM_BO_PRIV_FLAG_MOVING)) != 0) {
/*
* Here, the behavior differs between Linux and FreeBSD.
*
OpenPOWER on IntegriCloud