mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
260 lines
10 KiB
Diff
260 lines
10 KiB
Diff
diff --git mesa-clean/include/drm-uapi/drm.h mesa-workdir/include/drm-uapi/drm.h
|
|
index 4e4f7c2..2e4d3e2 100644
|
|
--- mesa-clean/include/drm-uapi/drm.h
|
|
+++ mesa-workdir/include/drm-uapi/drm.h
|
|
@@ -44,7 +44,7 @@ typedef unsigned int drm_handle_t;
|
|
#else /* One of the BSDs */
|
|
|
|
#include <stdint.h>
|
|
-#include <sys/ioccom.h>
|
|
+//#include <sys/ioccom.h>
|
|
#include <sys/types.h>
|
|
typedef int8_t __s8;
|
|
typedef uint8_t __u8;
|
|
diff --git mesa-clean/meson.build mesa-workdir/meson.build
|
|
index 9fb4160..f774dad 100644
|
|
--- mesa-clean/meson.build
|
|
+++ mesa-workdir/meson.build
|
|
@@ -118,7 +118,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', 'managarm'].contains(host_machine.system())
|
|
+system_has_kms_drm = ['openbsd', 'netbsd', 'freebsd', 'gnu/kfreebsd', 'dragonfly', 'linux', 'sunos', 'android', 'managarm', 'astral'].contains(host_machine.system())
|
|
|
|
gallium_drivers = get_option('gallium-drivers')
|
|
if gallium_drivers.contains('auto')
|
|
@@ -1040,7 +1040,7 @@ if cc.has_function('fmemopen')
|
|
endif
|
|
|
|
# TODO: this is very incomplete
|
|
-if ['linux', 'cygwin', 'gnu', 'freebsd', 'gnu/kfreebsd', 'haiku', 'android', 'managarm'].contains(host_machine.system())
|
|
+if ['linux', 'cygwin', 'gnu', 'freebsd', 'gnu/kfreebsd', 'haiku', 'android', 'managarm', 'astral'].contains(host_machine.system())
|
|
pre_args += '-D_GNU_SOURCE'
|
|
elif host_machine.system() == 'sunos'
|
|
pre_args += '-D__EXTENSIONS__'
|
|
diff --git mesa-clean/src/gallium/drivers/llvmpipe/lp_screen.c mesa-workdir/src/gallium/drivers/llvmpipe/lp_screen.c
|
|
index 7daa531..6b6dd7b 100644
|
|
--- mesa-clean/src/gallium/drivers/llvmpipe/lp_screen.c
|
|
+++ mesa-workdir/src/gallium/drivers/llvmpipe/lp_screen.c
|
|
@@ -128,7 +128,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
|
|
#endif
|
|
|
|
switch (param) {
|
|
-#ifdef HAVE_LINUX_UDMABUF_H
|
|
+#if defined(HAVE_LINUX_UDMABUF_H) && defined(__linux__)
|
|
case PIPE_CAP_DMABUF:
|
|
if (lscreen->udmabuf_fd != -1)
|
|
return DRM_PRIME_CAP_IMPORT | DRM_PRIME_CAP_EXPORT;
|
|
@@ -1173,7 +1173,7 @@ llvmpipe_create_screen(struct sw_winsys *winsys)
|
|
screen->num_threads);
|
|
screen->num_threads = MIN2(screen->num_threads, LP_MAX_THREADS);
|
|
|
|
-#ifdef HAVE_LINUX_UDMABUF_H
|
|
+#if defined(HAVE_LINUX_UDMABUF_H) && defined(__linux__)
|
|
screen->udmabuf_fd = open("/dev/udmabuf", O_RDWR);
|
|
#endif
|
|
|
|
diff --git mesa-clean/src/gallium/drivers/llvmpipe/lp_texture.c mesa-workdir/src/gallium/drivers/llvmpipe/lp_texture.c
|
|
index 2aab5bf..e8f9d69 100644
|
|
--- mesa-clean/src/gallium/drivers/llvmpipe/lp_texture.c
|
|
+++ mesa-workdir/src/gallium/drivers/llvmpipe/lp_texture.c
|
|
@@ -63,6 +63,10 @@
|
|
#include "drm-uapi/drm_fourcc.h"
|
|
#endif
|
|
|
|
+#ifdef __astral__
|
|
+#undef HAVE_LINUX_UDMABUF_H
|
|
+#endif
|
|
+
|
|
#ifdef HAVE_LINUX_UDMABUF_H
|
|
#include <fcntl.h>
|
|
#include <sys/mman.h>
|
|
diff --git mesa-clean/src/gallium/targets/dril/dril_target.c mesa-workdir/src/gallium/targets/dril/dril_target.c
|
|
index 593a07e..a8893b0 100644
|
|
--- mesa-clean/src/gallium/targets/dril/dril_target.c
|
|
+++ mesa-workdir/src/gallium/targets/dril/dril_target.c
|
|
@@ -332,8 +332,10 @@ init_dri2_configs(int fd)
|
|
|
|
/* dlopen/dlsym to avoid linkage */
|
|
egl = dlopen("libEGL.so.1", RTLD_LAZY | RTLD_LOCAL);
|
|
- if (!egl)
|
|
+ if (!egl) {
|
|
+ fprintf(stderr, "bad egl\n");
|
|
return false;
|
|
+ }
|
|
|
|
void * (*peglGetProcAddress)(const char *) = dlsym(egl, "eglGetProcAddress");
|
|
EGLDisplay (*peglGetPlatformDisplayEXT)(EGLenum, void *, const EGLint *) = peglGetProcAddress("eglGetPlatformDisplayEXT");
|
|
@@ -342,34 +344,47 @@ init_dri2_configs(int fd)
|
|
EGLBoolean (*peglGetConfigs)(EGLDisplay, EGLConfig*, EGLint, EGLint*) = peglGetProcAddress("eglGetConfigs");
|
|
EGLBoolean (*peglGetConfigAttrib)(EGLDisplay, EGLConfig, EGLint, EGLint *) = peglGetProcAddress("eglGetConfigAttrib");
|
|
const char *(*peglQueryString)(EGLDisplay, EGLint) = peglGetProcAddress("eglQueryString");
|
|
+ // Add after dlopen succeeds:
|
|
+ fprintf(stderr, "dril: EGL client extensions: %s\n", peglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS));
|
|
+ fflush(stderr);
|
|
|
|
struct gbm_device *gbm = NULL;
|
|
if (fd != -1) {
|
|
/* try opening GBM for hardware driver info */
|
|
gbm = gbm_create_device(fd);
|
|
- if (!gbm)
|
|
+ if (!gbm) {
|
|
+ fprintf(stderr, "bad gbm\n");
|
|
goto out;
|
|
+ }
|
|
}
|
|
|
|
- EGLDisplay dpy = peglGetPlatformDisplayEXT(EGL_PLATFORM_GBM_MESA, gbm ? gbm : EGL_DEFAULT_DISPLAY, NULL);
|
|
- if (!dpy)
|
|
+ EGLDisplay dpy = peglGetPlatformDisplayEXT(EGL_PLATFORM_SURFACELESS_MESA, gbm ? gbm : EGL_DEFAULT_DISPLAY, NULL);
|
|
+ if (!dpy) {
|
|
+ fprintf(stderr, "bad dpy\n");
|
|
goto out_gbm;
|
|
+ }
|
|
int maj, min;
|
|
- if (!peglInitialize(dpy, &maj, &min))
|
|
+ if (!peglInitialize(dpy, &maj, &min)) {
|
|
+ fprintf(stderr, "bad pegl\n");
|
|
goto out_gbm;
|
|
+ }
|
|
|
|
const char *egl_extension_list = peglQueryString(dpy, EGL_EXTENSIONS);
|
|
bool has_srgb = strstr(egl_extension_list, "EGL_KHR_gl_colorspace");
|
|
|
|
int num_configs = 0;
|
|
EGLConfig *eglconfigs = NULL;
|
|
- if (!peglGetConfigs(dpy, NULL, 0, &num_configs))
|
|
+ if (!peglGetConfigs(dpy, NULL, 0, &num_configs)) {
|
|
+ fprintf(stderr, "bad pegconfigs\n");
|
|
goto out_egl;
|
|
+ }
|
|
eglconfigs = malloc(sizeof(EGLConfig) * num_configs);
|
|
/* overestimate: num_configs * doubleBuffer * sRGB + NULL */
|
|
configs = calloc(num_configs * 2 * 2 + 1, sizeof(struct gl_config));
|
|
- if (!peglGetConfigs(dpy, eglconfigs, num_configs, &num_configs))
|
|
+ if (!peglGetConfigs(dpy, eglconfigs, num_configs, &num_configs)) {
|
|
+ fprintf(stderr, "more bad pegconfigs\n");
|
|
goto out_egl;
|
|
+ }
|
|
|
|
for (unsigned i = 0; i < num_configs; i++) {
|
|
/* verify that this is the right format */
|
|
@@ -381,6 +396,9 @@ init_dri2_configs(int fd)
|
|
!peglGetConfigAttrib(dpy, eglconfigs[i], EGL_SAMPLES, &samples))
|
|
continue;
|
|
|
|
+ fprintf(stderr, "dril: config %u format=0x%x depth=%d stencil=%d samples=%d\n", i, format, depth, stencil, samples);
|
|
+ fflush(stderr);
|
|
+
|
|
enum pipe_format pformat = fourcc_to_pipe_format(format);
|
|
|
|
/* srgb configs go after base configs */
|
|
@@ -412,6 +430,20 @@ init_dri2_configs(int fd)
|
|
/* check last format for srgbness too */
|
|
if (c && has_srgb)
|
|
c = add_srgb_config(configs, c, last_pformat, last_start);
|
|
+
|
|
+ fprintf(stderr, "c: %u\n", c);
|
|
+ /* surfaceless EGL returns no native visual IDs, populate directly */
|
|
+if (c == 0) {
|
|
+ configs = calloc(ARRAY_SIZE(drilConfigs) * 2 + 1, sizeof(struct gl_config));
|
|
+ for (unsigned i = 0; i < ARRAY_SIZE(drilConfigs); i++) {
|
|
+ /* single-buffered */
|
|
+ configs[c] = mem_dup(&drilConfigs[i], sizeof(drilConfigs[i]));
|
|
+ configs[c++]->doubleBufferMode = 0;
|
|
+ /* double-buffered */
|
|
+ configs[c] = mem_dup(&drilConfigs[i], sizeof(drilConfigs[i]));
|
|
+ configs[c++]->doubleBufferMode = 1;
|
|
+ }
|
|
+}
|
|
out_egl:
|
|
free(eglconfigs);
|
|
/* don't forget cleanup */
|
|
diff --git mesa-clean/src/glx/glxcmds.c mesa-workdir/src/glx/glxcmds.c
|
|
index 561d4c8..ffda2d0 100644
|
|
--- mesa-clean/src/glx/glxcmds.c
|
|
+++ mesa-workdir/src/glx/glxcmds.c
|
|
@@ -1832,6 +1832,9 @@ _X_HIDDEN GLboolean
|
|
__glxGetMscRate(struct glx_screen *psc,
|
|
int32_t * numerator, int32_t * denominator)
|
|
{
|
|
+#ifdef __astral__
|
|
+ return False;
|
|
+#else
|
|
#if !defined(GLX_USE_WINDOWSGL)
|
|
XF86VidModeModeLine mode_line;
|
|
int dot_clock;
|
|
@@ -1882,6 +1885,7 @@ __glxGetMscRate(struct glx_screen *psc,
|
|
#endif
|
|
|
|
return False;
|
|
+#endif
|
|
}
|
|
#endif
|
|
|
|
diff --git mesa-clean/src/util/detect_os.h mesa-workdir/src/util/detect_os.h
|
|
index 86286df..f3a5106 100644
|
|
--- mesa-clean/src/util/detect_os.h
|
|
+++ mesa-workdir/src/util/detect_os.h
|
|
@@ -91,6 +91,11 @@
|
|
#define DETECT_OS_POSIX 1
|
|
#endif
|
|
|
|
+#if defined(__astral__)
|
|
+#define DETECT_OS_ASTRAL 1
|
|
+#define DETECT_OS_POSIX 1
|
|
+#endif
|
|
+
|
|
|
|
/*
|
|
* Make sure DETECT_OS_* are always defined, so that they can be used with #if
|
|
diff --git mesa-clean/src/util/os_misc.c mesa-workdir/src/util/os_misc.c
|
|
index f529318..a61cd93 100644
|
|
--- mesa-clean/src/util/os_misc.c
|
|
+++ mesa-workdir/src/util/os_misc.c
|
|
@@ -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 || DETECT_OS_MANAGARM
|
|
+#elif DETECT_OS_LINUX || DETECT_OS_CYGWIN || DETECT_OS_SOLARIS || DETECT_OS_HURD || DETECT_OS_MANAGARM || DETECT_OS_ASTRAL
|
|
# include <unistd.h>
|
|
#elif DETECT_OS_OPENBSD || DETECT_OS_FREEBSD
|
|
# include <sys/resource.h>
|
|
@@ -274,7 +274,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 || DETECT_OS_MANAGARM
|
|
+#if DETECT_OS_LINUX || DETECT_OS_CYGWIN || DETECT_OS_SOLARIS || DETECT_OS_HURD || DETECT_OS_MANAGARM || DETECT_OS_ASTRAL
|
|
const long phys_pages = sysconf(_SC_PHYS_PAGES);
|
|
const long page_size = sysconf(_SC_PAGE_SIZE);
|
|
|
|
diff --git mesa-clean/src/util/os_time.c mesa-workdir/src/util/os_time.c
|
|
index da8ad7a..001cc3a 100644
|
|
--- mesa-clean/src/util/os_time.c
|
|
+++ mesa-workdir/src/util/os_time.c
|
|
@@ -65,7 +65,7 @@ os_time_get_nano(void)
|
|
void
|
|
os_time_sleep(int64_t usecs)
|
|
{
|
|
-#if DETECT_OS_LINUX || DETECT_OS_MANAGARM || DETECT_OS_FUCHSIA
|
|
+#if DETECT_OS_LINUX || DETECT_OS_MANAGARM || DETECT_OS_FUCHSIA || DETECT_OS_ASTRAL
|
|
struct timespec time;
|
|
time.tv_sec = usecs / 1000000;
|
|
time.tv_nsec = (usecs % 1000000) * 1000;
|
|
diff --git mesa-clean/src/util/u_thread.c mesa-workdir/src/util/u_thread.c
|
|
index 255c5f6..a532705 100644
|
|
--- mesa-clean/src/util/u_thread.c
|
|
+++ mesa-workdir/src/util/u_thread.c
|
|
@@ -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__) || DETECT_OS_MANAGARM || DETECT_OS_FUCHSIA
|
|
+#if DETECT_OS_LINUX || DETECT_OS_CYGWIN || DETECT_OS_SOLARIS || defined(__GLIBC__) || DETECT_OS_MANAGARM || DETECT_OS_FUCHSIA || DETECT_OS_ASTRAL
|
|
int ret = pthread_setname_np(pthread_self(), name);
|
|
if (ret == ERANGE) {
|
|
char buf[16];
|