[Intel-gfx] [PATCH 7/8] drm/i915: Count engine instances per uabi class

Umesh Nerlige Ramappa umesh.nerlige.ramappa at intel.com
Fri Mar 4 00:06:48 UTC 2022


On Wed, Mar 02, 2022 at 09:03:18AM +0000, Tvrtko Ursulin wrote:
>
>On 01/03/2022 19:34, Umesh Nerlige Ramappa wrote:
>>On Tue, Feb 22, 2022 at 02:04:21PM +0000, Tvrtko Ursulin wrote:
>>>From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
>>>
>>>This will be useful to have at hand in a following patch.
>>>
>>>Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
>>>---
>>>drivers/gpu/drm/i915/gt/intel_engine_user.c | 11 ++++++-----
>>>drivers/gpu/drm/i915/i915_drv.h             |  1 +
>>>2 files changed, 7 insertions(+), 5 deletions(-)
>>>
>>>diff --git a/drivers/gpu/drm/i915/gt/intel_engine_user.c 
>>>b/drivers/gpu/drm/i915/gt/intel_engine_user.c
>>>index 9ce85a845105..5dd559253078 100644
>>>--- a/drivers/gpu/drm/i915/gt/intel_engine_user.c
>>>+++ b/drivers/gpu/drm/i915/gt/intel_engine_user.c
>>>@@ -190,7 +190,6 @@ static void add_legacy_ring(struct legacy_ring *ring,
>>>void intel_engines_driver_register(struct drm_i915_private *i915)
>>>{
>>>    struct legacy_ring ring = {};
>>>-    u8 uabi_instances[4] = {};
>>>    struct list_head *it, *next;
>>>    struct rb_node **p, *prev;
>>>    LIST_HEAD(engines);
>>>@@ -211,8 +210,10 @@ void intel_engines_driver_register(struct 
>>>drm_i915_private *i915)
>>>        GEM_BUG_ON(engine->class >= ARRAY_SIZE(uabi_classes));
>>>        engine->uabi_class = uabi_classes[engine->class];
>>>
>>>-        GEM_BUG_ON(engine->uabi_class >= ARRAY_SIZE(uabi_instances));
>>>-        engine->uabi_instance = uabi_instances[engine->uabi_class]++;
>>>+        GEM_BUG_ON(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 */
>>>        memcpy(old, engine->name, sizeof(engine->name));
>>>@@ -242,8 +243,8 @@ void intel_engines_driver_register(struct 
>>>drm_i915_private *i915)
>>>        int class, inst;
>>>        int errors = 0;
>>>
>>>-        for (class = 0; class < ARRAY_SIZE(uabi_instances); class++) {
>>>-            for (inst = 0; inst < uabi_instances[class]; inst++) {
>>>+        for (class = 0; class < 
>>>ARRAY_SIZE(i915->engine_uabi_class_count); class++) {
>>>+            for (inst = 0; inst < 
>>>i915->engine_uabi_class_count[class]; inst++) {
>>>                engine = intel_engine_lookup_user(i915,
>>>                                  class, inst);
>>>                if (!engine) {
>>>diff --git a/drivers/gpu/drm/i915/i915_drv.h 
>>>b/drivers/gpu/drm/i915/i915_drv.h
>>>index b9d38276801d..68d8a751008b 100644
>>>--- a/drivers/gpu/drm/i915/i915_drv.h
>>>+++ b/drivers/gpu/drm/i915/i915_drv.h
>>>@@ -533,6 +533,7 @@ struct drm_i915_private {
>>>    struct pci_dev *bridge_dev;
>>>
>>>    struct rb_root uabi_engines;
>>>+    unsigned int 
>>>engine_uabi_class_count[I915_LAST_UABI_ENGINE_CLASS + 1];
>>
>>lgtm,
>>Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa at intel.com>
>
>Thanks Umesh - for the series or just this patch? I'd need to update 
>your r-b's on patches 3, 6 and 8 to latest as well.

I checked out the diff between this series and the previous one. The 
changes look good.

For the series:
Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa at intel.com>

Thanks,
Umesh
>
>Regards,
>
>Tvrtko


More information about the Intel-gfx mailing list