mesa: add managarm support
Co-authored-by: Alexander Richards <electrodeyt@gmail.com> Signed-off-by: Alexander Richards <electrodeyt@gmail.com> Signed-off-by: Dennis Bonke <dennis@managarm.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25818>
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
#ifndef _DMA_BUF_UAPI_H_
|
||||
#define _DMA_BUF_UAPI_H_
|
||||
|
||||
#if defined(__linux__)
|
||||
#if defined(__linux__) || defined(__managarm__)
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
|
@@ -35,7 +35,7 @@
|
||||
#ifndef _DRM_H_
|
||||
#define _DRM_H_
|
||||
|
||||
#if defined(__linux__)
|
||||
#if defined(__linux__) || defined(__managarm__)
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <asm/ioctl.h>
|
||||
|
@@ -128,7 +128,7 @@ with_any_opengl = with_opengl or with_gles1 or with_gles2
|
||||
# Only build shared_glapi if at least one OpenGL API is enabled
|
||||
with_shared_glapi = with_shared_glapi and with_any_opengl
|
||||
|
||||
system_has_kms_drm = ['openbsd', 'netbsd', 'freebsd', 'gnu/kfreebsd', 'dragonfly', 'linux', 'sunos', 'android'].contains(host_machine.system())
|
||||
system_has_kms_drm = ['openbsd', 'netbsd', 'freebsd', 'gnu/kfreebsd', 'dragonfly', 'linux', 'sunos', 'android', 'managarm'].contains(host_machine.system())
|
||||
|
||||
gallium_drivers = get_option('gallium-drivers')
|
||||
if gallium_drivers.contains('auto')
|
||||
@@ -962,7 +962,7 @@ if cc.has_function('fmemopen')
|
||||
endif
|
||||
|
||||
# TODO: this is very incomplete
|
||||
if ['linux', 'cygwin', 'gnu', 'freebsd', 'gnu/kfreebsd', 'haiku', 'android'].contains(host_machine.system())
|
||||
if ['linux', 'cygwin', 'gnu', 'freebsd', 'gnu/kfreebsd', 'haiku', 'android', 'managarm'].contains(host_machine.system())
|
||||
pre_args += '-D_GNU_SOURCE'
|
||||
elif host_machine.system() == 'sunos'
|
||||
pre_args += '-D__EXTENSIONS__'
|
||||
|
@@ -440,7 +440,7 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen,
|
||||
return 0;
|
||||
|
||||
case PIPE_CAP_DMABUF:
|
||||
#if defined(HAVE_LIBDRM) && (DETECT_OS_LINUX || DETECT_OS_BSD)
|
||||
#if defined(HAVE_LIBDRM) && (DETECT_OS_LINUX || DETECT_OS_BSD || DETECT_OS_MANAGARM)
|
||||
fd = pscreen->get_screen_fd(pscreen);
|
||||
if (fd != -1 && (drmGetCap(fd, DRM_CAP_PRIME, &cap) == 0))
|
||||
return cap;
|
||||
|
@@ -81,6 +81,11 @@
|
||||
#define DETECT_OS_UNIX 1
|
||||
#endif
|
||||
|
||||
#if defined(__managarm__)
|
||||
#define DETECT_OS_MANAGARM 1
|
||||
#define DETECT_OS_UNIX 1
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Make sure DETECT_OS_* are always defined, so that they can be used with #if
|
||||
@@ -127,5 +132,8 @@
|
||||
#ifndef DETECT_OS_WINDOWS
|
||||
#define DETECT_OS_WINDOWS 0
|
||||
#endif
|
||||
#ifndef DETECT_OS_MANAGARM
|
||||
#define DETECT_OS_MANAGARM 0
|
||||
#endif
|
||||
|
||||
#endif /* DETECT_OS_H */
|
||||
|
@@ -24,7 +24,7 @@
|
||||
#ifndef UTIL_FUTEX_H
|
||||
#define UTIL_FUTEX_H
|
||||
|
||||
#if defined(HAVE_LINUX_FUTEX_H)
|
||||
#if defined(HAVE_LINUX_FUTEX_H) && defined(__linux__)
|
||||
#define UTIL_FUTEX_SUPPORTED 1
|
||||
#elif defined(__FreeBSD__)
|
||||
#define UTIL_FUTEX_SUPPORTED 1
|
||||
|
@@ -57,7 +57,7 @@
|
||||
# include <unistd.h>
|
||||
# include <log/log.h>
|
||||
# include <cutils/properties.h>
|
||||
#elif DETECT_OS_LINUX || DETECT_OS_CYGWIN || DETECT_OS_SOLARIS || DETECT_OS_HURD
|
||||
#elif DETECT_OS_LINUX || DETECT_OS_CYGWIN || DETECT_OS_SOLARIS || DETECT_OS_HURD || DETECT_OS_MANAGARM
|
||||
# include <unistd.h>
|
||||
#elif DETECT_OS_OPENBSD || DETECT_OS_FREEBSD
|
||||
# include <sys/resource.h>
|
||||
@@ -248,7 +248,7 @@ exit_mutex:
|
||||
bool
|
||||
os_get_total_physical_memory(uint64_t *size)
|
||||
{
|
||||
#if DETECT_OS_LINUX || DETECT_OS_CYGWIN || DETECT_OS_SOLARIS || DETECT_OS_HURD
|
||||
#if DETECT_OS_LINUX || DETECT_OS_CYGWIN || DETECT_OS_SOLARIS || DETECT_OS_HURD || DETECT_OS_MANAGARM
|
||||
const long phys_pages = sysconf(_SC_PHYS_PAGES);
|
||||
const long page_size = sysconf(_SC_PAGE_SIZE);
|
||||
|
||||
|
@@ -65,7 +65,7 @@ os_time_get_nano(void)
|
||||
void
|
||||
os_time_sleep(int64_t usecs)
|
||||
{
|
||||
#if DETECT_OS_LINUX
|
||||
#if DETECT_OS_LINUX || DETECT_OS_MANAGARM
|
||||
struct timespec time;
|
||||
time.tv_sec = usecs / 1000000;
|
||||
time.tv_nsec = (usecs % 1000000) * 1000;
|
||||
|
@@ -75,7 +75,7 @@ int u_thread_create(thrd_t *thrd, int (*routine)(void *), void *param)
|
||||
void u_thread_setname( const char *name )
|
||||
{
|
||||
#if defined(HAVE_PTHREAD)
|
||||
#if DETECT_OS_LINUX || DETECT_OS_CYGWIN || DETECT_OS_SOLARIS || defined(__GLIBC__)
|
||||
#if DETECT_OS_LINUX || DETECT_OS_CYGWIN || DETECT_OS_SOLARIS || defined(__GLIBC__) || DETECT_OS_MANAGARM
|
||||
int ret = pthread_setname_np(pthread_self(), name);
|
||||
if (ret == ERANGE) {
|
||||
char buf[16];
|
||||
@@ -154,7 +154,7 @@ util_set_thread_affinity(thrd_t thread,
|
||||
int64_t
|
||||
util_thread_get_time_nano(thrd_t thread)
|
||||
{
|
||||
#if defined(HAVE_PTHREAD) && !defined(__APPLE__) && !defined(__HAIKU__)
|
||||
#if defined(HAVE_PTHREAD) && !defined(__APPLE__) && !defined(__HAIKU__) && !defined(__managarm__)
|
||||
struct timespec ts;
|
||||
clockid_t cid;
|
||||
|
||||
|
Reference in New Issue
Block a user