Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Aug 2013 23:59:38 +0000 (UTC)
From:      Jung-uk Kim <jkim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r255013 - head/sys/dev/drm2/i915
Message-ID:  <201308282359.r7SNxcFe082750@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jkim
Date: Wed Aug 28 23:59:38 2013
New Revision: 255013
URL: http://svnweb.freebsd.org/changeset/base/255013

Log:
  Correct atomic operations in i915.

Modified:
  head/sys/dev/drm2/i915/i915_gem.c
  head/sys/dev/drm2/i915/i915_gem_execbuffer.c
  head/sys/dev/drm2/i915/intel_display.c

Modified: head/sys/dev/drm2/i915/i915_gem.c
==============================================================================
--- head/sys/dev/drm2/i915/i915_gem.c	Wed Aug 28 23:43:28 2013	(r255012)
+++ head/sys/dev/drm2/i915/i915_gem.c	Wed Aug 28 23:59:38 2013	(r255013)
@@ -141,7 +141,7 @@ i915_gem_wait_for_error(struct drm_devic
 	}
 	mtx_unlock(&dev_priv->error_completion_lock);
 
-	if (atomic_read(&dev_priv->mm.wedged)) {
+	if (atomic_load_acq_int(&dev_priv->mm.wedged)) {
 		mtx_lock(&dev_priv->error_completion_lock);
 		dev_priv->error_completion++;
 		mtx_unlock(&dev_priv->error_completion_lock);
@@ -743,7 +743,7 @@ i915_gem_ring_throttle(struct drm_device
 	int ret;
 
 	dev_priv = dev->dev_private;
-	if (atomic_read(&dev_priv->mm.wedged))
+	if (atomic_load_acq_int(&dev_priv->mm.wedged))
 		return (-EIO);
 
 	file_priv = file->driver_priv;
@@ -768,15 +768,15 @@ i915_gem_ring_throttle(struct drm_device
 		if (ring->irq_get(ring)) {
 			while (ret == 0 &&
 			    !(i915_seqno_passed(ring->get_seqno(ring), seqno) ||
-			    atomic_read(&dev_priv->mm.wedged)))
+			    atomic_load_acq_int(&dev_priv->mm.wedged)))
 				ret = -msleep(ring, &ring->irq_lock, PCATCH,
 				    "915thr", 0);
 			ring->irq_put(ring);
-			if (ret == 0 && atomic_read(&dev_priv->mm.wedged))
+			if (ret == 0 && atomic_load_acq_int(&dev_priv->mm.wedged))
 				ret = -EIO;
 		} else if (_intel_wait_for(dev,
 		    i915_seqno_passed(ring->get_seqno(ring), seqno) ||
-		    atomic_read(&dev_priv->mm.wedged), 3000, 0, "915rtr")) {
+		    atomic_load_acq_int(&dev_priv->mm.wedged), 3000, 0, "915rtr")) {
 			ret = -EBUSY;
 		}
 	}

Modified: head/sys/dev/drm2/i915/i915_gem_execbuffer.c
==============================================================================
--- head/sys/dev/drm2/i915/i915_gem_execbuffer.c	Wed Aug 28 23:43:28 2013	(r255012)
+++ head/sys/dev/drm2/i915/i915_gem_execbuffer.c	Wed Aug 28 23:59:38 2013	(r255013)
@@ -192,7 +192,7 @@ i915_gem_object_set_to_gpu_domain(struct
 		i915_gem_clflush_object(obj);
 
 	if (obj->base.pending_write_domain)
-		cd->flips |= atomic_read(&obj->pending_flip);
+		cd->flips |= atomic_load_acq_int(&obj->pending_flip);
 
 	/* The actual obj->write_domain will be updated with
 	 * pending_write_domain after we emit the accumulated flush for all

Modified: head/sys/dev/drm2/i915/intel_display.c
==============================================================================
--- head/sys/dev/drm2/i915/intel_display.c	Wed Aug 28 23:43:28 2013	(r255012)
+++ head/sys/dev/drm2/i915/intel_display.c	Wed Aug 28 23:59:38 2013	(r255013)
@@ -2261,8 +2261,8 @@ intel_finish_fb(struct drm_framebuffer *
 	int ret;
 
 	mtx_lock(&dev->event_lock);
-	while (!atomic_read(&dev_priv->mm.wedged) &&
-	    atomic_read(&obj->pending_flip) != 0) {
+	while (!atomic_load_acq_int(&dev_priv->mm.wedged) &&
+	    atomic_load_acq_int(&obj->pending_flip) != 0) {
 		msleep(&obj->pending_flip, &dev->event_lock,
 		    0, "915flp", 0);
 	}
@@ -2948,7 +2948,7 @@ static void intel_crtc_wait_for_pending_
 	dev = crtc->dev;
 	dev_priv = dev->dev_private;
 	mtx_lock(&dev->event_lock);
-	while (atomic_read(&obj->pending_flip) != 0)
+	while (atomic_load_acq_int(&obj->pending_flip) != 0)
 		msleep(&obj->pending_flip, &dev->event_lock, 0, "915wfl", 0);
 	mtx_unlock(&dev->event_lock);
 }
@@ -7333,7 +7333,7 @@ static void do_intel_finish_page_flip(st
 	obj = work->old_fb_obj;
 
 	atomic_clear_int(&obj->pending_flip, 1 << intel_crtc->plane);
-	if (atomic_read(&obj->pending_flip) == 0)
+	if (atomic_load_acq_int(&obj->pending_flip) == 0)
 		wakeup(&obj->pending_flip);
 	mtx_unlock(&dev->event_lock);
 
@@ -7640,7 +7640,7 @@ static int intel_crtc_page_flip(struct d
 	return 0;
 
 cleanup_pending:
-	atomic_sub(1 << intel_crtc->plane, &work->old_fb_obj->pending_flip);
+	atomic_clear_int(&work->old_fb_obj->pending_flip, 1 << intel_crtc->plane);
 	drm_gem_object_unreference(&work->old_fb_obj->base);
 	drm_gem_object_unreference(&obj->base);
 	DRM_UNLOCK(dev);



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