summaryrefslogtreecommitdiff
path: root/platform/linuxbsd
AgeCommit message (Collapse)Author
2021-02-23Allow static linking with libatomic using clangHein-Pieter van Braam-Stewart
When using use_static_cpp we want to statically link with atomic as well to make sure we don't incur any new runtime dependencies. Scons doesn't quite support this so we do this little trick.
2021-02-20Merge pull request #46256 from hpvb/dri-prime-amd-masterHein-Pieter van Braam
Add 'AMD' GPU vendor name to PRIME detector
2021-02-20Add 'AMD' GPU vendor name to PRIME detectorHein-Pieter van Braam-Stewart
Apparently some recent Mesa version also changed AMD's vendor string. In addition I found a small uninitialized variable that's corrected now.
2021-02-20Use -latomic when linking whe using clang on LinuxHein-Pieter van Braam-Stewart
According to the LLVM documentation when using GNU's libstdc++ clang will not automatically link with -latomic. This is necessary since we merged c++11 atomics support. This fixes linking using Clang on Linux
2021-02-20An update to the dylibloader for older inttypesHein-Pieter van Braam-Stewart
This #define's older inttypes to their newer versions and #includes <stdint.h> in the generated files. This will help with older glibc/compiler versions using headers generated on newer systems. This closes #46223
2021-02-18Modernize atomicsPedro J. Estébanez
- Based on C++11's `atomic` - Reworked `SafeRefCount` (based on the rewrite by @hpvb) - Replaced free atomic functions by the new `SafeNumeric<T>` - Replaced wrong cases of `volatile bool` by the new `SafeFlag` - Platform-specific implementations no longer needed Co-authored-by: Hein-Pieter van Braam-Stewart <hp@tmm.cx>
2021-02-18Linux: Fix fallback logic when udev fails creating a contextRémi Verschelde
Thanks to Noshyaar for pointing out the bug.
2021-02-18Don't clobber original library symbolsHein-Pieter van Braam-Stewart
It appears that we can get a fun circle dependency on a shared object on some system configurations causing issues with our 'fake' function pointer names. This can lead to a crash. The new wrapper generator renames all the symbols so this can't happen anymore. See https://github.com/hpvb/dynload-wrapper/commit/704135e This closes #46140
2021-02-17Dynamically load libudev.so.1 on Linux if `udev=yes`Rémi Verschelde
This makes it possibly to run Linux binaries compiled with udev support on Linux systems which do not provide udev (typically systemd-less distros). If udev is missing, we fall back to parsing `/dev/input` like when compiled without udev support (`udev=no`). Also adding some verbose debug statements to know which method we're using when debugging Linux joypad issues. The libudev so wrappers were generated on Mageia 8 with libudev 246.9 using https://github.com/hpvb/dynload-wrapper: ``` ./generate-wrapper.py --include /usr/include/libudev.h --sys-include '<libudev.h>' \ --soname libudev.so.1 --init-name libudev --omit-prefix gnu_ \ --output-header libudev-so_wrap.h --output-implementation libudev-so_wrap.c ```
2021-02-16Dynamically load libpulse.so.0 and libasound.so.1 on LinuxHein-Pieter van Braam-Stewart
By generating stubs using https://github.com/hpvb/dynload-wrapper we can dynamically load libpulse and libasound on systems where it is available. Both are still a build-time requirement but no longer a run-time dependency. For maintenance purposes the wrappers should not need to be re-generated unless we want to bump pulse or asound to an incompatible version. It is unlikely we will want to do this any time soon. This closes #20978
2021-02-08SCons: Fix debug_symbols tests after switch to BoolVariableRémi Verschelde
Bug introduced in #45679. Fixes part of #45816.
2021-02-03SCons: Add `production=yes` option to use production defaultsRémi Verschelde
This is meant for users making custom builds to match the options used on optimized, official builds. This enables, on the platforms which support them: - `use_static_cpp=yes` (portable binaries for Linux and Windows) - `use_lto=yes` (link time optimizations - note: requires a lot of RAM!) - `debug_symbols=no` (no debug symbols, smaller binaries) Also abort when using MSVC with `production=yes`, as: - It cannot optimize the GDScript VM like GCC or Clang do, leading to significant performance drops. - Its LTO support is unreliable, at least used to trigger crashes last we tried it extensively. All options can still be overridden if specified, and the `dev=yes` option was changed to also support overrides.
2021-02-01Merge pull request #45630 from akien-mga/linux-enable-udevRémi Verschelde
Linux: Enable udev support by default
2021-02-01Linux: Build with use_static_cpp=yes by default for x86_64Rémi Verschelde
This enables `-static-libgcc -static-libstdc++` which help make custom Linux builds more portable (official builds have been using this option for years). For some obscure reason Ubuntu 18.04 i386 crashes when using the option for i386 builds, so let's play it safe and enable for x86_64 only for now.
2021-02-01Linux: Enable udev support by defaultRémi Verschelde
This has been enabled for years in official binaries, and users making custom builds may end up not enabling it unknowingly, so it's best if we default to the same as what official builds do. The original reason for having it opt-in was likely the addition of a dependency on libudev, but that should be fairly ubiquitous by now.
2021-01-31Merge pull request #45315 from RandomShaper/modernize_threadRémi Verschelde
Modernize Thread
2021-01-29Modernize ThreadPedro J. Estébanez
- Based on C++11's `thread` and `thread_local` - No more need to allocate-deallocate or check for null - No pointer anymore, just a member variable - Platform-specific implementations no longer needed (except for the few cases of non-portable functions) - Simpler for `NO_THREADS` - Thread ids are now the same across platforms (main is 1; others follow)
2021-01-28Unify URI encoding/decoding and add to C#Aaron Franke
http_escape and percent_encode have been unified into uri_encode, and http_unescape and percent_decode have been unified into uri_decode.
2021-01-27Go through all event devices, not just event[0-32]Jari Ronkainen
There are no guarantees that joypads are in event0-event32 range. Some devices, such as laptops with detachable keyboards and wacom can reserve events all the way up to 32. Some udev rules with e.g. custom controller firmwares may load the device as /dev/input/eventX, where X is greater than 32. This patch uses POSIX dirent to enumerate the event devices, so entries outside 0-32 range are not skipped.
2021-01-09Split OS::execute into two methodsMarcel Admiraal
1. execute(): Executes a command and returns the results. 2. create_process(): Creates a new process and returns the new process' id.
2021-01-01Update copyright statements to 2021Rémi Verschelde
Happy new year to the wonderful Godot community! 2020 has been a tough year for most of us personally, but a good year for Godot development nonetheless with a huge amount of work done towards Godot 4.0 and great improvements backported to the long-lived 3.2 branch. We've had close to 400 contributors to engine code this year, authoring near 7,000 commit! (And that's only for the `master` branch and for the engine code, there's a lot more when counting docs, demos and other first-party repos.) Here's to a great year 2021 for all Godot users 🎆
2020-12-28Merge pull request #44593 from madmiraal/rename-mainloop-methodsRémi Verschelde
Rename MainLoop methods to match Node methods
2020-12-28Rename empty() to is_empty()Marcel Admiraal
2020-12-22Rename MainLoop methods to match Node methodsMarcel Admiraal
2020-12-17Add override keywords to core/os.h derived classes.Marcel Admiraal
2020-12-16SCons: Add only selected platform's opts to envRémi Verschelde
Otherwise we can get situations where platform-specific opts with the same name can override each other depending on the order at which platforms are parsed, as was the case with `use_static_cpp` in Linux/Windows. Fixes #44304. This also has the added benefit that the `scons --help` output will now only include the options which are relevant for the selected (or detected) platform.
2020-12-16Fix named anonymous struct warningMarcel Admiraal
2020-12-08Merge pull request #43742 from qarmin/editor_modules_default_valuesRémi Verschelde
Initialize class/struct variables with default values in platform/ and editor/
2020-12-07Merge pull request #44021 from dakennedyd/personalRémi Verschelde
Fix implementation of move_to_trash() on Linux
2020-12-07Fixes move_to_trash() on LinuxDavid Kennedy
Fixes #42840 OS move_to_trash() on Linux is not compliant with the Freedesktop specification
2020-12-04RenderingServer reorganizationreduz
2020-12-03Reorganize rendering server.reduz
-Made RenderingServerScene abstract, allowing reimplementation -RenderingServerRaster -> RenderingServerDefault, but this class is going away soon.
2020-12-02Initialize class/struct variables with default values in platform/ and editor/Rafał Mikrut
2020-12-02X11: Include limits.h for LONG_MAXRémi Verschelde
Fixes #44030.
2020-11-28Merge pull request #41100 from bruvzg/ctl_text_server_interfaceRémi Verschelde
[Complex Text Layouts] Implement TextServer interface.
2020-11-27Implement INCR mechanism for Linux clipboardPouleyKetchoupp
Allows pasting from x11 clipboard to receive data incrementally, which is required when handling data size > 256KB.
2020-11-26[Complex Text Layouts] Add third-party TextServer dependencies (ICU, ↵bruvzg
HarfBuzz, Graphite).
2020-11-26Merge pull request #42652 from nekomatata/x11-clipboard-save-targetsRémi Verschelde
Implement SAVE_TARGETS mechanism for Linux clipboard
2020-11-25SCons: Do not define TYPED_METHOD_BIND on Linux/clangRémi Verschelde
It's now only needed for MSVC.
2020-11-19SCons: Remove unnecessary $LINK overridesRémi Verschelde
As of SCons 4.0.1, the default value for $LINK is $SMARTLINK, which itself is a function that will use $CXX as linker for C++: https://github.com/SCons/scons/blob/4.0.1/SCons/Tool/link.py#L327-L328 https://github.com/SCons/scons/blob/4.0.1/SCons/Tool/link.py#L54-L76 So we don't need to manually specify the same value as $CXX for $LINK.
2020-11-16Remove empty lines around braces with the formatting scriptAaron Franke
2020-11-16Merge pull request #43461 from ccl2of4/fix-linux-joypad-dpad-zeroingRémi Verschelde
Fix for linux joypad D-pad zeroing
2020-11-15Add XChangeProperty Atoms validity checks.bruvzg
2020-11-14Fixes crash if Vulkan presentation surface is not available.bruvzg
2020-11-12Add X11 Atom validity checks.bruvzg
2020-11-11Fix for linux joypad D-pad zeroingConnor Lirot
Some controllers (notably those made by 8bitdo) do not always emit an event to zero out a D-pad axis before flipping direction. For example, when rolling around aggressively the D-pad of an 8bitdo SN30 Pro/Pro+, the following may be observed: ``` ABS_HAT0X : -1 ABS_HAT0Y : -1 ABS_HAT0Y : 0 ABS_HAT0Y : 1 ABS_HAT0X : 1 ``` Notable here is that no event for `ABS_HAT0X: 0` is emitted between the events for `ABS_HAT0X: -1` and `ABS_HAT0X: 1`. Consequently, the game engine believes that both the negative _and_ positive x-axis directions of the D-pad are activated simultaneously (i.e `is_joy_button_pressed()` returns `true` for both `JOY_BUTTON_DPAD_LEFT` and `JOY_BUTTON_DPAD_RIGHT`), which should be impossible. This issue is _not_ reproducible on all controllers. The Xbox One controller in particular will not exhibit this problem (it always emits zeroing out events for an axis before flipping direction). The fix is to always zero out the opposite direction on the D-pad axis in question when processing an event with a nonzero value. This unfortunately wastes a small number of CPU cycles on controllers that behave nicely. **I have verified this issue is also reproducible in the stable 3.2 branch**
2020-11-09Remove `debug_symbols=full` in favor of `debug_symbols=yes`Hugo Locurcio
`debug_symbols=yes` will now behave like `debug_symbols=full` did before. The difference in compressed file sizes is not that large, which means there isn't much point in having two different values. This helps make the buildsystem easier to understand.
2020-11-07Reorganized core/ directory, it was too fatty alreadyreduz
-Removed FuncRef, since Callable makes it obsolete -Removed int_types.h as its obsolete in c++11+ -Changed color names code
2020-10-26Changed shell_open behaviourEv1lbl0w
2020-10-09Implement SAVE_TARGETS mechanism for Linux clipboardPouleyKetchoupp
Allows sending the clipboard content to the clipboard manager on exit to keep the content when using a clipboard manager that doesn't automatically makes a backup when copying. MULTIPLE selection mechanism also had to be implemented, because in this case, the clipboard manager might request multiple selection targets at once. Known use case: Ubuntu with XFCE4