Module Name:    xsrc
Committed By:   mrg
Date:           Tue Oct 22 00:23:43 UTC 2024

Modified Files:
        xsrc/external/mit/MesaLib/dist/src/util: u_atomic.c

Log Message:
sort-of-fix Mesa on most 32-bit platforms.

the new sparse_array implementation in Mesa 21 (not present in Mesa 19,
as shipped with netbsd-10) triggers it asking for an __atomic_load_8()
function, alongside it's __atomic_fetch_add_8/__atomic_fetch_sub_8/
__sync_val_compare_and_swap_8 versions on 32-bit platforms, so add a
__atomic_load_8() workaround that uses the same method as the others
to provide sync.  (i did check, and almost the accesses in mesa that
this accessor is used with do go via the API, the only ones not used
are as part setup/clean up.

tested by rin@ on macppc.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 xsrc/external/mit/MesaLib/dist/src/util/u_atomic.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/MesaLib/dist/src/util/u_atomic.c
diff -u xsrc/external/mit/MesaLib/dist/src/util/u_atomic.c:1.5 xsrc/external/mit/MesaLib/dist/src/util/u_atomic.c:1.6
--- xsrc/external/mit/MesaLib/dist/src/util/u_atomic.c:1.5	Sat May 11 18:50:15 2019
+++ xsrc/external/mit/MesaLib/dist/src/util/u_atomic.c	Tue Oct 22 00:23:42 2024
@@ -62,6 +62,18 @@ __atomic_fetch_sub_8(volatile long long 
    return r;
 }
 
+WEAK long long
+__atomic_load_8(const volatile long long *ptr, int memorder)
+{
+   long long r;
+
+   pthread_mutex_lock(&sync_mutex);
+   r = *ptr;
+   pthread_mutex_unlock(&sync_mutex);
+
+   return r;
+}
+
 #ifndef __clang__
 WEAK long long
 __sync_val_compare_and_swap_8(volatile long long *ptr, long long oldval, long long newval)

Reply via email to