llvmpipe: fix build on macOS due to st_mtim
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

macOS struct stat uses st_mtimespec instead of st_mtim. Use
st_mtimespec on Apple platforms to get nanosecond file modification
time.

Fixes: e68a0dfb12 ("llvmpipe: Implement manual context resets")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40791>
This commit is contained in:
Vinson Lee 2026-04-03 22:17:12 -07:00
parent 21952ffb07
commit 7f07783569

View file

@ -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;