[igt-dev] [PATCH i-g-t 17/93] lib/dummyload: Support intel_ctx_t (v2)
Jason Ekstrand
jason at jlekstrand.net
Wed Jun 9 17:36:00 UTC 2021
v2 (Zbigniew Kempczyński):
- Drop a spurrious newline
- Use igt_assert() instead of assert()
Signed-off-by: Jason Ekstrand <jason at jlekstrand.net>
Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
---
lib/igt_dummyload.c | 30 ++++++++++++++++++++++--------
lib/igt_dummyload.h | 3 +++
2 files changed, 25 insertions(+), 8 deletions(-)
diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c
index 784714d6..82459e52 100644
--- a/lib/igt_dummyload.c
+++ b/lib/igt_dummyload.c
@@ -123,16 +123,28 @@ emit_recursive_batch(igt_spin_t *spin,
addr += random() % addr / 2;
addr &= -4096;
+ igt_assert(!(opts->ctx && opts->ctx_id));
+
nengine = 0;
if (opts->engine == ALL_ENGINES) {
struct intel_execution_engine2 *engine;
- for_each_context_engine(fd, opts->ctx_id, engine) {
- if (opts->flags & IGT_SPIN_POLL_RUN &&
- !gem_class_can_store_dword(fd, engine->class))
- continue;
+ if (opts->ctx) {
+ for_each_ctx_engine(fd, opts->ctx, engine) {
+ if (opts->flags & IGT_SPIN_POLL_RUN &&
+ !gem_class_can_store_dword(fd, engine->class))
+ continue;
- flags[nengine++] = engine->flags;
+ flags[nengine++] = engine->flags;
+ }
+ } else {
+ for_each_context_engine(fd, opts->ctx_id, engine) {
+ if (opts->flags & IGT_SPIN_POLL_RUN &&
+ !gem_class_can_store_dword(fd, engine->class))
+ continue;
+
+ flags[nengine++] = engine->flags;
+ }
}
} else {
flags[nengine++] = opts->engine;
@@ -325,7 +337,7 @@ emit_recursive_batch(igt_spin_t *spin,
execbuf->buffers_ptr =
to_user_pointer(obj + (2 - execbuf->buffer_count));
- execbuf->rsvd1 = opts->ctx_id;
+ execbuf->rsvd1 = opts->ctx ? opts->ctx->id : opts->ctx_id;
if (opts->flags & IGT_SPIN_FENCE_OUT)
execbuf->flags |= I915_EXEC_FENCE_OUT;
@@ -422,8 +434,10 @@ igt_spin_factory(int fd, const struct igt_spin_factory *opts)
struct intel_execution_engine2 e;
int class;
- if (!gem_context_lookup_engine(fd, opts->engine,
- opts->ctx_id, &e)) {
+ if (opts->ctx) {
+ class = opts->ctx->cfg.engines[opts->engine].engine_class;
+ } else if (!gem_context_lookup_engine(fd, opts->engine,
+ opts->ctx_id, &e)) {
class = e.class;
} else {
gem_require_ring(fd, opts->engine);
diff --git a/lib/igt_dummyload.h b/lib/igt_dummyload.h
index ad1ce28c..67e1a08e 100644
--- a/lib/igt_dummyload.h
+++ b/lib/igt_dummyload.h
@@ -31,6 +31,7 @@
#include "igt_core.h"
#include "igt_list.h"
#include "i915_drm.h"
+#include "intel_ctx.h"
typedef struct igt_spin {
struct igt_list_head link;
@@ -62,6 +63,7 @@ typedef struct igt_spin {
/**
* igt_spin_factory_t:
* @ctx_id: GEM context handle
+ * @ctx: intel_ctx_t context wrapper
* @dependency: GEM object to depend on
* @engine: Flags describing the engine to execute on
* @flags: Set of IGT_SPIN_* flags
@@ -71,6 +73,7 @@ typedef struct igt_spin {
*/
typedef struct igt_spin_factory {
uint32_t ctx_id;
+ const intel_ctx_t *ctx;
uint32_t dependency;
unsigned int engine;
unsigned int flags;
--
2.31.1
More information about the igt-dev
mailing list