Rémi Bernon (@rbernon) commented about dlls/winemac.drv/keyboard.c:
> done:
> /* Null-terminate the buffer, if there's room. MSDN clearly states that the
> caller must not assume this is done, but some programs (e.g. Audiosurf) do. */
> - if (1 <= ret && ret < bufW_size)
> - bufW[ret] = 0;
> + if (0 <= len && len < bufW_size)
```suggestion:-0+0
if (len < bufW_size)
```
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/5319#note_73910
Rémi Bernon (@rbernon) commented about dlls/winemac.drv/keyboard.c:
> &savedDeadKeyState, bufW_size, &len, bufW);
> if (status != noErr)
> {
> - ERR_(key)("Couldn't translate keycode 0x%04x, status %d\n", keyc, status);
> + ERR_(key)("Couldn't translate dead keycode 0x%04x, status %d\n", keyc, status);
> goto done;
> }
>
> + if (len >= 1)
Same, doesn't seem to be necessary? If len is 0, and dead = TRUE, we just return 0 anyway?
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/5319#note_73909
This is part VIII of cmd engine rewrite.
It covers:
- introduction of a token based parser. For now, it produces the same
(degenerated) list of commands as we currently do.
Note: I opted for a pull mode for the parser while the lexer is in
push mode. Long term plan is to move the lexer into pull mode too
(and also converge the two different current methods of
argument/token access).
- introduction of return codes. It's not obvious from current tests
that lots of these codes are actually the kernel32 ones, but tests
in later MRs will clearly show it.
- starting changing 'exit' and 'goto' builtin implementations to use
return code. All builtins will have to adopt that scheme for
command chaining to be properly supported.
- add delayed expansion for IF command. That's not needed for now
(as single command execution already takes care of it), but will be
needed when we move IF and FOR commands out of single command in yet
to come MR.
Includes some test to cover that part.
(in case someone asks, it was needed in previous MR regarding the
FOR command, as the delayed expansion was only called on the body
of the FOR command, not the control block)
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/5903
With [`VK_EXT_device_address_binding_report`](https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_device_address_binding_report.html) we can get [debug_util](https://registry.khronos.org/vulkan/specs/1.3-extensions/man/ht… callbacks used to track memory bindings. Since it's the host's implementation that starts the callback we have to be sure that we have a way of converting it to the client side's variant before it's added to the handle map - i.e. we don't know the host handle at that time yet.
This is [used by vkd3d-proton](https://github.com/HansKristian-Work/vkd3d-proton/pull/1962). Requires Mesa with https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28649.
before (note the missing BIND for VkDevice which actually means `VkDeviceMemory`):
```
vkd3d-proton % VKD3D_TEST_FILTER=create_placed_resource_size VKD3D_CONFIG=fault VKD3D_DEBUG=trace ~/src/wine/build/wine ./tests/d3d12.exe 2>&1 | grep vkd3d_address_binding_callback
trace:vkd3d-proton:vkd3d_address_binding_callback: BIND || VkBuffer || VA ffff800100200000 || size 0000000001000000.
trace:vkd3d-proton:vkd3d_address_binding_callback: BIND || VkImage || VA ffff800100200000 || size 000000000019a000.
trace:vkd3d-proton:vkd3d_address_binding_callback: UNBIND || VkImage || VA ffff800100200000 || size 000000000019a000.
trace:vkd3d-proton:vkd3d_address_binding_callback: UNBIND || VkBuffer || VA ffff800100200000 || size 0000000001000000.
:trace:vkd3d-proton:vkd3d_address_binding_callback: UNBIND || VkDevice || VA ffff800100200000 || size 0000000001000000.
232285.553:0020:0024:trace:vkd3d-proton:vkd3d_address_binding_callback: BIND || VkBuffer || VA ffff800100200000 || size 0000000001000000.
232285.553:0020:0024:trace:vkd3d-proton:vkd3d_address_binding_callback: UNBIND || VkBuffer || VA ffff800100200000 || size 0000000001000000.
232285.553:0020:0024:trace:vkd3d-proton:vkd3d_address_binding_callback: UNBIND || VkDevice || VA ffff800100200000 || size 0000000001000000.
```
after:
```
% VKD3D_TEST_FILTER=create_placed_resource_size VKD3D_CONFIG=fault VKD3D_DEBUG=trace ~/src/wine/build/wine ./tests/d3d12.exe 2>&1 | grep vkd3d_address_binding_callback
232338.036:0020:0024:trace:vkd3d-proton:vkd3d_address_binding_callback: BIND || VkDevice || VA ffff800100200000 || size 0000000001000000.
232338.036:0020:0024:trace:vkd3d-proton:vkd3d_address_binding_callback: BIND || VkBuffer || VA ffff800100200000 || size 0000000001000000.
232338.037:0020:0024:trace:vkd3d-proton:vkd3d_address_binding_callback: BIND || VkImage || VA ffff800100200000 || size 000000000019a000.
232338.037:0020:0024:trace:vkd3d-proton:vkd3d_address_binding_callback: UNBIND || VkImage || VA ffff800100200000 || size 000000000019a000.
232338.037:0020:0024:trace:vkd3d-proton:vkd3d_address_binding_callback: UNBIND || VkBuffer || VA ffff800100200000 || size 0000000001000000.
232338.037:0020:0024:trace:vkd3d-proton:vkd3d_address_binding_callback: UNBIND || VkDevice || VA ffff800100200000 || size 0000000001000000.
232338.037:0020:0024:trace:vkd3d-proton:vkd3d_address_binding_callback: BIND || VkDevice || VA ffff800100200000 || size 0000000001000000.
232338.037:0020:0024:trace:vkd3d-proton:vkd3d_address_binding_callback: BIND || VkBuffer || VA ffff800100200000 || size 0000000001000000.
232338.037:0020:0024:trace:vkd3d-proton:vkd3d_address_binding_callback: UNBIND || VkBuffer || VA ffff800100200000 || size 0000000001000000.
232338.037:0020:0024:trace:vkd3d-proton:vkd3d_address_binding_callback: UNBIND || VkDevice || VA ffff800100200000 || size 0000000001000000.
```
[The spec guarantees](https://registry.khronos.org/vulkan/specs/1.3-extensions/html/v… the following:
> An application can receive multiple callbacks if multiple VkDebugUtilsMessengerEXT objects are created. A callback will always be executed in the same thread as the originating Vulkan call.
As of TLS I went with a suggestion from IRC:
```
<ivyl_> There's an issue with how we handle callbacks related to VK_EXT_debug_utils and VK_EXT_debug_report. In wine_vkAllocateMemory() we call device->funcs.p_vkAllocateMemory() which may execute callback.
<ivyl_> At this point we still don't have handle mapping added because we don't know what host_memory handle will be.
<ivyl_> AFAIU there's a spec guarantee that callback will be executed in the same thread as the call causing it, so I was thinking about maybe keeping `memory` in a tls (if enable_wrapper_list) and using that?
<ivyl_> but that's I don't see any precedent of using thread local storage on the unix side
<ivyl_> tls value would be short-lived in such case - only for the duration of the call to `device->funcs.p_vkAllocateMemory()`
<jacekc_> we usually use teb on unix side, see ntuser_thread_info
```
--
v2: winevulkan: Make device memory wrapper available in callbacks.
https://gitlab.winehq.org/wine/wine/-/merge_requests/5658
The current implementation enqueues the vkQueuePresentKHR() command after waiting on a fence which was enqueued where this command should go. However, this occurs in a worker thread to avoid deadlock, so an arbitrary number of additional commands may be enqueued before vkQueuePresentKHR(). I haven't found a specific scenario where this is a problem, but it is not desirable if we can avoid it.
This new implementation is just an RFC; it won't build because the vkd3d function is missing. That can be found [here](https://gitlab.winehq.org/cmccarthy/vkd3d/-/blob/present/libs/vkd3d/c… but I haven't raised an MR. The DXGI side meets all requirements: vkAcquireNextImageKHR() blocks there, but the driver unblocks it so deadlock is not possible. The vkd3d function waits only for the command queue op mutex and cannot deadlock either. The overall implementation should be less fragile, and doesn't need a worker thread.
A few days ago I saw a performance increase in HZD from reverting DXGI to before the worker was added, but have never seen this again. Performance differences are minimal between old, current and this one.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/5851
On Fri Jun 21 05:51:22 2024 +0000, Conor McCarthy wrote:
> changed this line in [version 2 of the diff](/wine/wine/-/merge_requests/5830/diffs?diff_id=118898&start_sha=0a098294aa1607350d8e382416546fe945fac98b#b8e9f5f67cc13143a0928d1e76d7519d0bab1bc3_1773_1764)
I removed this from the MR as I think it should be separate. We need one semaphore per Vulkan image. Indexing the semaphore array is an issue because we have no `vk_image_index`, but `frame_number % swapchain->buffer_count` may be ok.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/5830#note_73880
On Fri Jun 21 05:51:23 2024 +0000, Conor McCarthy wrote:
> changed this line in [version 2 of the diff](/wine/wine/-/merge_requests/5830/diffs?diff_id=118898&start_sha=0a098294aa1607350d8e382416546fe945fac98b#b8e9f5f67cc13143a0928d1e76d7519d0bab1bc3_1282_1269)
I replaced this with a wait for the blit before returning from `d3d12_swapchain_present()`. After a call to Present() returns, the client can render to the next buffer in sequence, so we must wait for completion of the blit read of that buffer. The old version using `vkAcquireNextImageKHR()` is not strict enough. HZD with vsync has frame pacing issues in some parts of the benchmark even on the old implementation, and this makes it a little bit worse. We can't really avoid that though, and the best fix is to improve frame times in vkd3d.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/5830#note_73879
On Mon Jun 17 17:07:40 2024 +0000, Elizabeth Figura wrote:
> Without doing any research myself... the other side is going to try to
> enter the logic immediately [within SleepConditionVariableCS()] assuming
> it's waiting, and I think usually wakes are fast enough [at least on
> Linux] that the other thread will generally start executing before you
> even return from the wake function.
> Besides a poorly communicated warning that doesn't apply here, the first
> comment in [1] also claims that it defeats a "wait morphing"
> optimization, where instead of actually waking threads they're just
> moved from the CV waitqueue to the mutex wait queue [if their associated
> mutex is locked [by the calling thread?]]. That's not something we
> currently implement in Wine; it may be possible to implement later though...
> [1] https://stackoverflow.com/questions/52503361/unlock-the-mutex-after-conditi…
I do see a small but measurable performance gain in HZD. It's only 0.7%, but that shoud be weighed that against the very simple change needed to gain it.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/5830#note_73878
The last commit fixes glitches in Horizon Zero Dawn with vsync on, for reasons stated in the comment there.
The wined3d implementation already blocks the client's call to `Present()` when `vkAcquireNextImageKHR()` blocks, so is roughly equivalent to this when frame latency and buffer count are equal. It has a frame latency implementation which unblocks after calling `vkQueuePresentKHR()`, rather than waiting for its execution to complete. I think the d3d12 implementation is supposed to do the latter, though using `KHR_present_wait` may be unnecessary overkill. Waiting on queue execution comes with a performance cost either way, so without a compelling reason for a strict implementation, something similar to wined3d makes sense.
Another potential issue is after the call to `ID3D12CommandQueue_Signal()` in `d3d12_swapchain_present()`, the client is free to enqueue more commands when `Present()` returns, so by the time the signal is executed and the swapchain worker blits the image and calls `vkQueuePresentKHR()`, these commands are not necessarily enqueued immediately after the `Signal()`. This may not always be harmless.
--
v2: dxgi: Wait for completion of a pending read of the next buffer before returning from d3d12_swapchain_Present().
dxgi: Wake the condition variable after leaving the critical section in d3d12_swapchain_resize_buffers().
dxgi: Wake the condition variable after leaving the critical section in d3d12_swapchain_present().
https://gitlab.winehq.org/wine/wine/-/merge_requests/5830
Huh. Okay.
I've seen some of those discussions, and something in them did indeed feel strange. (I never understood the context well enough to determine exactly what, and it's not my place to question that, anyways.)
I'll miss you 💔
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/5886#note_73870
After an X11 event handler queues messages to another thread, TRUE should be returned and eventually
propagated to X11DRV_ProcessEvents().
When FALSE is always returned in xrandr14_device_change_handler(), a possible hang can happen for
the desktop message queue as follows:
1. The explorer.exe calls GetMessageW() -> NtUserGetMessage() -> wait_objects() -> wait_message().
2. In wait_message(), user_driver->pProcessEvents() gets called in the desktop window thread to
handle RRNotify events and calls xrandr14_device_change_handler() -> display_mode_changed(FALSE)
-> send_message(get_desktop_window(), WM_DISPLAYCHANGE, ...) -> desktop_window_proc() ->
send_message_timeout() -> send_client_message() -> process_message() -> broadcast_message() ->
send_message_timeout() -> send_client_message() -> process_message() -> send_inter_thread_message()
-> wait_message_reply() -> a server set_queue_mask() with skip_wait being 1 -> wake_mask and
changed_mask are set to 0.
3. In wait_message(), user_driver->pProcessEvents() returns FALSE from xrandr14_device_change_handler().
So wait_message() continues to call NtWaitForMultipleObjects().
4. Now NtWaitForMultipleObjects() hangs for INFINITE timeout because wake_mask and changed_mask
for the message queue are set to 0 so the thread is not woke up.
The hang is sensitive to message ordering and only happens in this specific case so it's hard to
reproduce with tests. I believe some of the past test timeouts on TestBots can be attributed to this
bug.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/5890
> I don't want to be a blocker but to be honest I'm a bit annoyed with the idea of having to rewrite the patches I am trying to upstream with transform media types.
I'm going to delay making changes to wg_transform until you upstream your transform patches. I can concentrate on implementing the frontside first. So I'll simply remove patch 3,4,5 in this MR for now.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/5879#note_73808
On Wed Jun 19 15:58:14 2024 +0000, Elizabeth Figura wrote:
> > Can we add an encoder element without changing all this code? It
> doesn't look like you need all the complicated converter sequence, maybe
> only a videoconvert (do you even need one?).
> Yeah, in general the idea that we'd want the same sequence for decoding
> and encoding is probably wrong. E.g. for decoding we may want
> deinterlace, but we certainly don't want that for encoding. It's
> probably better to handle them separately.
Yeah, we can make things easy for encoder for now, only creating encoder element.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/5879#note_73807
LLVM 17 or 18 no longer allow non-private labels to appear between
.cfi_startproc/endproc when targeting Mach-O.
Similar fixes as in commit 295d521b11644fb76c36854336b13c2155bb7d79.
Since this is needed for 2 out of 4 architectures, would it be better to do it for all 4 and then modify the shared `__wine_syscall_dispatcher_return()` prototype?
--
v2: ntdll: Make __wine_syscall_dispatcher_return a separate function to fix Xcode 16 build errors.
https://gitlab.winehq.org/wine/wine/-/merge_requests/5871
I have been instructed by CodeWeavers, on behalf of the CodeWeavers and Wine
leadership, to resign my position as winegstreamer maintainer.
This comes because I have, for technical reasons, rejected or requested changes
to several winegstreamer patches. While these technical objections have not been
responded to, it is believed, in this case, committing patches tested against a
wide range of games, and avoiding a difference against the Proton project,
outweighs all technical problems I may potentially find.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/5886
Instead of accessing the surface with macdrv_get_surface_display_image.
--
v7: winemac: Remove unnecessary surface_clip_to_visible_rect.
winemac: Remove now unnecessary cocoa window surface pointer.
winemac: Push window surface image updates to the main thread.
winemac: Create window surface CGImageRef on surface flush.
winemac: Create a provider for the surface and a HBITMAP wrapping it.
winemac: Remove unused macdrv_get_surface_display_image copy_data parameter.
https://gitlab.winehq.org/wine/wine/-/merge_requests/5798
Instead of accessing the surface with macdrv_get_surface_display_image.
--
v6: winemac: Clip the surface rectangles to the virtual screen rect.
winemac: Remove unnecessary surface_clip_to_visible_rect.
winemac: Remove now unnecessary cocoa window surface pointer.
winemac: Push window surface image updates to the main thread.
winemac: Create window surface CGImageRef on surface flush.
winemac: Create a provider for the surface and a HBITMAP wrapping it.
winemac: Remove unused macdrv_get_surface_display_image copy_data parameter.
https://gitlab.winehq.org/wine/wine/-/merge_requests/5798
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56698
--
v9: quartz/tests: Test that avi_decompressor_source_qc_Notify does not deadlock if called from a foreign thread during IMemInput_Receive.
quartz: Allow concurrent calls to AVI decoder qc_Notify and Receive.
msvfw32/tests: Test that Cinepak rejects unsupported output types.
iccvid: Reject unsupported output types.
quartz/tests: Add Cinepak test to avi splitter.
winegstreamer: Make AVI splitter use end of previous frame if the current frame doesn't have a timestamp.
winegstreamer: Implement AM_MEDIA_TYPE to wg_format converter for Cinepak video.
https://gitlab.winehq.org/wine/wine/-/merge_requests/5744
For all mach vm operations this removes the task suspend and resume, which are not needed.
This uses `mach_vm_read_overwrite` to read into a caller-specified buffer, saving the `mach_vm_deallocate` call (bringing all read operations down to 1 syscall from 4).
The only alignment restriction on `mach_vm_write` according to the original CMU documentation is that data is
> [pointer to page aligned in array of bytes] An array of data to be written.
(In practice it also works with arbitrary addresses on macOS, but it probably doesn't hurt to follow the original specifications here).
The only other reference that these read/writes should be page-aligned is from the GNU Hurd documentation
> The current implementation requires that address, data and data_count all be page-aligned. Otherwise, KERN_INVALID_ARGUMENT is returned.
which I assume was the reason why this was originally done (plus it sounds to me like they will fix that in the future and 4fe19777 already broke GNU Hurd support anyways, if that was supposed to be working).
Also this includes the missing mach part of 5b1f3b14, which was only applied to the ptrace backend, and together with the `write_process_memory` rework, this gets rid of all fixmes in mach.c
--
v6: server: Simplify mach write_process_memory.
https://gitlab.winehq.org/wine/wine/-/merge_requests/4826
> Can we add an encoder element without changing all this code? It doesn't look like you need all the complicated converter sequence, maybe only a videoconvert (do you even need one?).
Yeah, in general the idea that we'd want the same sequence for decoding and encoding is probably wrong. E.g. for decoding we may want deinterlace, but we certainly don't want that for encoding. It's probably better to handle them separately.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/5879#note_73748
On Tue Jun 18 21:28:01 2024 +0000, Jacek Caban wrote:
> Current func info is more than (id,iid) carrier, it would only make
> things more confusing to reuse it as an opaque with constrains like
> that. We could introduce a new struct, if needed.
Well yes but wouldn't it be an implementation detail on mshtml side?
By new struct do you mean one in `func_info_t` and then passing its
address out to jscript? (so a single pointer, rather than filling
(id,iid) on jscript side)
I'm asking because it's easier to just use a single pointer around in
jscript (and even check it for NULL if, for instance, it's not a
function but a custom prop).
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/5444#note_73737
For all mach vm operations this removes the task suspend and resume, which are not needed.
This uses `mach_vm_read_overwrite` to read into a caller-specified buffer, saving the `mach_vm_deallocate` call (bringing all read operations down to 1 syscall from 4).
The only alignment restriction on `mach_vm_write` according to the original CMU documentation is that data is
> [pointer to page aligned in array of bytes] An array of data to be written.
(In practice it also works with arbitrary addresses on macOS, but it probably doesn't hurt to follow the original specifications here).
The only other reference that these read/writes should be page-aligned is from the GNU Hurd documentation
> The current implementation requires that address, data and data_count all be page-aligned. Otherwise, KERN_INVALID_ARGUMENT is returned.
which I assume was the reason why this was originally done (plus it sounds to me like they will fix that in the future and 4fe19777 already broke GNU Hurd support anyways, if that was supposed to be working).
Also this includes the missing mach part of 5b1f3b14, which was only applied to the ptrace backend, and together with the `write_process_memory` rework, this gets rid of all fixmes in mach.c
--
v5: server: Simplify mach write_process_memory.
server: Use mach_vm_read_overwrite in get_selector_entry.
https://gitlab.winehq.org/wine/wine/-/merge_requests/4826
Killsquad sends a MESessionClose at various times depending on user input. It always expects a MESessionClosed event and will wait indefinitely if not received. There are currently a number of scenarios where we don't report the MESessionClose event. This MR attempts to fix that.
--
v5: mf: Handle an error during Media Session Close.
mf: Handle MediaSession Close when state is SESSION_STATE_RESTARTING_SOURCES.
mf/tests: Add additional tests for MESessionClosed event.
https://gitlab.winehq.org/wine/wine/-/merge_requests/5584
This is the current proton thread priority implementation by @rbernon rebased for upstream with a few `#ifdef`s added since AFAIK Linux is the only operating system where threads have a unique PID which can be used to set niceness on.
~~I also ran `./tools/make_requests` on https://gitlab.winehq.org/mzent/wine/-/commit/6705d3481be0409f7e971c1d2c7a3… as well and `autoconf` on https://gitlab.winehq.org/mzent/wine/-/commit/d7bafe40c411753662b2ad97148a6… (which does blow up the line count a bit).~~
A few tiny changes ~~(with the ready variable for example)~~ are in anticipation for Part 2, which also adds Mach thread priorities and recalculates thread priorities on process priority change.
Since this is a rather large MR, I hope the split here is appropriate ~~(with the second part being slightly smaller)~~, but I think logically it makes the most sense here.
--
v15: server: Check wineserver privileges on init with -20 niceness.
server: Use setpriority to update thread niceness when safe.
ntdll: Set RLIMIT_NICE to its hard limit.
server: Introduce new set_thread_priority helper.
https://gitlab.winehq.org/wine/wine/-/merge_requests/4551
This MR extends the `wgl_pixel_format` struct with extra fields required to implement `wglGetPixelFormatAttribivARB` in opengl32.dll. I have added only fields that are relevant to the current needs of the drivers. The default implementation will be used automatically if the driver populates the extra fields, which this MR does for the winex11 driver.
The new winex11 implementation tries to remain faithful to the previous behavior in terms of error handling and fallbacks. To achieve this the `wgl_pixel_format` extra fields can be marked as invalid in order for the default implementation to return errors accordingly. Note, however, that error handling around `glXGetFBConfigAttrib` is not very consistent (e.g., the parts of `describe_pixel_format` dealing with PIXELFORMATDESCRIPTOR generally disregard errors).
The MR also adds a default implementation for `wglGetPixelFormatAttribfvARB` which piggy-backs on the integer variant of this function, and removes the need for the corresponding code in the drivers. Note that we could potentially remove this function completely from `struct opengl_funcs` (i.e., place it in `manual_win_functions` in `make_opengl`), but it seems the pattern is to maintain a complete list of extension functions (and wined3d also populates the field internally, although it doesn't seem to do anything with it).
Finally, the `winex11.drv/opengl.c` file contains a mix of coding styles. I chose to be consistent with the style of the closest context (e.g., the function) I was making changes/additions in.
--
v3: winex11: Use default wglGetPixelFormatAttribivARB implementation.
winex11: Pass wgl_pixel_format to describe_pixel_format.
winex11: Update describe_pixel_format coding style.
opengl32: Add default implementation for wglGetPixelFormatAttribfvARB.
opengl32: Add default implementation for wglGetPixelFormatAttribivARB.
https://gitlab.winehq.org/wine/wine/-/merge_requests/5844
This is in preparation for the mach thread id rework, which requires 64 bit there (and incidentally also stops truncating the FreeBSD one).
There wasn't any direct usage of `__int64` in the sever protocol before, so I added a new typedef and a new `dump_int64()` function (not sure if needed per se though).
--
v7: ntdll: Remove unneeded FreeBSD codepath in get_unix_tid().
server, ntdll: Use 64 bit for unix thread id.
https://gitlab.winehq.org/wine/wine/-/merge_requests/5047
The last commit fixes glitches in Horizon Zero Dawn with vsync on, for reasons stated in the comment there.
The wined3d implementation already blocks the client's call to `Present()` when `vkAcquireNextImageKHR()` blocks, so is roughly equivalent to this when frame latency and buffer count are equal. It has a frame latency implementation which unblocks after calling `vkQueuePresentKHR()`, rather than waiting for its execution to complete. I think the d3d12 implementation is supposed to do the latter, though using `KHR_present_wait` may be unnecessary overkill. Waiting on queue execution comes with a performance cost either way, so without a compelling reason for a strict implementation, something similar to wined3d makes sense.
Another potential issue is after the call to `ID3D12CommandQueue_Signal()` in `d3d12_swapchain_present()`, the client is free to enqueue more commands when `Present()` returns, so by the time the signal is executed and the swapchain worker blits the image and calls `vkQueuePresentKHR()`, these commands are not necessarily enqueued immediately after the `Signal()`. This may not always be harmless.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/5830
More details here: https://devblogs.microsoft.com/oldnewthing/20181206-00/?p=100415
However it does not mention that `PAGE_NOACCESS` and `PAGE_READONLY` still result in an error on Windows, which is properly implemented in this MR.
Only `WriteProcessMemory` offers this "service", `NtWriteVirtualMemory` will fail on non-writeable and executable regions (and already does so, except for the the mach server backend, which needs https://gitlab.winehq.org/wine/wine/-/merge_requests/4826 to also behave correctly here).
--
v4: kernelbase: Flush instruction cache in WriteProcessMemory.
kernelbase: Allow WriteProcessMemory to succeed on PAGE_EXECUTE and PAGE_EXECUTE_READ.
https://gitlab.winehq.org/wine/wine/-/merge_requests/5222
For all mach vm operations this removes the task suspend and resume, which are not needed.
This uses `mach_vm_read_overwrite` to read into a caller-specified buffer, saving the `mach_vm_deallocate` call (bringing all read operations down to 1 syscall from 4).
The only alignment restriction on `mach_vm_write` according to the original CMU documentation is that data is
> [pointer to page aligned in array of bytes] An array of data to be written.
(In practice it also works with arbitrary addresses on macOS, but it probably doesn't hurt to follow the original specifications here).
The only other reference that these read/writes should be page-aligned is from the GNU Hurd documentation
> The current implementation requires that address, data and data_count all be page-aligned. Otherwise, KERN_INVALID_ARGUMENT is returned.
which I assume was the reason why this was originally done (plus it sounds to me like they will fix that in the future and 4fe19777 already broke GNU Hurd support anyways, if that was supposed to be working).
Also this includes the missing mach part of 5b1f3b14, which was only applied to the ptrace backend, and together with the `write_process_memory` rework, this gets rid of all fixmes in mach.c
--
v4: server: Simplify mach write_process_memory.
server: Use mach_vm_read_overwrite in get_selector_entry.
server: Use mach_vm_read_overwrite in read_process_memory.
https://gitlab.winehq.org/wine/wine/-/merge_requests/4826
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56769
--
v4: quartz/tests: Test that avi_decompressor_source_qc_Notify does not deadlock if called from a foreign thread during IMemInput_Receive.
quartz: Allow concurrent calls to AVI decoder qc_Notify and Receive.
msvfw32/tests: Test that Cinepak rejects unsupported output types.
iccvid: Reject unsupported output types.
quartz/tests: Add Cinepak test to avi splitter.
winegstreamer: Make AVI splitter use end of previous frame if the current frame doesn't have a timestamp.
winegstreamer: Implement AM_MEDIA_TYPE to wg_format converter for Cinepak video.
https://gitlab.winehq.org/wine/wine/-/merge_requests/5846
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56698
--
v8: quartz/tests: Test that avi_decompressor_source_qc_Notify does not deadlock if called from a foreign thread during IMemInput_Receive.
quartz: Allow concurrent calls to AVI decoder qc_Notify and Receive.
msvfw32/tests: Test that Cinepak rejects unsupported output types.
iccvid: Reject unsupported output types.
quartz/tests: Add Cinepak test to avi splitter.
winegstreamer: Make AVI splitter use end of previous frame if the current frame doesn't have a timestamp.
winegstreamer: Implement AM_MEDIA_TYPE to wg_format converter for Cinepak video.
https://gitlab.winehq.org/wine/wine/-/merge_requests/5744
Rémi Bernon (@rbernon) commented about dlls/winegstreamer/wg_transform.c:
> - {
> - gst_caps_unref(parsed_caps);
> - parsed_caps = gst_caps_ref(src_caps);
> - }
> -
> - if (!(element = find_element(GST_ELEMENT_FACTORY_TYPE_DECODER, parsed_caps, sink_caps))
> - || !append_element(transform->container, element, &first, &last))
> - goto out;
> - break;
> -
> - case WG_MAJOR_TYPE_AUDIO:
> - case WG_MAJOR_TYPE_VIDEO:
> - break;
> - case WG_MAJOR_TYPE_UNKNOWN:
> - GST_FIXME("Format %u not implemented!", input_format.major_type);
> + if (!transform_create_transcoder(transform, src_caps, &input_format, &first, &last))
Can we add an encoder element without changing all this code? It doesn't look like you need all the complicated converter sequence, maybe only a videoconvert (do you even need one?).
I don't want to be a blocker but to be honest I'm a bit annoyed with the idea of having to rewrite the patches I am trying to upstream with transform media types.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/5879#note_73696
LLVM 17 or 18 no longer allow non-private labels to appear between
.cfi_startproc/endproc when targeting Mach-O.
Similar fixes as in commit 295d521b11644fb76c36854336b13c2155bb7d79.
Since this is needed for 2 out of 4 architectures, would it be better to do it for all 4 and then modify the shared `__wine_syscall_dispatcher_return()` prototype?
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/5871
On Tue Jun 18 16:34:50 2024 +0000, Emil Velikov wrote:
> Does the wine (pre)loader unload things on `exit()` or perhaps the
> dependency on ntdll.so and(?) win32u.so, makes that impossible?
> Either way, as you said there are bigger concerns than this one dlhandle.
Well for instance the user driver is never unloaded, and it links and uses symbols from win32u directly, so neither of them will be unloaded.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/5835#note_73682
Adds the registry key
HKEY_CURRENT_USER\\Software\\Wine\\Wayland Driver\\rawinput
witch allows mouse raw input. This makes it easier
to calculate the same sensitivity in different games,
use sensitivity calculators, and easily change values
when changing mouse DPI and do not depend on the compositor or OS.
For example, you want to set the sensitivity to half as much,
but sensitivity curves in libinput are more difficult
to calculate than mouse sensitivity in the games.
Implementation of ideas written in the comments: https://gitlab.winehq.org/wine/wine/-/merge_requests/4698
--
v4: winewayland.drv: Add mouse rawinput support
server: Add send_hardware_message flags for rawinput translation.
https://gitlab.winehq.org/wine/wine/-/merge_requests/5869
This MR extends the `wgl_pixel_format` struct with extra fields required to implement `wglGetPixelFormatAttribivARB` in opengl32.dll. I have added only fields that are relevant to the current needs of the drivers. The default implementation will be used automatically if the driver populates the extra fields, which this MR does for the winex11 driver.
The new winex11 implementation tries to remain faithful to the previous behavior in terms of error handling and fallbacks. To achieve this the `wgl_pixel_format` extra fields can be marked as invalid in order for the default implementation to return errors accordingly. Note, however, that error handling around `glXGetFBConfigAttrib` is not very consistent (e.g., the parts of `describe_pixel_format` dealing with PIXELFORMATDESCRIPTOR generally disregard errors).
The MR also adds a default implementation for `wglGetPixelFormatAttribfvARB` which piggy-backs on the integer variant of this function, and removes the need for the corresponding code in the drivers. Note that we could potentially remove this function completely from `struct opengl_funcs` (i.e., place it in `manual_win_functions` in `make_opengl`), but it seems the pattern is to maintain a complete list of extension functions (and wined3d also populates the field internally, although it doesn't seem to do anything with it).
Finally, the `winex11.drv/opengl.c` file contains a mix of coding styles. I chose to be consistent with the style of the closest context (e.g., the function) I was making changes/additions in.
--
v2: winex11: Use default wglGetPixelFormatAttribivARB implementation.
winex11: Pass wgl_pixel_format to describe_pixel_format.
winex11: Update describe_pixel_format coding style.
opengl32: Add default implementation for wglGetPixelFormatAttribfvARB.
opengl32: Add default implementation for wglGetPixelFormatAttribivARB.
https://gitlab.winehq.org/wine/wine/-/merge_requests/5844
This MR adds support for creating file mapping objects backed by large pages on Linux, by making the following changes:
## wineserver
* On Linux, `create_temp_file` will first attempt to use memfds as the backing fd. If it fails, it'll return to the current codepath, creating a temporary file in either the server or config directory.
* The created memfd will be sealed against writes, if the caller requesting the appropriate page protection flags.
* This removes the requirement that FDs be only created on filesystems/directories that aren't `noexec`.
* In the server method `create_mapping` , if large pages have been requested by the caller, hold that the calling thread's token holds `SeLockMemoryPrivilege` .
* Additionally, add `SeLockMemoryPrivilege` to the list of privileges enabled for the Administrator.
## `ntdll`
* Add `virtual_get_min_large_page_size` and its exported wrapper `wine_unix_get_min_large_page_size`.
* On Linux, the minimum page size is determined by going through `/sys/kernel/mm/hugepages`. If hugepage support was not detected, `STATUS_NOT_SUPPORTED` is returned instead. On other platforms, the older hard-coded value of 2\*1024\*1024 is returned instead.
* `NtCreateSection` will validate certain parameters if large pages are requested. Specifically, it will return STATUS_INVALID_PARAMETER if the requested mapping is not anonymous/unnamed, or the size is not a multiple of the minimum supported page size.
## `kernelbase`
* `GetLargePageMinimum` will use `wine_unix_get_min_large_page_size`.
## `kernel32/tests`
* Add new test test_large_page_file_mapping, which validates privilege enforcements and parameter validation while creating large pages backed file mapping obejcts. The tests are skipped if `GetLargePageMinimum` returns 0.
--
v23: ntdll: Use PAGEMAP_SCAN to implement get_working_set_ex, if available.
kernel32: Add tests for large page mapping support.
https://gitlab.winehq.org/wine/wine/-/merge_requests/5769
On Fri Jun 7 14:39:29 2024 +0000, Gabriel Ivăncescu wrote:
> I see, if you look at it that way it makes sense to use IID, yeah (I was
> thinking of the functions as complete separate entities rather than
> interface implementations).
> I still think it's slightly better to just pass/store func_info_t as a
> container though—it's not just the args but everywhere else we need to
> store it (like in ProxyFunction as I mentioned), now it's one less field
> to worry about. And besides, if we ever do need to change it at some
> point later, it will be much easier without affecting call sites.
Current func info is more than (id,iid) carrier, it would only make things more confusing to reuse it as an opaque with constrains like that. We could introduce a new struct, if needed.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/5444#note_73651
This MR adds support for creating file mapping objects backed by large pages on Linux, by making the following changes:
## wineserver
* On Linux, `create_temp_file` will first attempt to use memfds as the backing fd. If it fails, it'll return to the current codepath, creating a temporary file in either the server or config directory.
* The created memfd will be sealed against writes, if the caller requesting the appropriate page protection flags.
* This removes the requirement that FDs be only created on filesystems/directories that aren't `noexec`.
* In the server method `create_mapping` , if large pages have been requested by the caller, hold that the calling thread's token holds `SeLockMemoryPrivilege` .
* Additionally, add `SeLockMemoryPrivilege` to the list of privileges enabled for the Administrator.
## `ntdll`
* Add `virtual_get_min_large_page_size` and its exported wrapper `wine_unix_get_min_large_page_size`.
* On Linux, the minimum page size is determined by going through `/sys/kernel/mm/hugepages`. If hugepage support was not detected, `STATUS_NOT_SUPPORTED` is returned instead. On other platforms, the older hard-coded value of 2\*1024\*1024 is returned instead.
* `NtCreateSection` will validate certain parameters if large pages are requested. Specifically, it will return STATUS_INVALID_PARAMETER if the requested mapping is not anonymous/unnamed, or the size is not a multiple of the minimum supported page size.
## `kernelbase`
* `GetLargePageMinimum` will use `wine_unix_get_min_large_page_size`.
## `kernel32/tests`
* Add new test test_large_page_file_mapping, which validates privilege enforcements and parameter validation while creating large pages backed file mapping obejcts. The tests are skipped if `GetLargePageMinimum` returns 0.
--
v22: ntdll: Use PAGEMAP_SCAN to implement get_working_set_ex, if available.
kernel32: Add tests for large page mapping support.
ntdll: Support creating and mapping files backed by large pages (SEC_LARGE_PAGES).
https://gitlab.winehq.org/wine/wine/-/merge_requests/5769
Since `EVENT_SYSTEM_MINIMIZESTART` and `EVENT_SYSTEM_MINIMIZEEND` are implemented now (thanks to Esme), this is implementing visibility change events using them. We have to keep track of the browsers to iterate all the documents from the hook.
Note that I tried to refcount the per-thread hook and add it only when necessary (on a visiblity change listener), since it can slow down the entire prefix.
--
v3: mshtml: Implement visibilitychange event.
https://gitlab.winehq.org/wine/wine/-/merge_requests/5861
Since `EVENT_SYSTEM_MINIMIZESTART` and `EVENT_SYSTEM_MINIMIZEEND` are implemented now (thanks to Esme), this is implementing visibility change events using them. We have to keep track of the browsers to iterate all the documents from the hook.
Note that I tried to refcount the per-thread hook and add it only when necessary (on a visiblity change listener), since it can slow down the entire prefix.
--
v2: mshtml: Implement visibilitychange event.
https://gitlab.winehq.org/wine/wine/-/merge_requests/5861