[igt-dev] [RFC v2 11/43] tests/i915/gem_cs_prefetch: use the gem_engine_topology library

Ramalingam C
2019-06-21T10:01:17Z

tests/i915/gem_cs_prefetch.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/tests/i915/gem_cs_prefetch.c b/tests/i915/gem_cs_prefetch.c
index 2b8653687f8f..939d6455613e 100644
--- a/tests/i915/gem_cs_prefetch.c
+++ b/tests/i915/gem_cs_prefetch.c
@@ -79,7 +79,7 @@ static void setup(int fd, int gen, struct shadow *shadow)
shadow->reloc.write_domain = I915_GEM_DOMAIN_INSTRUCTION;
}

-static void can_test_ring(unsigned ring)
+static void can_test_ring(const struct intel_execution_engine2 *e)
{
int master = drm_open_driver_master(DRIVER_INTEL);
int fd = drm_open_driver(DRIVER_INTEL);
@@ -87,12 +87,12 @@ static void can_test_ring(unsigned ring)
/* Dance to avoid dying with master open */
close(master);
igt_require_gem(fd);
- gem_require_ring(fd, ring);
- igt_require(gem_can_store_dword(fd, ring));
+ gem_require_ring(fd, e->flags);
+ igt_require(gem_class_can_store_dword(fd, e->class));
close(fd);
}

-static void test_ring(unsigned ring)
+static void test_ring(const struct intel_execution_engine2 *e)
{
struct drm_i915_gem_execbuffer2 execbuf;
struct drm_i915_gem_exec_object2 obj[2];
@@ -100,7 +100,7 @@ static void test_ring(unsigned ring)
uint64_t i, count;
int fd, gen;

- can_test_ring(ring);
+ can_test_ring(e);

fd = drm_open_driver_master(DRIVER_INTEL);
gen = intel_gen(intel_get_drm_devid(fd));
@@ -116,7 +116,7 @@ static void test_ring(unsigned ring)

memset(&execbuf, 0, sizeof(execbuf));
execbuf.buffers_ptr = to_user_pointer(obj);
- execbuf.flags = ring;
+ execbuf.flags = e->flags;
if (gen < 6)
execbuf.flags |= I915_EXEC_SECURE;

@@ -139,11 +139,11 @@ static void test_ring(unsigned ring)

igt_main
{
- const struct intel_execution_engine *e;
+ const struct intel_execution_engine2 *e;

igt_skip_on_simulation();

- for (e = intel_execution_engines; e->name; e++)
+ __for_each_static_engine(e)
igt_subtest_f("%s", e->name)
- test_ring(e->exec_id | e->flags);
+ test_ring(e);