Commit fb3256da authored by Daniel Vetter's avatar Daniel Vetter

drm/i915: split up ring->dispatch_execbuffer functions

Now that we can, we should split them up in a way that makes some
sense and banishes the IS_ checks into init code.
Reviewed-by: default avatarEric Anholt <eric@anholt.net>
Signed-Off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 0fd2c201
...@@ -814,7 +814,7 @@ gen6_ring_put_irq(struct intel_ring_buffer *ring) ...@@ -814,7 +814,7 @@ gen6_ring_put_irq(struct intel_ring_buffer *ring)
} }
static int static int
ring_dispatch_execbuffer(struct intel_ring_buffer *ring, u32 offset, u32 length) i965_dispatch_execbuffer(struct intel_ring_buffer *ring, u32 offset, u32 length)
{ {
int ret; int ret;
...@@ -832,37 +832,36 @@ ring_dispatch_execbuffer(struct intel_ring_buffer *ring, u32 offset, u32 length) ...@@ -832,37 +832,36 @@ ring_dispatch_execbuffer(struct intel_ring_buffer *ring, u32 offset, u32 length)
} }
static int static int
render_ring_dispatch_execbuffer(struct intel_ring_buffer *ring, i830_dispatch_execbuffer(struct intel_ring_buffer *ring,
u32 offset, u32 len) u32 offset, u32 len)
{ {
struct drm_device *dev = ring->dev;
int ret; int ret;
if (IS_I830(dev) || IS_845G(dev)) { ret = intel_ring_begin(ring, 4);
ret = intel_ring_begin(ring, 4); if (ret)
if (ret) return ret;
return ret;
intel_ring_emit(ring, MI_BATCH_BUFFER); intel_ring_emit(ring, MI_BATCH_BUFFER);
intel_ring_emit(ring, offset | MI_BATCH_NON_SECURE); intel_ring_emit(ring, offset | MI_BATCH_NON_SECURE);
intel_ring_emit(ring, offset + len - 8); intel_ring_emit(ring, offset + len - 8);
intel_ring_emit(ring, 0); intel_ring_emit(ring, 0);
} else { intel_ring_advance(ring);
ret = intel_ring_begin(ring, 2);
if (ret)
return ret;
if (INTEL_INFO(dev)->gen >= 4) { return 0;
intel_ring_emit(ring, }
MI_BATCH_BUFFER_START | (2 << 6) |
MI_BATCH_NON_SECURE_I965); static int
intel_ring_emit(ring, offset); i915_dispatch_execbuffer(struct intel_ring_buffer *ring,
} else { u32 offset, u32 len)
intel_ring_emit(ring, {
MI_BATCH_BUFFER_START | (2 << 6)); int ret;
intel_ring_emit(ring, offset | MI_BATCH_NON_SECURE);
} ret = intel_ring_begin(ring, 2);
} if (ret)
return ret;
intel_ring_emit(ring, MI_BATCH_BUFFER_START | (2 << 6));
intel_ring_emit(ring, offset | MI_BATCH_NON_SECURE);
intel_ring_advance(ring); intel_ring_advance(ring);
return 0; return 0;
...@@ -1332,7 +1331,14 @@ int intel_init_render_ring_buffer(struct drm_device *dev) ...@@ -1332,7 +1331,14 @@ int intel_init_render_ring_buffer(struct drm_device *dev)
ring->irq_enable_mask = I915_USER_INTERRUPT; ring->irq_enable_mask = I915_USER_INTERRUPT;
} }
ring->write_tail = ring_write_tail; ring->write_tail = ring_write_tail;
ring->dispatch_execbuffer = render_ring_dispatch_execbuffer; if (INTEL_INFO(dev)->gen >= 6)
ring->dispatch_execbuffer = gen6_ring_dispatch_execbuffer;
else if (INTEL_INFO(dev)->gen >= 4)
ring->dispatch_execbuffer = i965_dispatch_execbuffer;
else if (IS_I830(dev) || IS_845G(dev))
ring->dispatch_execbuffer = i830_dispatch_execbuffer;
else
ring->dispatch_execbuffer = i915_dispatch_execbuffer;
ring->init = init_render_ring; ring->init = init_render_ring;
ring->cleanup = render_ring_cleanup; ring->cleanup = render_ring_cleanup;
...@@ -1373,7 +1379,12 @@ int intel_render_ring_init_dri(struct drm_device *dev, u64 start, u32 size) ...@@ -1373,7 +1379,12 @@ int intel_render_ring_init_dri(struct drm_device *dev, u64 start, u32 size)
ring->irq_enable_mask = I915_USER_INTERRUPT; ring->irq_enable_mask = I915_USER_INTERRUPT;
} }
ring->write_tail = ring_write_tail; ring->write_tail = ring_write_tail;
ring->dispatch_execbuffer = render_ring_dispatch_execbuffer; if (INTEL_INFO(dev)->gen >= 4)
ring->dispatch_execbuffer = i965_dispatch_execbuffer;
else if (IS_I830(dev) || IS_845G(dev))
ring->dispatch_execbuffer = i830_dispatch_execbuffer;
else
ring->dispatch_execbuffer = i915_dispatch_execbuffer;
ring->init = init_render_ring; ring->init = init_render_ring;
ring->cleanup = render_ring_cleanup; ring->cleanup = render_ring_cleanup;
...@@ -1448,7 +1459,7 @@ int intel_init_bsd_ring_buffer(struct drm_device *dev) ...@@ -1448,7 +1459,7 @@ int intel_init_bsd_ring_buffer(struct drm_device *dev)
ring->irq_get = i9xx_ring_get_irq; ring->irq_get = i9xx_ring_get_irq;
ring->irq_put = i9xx_ring_put_irq; ring->irq_put = i9xx_ring_put_irq;
} }
ring->dispatch_execbuffer = ring_dispatch_execbuffer; ring->dispatch_execbuffer = i965_dispatch_execbuffer;
} }
ring->init = init_ring_common; ring->init = init_ring_common;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment