milestone1

This commit is contained in:
2026-05-07 04:35:57 +01:00
parent b9698beceb
commit be17bbc9bc
37 changed files with 973 additions and 317 deletions
+17 -28
View File
@@ -1,4 +1,4 @@
--- a/src/meson.build
--- a/src/meson.build.orig
+++ b/src/meson.build
@@ -81,8 +81,7 @@
endif
@@ -10,33 +10,9 @@
else
wayland_scanner_for_build = wayland_scanner
endif
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -39,7 +39,23 @@
#include <dlfcn.h>
#include <sys/time.h>
#include <fcntl.h>
-#include <sys/eventfd.h>
+#ifndef EFD_CLOEXEC
+#define EFD_CLOEXEC O_CLOEXEC
+#endif
+#ifndef EFD_NONBLOCK
+#define EFD_NONBLOCK O_NONBLOCK
+#endif
+#ifndef EFD_SEMAPHORE
+#define EFD_SEMAPHORE 0x1
+#endif
+static int eventfd(unsigned int initval, int flags) {
+ int oflag = O_RDWR;
+ if (flags & EFD_CLOEXEC) oflag |= O_CLOEXEC;
+ if (flags & EFD_NONBLOCK) oflag |= O_NONBLOCK;
+ char path[64];
+ snprintf(path, sizeof(path), "/scheme/event/eventfd/%u/%d", initval, (flags & EFD_SEMAPHORE) ? 1 : 0);
+ return open(path, oflag);
+}
#include <sys/file.h>
#include <sys/stat.h>
--- a/src/wayland-client.c.orig
+++ b/src/wayland-client.c
@@ -649,6 +649,11 @@
wl_proxy_add_listener(struct wl_proxy *proxy,
void (**implementation)(void), void *data)
@@ -65,3 +41,16 @@
return proxy->display;
}
--- a/src/connection.c.orig
+++ b/src/connection.c
@@ -37,6 +37,9 @@
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
+#ifndef MSG_NOSIGNAL
+#define MSG_NOSIGNAL 0
+#endif
#include <time.h>
#include <ffi.h>
@@ -1,46 +1 @@
--- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h
+++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h
@@ -51,8 +51,10 @@
virtual bool supportsThreadedOpenGL() const { return false; }
virtual bool supportsWindowDecoration() const { return false; }
+#if QT_CONFIG(opengl)
virtual QWaylandWindow *createEglWindow(QWindow *window) = 0;
virtual QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const = 0;
+#endif
virtual bool canCreatePlatformOffscreenSurface() const { return false; }
#if QT_CONFIG(opengl)
virtual QOpenGLContext *createOpenGLContext(EGLContext context, EGLDisplay contextDisplay, QOpenGLContext *shareContext) const = 0;
@@ -67,5 +71,7 @@
virtual void *nativeResource(NativeResource /*resource*/) { return nullptr; }
+#if QT_CONFIG(opengl)
virtual void *nativeResourceForContext(NativeResource /*resource*/, QPlatformOpenGLContext */*context*/) { return nullptr; }
+#endif
};
}
--- a/src/plugins/platforms/wayland/qwaylandintegration.cpp
+++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp
@@ -137,7 +137,11 @@
return false;
case OffscreenSurface:
+#if QT_CONFIG(opengl)
return mDisplay->clientBufferIntegration()
&& mDisplay->clientBufferIntegration()->canCreatePlatformOffscreenSurface();
+#else
+ return false;
+#endif
default: return QPlatformIntegration::hasCapability(cap);
}
}
@@ -148,7 +152,9 @@
QPlatformWindow *QWaylandIntegration::createPlatformWindow(QWindow *window) const
{
+#if QT_CONFIG(opengl)
if (window->surfaceType() == QWindow::OpenGLSurface
&& mDisplay->clientBufferIntegration())
return mDisplay->clientBufferIntegration()->createEglWindow(window);
+#endif
#if QT_CONFIG(vulkan)
../../../../local/patches/qtbase/P1-qplatformopengl-guard.patch
@@ -1,19 +1,17 @@
diff --git a/src/header/sys_eventfd/cbindgen.toml b/src/header/sys_eventfd/cbindgen.toml
new file mode 100644
index 00000000..c47f467f
index 00000000..a1b2c3d4
--- /dev/null
+++ b/src/header/sys_eventfd/cbindgen.toml
@@ -0,0 +1,13 @@
@@ -0,0 +1,11 @@
+sys_includes = ["stdint.h"]
+after_includes = """
+typedef uint64_t eventfd_t;
+int eventfd(unsigned int initval, int flags);
+"""
+include_guard = "_SYS_EVENTFD_H"
+language = "C"
+style = "Tag"
+no_includes = true
+cpp_compat = true
+
+[enum]
+prefix_with_name = true
@@ -0,0 +1,35 @@
--- a/src/header/sys_eventfd/mod.rs
+++ b/src/header/sys_eventfd/mod.rs
@@ -5,6 +5,7 @@
use crate::c_str::{CStr, CString};
use crate::error::{Errno, ResultExt};
use crate::header::fcntl::{O_CLOEXEC, O_NONBLOCK, O_RDWR};
+use crate::header::errno::EFAULT;
use crate::header::errno::EINVAL;
use crate::platform::{Pal, Sys, types::{c_int, c_uint}};
@@ -35,3 +36,24 @@
}
Sys::open(CStr::borrow(&cpath), oflag, 0).or_minus_one_errno()
}
+
+#[unsafe(no_mangle)]
+pub extern "C" fn eventfd_read(fd: c_int, value: *mut eventfd_t) -> c_int {
+ if value.is_null() {
+ return Err::<c_int, _>(Errno(EFAULT)).or_minus_one_errno();
+ }
+ let mut buf = [0u8; 8];
+ match Sys::read(fd, &mut buf) {
+ Ok(8) => { unsafe { *value = u64::from_ne_bytes(buf); } 0 }
+ _ => -1,
+ }
+}
+
+#[unsafe(no_mangle)]
+pub extern "C" fn eventfd_write(fd: c_int, value: eventfd_t) -> c_int {
+ let buf = value.to_ne_bytes();
+ match Sys::write(fd, &buf) {
+ Ok(8) => 0,
+ _ => -1,
+ }
+}
@@ -0,0 +1,20 @@
diff --git a/include/stddef.h b/include/stddef.h
index 334267f4..beefde5e 100644
--- a/include/stddef.h
+++ b/include/stddef.h
@@ -1,6 +1,5 @@
#ifndef _STDDEF_H
#define _STDDEF_H
-#include <stdint.h>
#define NULL 0
@@ -11,6 +10,8 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
typedef long unsigned int size_t;
+#include <stdint.h>
+
typedef struct { long long __ll; long double __ld; } max_align_t;
#define offsetof(type, member) __builtin_offsetof(type, member)