diff options
author | Antonio Argenziano <antonio.argenziano@intel.com> | 2018-03-19 15:30:38 -0700 |
---|---|---|
committer | Antonio Argenziano <antonio.argenziano@intel.com> | 2018-03-20 10:44:10 -0700 |
commit | 94e886203a99ef19b8319489a45cd348e76e8ccd (patch) | |
tree | c26a1fe72268b6049b1aa5b3ffb256e1edc1ef7d /lib | |
parent | 178e7f3da66cd02660a86257df75708a0efa3bbc (diff) |
igt: Replace 'all-engines' magic numbers with macro
In interfaces where a parameter allow to select an engine, we usually
use '-1' or '~0u' to select all engines. This patch replaces magic
numbers with a named constant.
Suggested-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Antonio Argenziano <antonio.argenziano@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/i915/gem_submission.c | 6 | ||||
-rw-r--r-- | lib/igt_dummyload.c | 2 | ||||
-rw-r--r-- | lib/igt_gt.h | 2 |
3 files changed, 6 insertions, 4 deletions
diff --git a/lib/i915/gem_submission.c b/lib/i915/gem_submission.c index e27ea9ec..c5e96969 100644 --- a/lib/i915/gem_submission.c +++ b/lib/i915/gem_submission.c @@ -177,8 +177,8 @@ static bool is_wedged(int i915) * @i915: open i915 drm file descriptor * @engine: the engine (I915_EXEC_RING id) to exercise * - * Execute a nop batch on the specified, or -1 for all, and check it - * executes. + * Execute a nop batch on the engine specified, or ALL_ENGINES for all, + * and check it executes. */ void gem_test_engine(int i915, unsigned int engine) { @@ -194,7 +194,7 @@ void gem_test_engine(int i915, unsigned int engine) igt_assert(!is_wedged(i915)); gem_write(i915, obj.handle, 0, &bbe, sizeof(bbe)); - if (engine == -1u) { + if (engine == ALL_ENGINES) { for_each_engine(i915, engine) { execbuf.flags = engine; gem_execbuf(i915, &execbuf); diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c index 4b20f23d..dbc92e8f 100644 --- a/lib/igt_dummyload.c +++ b/lib/igt_dummyload.c @@ -91,7 +91,7 @@ static int emit_recursive_batch(igt_spin_t *spin, int i; nengine = 0; - if (engine == -1) { + if (engine == ALL_ENGINES) { for_each_engine(fd, engine) if (engine) engines[nengine++] = engine; diff --git a/lib/igt_gt.h b/lib/igt_gt.h index 4d9d1aa0..a517ed7b 100644 --- a/lib/igt_gt.h +++ b/lib/igt_gt.h @@ -66,6 +66,8 @@ void igt_clflush_range(void *addr, int size); 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; |