mirror of
https://gitlab.redox-os.org/redox-os/redox.git
synced 2026-06-17 15:34:18 +08:00
Port mesa demos for wayland
This commit is contained in:
parent
a56678a23f
commit
9461a537e7
@ -53,6 +53,8 @@ export RUST_BACKTRACE=full
|
||||
export RUST_LOG=debug
|
||||
export XCURSOR_THEME=Pop
|
||||
export XDG_RUNTIME_DIR=/tmp/run/user/0
|
||||
# Comment out once responsive
|
||||
export WAYLAND_DEBUG=1
|
||||
|
||||
# Create XDG runtime directory
|
||||
#TODO: mkdir -p not working
|
||||
|
||||
@ -158,6 +158,7 @@ lz4 = {}
|
||||
mednafen = {}
|
||||
mesa = {}
|
||||
mesa-glu = {}
|
||||
mesa-demos = {}
|
||||
mesa-demos-x11 = {}
|
||||
mgba = {}
|
||||
miniserve = {}
|
||||
|
||||
@ -37,7 +37,8 @@ cookbook_meson \
|
||||
-Dosmesa=true \
|
||||
-Dplatforms=redox \
|
||||
-Dshader-cache=disabled \
|
||||
-Dvulkan-drivers=swrast
|
||||
-Dvulkan-drivers=swrast \
|
||||
-Dgallium-drivers=swrast
|
||||
|
||||
# Hack to add LLVM libs, the list can be seen from meson log and check for matches $("${LLVM_CONFIG}" --libs)
|
||||
LLVMLIBS="-lLLVMBitReader -lLLVMCore -lLLVMExecutionEngine -lLLVMInstCombine -lLLVMMCDisassembler"
|
||||
|
||||
@ -1,9 +1,19 @@
|
||||
#TODO not compiled or tested
|
||||
# build instructions: https://gitlab.freedesktop.org/mesa/demos/-/blob/main/README.rst?ref_type=heads
|
||||
#TODO wayland only
|
||||
[source]
|
||||
tar = "https://archive.mesa3d.org/demos/mesa-demos-9.0.0.tar.xz"
|
||||
[build]
|
||||
template = "meson"
|
||||
dependencies = [
|
||||
"freeglut",
|
||||
"mesa",
|
||||
#this is possible, but demos remain using wayland (freeglut)
|
||||
#"mesa-x11",
|
||||
"wayland-protocols",
|
||||
"libdecor",
|
||||
]
|
||||
dev-dependencies = [
|
||||
"libstdcxx",
|
||||
]
|
||||
|
||||
[package]
|
||||
description = "Mesa demos (wayland only)"
|
||||
|
||||
144
recipes/wip/demos/mesa-demos/redox.patch
Normal file
144
recipes/wip/demos/mesa-demos/redox.patch
Normal file
@ -0,0 +1,144 @@
|
||||
diff --color -ruwN source/meson.build source-new/meson.build
|
||||
--- source/meson.build 2023-03-22 19:13:43.000000000 +0700
|
||||
+++ source-new/meson.build 2026-06-12 05:37:17.049652059 +0700
|
||||
@@ -39,7 +39,7 @@
|
||||
dep_m = cc.find_library('m', required : false)
|
||||
dep_winmm = cc.find_library('winmm', required : false)
|
||||
|
||||
-dep_gl = dependency('gl')
|
||||
+dep_gl = dependency('gl', required: false)
|
||||
|
||||
dep_epoll = dependency('epoll-shim', required : false)
|
||||
dep_gles1 = dependency('glesv1_cm', required : get_option('gles1'))
|
||||
@@ -99,7 +99,7 @@
|
||||
endif
|
||||
|
||||
dep_glx = dependency('glx', required: false, disabler : true)
|
||||
-if not dep_glx.found() and host_machine.system() == 'darwin'
|
||||
+if not dep_glx.found()
|
||||
# xquartz doesn't have a glx.pc, but it does have the header. And all the
|
||||
# symbols reside in libGL, so let's just use that.
|
||||
if cc.check_header('GL/glx.h', dependencies: dep_x11)
|
||||
diff --color -ruwN source/src/egl/eglut/eglut_wayland.c source-new/src/egl/eglut/eglut_wayland.c
|
||||
--- source/src/egl/eglut/eglut_wayland.c 2023-03-22 19:13:43.000000000 +0700
|
||||
+++ source-new/src/egl/eglut/eglut_wayland.c 2026-06-12 06:13:45.751910615 +0700
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include <sys/mman.h>
|
||||
-#include <sys/timerfd.h>
|
||||
+// #include <sys/timerfd.h>
|
||||
#include <unistd.h>
|
||||
#include <xkbcommon/xkbcommon.h>
|
||||
|
||||
@@ -133,21 +133,6 @@
|
||||
handle_key(struct display *d, xkb_keycode_t keycode,
|
||||
enum wl_keyboard_key_state state)
|
||||
{
|
||||
- struct itimerspec timer = {0};
|
||||
- if (d->seat.rate != 0 &&
|
||||
- xkb_keymap_key_repeats(d->seat.xkb_keymap, keycode) &&
|
||||
- state == WL_KEYBOARD_KEY_STATE_PRESSED) {
|
||||
- d->seat.repeat_keycode = keycode;
|
||||
- if (d->seat.rate > 1)
|
||||
- timer.it_interval.tv_nsec = 1000000000 / d->seat.rate;
|
||||
- else
|
||||
- timer.it_interval.tv_sec = 1;
|
||||
-
|
||||
- timer.it_value.tv_sec = d->seat.delay / 1000;
|
||||
- timer.it_value.tv_nsec = ( d->seat.delay % 1000) * 1000000;
|
||||
- }
|
||||
- timerfd_settime(d->seat.key_repeat_fd, 0, &timer, NULL);
|
||||
-
|
||||
if (state == WL_KEYBOARD_KEY_STATE_PRESSED)
|
||||
emit_keypress(d, keycode);
|
||||
}
|
||||
@@ -167,9 +152,6 @@
|
||||
leave_callback(void *data, struct wl_keyboard *wl_keyboard,
|
||||
uint32_t serial, struct wl_surface *surface)
|
||||
{
|
||||
- struct display *d = data;
|
||||
- struct itimerspec timer = {0};
|
||||
- timerfd_settime(d->seat.key_repeat_fd, 0, &timer, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -218,7 +200,7 @@
|
||||
if (caps & WL_SEAT_CAPABILITY_KEYBOARD) {
|
||||
d->seat.keyboard = wl_seat_get_keyboard(seat);
|
||||
wl_keyboard_add_listener(d->seat.keyboard, &keyboard_listener, data);
|
||||
- d->seat.key_repeat_fd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK);
|
||||
+ // d->seat.key_repeat_fd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK);
|
||||
} else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD)) {
|
||||
wl_keyboard_destroy(d->seat.keyboard);
|
||||
d->seat.keyboard = NULL;
|
||||
diff --color -ruwN source/src/egl/opengles2/es2gears.c source-new/src/egl/opengles2/es2gears.c
|
||||
--- source/src/egl/opengles2/es2gears.c 2023-03-22 19:13:43.000000000 +0700
|
||||
+++ source-new/src/egl/opengles2/es2gears.c 2026-06-12 06:16:40.759435351 +0700
|
||||
@@ -155,6 +155,13 @@
|
||||
gear->vertices = calloc(gear->nvertices, sizeof(*gear->vertices));
|
||||
v = gear->vertices;
|
||||
|
||||
+#ifndef sincos
|
||||
+#define sincos(x, s, c) do { \
|
||||
+ *(s) = sin(x); \
|
||||
+ *(c) = cos(x); \
|
||||
+} while(0)
|
||||
+#endif
|
||||
+
|
||||
for (i = 0; i < teeth; i++) {
|
||||
/* Calculate needed sin/cos for varius angles */
|
||||
sincos(i * 2.0 * M_PI / teeth, &s[0], &c[0]);
|
||||
diff --color -ruwN source/src/vulkan/wsi/wayland.c source-new/src/vulkan/wsi/wayland.c
|
||||
--- source/src/vulkan/wsi/wayland.c 2023-03-22 19:13:43.000000000 +0700
|
||||
+++ source-new/src/vulkan/wsi/wayland.c 2026-06-12 06:14:03.701669367 +0700
|
||||
@@ -35,7 +35,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <sys/mman.h>
|
||||
-#include <sys/timerfd.h>
|
||||
+// #include <sys/timerfd.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <wayland-util.h>
|
||||
@@ -131,22 +131,12 @@
|
||||
handle_key(uint key, enum wl_keyboard_key_state state)
|
||||
{
|
||||
xkb_keycode_t xkb_key = key + 8;
|
||||
- struct itimerspec timer = {0};
|
||||
if (keyboard_data.rate != 0 &&
|
||||
xkb_keymap_key_repeats(keyboard_data.xkb_keymap, xkb_key) &&
|
||||
state == WL_KEYBOARD_KEY_STATE_PRESSED) {
|
||||
keyboard_data.repeat_scancode = xkb_key;
|
||||
- if (keyboard_data.rate > 1) {
|
||||
- timer.it_interval.tv_nsec = 1000000000 / keyboard_data.rate;
|
||||
- } else {
|
||||
- timer.it_interval.tv_sec = 1;
|
||||
}
|
||||
|
||||
- timer.it_value.tv_sec = keyboard_data.delay / 1000;
|
||||
- timer.it_value.tv_nsec = (keyboard_data.delay % 1000) * 1000000;
|
||||
- }
|
||||
- timerfd_settime(keyboard_data.keyboard_timer_fd, 0, &timer, NULL);
|
||||
-
|
||||
dispatch_key(xkb_key, state);
|
||||
}
|
||||
|
||||
@@ -197,8 +187,6 @@
|
||||
leave(void *data, struct wl_keyboard *keyboard, uint serial,
|
||||
struct wl_surface *surface)
|
||||
{
|
||||
- struct itimerspec timer = {0};
|
||||
- timerfd_settime(keyboard_data.keyboard_timer_fd, 0, &timer, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -234,7 +222,7 @@
|
||||
wl_registry_destroy(registry);
|
||||
|
||||
keyboard_data.keyboard = wl_seat_get_keyboard(keyboard_data.seat);
|
||||
- keyboard_data.keyboard_timer_fd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK);
|
||||
+ // keyboard_data.keyboard_timer_fd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK);
|
||||
|
||||
wl_keyboard_add_listener(keyboard_data.keyboard, &keyboard_listener, NULL);
|
||||
|
||||
@ -1,6 +1,61 @@
|
||||
diff -ruwN libepoxy-1.5.10/src/dispatch_common.c source/src/dispatch_common.c
|
||||
--- libepoxy-1.5.10/src/dispatch_common.c 2022-02-17 05:56:12.000000000 -0700
|
||||
+++ source/src/dispatch_common.c 2025-05-04 17:57:31.910921783 -0600
|
||||
diff -ruwN source/registry/egl.xml source-new/registry/egl.xml
|
||||
--- source/registry/egl.xml 2022-02-17 19:56:12.000000000 +0700
|
||||
+++ source-new/registry/egl.xml 2026-06-11 22:13:16.770461177 +0700
|
||||
@@ -581,7 +581,9 @@
|
||||
<enum value="0x31D7" name="EGL_PLATFORM_GBM_MESA" alias="EGL_PLATFORM_GBM_KHR"/>
|
||||
<enum value="0x31D8" name="EGL_PLATFORM_WAYLAND_KHR"/>
|
||||
<enum value="0x31D8" name="EGL_PLATFORM_WAYLAND_EXT" alias="EGL_PLATFORM_WAYLAND_KHR"/>
|
||||
- <unused start="0x31D9" end="0x31DC"/>
|
||||
+ <enum value="0x31D9" name="EGL_PLATFORM_REDOX_KHR"/>
|
||||
+ <enum value="0x31D9" name="EGL_PLATFORM_REDOX_EXT" alias="EGL_PLATFORM_REDOX_KHR"/>
|
||||
+ <unused start="0x31DA" end="0x31DC"/>
|
||||
<enum value="0x31DD" name="EGL_PLATFORM_SURFACELESS_MESA"/>
|
||||
<unused start="0x31DE" end="0x31DF"/>
|
||||
</enums>
|
||||
@@ -2490,6 +2492,11 @@
|
||||
<enum name="EGL_PLATFORM_X11_SCREEN_EXT"/>
|
||||
</require>
|
||||
</extension>
|
||||
+ <extension name="EGL_EXT_platform_redox" supported="egl">
|
||||
+ <require>
|
||||
+ <enum name="EGL_PLATFORM_REDOX_EXT"/>
|
||||
+ </require>
|
||||
+ </extension>
|
||||
<extension name="EGL_EXT_protected_content" supported="egl">
|
||||
<require>
|
||||
<enum name="EGL_PROTECTED_CONTENT_EXT"/>
|
||||
@@ -2834,6 +2841,11 @@
|
||||
<enum name="EGL_PLATFORM_X11_SCREEN_KHR"/>
|
||||
</require>
|
||||
</extension>
|
||||
+ <extension name="EGL_KHR_platform_redox" supported="egl">
|
||||
+ <require>
|
||||
+ <enum name="EGL_PLATFORM_REDOX_KHR"/>
|
||||
+ </require>
|
||||
+ </extension>
|
||||
<extension name="EGL_KHR_reusable_sync" protect="KHRONOS_SUPPORT_INT64" supported="egl">
|
||||
<require>
|
||||
<enum name="EGL_SYNC_STATUS_KHR"/>
|
||||
@@ -3219,6 +3231,16 @@
|
||||
<enum name="EGL_TRIPLE_BUFFER_NV"/>
|
||||
</require>
|
||||
</extension>
|
||||
+ <extension name="EGL_REDOX_image_native_buffer" supported="egl">
|
||||
+ <require>
|
||||
+ <enum name="EGL_NATIVE_BUFFER_REDOX"/>
|
||||
+ </require>
|
||||
+ </extension>
|
||||
+ <extension name="EGL_REDOX_platform_screen" supported="egl">
|
||||
+ <require>
|
||||
+ <enum name="EGL_PLATFORM_SCREEN_REDOX"/>
|
||||
+ </require>
|
||||
+ </extension>
|
||||
<extension name="EGL_TIZEN_image_native_buffer" supported="egl">
|
||||
<require>
|
||||
<enum name="EGL_NATIVE_BUFFER_TIZEN"/>
|
||||
diff -ruwN source/src/dispatch_common.c source-new/src/dispatch_common.c
|
||||
--- source/src/dispatch_common.c 2022-02-17 19:56:12.000000000 +0700
|
||||
+++ source-new/src/dispatch_common.c 2026-06-11 23:46:49.992415192 +0700
|
||||
@@ -264,13 +264,7 @@
|
||||
long begin_count;
|
||||
};
|
||||
@ -16,3 +71,12 @@ diff -ruwN libepoxy-1.5.10/src/dispatch_common.c source/src/dispatch_common.c
|
||||
|
||||
static bool library_initialized;
|
||||
|
||||
@@ -810,7 +804,7 @@
|
||||
* use that.
|
||||
*/
|
||||
#if PLATFORM_HAS_GLX
|
||||
- if (api.glx_handle && glXGetCurrentContext())
|
||||
+ if (api.glx_handle && getenv("ORBITAL_DISPLAY") == NULL && glXGetCurrentContext())
|
||||
return epoxy_gl_dlsym(name);
|
||||
#endif
|
||||
|
||||
|
||||
@ -1,13 +1,20 @@
|
||||
#TODO need x11/wayland
|
||||
#TODO wayland only
|
||||
[source]
|
||||
tar = "https://github.com/freeglut/freeglut/releases/download/v3.4.0/freeglut-3.4.0.tar.gz"
|
||||
#blake3 = "08c8874d6ddad5be4860813865d4d4e2a84c294da0f3cf82a29e43920806b0da"
|
||||
blake3 = "e11ef6f8710c995ca200c0213a5fee2c8710d5cfd1284ec442c9c734dd3f98fb"
|
||||
[build]
|
||||
dependencies = [
|
||||
"mesa",
|
||||
"mesa-glu",
|
||||
"libwayland",
|
||||
"libxkbcommon",
|
||||
]
|
||||
template = "cmake"
|
||||
cmakeflags = [
|
||||
"-DFREEGLUT_GLES=0"
|
||||
"-DFREEGLUT_WAYLAND=1",
|
||||
"-DFREEGLUT_GLES=1",
|
||||
"-DFREEGLUT_BUILD_DEMOS=1"
|
||||
]
|
||||
|
||||
[package]
|
||||
description = "FreeGLUT (wayland only)"
|
||||
|
||||
@ -1,13 +1,17 @@
|
||||
#TODO not compiled or tested
|
||||
# build instructions: https://gitlab.freedesktop.org/libdecor/libdecor#build--install
|
||||
#TODO compiled but not tested
|
||||
[source]
|
||||
tar = "https://gitlab.freedesktop.org/libdecor/libdecor/-/releases/0.2.5/downloads/libdecor-0.2.5.tar.xz"
|
||||
blake3 = "83c2f4cf6b6abf654499ba6cb138eb1c044229f90b6b96207776d18de2031654"
|
||||
patches = [ "redox.patch" ]
|
||||
[build]
|
||||
template = "meson"
|
||||
mesonflags = [
|
||||
"-Ddbus=disabled"
|
||||
"-Ddbus=disabled",
|
||||
"-Ddemo=false",
|
||||
]
|
||||
dependencies = [
|
||||
"pango",
|
||||
"libwayland",
|
||||
"wayland-protocols",
|
||||
"gtk3",
|
||||
]
|
||||
|
||||
48
recipes/wip/libs/other/libdecor/redox.patch
Normal file
48
recipes/wip/libs/other/libdecor/redox.patch
Normal file
@ -0,0 +1,48 @@
|
||||
diff --color -ruwN source/demo/meson.build source-new/demo/meson.build
|
||||
--- source/demo/meson.build 2025-12-16 16:21:49.000000000 +0700
|
||||
+++ source-new/demo/meson.build 2026-06-12 06:10:07.177986398 +0700
|
||||
@@ -5,7 +5,7 @@
|
||||
math_dep = cc.find_library('m')
|
||||
|
||||
egl_dep = dependency('egl')
|
||||
-gl_dep = dependency('opengl')
|
||||
+gl_dep = dependency('opengl', required: false)
|
||||
wayland_egl_dep = dependency('wayland-egl')
|
||||
|
||||
xkb_dep = dependency('xkbcommon')
|
||||
diff --color -ruwN source/src/plugins/cairo/libdecor-cairo.c source-new/src/plugins/cairo/libdecor-cairo.c
|
||||
--- source/src/plugins/cairo/libdecor-cairo.c 2025-12-16 16:21:49.000000000 +0700
|
||||
+++ source-new/src/plugins/cairo/libdecor-cairo.c 2026-06-14 15:04:29.759947146 +0700
|
||||
@@ -26,7 +26,14 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
+#ifdef __linux__
|
||||
#include <linux/input.h>
|
||||
+#else
|
||||
+// https://github.com/torvalds/linux/blob/master/include/uapi/linux/input-event-codes.h
|
||||
+#define BTN_LEFT 0x110
|
||||
+#define BTN_RIGHT 0x111
|
||||
+#define BTN_MIDDLE 0x112
|
||||
+#endif
|
||||
#include <fcntl.h>
|
||||
#include <poll.h>
|
||||
#include <string.h>
|
||||
diff --color -ruwN source/src/plugins/gtk/libdecor-gtk.c source-new/src/plugins/gtk/libdecor-gtk.c
|
||||
--- source/src/plugins/gtk/libdecor-gtk.c 2025-12-16 16:21:49.000000000 +0700
|
||||
+++ source-new/src/plugins/gtk/libdecor-gtk.c 2026-06-14 15:05:18.818276809 +0700
|
||||
@@ -26,7 +26,14 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
+#ifdef __linux__
|
||||
#include <linux/input.h>
|
||||
+#else
|
||||
+// https://github.com/torvalds/linux/blob/master/include/uapi/linux/input-event-codes.h
|
||||
+#define BTN_LEFT 0x110
|
||||
+#define BTN_RIGHT 0x111
|
||||
+#define BTN_MIDDLE 0x112
|
||||
+#endif
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
@ -1,7 +1,5 @@
|
||||
[source]
|
||||
tar = "https://archive.mesa3d.org/demos/mesa-demos-9.0.0.tar.xz"
|
||||
blake3 = "eef628aebdaa65d3bb1078bb6d6bdd7685c41fb67674e7f7b0e1e15f10433240"
|
||||
patches = ["redox.patch"]
|
||||
same_as = "../../demos/mesa-demos"
|
||||
|
||||
[build]
|
||||
dependencies = [
|
||||
@ -10,10 +8,4 @@ dependencies = [
|
||||
dev-dependencies = [
|
||||
"libstdcxx",
|
||||
]
|
||||
|
||||
template = "custom"
|
||||
script = """
|
||||
DYNAMIC_INIT
|
||||
#TODO: implement sincos for es2gears
|
||||
cookbook_meson -Dgles2=disabled
|
||||
"""
|
||||
template = "meson"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
diff -ruwN mesa-demos-9.0.0/meson.build source/meson.build
|
||||
--- mesa-demos-9.0.0/meson.build 2023-03-22 06:13:43.000000000 -0600
|
||||
+++ source/meson.build 2025-05-06 15:58:57.523274337 -0600
|
||||
diff --color -ruwN source/meson.build source-new/meson.build
|
||||
--- source/meson.build 2023-03-22 19:13:43.000000000 +0700
|
||||
+++ source-new/meson.build 2026-06-14 14:55:40.778818599 +0700
|
||||
@@ -99,7 +99,7 @@
|
||||
endif
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user