Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 25 Aug 2013 15:38:16 +0000 (UTC)
From:      Jean-Sebastien Pedron <dumbbell@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r254880 - in head/sys/dev/drm2: . ttm
Message-ID:  <201308251538.r7PFcG3D072742@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dumbbell
Date: Sun Aug 25 15:38:16 2013
New Revision: 254880
URL: http://svnweb.freebsd.org/changeset/base/254880

Log:
  drm: Use the new drm_atomic.h, following the merge of projects/atomic64
  
  Submitted by:	jkim@

Modified:
  head/sys/dev/drm2/drm_gem.c
  head/sys/dev/drm2/drm_irq.c
  head/sys/dev/drm2/ttm/ttm_bo.c
  head/sys/dev/drm2/ttm/ttm_bo_util.c
  head/sys/dev/drm2/ttm/ttm_bo_vm.c

Modified: head/sys/dev/drm2/drm_gem.c
==============================================================================
--- head/sys/dev/drm2/drm_gem.c	Sun Aug 25 15:33:17 2013	(r254879)
+++ head/sys/dev/drm2/drm_gem.c	Sun Aug 25 15:38:16 2013	(r254880)
@@ -121,7 +121,7 @@ drm_gem_private_object_init(struct drm_d
 	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);

Modified: head/sys/dev/drm2/drm_irq.c
==============================================================================
--- head/sys/dev/drm2/drm_irq.c	Sun Aug 25 15:33:17 2013	(r254879)
+++ head/sys/dev/drm2/drm_irq.c	Sun Aug 25 15:38:16 2013	(r254880)
@@ -786,7 +786,7 @@ int drm_vblank_get(struct drm_device *de
 
 	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 *d
 	    ("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,

Modified: head/sys/dev/drm2/ttm/ttm_bo.c
==============================================================================
--- head/sys/dev/drm2/ttm/ttm_bo.c	Sun Aug 25 15:33:17 2013	(r254879)
+++ head/sys/dev/drm2/ttm/ttm_bo.c	Sun Aug 25 15:38:16 2013	(r254880)
@@ -1723,7 +1723,8 @@ int ttm_bo_wait(struct ttm_buffer_object
 		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
 		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);

Modified: head/sys/dev/drm2/ttm/ttm_bo_util.c
==============================================================================
--- head/sys/dev/drm2/ttm/ttm_bo_util.c	Sun Aug 25 15:33:17 2013	(r254879)
+++ head/sys/dev/drm2/ttm/ttm_bo_util.c	Sun Aug 25 15:38:16 2013	(r254880)
@@ -637,7 +637,8 @@ int ttm_bo_move_accel_cleanup(struct ttm
 		 * 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);

Modified: head/sys/dev/drm2/ttm/ttm_bo_vm.c
==============================================================================
--- head/sys/dev/drm2/ttm/ttm_bo_vm.c	Sun Aug 25 15:33:17 2013	(r254879)
+++ head/sys/dev/drm2/ttm/ttm_bo_vm.c	Sun Aug 25 15:38:16 2013	(r254880)
@@ -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.
 		 *



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201308251538.r7PFcG3D072742>