Allow building on musl --- --- a/benchmarks/gem_syslatency.c +++ b/benchmarks/gem_syslatency.c @@ -44,7 +44,11 @@ #include -#define sigev_notify_thread_id _sigev_un._tid +#ifndef __GLIBC__ +#include "signal_compat.h" +#endif + +#define sigev_notify_thread_id sigev_notify_function static volatile int done; --- a/lib/igt_aux.c +++ b/lib/igt_aux.c @@ -31,6 +31,7 @@ #endif #include #include +#include // PATH_MAX #include #include #include @@ -73,6 +74,12 @@ #include /* for dirname() */ #endif +#ifndef __GLIBC__ +#include "signal_compat.h" +#endif + +//#include + /** * SECTION:igt_aux * @short_description: Auxiliary libraries and support functions --- a/lib/igt_aux.h +++ b/lib/igt_aux.h @@ -46,7 +46,7 @@ # define gettid() (pid_t)(syscall(__NR_gettid)) # endif #endif -#define sigev_notify_thread_id _sigev_un._tid +#define sigev_notify_thread_id sigev_notify_function /* auxialiary igt helpers from igt_aux.c */ /* generally useful helpers */ --- a/lib/igt_halffloat.c +++ b/lib/igt_halffloat.c @@ -162,7 +162,7 @@ static inline float _half_to_float(uint16_t val) return fi.f; } -#if defined(__x86_64__) && !defined(__clang__) +#if defined(__x86_64__) && !defined(__clang__) && defined(__GLIBC__) #pragma GCC push_options #pragma GCC target("f16c") --- a/lib/igt_x86.c +++ b/lib/igt_x86.c @@ -190,7 +190,7 @@ char *igt_x86_features_to_string(unsigned features, char *line) } #endif -#if defined(__x86_64__) && !defined(__clang__) +#if defined(__x86_64__) && !defined(__clang__) && defined(__GLIBC__) #pragma GCC push_options #pragma GCC target("sse4.1") #pragma GCC diagnostic ignored "-Wpointer-arith" --- /dev/null +++ b/lib/signal_compat.h @@ -0,0 +1,8 @@ +#define SIGEV_SIGNAL 0 +#define SIGEV_NONE 1 +#define SIGEV_THREAD 2 + +#define SIGEV_SIGNAL 0 /* notify via signal */ +#define SIGEV_NONE 1 /* other notification: meaningless */ +#define SIGEV_THREAD 2 /* deliver via thread creation */ +#define SIGEV_THREAD_ID 4 /* deliver to thread */ --- a/tests/drm_read.c +++ b/tests/drm_read.c @@ -220,7 +220,7 @@ static void test_short_buffer_wakeup(int in, enum pipe pipe) pthread_mutex_unlock(&w.mutex); /* Give each thread a chance to sleep in drm_read() */ - pthread_yield(); + sched_yield(); /* One event should wake all threads as none consume */ generate_event(w.fd, pipe); --- a/tests/kms_hdmi_inject.c +++ b/tests/kms_hdmi_inject.c @@ -23,7 +23,7 @@ */ #include "config.h" - +#include #include #include "igt.h" --- a/tests/kms_sysfs_edid_timing.c +++ b/tests/kms_sysfs_edid_timing.c @@ -24,6 +24,7 @@ #include #include +#include #include #define THRESHOLD_PER_CONNECTOR 10 --- a/tests/i915/gem_close_race.c +++ b/tests/i915/gem_close_race.c @@ -42,6 +42,10 @@ #include #include "drm.h" +#ifndef __GLIBC__ +#include "signal_compat.h" +#endif + #define OBJECT_SIZE (256 * 1024) #define COPY_BLT_CMD (2<<29|0x53<<22|0x6) @@ -51,7 +55,7 @@ static uint32_t devid; static bool has_64bit_relocations; -#define sigev_notify_thread_id _sigev_un._tid +#define sigev_notify_thread_id sigev_notify_function static void selfcopy(int fd, uint32_t handle, int loops) { --- a/tests/panfrost_submit.c +++ b/tests/panfrost_submit.c @@ -68,7 +68,7 @@ static void check_fb(int fd, struct panfrost_bo *bo) { int gpu_prod_id = igt_panfrost_get_param(fd, DRM_PANFROST_PARAM_GPU_PROD_ID); - __uint32_t *fbo; + uint32_t *fbo; int i; fbo = bo->map; --- a/tests/kms_atomic.c +++ b/tests/kms_atomic.c @@ -683,7 +683,6 @@ { int timeline, fence_fd; void *map; - const ptrdiff_t PAGE_SIZE = sysconf(_SC_PAGE_SIZE); uint64_t old_mode_id = pipe->values[IGT_CRTC_MODE_ID]; igt_require_sw_sync();