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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 11/24/2017 4:51 PM, Tvrtko Ursulin wrote:
From: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>

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

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
Suggested-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>

Reviewed-by: Sagar Arun Kamble <sagar.a.kamble@xxxxxxxxx>

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.

---
  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(-)

diff --git a/drivers/gpu/drm/i915/i915_cmd_parser.c b/drivers/gpu/drm/i915/i915_cmd_parser.c
index b11629beeb63..447c0b89493f 100644
--- a/drivers/gpu/drm/i915/i915_cmd_parser.c
+++ b/drivers/gpu/drm/i915/i915_cmd_parser.c
@@ -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;
  		}
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 14d9e61a1e06..70ccd63cbf8e 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -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)
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h
index 0f38d7b43f31..a91ce63b88b6 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.h
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.h
@@ -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)

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux