public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Lucas De Marchi <lucas.demarchi@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH 5/5] i915/gem_mocs_settings: add support for Tiger Lake
Date: Thu, 25 Jul 2019 13:33:54 -0700	[thread overview]
Message-ID: <20190725203354.6757-5-lucas.demarchi@intel.com> (raw)
In-Reply-To: <20190725203354.6757-1-lucas.demarchi@intel.com>

Gen 12 and later only have global MOCS: use the new offset.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 tests/i915/gem_mocs_settings.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/tests/i915/gem_mocs_settings.c b/tests/i915/gem_mocs_settings.c
index 9ec0b122..3a593219 100644
--- a/tests/i915/gem_mocs_settings.c
+++ b/tests/i915/gem_mocs_settings.c
@@ -63,6 +63,7 @@ static const char * const test_modes[] = {
 #define GEN9_MFX1_MOCS_0	(0xcA00)	/* Media 1 MOCS base register*/
 #define GEN9_VEBOX_MOCS_0	(0xcB00)	/* Video MOCS base register*/
 #define GEN9_BLT_MOCS_0		(0xcc00)	/* Blitter MOCS base register*/
+#define GEN12_GLOBAL_MOCS	(0x4000)
 #define ICELAKE_MOCS_PTE	{0x00000004, 0x0030, 0x1}
 #define MOCS_PTE		{0x00000038, 0x0030, 0x1}
 
@@ -165,6 +166,11 @@ static const uint32_t write_values[GEN9_NUM_MOCS_ENTRIES] = {
 	[0 ... GEN9_NUM_MOCS_ENTRIES - 1] = 0xFFFFFFFF,
 };
 
+static bool has_global_mocs(int fd)
+{
+	return intel_gen(intel_get_drm_devid(fd)) >= 12;
+}
+
 static bool get_mocs_settings(int fd, struct mocs_table *table, bool dirty)
 {
 	uint32_t devid = intel_get_drm_devid(fd);
@@ -204,8 +210,11 @@ static bool get_mocs_settings(int fd, struct mocs_table *table, bool dirty)
 #define LOCAL_I915_EXEC_BSD1 (I915_EXEC_BSD | (1<<13))
 #define LOCAL_I915_EXEC_BSD2 (I915_EXEC_BSD | (2<<13))
 
-static uint32_t get_engine_base(uint32_t engine)
+static uint32_t get_engine_base(int fd, uint32_t engine)
 {
+	if (has_global_mocs(fd))
+		return GEN12_GLOBAL_MOCS;
+
 	switch (engine) {
 	case LOCAL_I915_EXEC_BSD1:	return GEN9_MFX0_MOCS_0;
 	case LOCAL_I915_EXEC_BSD2:	return GEN9_MFX1_MOCS_0;
@@ -339,7 +348,7 @@ static void check_control_registers(int fd,
 				    uint32_t ctx_id,
 				    bool dirty)
 {
-	const uint32_t reg_base = get_engine_base(engine);
+	const uint32_t reg_base = get_engine_base(fd, engine);
 	uint32_t dst_handle = gem_create(fd, 4096);
 	uint32_t *read_regs;
 	struct mocs_table table;
@@ -467,7 +476,7 @@ static void write_dirty_mocs(int fd,
 	else
 		num_of_mocs_entries = GEN9_NUM_MOCS_ENTRIES;
 
-	write_registers(fd, ctx_id, get_engine_base(engine),
+	write_registers(fd, ctx_id, get_engine_base(fd, engine),
 			write_values, num_of_mocs_entries,
 			engine, privileged);
 
@@ -494,7 +503,7 @@ static void run_test(int fd, unsigned engine, unsigned flags, unsigned mode)
 	gem_require_ring(fd, engine);
 
 	/* Skip if we don't know where the registers are for this engine */
-	igt_require(get_engine_base(engine));
+	igt_require(get_engine_base(fd, engine));
 
 	if (flags & MOCS_NON_DEFAULT_CTX)
 		ctx_id = gem_context_create(fd);
-- 
2.21.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2019-07-25 20:36 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-25 20:33 [igt-dev] [PATCH 1/5] i915/gem_mocs_settings: log the engine and MOCS index Lucas De Marchi
2019-07-25 20:33 ` [igt-dev] [PATCH 2/5] i915/gem_mocs_settings: do not set undefined entries to PTE Lucas De Marchi
2019-07-26 20:49   ` Daniele Ceraolo Spurio
2019-07-26 20:57     ` Chris Wilson
2019-07-25 20:33 ` [igt-dev] [PATCH 3/5] i915/gem_mocs_settings: add MOCS table for Tiger Lake Lucas De Marchi
2019-07-27  0:16   ` Daniele Ceraolo Spurio
2019-07-25 20:33 ` [igt-dev] [PATCH 4/5] i915/gem_mocs_settings: fix global MOCS on gen 11 Lucas De Marchi
2019-07-29 20:53   ` Kumar Valsan, Prathap
2019-07-25 20:33 ` Lucas De Marchi [this message]
2019-07-27  0:23   ` [igt-dev] [PATCH 5/5] i915/gem_mocs_settings: add support for Tiger Lake Daniele Ceraolo Spurio
2019-07-25 21:12 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [1/5] i915/gem_mocs_settings: log the engine and MOCS index Patchwork
2019-07-25 21:45 ` [igt-dev] [PATCH 1/5] " Lucas De Marchi
2019-07-26 12:39 ` [igt-dev] ✓ Fi.CI.IGT: success for series starting with [1/5] " Patchwork
2019-07-26 23:26   ` Daniele Ceraolo Spurio
2019-07-26 23:49     ` Lucas De Marchi
2019-07-26 23:54       ` Daniele Ceraolo Spurio
2019-07-27  0:04         ` Lucas De Marchi
2019-07-26 23:23 ` [igt-dev] [PATCH 1/5] " Daniele Ceraolo Spurio
2019-07-26 23:35   ` Lucas De Marchi

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=20190725203354.6757-5-lucas.demarchi@intel.com \
    --to=lucas.demarchi@intel.com \
    --cc=igt-dev@lists.freedesktop.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