[PATCH i-g-t 2/3] lib/igt_core: Add a couple of time conversion macros
Lucas De Marchi
lucas.demarchi at intel.com
Wed Aug 14 21:47:04 UTC 2024
NSEC_PER_MSEC is defined in a few places: move it to a shared place
and make it build on top of USEC_PER_MSEC.
---
lib/igt_core.h | 2 ++
tests/intel/gem_ctx_persistence.c | 1 -
tests/intel/xe_exec_sip.c | 2 --
3 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/lib/igt_core.h b/lib/igt_core.h
index c83bcbaba..74fa0ed49 100644
--- a/lib/igt_core.h
+++ b/lib/igt_core.h
@@ -1509,6 +1509,8 @@ void igt_kmsg(const char *format, ...);
#define USEC_PER_SEC (1000u * MSEC_PER_SEC)
#define USEC_PER_DECISEC (100u * MSEC_PER_SEC)
#define NSEC_PER_SEC (1000u * USEC_PER_SEC)
+#define USEC_PER_MSEC (1000u)
+#define NSEC_PER_MSEC (1000u * USEC_PER_MSEC)
#define for_if(expr__) if (!(expr__)) {} else
diff --git a/tests/intel/gem_ctx_persistence.c b/tests/intel/gem_ctx_persistence.c
index 8d4a874d4..974444cf1 100644
--- a/tests/intel/gem_ctx_persistence.c
+++ b/tests/intel/gem_ctx_persistence.c
@@ -122,7 +122,6 @@
#define RESET_TIMEOUT_MS 2 * MSEC_PER_SEC; /* default: 640ms */
static unsigned long reset_timeout_ms = RESET_TIMEOUT_MS;
-#define NSEC_PER_MSEC (1000 * 1000ull)
static void cleanup(int i915)
{
diff --git a/tests/intel/xe_exec_sip.c b/tests/intel/xe_exec_sip.c
index f99726761..ea1770cd6 100644
--- a/tests/intel/xe_exec_sip.c
+++ b/tests/intel/xe_exec_sip.c
@@ -31,8 +31,6 @@
#define SHADER_CANARY 0x01010101
-#define NSEC_PER_MSEC (1000 * 1000ull)
-
static struct intel_buf *
create_fill_buf(int fd, int width, int height, uint8_t color)
{
--
2.43.0
More information about the igt-dev
mailing list