drm: Use the new drm_atomic.h, following the merge of projects/atomic64

Submitted by:	jkim@
This commit is contained in:
Jean-Sébastien Pédron 2013-08-25 15:38:16 +00:00
parent a18d713ab7
commit e558c87be3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=254880
5 changed files with 11 additions and 8 deletions

View File

@ -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);

View File

@ -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,

View File

@ -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);

View File

@ -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);

View File

@ -153,7 +153,8 @@ ttm_bo_vm_fault(vm_object_t vm_obj, vm_ooffset_t offset,
*/
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.
*