[igt-dev] [RFC v2 37/43] tests/i915/i915_module_load: use the gem_engine_topology library
Ramalingam C
ramalingam.c at intel.com
Fri Jun 21 10:03:39 UTC 2019
Replace the legacy for_each_engine* defines with the ones
implemented in the gem_engine_topology library.
Signed-off-by: Ramalingam C <ramalingam.c at intel.com>
---
tests/i915/i915_module_load.c | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)
diff --git a/tests/i915/i915_module_load.c b/tests/i915/i915_module_load.c
index 7fe83520713c..aabb701d592c 100644
--- a/tests/i915/i915_module_load.c
+++ b/tests/i915/i915_module_load.c
@@ -42,7 +42,7 @@
#define ENGINE_MASK (I915_EXEC_RING_MASK | LOCAL_I915_EXEC_BSD_MASK)
-static void store_dword(int fd, unsigned ring)
+static void store_dword(int fd, const struct intel_execution_engine2 *e)
{
const int gen = intel_gen(intel_get_drm_devid(fd));
struct drm_i915_gem_exec_object2 obj[2];
@@ -51,17 +51,17 @@ static void store_dword(int fd, unsigned ring)
uint32_t batch[16];
int i;
- if (!gem_can_store_dword(fd, ring))
+ if (!gem_class_can_store_dword(fd, e->class))
return;
- if (!gem_has_ring(fd, ring))
+ if (!gem_has_ring(fd, e->flags))
return;
intel_detect_and_clear_missed_interrupts(fd);
memset(&execbuf, 0, sizeof(execbuf));
execbuf.buffers_ptr = (uintptr_t)obj;
execbuf.buffer_count = 2;
- execbuf.flags = ring;
+ execbuf.flags = e->flags;
if (gen < 6)
execbuf.flags |= I915_EXEC_SECURE;
@@ -113,11 +113,12 @@ static void store_all(int fd)
unsigned engines[16], permuted[16];
uint32_t batch[16];
uint64_t offset;
- unsigned engine, nengine;
+ unsigned nengine;
+ const struct intel_execution_engine2 *engine;
int value;
int i, j;
- if (!gem_can_store_dword(fd, 0))
+ if (!gem_class_can_store_dword(fd, I915_ENGINE_CLASS_RENDER))
return;
memset(&execbuf, 0, sizeof(execbuf));
@@ -151,14 +152,14 @@ static void store_all(int fd)
nengine = 0;
intel_detect_and_clear_missed_interrupts(fd);
- for_each_engine(fd, engine) {
- if (!gem_can_store_dword(fd, engine))
+ __for_each_physical_engine(fd, engine) {
+ if (!gem_class_can_store_dword(fd, engine->class))
continue;
igt_assert(2*(nengine+1)*sizeof(batch) <= 4096);
execbuf.flags &= ~ENGINE_MASK;
- execbuf.flags |= engine;
+ execbuf.flags |= engine->flags;
j = 2*nengine;
reloc[j].target_handle = obj[0].handle;
@@ -190,7 +191,7 @@ static void store_all(int fd)
execbuf.batch_start_offset = j*sizeof(batch);
gem_execbuf(fd, &execbuf);
- engines[nengine++] = engine;
+ engines[nengine++] = engine->flags;
}
gem_sync(fd, obj[1].handle);
@@ -281,14 +282,14 @@ static void
gem_exec_store(void)
{
int fd;
- const struct intel_execution_engine *e;
+ const struct intel_execution_engine2 *e;
fd = __drm_open_driver(DRIVER_INTEL);
igt_fork_hang_detector(fd);
- for (e = intel_execution_engines; e->name; e++) {
- if (gem_can_store_dword(fd, e->exec_id | e->flags))
- store_dword(fd, e->exec_id | e->flags);
+ __for_each_static_engine(e) {
+ if (gem_class_can_store_dword(fd, e->class))
+ store_dword(fd, e);
}
store_all(fd);
--
2.19.1
More information about the igt-dev
mailing list