public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Intel-gfx@lists.freedesktop.org
Cc: Rob Clark <robdclark@chromium.org>
Subject: [Intel-gfx] [PATCH 7/8] drm/i915: Count engine instances per uabi class
Date: Tue, 22 Feb 2022 14:04:21 +0000	[thread overview]
Message-ID: <20220222140422.1121163-8-tvrtko.ursulin@linux.intel.com> (raw)
In-Reply-To: <20220222140422.1121163-1-tvrtko.ursulin@linux.intel.com>

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

This will be useful to have at hand in a following patch.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@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];
 
 	struct resource mch_res;
 
-- 
2.32.0


  parent reply	other threads:[~2022-02-22 14:05 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-22 14:04 [Intel-gfx] [PATCH 0/8] Per client GPU utilisation Tvrtko Ursulin
2022-02-22 14:04 ` [Intel-gfx] [PATCH 1/8] drm/i915: Explicitly track DRM clients Tvrtko Ursulin
2022-02-22 14:04 ` [Intel-gfx] [PATCH 2/8] drm/i915: Make GEM contexts " Tvrtko Ursulin
2022-02-22 14:04 ` [Intel-gfx] [PATCH 3/8] drm/i915: Track runtime spent in closed and unreachable GEM contexts Tvrtko Ursulin
2022-02-22 14:04 ` [Intel-gfx] [PATCH 4/8] drm/i915: Track all user contexts per client Tvrtko Ursulin
2022-02-22 14:04 ` [Intel-gfx] [PATCH 5/8] drm/i915: Track context current active time Tvrtko Ursulin
2022-02-22 14:04 ` [Intel-gfx] [PATCH 6/8] drm: Document fdinfo format specification Tvrtko Ursulin
2022-02-22 14:04 ` Tvrtko Ursulin [this message]
2022-03-01 19:34   ` [Intel-gfx] [PATCH 7/8] drm/i915: Count engine instances per uabi class Umesh Nerlige Ramappa
2022-03-02  9:03     ` Tvrtko Ursulin
2022-03-04  0:06       ` Umesh Nerlige Ramappa
2022-02-22 14:04 ` [Intel-gfx] [PATCH 8/8] drm/i915: Expose client engine utilisation via fdinfo Tvrtko Ursulin
2022-03-01 17:40   ` Rob Clark
2022-02-22 21:58 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Per client GPU utilisation Patchwork
2022-02-22 21:59 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-02-22 22:03 ` [Intel-gfx] ✗ Fi.CI.DOCS: " Patchwork
2022-02-22 22:27 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-02-23  8:52 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2022-02-23 22:44 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Per client GPU utilisation (rev2) Patchwork
2022-02-23 22:45 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-02-23 22:49 ` [Intel-gfx] ✗ Fi.CI.DOCS: " Patchwork
2022-02-23 23:11 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-02-24 10:41 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2022-03-31 14:09 [Intel-gfx] [PATCH 0/8] Per client GPU utilisation Tvrtko Ursulin
2022-03-31 14:09 ` [Intel-gfx] [PATCH 7/8] drm/i915: Count engine instances per uabi class Tvrtko Ursulin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220222140422.1121163-8-tvrtko.ursulin@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=Intel-gfx@lists.freedesktop.org \
    --cc=robdclark@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox