Correct atomic operations in i915.
This commit is contained in:
parent
6ac96a7e7e
commit
8e0caa60f2
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user