drm/i915: Move the common engine cleanup to intel_engine_cs.c
authorChris Wilson <chris@chris-wilson.co.uk>
Wed, 3 Aug 2016 12:19:16 +0000 (13:19 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Wed, 3 Aug 2016 13:01:12 +0000 (14:01 +0100)
Now that we initialize the state to both legacy and execlists inside
intel_engine_cs, we should also clean up that state from the common
functions.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1470226756-24401-1-git-send-email-chris@chris-wilson.co.uk
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
drivers/gpu/drm/i915/intel_engine_cs.c
drivers/gpu/drm/i915/intel_lrc.c
drivers/gpu/drm/i915/intel_ringbuffer.c
drivers/gpu/drm/i915/intel_ringbuffer.h

index a5f2128dd5a36560e0fb84dd16ae604cb02f7f30..4ec914ed9104c8914ba4db5534ee8872a51cd0fc 100644 (file)
@@ -210,3 +210,17 @@ int intel_engine_init_common(struct intel_engine_cs *engine)
 
        return intel_engine_init_cmd_parser(engine);
 }
+
+/**
+ * intel_engines_cleanup_common - cleans up the engine state created by
+ *                                the common initiailizers.
+ * @engine: Engine to cleanup.
+ *
+ * This cleans up everything created by the common helpers.
+ */
+void intel_engine_cleanup_common(struct intel_engine_cs *engine)
+{
+       intel_engine_cleanup_cmd_parser(engine);
+       intel_engine_fini_breadcrumbs(engine);
+       i915_gem_batch_pool_fini(&engine->batch_pool);
+}
index afc51d9fe624375471bd1d08ff78820ac31a5311..622cd0bdef381dde269d76205efdbeae728b9b12 100644 (file)
@@ -1720,10 +1720,7 @@ void intel_logical_ring_cleanup(struct intel_engine_cs *engine)
        if (engine->cleanup)
                engine->cleanup(engine);
 
-       intel_engine_cleanup_cmd_parser(engine);
-       i915_gem_batch_pool_fini(&engine->batch_pool);
-
-       intel_engine_fini_breadcrumbs(engine);
+       intel_engine_cleanup_common(engine);
 
        if (engine->status_page.obj) {
                i915_gem_object_unpin_map(engine->status_page.obj);
index a979acf5a2864aa4d67cdcab0a45069c3ed414cf..ecf4278fdabb30ea3f6b15a10a68ec712cd5819e 100644 (file)
@@ -2218,9 +2218,7 @@ void intel_engine_cleanup(struct intel_engine_cs *engine)
                cleanup_phys_status_page(engine);
        }
 
-       intel_engine_cleanup_cmd_parser(engine);
-       i915_gem_batch_pool_fini(&engine->batch_pool);
-       intel_engine_fini_breadcrumbs(engine);
+       intel_engine_cleanup_common(engine);
 
        intel_ring_context_unpin(dev_priv->kernel_context, engine);
 
index a94ed5db87cbcec48bad190a69327568e7ceecec..1706241718873774e6b56c1207b9932c8f55b8f8 100644 (file)
@@ -483,6 +483,7 @@ void intel_fini_pipe_control(struct intel_engine_cs *engine);
 
 void intel_engine_setup_common(struct intel_engine_cs *engine);
 int intel_engine_init_common(struct intel_engine_cs *engine);
+void intel_engine_cleanup_common(struct intel_engine_cs *engine);
 
 int intel_init_render_ring_buffer(struct intel_engine_cs *engine);
 int intel_init_bsd_ring_buffer(struct intel_engine_cs *engine);