summaryrefslogtreecommitdiff
path: root/lib/igt_dummyload.h
diff options
context:
space:
mode:
authorDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>2018-02-22 09:35:06 -0800
committerChris Wilson <chris@chris-wilson.co.uk>2018-02-23 08:56:58 +0000
commit7040f3be1efec904c3ba5729a5a532d03346a161 (patch)
tree60cb2490bdd3f31374147ceb58a31e72d40b57e3 /lib/igt_dummyload.h
parente2e2b4c4d11a1aed2af1079c914e76df4eddbe76 (diff)
lib/igt_dummyload: add igt_cork
The "cork" bo (imported bo with attached fence) and fence is used in several tests to stall execution. Moving it to a common place makes the codebase cleaner. Note that the actual test updates is done in follow up patches as it is simpler to do in one go after one more common function is added in the next patch. v2: don't use new/free naming, don't use dynamic alloc (Chris) v3: add sw_sync common functions. (Chris) v4: squash sw_sync and vgem cork structs into one. (Chris) v5: use anonymous enum in cork struct. (Chris) v6: reset cork after unplugging. (Chris) Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> Signed-off-by: Antonio Argenziano <antonio.argenziano@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib/igt_dummyload.h')
-rw-r--r--lib/igt_dummyload.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/igt_dummyload.h b/lib/igt_dummyload.h
index ffa7e351..4103e4ab 100644
--- a/lib/igt_dummyload.h
+++ b/lib/igt_dummyload.h
@@ -61,4 +61,36 @@ void igt_spin_batch_free(int fd, igt_spin_t *spin);
void igt_terminate_spin_batches(void);
+enum igt_cork_type {
+ CORK_SYNC_FD = 1,
+ CORK_VGEM_HANDLE
+};
+
+struct igt_cork_vgem {
+ int device;
+ uint32_t fence;
+};
+
+struct igt_cork_sw_sync {
+ int timeline;
+};
+
+struct igt_cork {
+ enum igt_cork_type type;
+
+ union {
+ int fd;
+
+ struct igt_cork_vgem vgem;
+ struct igt_cork_sw_sync sw_sync;
+ };
+};
+
+#define IGT_CORK(name, cork_type) struct igt_cork name = { .type = cork_type, .fd = -1}
+#define IGT_CORK_HANDLE(name) IGT_CORK(name, CORK_VGEM_HANDLE)
+#define IGT_CORK_FENCE(name) IGT_CORK(name, CORK_SYNC_FD)
+
+uint32_t igt_cork_plug(struct igt_cork *cork, int fd);
+void igt_cork_unplug(struct igt_cork *cork);
+
#endif /* __IGT_DUMMYLOAD_H__ */