Hello ports@, Please find attached a patch to update games/godot from 3.2.3 to the latest 3.3. You can find the release notes here[0] and the full changelog here[1].
One important change is the new atomics and thread API. The sndio audio driver was updated to reflect this and the patch to safe_refcount dropped (see upstream commit[2].) I've used this for the last 3-4 days and haven't noticed regressions on amd64 w/ amdgpu and I've got one positve report from amd64 w/ inteldrm. OKs, comments and tests on other arches are welcome :) Cheers, Omar Polo [0]: https://godotengine.org/article/godot-3-3-has-arrived [1]: https://downloads.tuxfamily.org/godotengine/3.3/Godot_v3.3-stable_changelog_authors.txt [2]: https://github.com/godotengine/godot/commit/4485b43a57d13c64dc8ebc195c247dd6d0bbd0c9#diff-6e7be81e8deddca9a6bb8cf69f773119e96b3d3859a4207a8b395188e945ba2e Index: Makefile =================================================================== RCS file: /home/cvs/ports/games/godot/Makefile,v retrieving revision 1.17 diff -u -p -r1.17 Makefile --- Makefile 15 Nov 2020 22:05:10 -0000 1.17 +++ Makefile 22 Apr 2021 11:03:09 -0000 @@ -2,10 +2,9 @@ COMMENT = 2D and 3D game engine -V = 3.2.3 +V = 3.3 DISTNAME = godot-${V}-stable PKGNAME = godot-${V} -REVISION = 0 CATEGORIES = games HOMEPAGE = https://godotengine.org/ MAINTAINER = Omar Polo <o...@omarpolo.com> Index: distinfo =================================================================== RCS file: /home/cvs/ports/games/godot/distinfo,v retrieving revision 1.5 diff -u -p -r1.5 distinfo --- distinfo 19 Sep 2020 06:37:23 -0000 1.5 +++ distinfo 22 Apr 2021 09:10:04 -0000 @@ -1,2 +1,2 @@ -SHA256 (godot-3.2.3-stable.tar.xz) = hf1z10LMZIhwVqIy+PemIhEueLUfMdTQjbD5guXzoCM= -SIZE (godot-3.2.3-stable.tar.xz) = 14360332 +SHA256 (godot-3.3-stable.tar.xz) = /LvGqqsWBZ5mIkgsM1jVgJjTTtUeCZyFTsCtefRm1VU= +SIZE (godot-3.3-stable.tar.xz) = 20581028 Index: files/sndio/audio_driver_sndio.cpp =================================================================== RCS file: /home/cvs/ports/games/godot/files/sndio/audio_driver_sndio.cpp,v retrieving revision 1.1 diff -u -p -r1.1 audio_driver_sndio.cpp --- files/sndio/audio_driver_sndio.cpp 6 Sep 2020 10:34:19 -0000 1.1 +++ files/sndio/audio_driver_sndio.cpp 22 Apr 2021 10:12:46 -0000 @@ -70,8 +70,7 @@ Error AudioDriverSndio::init() { samples.resize(period_size * channels); - mutex = Mutex::create(); - thread = Thread::create(AudioDriverSndio::thread_func, this); + thread.start(AudioDriverSndio::thread_func, this); return OK; } @@ -116,30 +115,16 @@ AudioDriver::SpeakerMode AudioDriverSndi } void AudioDriverSndio::lock() { - if (!thread || !mutex) - return; - mutex->lock(); + mutex.lock(); } void AudioDriverSndio::unlock() { - if (!thread || !mutex) - return; - mutex->unlock(); + mutex.unlock(); } void AudioDriverSndio::finish() { - if (thread) { - exit_thread = true; - Thread::wait_to_finish(thread); - - memdelete(thread); - thread = NULL; - } - - if (mutex) { - memdelete(mutex); - mutex = NULL; - } + exit_thread = true; + thread.wait_to_finish(); if (handle) { sio_close(handle); @@ -148,8 +133,6 @@ void AudioDriverSndio::finish() { } AudioDriverSndio::AudioDriverSndio() { - mutex = NULL; - thread = NULL; } AudioDriverSndio::~AudioDriverSndio() { Index: files/sndio/audio_driver_sndio.h =================================================================== RCS file: /home/cvs/ports/games/godot/files/sndio/audio_driver_sndio.h,v retrieving revision 1.1 diff -u -p -r1.1 audio_driver_sndio.h --- files/sndio/audio_driver_sndio.h 6 Sep 2020 10:34:19 -0000 1.1 +++ files/sndio/audio_driver_sndio.h 22 Apr 2021 10:12:46 -0000 @@ -34,8 +34,8 @@ #include <sndio.h> class AudioDriverSndio : public AudioDriver { - Thread *thread; - Mutex *mutex; + Thread thread; + Mutex mutex; Vector<int32_t> samples; Index: patches/patch-core_project_settings_cpp =================================================================== RCS file: /home/cvs/ports/games/godot/patches/patch-core_project_settings_cpp,v retrieving revision 1.4 diff -u -p -r1.4 patch-core_project_settings_cpp --- patches/patch-core_project_settings_cpp 19 Sep 2020 06:37:23 -0000 1.4 +++ patches/patch-core_project_settings_cpp 22 Apr 2021 09:25:38 -0000 @@ -19,7 +19,7 @@ Index: core/project_settings.cpp Compression::zlib_level = GLOBAL_GET("compression/formats/zlib/compression_level"); -@@ -1210,12 +1208,8 @@ ProjectSettings::ProjectSettings() { +@@ -1233,12 +1231,8 @@ ProjectSettings::ProjectSettings() { GLOBAL_DEF("debug/settings/profiler/max_functions", 16384); custom_prop_info["debug/settings/profiler/max_functions"] = PropertyInfo(Variant::INT, "debug/settings/profiler/max_functions", PROPERTY_HINT_RANGE, "128,65535,1"); Index: patches/patch-core_safe_refcount_h =================================================================== RCS file: patches/patch-core_safe_refcount_h diff -N patches/patch-core_safe_refcount_h --- patches/patch-core_safe_refcount_h 19 Jul 2020 13:02:38 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,76 +0,0 @@ -$OpenBSD: patch-core_safe_refcount_h,v 1.2 2020/07/19 13:02:38 thfr Exp $ - -hppa, ppc: use __atomic functions as 64-bit __sync operators -are not supported, from: -https://github.com/godotengine/godot/pull/31321 - -Index: core/safe_refcount.h ---- core/safe_refcount.h.orig -+++ core/safe_refcount.h -@@ -55,33 +55,26 @@ static _ALWAYS_INLINE_ T atomic_conditional_increment( - template <class T> - static _ALWAYS_INLINE_ T atomic_decrement(volatile T *pw) { - -- (*pw)--; -- -- return *pw; -+ return __atomic_sub_fetch(pw, 1, __ATOMIC_SEQ_CST); - } - - template <class T> - static _ALWAYS_INLINE_ T atomic_increment(volatile T *pw) { - -- (*pw)++; -- -- return *pw; -+ return __atomic_add_fetch(pw, 1, __ATOMIC_SEQ_CST); - } - - template <class T, class V> - static _ALWAYS_INLINE_ T atomic_sub(volatile T *pw, volatile V val) { - -- (*pw) -= val; - -- return *pw; -+ return __atomic_sub_fetch(pw, val, __ATOMIC_SEQ_CST); - } - - template <class T, class V> - static _ALWAYS_INLINE_ T atomic_add(volatile T *pw, volatile V val) { - -- (*pw) += val; -- -- return *pw; -+ return __atomic_add_fetch(pw, val, __ATOMIC_SEQ_CST); - } - - template <class T, class V> -@@ -97,8 +90,8 @@ static _ALWAYS_INLINE_ T atomic_exchange_if_greater(vo - - /* Implementation for GCC & Clang */ - --// GCC guarantees atomic intrinsics for sizes of 1, 2, 4 and 8 bytes. --// Clang states it supports GCC atomic builtins. -+#include <stdbool.h> -+#include <atomic> - - template <class T> - static _ALWAYS_INLINE_ T atomic_conditional_increment(volatile T *pw) { -@@ -107,7 +100,7 @@ static _ALWAYS_INLINE_ T atomic_conditional_increment( - T tmp = static_cast<T const volatile &>(*pw); - if (tmp == 0) - return 0; // if zero, can't add to it anymore -- if (__sync_val_compare_and_swap(pw, tmp, tmp + 1) == tmp) -+ if (__atomic_compare_exchange_n(pw, &tmp, tmp + 1, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST) == true) - return tmp + 1; - } - } -@@ -143,7 +136,7 @@ static _ALWAYS_INLINE_ T atomic_exchange_if_greater(vo - T tmp = static_cast<T const volatile &>(*pw); - if (tmp >= val) - return tmp; // already greater, or equal -- if (__sync_val_compare_and_swap(pw, tmp, val) == tmp) -+ if (__atomic_compare_exchange_n(pw, &tmp, val, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST) == true) - return val; - } - } Index: patches/patch-drivers_unix_os_unix_cpp =================================================================== RCS file: /home/cvs/ports/games/godot/patches/patch-drivers_unix_os_unix_cpp,v retrieving revision 1.5 diff -u -p -r1.5 patch-drivers_unix_os_unix_cpp --- patches/patch-drivers_unix_os_unix_cpp 19 Sep 2020 06:37:23 -0000 1.5 +++ patches/patch-drivers_unix_os_unix_cpp 22 Apr 2021 09:25:38 -0000 @@ -5,8 +5,8 @@ hardcode executable path Index: drivers/unix/os_unix.cpp --- drivers/unix/os_unix.cpp.orig +++ drivers/unix/os_unix.cpp -@@ -512,7 +512,7 @@ String OS_Unix::get_executable_path() const { - #elif defined(__OpenBSD__) +@@ -501,7 +501,7 @@ String OS_Unix::get_executable_path() const { + #elif defined(__OpenBSD__) || defined(__NetBSD__) char resolved_path[MAXPATHLEN]; - realpath(OS::get_executable_path().utf8().get_data(), resolved_path); Index: patches/patch-platform_x11_detect_py =================================================================== RCS file: /home/cvs/ports/games/godot/patches/patch-platform_x11_detect_py,v retrieving revision 1.3 diff -u -p -r1.3 patch-platform_x11_detect_py --- patches/patch-platform_x11_detect_py 6 Sep 2020 10:34:19 -0000 1.3 +++ patches/patch-platform_x11_detect_py 22 Apr 2021 09:28:07 -0000 @@ -5,30 +5,36 @@ remove hardcoded -O2, found by bcallah@. Index: platform/x11/detect.py --- platform/x11/detect.py.orig +++ platform/x11/detect.py -@@ -85,21 +85,12 @@ def configure(env): +@@ -87,26 +87,9 @@ def get_flags(): + def configure(env): ## Build type - if env["target"] == "release": +- if env["target"] == "release": - if env["optimize"] == "speed": # optimize for speed (default) - env.Prepend(CCFLAGS=["-O3"]) -- else: # optimize for size +- elif env["optimize"] == "size": # optimize for size - env.Prepend(CCFLAGS=["-Os"]) - - if env["debug_symbols"] == "yes": - env.Prepend(CCFLAGS=["-g1"]) - if env["debug_symbols"] == "full": - env.Prepend(CCFLAGS=["-g2"]) - - elif env["target"] == "release_debug": +- if env["debug_symbols"]: +- env.Prepend(CCFLAGS=["-g2"]) +- +- elif env["target"] == "release_debug": - if env["optimize"] == "speed": # optimize for speed (default) - env.Prepend(CCFLAGS=["-O2"]) -- else: # optimize for size +- elif env["optimize"] == "size": # optimize for size - env.Prepend(CCFLAGS=["-Os"]) +- ++ if env["target"] == "release_debug": env.Prepend(CPPDEFINES=["DEBUG_ENABLED"]) - if env["debug_symbols"] == "yes": -@@ -302,6 +293,10 @@ def configure(env): - env.ParseConfig("pkg-config alsa --libs") +- if env["debug_symbols"]: +- env.Prepend(CCFLAGS=["-g2"]) +- + elif env["target"] == "debug": + env.Prepend(CCFLAGS=["-ggdb"]) + env.Prepend(CCFLAGS=["-g3"]) +@@ -318,6 +301,10 @@ def configure(env): + env.Append(CPPDEFINES=["ALSA_ENABLED", "ALSAMIDI_ENABLED"]) else: print("ALSA libraries not found, disabling driver") + Index: patches/patch-platform_x11_os_x11_cpp =================================================================== RCS file: /home/cvs/ports/games/godot/patches/patch-platform_x11_os_x11_cpp,v retrieving revision 1.4 diff -u -p -r1.4 patch-platform_x11_os_x11_cpp --- patches/patch-platform_x11_os_x11_cpp 19 Sep 2020 06:37:23 -0000 1.4 +++ patches/patch-platform_x11_os_x11_cpp 22 Apr 2021 09:25:38 -0000 @@ -5,7 +5,7 @@ fix libXrandr library name and load sndi Index: platform/x11/os_x11.cpp --- platform/x11/os_x11.cpp.orig +++ platform/x11/os_x11.cpp -@@ -160,10 +160,10 @@ Error OS_X11::initialize(const VideoMode &p_desired, i +@@ -160,7 +160,7 @@ Error OS_X11::initialize(const VideoMode &p_desired, i int xrandr_minor = 0; int event_base, error_base; xrandr_ext_ok = XRRQueryExtension(x11_display, &event_base, &error_base); @@ -13,12 +13,8 @@ Index: platform/x11/os_x11.cpp + xrandr_handle = dlopen("libXrandr.so", RTLD_LAZY); if (!xrandr_handle) { err = dlerror(); -- fprintf(stderr, "could not load libXrandr.so.2, Error: %s\n", err); -+ fprintf(stderr, "could not load libXrandr.so, Error: %s\n", err); - } else { - XRRQueryVersion(x11_display, &xrandr_major, &xrandr_minor); - if (((xrandr_major << 8) | xrandr_minor) >= 0x0105) { -@@ -3564,6 +3564,10 @@ void OS_X11::update_real_mouse_position() { + // For some arcane reason, NetBSD now ships libXrandr.so.3 while the rest of the world has libXrandr.so.2... +@@ -3972,6 +3972,10 @@ void OS_X11::update_real_mouse_position() { } OS_X11::OS_X11() { Index: patches/patch-platform_x11_os_x11_h =================================================================== RCS file: /home/cvs/ports/games/godot/patches/patch-platform_x11_os_x11_h,v retrieving revision 1.2 diff -u -p -r1.2 patch-platform_x11_os_x11_h --- patches/patch-platform_x11_os_x11_h 19 Sep 2020 06:37:23 -0000 1.2 +++ patches/patch-platform_x11_os_x11_h 22 Apr 2021 09:25:38 -0000 @@ -5,7 +5,7 @@ load sndio Index: platform/x11/os_x11.h --- platform/x11/os_x11.h.orig +++ platform/x11/os_x11.h -@@ -36,6 +36,7 @@ +@@ -37,6 +37,7 @@ #include "crash_handler_x11.h" #include "drivers/alsa/audio_driver_alsa.h" #include "drivers/alsamidi/midi_driver_alsamidi.h" @@ -13,7 +13,7 @@ Index: platform/x11/os_x11.h #include "drivers/pulseaudio/audio_driver_pulseaudio.h" #include "drivers/unix/os_unix.h" #include "joypad_linux.h" -@@ -184,6 +185,10 @@ class OS_X11 : public OS_Unix { +@@ -206,6 +207,10 @@ class OS_X11 : public OS_Unix { #ifdef ALSAMIDI_ENABLED MIDIDriverALSAMidi driver_alsamidi;