diff options
Diffstat (limited to 'sys/dev/pci/drm/i915/intel_ringbuffer.c')
-rw-r--r-- | sys/dev/pci/drm/i915/intel_ringbuffer.c | 34 |
1 files changed, 9 insertions, 25 deletions
diff --git a/sys/dev/pci/drm/i915/intel_ringbuffer.c b/sys/dev/pci/drm/i915/intel_ringbuffer.c index e42e8b81934..501f0152832 100644 --- a/sys/dev/pci/drm/i915/intel_ringbuffer.c +++ b/sys/dev/pci/drm/i915/intel_ringbuffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intel_ringbuffer.c,v 1.26 2015/04/12 03:54:10 jsg Exp $ */ +/* $OpenBSD: intel_ringbuffer.c,v 1.27 2015/04/12 11:26:54 jsg Exp $ */ /* * Copyright © 2008-2010 Intel Corporation * @@ -364,7 +364,6 @@ static int init_ring_common(struct intel_ring_buffer *ring) struct drm_i915_gem_object *obj = ring->obj; int ret = 0; u32 head; - int retries; if (HAS_FORCE_WAKE(dev)) gen6_gt_force_wake_get(dev_priv); @@ -409,14 +408,9 @@ static int init_ring_common(struct intel_ring_buffer *ring) | RING_VALID); /* If the head is still not zero, the ring is dead */ - for (retries = 50; retries > 0; retries--) { - if ((I915_READ_CTL(ring) & RING_VALID) != 0 && - I915_READ_START(ring) == obj->gtt_offset && - (I915_READ_HEAD(ring) & HEAD_ADDR) == 0) - break; - DELAY(1000); - } - if (retries == 0) { + if (wait_for((I915_READ_CTL(ring) & RING_VALID) != 0 && + I915_READ_START(ring) == obj->gtt_offset && + (I915_READ_HEAD(ring) & HEAD_ADDR) == 0, 50)) { DRM_ERROR("%s initialization failed " "ctl %08x head %08x tail %08x start %08x\n", ring->name, @@ -894,17 +888,12 @@ void intel_ring_setup_status_page(struct intel_ring_buffer *ring) /* Flush the TLB for this page */ if (INTEL_INFO(dev)->gen >= 6) { - int retries; u32 reg = RING_INSTPM(ring->mmio_base); I915_WRITE(reg, _MASKED_BIT_ENABLE(INSTPM_TLB_INVALIDATE | INSTPM_SYNC_FLUSH)); - for (retries = 1000; retries > 0; retries--) { - if ((I915_READ(reg) & INSTPM_SYNC_FLUSH) == 0) - break; - DELAY(1000); - } - if (retries == 0) + if (wait_for((I915_READ(reg) & INSTPM_SYNC_FLUSH) == 0, + 1000)) DRM_ERROR("%s: wait for SyncFlush to complete for TLB invalidation timed out\n", ring->name); } @@ -1527,7 +1516,6 @@ static void gen6_bsd_ring_write_tail(struct intel_ring_buffer *ring, u32 value) { drm_i915_private_t *dev_priv = ring->dev->dev_private; - int retries; /* Every tail move must follow the sequence below */ @@ -1541,13 +1529,9 @@ static void gen6_bsd_ring_write_tail(struct intel_ring_buffer *ring, I915_WRITE64(GEN6_BSD_RNCID, 0x0); /* Wait for the ring not to be idle, i.e. for it to wake up. */ - for (retries = 50; retries > 0; retries--) { - if ((I915_READ(GEN6_BSD_SLEEP_PSMI_CONTROL) & - GEN6_BSD_SLEEP_INDICATOR) == 0) - break; - DELAY(1000); - } - if (retries == 0) + if (wait_for((I915_READ(GEN6_BSD_SLEEP_PSMI_CONTROL) & + GEN6_BSD_SLEEP_INDICATOR) == 0, + 50)) DRM_ERROR("timed out waiting for the BSD ring to wake up\n"); /* Now that the ring is fully powered up, update the tail */ |