return I915_READ(PRB0_HEAD) & HEAD_ADDR;
}
-static unsigned int render_ring_get_tail(struct drm_device *dev,
- struct intel_ring_buffer *ring)
-{
- drm_i915_private_t *dev_priv = dev->dev_private;
- return I915_READ(PRB0_TAIL) & TAIL_ADDR;
-}
-
-static inline void render_ring_set_tail(struct drm_device *dev, u32 value)
+static void ring_set_tail(struct drm_device *dev,
+ struct intel_ring_buffer *ring,
+ u32 value)
{
drm_i915_private_t *dev_priv = dev->dev_private;
- I915_WRITE(PRB0_TAIL, value);
+ I915_WRITE_TAIL(ring, ring->tail);
}
static unsigned int render_ring_get_active_head(struct drm_device *dev,
/* Stop the ring if it's running. */
I915_WRITE(ring->regs.ctl, 0);
I915_WRITE(ring->regs.head, 0);
- ring->set_tail(dev, 0);
+ ring->set_tail(dev, ring, 0);
/* Initialize the ring. */
I915_WRITE(ring->regs.start, obj_priv->gtt_offset);
ring->name,
I915_READ(ring->regs.ctl),
I915_READ(ring->regs.head),
- I915_READ(ring->regs.tail),
+ I915_READ_TAIL(ring),
I915_READ(ring->regs.start));
I915_WRITE(ring->regs.head, 0);
ring->name,
I915_READ(ring->regs.ctl),
I915_READ(ring->regs.head),
- I915_READ(ring->regs.tail),
+ I915_READ_TAIL(ring),
I915_READ(ring->regs.start));
}
ring->name,
I915_READ(ring->regs.ctl),
I915_READ(ring->regs.head),
- I915_READ(ring->regs.tail),
+ I915_READ_TAIL(ring),
I915_READ(ring->regs.start));
return -EIO;
}
i915_kernel_lost_context(dev);
else {
ring->head = ring->get_head(dev, ring);
- ring->tail = ring->get_tail(dev, ring);
+ ring->tail = I915_READ_TAIL(ring) & TAIL_ADDR;
ring->space = ring->head - (ring->tail + 8);
if (ring->space < 0)
ring->space += ring->size;
return I915_READ(BSD_RING_HEAD) & HEAD_ADDR;
}
-static inline unsigned int bsd_ring_get_tail(struct drm_device *dev,
- struct intel_ring_buffer *ring)
-{
- drm_i915_private_t *dev_priv = dev->dev_private;
- return I915_READ(BSD_RING_TAIL) & TAIL_ADDR;
-}
-
-static inline void bsd_ring_set_tail(struct drm_device *dev, u32 value)
-{
- drm_i915_private_t *dev_priv = dev->dev_private;
- I915_WRITE(BSD_RING_TAIL, value);
-}
-
static inline unsigned int bsd_ring_get_active_head(struct drm_device *dev,
struct intel_ring_buffer *ring)
{
int intel_init_ring_buffer(struct drm_device *dev,
struct intel_ring_buffer *ring)
{
+ struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_i915_gem_object *obj_priv;
struct drm_gem_object *obj;
int ret;
i915_kernel_lost_context(dev);
else {
ring->head = ring->get_head(dev, ring);
- ring->tail = ring->get_tail(dev, ring);
+ ring->tail = I915_READ_TAIL(ring) & TAIL_ADDR;
ring->space = ring->head - (ring->tail + 8);
if (ring->space < 0)
ring->space += ring->size;
struct intel_ring_buffer *ring)
{
ring->tail &= ring->size - 1;
- ring->set_tail(dev, ring->tail);
+ ring->set_tail(dev, ring, ring->tail);
}
void intel_fill_struct(struct drm_device *dev,
.regs = {
.ctl = PRB0_CTL,
.head = PRB0_HEAD,
- .tail = PRB0_TAIL,
.start = PRB0_START
},
.mmio_base = RENDER_RING_BASE,
.setup_status_page = render_setup_status_page,
.init = init_render_ring,
.get_head = render_ring_get_head,
- .get_tail = render_ring_get_tail,
- .set_tail = render_ring_set_tail,
+ .set_tail = ring_set_tail,
.get_active_head = render_ring_get_active_head,
.flush = render_ring_flush,
.add_request = render_ring_add_request,
.regs = {
.ctl = BSD_RING_CTL,
.head = BSD_RING_HEAD,
- .tail = BSD_RING_TAIL,
.start = BSD_RING_START
},
.mmio_base = BSD_RING_BASE,
.setup_status_page = bsd_setup_status_page,
.init = init_bsd_ring,
.get_head = bsd_ring_get_head,
- .get_tail = bsd_ring_get_tail,
- .set_tail = bsd_ring_set_tail,
+ .set_tail = ring_set_tail,
.get_active_head = bsd_ring_get_active_head,
.flush = bsd_ring_flush,
.add_request = bsd_ring_add_request,
return I915_READ(GEN6_BSD_RING_HEAD) & HEAD_ADDR;
}
-static inline unsigned int gen6_bsd_ring_get_tail(struct drm_device *dev,
- struct intel_ring_buffer *ring)
-{
- drm_i915_private_t *dev_priv = dev->dev_private;
- return I915_READ(GEN6_BSD_RING_TAIL) & TAIL_ADDR;
-}
-
static inline void gen6_bsd_ring_set_tail(struct drm_device *dev,
- u32 value)
+ struct intel_ring_buffer *ring,
+ u32 value)
{
drm_i915_private_t *dev_priv = dev->dev_private;
50))
DRM_ERROR("timed out waiting for IDLE Indicator\n");
- I915_WRITE(GEN6_BSD_RING_TAIL, value);
+ I915_WRITE_TAIL(ring, value);
I915_WRITE(GEN6_BSD_SLEEP_PSMI_CONTROL,
GEN6_BSD_SLEEP_PSMI_CONTROL_RC_ILDL_MESSAGE_MODIFY_MASK |
GEN6_BSD_SLEEP_PSMI_CONTROL_RC_ILDL_MESSAGE_ENABLE);
.regs = {
.ctl = GEN6_BSD_RING_CTL,
.head = GEN6_BSD_RING_HEAD,
- .tail = GEN6_BSD_RING_TAIL,
.start = GEN6_BSD_RING_START
},
.mmio_base = GEN6_BSD_RING_BASE,
.setup_status_page = gen6_bsd_setup_status_page,
.init = init_bsd_ring,
.get_head = gen6_bsd_ring_get_head,
- .get_tail = gen6_bsd_ring_get_tail,
.set_tail = gen6_bsd_ring_set_tail,
.get_active_head = gen6_bsd_ring_get_active_head,
.flush = gen6_bsd_ring_flush,