Bug 93648

Summary: Random lines being rendered when playing Dolphin (geometry shaders related, w/ apitrace)
Product: Mesa Reporter: Pierre Bourdon <delroth>
Component: Drivers/Gallium/radeonsiAssignee: Default DRI bug account <dri-devel>
Status: RESOLVED FIXED QA Contact: Default DRI bug account <dri-devel>
Severity: normal    
Priority: medium CC: jdruel
Version: git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Pierre Bourdon 2016-01-09 16:49:07 UTC
We recently setup Dolphin's automated rendering tests on Fiji XT with Mesa/amdgpu. It started detected a random rendering issue which I think we can attribute to a driver bug.

See https://fifoci.dolphin-emu.org/compare/1086020-1085934/ . Left side has the "bad" rendering, right side the "good" rendering.

The issue is properly captured in this apitrace: http://delroth.net/radeon-unpredictable.trace -- rendering it on my Fiji XT system shows the lines but rendering it on i965 doesn't.

We have also had reports of users seeing this in action on Pitcairn GPUs: https://bugs.dolphin-emu.org/issues/9239
Comment 1 Pierre Bourdon 2016-01-09 18:15:22 UTC
Someone on IRC just reported something that sounds like the same issue, but on r600.

It's likely that this issue comes from geometry shaders, which we are using to generate stripes from lines. Disabling the use of geometry shaders breaks some features in Dolphin but fixes that particular problem.
Comment 2 Pierre Bourdon 2016-01-16 08:17:29 UTC
I haven't been able to test that myself, but other Dolphin users have reported the same symptoms on Intel Sandybridge IGPs. Our automated tests on Broadwell don't seem see that issue however, and my own laptop on Haswell doesn't see that issue either.
Comment 3 Ilia Mirkin 2016-01-16 08:36:45 UTC
I tested on a SNB and couldn't reproduce any artifacts on the apitrace (after forcing ARB_conservative_depth on). Even if I could, it'd be very surprising if the issues were related. Unless you have concrete evidence to the contrary, I'd keep it to one bug per issue that you see. Issues can be combined later on, but are difficult to break apart. Switching this one back to radeonsi.

Any issues you see on other hardware should include an apitrace taken on that hw.
Comment 4 Timothy Arceri 2016-01-16 10:31:31 UTC
(In reply to Ilia Mirkin from comment #3)
> I tested on a SNB and couldn't reproduce any artifacts on the apitrace
> (after forcing ARB_conservative_depth on). Even if I could, it'd be very
> surprising if the issues were related. Unless you have concrete evidence to
> the contrary, I'd keep it to one bug per issue that you see. Issues can be
> combined later on, but are difficult to break apart. Switching this one back
> to radeonsi.
> 
> Any issues you see on other hardware should include an apitrace taken on
> that hw.

I think Pierre was referring to bug #93418 it already has an apitrace for SNB I tried it a while ago on my Ivy Bridge and it also worked fine there.
Comment 5 Nicolai Hähnle 2016-01-20 15:14:15 UTC
Thanks again for the report. Analysing the apitrace suggests we're not handling geometry shader primitive types correctly, I'm looking into it.
Comment 6 Nicolai Hähnle 2016-01-22 22:59:06 UTC
Found the bug: we didn't properly update a piece of state in a specific (but not all that unusual) sequence of operations involving geometry shaders.

I have a preliminary series containing the fix at http://cgit.freedesktop.org/~nh/mesa/log/?h=shader-state

I remember that you mentioned other rendering bugs in Dolphin that showed up using your automated tests, but I don't think you've filed bug reports for them. Of course they may well have had the same root cause, but if any of them persist after the fix for this bug, I appreciate similarly high quality bug reports in the future :)
Comment 7 Nicolai Hähnle 2016-01-25 15:23:34 UTC
The fix is now in Mesa master:

commit 004fcd423011d45f746d571be47062feeea75455
Author: Nicolai Hähnle <nicolai.haehnle@amd.com>
Date:   Fri Jan 22 17:04:48 2016 -0500

    radeonsi: ensure that VGT_GS_MODE is sent when necessary

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.