From owner-svn-src-head@FreeBSD.ORG Wed Aug 28 23:59:39 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 93429B86; Wed, 28 Aug 2013 23:59:39 +0000 (UTC) (envelope-from jkim@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 7DCCA21EA; Wed, 28 Aug 2013 23:59:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7SNxdUS082753; Wed, 28 Aug 2013 23:59:39 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7SNxcFe082750; Wed, 28 Aug 2013 23:59:38 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201308282359.r7SNxcFe082750@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 28 Aug 2013 23:59:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r255013 - head/sys/dev/drm2/i915 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: Wed, 28 Aug 2013 23:59:39 -0000 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);