Skip to contentSkip to conversation

drm/i915: Move engine->needs_cmd_parser to engine->flags

PATCH Superseded Tvrtko Ursulin 6 participants 19 messages Nov 24, 2017 – Nov 29, 2017

Subsystems (2)
lore
Share & tools
lore

Tvrtko Ursulin

author maintainer
#0 lore raw

PATCH 1/2 drm/i915: Move engine->needs_cmd_parser to engine->flags

From: Tvrtko Ursulin <[email protected]>

Will be adding a new per-engine flags shortly so it makes sense to consolidate.

---
 drivers/gpu/drm/i915/i915_cmd_parser.c     | 11 +++++------
 drivers/gpu/drm/i915/i915_gem_execbuffer.c |  2 +-
 drivers/gpu/drm/i915/intel_ringbuffer.h    |  8 +++++++-
 3 files changed, 13 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/i915_cmd_parser.c +5 -6
index b11629beeb63..447c0b89493f 100644
@@ -26,6 +26,7 @@
  */
 
 #include "i915_drv.h"
+#include "intel_ringbuffer.h"
 
 /**
  * DOC: batch buffer command parser
@@ -940,7 +941,7 @@ void intel_engine_init_cmd_parser(struct intel_engine_cs *engine)
 		return;
 	}
 
-	engine->needs_cmd_parser = true;
+	engine->flags |= I915_ENGINE_NEEDS_CMD_PARSER;
 }
 
 /**
@@ -952,10 +953,8 @@ void intel_engine_init_cmd_parser(struct intel_engine_cs *engine)
  */
 void intel_engine_cleanup_cmd_parser(struct intel_engine_cs *engine)
 {
-	if (!engine->needs_cmd_parser)
-		return;
-
-	fini_hash_table(engine);
+	if (intel_engine_needs_cmd_parser(engine))
+		fini_hash_table(engine);
 }
 
 static const struct drm_i915_cmd_descriptor*
@@ -1350,7 +1349,7 @@ int i915_cmd_parser_get_version(struct drm_i915_private *dev_priv)
 
 	/* If the command parser is not enabled, report 0 - unsupported */
 	for_each_engine(engine, dev_priv, id) {
-		if (engine->needs_cmd_parser) {
+		if (intel_engine_needs_cmd_parser(engine)) {
 			active = true;
 			break;
 		}
drivers/gpu/drm/i915/i915_gem_execbuffer.c +1 -1
index 14d9e61a1e06..70ccd63cbf8e 100644
@@ -271,7 +271,7 @@ static inline u64 gen8_noncanonical_addr(u64 address)
 
 static inline bool eb_use_cmdparser(const struct i915_execbuffer *eb)
 {
-	return eb->engine->needs_cmd_parser && eb->batch_len;
+	return intel_engine_needs_cmd_parser(eb->engine) && eb->batch_len;
 }
 
 static int eb_create(struct i915_execbuffer *eb)
drivers/gpu/drm/i915/intel_ringbuffer.h +7 -1
index 0f38d7b43f31..a91ce63b88b6 100644
@@ -539,7 +539,8 @@ struct intel_engine_cs {
 
 	struct intel_engine_hangcheck hangcheck;
 
-	bool needs_cmd_parser;
+#define I915_ENGINE_NEEDS_CMD_PARSER BIT(0)
+	unsigned int flags;
 
 	/*
 	 * Table of commands the command parser needs to know about
@@ -598,6 +599,11 @@ struct intel_engine_cs {
 	} stats;
 };
 
+static inline bool intel_engine_needs_cmd_parser(struct intel_engine_cs *engine)
+{
+	return engine->flags & I915_ENGINE_NEEDS_CMD_PARSER;
+}
+
 static inline void
 execlists_set_active(struct intel_engine_execlists *execlists,
 		     unsigned int bit)
Signature · 6 lines
2.14.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
author maintainer
#1 lore raw

PATCH 2/2 drm/i915: Consolidate checks for engine stats availability

From: Tvrtko Ursulin <[email protected]>

Sagar noticed the check can be consolidated between the engine stats implementation and the PMU.

My first choice was a static inline helper but that got into include ordering mess quickly fast so I went with a macro instead. At some point we should perhaps looking into taking out the non-ringubffer bits from intel_ringbuffer.h into a new intel_engine.h or something.

v2: Use engine->flags. (Chris Wilson)

---
 drivers/gpu/drm/i915/i915_pmu.c         | 11 ++++-------
 drivers/gpu/drm/i915/intel_engine_cs.c  |  7 +++++--
 drivers/gpu/drm/i915/intel_ringbuffer.h |  6 ++++++
 3 files changed, 15 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/i915_pmu.c +4 -7
index 685aef1d81b9..ccce9c84add1 100644
@@ -90,11 +90,6 @@ static unsigned int event_enabled_bit(struct perf_event *event)
 	return config_enabled_bit(event->attr.config);
 }
 
-static bool supports_busy_stats(struct drm_i915_private *i915)
-{
-	return INTEL_GEN(i915) >= 8;
-}
-
 static bool pmu_needs_timer(struct drm_i915_private *i915, bool gpu_active)
 {
 	u64 enable;
@@ -123,8 +118,10 @@ static bool pmu_needs_timer(struct drm_i915_private *i915, bool gpu_active)
 	/*
 	 * Also there is software busyness tracking available we do not
 	 * need the timer for I915_SAMPLE_BUSY counter.
+	 *
+	 * Use RCS as proxy for all engines.
 	 */
-	else if (supports_busy_stats(i915))
+	else if (intel_engine_supports_stats(i915->engine[RCS]))
 		enable &= ~BIT(I915_SAMPLE_BUSY);
 
 	/*
@@ -458,7 +455,7 @@ static void i915_pmu_event_read(struct perf_event *event)
 
 static bool engine_needs_busy_stats(struct intel_engine_cs *engine)
 {
-	return supports_busy_stats(engine->i915) &&
+	return intel_engine_supports_stats(engine) &&
 	       (engine->pmu.enable & BIT(I915_SAMPLE_BUSY));
 }
 
drivers/gpu/drm/i915/intel_engine_cs.c +5 -2
index fede62daf3e1..1ee8c8dcc2c7 100644
@@ -420,6 +420,9 @@ static void intel_engine_init_execlist(struct intel_engine_cs *engine)
 
 	execlists->queue = RB_ROOT;
 	execlists->first = NULL;
+
+	if (INTEL_GEN(engine->i915) >=8)
+		engine->flags |= I915_ENGINE_SUPPORTS_STATS;
 }
 
 /**
@@ -1863,7 +1866,7 @@ int intel_enable_engine_stats(struct intel_engine_cs *engine)
 {
 	unsigned long flags;
 
-	if (INTEL_GEN(engine->i915) < 8)
+	if (!intel_engine_supports_stats(engine))
 		return -ENODEV;
 
 	spin_lock_irqsave(&engine->stats.lock, flags);
@@ -1924,7 +1927,7 @@ void intel_disable_engine_stats(struct intel_engine_cs *engine)
 {
 	unsigned long flags;
 
-	if (INTEL_GEN(engine->i915) < 8)
+	if (!intel_engine_supports_stats(engine))
 		return;
 
 	spin_lock_irqsave(&engine->stats.lock, flags);
drivers/gpu/drm/i915/intel_ringbuffer.h +6 -0
index a91ce63b88b6..c68ab3ead83c 100644
@@ -540,6 +540,7 @@ struct intel_engine_cs {
 	struct intel_engine_hangcheck hangcheck;
 
 #define I915_ENGINE_NEEDS_CMD_PARSER BIT(0)
+#define I915_ENGINE_SUPPORTS_STATS   BIT(1)
 	unsigned int flags;
 
 	/*
@@ -604,6 +605,11 @@ static inline bool intel_engine_needs_cmd_parser(struct intel_engine_cs *engine)
 	return engine->flags & I915_ENGINE_NEEDS_CMD_PARSER;
 }
 
+static inline bool intel_engine_supports_stats(struct intel_engine_cs *engine)
+{
+	return engine->flags & I915_ENGINE_SUPPORTS_STATS;
+}
+
 static inline void
 execlists_set_active(struct intel_engine_execlists *execlists,
 		     unsigned int bit)
Signature · 6 lines
2.14.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] drm/i915: Consolidate checks for engine stats availability

Quoting Tvrtko Ursulin (2017-11-24 11:21:21)

Quoted 21 lines

From: Tvrtko Ursulin <[email protected]>

Sagar noticed the check can be consolidated between the engine stats implementation and the PMU.

My first choice was a static inline helper but that got into include ordering mess quickly fast so I went with a macro instead. At some point we should perhaps looking into taking out the non-ringubffer bits from intel_ringbuffer.h into a new intel_engine.h or something.

v2: Use engine->flags. (Chris Wilson)

---

drivers/gpu/drm/i915/intel_engine_cs.c +0 -0
index fede62daf3e1..1ee8c8dcc2c7 100644

drivers/gpu/drm/i915/intel_engine_cs.c static void intel_engine_init_execlist(struct intel_engine_cs *engine) · line 425

Quoted 6 lines
drivers/gpu/drm/i915/intel_engine_cs.c +3 -0
@@ -420,6 +420,9 @@ static void intel_engine_init_execlist(struct intel_engine_cs *engine)
 
        execlists->queue = RB_ROOT;
        execlists->first = NULL;
+
+       if (INTEL_GEN(engine->i915) >=8)
+               engine->flags |= I915_ENGINE_SUPPORTS_STATS;

Oh, I was thinking of sticking it over in logical_ring_setup() (or _init()), so it was closer to where we implement the alternatve mode. (At least that's the graph I have in my head, it's bit more confusing because intel_engine_context_in() is elsewhere.)

Hmm, I am really not sure who depends on who. Setting the flag here is immaterial if we don't couple it in from execlists. Similarly the stats from execlists are meaningless unless they have been enabled.

Overall though, I think it is still a mechanism that is opted into by execlists, and that's where we should then declare the flag.

Other than that (and a small tear for having to use i915->engine[RCS]->flags),

for both patches. Joonas is going to be thrilled by the first ;) -Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

author maintainer
#3 lore raw

PATCH v5 2/2 drm/i915: Consolidate checks for engine stats availability

In reply to Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

Sagar noticed the check can be consolidated between the engine stats implementation and the PMU.

My first choice was a static inline helper but that got into include ordering mess quickly fast so I went with a macro instead. At some point we should perhaps looking into taking out the non-ringubffer bits from intel_ringbuffer.h into a new intel_engine.h or something.

v2: Use engine->flags. (Chris Wilson)
v3: Rebase and mark GuC as not yet supported. (Chris Wilson)
v4: Move flag setting to intel_engines_reset_default_submission.
(Chris Wilson)
v5: Move flag setting to logical_ring_setup.

---
 drivers/gpu/drm/i915/i915_pmu.c             | 11 ++++-------
 drivers/gpu/drm/i915/intel_engine_cs.c      |  8 +++++---
 drivers/gpu/drm/i915/intel_guc_submission.c |  2 ++
 drivers/gpu/drm/i915/intel_lrc.c            |  2 ++
 drivers/gpu/drm/i915/intel_ringbuffer.h     |  6 ++++++
 5 files changed, 19 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/i915_pmu.c +4 -7
index 1c0ee9d68b04..e8e2faf4982f 100644
@@ -90,11 +90,6 @@ static unsigned int event_enabled_bit(struct perf_event *event)
 	return config_enabled_bit(event->attr.config);
 }
 
-static bool supports_busy_stats(struct drm_i915_private *i915)
-{
-	return INTEL_GEN(i915) >= 8;
-}
-
 static bool pmu_needs_timer(struct drm_i915_private *i915, bool gpu_active)
 {
 	u64 enable;
@@ -123,8 +118,10 @@ static bool pmu_needs_timer(struct drm_i915_private *i915, bool gpu_active)
 	/*
 	 * Also there is software busyness tracking available we do not
 	 * need the timer for I915_SAMPLE_BUSY counter.
+	 *
+	 * Use RCS as proxy for all engines.
 	 */
-	else if (supports_busy_stats(i915))
+	else if (intel_engine_supports_stats(i915->engine[RCS]))
 		enable &= ~BIT(I915_SAMPLE_BUSY);
 
 	/*
@@ -447,7 +444,7 @@ static void i915_pmu_event_read(struct perf_event *event)
 
 static bool engine_needs_busy_stats(struct intel_engine_cs *engine)
 {
-	return supports_busy_stats(engine->i915) &&
+	return intel_engine_supports_stats(engine) &&
 	       (engine->pmu.enable & BIT(I915_SAMPLE_BUSY));
 }
 
drivers/gpu/drm/i915/intel_engine_cs.c +5 -3
index fede62daf3e1..3143b8ed7a0c 100644
@@ -1561,8 +1561,10 @@ void intel_engines_reset_default_submission(struct drm_i915_private *i915)
 	struct intel_engine_cs *engine;
 	enum intel_engine_id id;
 
-	for_each_engine(engine, i915, id)
+	for_each_engine(engine, i915, id) {
 		engine->set_default_submission(engine);
+		engine->flags |= I915_ENGINE_SUPPORTS_STATS;
+	}
 }
 
 /**
@@ -1863,7 +1865,7 @@ int intel_enable_engine_stats(struct intel_engine_cs *engine)
 {
 	unsigned long flags;
 
-	if (INTEL_GEN(engine->i915) < 8)
+	if (!intel_engine_supports_stats(engine))
 		return -ENODEV;
 
 	spin_lock_irqsave(&engine->stats.lock, flags);
@@ -1924,7 +1926,7 @@ void intel_disable_engine_stats(struct intel_engine_cs *engine)
 {
 	unsigned long flags;
 
-	if (INTEL_GEN(engine->i915) < 8)
+	if (!intel_engine_supports_stats(engine))
 		return;
 
 	spin_lock_irqsave(&engine->stats.lock, flags);
drivers/gpu/drm/i915/intel_guc_submission.c +2 -0
index cf1cc2cb6722..912ff143d531 100644
@@ -1453,6 +1453,8 @@ int intel_guc_submission_enable(struct intel_guc *guc)
 		execlists->tasklet.func = guc_submission_tasklet;
 		engine->park = guc_submission_park;
 		engine->unpark = guc_submission_unpark;
+
+		engine->flags &= ~I915_ENGINE_SUPPORTS_STATS;
 	}
 
 	return 0;
drivers/gpu/drm/i915/intel_lrc.c +2 -0
index 570864583e28..904d9f821c2f 100644
@@ -1963,6 +1963,8 @@ logical_ring_setup(struct intel_engine_cs *engine)
 	/* Intentionally left blank. */
 	engine->buffer = NULL;
 
+	engine->flags |= I915_ENGINE_SUPPORTS_STATS;
+
 	fw_domains = intel_uncore_forcewake_for_reg(dev_priv,
 						    RING_ELSP(engine),
 						    FW_REG_WRITE);
drivers/gpu/drm/i915/intel_ringbuffer.h +6 -0
index a91ce63b88b6..c68ab3ead83c 100644
@@ -540,6 +540,7 @@ struct intel_engine_cs {
 	struct intel_engine_hangcheck hangcheck;
 
 #define I915_ENGINE_NEEDS_CMD_PARSER BIT(0)
+#define I915_ENGINE_SUPPORTS_STATS   BIT(1)
 	unsigned int flags;
 
 	/*
@@ -604,6 +605,11 @@ static inline bool intel_engine_needs_cmd_parser(struct intel_engine_cs *engine)
 	return engine->flags & I915_ENGINE_NEEDS_CMD_PARSER;
 }
 
+static inline bool intel_engine_supports_stats(struct intel_engine_cs *engine)
+{
+	return engine->flags & I915_ENGINE_SUPPORTS_STATS;
+}
+
 static inline void
 execlists_set_active(struct intel_engine_execlists *execlists,
 		     unsigned int bit)
Signature · 6 lines
2.14.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer Reviewed-by on v5 2/2
#4 lore raw

Re: [PATCH v5 2/2] drm/i915: Consolidate checks for engine stats availability

Quoted 16 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

Sagar noticed the check can be consolidated between the engine stats implementation and the PMU.

My first choice was a static inline helper but that got into include ordering mess quickly fast so I went with a macro instead. At some point we should perhaps looking into taking out the non-ringubffer bits from intel_ringbuffer.h into a new intel_engine.h or something.

v2: Use engine->flags. (Chris Wilson)
v3: Rebase and mark GuC as not yet supported. (Chris Wilson)
v4: Move flag setting to intel_engines_reset_default_submission.
(Chris Wilson)
v5: Move flag setting to logical_ring_setup.

Quoted 4 lines

Regards, Joonas

Signature · 7 lines
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
author maintainer
#5 lore raw

PATCH v6 2/2 drm/i915: Consolidate checks for engine stats availability

In reply to Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

Sagar noticed the check can be consolidated between the engine stats implementation and the PMU.

My first choice was a static inline helper but that got into include ordering mess quickly fast so I went with a macro instead. At some point we should perhaps looking into taking out the non-ringubffer bits from intel_ringbuffer.h into a new intel_engine.h or something.

v2: Use engine->flags. (Chris Wilson)
v3: Rebase and mark GuC as not yet supported. (Chris Wilson)
v4: Move flag setting to intel_engines_reset_default_submission.
(Chris Wilson)
v5: Move flag setting to logical_ring_setup.
v6: intel_engines_reset_default_submission is the wrong place to set the
flag - it needs to be in execlists_set_default_submission. (Sagar)

---
 drivers/gpu/drm/i915/i915_pmu.c             | 11 ++++-------
 drivers/gpu/drm/i915/intel_engine_cs.c      |  4 ++--
 drivers/gpu/drm/i915/intel_guc_submission.c |  2 ++
 drivers/gpu/drm/i915/intel_lrc.c            |  4 ++++
 drivers/gpu/drm/i915/intel_ringbuffer.h     |  6 ++++++
 5 files changed, 18 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/i915_pmu.c +4 -7
index 1c0ee9d68b04..e8e2faf4982f 100644
@@ -90,11 +90,6 @@ static unsigned int event_enabled_bit(struct perf_event *event)
 	return config_enabled_bit(event->attr.config);
 }
 
-static bool supports_busy_stats(struct drm_i915_private *i915)
-{
-	return INTEL_GEN(i915) >= 8;
-}
-
 static bool pmu_needs_timer(struct drm_i915_private *i915, bool gpu_active)
 {
 	u64 enable;
@@ -123,8 +118,10 @@ static bool pmu_needs_timer(struct drm_i915_private *i915, bool gpu_active)
 	/*
 	 * Also there is software busyness tracking available we do not
 	 * need the timer for I915_SAMPLE_BUSY counter.
+	 *
+	 * Use RCS as proxy for all engines.
 	 */
-	else if (supports_busy_stats(i915))
+	else if (intel_engine_supports_stats(i915->engine[RCS]))
 		enable &= ~BIT(I915_SAMPLE_BUSY);
 
 	/*
@@ -447,7 +444,7 @@ static void i915_pmu_event_read(struct perf_event *event)
 
 static bool engine_needs_busy_stats(struct intel_engine_cs *engine)
 {
-	return supports_busy_stats(engine->i915) &&
+	return intel_engine_supports_stats(engine) &&
 	       (engine->pmu.enable & BIT(I915_SAMPLE_BUSY));
 }
 
drivers/gpu/drm/i915/intel_engine_cs.c +2 -2
index fede62daf3e1..cffd0c812b7e 100644
@@ -1863,7 +1863,7 @@ int intel_enable_engine_stats(struct intel_engine_cs *engine)
 {
 	unsigned long flags;
 
-	if (INTEL_GEN(engine->i915) < 8)
+	if (!intel_engine_supports_stats(engine))
 		return -ENODEV;
 
 	spin_lock_irqsave(&engine->stats.lock, flags);
@@ -1924,7 +1924,7 @@ void intel_disable_engine_stats(struct intel_engine_cs *engine)
 {
 	unsigned long flags;
 
-	if (INTEL_GEN(engine->i915) < 8)
+	if (!intel_engine_supports_stats(engine))
 		return;
 
 	spin_lock_irqsave(&engine->stats.lock, flags);
drivers/gpu/drm/i915/intel_guc_submission.c +2 -0
index cf1cc2cb6722..912ff143d531 100644
@@ -1453,6 +1453,8 @@ int intel_guc_submission_enable(struct intel_guc *guc)
 		execlists->tasklet.func = guc_submission_tasklet;
 		engine->park = guc_submission_park;
 		engine->unpark = guc_submission_unpark;
+
+		engine->flags &= ~I915_ENGINE_SUPPORTS_STATS;
 	}
 
 	return 0;
drivers/gpu/drm/i915/intel_lrc.c +4 -0
index 570864583e28..ef513e1c10f3 100644
@@ -1919,6 +1919,8 @@ static void execlists_set_default_submission(struct intel_engine_cs *engine)
 
 	engine->park = NULL;
 	engine->unpark = NULL;
+
+	engine->flags |= I915_ENGINE_SUPPORTS_STATS;
 }
 
 static void
@@ -1963,6 +1965,8 @@ logical_ring_setup(struct intel_engine_cs *engine)
 	/* Intentionally left blank. */
 	engine->buffer = NULL;
 
+	engine->flags |= I915_ENGINE_SUPPORTS_STATS;
+
 	fw_domains = intel_uncore_forcewake_for_reg(dev_priv,
 						    RING_ELSP(engine),
 						    FW_REG_WRITE);
drivers/gpu/drm/i915/intel_ringbuffer.h +6 -0
index a91ce63b88b6..c68ab3ead83c 100644
@@ -540,6 +540,7 @@ struct intel_engine_cs {
 	struct intel_engine_hangcheck hangcheck;
 
 #define I915_ENGINE_NEEDS_CMD_PARSER BIT(0)
+#define I915_ENGINE_SUPPORTS_STATS   BIT(1)
 	unsigned int flags;
 
 	/*
@@ -604,6 +605,11 @@ static inline bool intel_engine_needs_cmd_parser(struct intel_engine_cs *engine)
 	return engine->flags & I915_ENGINE_NEEDS_CMD_PARSER;
 }
 
+static inline bool intel_engine_supports_stats(struct intel_engine_cs *engine)
+{
+	return engine->flags & I915_ENGINE_SUPPORTS_STATS;
+}
+
 static inline void
 execlists_set_active(struct intel_engine_execlists *execlists,
 		     unsigned int bit)
Signature · 6 lines
2.14.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v6 2/2
#6 lore raw

Re: [PATCH v6 2/2] drm/i915: Consolidate checks for engine stats availability

Quoted 18 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

Sagar noticed the check can be consolidated between the engine stats implementation and the PMU.

My first choice was a static inline helper but that got into include ordering mess quickly fast so I went with a macro instead. At some point we should perhaps looking into taking out the non-ringubffer bits from intel_ringbuffer.h into a new intel_engine.h or something.

v2: Use engine->flags. (Chris Wilson)
v3: Rebase and mark GuC as not yet supported. (Chris Wilson)
v4: Move flag setting to intel_engines_reset_default_submission.
(Chris Wilson)
v5: Move flag setting to logical_ring_setup.
v6: intel_engines_reset_default_submission is the wrong place to set the
flag - it needs to be in execlists_set_default_submission. (Sagar)

Quoted 4 lines
Quoted 116 lines
---
  drivers/gpu/drm/i915/i915_pmu.c             | 11 ++++-------
  drivers/gpu/drm/i915/intel_engine_cs.c      |  4 ++--
  drivers/gpu/drm/i915/intel_guc_submission.c |  2 ++
  drivers/gpu/drm/i915/intel_lrc.c            |  4 ++++
  drivers/gpu/drm/i915/intel_ringbuffer.h     |  6 ++++++
  5 files changed, 18 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/i915_pmu.c +4 -7
index 1c0ee9d68b04..e8e2faf4982f 100644
@@ -90,11 +90,6 @@ static unsigned int event_enabled_bit(struct perf_event *event)
  	return config_enabled_bit(event->attr.config);
  }
 
-static bool supports_busy_stats(struct drm_i915_private *i915)
-{
-	return INTEL_GEN(i915) >= 8;
-}
-
  static bool pmu_needs_timer(struct drm_i915_private *i915, bool gpu_active)
  {
  	u64 enable;
@@ -123,8 +118,10 @@ static bool pmu_needs_timer(struct drm_i915_private *i915, bool gpu_active)
  	/*
  	 * Also there is software busyness tracking available we do not
  	 * need the timer for I915_SAMPLE_BUSY counter.
+	 *
+	 * Use RCS as proxy for all engines.
  	 */
-	else if (supports_busy_stats(i915))
+	else if (intel_engine_supports_stats(i915->engine[RCS]))
  		enable &= ~BIT(I915_SAMPLE_BUSY);
 
  	/*
@@ -447,7 +444,7 @@ static void i915_pmu_event_read(struct perf_event *event)
 
  static bool engine_needs_busy_stats(struct intel_engine_cs *engine)
  {
-	return supports_busy_stats(engine->i915) &&
+	return intel_engine_supports_stats(engine) &&
  	       (engine->pmu.enable & BIT(I915_SAMPLE_BUSY));
  }
 
drivers/gpu/drm/i915/intel_engine_cs.c +2 -2
index fede62daf3e1..cffd0c812b7e 100644
@@ -1863,7 +1863,7 @@ int intel_enable_engine_stats(struct intel_engine_cs *engine)
  {
  	unsigned long flags;
 
-	if (INTEL_GEN(engine->i915) < 8)
+	if (!intel_engine_supports_stats(engine))
  		return -ENODEV;
 
  	spin_lock_irqsave(&engine->stats.lock, flags);
@@ -1924,7 +1924,7 @@ void intel_disable_engine_stats(struct intel_engine_cs *engine)
  {
  	unsigned long flags;
 
-	if (INTEL_GEN(engine->i915) < 8)
+	if (!intel_engine_supports_stats(engine))
  		return;
 
  	spin_lock_irqsave(&engine->stats.lock, flags);
drivers/gpu/drm/i915/intel_guc_submission.c +2 -0
index cf1cc2cb6722..912ff143d531 100644
@@ -1453,6 +1453,8 @@ int intel_guc_submission_enable(struct intel_guc *guc)
  		execlists->tasklet.func = guc_submission_tasklet;
  		engine->park = guc_submission_park;
  		engine->unpark = guc_submission_unpark;
+
+		engine->flags &= ~I915_ENGINE_SUPPORTS_STATS;
  	}
 
  	return 0;
drivers/gpu/drm/i915/intel_lrc.c +4 -0
index 570864583e28..ef513e1c10f3 100644
@@ -1919,6 +1919,8 @@ static void execlists_set_default_submission(struct intel_engine_cs *engine)
 
  	engine->park = NULL;
  	engine->unpark = NULL;
+
+	engine->flags |= I915_ENGINE_SUPPORTS_STATS;
  }
 
  static void
@@ -1963,6 +1965,8 @@ logical_ring_setup(struct intel_engine_cs *engine)
  	/* Intentionally left blank. */
  	engine->buffer = NULL;
 
+	engine->flags |= I915_ENGINE_SUPPORTS_STATS;
+
  	fw_domains = intel_uncore_forcewake_for_reg(dev_priv,
  						    RING_ELSP(engine),
  						    FW_REG_WRITE);
drivers/gpu/drm/i915/intel_ringbuffer.h +1 -0
index a91ce63b88b6..c68ab3ead83c 100644
@@ -540,6 +540,7 @@ struct intel_engine_cs {
  	struct intel_engine_hangcheck hangcheck;
 
  #define I915_ENGINE_NEEDS_CMD_PARSER BIT(0)
+#define I915_ENGINE_SUPPORTS_STATS   BIT(1)
  	unsigned int flags;
 
  	/*
@@ -604,6 +605,11 @@ static inline bool intel_engine_needs_cmd_parser(struct intel_engine_cs *engine)
  	return engine->flags & I915_ENGINE_NEEDS_CMD_PARSER;

drivers/gpu/drm/i915/intel_ringbuffer.h static inline bool intel_engine_needs_cmd_parser(struct intel_engine_cs *engine) · line 615

Quoted 10 lines
drivers/gpu/drm/i915/intel_ringbuffer.h +5 -0
  }
 
+static inline bool intel_engine_supports_stats(struct intel_engine_cs *engine)
+{
+	return engine->flags & I915_ENGINE_SUPPORTS_STATS;
+}
+
  static inline void
  execlists_set_active(struct intel_engine_execlists *execlists,
  		     unsigned int bit)

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reviewed-by on v6 2/2
#7 lore raw

Re: [PATCH v6 2/2] drm/i915: Consolidate checks for engine stats availability

In reply to Tvrtko Ursulin

Quoting Tvrtko Ursulin (2017-11-29 09:27:56)

Quoted 37 lines

From: Tvrtko Ursulin <[email protected]>

Sagar noticed the check can be consolidated between the engine stats implementation and the PMU.

My first choice was a static inline helper but that got into include ordering mess quickly fast so I went with a macro instead. At some point we should perhaps looking into taking out the non-ringubffer bits from intel_ringbuffer.h into a new intel_engine.h or something.

v2: Use engine->flags. (Chris Wilson)
v3: Rebase and mark GuC as not yet supported. (Chris Wilson)
v4: Move flag setting to intel_engines_reset_default_submission.
(Chris Wilson)
v5: Move flag setting to logical_ring_setup.
v6: intel_engines_reset_default_submission is the wrong place to set the
flag - it needs to be in execlists_set_default_submission. (Sagar)

---

drivers/gpu/drm/i915/intel_lrc.c +2 -0
index 570864583e28..ef513e1c10f3 100644
@@ -1919,6 +1919,8 @@ static void execlists_set_default_submission(struct intel_engine_cs *engine)
 
        engine->park = NULL;
        engine->unpark = NULL;
+
+       engine->flags |= I915_ENGINE_SUPPORTS_STATS;
 }
 
 static void

drivers/gpu/drm/i915/intel_lrc.c logical_ring_setup(struct intel_engine_cs *engine) · line 1968

Quoted 4 lines
drivers/gpu/drm/i915/intel_lrc.c +1 -0
@@ -1963,6 +1965,8 @@ logical_ring_setup(struct intel_engine_cs *engine)
        /* Intentionally left blank. */
        engine->buffer = NULL;
 
+       engine->flags |= I915_ENGINE_SUPPORTS_STATS;

Now that you've added it to execlists_set_default_submission, you can remove the flag from here, as it will be set by the call from intel_engine_init_common().

-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

author maintainer
#8 lore raw

PATCH v7 2/2 drm/i915: Consolidate checks for engine stats availability

From: Tvrtko Ursulin <[email protected]>

Sagar noticed the check can be consolidated between the engine stats implementation and the PMU.

My first choice was a static inline helper but that got into include ordering mess quickly fast so I went with a macro instead. At some point we should perhaps looking into taking out the non-ringubffer bits from intel_ringbuffer.h into a new intel_engine.h or something.

v2: Use engine->flags. (Chris Wilson)
v3: Rebase and mark GuC as not yet supported. (Chris Wilson)
v4: Move flag setting to intel_engines_reset_default_submission.
(Chris Wilson)
v5: Move flag setting to logical_ring_setup.
v6: intel_engines_reset_default_submission is the wrong place to set the
flag - it needs to be in execlists_set_default_submission. (Sagar)
v7: Flag setting in logical_ring_setup is not required. (Chris)

---
 drivers/gpu/drm/i915/i915_pmu.c             | 11 ++++-------
 drivers/gpu/drm/i915/intel_engine_cs.c      |  4 ++--
 drivers/gpu/drm/i915/intel_guc_submission.c |  2 ++
 drivers/gpu/drm/i915/intel_lrc.c            |  2 ++
 drivers/gpu/drm/i915/intel_ringbuffer.h     |  6 ++++++
 5 files changed, 16 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/i915_pmu.c +4 -7
index 1c0ee9d68b04..e8e2faf4982f 100644
@@ -90,11 +90,6 @@ static unsigned int event_enabled_bit(struct perf_event *event)
 	return config_enabled_bit(event->attr.config);
 }
 
-static bool supports_busy_stats(struct drm_i915_private *i915)
-{
-	return INTEL_GEN(i915) >= 8;
-}
-
 static bool pmu_needs_timer(struct drm_i915_private *i915, bool gpu_active)
 {
 	u64 enable;
@@ -123,8 +118,10 @@ static bool pmu_needs_timer(struct drm_i915_private *i915, bool gpu_active)
 	/*
 	 * Also there is software busyness tracking available we do not
 	 * need the timer for I915_SAMPLE_BUSY counter.
+	 *
+	 * Use RCS as proxy for all engines.
 	 */
-	else if (supports_busy_stats(i915))
+	else if (intel_engine_supports_stats(i915->engine[RCS]))
 		enable &= ~BIT(I915_SAMPLE_BUSY);
 
 	/*
@@ -447,7 +444,7 @@ static void i915_pmu_event_read(struct perf_event *event)
 
 static bool engine_needs_busy_stats(struct intel_engine_cs *engine)
 {
-	return supports_busy_stats(engine->i915) &&
+	return intel_engine_supports_stats(engine) &&
 	       (engine->pmu.enable & BIT(I915_SAMPLE_BUSY));
 }
 
drivers/gpu/drm/i915/intel_engine_cs.c +2 -2
index fede62daf3e1..cffd0c812b7e 100644
@@ -1863,7 +1863,7 @@ int intel_enable_engine_stats(struct intel_engine_cs *engine)
 {
 	unsigned long flags;
 
-	if (INTEL_GEN(engine->i915) < 8)
+	if (!intel_engine_supports_stats(engine))
 		return -ENODEV;
 
 	spin_lock_irqsave(&engine->stats.lock, flags);
@@ -1924,7 +1924,7 @@ void intel_disable_engine_stats(struct intel_engine_cs *engine)
 {
 	unsigned long flags;
 
-	if (INTEL_GEN(engine->i915) < 8)
+	if (!intel_engine_supports_stats(engine))
 		return;
 
 	spin_lock_irqsave(&engine->stats.lock, flags);
drivers/gpu/drm/i915/intel_guc_submission.c +2 -0
index cf1cc2cb6722..912ff143d531 100644
@@ -1453,6 +1453,8 @@ int intel_guc_submission_enable(struct intel_guc *guc)
 		execlists->tasklet.func = guc_submission_tasklet;
 		engine->park = guc_submission_park;
 		engine->unpark = guc_submission_unpark;
+
+		engine->flags &= ~I915_ENGINE_SUPPORTS_STATS;
 	}
 
 	return 0;
drivers/gpu/drm/i915/intel_lrc.c +2 -0
index 570864583e28..2a8160f603ab 100644
@@ -1919,6 +1919,8 @@ static void execlists_set_default_submission(struct intel_engine_cs *engine)
 
 	engine->park = NULL;
 	engine->unpark = NULL;
+
+	engine->flags |= I915_ENGINE_SUPPORTS_STATS;
 }
 
 static void
drivers/gpu/drm/i915/intel_ringbuffer.h +6 -0
index a91ce63b88b6..c68ab3ead83c 100644
@@ -540,6 +540,7 @@ struct intel_engine_cs {
 	struct intel_engine_hangcheck hangcheck;
 
 #define I915_ENGINE_NEEDS_CMD_PARSER BIT(0)
+#define I915_ENGINE_SUPPORTS_STATS   BIT(1)
 	unsigned int flags;
 
 	/*
@@ -604,6 +605,11 @@ static inline bool intel_engine_needs_cmd_parser(struct intel_engine_cs *engine)
 	return engine->flags & I915_ENGINE_NEEDS_CMD_PARSER;
 }
 
+static inline bool intel_engine_supports_stats(struct intel_engine_cs *engine)
+{
+	return engine->flags & I915_ENGINE_SUPPORTS_STATS;
+}
+
 static inline void
 execlists_set_active(struct intel_engine_execlists *execlists,
 		     unsigned int bit)
Signature · 6 lines
2.14.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#9 lore raw

✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915: Move engine->needs_cmd_parser to engine->flags

In reply to Tvrtko Ursulin
== Series Details ==

== Series Details ==

Series: series starting with [1/2] drm/i915: Move engine->needs_cmd_parser to engine->flags
URL : https://patchwork.freedesktop.org/series/34354/
State : success

== Summary ==

Series 34354v1 series starting with [1/2] drm/i915: Move engine->needs_cmd_parser to engine->flags
https://patchwork.freedesktop.org/api/1.0/series/34354/revisions/1/mbox/

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:444s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:455s
fi-blb-e6850     total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:384s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:534s
fi-bwr-2160      total:289  pass:183  dwarn:0   dfail:0   fail:0   skip:106 time:277s
fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:508s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:506s
fi-byt-j1900     total:289  pass:254  dwarn:0   dfail:0   fail:0   skip:35  time:500s
fi-byt-n2820     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:493s
fi-elk-e7500     total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:432s
fi-gdg-551       total:289  pass:178  dwarn:1   dfail:0   fail:1   skip:109 time:266s
fi-glk-1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:539s
fi-hsw-4770      total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:426s
fi-hsw-4770r     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:436s
fi-ilk-650       total:289  pass:228  dwarn:0   dfail:0   fail:0   skip:61  time:428s
fi-ivb-3520m     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:482s
fi-ivb-3770      total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:464s
fi-kbl-7500u     total:289  pass:264  dwarn:1   dfail:0   fail:0   skip:24  time:480s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:528s
fi-kbl-7567u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:476s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:533s
fi-pnv-d510      total:289  pass:222  dwarn:1   dfail:0   fail:0   skip:66  time:580s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:467s
fi-skl-6600u     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:547s
fi-skl-6700hq    total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:567s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:511s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:502s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:462s
fi-snb-2520m     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:559s
fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:0   skip:40  time:421s
Blacklisted hosts:
fi-cfl-s2        total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:603s
fi-cnl-y         total:219  pass:198  dwarn:0   dfail:0   fail:0   skip:20 
fi-glk-dsi       total:15   pass:14   dwarn:0   dfail:0   fail:0   skip:0  

8b78c9fb3da0e9f3011ad89d3f1cb0a4ac94c569 drm-tip: 2017y-11m-24d-10h-36m-28s UTC integration manifest 446de78bc6f9 drm/i915: Consolidate checks for engine stats availability
4fc7df97b0de drm/i915: Move engine->needs_cmd_parser to engine->flags

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7277/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#10 lore raw

✓ Fi.CI.IGT: success for series starting with [1/2] drm/i915: Move engine->needs_cmd_parser to engine->flags

In reply to Tvrtko Ursulin
== Series Details ==

== Series Details ==

Series: series starting with [1/2] drm/i915: Move engine->needs_cmd_parser to engine->flags
URL : https://patchwork.freedesktop.org/series/34354/
State : success

== Summary ==

Warning: bzip CI_DRM_3381/shard-glkb6/results8.json.bz2 wasn't in correct JSON format Test kms_flip:

        Subgroup dpms-vs-vblank-race:
                pass       -> FAIL       (shard-hsw) fdo#103060
        Subgroup plain-flip-fb-recreate-interruptible:
                fail       -> PASS       (shard-hsw) fdo#100368
Test kms_frontbuffer_tracking:
        Subgroup fbc-1p-offscren-pri-shrfb-draw-render:
                fail       -> PASS       (shard-snb) fdo#101623

fdo#103060 https://bugs.freedesktop.org/show_bug.cgi?id=103060
fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#101623 https://bugs.freedesktop.org/show_bug.cgi?id=101623

shard-hsw        total:2667 pass:1534 dwarn:1   dfail:0   fail:11  skip:1121 time:9510s
shard-snb        total:2667 pass:1312 dwarn:1   dfail:0   fail:12  skip:1342 time:8135s

Blacklisted hosts:
shard-apl total:2667 pass:1690 dwarn:2 dfail:1 fail:20 skip:954 time:13477s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7277/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reviewed-by on v1 1/2
#11 lore raw
In reply to Tvrtko Ursulin
Quoted 7 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

Will be adding a new per-engine flags shortly so it makes sense to consolidate.

I had thought of cmd parser more like a workaround so having wa_flags (for cmd parser, WA CTX/BB need) and caps_flags (for busystats) would make sense. But that can be done later.

Quoted 78 lines
---
  drivers/gpu/drm/i915/i915_cmd_parser.c     | 11 +++++------
  drivers/gpu/drm/i915/i915_gem_execbuffer.c |  2 +-
  drivers/gpu/drm/i915/intel_ringbuffer.h    |  8 +++++++-
  3 files changed, 13 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/i915_cmd_parser.c +5 -6
index b11629beeb63..447c0b89493f 100644
@@ -26,6 +26,7 @@
   */
 
  #include "i915_drv.h"
+#include "intel_ringbuffer.h"
 
  /**
   * DOC: batch buffer command parser
@@ -940,7 +941,7 @@ void intel_engine_init_cmd_parser(struct intel_engine_cs *engine)
  		return;
  	}
 
-	engine->needs_cmd_parser = true;
+	engine->flags |= I915_ENGINE_NEEDS_CMD_PARSER;
  }
 
  /**
@@ -952,10 +953,8 @@ void intel_engine_init_cmd_parser(struct intel_engine_cs *engine)
   */
  void intel_engine_cleanup_cmd_parser(struct intel_engine_cs *engine)
  {
-	if (!engine->needs_cmd_parser)
-		return;
-
-	fini_hash_table(engine);
+	if (intel_engine_needs_cmd_parser(engine))
+		fini_hash_table(engine);
  }
 
  static const struct drm_i915_cmd_descriptor*
@@ -1350,7 +1349,7 @@ int i915_cmd_parser_get_version(struct drm_i915_private *dev_priv)
 
  	/* If the command parser is not enabled, report 0 - unsupported */
  	for_each_engine(engine, dev_priv, id) {
-		if (engine->needs_cmd_parser) {
+		if (intel_engine_needs_cmd_parser(engine)) {
  			active = true;
  			break;
  		}
drivers/gpu/drm/i915/i915_gem_execbuffer.c +1 -1
index 14d9e61a1e06..70ccd63cbf8e 100644
@@ -271,7 +271,7 @@ static inline u64 gen8_noncanonical_addr(u64 address)
 
  static inline bool eb_use_cmdparser(const struct i915_execbuffer *eb)
  {
-	return eb->engine->needs_cmd_parser && eb->batch_len;
+	return intel_engine_needs_cmd_parser(eb->engine) && eb->batch_len;
  }
 
  static int eb_create(struct i915_execbuffer *eb)
drivers/gpu/drm/i915/intel_ringbuffer.h +2 -1
index 0f38d7b43f31..a91ce63b88b6 100644
@@ -539,7 +539,8 @@ struct intel_engine_cs {
 
  	struct intel_engine_hangcheck hangcheck;
 
-	bool needs_cmd_parser;
+#define I915_ENGINE_NEEDS_CMD_PARSER BIT(0)
+	unsigned int flags;
 
  	/*
  	 * Table of commands the command parser needs to know about
@@ -598,6 +599,11 @@ struct intel_engine_cs {
  	} stats;

drivers/gpu/drm/i915/intel_ringbuffer.h struct intel_engine_cs { · line 609

Quoted 10 lines
drivers/gpu/drm/i915/intel_ringbuffer.h +5 -0
  };
 
+static inline bool intel_engine_needs_cmd_parser(struct intel_engine_cs *engine)
+{
+	return engine->flags & I915_ENGINE_NEEDS_CMD_PARSER;
+}
+
  static inline void
  execlists_set_active(struct intel_engine_execlists *execlists,
  		     unsigned int bit)

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

maintainer Reviewed-by on v1 1/2
#12 lore raw
In reply to Tvrtko Ursulin
Quoted 7 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

Will be adding a new per-engine flags shortly so it makes sense to consolidate.

<SNIP>

drivers/gpu/drm/i915/i915_cmd_parser.c void intel_engine_init_cmd_parser(struct intel_engine_cs *engine) · line 957

Quoted 10 lines
drivers/gpu/drm/i915/i915_cmd_parser.c +2 -4
@@ -952,10 +953,8 @@ void intel_engine_init_cmd_parser(struct intel_engine_cs *engine)
  */
 void intel_engine_cleanup_cmd_parser(struct intel_engine_cs *engine)
 {
-	if (!engine->needs_cmd_parser)
-		return;
-
-	fini_hash_table(engine);
+	if (intel_engine_needs_cmd_parser(engine))
+		fini_hash_table(engine);

Just keep the previous code flow.

Regards, Joonas

Signature · 7 lines
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
author maintainer
#13 lore raw

PATCH v2 1/2 drm/i915: Move engine->needs_cmd_parser to engine->flags

In reply to Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

Will be adding a new per-engine flags shortly so it makes sense to consolidate.

v2: Keep the original code flow in intel_engine_cleanup_cmd_parser.
(Joonas Lahtinen)

---
 drivers/gpu/drm/i915/i915_cmd_parser.c     | 7 ++++---
 drivers/gpu/drm/i915/i915_gem_execbuffer.c | 2 +-
 drivers/gpu/drm/i915/intel_ringbuffer.h    | 8 +++++++-
 3 files changed, 12 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_cmd_parser.c +4 -3
index b11629beeb63..ccb5ba043b63 100644
@@ -26,6 +26,7 @@
  */
 
 #include "i915_drv.h"
+#include "intel_ringbuffer.h"
 
 /**
  * DOC: batch buffer command parser
@@ -940,7 +941,7 @@ void intel_engine_init_cmd_parser(struct intel_engine_cs *engine)
 		return;
 	}
 
-	engine->needs_cmd_parser = true;
+	engine->flags |= I915_ENGINE_NEEDS_CMD_PARSER;
 }
 
 /**
@@ -952,7 +953,7 @@ void intel_engine_init_cmd_parser(struct intel_engine_cs *engine)
  */
 void intel_engine_cleanup_cmd_parser(struct intel_engine_cs *engine)
 {
-	if (!engine->needs_cmd_parser)
+	if (!intel_engine_needs_cmd_parser(engine))
 		return;
 
 	fini_hash_table(engine);
@@ -1350,7 +1351,7 @@ int i915_cmd_parser_get_version(struct drm_i915_private *dev_priv)
 
 	/* If the command parser is not enabled, report 0 - unsupported */
 	for_each_engine(engine, dev_priv, id) {
-		if (engine->needs_cmd_parser) {
+		if (intel_engine_needs_cmd_parser(engine)) {
 			active = true;
 			break;
 		}
drivers/gpu/drm/i915/i915_gem_execbuffer.c +1 -1
index 14d9e61a1e06..70ccd63cbf8e 100644
@@ -271,7 +271,7 @@ static inline u64 gen8_noncanonical_addr(u64 address)
 
 static inline bool eb_use_cmdparser(const struct i915_execbuffer *eb)
 {
-	return eb->engine->needs_cmd_parser && eb->batch_len;
+	return intel_engine_needs_cmd_parser(eb->engine) && eb->batch_len;
 }
 
 static int eb_create(struct i915_execbuffer *eb)
drivers/gpu/drm/i915/intel_ringbuffer.h +7 -1
index 0f38d7b43f31..a91ce63b88b6 100644
@@ -539,7 +539,8 @@ struct intel_engine_cs {
 
 	struct intel_engine_hangcheck hangcheck;
 
-	bool needs_cmd_parser;
+#define I915_ENGINE_NEEDS_CMD_PARSER BIT(0)
+	unsigned int flags;
 
 	/*
 	 * Table of commands the command parser needs to know about
@@ -598,6 +599,11 @@ struct intel_engine_cs {
 	} stats;
 };
 
+static inline bool intel_engine_needs_cmd_parser(struct intel_engine_cs *engine)
+{
+	return engine->flags & I915_ENGINE_NEEDS_CMD_PARSER;
+}
+
 static inline void
 execlists_set_active(struct intel_engine_execlists *execlists,
 		     unsigned int bit)
Signature · 6 lines
2.14.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#14 lore raw

✓ Fi.CI.BAT: success for series starting with [v2,1/2] drm/i915: Move engine->needs_cmd_parser to engine->flags (rev4)

In reply to Tvrtko Ursulin
== Series Details ==

== Series Details ==

Series: series starting with [v2,1/2] drm/i915: Move engine->needs_cmd_parser to engine->flags (rev4)
URL : https://patchwork.freedesktop.org/series/34354/
State : success

== Summary ==

Series 34354v4 series starting with [v2,1/2] drm/i915: Move engine->needs_cmd_parser to engine->flags
https://patchwork.freedesktop.org/api/1.0/series/34354/revisions/4/mbox/

Test debugfs_test:

        Subgroup read_all_entries:
                dmesg-warn -> PASS       (fi-bdw-gvtdvm) fdo#103938 +1
Test gem_mmap_gtt:
        Subgroup basic-small-bo-tiledx:
                fail       -> PASS       (fi-gdg-551) fdo#102575
Test kms_pipe_crc_basic:
        Subgroup read-crc-pipe-b:
                fail       -> PASS       (fi-skl-6700k) fdo#103191
        Subgroup suspend-read-crc-pipe-b:
                incomplete -> PASS       (fi-snb-2520m) fdo#103713

fdo#103938 https://bugs.freedesktop.org/show_bug.cgi?id=103938
fdo#102575 https://bugs.freedesktop.org/show_bug.cgi?id=102575
fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713

fi-bdw-5557u     total:288  pass:267  dwarn:0   dfail:0   fail:0   skip:21  time:438s
fi-bdw-gvtdvm    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:447s
fi-blb-e6850     total:288  pass:223  dwarn:1   dfail:0   fail:0   skip:64  time:383s
fi-bsw-n3050     total:288  pass:242  dwarn:0   dfail:0   fail:0   skip:46  time:520s
fi-bwr-2160      total:288  pass:183  dwarn:0   dfail:0   fail:0   skip:105 time:281s
fi-bxt-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:506s
fi-bxt-j4205     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:508s
fi-byt-j1900     total:288  pass:253  dwarn:0   dfail:0   fail:0   skip:35  time:484s
fi-byt-n2820     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:474s
fi-elk-e7500     total:288  pass:229  dwarn:0   dfail:0   fail:0   skip:59  time:420s
fi-gdg-551       total:288  pass:179  dwarn:1   dfail:0   fail:0   skip:108 time:272s
fi-glk-1         total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:537s
fi-hsw-4770      total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:356s
fi-hsw-4770r     total:288  pass:224  dwarn:0   dfail:0   fail:0   skip:64  time:257s
fi-ilk-650       total:288  pass:228  dwarn:0   dfail:0   fail:0   skip:60  time:429s
fi-ivb-3520m     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:478s
fi-kbl-7500u     total:288  pass:263  dwarn:1   dfail:0   fail:0   skip:24  time:491s
fi-kbl-7560u     total:288  pass:269  dwarn:0   dfail:0   fail:0   skip:19  time:529s
fi-kbl-7567u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:477s
fi-kbl-r         total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:534s
fi-pnv-d510      total:288  pass:222  dwarn:1   dfail:0   fail:0   skip:65  time:589s
fi-skl-6260u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:448s
fi-skl-6600u     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:541s
fi-skl-6700hq    total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:567s
fi-skl-6700k     total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:517s
fi-skl-6770hq    total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:510s
fi-skl-gvtdvm    total:288  pass:265  dwarn:0   dfail:0   fail:0   skip:23  time:452s
fi-snb-2520m     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:550s
fi-snb-2600      total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:419s
Blacklisted hosts:
fi-cfl-s2        total:288  pass:254  dwarn:8   dfail:0   fail:0   skip:26  time:621s
fi-cnl-y         total:246  pass:221  dwarn:0   dfail:0   fail:0   skip:24 

c544c30501259c15ced047e547e787d546c24a43 drm-tip: 2017y-11m-29d-08h-19m-47s UTC integration manifest 23fae9483e08 drm/i915: Consolidate checks for engine stats availability
caf6e484864c drm/i915: Move engine->needs_cmd_parser to engine->flags

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7334/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#15 lore raw

✓ Fi.CI.BAT: success for series starting with [v2,1/2] drm/i915: Move engine->needs_cmd_parser to engine->flags (rev5)

In reply to Tvrtko Ursulin
== Series Details ==

== Series Details ==

Series: series starting with [v2,1/2] drm/i915: Move engine->needs_cmd_parser to engine->flags (rev5)
URL : https://patchwork.freedesktop.org/series/34354/
State : success

== Summary ==

Series 34354v5 series starting with [v2,1/2] drm/i915: Move engine->needs_cmd_parser to engine->flags
https://patchwork.freedesktop.org/api/1.0/series/34354/revisions/5/mbox/

Test debugfs_test:

        Subgroup read_all_entries:
                dmesg-warn -> PASS       (fi-bdw-gvtdvm) fdo#103938 +1
Test gem_mmap_gtt:
        Subgroup basic-small-bo-tiledx:
                fail       -> PASS       (fi-gdg-551) fdo#102575
Test gem_ringfill:
        Subgroup basic-default-hang:
                dmesg-warn -> PASS       (fi-pnv-d510) fdo#101600
Test kms_frontbuffer_tracking:
        Subgroup basic:
                pass       -> DMESG-WARN (fi-bdw-5557u) fdo#102473
Test kms_pipe_crc_basic:
        Subgroup read-crc-pipe-b:
                fail       -> PASS       (fi-skl-6700k) fdo#103191
        Subgroup suspend-read-crc-pipe-b:
                incomplete -> PASS       (fi-snb-2520m) fdo#103713

fdo#103938 https://bugs.freedesktop.org/show_bug.cgi?id=103938
fdo#102575 https://bugs.freedesktop.org/show_bug.cgi?id=102575
fdo#101600 https://bugs.freedesktop.org/show_bug.cgi?id=101600
fdo#102473 https://bugs.freedesktop.org/show_bug.cgi?id=102473
fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713

fi-bdw-5557u     total:288  pass:266  dwarn:1   dfail:0   fail:0   skip:21  time:439s
fi-bdw-gvtdvm    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:451s
fi-blb-e6850     total:288  pass:223  dwarn:1   dfail:0   fail:0   skip:64  time:382s
fi-bsw-n3050     total:288  pass:242  dwarn:0   dfail:0   fail:0   skip:46  time:508s
fi-bwr-2160      total:288  pass:183  dwarn:0   dfail:0   fail:0   skip:105 time:282s
fi-bxt-j4205     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:509s
fi-byt-j1900     total:288  pass:253  dwarn:0   dfail:0   fail:0   skip:35  time:489s
fi-byt-n2820     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:471s
fi-elk-e7500     total:288  pass:229  dwarn:0   dfail:0   fail:0   skip:59  time:426s
fi-gdg-551       total:288  pass:179  dwarn:1   dfail:0   fail:0   skip:108 time:265s
fi-glk-1         total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:532s
fi-hsw-4770      total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:370s
fi-hsw-4770r     total:288  pass:224  dwarn:0   dfail:0   fail:0   skip:64  time:257s
fi-ivb-3520m     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:490s
fi-kbl-7500u     total:288  pass:263  dwarn:1   dfail:0   fail:0   skip:24  time:487s
fi-kbl-7560u     total:288  pass:269  dwarn:0   dfail:0   fail:0   skip:19  time:526s
fi-kbl-7567u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:479s
fi-kbl-r         total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:529s
fi-pnv-d510      total:288  pass:223  dwarn:0   dfail:0   fail:0   skip:65  time:579s
fi-skl-6260u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:455s
fi-skl-6600u     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:541s
fi-skl-6700hq    total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:567s
fi-skl-6700k     total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:517s
fi-skl-6770hq    total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:518s
fi-skl-gvtdvm    total:288  pass:265  dwarn:0   dfail:0   fail:0   skip:23  time:448s
fi-snb-2520m     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:542s
fi-snb-2600      total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:413s
Blacklisted hosts:
fi-cfl-s2        total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:609s
fi-cnl-y         total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:566s

fi-bxt-dsi failed to collect. IGT log at Patchwork_7336/fi-bxt-dsi/igt.log

c544c30501259c15ced047e547e787d546c24a43 drm-tip: 2017y-11m-29d-08h-19m-47s UTC integration manifest 36d8fac885fd drm/i915: Consolidate checks for engine stats availability
c4f8928a7be4 drm/i915: Move engine->needs_cmd_parser to engine->flags

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7336/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#16 lore raw

Re: ✓ Fi.CI.BAT: success for series starting with [v2,1/2] drm/i915: Move engine->needs_cmd_parser to engine->flags (rev5)

Quoted 66 lines · Patchwork

== Series Details ==

Series: series starting with [v2,1/2] drm/i915: Move engine->needs_cmd_parser to engine->flags (rev5)
URL : https://patchwork.freedesktop.org/series/34354/
State : success

== Summary ==

Series 34354v5 series starting with [v2,1/2] drm/i915: Move engine->needs_cmd_parser to engine->flags
https://patchwork.freedesktop.org/api/1.0/series/34354/revisions/5/mbox/

Test debugfs_test:

         Subgroup read_all_entries:
                 dmesg-warn -> PASS       (fi-bdw-gvtdvm) fdo#103938 +1
Test gem_mmap_gtt:
         Subgroup basic-small-bo-tiledx:
                 fail       -> PASS       (fi-gdg-551) fdo#102575
Test gem_ringfill:
         Subgroup basic-default-hang:
                 dmesg-warn -> PASS       (fi-pnv-d510) fdo#101600
Test kms_frontbuffer_tracking:
         Subgroup basic:
                 pass       -> DMESG-WARN (fi-bdw-5557u) fdo#102473
Test kms_pipe_crc_basic:
         Subgroup read-crc-pipe-b:
                 fail       -> PASS       (fi-skl-6700k) fdo#103191
         Subgroup suspend-read-crc-pipe-b:
                 incomplete -> PASS       (fi-snb-2520m) fdo#103713

fdo#103938 https://bugs.freedesktop.org/show_bug.cgi?id=103938
fdo#102575 https://bugs.freedesktop.org/show_bug.cgi?id=102575
fdo#101600 https://bugs.freedesktop.org/show_bug.cgi?id=101600
fdo#102473 https://bugs.freedesktop.org/show_bug.cgi?id=102473
fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713

fi-bdw-5557u     total:288  pass:266  dwarn:1   dfail:0   fail:0   skip:21  time:439s
fi-bdw-gvtdvm    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:451s
fi-blb-e6850     total:288  pass:223  dwarn:1   dfail:0   fail:0   skip:64  time:382s
fi-bsw-n3050     total:288  pass:242  dwarn:0   dfail:0   fail:0   skip:46  time:508s
fi-bwr-2160      total:288  pass:183  dwarn:0   dfail:0   fail:0   skip:105 time:282s
fi-bxt-j4205     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:509s
fi-byt-j1900     total:288  pass:253  dwarn:0   dfail:0   fail:0   skip:35  time:489s
fi-byt-n2820     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:471s
fi-elk-e7500     total:288  pass:229  dwarn:0   dfail:0   fail:0   skip:59  time:426s
fi-gdg-551       total:288  pass:179  dwarn:1   dfail:0   fail:0   skip:108 time:265s
fi-glk-1         total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:532s
fi-hsw-4770      total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:370s
fi-hsw-4770r     total:288  pass:224  dwarn:0   dfail:0   fail:0   skip:64  time:257s
fi-ivb-3520m     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:490s
fi-kbl-7500u     total:288  pass:263  dwarn:1   dfail:0   fail:0   skip:24  time:487s
fi-kbl-7560u     total:288  pass:269  dwarn:0   dfail:0   fail:0   skip:19  time:526s
fi-kbl-7567u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:479s
fi-kbl-r         total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:529s
fi-pnv-d510      total:288  pass:223  dwarn:0   dfail:0   fail:0   skip:65  time:579s
fi-skl-6260u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:455s
fi-skl-6600u     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:541s
fi-skl-6700hq    total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:567s
fi-skl-6700k     total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:517s
fi-skl-6770hq    total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:518s
fi-skl-gvtdvm    total:288  pass:265  dwarn:0   dfail:0   fail:0   skip:23  time:448s
fi-snb-2520m     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:542s
fi-snb-2600      total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:413s
Blacklisted hosts:
fi-cfl-s2        total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:609s
fi-cnl-y         total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:566s
Quoted 5 lines

fi-bxt-dsi failed to collect. IGT log at Patchwork_7336/fi-bxt-dsi/igt.log

c544c30501259c15ced047e547e787d546c24a43 drm-tip: 2017y-11m-29d-08h-19m-47s UTC integration manifest 36d8fac885fd drm/i915: Consolidate checks for engine stats availability
c4f8928a7be4 drm/i915: Move engine->needs_cmd_parser to engine->flags

Pushed, thanks for the review.

Regards,

Tvrtko

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#17 lore raw

✓ Fi.CI.IGT: success for series starting with [v2,1/2] drm/i915: Move engine->needs_cmd_parser to engine->flags (rev4)

In reply to Tvrtko Ursulin
== Series Details ==

== Series Details ==

Series: series starting with [v2,1/2] drm/i915: Move engine->needs_cmd_parser to engine->flags (rev4)
URL : https://patchwork.freedesktop.org/series/34354/
State : success

== Summary ==

Blacklisted hosts:

shard-apl        total:2412 pass:1516 dwarn:14  dfail:10  fail:12  skip:854 time:11519s
shard-hsw        total:2661 pass:1522 dwarn:8   dfail:1   fail:11  skip:1119 time:9175s
shard-kbl        total:2361 pass:1578 dwarn:12  dfail:12  fail:12  skip:739 time:8257s
shard-snb        total:2539 pass:1229 dwarn:13  dfail:8   fail:8   skip:1277 time:6709s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7334/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#18 lore raw

✓ Fi.CI.IGT: success for series starting with [v2,1/2] drm/i915: Move engine->needs_cmd_parser to engine->flags (rev5)

In reply to Tvrtko Ursulin
== Series Details ==

== Series Details ==

Series: series starting with [v2,1/2] drm/i915: Move engine->needs_cmd_parser to engine->flags (rev5)
URL : https://patchwork.freedesktop.org/series/34354/
State : success

== Summary ==

Blacklisted hosts:

shard-apl        total:2431 pass:1516 dwarn:13  dfail:11  fail:13  skip:872 time:11588s
shard-hsw        total:2661 pass:1527 dwarn:9   dfail:1   fail:8   skip:1116 time:9311s
shard-kbl        total:2440 pass:1631 dwarn:14  dfail:12  fail:13  skip:763 time:8562s
shard-snb        total:2540 pass:1228 dwarn:16  dfail:8   fail:6   skip:1278 time:6839s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7336/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx