1 diff -ruN mesa-19.0.1/include/EGL/eglplatform.h mesa-19.0.1.aros/include/EGL/eglplatform.h
2 --- mesa-19.0.1/include/EGL/eglplatform.h 2019-03-27 17:04:23.000000000 +0000
3 +++ mesa-19.0.1.aros/include/EGL/eglplatform.h 2019-04-03 02:29:42.025219800 +0100
5 typedef struct gbm_bo *EGLNativePixmapType;
6 typedef void *EGLNativeWindowType;
8 +#elif defined(__AROS__)
10 +#include <intuition/intuition.h>
12 +typedef APTR EGLNativeDisplayType;
13 +typedef struct Bitmap *EGLNativePixmapType;
14 +typedef struct Window *EGLNativeWindowType;
16 #elif defined(__ANDROID__) || defined(ANDROID)
19 diff -ruN mesa-19.0.1/include/c11/threads_posix.h mesa-19.0.1.aros/include/c11/threads_posix.h
20 --- mesa-19.0.1/include/c11/threads_posix.h 2019-03-27 17:04:23.000000000 +0000
21 +++ mesa-19.0.1.aros/include/c11/threads_posix.h 2019-04-03 02:30:29.619536500 +0100
26 +#if defined(__AROS__)
30 +#define pthread_sigmask(a,b,c) (1)
33 /*---------------------------- macros ----------------------------*/
34 #define ONCE_FLAG_INIT PTHREAD_ONCE_INIT
35 #ifdef INIT_ONCE_STATIC_INIT
36 diff -ruN mesa-19.0.1/include/c99_math.h mesa-19.0.1.aros/include/c99_math.h
37 --- mesa-19.0.1/include/c99_math.h 2019-03-27 17:04:23.000000000 +0000
38 +++ mesa-19.0.1.aros/include/c99_math.h 2019-04-03 02:31:40.233582000 +0100
43 +#elif defined(__AROS__)
44 +#define fpclassify(x) FP_NORMAL
46 #error "Need to include or define an fpclassify function"
48 diff -ruN mesa-19.0.1/src/egl/main/egldisplay.c mesa-19.0.1.aros/src/egl/main/egldisplay.c
49 --- mesa-19.0.1/src/egl/main/egldisplay.c 2019-03-27 17:04:23.000000000 +0000
50 +++ mesa-19.0.1.aros/src/egl/main/egldisplay.c 2019-04-03 02:34:17.877051100 +0100
52 { _EGL_PLATFORM_X11, "x11" },
53 { _EGL_PLATFORM_WAYLAND, "wayland" },
54 { _EGL_PLATFORM_DRM, "drm" },
55 + { _EGL_PLATFORM_AROS, "aros" },
56 { _EGL_PLATFORM_ANDROID, "android" },
57 { _EGL_PLATFORM_HAIKU, "haiku" },
58 { _EGL_PLATFORM_SURFACELESS, "surfaceless" },
59 diff -ruN mesa-19.0.1/src/egl/main/egldisplay.h mesa-19.0.1.aros/src/egl/main/egldisplay.h
60 --- mesa-19.0.1/src/egl/main/egldisplay.h 2019-03-27 17:04:23.000000000 +0000
61 +++ mesa-19.0.1.aros/src/egl/main/egldisplay.h 2019-04-03 02:34:44.769303500 +0100
64 _EGL_PLATFORM_WAYLAND,
67 _EGL_PLATFORM_ANDROID,
69 _EGL_PLATFORM_SURFACELESS,
70 diff -ruN mesa-19.0.1/src/gallium/auxiliary/driver_ddebug/dd_util.h mesa-19.0.1.aros/src/gallium/auxiliary/driver_ddebug/dd_util.h
71 --- mesa-19.0.1/src/gallium/auxiliary/driver_ddebug/dd_util.h 2019-03-27 17:04:23.000000000 +0000
72 +++ mesa-19.0.1.aros/src/gallium/auxiliary/driver_ddebug/dd_util.h 2019-04-03 03:06:34.658627100 +0100
74 #include "util/u_string.h"
76 #include "pipe/p_config.h"
77 -#if defined(PIPE_OS_UNIX)
78 +#if defined(PIPE_OS_UNIX) || defined(PIPE_OS_AROS)
81 #elif defined(PIPE_OS_WINDOWS)
82 diff -ruN mesa-19.0.1/src/gallium/include/pipe/p_config.h mesa-19.0.1.aros/src/gallium/include/pipe/p_config.h
83 --- mesa-19.0.1/src/gallium/include/pipe/p_config.h 2019-03-27 17:04:23.000000000 +0000
84 +++ mesa-19.0.1.aros/src/gallium/include/pipe/p_config.h 2019-04-03 02:07:01.103290700 +0100
86 #define PIPE_ARCH_AARCH64
89 +#if defined(__mc68000__)
90 +#define PIPE_ARCH_M68K
98 #if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) || defined(PIPE_ARCH_ARM) || defined(PIPE_ARCH_AARCH64)
99 #define PIPE_ARCH_LITTLE_ENDIAN
100 -#elif defined(PIPE_ARCH_PPC) || defined(PIPE_ARCH_PPC_64) || defined(PIPE_ARCH_S390)
101 +#elif defined(PIPE_ARCH_M68K) || defined(PIPE_ARCH_PPC) || defined(PIPE_ARCH_PPC_64) || defined(PIPE_ARCH_S390)
102 #define PIPE_ARCH_BIG_ENDIAN
106 * See subsystem below for a more fine-grained distinction.
109 +#if defined(__AROS__)
110 +#define PIPE_OS_AROS
111 +#else /* !__AROS__ */
113 #if defined(__linux__)
114 #define PIPE_OS_LINUX
118 #endif /* PIPE_OS_WINDOWS */
120 +#endif /* ! __AROS__ */
122 #endif /* P_CONFIG_H_ */
123 diff -ruN mesa-19.0.1/src/mesa/main/compiler.h mesa-19.0.1.aros/src/mesa/main/compiler.h
124 --- mesa-19.0.1/src/mesa/main/compiler.h 2019-03-27 17:04:24.000000000 +0000
125 +++ mesa-19.0.1.aros/src/mesa/main/compiler.h 2019-04-03 01:55:19.836278300 +0100
127 #elif defined(__APPLE__)
128 #include <CoreFoundation/CFByteOrder.h>
129 #define CPU_TO_LE32( x ) CFSwapInt32HostToLittle( x )
130 +#elif defined(__AROS__)
131 +#define CPU_TO_LE32( x ) AROS_BE2LONG( x )
132 #elif defined(__OpenBSD__)
133 #include <sys/types.h>
134 #define CPU_TO_LE32( x ) htole32( x )
135 diff -ruN mesa-19.0.1/src/util/os_misc.c mesa-19.0.1.aros/src/util/os_misc.c
136 --- mesa-19.0.1/src/util/os_misc.c 2019-03-27 17:04:24.000000000 +0000
137 +++ mesa-19.0.1.aros/src/util/os_misc.c 2019-04-03 02:43:34.251028000 +0100
139 # include <kernel/OS.h>
140 #elif defined(PIPE_OS_WINDOWS)
141 # include <windows.h>
142 +#elif defined(PIPE_OS_AROS)
143 +# include <proto/exec.h>
145 #error unexpected platform in os_sysinfo.c
148 ret = GlobalMemoryStatusEx(&status);
149 *size = status.ullTotalPhys;
150 return (ret == TRUE);
151 +#elif defined(PIPE_OS_AROS)
152 + *size = (uint64_t)AvailMem(MEMF_TOTAL);
155 #error unexpected platform in os_sysinfo.c
157 diff -ruN mesa-19.0.1/src/util/os_misc.h mesa-19.0.1.aros/src/util/os_misc.h
158 --- mesa-19.0.1/src/util/os_misc.h 2019-03-27 17:04:24.000000000 +0000
159 +++ mesa-19.0.1.aros/src/util/os_misc.h 2019-04-03 03:32:22.500543200 +0100
161 #include "pipe/p_compiler.h"
164 -#if defined(PIPE_OS_UNIX)
165 +#if defined(PIPE_OS_UNIX) || defined(PIPE_OS_AROS)
166 # include <signal.h> /* for kill() */
167 # include <unistd.h> /* getpid() */
169 diff -ruN mesa-19.0.1/src/util/os_time.c mesa-19.0.1.aros/src/util/os_time.c
170 --- mesa-19.0.1/src/util/os_time.c 2019-03-27 17:04:24.000000000 +0000
171 +++ mesa-19.0.1.aros/src/util/os_time.c 2019-04-03 04:51:03.391474300 +0100
174 #include "util/u_atomic.h"
176 -#if defined(PIPE_OS_UNIX)
177 +#if defined(PIPE_OS_UNIX) || defined(PIPE_OS_AROS)
178 # include <unistd.h> /* usleep */
179 # include <time.h> /* timeval */
180 # include <sys/time.h> /* timeval */
182 clock_gettime(CLOCK_MONOTONIC, &tv);
183 return tv.tv_nsec + tv.tv_sec*INT64_C(1000000000);
185 -#elif defined(PIPE_OS_UNIX)
186 +#elif defined(PIPE_OS_UNIX) || defined(PIPE_OS_AROS)
189 gettimeofday(&tv, NULL);
191 time.tv_nsec = (usecs % 1000000) * 1000;
192 while (clock_nanosleep(CLOCK_MONOTONIC, 0, &time, &time) == EINTR);
194 -#elif defined(PIPE_OS_UNIX)
195 +#elif defined(PIPE_OS_UNIX) || defined(PIPE_OS_AROS)
198 #elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
199 diff -ruN mesa-19.0.1/src/mapi/glapi/glapi.h mesa-19.0.1.aros/src/mapi/glapi/glapi.h
200 --- mesa-19.0.1/src/mapi/glapi/glapi.h 2019-03-27 17:04:23.000000000 +0000
201 +++ mesa-19.0.1.aros/src/mapi/glapi/glapi.h 2019-03-27 17:04:23.000000000 +0000
203 # define GET_DISPATCH() _glapi_tls_Dispatch
204 # define GET_CURRENT_CONTEXT(C) struct gl_context *C = (struct gl_context *) _glapi_tls_Context
206 +#elif defined(__AROS__)
208 +#define GET_DISPATCH() _glapi_get_dispatch()
209 +#define GET_CURRENT_CONTEXT(C) struct gl_context *C = (struct gl_context *) _glapi_get_context()
213 _GLAPI_EXPORT extern struct _glapi_table *_glapi_Dispatch;
214 diff -ruN mesa-19.0.1/src/mapi/u_current.c mesa-19.0.1.aros/src/mapi/u_current.c
215 --- mesa-19.0.1/src/mapi/u_current.c 2019-03-27 17:04:23.000000000 +0000
216 +++ mesa-19.0.1.aros/src/mapi/u_current.c 2019-04-04 17:39:12.930607600 +0100
218 __thread void *u_current_context
219 __attribute__((tls_model("initial-exec")));
221 +#elif defined(__AROS__)
224 +DECLARE_STATIC_TLS(u_current_table);
225 +DECLARE_STATIC_TLS(u_current_context);
229 struct _glapi_table *u_current_table =
230 @@ -123,14 +129,14 @@
232 u_current_destroy(void)
234 -#if !defined(GLX_USE_TLS)
235 +#if !defined(GLX_USE_TLS) && !defined(__AROS__)
236 tss_delete(u_current_table_tsd);
237 tss_delete(u_current_context_tsd);
242 -#if !defined(GLX_USE_TLS)
243 +#if !defined(GLX_USE_TLS) && !defined(__AROS__)
246 u_current_init_tsd(void)
249 #if defined(GLX_USE_TLS)
250 u_current_context = (void *) ptr;
251 +#elif defined(__AROS__)
252 + InsertIntoTLS(u_current_context, (APTR)ptr);
254 tss_set(u_current_context_tsd, (void *) ptr);
255 u_current_context = (ThreadSafe) ? NULL : (void *) ptr;
258 #if defined(GLX_USE_TLS)
259 return u_current_context;
260 +#elif defined(__AROS__)
261 + return GetFromTLS(u_current_context);
263 return ThreadSafe ? tss_get(u_current_context_tsd) : u_current_context;
267 #if defined(GLX_USE_TLS)
268 u_current_table = (struct _glapi_table *) tbl;
269 +#elif defined(__AROS__)
270 + InsertIntoTLS(u_current_table, (APTR)tbl);
272 tss_set(u_current_table_tsd, (void *) tbl);
273 u_current_table = (ThreadSafe) ? NULL : (void *) tbl;
276 #if defined(GLX_USE_TLS)
277 return u_current_table;
278 +#elif defined(__AROS__)
279 + struct _glapi_table *tbl;
280 + tbl = (struct _glapi_table *)GetFromTLS(u_current_table);
282 + tbl = (struct _glapi_table *) table_noop_array;
286 return (struct _glapi_table *) tss_get(u_current_table_tsd);
287 diff -ruN mesa-19.0.1/src/mapi/u_current.h mesa-19.0.1.aros/src/mapi/u_current.h
288 --- mesa-19.0.1/src/mapi/u_current.h 2019-03-27 17:04:23.000000000 +0000
289 +++ mesa-19.0.1.aros/src/mapi/u_current.h 2019-04-04 17:41:11.185741700 +0100
292 extern __thread void *u_current_context
293 __attribute__((tls_model("initial-exec")));
294 +#elif defined(__AROS__)
296 #else /* GLX_USE_TLS */
301 return u_current_table;
302 +#elif defined(__AROS__)
303 + return u_current_get_table_internal();
305 return (likely(u_current_table) ?
306 u_current_table : u_current_get_table_internal());
310 return u_current_context;
311 +#elif defined(__AROS__)
312 + return u_current_get_context_internal();
314 return likely(u_current_context) ? u_current_context : u_current_get_context_internal();