diff --git a/config/wayland.toml b/config/wayland.toml index 1bf8d306..01f11be7 100644 --- a/config/wayland.toml +++ b/config/wayland.toml @@ -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 diff --git a/config/x86_64/ci.toml b/config/x86_64/ci.toml index e105214f..c31ae395 100644 --- a/config/x86_64/ci.toml +++ b/config/x86_64/ci.toml @@ -158,6 +158,7 @@ lz4 = {} mednafen = {} mesa = {} mesa-glu = {} +mesa-demos = {} mesa-demos-x11 = {} mgba = {} miniserve = {} diff --git a/recipes/libs/mesa/recipe.toml b/recipes/libs/mesa/recipe.toml index 6d23ee12..13768b8b 100644 --- a/recipes/libs/mesa/recipe.toml +++ b/recipes/libs/mesa/recipe.toml @@ -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" diff --git a/recipes/wip/demos/mesa-demos/recipe.toml b/recipes/wip/demos/mesa-demos/recipe.toml index f5577ef3..ae75b866 100644 --- a/recipes/wip/demos/mesa-demos/recipe.toml +++ b/recipes/wip/demos/mesa-demos/recipe.toml @@ -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)" diff --git a/recipes/wip/demos/mesa-demos/redox.patch b/recipes/wip/demos/mesa-demos/redox.patch new file mode 100644 index 00000000..f998f653 --- /dev/null +++ b/recipes/wip/demos/mesa-demos/redox.patch @@ -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 + #include + #include +-#include ++// #include + #include + #include + +@@ -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 + + #include +-#include ++// #include + #include + + #include +@@ -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); + diff --git a/recipes/wip/libs/gnome/libepoxy/redox.patch b/recipes/wip/libs/gnome/libepoxy/redox.patch index 58a5f96b..cbb6eb21 100644 --- a/recipes/wip/libs/gnome/libepoxy/redox.patch +++ b/recipes/wip/libs/gnome/libepoxy/redox.patch @@ -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 @@ + + + +- ++ ++ ++ + + + +@@ -2490,6 +2492,11 @@ + + + ++ ++ ++ ++ ++ + + + +@@ -2834,6 +2841,11 @@ + + + ++ ++ ++ ++ ++ + + + +@@ -3219,6 +3231,16 @@ + + + ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + + + +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 + diff --git a/recipes/wip/libs/other/freeglut/recipe.toml b/recipes/wip/libs/other/freeglut/recipe.toml index 970c9328..db6dff56 100644 --- a/recipes/wip/libs/other/freeglut/recipe.toml +++ b/recipes/wip/libs/other/freeglut/recipe.toml @@ -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)" diff --git a/recipes/wip/libs/other/libdecor/recipe.toml b/recipes/wip/libs/other/libdecor/recipe.toml index 027588b6..50bb1ce7 100644 --- a/recipes/wip/libs/other/libdecor/recipe.toml +++ b/recipes/wip/libs/other/libdecor/recipe.toml @@ -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", ] diff --git a/recipes/wip/libs/other/libdecor/redox.patch b/recipes/wip/libs/other/libdecor/redox.patch new file mode 100644 index 00000000..74d4ba7c --- /dev/null +++ b/recipes/wip/libs/other/libdecor/redox.patch @@ -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 ++#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 + #include + #include +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 ++#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 + #include + #include diff --git a/recipes/wip/x11/mesa-demos-x11/recipe.toml b/recipes/wip/x11/mesa-demos-x11/recipe.toml index f7b049ae..42115c79 100644 --- a/recipes/wip/x11/mesa-demos-x11/recipe.toml +++ b/recipes/wip/x11/mesa-demos-x11/recipe.toml @@ -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" diff --git a/recipes/wip/x11/mesa-demos-x11/redox.patch b/recipes/wip/x11/mesa-demos-x11/redox.patch index 62b33512..5e882178 100644 --- a/recipes/wip/x11/mesa-demos-x11/redox.patch +++ b/recipes/wip/x11/mesa-demos-x11/redox.patch @@ -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