[PATCH i-g-t v3 08/10] tests/intel/xe_drm_fdinfo: Remove unused flags
Lucas De Marchi
lucas.demarchi at intel.com
Tue Aug 27 16:54:47 UTC 2024
single() is the only test function that is used by multiple kinds of
tests and controlled by flags. The others simply pass the same flags
every time. Simplify the tests by removing the bogus checks.
Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
---
tests/intel/xe_drm_fdinfo.c | 81 +++++++++++++++++--------------------
1 file changed, 38 insertions(+), 43 deletions(-)
diff --git a/tests/intel/xe_drm_fdinfo.c b/tests/intel/xe_drm_fdinfo.c
index 46c96dbe0..23edeea40 100644
--- a/tests/intel/xe_drm_fdinfo.c
+++ b/tests/intel/xe_drm_fdinfo.c
@@ -538,7 +538,7 @@ single(int fd, struct drm_xe_engine_class_instance *hwe, unsigned int flags)
}
static void
-busy_check_all(int fd, struct drm_xe_engine_class_instance *hwe, unsigned int flags)
+busy_check_all(int fd, struct drm_xe_engine_class_instance *hwe)
{
struct pceu_cycles pceu1[DRM_XE_ENGINE_CLASS_COMPUTE + 1];
struct pceu_cycles pceu2[DRM_XE_ENGINE_CLASS_COMPUTE + 1];
@@ -547,20 +547,20 @@ busy_check_all(int fd, struct drm_xe_engine_class_instance *hwe, unsigned int fl
int class;
vm = xe_vm_create(fd, 0, 0);
- if (flags & TEST_BUSY) {
- ctx = spin_ctx_init(fd, hwe, vm);
- spin_sync_start(fd, ctx);
- }
+
+ ctx = spin_ctx_init(fd, hwe, vm);
+ spin_sync_start(fd, ctx);
read_engine_cycles(fd, pceu1);
usleep(batch_duration_usec);
- if (flags & TEST_TRAILING_IDLE)
- spin_sync_end(fd, ctx);
+ spin_sync_end(fd, ctx);
read_engine_cycles(fd, pceu2);
- xe_for_each_engine_class(class)
- check_results(pceu1, pceu2, class,
- hwe->engine_class == class ? flags : 0);
+ xe_for_each_engine_class(class) {
+ bool idle = hwe->engine_class != class;
+
+ check_results(pceu1, pceu2, class, idle ? 0 : TEST_BUSY);
+ }
spin_sync_end(fd, ctx);
spin_ctx_destroy(fd, ctx);
@@ -594,8 +594,7 @@ single_destroy_queue(int fd, struct drm_xe_engine_class_instance *hwe)
}
static void
-most_busy_check_all(int fd, struct drm_xe_engine_class_instance *hwe,
- unsigned int flags)
+most_busy_check_all(int fd, struct drm_xe_engine_class_instance *hwe)
{
struct pceu_cycles pceu1[DRM_XE_ENGINE_CLASS_COMPUTE + 1];
struct pceu_cycles pceu2[DRM_XE_ENGINE_CLASS_COMPUTE + 1];
@@ -605,32 +604,31 @@ most_busy_check_all(int fd, struct drm_xe_engine_class_instance *hwe,
int class;
vm = xe_vm_create(fd, 0, 0);
- if (flags & TEST_BUSY) {
- /* spin on one hwe per class except the target class hwes */
- xe_for_each_engine(fd, _hwe) {
- int _class = _hwe->engine_class;
- if (_class == hwe->engine_class || ctx[_class])
- continue;
+ /* spin on one hwe per class except the target class hwes */
+ xe_for_each_engine(fd, _hwe) {
+ int _class = _hwe->engine_class;
- ctx[_class] = spin_ctx_init(fd, _hwe, vm);
- spin_sync_start(fd, ctx[_class]);
- }
+ if (_class == hwe->engine_class || ctx[_class])
+ continue;
+
+ ctx[_class] = spin_ctx_init(fd, _hwe, vm);
+ spin_sync_start(fd, ctx[_class]);
}
read_engine_cycles(fd, pceu1);
usleep(batch_duration_usec);
- if (flags & TEST_TRAILING_IDLE)
- xe_for_each_engine_class(class)
- spin_sync_end(fd, ctx[class]);
+ xe_for_each_engine_class(class)
+ spin_sync_end(fd, ctx[class]);
read_engine_cycles(fd, pceu2);
xe_for_each_engine_class(class) {
+ bool idle = hwe->engine_class == class;
+
if (!ctx[class])
continue;
- check_results(pceu1, pceu2, class,
- hwe->engine_class == class ? 0 : flags);
+ check_results(pceu1, pceu2, class, idle ? 0 : TEST_BUSY);
spin_sync_end(fd, ctx[class]);
spin_ctx_destroy(fd, ctx[class]);
}
@@ -639,7 +637,7 @@ most_busy_check_all(int fd, struct drm_xe_engine_class_instance *hwe,
}
static void
-all_busy_check_all(int fd, unsigned int flags)
+all_busy_check_all(int fd)
{
struct pceu_cycles pceu1[DRM_XE_ENGINE_CLASS_COMPUTE + 1];
struct pceu_cycles pceu2[DRM_XE_ENGINE_CLASS_COMPUTE + 1];
@@ -649,31 +647,28 @@ all_busy_check_all(int fd, unsigned int flags)
int class;
vm = xe_vm_create(fd, 0, 0);
- if (flags & TEST_BUSY) {
- /* spin on one hwe per class */
- xe_for_each_engine(fd, hwe) {
- class = hwe->engine_class;
- if (ctx[class])
- continue;
+ /* spin on one hwe per class */
+ xe_for_each_engine(fd, hwe) {
+ class = hwe->engine_class;
+ if (ctx[class])
+ continue;
- ctx[class] = spin_ctx_init(fd, hwe, vm);
- spin_sync_start(fd, ctx[class]);
- }
+ ctx[class] = spin_ctx_init(fd, hwe, vm);
+ spin_sync_start(fd, ctx[class]);
}
read_engine_cycles(fd, pceu1);
usleep(batch_duration_usec);
- if (flags & TEST_TRAILING_IDLE)
- xe_for_each_engine_class(class)
- spin_sync_end(fd, ctx[class]);
+ xe_for_each_engine_class(class)
+ spin_sync_end(fd, ctx[class]);
read_engine_cycles(fd, pceu2);
xe_for_each_engine_class(class) {
if (!ctx[class])
continue;
- check_results(pceu1, pceu2, class, flags);
+ check_results(pceu1, pceu2, class, TEST_BUSY);
spin_sync_end(fd, ctx[class]);
spin_ctx_destroy(fd, ctx[class]);
}
@@ -715,14 +710,14 @@ igt_main
igt_subtest("drm-busy-idle-check-all")
xe_for_each_engine(xe, hwe)
- busy_check_all(xe, hwe, TEST_BUSY | TEST_TRAILING_IDLE);
+ busy_check_all(xe, hwe);
igt_subtest("drm-most-busy-idle-check-all")
xe_for_each_engine(xe, hwe)
- most_busy_check_all(xe, hwe, TEST_BUSY | TEST_TRAILING_IDLE);
+ most_busy_check_all(xe, hwe);
igt_subtest("drm-all-busy-idle-check-all")
- all_busy_check_all(xe, TEST_BUSY | TEST_TRAILING_IDLE);
+ all_busy_check_all(xe);
igt_subtest("drm-busy-exec-queue-destroy-idle")
xe_for_each_engine(xe, hwe)
--
2.43.0
More information about the igt-dev
mailing list