Skip to content

Commit

Permalink
10.0-rc2-3 patchset
Browse files Browse the repository at this point in the history
return openglfreak's threaded/shared memory server request patchset

fix logic error in semaphore path for fsync retry optimization (causing long freezes in osu song select)

fix screenshot folder not opening in osu with WINE_BLOCK_GET_VERSION=1

some other minor things
  • Loading branch information
whrvt committed Dec 16, 2024
1 parent 3bec479 commit 0044162
Show file tree
Hide file tree
Showing 35 changed files with 3,391 additions and 1,026 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
From 6a2af9fc9415a13e82155d96eea3a9440d593fcd Mon Sep 17 00:00:00 2001
From: Paul Gofman <[email protected]>
Date: Fri, 13 Dec 2024 19:28:43 -0600
Subject: [PATCH] winex11.drv: Use NtUserReleaseDC() with hdc.

---
dlls/winex11.drv/init.c | 2 +-
dlls/winex11.drv/vulkan.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c
index ddb8101a2f7..fca673fb825 100644
--- a/dlls/winex11.drv/init.c
+++ b/dlls/winex11.drv/init.c
@@ -215,7 +215,7 @@ static BOOL needs_client_window_clipping( HWND hwnd )
if (ret == SIMPLEREGION && EqualRect( &rect, &client )) ret = 0;
NtGdiDeleteObjectApp( region );
}
- NtGdiDeleteObjectApp( hdc );
+ NtUserReleaseDC( hwnd, hdc );

return ret > 0;
}
diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c
index 12f51fdcefd..855dddba440 100644
--- a/dlls/winex11.drv/vulkan.c
+++ b/dlls/winex11.drv/vulkan.c
@@ -246,7 +246,7 @@ static void X11DRV_vulkan_surface_presented( HWND hwnd, void *private, VkResult
surface->hdc_src, 0, 0, surface->rect.right, surface->rect.bottom, SRCCOPY, 0 );

if (region) NtGdiDeleteObjectApp( region );
- if (hdc) NtGdiDeleteObjectApp( hdc );
+ if (hdc) NtUserReleaseDC( hwnd, hdc );
}

static VkBool32 X11DRV_vkGetPhysicalDeviceWin32PresentationSupportKHR(VkPhysicalDevice phys_dev,
--
GitLab

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
From 93260362ecc1daac2c5a621ecc4e651fac787c5a Mon Sep 17 00:00:00 2001
From: Elizabeth Figura <[email protected]>
Date: Sat, 14 Dec 2024 19:00:44 -0600
Subject: [PATCH] configure: Add /usr/lib64/pkgconfig to the 32-bit search
path.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53953
---
configure.ac | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 6596f653fb1..1d6a2b55b4a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -129,7 +129,10 @@ case $host in
host_cpu="i386"
notice_platform="32-bit "
TARGETFLAGS="$TARGETFLAGS -m32"
- PKG_CONFIG_LIBDIR=${PKG_CONFIG_LIBDIR:-/usr/lib/i386-linux-gnu/pkgconfig:/usr/lib32/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig}
+ dnl Search 64-bit directories, even though it's explicitly the wrong architecture.
+ dnl Most headers end up being identical anyway, and this allows users to not need
+ dnl to go out of their way to install the right headers.
+ PKG_CONFIG_LIBDIR=${PKG_CONFIG_LIBDIR:-/usr/lib/i386-linux-gnu/pkgconfig:/usr/lib32/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig:/usr/lib64/pkgconfig}
export PKG_CONFIG_LIBDIR
else
CC="$CC -m64"
--
GitLab

Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
From d5f8bedec11d7d72e8312bc1302aad943f0bd054 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <[email protected]>
Date: Mon, 16 Dec 2024 11:19:14 +0100
Subject: [PATCH] win32u: Always update the surface region when the surface
changes.

Instead of reapplying the old shape, which not only includes the window
shape but also the old clipping and visible areas that can change
independently.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57551
---
dlls/win32u/window.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c
index 4855555d926..d8974501adb 100644
--- a/dlls/win32u/window.c
+++ b/dlls/win32u/window.c
@@ -2066,7 +2066,7 @@ static BOOL apply_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags, stru
old_surface = win->surface;
if (old_surface != new_surface)
{
- if (old_surface && new_surface) window_surface_set_shape( new_surface, old_surface->shape_region );
+ needs_update = TRUE; /* force refreshing the window surface shape */
swp_flags |= SWP_FRAMECHANGED; /* force refreshing non-client area */
}

@@ -2112,7 +2112,7 @@ static BOOL apply_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags, stru
win->rects = *new_rects;
if ((win->surface = new_surface)) window_surface_add_ref( win->surface );
surface_win = wine_server_ptr_handle( reply->surface_win );
- needs_update = reply->needs_update;
+ if (!needs_update) needs_update = reply->needs_update;
if (get_window_long( win->parent, GWL_EXSTYLE ) & WS_EX_LAYOUTRTL)
{
RECT client = {0};
--
GitLab

Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
From a0642db0c5a57d93c66193a14a8eb4da28f84359 Mon Sep 17 00:00:00 2001
From: William Horvath <[email protected]>
Date: Mon, 16 Dec 2024 00:43:14 -0800
Subject: [PATCH] fsync: Don't spin on zero timeouts, and fix
try_wait_semaphore logic.

---
dlls/ntdll/unix/fsync.c | 28 +++++++++++++---------------
1 file changed, 13 insertions(+), 15 deletions(-)

diff --git a/dlls/ntdll/unix/fsync.c b/dlls/ntdll/unix/fsync.c
index 9831fa4e8ee..307f891eb9d 100644
--- a/dlls/ntdll/unix/fsync.c
+++ b/dlls/ntdll/unix/fsync.c
@@ -880,7 +880,7 @@ static inline NTSTATUS try_wait_value( volatile int *addr, int expected_val,
}

static inline BOOL try_reacquire_mutex( struct mutex *mutex, int current_tid,
- int *observed_tid )
+ int *observed_tid, BOOL zero_timeout )
{
int tid = *observed_tid;

@@ -900,7 +900,7 @@ static inline BOOL try_reacquire_mutex( struct mutex *mutex, int current_tid,
mutex->count = 1;
return TRUE;
}
- if (try_wait_value( &mutex->tid, tid, &tid, MUTEX_MON_TIMEOUT ) == STATUS_SUCCESS)
+ if (!zero_timeout && try_wait_value( &mutex->tid, tid, &tid, MUTEX_MON_TIMEOUT ) == STATUS_SUCCESS)
{
*observed_tid = tid;
return TRUE;
@@ -908,26 +908,23 @@ static inline BOOL try_reacquire_mutex( struct mutex *mutex, int current_tid,
return FALSE; /* fall back to futex */
}

-static inline BOOL try_acquire_semaphore( struct semaphore *semaphore )
+static inline BOOL try_acquire_semaphore( struct semaphore *semaphore, BOOL zero_timeout )
{
int count, new_count;

new_count = __atomic_load_n( &semaphore->count, __ATOMIC_SEQ_CST );
- while ((count = new_count) > 0)
+ while ((count = new_count))
{
if ((new_count = __sync_val_compare_and_swap( &semaphore->count,
count, count - 1 )) == count)
{
return TRUE;
}
-
- if (!new_count &&
- try_wait_value( &semaphore->count, 0, &new_count, SEM_MON_TIMEOUT ) == STATUS_SUCCESS)
+ if (!zero_timeout &&
+ try_wait_value( &semaphore->count, new_count, &new_count, SEM_MON_TIMEOUT ) == STATUS_SUCCESS)
{
continue;
}
-
- break;
}
return FALSE;
}
@@ -941,7 +938,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles,

struct futex_waitv futexes[MAXIMUM_WAIT_OBJECTS + 1];
struct fsync objs[MAXIMUM_WAIT_OBJECTS];
- BOOL msgwait = FALSE, waited = FALSE;
+ BOOL msgwait = FALSE, waited = FALSE, zero_timeout = FALSE;
int has_fsync = 0, has_server = 0;
clockid_t clock_id = 0;
struct timespec64 end;
@@ -969,6 +966,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles,
}

get_wait_end_time( &timeout, &end, &clock_id );
+ zero_timeout = timeout && !timeout->QuadPart;

for (i = 0; i < count; i++)
{
@@ -1050,7 +1048,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles,
{
struct semaphore *semaphore = obj->shm;

- if (try_acquire_semaphore( semaphore ))
+ if (try_acquire_semaphore( semaphore, zero_timeout ))
{
TRACE("Woken up by handle %p [%d].\n", handles[i], i);
return i;
@@ -1072,7 +1070,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles,
}

tid = __atomic_load_n( &mutex->tid, __ATOMIC_SEQ_CST );
- if (try_reacquire_mutex( mutex, current_tid, &tid ))
+ if (try_reacquire_mutex( mutex, current_tid, &tid, zero_timeout ))
{
TRACE("Woken up by handle %p [%d].\n", handles[i], i);
return (tid == ~0) ? STATUS_ABANDONED_WAIT_0 + i : i;
@@ -1093,7 +1091,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles,
return i;
}

- if (try_wait_value( &event->signaled, 0, &signaled, AUTO_MON_TIMEOUT ) == STATUS_SUCCESS &&
+ if (!zero_timeout && try_wait_value( &event->signaled, 0, &signaled, AUTO_MON_TIMEOUT ) == STATUS_SUCCESS &&
__sync_val_compare_and_swap( &event->signaled, 1, 0 ))
{
TRACE("Woken up by handle %p [%d].\n", handles[i], i);
@@ -1116,7 +1114,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles,
return i;
}

- if (try_wait_value( &event->signaled, 0, &signaled, MANUAL_MON_TIMEOUT ) == STATUS_SUCCESS &&
+ if (!zero_timeout && try_wait_value( &event->signaled, 0, &signaled, MANUAL_MON_TIMEOUT ) == STATUS_SUCCESS &&
signaled)
{
TRACE("Woken up by handle %p [%d].\n", handles[i], i);
@@ -1146,7 +1144,7 @@ static NTSTATUS __fsync_wait_objects( DWORD count, const HANDLE *handles,

/* Looks like everything is contended, so wait. */

- if (timeout && !timeout->QuadPart)
+ if (zero_timeout)
{
/* Unlike esync, we already know that we've timed out, so we
* can avoid a syscall. */
--
2.47.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
From 54d82ed4d5483f7569871219acc485b3cb5a224e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <[email protected]>
Date: Sat, 14 Dec 2024 13:15:42 +0100
Subject: [PATCH] winex11: Sync gl drawable outside of the win_data mutex.

Some thread might be destroying a window, calling destroy_client_window
from release_gl_drawable, holding the GL context mutex and trying to
enter the win_data mutex.

At the same time, another thread might be moving its window, calling
sync_gl_drawable from X11DRV_WindowPosChanged, holding the win_data
mutex and trying to enter the GL context mutex.

The deadlock was present before already, although less frequently
triggered as sync_gl_drawable was done conditionally if the client
window has been moved.

This triggers now more frequently in the dxgi:dxgi tests.
---
dlls/winex11.drv/window.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git b/dlls/winex11.drv/window.c a/dlls/winex11.drv/window.c
index bf415f19cb9..d109d6a744e 100644
--- b/dlls/winex11.drv/window.c
+++ a/dlls/winex11.drv/window.c
@@ -2932,8 +2932,6 @@ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, HWND owner_hint, UIN
struct window_rects old_rects;
BOOL was_fullscreen;

- sync_gl_drawable( hwnd, FALSE );
-
if (!(data = get_win_data( hwnd ))) return;

old_style = new_style & ~(WS_VISIBLE | WS_MINIMIZE | WS_MAXIMIZE);
@@ -2952,6 +2950,7 @@ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, HWND owner_hint, UIN
XFlush( gdi_display ); /* make sure painting is done before we move the window */

sync_client_position( data, &old_rects );
+ sync_gl_drawable( hwnd, FALSE );

if (!data->whole_window)
{
--
2.47.1

This file was deleted.

Loading

0 comments on commit 0044162

Please sign in to comment.