Commit e2d0ff35 authored by Tvrtko Ursulin's avatar Tvrtko Ursulin

drm/i915: Count engine instances per uabi class

This will be useful to have at hand in a following patch.
Signed-off-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: default avatarUmesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220401142205.3123159-8-tvrtko.ursulin@linux.intel.com
parent 2d12d3da
...@@ -193,7 +193,6 @@ static void add_legacy_ring(struct legacy_ring *ring, ...@@ -193,7 +193,6 @@ static void add_legacy_ring(struct legacy_ring *ring,
void intel_engines_driver_register(struct drm_i915_private *i915) void intel_engines_driver_register(struct drm_i915_private *i915)
{ {
struct legacy_ring ring = {}; struct legacy_ring ring = {};
u8 uabi_instances[5] = {};
struct list_head *it, *next; struct list_head *it, *next;
struct rb_node **p, *prev; struct rb_node **p, *prev;
LIST_HEAD(engines); LIST_HEAD(engines);
...@@ -214,8 +213,10 @@ void intel_engines_driver_register(struct drm_i915_private *i915) ...@@ -214,8 +213,10 @@ void intel_engines_driver_register(struct drm_i915_private *i915)
GEM_BUG_ON(engine->class >= ARRAY_SIZE(uabi_classes)); GEM_BUG_ON(engine->class >= ARRAY_SIZE(uabi_classes));
engine->uabi_class = uabi_classes[engine->class]; engine->uabi_class = uabi_classes[engine->class];
GEM_BUG_ON(engine->uabi_class >= ARRAY_SIZE(uabi_instances)); GEM_BUG_ON(engine->uabi_class >=
engine->uabi_instance = uabi_instances[engine->uabi_class]++; ARRAY_SIZE(i915->engine_uabi_class_count));
engine->uabi_instance =
i915->engine_uabi_class_count[engine->uabi_class]++;
/* Replace the internal name with the final user facing name */ /* Replace the internal name with the final user facing name */
memcpy(old, engine->name, sizeof(engine->name)); memcpy(old, engine->name, sizeof(engine->name));
...@@ -245,8 +246,8 @@ void intel_engines_driver_register(struct drm_i915_private *i915) ...@@ -245,8 +246,8 @@ void intel_engines_driver_register(struct drm_i915_private *i915)
int class, inst; int class, inst;
int errors = 0; int errors = 0;
for (class = 0; class < ARRAY_SIZE(uabi_instances); class++) { for (class = 0; class < ARRAY_SIZE(i915->engine_uabi_class_count); class++) {
for (inst = 0; inst < uabi_instances[class]; inst++) { for (inst = 0; inst < i915->engine_uabi_class_count[class]; inst++) {
engine = intel_engine_lookup_user(i915, engine = intel_engine_lookup_user(i915,
class, inst); class, inst);
if (!engine) { if (!engine) {
......
...@@ -533,6 +533,7 @@ struct drm_i915_private { ...@@ -533,6 +533,7 @@ struct drm_i915_private {
struct pci_dev *bridge_dev; struct pci_dev *bridge_dev;
struct rb_root uabi_engines; struct rb_root uabi_engines;
unsigned int engine_uabi_class_count[I915_LAST_UABI_ENGINE_CLASS + 1];
struct resource mch_res; struct resource mch_res;
......
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