[igt-dev] [RFC v2 42/43] lib: replace the legacy funcs with gem_engine_topology libraries
Ramalingam C
ramalingam.c at intel.com
Fri Jun 21 10:03:44 UTC 2019
All legacy functions are replaced with the functions from the
gem_engine_topology library.
Signed-off-by: Ramalingam C <ramalingam.c at intel.com>
---
benchmarks/gem_syslatency.c | 7 ++++---
lib/i915/gem_ring.c | 7 +++++--
lib/i915/gem_submission.c | 6 ++++--
lib/igt_gt.c | 11 -----------
lib/igt_gt.h | 21 ---------------------
5 files changed, 13 insertions(+), 39 deletions(-)
diff --git a/benchmarks/gem_syslatency.c b/benchmarks/gem_syslatency.c
index 7671dc43efe9..01ddbf67ea3f 100644
--- a/benchmarks/gem_syslatency.c
+++ b/benchmarks/gem_syslatency.c
@@ -100,14 +100,15 @@ static void *gem_busyspin(void *arg)
bs->sz ? bs->sz + sizeof(bbe) : bs->leak ? 16 << 20 : 4 << 10;
unsigned engines[16];
unsigned nengine;
- unsigned engine;
+ const struct intel_execution_engine2 *engine;
int fd;
fd = drm_open_driver(DRIVER_INTEL);
nengine = 0;
- for_each_engine(fd, engine)
- if (!ignore_engine(fd, engine)) engines[nengine++] = engine;
+ for_each_context_engine(fd, 0, engine)
+ if (!ignore_engine(fd, engine->flags))
+ engines[nengine++] = engine->flags;
memset(obj, 0, sizeof(obj));
obj[0].handle = gem_create(fd, 4096);
diff --git a/lib/i915/gem_ring.c b/lib/i915/gem_ring.c
index fdb9fc1b13fe..e050e4c90844 100644
--- a/lib/i915/gem_ring.c
+++ b/lib/i915/gem_ring.c
@@ -33,6 +33,8 @@
#include "igt_dummyload.h"
#include "igt_gt.h"
+#include <i915/gem_engine_topology.h>
+
static int __execbuf(int fd, struct drm_i915_gem_execbuffer2 *execbuf)
{
int err;
@@ -141,9 +143,10 @@ gem_measure_ring_inflight(int fd, unsigned int engine, enum measure_ring_flags f
{
if (engine == ALL_ENGINES) {
unsigned int global_min = ~0u;
+ const struct intel_execution_engine2 *e;
- for_each_physical_engine(fd, engine) {
- unsigned int engine_min = __gem_measure_ring_inflight(fd, engine, flags);
+ for_each_context_engine(fd, 0, e) {
+ unsigned int engine_min = __gem_measure_ring_inflight(fd, e->flags, flags);
if (engine_min < global_min)
global_min = engine_min;
diff --git a/lib/i915/gem_submission.c b/lib/i915/gem_submission.c
index 2fd460d5ed2b..9bfb91b89f80 100644
--- a/lib/i915/gem_submission.c
+++ b/lib/i915/gem_submission.c
@@ -36,6 +36,7 @@
#include "ioctl_wrappers.h"
#include "i915/gem_submission.h"
+#include "i915/gem_engine_topology.h"
/**
* SECTION:gem_submission
@@ -207,6 +208,7 @@ void gem_test_engine(int i915, unsigned int engine)
.buffers_ptr = to_user_pointer(&obj),
.buffer_count = 1,
};
+ const struct intel_execution_engine2 *e;
i915 = gem_reopen_driver(i915);
igt_assert(!is_wedged(i915));
@@ -215,8 +217,8 @@ void gem_test_engine(int i915, unsigned int engine)
gem_write(i915, obj.handle, 0, &bbe, sizeof(bbe));
if (engine == ALL_ENGINES) {
- for_each_physical_engine(i915, engine) {
- execbuf.flags = engine;
+ __for_each_physical_engine(i915, e) {
+ execbuf.flags = e->flags;
gem_execbuf(i915, &execbuf);
}
} else {
diff --git a/lib/igt_gt.c b/lib/igt_gt.c
index 78e3cd08925b..e89058a93f9c 100644
--- a/lib/igt_gt.c
+++ b/lib/igt_gt.c
@@ -546,17 +546,6 @@ unsigned intel_detect_and_clear_missed_interrupts(int fd)
return missed;
}
-const struct intel_execution_engine intel_execution_engines[] = {
- { "default", NULL, 0, 0 },
- { "render", "rcs0", I915_EXEC_RENDER, 0 },
- { "bsd", "vcs0", I915_EXEC_BSD, 0 },
- { "bsd1", "vcs0", I915_EXEC_BSD, 1<<13 /*I915_EXEC_BSD_RING1*/ },
- { "bsd2", "vcs1", I915_EXEC_BSD, 2<<13 /*I915_EXEC_BSD_RING2*/ },
- { "blt", "bcs0", I915_EXEC_BLT, 0 },
- { "vebox", "vecs0", I915_EXEC_VEBOX, 0 },
- { NULL, 0, 0 }
-};
-
bool gem_class_can_store_dword(int fd, int class)
{
uint16_t devid = intel_get_drm_devid(fd);
diff --git a/lib/igt_gt.h b/lib/igt_gt.h
index 73b5002a04bd..4ad5d892579a 100644
--- a/lib/igt_gt.h
+++ b/lib/igt_gt.h
@@ -65,27 +65,6 @@ unsigned intel_detect_and_clear_missed_interrupts(int fd);
#define ALL_ENGINES ~0u /* Use in interfaces to iterate all engines */
-extern const struct intel_execution_engine {
- const char *name;
- const char *full_name;
- unsigned exec_id;
- unsigned flags;
-} intel_execution_engines[];
-
-#define for_if(expr__) if (!(expr__)) {} else
-
-#define for_each_engine(fd__, flags__) \
- for (const struct intel_execution_engine *e__ = intel_execution_engines;\
- e__->name; \
- e__++) \
- for_if (gem_has_ring(fd__, flags__ = e__->exec_id | e__->flags))
-
-#define for_each_physical_engine(fd__, flags__) \
- for (const struct intel_execution_engine *e__ = intel_execution_engines;\
- e__->name; \
- e__++) \
- for_if (gem_ring_has_physical_engine(fd__, flags__ = e__->exec_id | e__->flags))
-
bool gem_ring_is_physical_engine(int fd, unsigned int ring);
bool gem_ring_has_physical_engine(int fd, unsigned int ring);
--
2.19.1
More information about the igt-dev
mailing list