Commit 33def1ff authored by Tvrtko Ursulin's avatar Tvrtko Ursulin

drm/i915: Simplify intel_engines_init

We do not want to carry on over missing constructors and don't
need a duplicated engine mask checking which is already done
in the setup phase.
Signed-off-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
parent 1f588aeb
...@@ -291,11 +291,9 @@ int intel_engines_init_mmio(struct drm_i915_private *dev_priv) ...@@ -291,11 +291,9 @@ int intel_engines_init_mmio(struct drm_i915_private *dev_priv)
*/ */
int intel_engines_init(struct drm_i915_private *dev_priv) int intel_engines_init(struct drm_i915_private *dev_priv)
{ {
struct intel_device_info *device_info = mkwrite_device_info(dev_priv);
struct intel_engine_cs *engine; struct intel_engine_cs *engine;
enum intel_engine_id id, err_id; enum intel_engine_id id, err_id;
unsigned int mask = 0; int err;
int err = 0;
for_each_engine(engine, dev_priv, id) { for_each_engine(engine, dev_priv, id) {
const struct engine_class_info *class_info = const struct engine_class_info *class_info =
...@@ -306,40 +304,30 @@ int intel_engines_init(struct drm_i915_private *dev_priv) ...@@ -306,40 +304,30 @@ int intel_engines_init(struct drm_i915_private *dev_priv)
init = class_info->init_execlists; init = class_info->init_execlists;
else else
init = class_info->init_legacy; init = class_info->init_legacy;
if (!init) {
kfree(engine); err = -EINVAL;
dev_priv->engine[id] = NULL; err_id = id;
continue;
} if (GEM_WARN_ON(!init))
goto cleanup;
err = init(engine); err = init(engine);
if (err) { if (err)
err_id = id;
goto cleanup; goto cleanup;
}
GEM_BUG_ON(!engine->submit_request); GEM_BUG_ON(!engine->submit_request);
mask |= ENGINE_MASK(id);
} }
/*
* Catch failures to update intel_engines table when the new engines
* are added to the driver by a warning and disabling the forgotten
* engines.
*/
if (WARN_ON(mask != INTEL_INFO(dev_priv)->ring_mask))
device_info->ring_mask = mask;
device_info->num_rings = hweight32(mask);
return 0; return 0;
cleanup: cleanup:
for_each_engine(engine, dev_priv, id) { for_each_engine(engine, dev_priv, id) {
if (id >= err_id) if (id >= err_id) {
kfree(engine); kfree(engine);
else dev_priv->engine[id] = NULL;
} else {
dev_priv->gt.cleanup_engine(engine); dev_priv->gt.cleanup_engine(engine);
}
} }
return err; return err;
} }
......
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