Bug 102633 - Running ConeStepMap in wine freezes the system
Summary: Running ConeStepMap in wine freezes the system
Status: RESOLVED NOTOURBUG
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Gallium/radeonsi (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: Default DRI bug account
QA Contact: Default DRI bug account
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-09 09:45 UTC by Fabian Maurer
Modified: 2017-09-15 16:12 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Apitrace that will freeze the system (5.82 MB, application/x-7z-compressed)
2017-09-09 09:45 UTC, Fabian Maurer
Details
hacky patch (1.02 KB, patch)
2017-09-15 10:39 UTC, Samuel Pitoiset
Details | Splinter Review

Description Fabian Maurer 2017-09-09 09:45:28 UTC
Created attachment 134106 [details]
Apitrace that will freeze the system

ConeStepMap is a small OpenGL demo, but when run under wine with mesa it freezes the system. I created and attached an apitrace to reproduce, simply replaying it freezes my system and forces me to make a hard-reset.


System the bug was tested on:
- Arch Linux 64bit
- Linux 4.12.10, AMDGPU driver
- Mesa 17.3.0-devel (git-b33b85cdd4) / 17.1.8
- Radeon R9 285
Comment 1 Samuel Pitoiset 2017-09-15 10:39:16 UTC
Created attachment 134252 [details] [review]
hacky patch
Comment 2 Samuel Pitoiset 2017-09-15 10:41:11 UTC
Thanks for reporting this.

I'm able to reproduce the hang with the following environment:

OpenGL renderer string: AMD Radeon (TM) RX 480 Graphics (POLARIS10 / DRM 3.19.0 / 4.13.0-rc5-ARCH+, LLVM 6.0.0)
OpenGL core profile version string: 4.5 (Core Profile) Mesa 17.3.0-devel (git-8e8c7c6703)

No VM faults are reported, but it appears that one shader is stucked because some uniform variables are undefined and it loops indefinitely.

When replaying the trace, I get a bunch of errors like:

Mesa: User error: GL_INVALID_OPERATION in glUniform(location=18)
4867496: message: major api error 3: GL_INVALID_OPERATION in glUniform(location=18)
4867496 @0 glUniform1ivARB(location = 18, count = 1, value = &0)
4867496: warning: glGetError(glUniform1ivARB) = GL_INVALID_OPERATION

Basically, the app is trying to update a uniform variable with an invalid location.

After looking at the trace, the app assumes that uniform locations are fixed, which is wrong (except if they are explicitly set inside the shader). Instead, new locations are generated after each successful re-link, which is why GetUniformLocation exists (and the app never calls it).

The GLSL compiler doesn't allocate locations for built-in uniform variables like gl_ModelViewMatrix which explains the above errors. The attached (hacky) patch fixes the hang but don't except this to be upstream, the application is buggy.

Though, it would be doable to add new drirc option like glsl_force_fixed_locations but I personally don't want to introduce new hacks in Mesa.

Closing.
Comment 3 Fabian Maurer 2017-09-15 14:48:04 UTC
Thanks for looking into this.
I can't really agree with the resolution though, it not working is one thing, but it freezing the whole system is another. Can't something be done to at least avoid the latter?
Comment 4 Samuel Pitoiset 2017-09-15 15:47:20 UTC
Fix the app would be much better. :)
Comment 5 Fabian Maurer 2017-09-15 16:12:34 UTC
Sure thing, but a driver shouldn't allow to bring down the whole system, right?


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.