Split from https://gitlab.winehq.org/wine/wine/-/merge_requests/576, for which I'll then add modes sorting, and move support for stretched / interlaced modes from winemac to win32u.
--
v2: win32u: Only read/write valid mode fields from/to the registry.
win32u: Use current mode position if desired mode doesn't specify it.
win32u: Always copy devmode in validate_display_settings.
win32u: Read registry or current mode when validation needs it.
win32u: Do not keep display modes driver extra in the registry.
https://gitlab.winehq.org/wine/wine/-/merge_requests/665
Bug introduced in !600.
```
00dc:trace:alsa:AudioClient_GetService (00A53680)->({cd63314f-3fba-4a1b-812c-ef96358728e7}, 0022FCB0)
00dc:trace:alsa:AudioClient_AddRef (00A53680) Refcount now 2
00dc:trace:alsa:AudioClock_GetFrequency (00A53680)->(0022FCC8)
render.c:1056: Clock Frequency 384000
00dc:trace:alsa:AudioClock_GetPosition (00A53680)->(00000000, 00000000)
00dc:trace:alsa:AudioClock_GetPosition (00A53680)->(0022FCD0, 0022FCD8)
00dc:trace:alsa:alsa_get_position frames written: 0, held: 0, state: 0x2, position: 0
render.c:1071: Test failed: GetPosition failed: 00423930
render.c:1072: Test failed: GetPosition returned non-zero pos before being started
render.c:1073: Test failed: GetPosition returned zero pcpos
00dc:trace:alsa:AudioClient_GetService (00A53680)->({f294acfc-3146-4483-a7bf-addca7c260e2}, 0022FCB4)
00dc:trace:alsa:AudioClient_AddRef (00A53680) Refcount now 3
00dc:trace:alsa:AudioRenderClient_GetBuffer (00A53680)->(24001, 0022FCC0)
```
And the test hangs.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/687
foobar2000.exe's UPnP Media Renderer component (foo_out_upnp.dll)
expects that, if a select() call completes successfully with a non-empty
writefds set, any immediately following send() call on a socket in the
writefds set never fails with WSAEWOULDBLOCK.
On Wine, the Winsock select() and send() implementations both call the
Unix poll(2) under the hood to test if I/O is possible on the socket.
As it turns out, it's entirely possible that Unix poll() may yield
POLLOUT on the first call (for select) but *not* the second (for send),
even if no send() call has been made in the meanwhile.
On Linux (as of v5.19), a connected (ESTABLISHED) TCP socket that has
not been shut down indicates the (E)POLLOUT condition only if the ratio
of sk_wmem_queued (the amount of bytes queued in the send buffer) to
sk_sndbuf (the size of send buffer size itself, which can be retrieved
via SO_SNDBUF) is below a certain threshold. Therefore, a falling edge
in POLLOUT can be triggered due to a number of reasons:
1. TCP retransmission and control packets (e.g. MTU probing). Such
packets share the same buffer with application-initiated packets,
and thus counted in sk_wmem_queued_add just like application data.
See also: sk_wmem_queued_add() callers (Linux 5.19).
2. Memory pressure. This causes sk_sndbuf to shrink.
See also: sk_stream_moderate_sndbuf() callers (Linux 5.19).
Fix this by always attempting synchronous I/O first if the nonblocking
flag is set.
Note: for diagnosis, `getsockopt(fd, SOL_SOCKET, SO_MEMINFO, ...)` can be
used to retrieve both sk_wmem_queued (the amount of bytes queued in the
send buffer) and sk_sndbuf (the size of the send buffer itself, which
can also be retrieved via SO_SNDBUF).
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/617