aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_ringbuffer.c
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2014-11-19 18:33:08 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2014-12-03 03:35:29 -0500
commitbfc882b4e30fbc169ecfe3508378623743806f56 (patch)
tree40cd52c97a63bcec651da7da71cebf9199ccf6fe /drivers/gpu/drm/i915/intel_ringbuffer.c
parent36d0a82ef4dbe8a586b1ca538cbd37c889829340 (diff)
drm/i915: Flatten engine init control flow
Now that sanity prevails and we have the clean split between software init and starting the engines we can drop all the "have we allocate this struct already?" nonsense. Execlist code could benefit quite a bit more still, but that's for another patch. Reviewed-by: Dave Gordon <david.s.gordon@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_ringbuffer.c')
-rw-r--r--drivers/gpu/drm/i915/intel_ringbuffer.c45
1 files changed, 22 insertions, 23 deletions
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 590b7c38292f..79b4ca5dc65f 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -635,8 +635,7 @@ intel_init_pipe_control(struct intel_engine_cs *ring)
635{ 635{
636 int ret; 636 int ret;
637 637
638 if (ring->scratch.obj) 638 WARN_ON(ring->scratch.obj);
639 return 0;
640 639
641 ring->scratch.obj = i915_gem_alloc_object(ring->dev, 4096); 640 ring->scratch.obj = i915_gem_alloc_object(ring->dev, 4096);
642 if (ring->scratch.obj == NULL) { 641 if (ring->scratch.obj == NULL) {
@@ -1799,15 +1798,15 @@ int intel_alloc_ringbuffer_obj(struct drm_device *dev,
1799static int intel_init_ring_buffer(struct drm_device *dev, 1798static int intel_init_ring_buffer(struct drm_device *dev,
1800 struct intel_engine_cs *ring) 1799 struct intel_engine_cs *ring)
1801{ 1800{
1802 struct intel_ringbuffer *ringbuf = ring->buffer; 1801 struct intel_ringbuffer *ringbuf;
1803 int ret; 1802 int ret;
1804 1803
1805 if (ringbuf == NULL) { 1804 WARN_ON(ring->buffer);
1806 ringbuf = kzalloc(sizeof(*ringbuf), GFP_KERNEL); 1805
1807 if (!ringbuf) 1806 ringbuf = kzalloc(sizeof(*ringbuf), GFP_KERNEL);
1808 return -ENOMEM; 1807 if (!ringbuf)
1809 ring->buffer = ringbuf; 1808 return -ENOMEM;
1810 } 1809 ring->buffer = ringbuf;
1811 1810
1812 ring->dev = dev; 1811 ring->dev = dev;
1813 INIT_LIST_HEAD(&ring->active_list); 1812 INIT_LIST_HEAD(&ring->active_list);
@@ -1830,21 +1829,21 @@ static int intel_init_ring_buffer(struct drm_device *dev,
1830 goto error; 1829 goto error;
1831 } 1830 }
1832 1831
1833 if (ringbuf->obj == NULL) { 1832 WARN_ON(ringbuf->obj);
1834 ret = intel_alloc_ringbuffer_obj(dev, ringbuf);
1835 if (ret) {
1836 DRM_ERROR("Failed to allocate ringbuffer %s: %d\n",
1837 ring->name, ret);
1838 goto error;
1839 }
1840 1833
1841 ret = intel_pin_and_map_ringbuffer_obj(dev, ringbuf); 1834 ret = intel_alloc_ringbuffer_obj(dev, ringbuf);
1842 if (ret) { 1835 if (ret) {
1843 DRM_ERROR("Failed to pin and map ringbuffer %s: %d\n", 1836 DRM_ERROR("Failed to allocate ringbuffer %s: %d\n",
1844 ring->name, ret); 1837 ring->name, ret);
1845 intel_destroy_ringbuffer_obj(ringbuf); 1838 goto error;
1846 goto error; 1839 }
1847 } 1840
1841 ret = intel_pin_and_map_ringbuffer_obj(dev, ringbuf);
1842 if (ret) {
1843 DRM_ERROR("Failed to pin and map ringbuffer %s: %d\n",
1844 ring->name, ret);
1845 intel_destroy_ringbuffer_obj(ringbuf);
1846 goto error;
1848 } 1847 }
1849 1848
1850 /* Workaround an erratum on the i830 which causes a hang if 1849 /* Workaround an erratum on the i830 which causes a hang if