diff options
author | jkim <jkim@FreeBSD.org> | 2013-08-28 23:59:38 +0000 |
---|---|---|
committer | jkim <jkim@FreeBSD.org> | 2013-08-28 23:59:38 +0000 |
commit | 4c745090116375b5d96509e9deb8b9662b8253d8 (patch) | |
tree | 4be7c16da0e823f73e00e1106e9aa2ff266f2f0a | |
parent | 28ab6fab8b32acdefcbcdd5450da8431df803bf3 (diff) | |
download | FreeBSD-src-4c745090116375b5d96509e9deb8b9662b8253d8.zip FreeBSD-src-4c745090116375b5d96509e9deb8b9662b8253d8.tar.gz |
Correct atomic operations in i915.
-rw-r--r-- | sys/dev/drm2/i915/i915_gem.c | 10 | ||||
-rw-r--r-- | sys/dev/drm2/i915/i915_gem_execbuffer.c | 2 | ||||
-rw-r--r-- | sys/dev/drm2/i915/intel_display.c | 10 |
3 files changed, 11 insertions, 11 deletions
diff --git a/sys/dev/drm2/i915/i915_gem.c b/sys/dev/drm2/i915/i915_gem.c index 7204778..5afea4e 100644 --- a/sys/dev/drm2/i915/i915_gem.c +++ b/sys/dev/drm2/i915/i915_gem.c @@ -141,7 +141,7 @@ i915_gem_wait_for_error(struct drm_device *dev) } 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 *dev, struct drm_file *file) 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 *dev, struct drm_file *file) 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; } } diff --git a/sys/dev/drm2/i915/i915_gem_execbuffer.c b/sys/dev/drm2/i915/i915_gem_execbuffer.c index dbd5c4e..21e331f 100644 --- a/sys/dev/drm2/i915/i915_gem_execbuffer.c +++ b/sys/dev/drm2/i915/i915_gem_execbuffer.c @@ -192,7 +192,7 @@ i915_gem_object_set_to_gpu_domain(struct drm_i915_gem_object *obj, 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 diff --git a/sys/dev/drm2/i915/intel_display.c b/sys/dev/drm2/i915/intel_display.c index 461d779..ccff1e4 100644 --- a/sys/dev/drm2/i915/intel_display.c +++ b/sys/dev/drm2/i915/intel_display.c @@ -2261,8 +2261,8 @@ intel_finish_fb(struct drm_framebuffer *old_fb) 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_flips(struct drm_crtc *crtc) 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(struct drm_device *dev, 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 drm_crtc *crtc, 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); |