From: Oscar Mateo <oscar.mateo@xxxxxxxxx> No functional changes. Signed-off-by: Oscar Mateo <oscar.mateo@xxxxxxxxx> --- drivers/gpu/drm/i915/intel_ringbuffer.c | 21 ++++++++++++++------- drivers/gpu/drm/i915/intel_ringbuffer.h | 3 +++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index fc737c8..5d61923 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c @@ -1368,7 +1368,18 @@ static int init_phys_status_page(struct intel_ring_buffer *ring) return 0; } -static int allocate_ring_buffer(struct intel_ring_buffer *ring) +void intel_destroy_ring_buffer(struct intel_ring_buffer *ring) +{ + if (!ring->obj) + return; + + iounmap(ring->virtual_start); + i915_gem_object_ggtt_unpin(ring->obj); + drm_gem_object_unreference(&ring->obj->base); + ring->obj = NULL; +} + +int intel_allocate_ring_buffer(struct intel_ring_buffer *ring) { struct drm_device *dev = ring->dev; struct drm_i915_private *dev_priv = to_i915(dev); @@ -1435,7 +1446,7 @@ static int intel_init_ring_buffer(struct drm_device *dev, return ret; } - ret = allocate_ring_buffer(ring); + ret = intel_allocate_ring_buffer(ring); if (ret) { DRM_ERROR("Failed to allocate ringbuffer %s: %d\n", ring->name, ret); return ret; @@ -1464,11 +1475,7 @@ void intel_cleanup_ring_buffer(struct intel_ring_buffer *ring) intel_stop_ring_buffer(ring); WARN_ON((I915_READ_MODE(ring) & MODE_IDLE) == 0); - iounmap(ring->virtual_start); - - i915_gem_object_ggtt_unpin(ring->obj); - drm_gem_object_unreference(&ring->obj->base); - ring->obj = NULL; + intel_destroy_ring_buffer(ring); ring->preallocated_lazy_request = NULL; ring->outstanding_lazy_seqno = 0; diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h index b1bf767..680e451 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.h +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h @@ -307,6 +307,9 @@ int intel_init_vebox_ring_buffer(struct drm_device *dev); u64 intel_ring_get_active_head(struct intel_ring_buffer *ring); void intel_ring_setup_status_page(struct intel_ring_buffer *ring); +void intel_destroy_ring_buffer(struct intel_ring_buffer *ring); +int intel_allocate_ring_buffer(struct intel_ring_buffer *ring); + static inline u32 intel_ring_get_tail(struct intel_ring_buffer *ring) { return ring->tail; -- 1.9.0 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/intel-gfx