Bug 94168

Summary: Incorrect rendering when running Populous 3 on wine using DDraw->WineD3D->OpenGL wrapper [apitrace]
Product: Mesa Reporter: Diego <diegoandino>
Component: Mesa coreAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact: mesa-dev
Severity: normal    
Priority: medium CC: joseph.kucia, notasas, sa
Version: git   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Diego 2016-02-15 23:19:56 UTC
There is a description of this problem on Wine's Bugzilla, I'll refer to that first:

https://bugs.winehq.org/show_bug.cgi?id=40126

I did some tests and I am now inclined to believe this is a Mesa bug:

After making an apitrace and replaying it, I only see incorrect rendering when using hardware rendering (Mesa, Gallium3D, radeonsi). When the same apitrace is replayed in software mode, the rendering is correct and looks like it is supposed to.

Another user reported the exact same problem with nouveau, but it works fine with the nvidia binary driver.

Apitrace: https://drive.google.com/file/d/0B6CofbZiVpM1b1RKSDNLZXdteW8/view?usp=sharing
Comment 1 Marek Olšák 2016-04-05 21:20:28 UTC
Can this be reproduced on i965?
Comment 2 Grazvydas Ignotas 2016-04-07 00:08:57 UTC
i965 seems to be fine, at least matches LIBGL_ALWAYS_SOFTWARE.
Comment 3 Marek Olšák 2016-04-07 11:59:08 UTC
Then it must be a DRI state tracker bug.
Comment 4 Marek Olšák 2016-04-07 12:01:11 UTC
(In reply to Grazvydas Ignotas from comment #2)
> i965 seems to be fine, at least matches LIBGL_ALWAYS_SOFTWARE.

Actually, what exactly did you see? You need to run the trace with a low frame rate to be able to see it. The bug is that the cursor animation stops when the cursor stops moving.
Comment 5 Grazvydas Ignotas 2016-04-07 13:46:59 UTC
The cursor is animating, I even tried the game itself (there is a link to free demo in wine bug) and the cursor does animate properly even when inputs are not touched. FWIW I'm using DRI3 on X.Org 1.18.1 on Skylake GPU.
Comment 6 Grazvydas Ignotas 2016-04-16 01:20:32 UTC
I've put my HD 5770 in and can confirm r600g suffers from this too.
Comment 7 Nicolai Hähnle 2016-04-29 18:35:30 UTC
When you open the trace with qapitrace, you'll see that appears as one single big frame. This is a big clue as to what's going on. Somehow, the game/Wine doesn't trigger the usual swap buffers logic, which means screen refreshes don't happen reliably. Seems most likely to be a Wine bug, to be honest.
Comment 8 almos 2016-04-29 19:46:05 UTC
(In reply to Nicolai Hähnle from comment #7)
> When you open the trace with qapitrace, you'll see that appears as one
> single big frame. This is a big clue as to what's going on. Somehow, the
> game/Wine doesn't trigger the usual swap buffers logic, which means screen
> refreshes don't happen reliably. Seems most likely to be a Wine bug, to be
> honest.

Doesn't that mean frontbuffer rendering?
Comment 9 Marek Olšák 2016-05-01 09:56:54 UTC
This hack fixes the bug:

diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
index a983d64..806ca60 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -194,8 +194,6 @@ st_framebuffer_validate(struct st_framebuffer *stfb,
       return;
 
    new_stamp = p_atomic_read(&stfb->iface->stamp);
-   if (stfb->iface_stamp == new_stamp)
-      return;
 
    /* validate the fb */
    do {


These stamps are like black magic to me.
Comment 10 Sven Arvidsson 2017-06-10 17:29:49 UTC
Gabriel Knight 3 is another Wine direct draw game with a similar problem.

When restoring a saved game the screen stops refreshing, but the game still runs.

Applying the suggested patch or using LIBGL_ALWAYS_SOFTWARE works around the problem.
Comment 11 Diego 2017-11-17 21:58:25 UTC
Problem is gone with Mesa 17.2.4 and Wine 2.21. I haven't done any reliable testing and therefore I am not sure what fixed or hid it, or when it happened.
Diego.
Comment 12 Michel Dänzer 2017-11-20 11:08:38 UTC
Resolving per comment 11, thanks for the report and followup.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.