https://bugs.winehq.org/show_bug.cgi?id=55107
Bug ID: 55107 Summary: DirectX programs cannot run on dedicated GPU in windowed mode for hybrid-graphics laptop Product: Wine Version: 8.10 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: xuancong84@gmail.com Distribution: ---
Years ago, I created a Direct3D program with statically-linked C library. This program has minimal library dependency and has been tested working on all versions of Windows with DirectX 9 supported. You can download it at: https://github.com/xuancong84/solid-rubix-cube/raw/master/Release/svcube.exe
I typically run this programs in 4 modes of Wine: 1. full-screen mode without dedicated GPU, `wine svcube.exe` 2. full-screen mode with dedicated GPU, `__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia wine svcube.exe` 3. windowed mode without dedicated GPU, cmdline same as 1 but with 'emulate a virtual desktop' checked 4. windowed mode with dedicated GPU, cmdline same as 2 but with 'emulate a virtual desktop' checked
From Wine 5.0 onwards (not tested on older versions), not a single version of Wine (including both wine and winehq, including -stable -staging and -devel) can pass all the 4 modes. In the latest winehq-stable (version 8.0.1~bullseye-1, on MX-Linux21/Debian11), the program can run successfully in 1,2, and 3, but crashes on 4 with the following error: ``` 002c:fixme:winediag:LdrInitializeThunk wine-staging 7.22 is a testing version containing experimental patches. 002c:fixme:winediag:LdrInitializeThunk Please mention your exact version when filing bug reports on winehq.org. 0084:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005 0084:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005 0084:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005 0084:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005 MESA-INTEL: warning: Performance support disabled, consider sysctl dev.i915.perf_stream_paranoid=0 MESA-INTEL: warning: Performance support disabled, consider sysctl dev.i915.perf_stream_paranoid=0 MESA-INTEL: warning: Performance support disabled, consider sysctl dev.i915.perf_stream_paranoid=0 0110:fixme:ver:GetCurrentPackageId (006CFAF0 00000000): stub 006c:fixme:imm:ImeSetActiveContext (0000000000010026, 0): stub 006c:fixme:imm:ImmReleaseContext (0000000000010020, 0000000000010026): stub 0110:fixme:imm:ImeSetActiveContext (00010072, 1): stub 0110:fixme:imm:ImmReleaseContext (0002006A, 00010072): stub X Error of failed request: BadMatch (invalid parameter attributes) Major opcode of failed request: 156 (NV-GLX) Minor opcode of failed request: 43 () Serial number of failed request: 409 Current serial number in output stream: 410 ```
I have NVIDIA CUDA installed (Driver Version: 530.30.02, CUDA Version: 12.1). And PyTorch/Tensorflow can run with/without GPU decoding. I am pretty sure my Nvidia GLX is working properly because Mode 2 can run successfully with the process appearing in `nvidia-smi` and taking GPU usage.