Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timescale issues #89

Open
pg9182 opened this issue Dec 17, 2023 · 7 comments
Open

Timescale issues #89

pg9182 opened this issue Dec 17, 2023 · 7 comments

Comments

@pg9182
Copy link
Owner

pg9182 commented Dec 17, 2023

I'm just going to dump some stuff about the timescale issues with the nodrv patch and/or new wine versions here.

@pg9182
Copy link
Owner Author

pg9182 commented Dec 17, 2023

image
image
image
image
image
image
image
image
image
image
image
image
image
image
image
image
image
image

@pg9182
Copy link
Owner Author

pg9182 commented Dec 17, 2023

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

@pg9182
Copy link
Owner Author

pg9182 commented Dec 17, 2023

I'm going to work on the new docker image now, which will feature:

  • wine 9
  • weston/wayland (instead of xvfb)
  • debian base image (instead of alpine) (for better host compatibility)
  • ability to download updated northstar versions / mods / ci builds (replacing northstar-dedicated-ci)
  • better layering logic (probably from scratch instead of trying to coerce buildkit into doing what we want)
  • dropping legacy northstar support
  • possibly thunderstore integration
  • support executing concommands via stdin (via WM_COPYDATA)
  • better support for graceful client disconnect on shutdown (via WM_QUIT and/or the concommand)
  • better integration with the main northstar release pipeline
  • box64 for arm support (maybe)

Will probably also make some launcher changes for the next release:

  • automatically exit on registration failure (to make it easier to manage the container)
  • send container metadata during server registration (for troubleshooting and stats)

@pg9182
Copy link
Owner Author

pg9182 commented Dec 17, 2023

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.

@pg9182
Copy link
Owner Author

pg9182 commented Dec 17, 2023

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.

@pg9182
Copy link
Owner Author

pg9182 commented Dec 17, 2023

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);
}

@pg9182
Copy link
Owner Author

pg9182 commented Dec 17, 2023

https://github.com/pg9182/NorthstarDocker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant