Based on !9515 (this MR is a draft until the first part is accepted).
This is most of the logic of partial presentation. D3D11 only.
Remaining parts:
1. Support for multiple rectangles. Requires changes to command stream and swapchain present op (GL, VK, GDI). I have it implemented, but I'm not confident in my implementation, so it must be a separate review.
2. Scroll. Simple grep.app search shows very little use. Neither Firefox nor Chromium use that. Windows Terminal is the most prominent. So this is low priority (though I have it implemented, it's not very difficult).
3. D3D12. I know of no apps that do partial presentation with D3D12. Most of my experience is with D2D & DComp, I barely have experience with D3D11, D3D12 is even more complicated, so I do not plan on implementing it.
4. Other scaling modes (see TODO). I don't think Wine implements them for D3D11.
5. Performance improvement? Right now dirty backbuffer regions are always tracked for correctness. I bet Windows does it better in the most common cases when there is no partial presentation.
--
v2: wined3d: Initial partial present implementation
wined3d: Track the dirty regions of the swapchain backbuffers
https://gitlab.winehq.org/wine/wine/-/merge_requests/9518
Based on !9515 (this MR is a draft until the first part is accepted).
This is most of the logic of partial presentation. D3D11 only.
Remaining parts:
1. Support for multiple rectangles. Requires changes to command stream and swapchain present op (GL, VK, GDI). I have it implemented, but I'm not confident in my implementation, so it must be a separate review.
2. Scroll. Simple grep.app search shows very little use. Neither Firefox nor Chromium use that. Windows Terminal is the most prominent. So this is low priority (though I have it implemented, it's not very difficult).
3. D3D12. I know of no apps that do partial presentation with D3D12. Most of my experience is with D2D & DComp, I barely have experience with D3D11, D3D12 is even more complicated, so I do not plan on implementing it.
4. Other scaling modes (see TODO). I don't think Wine implements them for D3D11.
5. Performance improvement? Right now dirty backbuffer regions are always tracked for correctness. I bet Windows does it better in the most common cases when there is no partial presentation.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/9518
Presently the wine file explorer has a create shortcut entry that does nothing. This implements the FCIDM_SHVIEW_CREATELINK command.
This is a patch that was first submitted in 2017 and I unfortunately let the revision request fall unimplemented.
--
v9: shell32: Implement FCIDM_SHVIEW_CREATELINK
https://gitlab.winehq.org/wine/wine/-/merge_requests/5373
--
v3: dmsynth: Use a factor of 1/10 for modulation LFO x channel pressure -> gain connections.
dmsynth: Handle channel pressure events.
dmsynth: Don't add 1000 to the sustain modulators.
dmsynth: Use 0.1% as the sustain level unit.
dmsynth/tests: Add DLS tests.
https://gitlab.winehq.org/wine/wine/-/merge_requests/9506
--
v2: xactengine3/tests: Test wavebank type mismatch.
xactengine3/tests: Test SetMatrixCoefficients() channel counts.
xactengine3/tests: Test variables.
xactengine3/tests: Test renderer details.
https://gitlab.winehq.org/wine/wine/-/merge_requests/9453
Pretty much the same kind of thing Proton does, this is only for non-shared semaphores for now.
This creates timeline events backed by host timeline semaphores, for every wait and signal operation on a client timeline semaphore. Events are host timeline semaphores with monotonically increasing values. One event is a `(host semaphore, value)` unique tuple, and their value is incremented every time they get signaled. They can be reused right away as a different event, with the new value. Signaled events are queued to a per-device event list for reuse, as we cannot safely destroy them [^1] and as creating them might be costly.
A thread is spawned for every device that uses timeline semaphores, monitoring the events and semaphore value changes. The semaphore wrapper keeps the current client semaphore value, which is read directly by `vkGetSemaphoreCounterValue`.
CPU and GPU waits on the client semaphore are swapped with a wait on a timeline event, and GPU signals with a signal on a timeline event. CPU signals simply update the client semaphore value on the wrapper, signaling the timeline thread to check and notify any waiter. The timeline thread waits on signal events, coming from the GPU, and on a per-device semaphore for CPU notifications (wait/signal list updates, CPU-side signal). It will then signal any pending wait for a client semaphore value that has been reached, and removes timed out waits.
---
For shared semaphores my idea is to use the client timeline semaphore host handle itself as a signal to notify other device threads of semaphore value changes, as the host semaphore is what is exported and imported in other devices. The timeline threads would wait on that semaphore too in addition to the signal events and thread notification semaphore.
The main issue with shared semaphores actually comes from sharing the client semaphore values, so that they can be read from each device timeline threads as well as from other processes. There's two scenarios to support, one that is for in-process sharing which could perhaps keep the information locally, but we also need to support cross-process sharing so I think there's no other way than to involve wineserver.
My idea then is to move shared semaphore client value to wineserver, which will cost a request on every signal and wait (and reading the value for waits could later be moved to a shared memory object). This will also allow us to implement `D3DKMTWaitForSynchronizationObjectFromCpu` which might be useful for D3D12 fence implementation as it'll allow us to translate a timeline semaphore wait to an asynchronous NT event signal.
[^1]: Vulkan spec indicates that semaphores may only be destroyed *after* every operation that uses them has fully executed, and it's unclear whether signaling or waiting a semaphore is enough as an indicator for full execution or whether we would need to wait on a submit fence.
--
v2: win32u: Implement timeline semaphore rewinding support.
win32u: Make a copy of the timeline semaphore value arrays.
win32u: Spawn a device thread for timeline semaphores.
win32u: Hook more vulkan timeline semaphore functions.
https://gitlab.winehq.org/wine/wine/-/merge_requests/9510
Pegasus Mail posts a WM_USER + 8991 message to its own window when it
loses focus, then calls SetFocus on its window when processing this
message. Several other applications have been seen calling SetWindowPos
during WM_ACTIVATE message, which might also attempt to reactivate the
window.
That processing happens shortly after we have changed the foreground
window to the desktop window, when focus is lost, then SetFocus tries
to change the foreground window again.
This SetFocus behavior is tested, and should work like this, but would
only activate the window if the process is allowed to do so. Windows has
various rules around this, and it seems to boil down to something like:
* Allow taking focus if the process never was foreground, ie: when
process is starting and gets initial focus on its windows.
* Allow taking focus if the process was foreground but lost it recently
because of a window being destroyed.
* Forbid taking focus back if the process had foreground and called
SetForegroundWindow explicitly to give it to another process.
This doesn't implement all this rules, but rather keep rely on the host
window management with some additional heuristics to avoid activating
windows which lost foreground recently. This is mostly about keeping
track of user input time, updating it on user input and on focus change.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=58167
---
I think this should be enough to prevent spurious window reactivation, either
from calls to SetWindowPos during WM_ACTIVATE messages like in https://gitlab.winehq.org/wine/wine/-/merge_requests/9398
or from calls to SetFocus from posted messages right after window deactivation
as described above.
Fwiw we could have tests for that, and show that this MR is fixing them but fvwm
doesn't implement window minimization properly, and doesn't change focus when
window is minimized, so the tests would be meaningless.
--
v2: server: Forbid background process window reactivation.
server: Set NULL foreground input when switching to desktop window.
win32u: Introduce a NtUserSetForegroundWindowInternal call.
https://gitlab.winehq.org/wine/wine/-/merge_requests/9511