From: Lucas De Marchi <lucas.demarchi@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Subject: [PATCH i-g-t 6/8] lib/xe/xe_spin: Move declarations around
Date: Fri, 3 Jan 2025 23:15:46 -0800 [thread overview]
Message-ID: <20250104071548.737612-6-lucas.demarchi@intel.com> (raw)
In-Reply-To: <20250104071548.737612-1-lucas.demarchi@intel.com>
xe_spin.h has 3 abstractions:
1) the integration with igt_dummyload
2) xe_spin, the bo to be exec'ed somewhere
3) xe_cork, that resembles more the igt_spin, abstracting the fd, vm,
bind, etc
Group them so it's easier to understand each one.
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
lib/xe/xe_spin.c | 2 +-
lib/xe/xe_spin.h | 54 +++++++++++++++++++++++++++---------------------
2 files changed, 32 insertions(+), 24 deletions(-)
diff --git a/lib/xe/xe_spin.c b/lib/xe/xe_spin.c
index 333f8d7d8..bb6318cef 100644
--- a/lib/xe/xe_spin.c
+++ b/lib/xe/xe_spin.c
@@ -232,7 +232,7 @@ xe_spin_create(int fd, const struct igt_spin_factory *opt)
return spin;
}
-void xe_spin_sync_wait(int fd, struct igt_spin *spin)
+static void xe_spin_sync_wait(int fd, struct igt_spin *spin)
{
igt_assert(syncobj_wait(fd, &spin->syncobj, 1, INT64_MAX, 0, NULL));
}
diff --git a/lib/xe/xe_spin.h b/lib/xe/xe_spin.h
index 01f45eaeb..7c95996c3 100644
--- a/lib/xe/xe_spin.h
+++ b/lib/xe/xe_spin.h
@@ -15,6 +15,15 @@
#include "xe_query.h"
#include "lib/igt_dummyload.h"
+/* Wrapper to integrate with igt_dummyload, aka igt_spin */
+igt_spin_t *xe_spin_create(int fd, const struct igt_spin_factory *opt);
+void xe_spin_free(int fd, struct igt_spin *spin);
+
+/*
+ * xe_spin: abstract a bo mapped in the GPU that when exec'ed will spin the
+ * engine in which it's exec'ed
+ */
+
/**
* struct xe_spin_opts
* @addr: offset of spinner within vm
@@ -30,11 +39,6 @@ struct xe_spin_opts {
bool write_timestamp;
};
-struct xe_cork_opts {
- uint64_t ahnd;
- bool debug;
-};
-
/* Mapped GPU object */
struct xe_spin {
uint32_t batch[128];
@@ -46,6 +50,24 @@ struct xe_spin {
uint32_t timestamp;
};
+uint32_t xe_spin_nsec_to_ticks(int fd, int gt_id, uint64_t nsec);
+void xe_spin_init(struct xe_spin *spin, struct xe_spin_opts *opts);
+#define xe_spin_init_opts(fd, ...) \
+ xe_spin_init(fd, &((struct xe_spin_opts){__VA_ARGS__}))
+bool xe_spin_started(struct xe_spin *spin);
+void xe_spin_wait_started(struct xe_spin *spin);
+void xe_spin_end(struct xe_spin *spin);
+
+/*
+ * xe_cork: higher level API that simplifies exec'ing an xe_spin by taking care
+ * of vm creation, exec call, etc.
+ */
+
+struct xe_cork_opts {
+ uint64_t ahnd;
+ bool debug;
+};
+
struct xe_cork {
struct xe_spin *spin;
int fd;
@@ -65,27 +87,13 @@ struct xe_cork {
uint16_t num_placements;
};
-igt_spin_t *xe_spin_create(int fd, const struct igt_spin_factory *opt);
-void xe_spin_init(struct xe_spin *spin, struct xe_spin_opts *opts);
-struct xe_cork *
-xe_cork_create(int fd, struct drm_xe_engine_class_instance *hwe, uint32_t vm,
- uint16_t width, uint16_t num_placements, struct xe_cork_opts *opts);
-void xe_cork_destroy(int fd, struct xe_cork *ctx);
-
+struct xe_cork *xe_cork_create(int fd, struct drm_xe_engine_class_instance *hwe,
+ uint32_t vm, uint16_t width, uint16_t num_placements,
+ struct xe_cork_opts *opts);
#define xe_cork_create_opts(fd, hwe, vm, width, num_placements, ...) \
xe_cork_create(fd, hwe, vm, width, num_placements, \
&((struct xe_cork_opts){__VA_ARGS__}))
-
-#define xe_spin_init_opts(fd, ...) \
- xe_spin_init(fd, &((struct xe_spin_opts){__VA_ARGS__}))
-
-uint32_t xe_spin_nsec_to_ticks(int fd, int gt_id, uint64_t nsec);
-
-bool xe_spin_started(struct xe_spin *spin);
-void xe_spin_sync_wait(int fd, struct igt_spin *spin);
-void xe_spin_wait_started(struct xe_spin *spin);
-void xe_spin_end(struct xe_spin *spin);
-void xe_spin_free(int fd, struct igt_spin *spin);
+void xe_cork_destroy(int fd, struct xe_cork *ctx);
void xe_cork_sync_start(int fd, struct xe_cork *ctx);
void xe_cork_sync_end(int fd, struct xe_cork *ctx);
--
2.47.0
next prev parent reply other threads:[~2025-01-04 7:16 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-04 7:15 [PATCH i-g-t 1/8] tests/intel/xe_drm_fdinfo: Do not end cork not started Lucas De Marchi
2025-01-04 7:15 ` [PATCH i-g-t 2/8] lib/xe/xe_gt: Fix header guards and boilerplate Lucas De Marchi
2025-01-06 22:58 ` Cavitt, Jonathan
2025-01-04 7:15 ` [PATCH i-g-t 3/8] lib/xe: Move functions from xe_util to xe_gt Lucas De Marchi
2025-01-06 22:58 ` Cavitt, Jonathan
2025-01-07 17:57 ` Lucas De Marchi
2025-01-04 7:15 ` [PATCH i-g-t 4/8] lib/xe: Rename xe_is_gt_in_c6() Lucas De Marchi
2025-01-06 22:58 ` Cavitt, Jonathan
2025-01-04 7:15 ` [PATCH i-g-t 5/8] lib/xe: Split nsec to ticks abstraction Lucas De Marchi
2025-01-06 22:58 ` Cavitt, Jonathan
2025-01-04 7:15 ` Lucas De Marchi [this message]
2025-01-06 22:58 ` [PATCH i-g-t 6/8] lib/xe/xe_spin: Move declarations around Cavitt, Jonathan
2025-01-07 18:05 ` Lucas De Marchi
2025-01-04 7:15 ` [PATCH i-g-t 7/8] treewide: s/ctx/cork/ when referring to xe_cork Lucas De Marchi
2025-01-06 22:58 ` Cavitt, Jonathan
2025-01-04 7:15 ` [PATCH i-g-t 8/8] tests/intel/xe_drm_fdinfo: Stop asserting on usage percentage Lucas De Marchi
2025-01-06 22:58 ` Cavitt, Jonathan
2025-01-07 19:06 ` Lucas De Marchi
2025-01-06 14:58 ` ✓ i915.CI.BAT: success for series starting with [i-g-t,1/8] tests/intel/xe_drm_fdinfo: Do not end cork not started (rev2) Patchwork
2025-01-06 15:05 ` ✓ Xe.CI.BAT: " Patchwork
2025-01-06 15:08 ` [PATCH i-g-t 1/8] tests/intel/xe_drm_fdinfo: Do not end cork not started Cavitt, Jonathan
2025-01-06 17:22 ` Lucas De Marchi
2025-01-06 17:03 ` ✓ i915.CI.Full: success for series starting with [i-g-t,1/8] tests/intel/xe_drm_fdinfo: Do not end cork not started (rev2) Patchwork
2025-01-07 6:07 ` ✗ Xe.CI.Full: failure " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250104071548.737612-6-lucas.demarchi@intel.com \
--to=lucas.demarchi@intel.com \
--cc=igt-dev@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox