From owner-svn-src-head@FreeBSD.ORG Sun Aug 25 15:38:17 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id C59CAFBF; Sun, 25 Aug 2013 15:38:17 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B218423D1; Sun, 25 Aug 2013 15:38:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7PFcHpu072748; Sun, 25 Aug 2013 15:38:17 GMT (envelope-from dumbbell@svn.freebsd.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7PFcG3D072742; Sun, 25 Aug 2013 15:38:16 GMT (envelope-from dumbbell@svn.freebsd.org) Message-Id: <201308251538.r7PFcG3D072742@svn.freebsd.org> From: Jean-Sebastien Pedron Date: Sun, 25 Aug 2013 15:38:16 +0000 (UTC) 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 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Aug 2013 15:38:17 -0000 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. *