From 7f07783569ea2fb2d0922cc72ff7c25d1cc7dd20 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 3 Apr 2026 22:17:12 -0700 Subject: [PATCH] llvmpipe: fix build on macOS due to st_mtim macOS struct stat uses st_mtimespec instead of st_mtim. Use st_mtimespec on Apple platforms to get nanosecond file modification time. Fixes: e68a0dfb126 ("llvmpipe: Implement manual context resets") Signed-off-by: Vinson Lee Part-of: --- src/gallium/drivers/llvmpipe/lp_context.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gallium/drivers/llvmpipe/lp_context.c b/src/gallium/drivers/llvmpipe/lp_context.c index d13a09cf90b..d24dd1abe65 100644 --- a/src/gallium/drivers/llvmpipe/lp_context.c +++ b/src/gallium/drivers/llvmpipe/lp_context.c @@ -225,8 +225,13 @@ llvmpipe_get_device_reset_status(struct pipe_context *pipe) PIPE_UNKNOWN_CONTEXT_RESET : PIPE_NO_RESET; if (stat(llvmpipe->context_reset_file_path, &st_reset_file) == 0) { +#if defined(__APPLE__) + int64_t file_mod_time_ns = (int64_t)st_reset_file.st_mtimespec.tv_sec * + 1000000000LL + st_reset_file.st_mtimespec.tv_nsec; +#else int64_t file_mod_time_ns = (int64_t)st_reset_file.st_mtim.tv_sec * 1000000000LL + st_reset_file.st_mtim.tv_nsec; +#endif if (llvmpipe->context_creation_time_ns < file_mod_time_ns) { llvmpipe->context_reset_time_ns = now_ns;