All of lore.kernel.org
 help / color / mirror / Atom feed
From: apoorva1.singh@intel.com
To: apoorva1.singh@intel.com, igt-dev@lists.freedesktop.org,
	ramalingam.c@intel.com, zbigniew.kempczynski@intel.com,
	arjun.melkaveri@intel.com
Subject: [igt-dev] [PATCH i-g-t, v5 4/5] i915/gem_engine_topology: Only use the main copy engines for XY_BLOCK_COPY
Date: Sun, 19 Dec 2021 18:44:42 +0530	[thread overview]
Message-ID: <20211219131443.472654-5-apoorva1.singh@intel.com> (raw)
In-Reply-To: <20211219131443.472654-1-apoorva1.singh@intel.com>

From: Chris Wilson <chris.p.wilson@intel.com>

XY_BLOCK_COPY blt command is used to transfer the ccs data.
So, we can only run the tests on those engines which have
support for the "block_copy" capability.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Signed-off-by: Apoorva Singh <apoorva1.singh@intel.com>
Cc: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Cc: Melkaveri, Arjun <arjun.melkaveri@intel.com>
---
 lib/i915/gem_engine_topology.c | 38 ++++++++++++++++++++++++++++++++++
 lib/i915/gem_engine_topology.h |  5 +++++
 2 files changed, 43 insertions(+)

diff --git a/lib/i915/gem_engine_topology.c b/lib/i915/gem_engine_topology.c
index 729f42b0..37b5875e 100644
--- a/lib/i915/gem_engine_topology.c
+++ b/lib/i915/gem_engine_topology.c
@@ -488,6 +488,44 @@ int gem_engine_property_printf(int i915, const char *engine, const char *attr,
 	return ret;
 }
 
+static bool
+__gem_engine_has_capability(int i915, const char *engine,
+			    const char *attr, const char *cap)
+{
+	char buf[4096] = {};
+	FILE *file;
+
+	file = __open_attr(igt_sysfs_open(i915), "r",
+			   "engine", engine, attr, NULL);
+	if (file) {
+		fread(buf, 1, sizeof(buf) - 1, file);
+		fclose(file);
+	}
+
+	return strstr(buf, cap);
+}
+
+bool gem_engine_has_capability(int i915, const char *engine, const char *cap)
+{
+	return __gem_engine_has_capability(i915, engine, "capabilities", cap);
+}
+
+bool gem_engine_has_known_capability(int i915, const char *engine, const char *cap)
+{
+	return __gem_engine_has_capability(i915, engine, "known_capabilities", cap);
+}
+
+bool gem_engine_can_block_copy(int i915, const struct intel_execution_engine2 *engine)
+{
+	if (engine->class != I915_ENGINE_CLASS_COPY)
+		return false;
+
+	if (!gem_engine_has_known_capability(i915, engine->name, "block_copy"))
+		return intel_gen(intel_get_drm_devid(i915)) >= 12;
+
+	return gem_engine_has_capability(i915, engine->name, "block_copy");
+}
+
 uint32_t gem_engine_mmio_base(int i915, const char *engine)
 {
 	unsigned int mmio = 0;
diff --git a/lib/i915/gem_engine_topology.h b/lib/i915/gem_engine_topology.h
index 4cfab560..d24bc9e8 100644
--- a/lib/i915/gem_engine_topology.h
+++ b/lib/i915/gem_engine_topology.h
@@ -124,6 +124,11 @@ int gem_engine_property_printf(int i915, const char *engine, const char *attr,
 
 uint32_t gem_engine_mmio_base(int i915, const char *engine);
 
+bool gem_engine_has_capability(int i915, const char *engine, const char *cap);
+bool gem_engine_has_known_capability(int i915, const char *engine, const char *cap);
+
+bool gem_engine_can_block_copy(int i915, const struct intel_execution_engine2 *engine);
+
 void dyn_sysfs_engines(int i915, int engines, const char *file,
 		       void (*test)(int i915, int engine));
 
-- 
2.25.1

  parent reply	other threads:[~2021-12-19 13:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-19 13:14 [igt-dev] [PATCH i-g-t,v5 0/5] Add testing for CCS apoorva1.singh
2021-12-19 13:14 ` [igt-dev] [PATCH i-g-t, v5 1/5] lib/i915: Introduce library intel_mocs apoorva1.singh
2021-12-20 12:36   ` Zbigniew Kempczyński
2021-12-19 13:14 ` [igt-dev] [PATCH i-g-t, v5 2/5] lib/i915: Introduce library i915_blt apoorva1.singh
2021-12-20 13:06   ` Zbigniew Kempczyński
2021-12-20 13:49   ` Petri Latvala
2021-12-19 13:14 ` [igt-dev] [PATCH i-g-t, v5 3/5] lib/intel_chipset.h: Add has_flat_ccs flag apoorva1.singh
2021-12-19 13:14 ` apoorva1.singh [this message]
2021-12-19 13:14 ` [igt-dev] [PATCH i-g-t,v5 5/5] i915/gem_ccs: Add testing for CCS apoorva1.singh
2021-12-19 13:51 ` [igt-dev] ✓ Fi.CI.BAT: success for Add testing for CCS (rev5) Patchwork
2021-12-19 14:56 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

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=20211219131443.472654-5-apoorva1.singh@intel.com \
    --to=apoorva1.singh@intel.com \
    --cc=arjun.melkaveri@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=ramalingam.c@intel.com \
    --cc=zbigniew.kempczynski@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.