We have to mix a static UABI engine id with the potential for a varying hw_id and layout, and so we need a way to map from the userspace id for an engine to our internal pointers. Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> --- drivers/gpu/drm/i915/intel_engine_cs.c | 17 +++++++++++++++++ drivers/gpu/drm/i915/intel_ringbuffer.h | 3 +++ 2 files changed, 20 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_engine_cs.c b/drivers/gpu/drm/i915/intel_engine_cs.c index 0f8b3312dad8..8a197f826d38 100644 --- a/drivers/gpu/drm/i915/intel_engine_cs.c +++ b/drivers/gpu/drm/i915/intel_engine_cs.c @@ -1125,6 +1125,23 @@ void intel_engines_cleanup(struct drm_i915_private *i915) engine->cleanup(engine); } +struct intel_engine_cs * +intel_engine_lookup(struct drm_i915_private *i915, u32 uabi_id) +{ + static const enum intel_engine_id uabi_map[] = { + [I915_EXEC_DEFAULT] = RCS, + [I915_EXEC_RENDER] = RCS, + [I915_EXEC_BLT] = BCS, + [I915_EXEC_BSD] = VCS, + [I915_EXEC_VEBOX] = VECS, + }; + + if (uabi_id >= ARRAY_SIZE(uabi_map)) + return NULL; + + return i915->engine[uabi_map[uabi_id]]; +} + #if IS_ENABLED(CONFIG_DRM_I915_SELFTEST) #include "selftests/mock_engine.c" #endif diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h index 53880389e6c9..7f8366da5a4c 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.h +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h @@ -671,6 +671,9 @@ static inline u32 *gen8_emit_pipe_control(u32 *batch, u32 flags, u32 offset) return batch + 6; } +struct intel_engine_cs * +intel_engine_lookup(struct drm_i915_private *i915, u32 uabi_id); + bool intel_engine_is_idle(struct intel_engine_cs *engine); bool intel_engines_are_idle(struct drm_i915_private *dev_priv); -- 2.11.0 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx