Open pg9182 opened 10 months ago
TLDR: we can avoid this entire issue while also making everything else much easier by using wine-9.0 with headless weston.
export WAYLAND_DISPLAY=wayland-1 XDG_RUNTIME_DIR=/tmp XDG_SESSION_TYPE=wayland
weston --backend=headless --use-pixman --no-config &
wine64 wineboot --init
wine64 reg add 'HKCU\Software\Wine' /v 'Version' /t REG_SZ /d 'win10' /f
wine64 reg add 'HKCU\Software\Wine\Drivers' /v 'Audio' /t REG_SZ /d '' /f
wine64 reg add 'HKCU\Software\Wine\WineDbg' /v 'ShowCrashDialog' /t REG_DWORD /d 0 /f
wine64 reg add 'HKCU\Software\Wine\Drivers' /v 'Graphics' /t REG_SZ /d 'wayland' /f
wine64 reg add 'HKLM\System\CurrentControlSet\Services\WineBus' /v 'DisableHidraw' /t REG_DWORD /d 1 /f
wine64 reg add 'HKLM\System\CurrentControlSet\Services\WineBus' /v 'DisableInput' /t REG_DWORD /d 1 /f
wine64 reg add 'HKLM\System\CurrentControlSet\Services\WineBus' /v 'Enable SDL' /t REG_DWORD /d 0 /f
wine64 reg add 'HKCU\Software\Wine\DllOverrides' /v 'mscoree' /t REG_SZ /d '' /f
wine64 reg add 'HKCU\Software\Wine\DllOverrides' /v 'mshtml' /t REG_SZ /d '' /f
wine64 reg add 'HKCU\Software\Wine\DllOverrides' /v 'winemenubuilder' /t REG_SZ /d '' /f
wine64 reg add 'HKCU\Software\Wine\DllOverrides' /v 'd3d9' /t REG_SZ /d '' /f
wine64 reg add 'HKCU\Software\Wine\DllOverrides' /v 'd3d10' /t REG_SZ /d '' /f
wine64 reg add 'HKCU\Software\Wine\DllOverrides' /v 'd3d11' /t REG_SZ /d 'native' /f
wine64 reg add 'HKCU\Software\Wine\DllOverrides' /v 'd3d12' /t REG_SZ /d '' /f
wine64 reg add 'HKCU\Software\Wine\DllOverrides' /v 'wined3d' /t REG_SZ /d '' /f
wine64 reg add 'HKCU\Software\Wine\DllOverrides' /v 'winevulkan' /t REG_SZ /d '' /f
nswrap /path/to/northstar
I'm going to work on the new docker image now, which will feature:
WM_COPYDATA
)WM_QUIT
and/or the concommand)Will probably also make some launcher changes for the next release:
Also going to consider making the image support being run as a systemd portable service, and being bootable as an ISO with config via cloud-init
.
Will probably just do a custom wlroots-based compositor from scratch since it'll only be a few hundred lines, it'll have fewer dependencies than weston, and it'll be nice to have it integrated with the rest of nswrap.
This is all that's necessary for creating a dummy compositor for wayland with wine 9.0-rc2.
// pkg-config --cflags --libs pixman-1 wlroots wayland-server
// wayland-scanner server-header /usr/share/wayland-protocols/stable/xdg-shell/xdg-shell.xml src/nswrap/xdg-shell-protocol.h
// wayland-scanner server-header /usr/share/wayland-protocols/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml src/nswrap/pointer-constraints-unstable-v1-protocol.h
// gcc -Wall -Wextra -I/usr/include/pixman-1 -I/usr/include/libdrm src/nswrap/nswrap2.c -lpixman-1 -lwlroots -lwayland-server
#define WLR_USE_UNSTABLE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <wayland-server-core.h>
#include <wlr/backend.h>
#include <wlr/backend/session.h>
#include <wlr/backend/headless.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/render/pixman.h>
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_xdg_shell.h>
#include <wlr/types/wlr_subcompositor.h>
#include <wlr/types/wlr_pointer_constraints_v1.h>
#include <wlr/types/wlr_relative_pointer_v1.h>
#include <wlr/util/log.h>
extern struct wlr_allocator *wlr_shm_allocator_create(void);
int main(void) {
wlr_log_init(WLR_DEBUG, NULL);
struct wl_display *display = wl_display_create();
struct wlr_backend *backend = wlr_headless_backend_create(display);
if (!backend) {
wlr_log(WLR_ERROR, "Failed to create wlr_headless_backend");
exit(1);
}
struct wlr_renderer *renderer = wlr_pixman_renderer_create();
if (!renderer) {
wlr_log(WLR_ERROR, "Failed to create wlr_pixman_renderer");
exit(1);
}
struct wlr_compositor *compositor = wlr_compositor_create(display, renderer);
if (!compositor) {
wlr_log(WLR_ERROR, "Failed to create wlr_compositor");
exit(1);
}
// required for winewayland.drv
if (!wlr_renderer_init_wl_shm(renderer, display)) {
wlr_log(WLR_ERROR, "Failed to initialize wl_shm on renderer");
exit(1);
}
// required for winewayland.drv
struct wlr_subcompositor *subcompositor = wlr_subcompositor_create(display);
if (!subcompositor) {
wlr_log(WLR_ERROR, "Failed to create wlr_subcompositor");
exit(1);
}
// required for winewayland.drv
struct wlr_pointer_constraints_v1 *pointer_constraints_v1 = wlr_pointer_constraints_v1_create(display);
if (!pointer_constraints_v1) {
wlr_log(WLR_ERROR, "Failed to create wlr_pointer_constraints_v1");
exit(1);
}
// required for winewayland.drv
struct wlr_relative_pointer_manager_v1 *relative_pointer_manager_v1 = wlr_relative_pointer_manager_v1_create(display);
if (!relative_pointer_manager_v1) {
wlr_log(WLR_ERROR, "Failed to create wlr_relative_pointer_manager_v1");
exit(1);
}
// required for winewayland.drv
struct wlr_xdg_shell *xdg_shell = wlr_xdg_shell_create(display, 5);
if (!xdg_shell) {
wlr_log(WLR_ERROR, "Failed to create wlr_xdg_shell");
exit(1);
}
if (wl_display_add_socket(display, "/tmp/nswrap-wayland")) {
wlr_log(WLR_ERROR, "Failed to create socket");
exit(1);
}
if (!wlr_backend_start(backend)) {
wlr_log(WLR_ERROR, "Failed to start backend");
wlr_backend_destroy(backend);
exit(1);
}
wlr_log(WLR_INFO, "WAYLAND_DISPLAY=/tmp/nswrap-wayland");
wl_display_run(display);
wl_display_destroy(display);
wlr_renderer_destroy(renderer);
}
I'm just going to dump some stuff about the timescale issues with the nodrv patch and/or new wine versions here.