diff options
Diffstat (limited to 'drivers/gpu/drm/i915/intel_ringbuffer.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_ringbuffer.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index b59b6d5b7583..e5b84ff89ca5 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c | |||
@@ -266,10 +266,15 @@ u32 intel_ring_get_active_head(struct intel_ring_buffer *ring) | |||
266 | 266 | ||
267 | static int init_ring_common(struct intel_ring_buffer *ring) | 267 | static int init_ring_common(struct intel_ring_buffer *ring) |
268 | { | 268 | { |
269 | drm_i915_private_t *dev_priv = ring->dev->dev_private; | 269 | struct drm_device *dev = ring->dev; |
270 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
270 | struct drm_i915_gem_object *obj = ring->obj; | 271 | struct drm_i915_gem_object *obj = ring->obj; |
272 | int ret = 0; | ||
271 | u32 head; | 273 | u32 head; |
272 | 274 | ||
275 | if (HAS_FORCE_WAKE(dev)) | ||
276 | gen6_gt_force_wake_get(dev_priv); | ||
277 | |||
273 | /* Stop the ring if it's running. */ | 278 | /* Stop the ring if it's running. */ |
274 | I915_WRITE_CTL(ring, 0); | 279 | I915_WRITE_CTL(ring, 0); |
275 | I915_WRITE_HEAD(ring, 0); | 280 | I915_WRITE_HEAD(ring, 0); |
@@ -317,7 +322,8 @@ static int init_ring_common(struct intel_ring_buffer *ring) | |||
317 | I915_READ_HEAD(ring), | 322 | I915_READ_HEAD(ring), |
318 | I915_READ_TAIL(ring), | 323 | I915_READ_TAIL(ring), |
319 | I915_READ_START(ring)); | 324 | I915_READ_START(ring)); |
320 | return -EIO; | 325 | ret = -EIO; |
326 | goto out; | ||
321 | } | 327 | } |
322 | 328 | ||
323 | if (!drm_core_check_feature(ring->dev, DRIVER_MODESET)) | 329 | if (!drm_core_check_feature(ring->dev, DRIVER_MODESET)) |
@@ -326,9 +332,14 @@ static int init_ring_common(struct intel_ring_buffer *ring) | |||
326 | ring->head = I915_READ_HEAD(ring); | 332 | ring->head = I915_READ_HEAD(ring); |
327 | ring->tail = I915_READ_TAIL(ring) & TAIL_ADDR; | 333 | ring->tail = I915_READ_TAIL(ring) & TAIL_ADDR; |
328 | ring->space = ring_space(ring); | 334 | ring->space = ring_space(ring); |
335 | ring->last_retired_head = -1; | ||
329 | } | 336 | } |
330 | 337 | ||
331 | return 0; | 338 | out: |
339 | if (HAS_FORCE_WAKE(dev)) | ||
340 | gen6_gt_force_wake_put(dev_priv); | ||
341 | |||
342 | return ret; | ||
332 | } | 343 | } |
333 | 344 | ||
334 | static int | 345 | static int |
@@ -987,6 +998,10 @@ static int intel_init_ring_buffer(struct drm_device *dev, | |||
987 | if (ret) | 998 | if (ret) |
988 | goto err_unref; | 999 | goto err_unref; |
989 | 1000 | ||
1001 | ret = i915_gem_object_set_to_gtt_domain(obj, true); | ||
1002 | if (ret) | ||
1003 | goto err_unpin; | ||
1004 | |||
990 | ring->virtual_start = ioremap_wc(dev->agp->base + obj->gtt_offset, | 1005 | ring->virtual_start = ioremap_wc(dev->agp->base + obj->gtt_offset, |
991 | ring->size); | 1006 | ring->size); |
992 | if (ring->virtual_start == NULL) { | 1007 | if (ring->virtual_start == NULL) { |