https://bugs.winehq.org/show_bug.cgi?id=52563
Bug ID: 52563 Summary: d3d11:d3d11 fails in test_dynamic_map_synchronization() on cw-rx460 Product: Wine Version: unspecified Hardware: x86-64 OS: Linux Status: NEW Severity: normal Priority: P2 Component: directx-d3d Assignee: wine-bugs@winehq.org Reporter: fgouget@codeweavers.com Distribution: ---
d3d11:d3d11 fails in test_dynamic_map_synchronization() on cw-rx460:
d3d11.c:34006: Test failed: Got 0xff0000ff, expected 0xff00ff00 at (3, 478, 0), sub-resource 0.
https://test.winehq.org/data/patterns.html#d3d11:d3d11
The failures started with the commit below:
commit a13fc3bb7e055562b8b9deae985c64c5c7861424 Author: Henri Verbeet hverbeet@codeweavers.com Date: Fri Feb 11 19:42:02 2022 -0600
wined3d: Use the chunk allocator for GL vertex buffers.
Signed-off-by: Zebediah Figura zfigura@codeweavers.com Signed-off-by: Henri Verbeet hverbeet@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
https://bugs.winehq.org/show_bug.cgi?id=52563
François Gouget fgouget@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |regression, source, | |testcase Regression SHA1| |a13fc3bb7e055562b8b9deae985 | |c64c5c7861424
https://bugs.winehq.org/show_bug.cgi?id=52563
--- Comment #1 from François Gouget fgouget@codeweavers.com --- This commit also causes some new failures on cw-gtx560. See bug 52566.
https://bugs.winehq.org/show_bug.cgi?id=52563
Zebediah Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |z.figura12@gmail.com
--- Comment #2 from Zebediah Figura z.figura12@gmail.com --- Created attachment 71887 --> https://bugs.winehq.org/attachment.cgi?id=71887 don't use deferred contexts
Curious that it doesn't affect the same test in d3d10core. Does the attached patch make a difference?
I also can't reproduce this here, with a GPU with the same PCI id, and Mesa 21.2.6. What Mesa version is this?
Can this be reproduced with a +d3d,+d3d11,+d3d_perf log?
https://bugs.winehq.org/show_bug.cgi?id=52563
--- Comment #3 from François Gouget fgouget@codeweavers.com --- The failure is reproducible with the traces and goes away with the attached patch (attachment 71887).
The logs are a bit big so I uploaded them to the URLs below: http://fgouget.free.fr/tmp/d3d11-rx460.log.xz http://fgouget.free.fr/tmp/d3d11-rx460-patched.log.xz
https://bugs.winehq.org/show_bug.cgi?id=52563
--- Comment #4 from Zebediah Figura z.figura12@gmail.com --- I'm struggling to figure out what's going wrong here. The log doesn't really tell me anything, nor do I have any ideas.
The offending buffer (both here and for bug 52566) is the first one allocated, so it's not even like we or the driver should be mishandling offsets.
Nor should the map flags be any different if we aren't suballocating.
Does disabling CSMT change anything?
https://bugs.winehq.org/show_bug.cgi?id=52563
--- Comment #5 from François Gouget fgouget@codeweavers.com --- (In reply to Zebediah Figura from comment #4) [...]
Does disabling CSMT change anything?
I tried with both csmt=0 and csmt=2 but I still get the failure. I uploaded the corresponding logs there in case they contain a clue elsewhere:
http://fgouget.free.fr/tmp/d3d11-rx460-csmt0.log.xz http://fgouget.free.fr/tmp/d3d11-rx460-csmt2.log.xz
Note: To set csmt I used the following command and the winediag trace seems to indicate it worked: ./wine reg add HKCU\Software\Wine\Direct3D /v csmt /t REG_DWORD /d 0 /f
https://bugs.winehq.org/show_bug.cgi?id=52563
François Gouget fgouget@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |hverbeet@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=52563
François Gouget fgouget@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|d3d11:d3d11 fails in |d3d11:d3d11 fails in |test_dynamic_map_synchroniz |test_dynamic_map_synchroniz |ation() on cw-rx460 |ation() on cw-rx460 in Wine
https://bugs.winehq.org/show_bug.cgi?id=52563
--- Comment #6 from Zeb Figura z.figura12@gmail.com --- I started getting this too locally all of a sudden, and combined with the advent of bug 54023, I have a theory.
I think what triggered me to start getting this locally is that Mesa's CSMT thread was turned on by default. I don't know what changed it; I can't easily see anything to that effect in Mesa, so maybe Debian did it. At any rate, forcing mesa_glthread=false seems to consistently "fix" it for me. At that point it doesn't actually matter whether Wine's CSMT thread is on or off, which makes sense—I don't think we have any synchronization errors here.
By using Present() one can see where the test fails, and it's for some reason on the first few NOOVERWRITE maps on every second row where we do a deferred discard. The draw after the discard renders correctly, but the first one or more nooverwrite doesn't. And this is IIRC true of bug 54023, which is what started to clue me in.
My guess, although it's probably impossible to confirm [if this test itself can't be said to confirm it!] is that a DISCARD on a deferred context simply doesn't have the same synchronization guarantees as a DISCARD on an immediate context. Or, at least, that's what NVidia says. By tracing the map pointer one can see that NVidia will return the same pointer after the deferred discard, but a new pointer after an immediate discard. I suspect what's happening is that internally it uploads the buffer contents to the existing buffer, and *that* draw might synchronize, but the following NOOVERWRITE maps might *not*. I don't quite know what "doesn't synchronize" means, though.
The same thing is probably happening with Mesa. We too don't actually discard the buffer on a deferred discard (we could, though...) Instead we use glBufferSubData() to upload the whole deferred discard allocation. The buffer itself is allocated with GL_MAP_UNSYNCHRONIZED_BIT since it's write-only, and while the glBufferSubData() might synchronize, the following writes to the mapped buffer might not.
So I think the right thing to do is just remove the deferred context tests.
https://bugs.winehq.org/show_bug.cgi?id=52563
Zeb Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Fixed by SHA1| |e7c46ac6b567af4a563c4d3af93 | |dd6a4feb1d724 Resolution|--- |FIXED
--- Comment #7 from Zeb Figura z.figura12@gmail.com --- The offending tests were removed in https://source.winehq.org/git/wine.git/commitdiff/e7c46ac6b567af4a563c4d3af93dd6a4feb1d724.
https://bugs.winehq.org/show_bug.cgi?id=52563
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #8 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 8.0-rc3.