Bug 91780 - Rendering issues with geometry shader
Summary: Rendering issues with geometry shader
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Gallium/r600 (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Default DRI bug account
QA Contact: Default DRI bug account
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-27 21:04 UTC by Jonas Wielicki
Modified: 2015-11-11 23:07 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
apitrace which shows the problem (2.36 MB, text/plain)
2015-08-27 21:04 UTC, Jonas Wielicki
Details
screenshot of the problem (1.05 MB, image/png)
2015-08-27 21:06 UTC, Jonas Wielicki
Details

Description Jonas Wielicki 2015-08-27 21:04:49 UTC
Created attachment 117951 [details]
apitrace which shows the problem

In the attached apitrace, *sometimes* (about 50% of the runs) rendering issues can be observed. They manifest in appearantly missing geometry (compare attached screenshot; the UI has been disabled for taking the apitrace).

Steps to reproduce:
1. DRI_PRIME=1 apitrace replay r600-renderbug-noui.trace
2. If step 1 did not show the behaviour, retry a few times.

Expected results:
Rendering should work and show a terrain without holes

Actual results:
Holes in the terrain

The results have been observed on mesa-11.0.0-rc1 with and without http://lists.freedesktop.org/archives/mesa-dev/2015-August/092766.html applied.

The same code has never (in 50+ tests) shown the issue on the Intel integrated GPU.

The application which produces the given behaviour can be found at 
https://github.com/horazont/scc/tree/f31d90e1579ebda14ce7a0417339b2cd448efde8

The geometry shader is in:
https://github.com/horazont/scc/blob/f31d90e1579ebda14ce7a0417339b2cd448efde8/game/resources/shaders/terrain/main.geom

The usage is in:
https://github.com/horazont/scc/blob/f31d90e1579ebda14ce7a0417339b2cd448efde8/libffengine-render/src/render/fancyterrain.cpp
(search for draw_elements, GL_GEOMETRY_SHADER, GL_LINES_ADJACENCY)


In another commit, the geometry shader has been disabled (<https://github.com/horazont/scc/commit/4e1e298b02723efcf6555c1c4a7efa31682cf79b>), which appears to fix the problem or make it very hard to reproduce.


radeon GPU:
Advanced Micro Devices, Inc. [AMD/ATI] Whistler [Radeon HD 6630M/6650M/6750M/7670M/7690M] (rev ff)  {6630M according to notebook specs}
intel GPU:
Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)
Comment 1 Jonas Wielicki 2015-08-27 21:06:04 UTC
Created attachment 117952 [details]
screenshot of the problem
Comment 2 Dieter Nützel 2015-08-27 21:20:36 UTC
Can you please try with

R600_DEBUG=nosb

And maybe test Mesa-demo 'gsraytrace'?

I got several geometry shader glitches/crashes on Turks, here.
Bugs are open:
https://bugs.freedesktop.org/show_bug.cgi?id=83319
https://bugs.freedesktop.org/show_bug.cgi?id=91503
Comment 3 Glenn Kennard 2015-08-27 21:29:21 UTC
Dieter, those are unrelated to this issue, which appears to be something specific to GL_LINES_ADJACENCY primitive type.

The piglit test glsl-1.50-geometry-primitive-types GL_TRIANGLE_STRIP_ADJACENCY fails which might be related, but curiously the lines adjacency types pass.
Comment 4 Jonas Wielicki 2015-08-27 21:29:52 UTC
(In reply to Dieter Nützel from comment #2)
> Can you please try with
> 
> R600_DEBUG=nosb

Yes, I tried that (should have mentioned it, sorry) and it shows the problem.

> And maybe test Mesa-demo 'gsraytrace'?

Will try that later.
Comment 5 Dave Airlie 2015-08-28 07:39:05 UTC
just fyi I tested this on CAICOS GPU and SUMO APU today,

and it renders fine on the SUMO but fails similarly on the CAICOS.

This is strange, and it might take someone from AMD doing some research for us.
Comment 6 Jonas Wielicki 2015-09-03 09:59:24 UTC
(In reply to Dieter Nützel from comment #2)
> And maybe test Mesa-demo 'gsraytrace'?

I am having a hard time to get gsraytrace to run. I am not sure whether this is related to this bug or to PRIME issues, as in general, using the Radeon GPU is a bit unstable here. The instability manifests in not receiving any rendering output in the window and sometimes error messages ("radeon: The kernel rejected CS, see dmesg for more information.").

I made two tests:

FIRST TEST

When trying to run the gsraytrace demo on the radeon, I did not receive visual output in the window; no rendering took place, the window contents were never written and were showing what was at that place on the screen before the window opened. The terminal suggested a frame rate of 1 FPS. No crash happened.

I then tried to distinguish between PRIME failure and demo failure by opening a glxgears instance on the radeon gpu, which made the whole X11 freeze for a few seconds and afterwards both glxgears and the gsraytrace demo spammed the above error message.

SECOND TEST

This time, I started glxgears first to make sure that everything was set up properly, PRIME-wise. glxgears was running fine at a reasonable frame rate.

Then I started the gsraytrace demo, which made the X11 freeze. (I then went to fetch some tea) Both programs were spamming the above error message when the GUI had unfreezed.


At no point I ever saw visual output from the gsraytrace demo. As I said, I am not sure what of this is purely due to PRIME and what is caused by the bug this entry refers to. I just wanted to add my data here as it was requested for and I don’t think I will get better results on my own.
Comment 7 Jonas Wielicki 2015-09-03 10:00:50 UTC
(In reply to Jonas Wielicki from comment #6)
> This time, I started glxgears first to make sure that everything was set up
> properly, PRIME-wise. glxgears was running fine at a reasonable frame rate.
> 
> Then I started the gsraytrace demo, which made the X11 freeze. (I then went
> to fetch some tea) Both programs were spamming the above error message when
> the GUI had unfreezed.

Sorry for the spam, here the output of gsraytrace:


```
GL_RENDERER = Gallium 0.4 on AMD TURKS (DRM 2.42.0, LLVM 3.5.0)

ESC                 = exit demo
left mouse + drag   = rotate camera

radeon: The kernel rejected CS, see dmesg for more information.
0.044456 FPS (1 frames in 22.493999 seconds)
radeon: The kernel rejected CS, see dmesg for more information.
[… the above message repeated a few hundred times before I killed it …]
```
Comment 8 Marek Olšák 2015-09-04 13:05:15 UTC
(In reply to Dave Airlie from comment #5)
> just fyi I tested this on CAICOS GPU and SUMO APU today,
> 
> and it renders fine on the SUMO but fails similarly on the CAICOS.
> 
> This is strange, and it might take someone from AMD doing some research for
> us.

I don't know of any hw bug related to GS that could cause this.
Comment 9 Dave Airlie 2015-11-11 23:07:31 UTC
this should now be fixed in master.


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.