asahi: Don't depend on glibc to decode
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Sat, 22 Jul 2023 16:40:49 +0000 (12:40 -0400)
committerAlyssa Rosenzweig <alyssa@rosenzweig.io>
Sat, 22 Jul 2023 16:42:58 +0000 (12:42 -0400)
fopencookie is a glibc feature, so we can't use it on macOS (and
probably other libc's?). It's only used for the hypervisor interface,
though, so we can just make the hypervisor piece glibc-only while
otherwise fixing the wrap.dylib build.

Fixes: ee83453f69f ("asahi: Add a shared library interface for decode")
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24293>

src/asahi/lib/decode.c

index c357610..bb43fc4 100644 (file)
@@ -971,17 +971,24 @@ libagxdecode_writer(void *cookie, const char *buffer, size_t size)
    return lib_config.stream_write(buffer, size);
 }
 
+#ifdef _GNU_SOURCE
 static cookie_io_functions_t funcs = {.write = libagxdecode_writer};
+#endif
 
 static decoder_params lib_params;
 
 void
 libagxdecode_init(struct libagxdecode_config *config)
 {
+#ifdef _GNU_SOURCE
    lib_config = *config;
    agxdecode_dump_stream = fopencookie(NULL, "w", funcs);
 
    chip_id_to_params(&lib_params, config->chip_id);
+#else
+   /* fopencookie is a glibc extension */
+   unreachable("libagxdecode only available with glibc");
+#endif
 }
 
 void