From fcaed00a03ebe12bf68b25d7d11248b898e395a5 Mon Sep 17 00:00:00 2001 From: Alexandros Frantzis Date: Tue, 21 Mar 2023 21:05:45 +0200 Subject: [PATCH] winewayland.drv: Initialize display devices once after process init. After the driver process initialization is done, use all the received wl_output information to non-forcefully initialize the display devices. We will reintroduce dynamic display device reinitialization (i.e., as a response to non-initial wl_output events) when we start reading and dispatching Wayland events. Signed-off-by: Alexandros Frantzis --- dlls/winewayland.drv/display.c | 25 +++---------------------- dlls/winewayland.drv/wayland.c | 3 ++- dlls/winewayland.drv/wayland_output.c | 2 -- 3 files changed, 5 insertions(+), 25 deletions(-) diff --git a/dlls/winewayland.drv/display.c b/dlls/winewayland.drv/display.c index bd99441170e..36d1703e010 100644 --- a/dlls/winewayland.drv/display.c +++ b/dlls/winewayland.drv/display.c @@ -32,30 +32,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(waylanddrv); -static BOOL force_display_devices_refresh; - -static void wayland_refresh_display_devices(void) +void wayland_init_display_devices(void) { UINT32 num_path, num_mode; - force_display_devices_refresh = TRUE; /* Trigger refresh in win32u */ NtUserGetDisplayConfigBufferSizes(QDC_ONLY_ACTIVE_PATHS, &num_path, &num_mode); } -void wayland_init_display_devices(void) -{ - struct ntuser_thread_info *thread_info = NtUserGetThreadInfo(); - DWORD current_pid = GetCurrentProcessId(); - HWND desktop_hwnd = UlongToHandle(thread_info->top_window); - DWORD desktop_pid = 0; - - if (desktop_hwnd) NtUserGetWindowThread(desktop_hwnd, &desktop_pid); - - /* Refresh devices only from the desktop window process. */ - if (!desktop_pid || current_pid == desktop_pid) - wayland_refresh_display_devices(); -} - static void wayland_add_device_gpu(const struct gdi_device_manager *device_manager, void *param) { @@ -141,11 +124,9 @@ BOOL WAYLAND_UpdateDisplayDevices(const struct gdi_device_manager *device_manage struct wayland_output *output; INT output_id = 0; - if (!force && !force_display_devices_refresh) return TRUE; - - TRACE("force=%d force_refresh=%d\n", force, force_display_devices_refresh); + if (!force) return TRUE; - force_display_devices_refresh = FALSE; + TRACE("force=%d\n", force); wayland_add_device_gpu(device_manager, param); diff --git a/dlls/winewayland.drv/wayland.c b/dlls/winewayland.drv/wayland.c index 104a091ea80..e09843e1f50 100644 --- a/dlls/winewayland.drv/wayland.c +++ b/dlls/winewayland.drv/wayland.c @@ -65,7 +65,6 @@ static void registry_handle_global_remove(void *data, struct wl_registry *regist { TRACE("removing output->name=%s\n", output->name); wayland_output_destroy(output); - wayland_init_display_devices(); return; } } @@ -129,5 +128,7 @@ BOOL wayland_process_init(void) wl_display_roundtrip_queue(process_wl_display, process_wayland->wl_event_queue); wl_display_roundtrip_queue(process_wl_display, process_wayland->wl_event_queue); + wayland_init_display_devices(); + return TRUE; } diff --git a/dlls/winewayland.drv/wayland_output.c b/dlls/winewayland.drv/wayland_output.c index be9ea32bd72..0bdfd491bfe 100644 --- a/dlls/winewayland.drv/wayland_output.c +++ b/dlls/winewayland.drv/wayland_output.c @@ -132,8 +132,6 @@ static void output_handle_done(void *data, struct wl_output *wl_output) mode->width, mode->height, mode->refresh, output->current_mode == mode ? "*" : ""); } - - wayland_init_display_devices(); } static void output_handle_scale(void *data, struct wl_output *wl_output, -- 2.11.4.GIT