Mutter and related window managers use a parent X window frame, and
temporarily unmap windows when their decoration is switched on/off.
This triggers an Unmap > FocusOut > Reparent > Map > FocusIn event
sequence, which we need to ignore in order to keep focus unchanged.
If we were wrong about it, the WM_STATE property should then change as
well, and we will eventually post a WM_WINE_WINDOW_STATE_CHANGED message
again and have another chance at changing the foreground window.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/8154
Instead of https://gitlab.winehq.org/wine/wine/-/merge_requests/7815, for https://gitlab.winehq.org/wine/wine/-/merge_requests/7226, this only split the sync ops to a separate vtable and let objects delegate theirs to a separate object.
This starts using a event-like interface for most objects, leaving the decision regarding if/how to split sync themselves / integrate inproc syncs for later.
--
v9: server: Use an event sync for fd objects.
server: Introduce a new event sync object.
server: Redirect fd-based objects sync to the fd.
server: Add an operation to retrieve an object sync.
server: Move object grab/release out of (add|remove)_queue.
server: Move signal access checks outside of the objects.
https://gitlab.winehq.org/wine/wine/-/merge_requests/7848
Windows doesn't support I420 10LE, but uses P010 instead, thus
GST_VIDEO_FORMAT_I420_10LE is ultimately converted to
GST_VIDEO_FORMAT_P010_10LE.
This fixes playback of videos in VRChat that use i420 10le as the raw video color format.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/8144
On some Windows versions, `__C_specific_handler` requires unwind information for the
tested function, even though it's not actually needed, since unwinding should stop
at this point.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/8149
--
v6: winex11: Serialize window config requests with some other requests.
winex11: Serialize managed window config change requests.
winex11: Keep track of the last config above flag used.
winex11: Track window pending config position / size independently.
winex11: Serialize individual _NET_WM_STATE bit changes.
winex11: Continue requesting desired window state on no-op event.
https://gitlab.winehq.org/wine/wine/-/merge_requests/8079
--
v5: winex11: Serialize window config requests with some other requests.
winex11: Serialize managed window config change requests.
winex11: Keep track of the last config above flag used.
winex11: Track window pending config position / size independently.
winex11: Serialize individual _NET_WM_STATE bit changes.
winex11: Continue requesting desired window state on no-op event.
https://gitlab.winehq.org/wine/wine/-/merge_requests/8079
Over the past several weeks I've been working on and off on this. I didn't track the hours but I'm sure that I've spent 80+ hours on the feature. I've tested and retested all known scenarios and it seems to be working as expected.
--
v51: cmd: Implement tab completion for command line entry.
https://gitlab.winehq.org/wine/wine/-/merge_requests/7843
SCSI command 0xAD (GPCMD_READ_DVD_STRUCTURE) with the eighth byte of the
command set to 0x00 (DVD_STRUCT_PHYSICAL) returns physical disc
information for DVDs and blu-rays. On success, the command returns
status 0, and for ordinary CDs, the command returns the error status
0x02 (SAM_STAT_CHECK_CONDITION). The format of the data returned is
different for blu-rays than for DVDs, and the second byte of the command
indicates whether to return DVD information or blu-ray information. (My
LG WH16NS40 drive actually ignores the second byte when there is a DVD
in the drive, but it returns SAM_STAT_CHECK_CONDITION when there is a
blu-ray in the drive and the second byte is not 0x01.) Windows does not
distinguish between DVDs and blu-rays in IOCTL_DISK_GET_MEDIA_TYPES, so
if the SCSI command succeeds for either disc type, report
FILE_DEVICE_DVD.
More specific media information is still not implemented.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57790
--
v3: ntdll: Detect the optical disc type on Linux using a SCSI command.
https://gitlab.winehq.org/wine/wine/-/merge_requests/7747
Function GdipGetImageAttributesAdjustedPalette gets [called with type = -1](https://gitlab.winehq.org/wine/wine/-/blob/22af42ac22279e6c0c671f033661f95c1761b4bb/dlls/gdiplus/tests/image.c?page=6#L5649) and therefore accesses several arrays at index -1.
This patch adds a helper which additionally checks for `type >= ColorAdjustTypeDefault`.
<details>
<summary>ASan output</summary>
```
=================================================================
==gdiplus_test.exe==308==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7f21342c57f8 at pc 0x6ffffadfd25b bp 0x7ffffe1ff750 sp 0x7ffffe1ff798
READ of size 4 at 0x7f21342c57f8 thread T0
#0 0x6ffffadfd25a in apply_image_attributes .../dlls/gdiplus/graphics.c:929:41
#1 0x6ffffae5c2f2 in GdipGetImageAttributesAdjustedPalette .../dlls/gdiplus/imageattributes.c:123:5
#2 0x000140084b59 in test_getadjustedpalette .../dlls/gdiplus/tests/image.c:5649:12
#3 0x000140062be6 in func_image .../dlls/gdiplus/tests/image.c:6719:5
#4 0x0001400c9132 in run_test .../include/wine/test.h:765:5
#5 0x0001400c8b50 in main .../include/wine/test.h:884:12
#6 0x0001400cad3a in mainCRTStartup .../dlls/msvcrt/crt_main.c:60:11
#7 0x6fffffc45aa0 in BaseThreadInitThunk .../dlls/kernel32/thread.c:61:24
#8 0x6fffffdcc776 in RtlUserThreadStart (C:\windows\system32\ntdll.dll+0x17004c776)
0x7f21342c57f8 is located 144 bytes after 1256-byte region [0x7f21342c5280,0x7f21342c5768)
freed by thread T0 here:
#0 0x6ffffe88aab1 in free C:/llvm-mingw/llvm-mingw/llvm-project/compiler-rt/lib/asan\asan_malloc_win.cpp:71:3
#1 0x6ffffae5c21d in GdipDisposeImageAttributes .../dlls/gdiplus/imageattributes.c:109:5
#2 0x000140083598 in test_colorkey .../dlls/gdiplus/tests/image.c:3709:5
#3 0x000140062bd7 in func_image .../dlls/gdiplus/tests/image.c:6716:5
#4 0x0001400c9132 in run_test .../include/wine/test.h:765:5
#5 0x0001400c8b50 in main .../include/wine/test.h:884:12
#6 0x0001400cad3a in mainCRTStartup .../dlls/msvcrt/crt_main.c:60:11
#7 0x6fffffc45aa0 in BaseThreadInitThunk .../dlls/kernel32/thread.c:61:24
#8 0x6fffffdcc776 in RtlUserThreadStart (C:\windows\system32\ntdll.dll+0x17004c776)
previously allocated by thread T0 here:
#0 0x6ffffe88ace6 in calloc C:/llvm-mingw/llvm-mingw/llvm-project/compiler-rt/lib/asan\asan_malloc_win.cpp:91:3
#1 0x6ffffae5c0fc in GdipCreateImageAttributes .../dlls/gdiplus/imageattributes.c:87:18
#2 0x000140082bf9 in test_colorkey .../dlls/gdiplus/tests/image.c:3629:12
#3 0x000140062bd7 in func_image .../dlls/gdiplus/tests/image.c:6716:5
#4 0x0001400c9132 in run_test .../include/wine/test.h:765:5
#5 0x0001400c8b50 in main .../include/wine/test.h:884:12
#6 0x0001400cad3a in mainCRTStartup .../dlls/msvcrt/crt_main.c:60:11
#7 0x6fffffc45aa0 in BaseThreadInitThunk .../dlls/kernel32/thread.c:61:24
#8 0x6fffffdcc776 in RtlUserThreadStart (C:\windows\system32\ntdll.dll+0x17004c776)
SUMMARY: AddressSanitizer: heap-buffer-overflow .../dlls/gdiplus/graphics.c:929:41 in apply_image_attributes
Shadow bytes around the buggy address:
0x7f21342c5500: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x7f21342c5580: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x7f21342c5600: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x7f21342c5680: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x7f21342c5700: fd fd fd fd fd fd fd fd fd fd fd fd fd fa fa fa
=>0x7f21342c5780: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa[fa]
0x7f21342c5800: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x7f21342c5880: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x7f21342c5900: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x7f21342c5980: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x7f21342c5a00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==gdiplus_test.exe==308==ABORTING
```
</details>
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/8141
On Fri May 23 04:23:45 2025 +0000, Alex Henrie wrote:
> Linux has only three [DVD
> ioctls](https://docs.kernel.org/userspace-api/ioctl/cdrom.html):
> DVD_READ_STRUCT, DVD_WRITE_STRUCT, and DVD_AUTH. It has no blu-ray
> ioctls. Of the three DVD ioctls, only DVD_READ_STRUCT would be suitable
> for disc type detection.
> DVD_READ_STRUCT can read five kinds of information: DVD_STRUCT_PHYSICAL,
> DVD_STRUCT_COPYRIGHT, DVD_STRUCT_DISCKEY, DVD_STRUCT_BCA, and
> DVD_STRUCT_MANUFACT. Of those five, only DVD_STRUCT_PHYSICAL would be
> suitable for disc type detection.
> At least on my LG WH16NS40 drive, DVD_STRUCT_PHYSICAL succeeds when
> there is a DVD in the drive, but it fails when there is a CD or a
> blu-ray in the drive. That means that we could use DVD_STRUCT_PHYSICAL
> to accurately detect whether there is a DVD in the drive, but we would
> still need another way to detect blu-rays.
> Is there another ioctl that you had in mind, or something else that I
> missed? Do you want to try DVD_STRUCT_PHYSICAL first and fall back to
> guessing based on the data size if it fails? Please let me know how to proceed.
Any chance it could be a driver bug?
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7747#note_104478
eric pouech (@epo) commented about programs/cmd/wcmdmain.c:
> +
> + /* Calculate cursor position at beginning of prompt, accounting for lines scrolled
> + * due to length of input.
> + */
> + GetConsoleScreenBufferInfo(hOutput, ¤tConsoleInfo);
> + currentConsoleInfo.dwCursorPosition.X = startConsoleInfo.dwCursorPosition.X;
> + len2 -= (currentConsoleInfo.dwSize.X - currentConsoleInfo.dwCursorPosition.X);
> + if (len2 > 0) {
> + currentConsoleInfo.dwCursorPosition.Y -= ((len2 / currentConsoleInfo.dwSize.X) + 1);
> + }
> + SetConsoleCursorPosition(hOutput, currentConsoleInfo.dwCursorPosition);
> +
> + WriteConsoleW(hOutput, inputBuffer, len, &numWritten, NULL);
> + if (maxLen > len) {
> + clear_console_characters(hOutput, maxLen - len, lastConsoleInfo.dwSize.X); /* width at time of last console update */
> + }
and likely you could do 'maxLen = len;' here: as screen is "cleared" after 'len' position, there's no need to clear it again (unless a wider string is needed, but you'll catch that later)
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7843#note_104474
eric pouech (@epo) commented about programs/cmd/wcmdmain.c:
> + len = lstrlenW(inputBuffer);
> + len2 = len;
> +
> + /* Update current input display in console */
> + set_cursor_visible(hOutput, FALSE);
> +
> + /* Calculate cursor position at beginning of prompt, accounting for lines scrolled
> + * due to length of input.
> + */
> + GetConsoleScreenBufferInfo(hOutput, ¤tConsoleInfo);
> + currentConsoleInfo.dwCursorPosition.X = startConsoleInfo.dwCursorPosition.X;
> + len2 -= (currentConsoleInfo.dwSize.X - currentConsoleInfo.dwCursorPosition.X);
> + if (len2 > 0) {
> + currentConsoleInfo.dwCursorPosition.Y -= ((len2 / currentConsoleInfo.dwSize.X) + 1);
> + }
> + SetConsoleCursorPosition(hOutput, currentConsoleInfo.dwCursorPosition);
did you try just reusing startConsoleInfo.dwCursorPosition here instead of recomputing the initial cursor position?
Actually I'm worried that we have to convert between cursor position from/to number of characters
- this makes assumptions about how the string is layed out (one vs multiple lines, one string character == one cell == one glyph on screen (this is not the case for CJK characters; if we support them one day))
- anyway, I don't see a simple straightforward way to do it (ReadConsole doesn't return the farthest cursor point where it has written to, and since it can be on multiple lines...).
- but the less code that does it, the better
the pain here comes from conhost wrapping the strings (in WriteConsole) larger than screen buffer width onto different lines... native use an unbounded line length and wraps it depending on window size.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7843#note_104473
On Sun May 25 15:34:38 2025 +0000, Alexandros Frantzis wrote:
> Hi @yurih, from what I understand the reason alt(-tab) is problematic is
> because the alt menu mode is enabled when the key is released. However,
> avoiding the release just for this behavior doesn't seem like a viable
> way forward, since other applications may treat alt differently or may
> also require treating other keys the same way.
> I was experimenting a bit and sending WM_CANCELMODE (which winex11 does
> already) seems to help with the alt(-tab) menu situation in my tests.
> Could you try the following and let me know if it helps with your use case:
> ```patch
> --- a/dlls/winewayland.drv/wayland_keyboard.c
> +++ b/dlls/winewayland.drv/wayland_keyboard.c
> @@ -800,6 +800,11 @@ static void keyboard_handle_leave(void *data,
> struct wl_keyboard *wl_keyboard,
> * and for any key repetition to stop. */
> release_all_keys(hwnd);
>
> + if (hwnd == NtUserGetForegroundWindow())
> + {
> + if (!(NtUserGetWindowLongW(hwnd, GWL_STYLE) & WS_MINIMIZE))
> + send_message(hwnd, WM_CANCELMODE, 0, 0);
> + }
> /* FIXME: update foreground window as well */
> }
> ```
Yes it does indeed fix the alt menu mode without my patch. Though I don't think I understood clearly what you meant, as Alt is already filtered (VK_MENU), I just added the left and right keys as they are among the returned keyboard state and are not filtered, making Alt released anyway. You plan to remove the modifier's filtering altogether ?
Also, there's issues with extended scan code (for example my keyboard arrows) that aren't released, though it also happens with winex11.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/6199#note_104470
On Sun May 25 13:31:25 2025 +0000, Jayson Reis wrote:
> Hi there @epo thanks for the review!
> As I could not find any auto formatting tool configured, I tried
> maintaining the formatting around the code I was changing, do you mind
> point me out where did you find it different?
> I will change the calls to GetProcAddress, as there is no public header,
> this means that on console.c I cannot call the Wide function from ascii
> and just convert, right? Meaning I would need to implement the logic twice?
> About being racy, reading the docs I did not see anything special about
> it, it seems like a wrapper around the PeekInputConsole to be less
> blocking, something gives you the feel it should be reimplemented?
> Also, is it a good idea to copy the exe for tests and run on Windows to
> see how it goes?
> At least this showed something to me that my test and implementation
> seem to be wrong like when calling the function with nowait, and it is
> empty, the return should be false but GetLastError seems to be 0
You can call a function without public header, just move that prototype to console.c (either near the top, or just before ExA - I don't know what Wine code style says about that).
The race happens if two threads read from that console simultaneously, both with nowait; Peek returns for both, thread 1 calls Read, and thread 2 calls Read too and blocks because it's empty.
Tests should be run on Windows, yes. That's how we discover which behavior to implement in Wine.
We usually SetLastError(0xdeadbeef) before calling something that should (or shouldn't) set the last error, to make sure we're not seeing a leftover error from a previous operation.
If PeekW returns false, then you should return false too, not think you're in the *count=0 branch and return true.
The code style issue is probably the // comments, we use only /* in Wine. (Also it's spelled that, not tha.)
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/8137#note_104466
Hi there @epo thanks for the review!
As I could not find any auto formatting tool configured, I tried maintaining the formatting around the code I was changing, do you mind point me out where did you find it different?
I will change the calls to GetProcAddress, as there is no public header, this means that on console.c I cannot call the Wide function from ascii and just convert, right? Meaning I would need to implement the logic twice?
About being racy, reading the docs I did not see anything special about it, it seems like a wrapper around the PeekInputConsole to be less blocking, something gives you the feel it should be reimplemented?
Also, is it a good idea to copy the exe for tests and run on Windows to see how it goes?
At least this showed something to me that my test and implementation seem to be wrong like when calling the function with nowait, and it is empty, the return should be false but GetLastError seems to be 0
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/8137#note_104465
a couple of comments:
* please read and conform to [Wine Coding style](https://gitlab.winehq.org/wine/wine/-/wikis/Wine-Developer's-Guide/Coding-Practice#some-notes-about-style)
* AFAICT ReadConsoleInputEx\[AW\] isn't defined in Windows SDK so header files shouldn't be changed
* tests must reflect what Windows does, not what your implementation does (hence the generated failures in CI pipeline)
* this should be implemented using proper (new or modified) IOCTL:s; there's no way this API can be implemented on top of kernel32's one without being racy (as your proposal is). That's the reason why MS introduced this new API.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/8137#note_104458
The Aim of this MR is to fix https://bugs.winehq.org/show_bug.cgi?id=10941
In a nutshell:
- CUI app starts, and CRT inits its std streams from console,
- app calls FreeConsole() then AllocConsole() and expects the CRT I/O
functions to be able to output to newly created console.
It fails:
- when run with wineconsole, as the inherited std consoles are closed
in FreeConsole(). Added tests, but current implementation of kernelbase
is correct. So, the fix is to force wineconsole to pass unbound console
handles with standard inheritance (to they are not closed),
- when run from unix console, the std handles were also closed. There's
no unbound console in that case. The fix is not to close these
handles in FreeConsole().
- the other cases from the bug entry work because cmd was created with
unbound console handles.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/8136
I was able to replicate the issue seen in [Bug 58113](https://bugs.winehq.org/show_bug.cgi?id=58113) on my M1.
The issue stems from the usage of AudioDevicePropertyVolumeScalar, which the audio driver for the M1 does not support (at least so it appears.) Using AudioObjectIsPropertySettable allows for fast checking for this situation, including preemptively disabling main channel audio if it appears to be unsupported.
--
v2: winecoreaudio: revert unix_set_volumes from f46e9b8f120605d984f4ae14b4c815a67fbd1b59
https://gitlab.winehq.org/wine/wine/-/merge_requests/7920
1. For %fs/fsbase the patch follows the macOS logic with LDT descriptor registration and Linux with switching. One notable difference is that on 32->64 transition we set %fs to GSEL(GUFS32_SEL, SEL_UPL) before restoring fsbase, otherwise FreeBSD will just revert it by reloading the selector [at the first opportunity](https://github.com/freebsd/freebsd-src/blob/5673462af5330df207…. GSEL(GUFS32_SEL, SEL_UPL) is the default %fs value on FreeBSD and is special-cased to save/restore actual fsbase value to/from PCB.
2. I was told we could get rid of fsbase glitches in signal handlers by blocking signals with [sigfastblock(2)](https://man.freebsd.org/cgi/man.cgi?query=sigfastblock) between %fs reset to the default value and fsbase reset to pthread_teb. This is currently a part of internal API for libthr, which could be exposed as pthread_signal_block_np for Wine. I'm on the fence whether it's worth it.
3. I fully admit I have no idea what registers are worth preserving around fallback sysarch(AMD64_SET_FSBASE) syscalls and whether it's appropriate to push those registers to stack. ("Kernel" stack should be fine, I assume?) Syscalls definitely clobber r8-r11.
4. For %ss see https://lkml.org/lkml/2015/4/24/216. FreeBSD doesn't have a similar workaround in the kernel, so it goes into Wine.
--
v7: ntdll: Work around AMD SYSRET SS descriptor behavior on FreeBSD.
ntdll: Unbreak new wow64 mode on FreeBSD.
https://gitlab.winehq.org/wine/wine/-/merge_requests/8073
Allow messages after SetForegroundWindow returns. Kwin likes to resize
our window some more after d3d9 resized it.
Patch 2 makes the test stricter on Windows to give it some meaning.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/8132
--
v4: winex11: Reconfigure window even if the new rectangle equals to the old one.
winex11: Serialize window config requests with some other requests.
winex11: Serialize managed window config change requests.
winex11: Track window pending config position / size independently.
winex11: Serialize individual _NET_WM_STATE bit changes.
winex11: Continue requesting desired window state on no-op event.
https://gitlab.winehq.org/wine/wine/-/merge_requests/8079
CW* masks in window_set_config() are from comparing against the old rect from data->pending_state.rect,
not the actual X11 window rectangle. So it's still possible that after removing __NET_WM_STATE_FULLSCREEN,
WM moves the window behind Wine's back. Then window_set_config() calculates CW* masks and calls
XReconfigureWMWindow(), assuming the old rect is still the actual X11 window rect. As the result,
some rectangle updates might be missed.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/8128
Windows uses a smaller alignment than gstreamer for some formats, for
example NV12. This means we cannot use MFCalculateImageSize() to get the
output sample size. Commit 7b79e3a87b1e switched to calling it instead of
GetOutputStreamInfo() to fix some game bugs.
--
v4: winegstreamer: Call wg_format_get_max_size() to get the video decoder output sample size.
winegstreamer: Do not pass a sample size to wg_transform_read_mf().
mf/tests: Add a video processor NV12 test with a width alignment of 2.
https://gitlab.winehq.org/wine/wine/-/merge_requests/8034
Hi @yurih, from what I understand the reason alt(-tab) is problematic is because the alt menu mode is enabled when the key is released. However, avoiding the release just for this behavior doesn't seem like a viable way forward, since other applications may treat alt differently or may also require treating other keys the same way.
I was experimenting a bit and sending WM_CANCELMODE (which winex11 does already) seems to help with the alt(-tab) menu situation in my tests. Could you try the following and let me know if it helps with your use case:
```patch
--- a/dlls/winewayland.drv/wayland_keyboard.c
+++ b/dlls/winewayland.drv/wayland_keyboard.c
@@ -800,6 +800,11 @@ static void keyboard_handle_leave(void *data, struct wl_keyboard *wl_keyboard,
* and for any key repetition to stop. */
release_all_keys(hwnd);
+ if (hwnd == NtUserGetForegroundWindow())
+ {
+ if (!(NtUserGetWindowLongW(hwnd, GWL_STYLE) & WS_MINIMIZE))
+ send_message(hwnd, WM_CANCELMODE, 0, 0);
+ }
/* FIXME: update foreground window as well */
}
```
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/6199#note_104335
This MR fixes seek in VRChat by copying the sequence of flushes/stop/starts that Windows does.
The order on Windows is:
1. Stop sources;
2. Flush MFTs;
3. Start sources;
4. Request output down the chain of sink inputs;
6. Flush sinks; and
7. Start the clock
This takes place whether we pause before we seek or seek without pause.
Changes in version 2:
1. Add test to see when SAR requests new samples;
2. Add test to examine when step 4 from above takes place;
3. Adjust the seek implementation in `mf/session.c` to match findings from the new tests;
4. Adjust `mfmediaengine` to reflect findings from the new tests;
5. Refactored `if` statement in `session_start` to be a `switch` again
--
v3: mfmediaengine: Request sample if we are seeking.
mfmediaengine: Don't perform implicit flush on state change.
mf: Don't send MFT_MESSAGE_NOTIFY_START_OF_STREAM when seeking.
mf: Restart transforms and sinks on seek.
mf/tests: Test sequence of calls during a Pause and Seek.
mf/tests: Test when SAR requests a new sample.
https://gitlab.winehq.org/wine/wine/-/merge_requests/7932
Windows uses a smaller alignment than gstreamer for some formats, for
example NV12. This means we cannot use MFCalculateImageSize() to get the
output sample size. Commit 7b79e3a87b1e switched to calling it instead of
GetOutputStreamInfo() to fix some game bugs.
--
v3: winegstreamer: Call wg_format_get_max_size() to get the video decoder output sample size.
winegstreamer: Do not pass a sample size to wg_transform_read_mf().
mf/tests: Add a video processor NV12 test with a width alignment of 2.
mfplat/tests: Add NV12 650 x 850 to image_size_tests.
https://gitlab.winehq.org/wine/wine/-/merge_requests/8034
--
v3: winewayland: Use win32u for EGL display and pixel formats.
wineandroid: Use win32u for EGL display and pixel formats.
win32u: Implement OpenGL pixel formats over EGL configs.
win32u: Introduce an EGL opengl_driver_function table.
winewayland: Use the EGL display opened from win32u.
wineandroid: Use the EGL display opened from win32u.
win32u: Open and initialize an EGL platform display.
https://gitlab.winehq.org/wine/wine/-/merge_requests/8115
On Fri May 23 00:45:26 2025 +0000, Zhiyi Zhang wrote:
> The reason why something like this didn't exist before is that after the
> monitor changes, the old Xinerama monitor index might be different than
> the new ones. For example, changing the secondary monitor from right to
> left and then making the secondary monitor primary using the host
> system's utilities. We can probably invalidate the old monitor Xinerama
> indices after a device change.
Oh I see. The reason for this is to reduce the number of requests sent as much as possible, in case they would somehow trigger things like window reconfigure from the window manager side. I'll look into invalidating the data on device change.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/8123#note_104297
Ralf Habacker (@rhabacker) commented about dlls/ws2_32/socket.c:
> return -1;
> }
> params->unknown = 0;
> - memcpy( ¶ms->addr, addr, len );
> + if (addr->sa_family == AF_UNIX)
> + memset( ¶ms->addr, 0, len );
> + memcpy( ¶ms->addr, addr, bind_len );
> + if (unix_path)
Here a comment should be added, that in case of AF_UNIX sockets the unix path is appended as second string to `params->addr`.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7650#note_104293
On Fri May 23 04:23:45 2025 +0000, Alexandre Julliard wrote:
> > There is probably some tiny DVD somewhere in the world that will still
> be misdetected, but I'm not sure that issuing SCSI commands to the drive
> to try to determine the disc type would be any more reliable.
> To support an app that is most likely going to issue DVD ioctls,
> checking by using a DVD ioctl seems preferable.
Linux has only three [DVD ioctls](https://docs.kernel.org/userspace-api/ioctl/cdrom.html): DVD_READ_STRUCT, DVD_WRITE_STRUCT, and DVD_AUTH. It has no blu-ray ioctls. Of the three DVD ioctls, only DVD_READ_STRUCT would be suitable for disc type detection.
DVD_READ_STRUCT can read five kinds of information: DVD_STRUCT_PHYSICAL, DVD_STRUCT_COPYRIGHT, DVD_STRUCT_DISCKEY, DVD_STRUCT_BCA, and DVD_STRUCT_MANUFACT. Of those five, only DVD_STRUCT_PHYSICAL would be suitable for disc type detection.
At least on my LG WH16NS40 drive, DVD_STRUCT_PHYSICAL succeeds when there is a DVD in the drive, but it fails when there is a CD or a blu-ray in the drive. That means that we could use DVD_STRUCT_PHYSICAL to accurately detect whether there is a DVD in the drive, but we would still need another way to detect blu-rays.
Is there another ioctl that you had in mind, or something else that I missed? Do you want to try DVD_STRUCT_PHYSICAL first and fall back to guessing based on the data size if it fails? Please let me know how to proceed.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7747#note_104292
Zhiyi Zhang (@zhiyi) commented about dlls/winex11.drv/window.c:
> return;
>
> xinerama_get_fullscreen_monitors( &data->rects.visible, monitors );
> + memcpy( data->desired_state.monitors, monitors, sizeof(monitors) );
> + if (!memcmp( old_monitors, monitors, sizeof(monitors) )) return; /* states are the same, nothing to update */
The reason why something like this didn't exist before is that after the monitor changes, the old Xinerama monitor index might be different than the new ones. For example, changing the secondary monitor from right to left and then making the secondary monitor primary using the host system's utilities. We can probably invalidate the old monitor Xinerama indices after a device change.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/8123#note_104289
This consolidates the two separate `CGImage`s (`colorImage` and `shapeImage`) previously used in `WineContentView` into a single `IOSurface` that also holds the window mask information in its alpha channel now.
The alpha channel is now being updated in `macdrv_surface_flush`, whenever the shape changes (and stores that change for the next update, to also keep the front buffer in sync).
This reduces the delay from setting a `CGImage` to a layer from 50ms to about 1.5ms in the `IOSurface` case (also accounting for `vImageSelectChannels_ARGB8888` operation).
Based on a patch by @bshanks.
I am already putting it out for feedback, but I will so some more testing to see how the performance impact of this is and do more exhaustive testing with shaped windows.
Ideally the double buffer solution can be avoided as well... Also the `HBITMAP` for the windows is currently backed by a `CGDataProviderRef` and could also become an `IOSurface` I believe.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7938
1. For %fs/fsbase the patch follows the macOS logic with LDT descriptor registration and Linux with switching. One notable difference is that on 32->64 transition we set %fs to GSEL(GUFS32_SEL, SEL_UPL) before restoring fsbase, otherwise FreeBSD will just revert it by reloading the selector [at the first opportunity](https://github.com/freebsd/freebsd-src/blob/5673462af5330df207…. GSEL(GUFS32_SEL, SEL_UPL) is the default %fs value on FreeBSD and is special-cased to save/restore actual fsbase value to/from PCB.
2. I was told we could get rid of fsbase glitches in signal handlers by blocking signals with [sigfastblock(2)](https://man.freebsd.org/cgi/man.cgi?query=sigfastblock) between %fs reset to the default value and fsbase reset to pthread_teb. This is currently a part of internal API for libthr, which could be exposed as pthread_signal_block_np for Wine. I'm on the fence whether it's worth it.
3. I fully admit I have no idea what registers are worth preserving around fallback sysarch(AMD64_SET_FSBASE) syscalls and whether it's appropriate to push those registers to stack. ("Kernel" stack should be fine, I assume?) Syscalls definitely clobber r8-r11.
4. For %ss see https://lkml.org/lkml/2015/4/24/216. FreeBSD doesn't have a similar workaround in the kernel, so it goes into Wine.
--
v5: ntdll: Unbreak new wow64 mode on FreeBSD.
https://gitlab.winehq.org/wine/wine/-/merge_requests/8073
1. For %fs/fsbase the patch follows the macOS logic with LDT descriptor registration and Linux with switching. One notable difference is that on 32->64 transition we set %fs to GSEL(GUFS32_SEL, SEL_UPL) before restoring fsbase, otherwise FreeBSD will just revert it by reloading the selector [at the first opportunity](https://github.com/freebsd/freebsd-src/blob/5673462af5330df207…. GSEL(GUFS32_SEL, SEL_UPL) is the default %fs value on FreeBSD and is special-cased to save/restore actual fsbase value to/from PCB.
2. I was told we could get rid of fsbase glitches in signal handlers by blocking signals with [sigfastblock(2)](https://man.freebsd.org/cgi/man.cgi?query=sigfastblock) between %fs reset to the default value and fsbase reset to pthread_teb. This is currently a part of internal API for libthr, which could be exposed as pthread_signal_block_np for Wine. I'm on the fence whether it's worth it.
3. I fully admit I have no idea what registers are worth preserving around fallback sysarch(AMD64_SET_FSBASE) syscalls and whether it's appropriate to push those registers to stack. ("Kernel" stack should be fine, I assume?) Syscalls definitely clobber r8-r11.
4. For %ss see https://lkml.org/lkml/2015/4/24/216. FreeBSD doesn't have a similar workaround in the kernel, so it goes into Wine.
--
v4: ntdll: Unbreak new wow64 mode on FreeBSD.
https://gitlab.winehq.org/wine/wine/-/merge_requests/8073