asyncio: Added Linux io_uring support.

This commit is contained in:
Ryan C. Gordon
2024-10-01 01:43:34 -04:00
parent e79ce2a200
commit 022a6a9f97
5 changed files with 540 additions and 1 deletions
+15
View File
@@ -286,6 +286,7 @@ set_option(SDL_SYSTEM_ICONV "Use iconv() from system-installed libraries"
set_option(SDL_LIBICONV "Prefer iconv() from libiconv, if available, over libc version" OFF)
set_option(SDL_GCC_ATOMICS "Use gcc builtin atomics" ${SDL_GCC_ATOMICS_DEFAULT})
dep_option(SDL_DBUS "Enable D-Bus support" ON "${UNIX_SYS}" OFF)
dep_option(SDL_LIBURING "Enable liburing support" ON "${UNIX_SYS}" OFF)
dep_option(SDL_DISKAUDIO "Support the disk writer audio driver" ON "SDL_AUDIO" OFF)
dep_option(SDL_DUMMYAUDIO "Support the dummy audio driver" ON "SDL_AUDIO" OFF)
dep_option(SDL_DUMMYVIDEO "Use dummy video driver" ON "SDL_VIDEO" OFF)
@@ -1657,6 +1658,16 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU)
set(SDL_USE_IME 1)
endif()
if(SDL_LIBURING)
pkg_search_module(LIBURING liburing-ffi)
find_path(HAVE_LIBURING_H NAMES liburing.h)
if(LIBURING_FOUND AND HAVE_LIBURING_H)
set(HAVE_LIBURING_LIBURING_H TRUE)
sdl_include_directories(PRIVATE SYSTEM ${LIBURING_INCLUDE_DIRS})
set(HAVE_LIBURING TRUE)
endif()
endif()
if((FREEBSD OR NETBSD) AND NOT HAVE_INOTIFY)
set(LibInotify_PKG_CONFIG_SPEC libinotify)
pkg_check_modules(PC_LIBINOTIFY IMPORTED_TARGET ${LibInotify_PKG_CONFIG_SPEC})
@@ -1720,6 +1731,10 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU)
endif()
endif()
if(HAVE_LIBURING_H)
sdl_sources("${SDL3_SOURCE_DIR}/src/file/io_uring/SDL_asyncio_liburing.c")
endif()
# Always compiled for Linux, unconditionally:
sdl_sources(
"${SDL3_SOURCE_DIR}/src/core/linux/SDL_evdev_capabilities.c"
+3 -1
View File
@@ -21,7 +21,7 @@ Ubuntu 18.04, all available features enabled:
libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev \
libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev fcitx-libs-dev
Ubuntu 22.04+ can also add `libpipewire-0.3-dev libwayland-dev libdecor-0-dev` to that command line.
Ubuntu 22.04+ can also add `libpipewire-0.3-dev libwayland-dev libdecor-0-dev liburing-dev` to that command line.
Fedora 35, all available features enabled:
@@ -34,6 +34,8 @@ Fedora 35, all available features enabled:
libdrm-devel mesa-libgbm-devel libusb-devel libdecor-devel \
pipewire-jack-audio-connection-kit-devel \
Fedora 39+ can also add `liburing-devel` to that command line.
NOTES:
- The sndio audio target is unavailable on Fedora (but probably not what you
should want to use anyhow).
@@ -229,6 +229,7 @@
#cmakedefine HAVE_LINUX_INPUT_H 1
#cmakedefine HAVE_LIBUDEV_H 1
#cmakedefine HAVE_LIBDECOR_H 1
#cmakedefine HAVE_LIBURING_H 1
#cmakedefine HAVE_D3D11_H @HAVE_D3D11_H@
#cmakedefine HAVE_DDRAW_H @HAVE_DDRAW_H@
+4
View File
@@ -28,7 +28,11 @@
// is #defined to 0 instead and implement the SDL_SYS_* functions below in your
// backend (having them maybe call into the SDL_SYS_*_Generic versions as a
// fallback if the platform has functionality that isn't always available).
#ifdef HAVE_LIBURING_H
#define SDL_ASYNCIO_ONLY_HAVE_GENERIC 0
#else
#define SDL_ASYNCIO_ONLY_HAVE_GENERIC 1
#endif
// this entire thing is just juggling doubly-linked lists, so make some helper macros.
#define LINKED_LIST_DECLARE_FIELDS(type, prefix) \
File diff suppressed because it is too large Load Diff