curv3d / curv

a language for making art using mathematics
Apache License 2.0
1.14k stars 73 forks source link

Intel driver crashes after OpenGL 3.3 upgrade #72

Closed p-e-w closed 5 years ago

p-e-w commented 5 years ago

See #51 for system information.

Recently I updated Curv and started to see GPU driver issues with typical symptoms of memory corruption (graphical glitches in other programs, complete system freezes requiring hard reset). The crashes happened with even the simplest Curv programs (such as the standard library cube), though sometimes the system wouldn't lock up until 20-30 minutes after exiting Curv.

I immediately suspected the OpenGL 3.3 upgrade as the culprit, so I reverted https://github.com/curv3d/curv/commit/8e1b6fdbec5b6144d3ebcddcac3cf6a531bebc26 and https://github.com/curv3d/curv/commit/475b5f39a137a16e1273003763f979f1d78da025, and sure enough, the crashes disappeared.

I realize there is probably not much you can do here, but I have a rather common setup (2015-ish Intel integrated GPU with open source drivers) so there is reason to believe this might affect a large percentage of Curv users. Therefore, you might want to consider making OpenGL 3.3 an optional requirement. I never saw a single crash before the upgrade.

doug-moen commented 5 years ago

I am going to try and fix the underlying problem. As you point out, it's a driver bug. However, Curv must be doing something unusual that other OpenGL programs don't do. It would be good to figure out what is going on and fix it.

The problem is most likely in the viewer code that I copied from glslViewer. It could also be in the ImGui library, but that library has a large user base, so it is less likely. (But, I could try upgrading ImGui to the latest version and see if there is a change.) It could be resource exhaustion caused by failure of Curv to delete OpenGL objects no longer used--that's my only idea right now. I should learn how to use GPU debugger tools and see if these tools report anything suspicious about Curv's behaviour during execution.

doug-moen commented 5 years ago

@p-e-w was using this GPU and driver when this bug was filed:

$ curv --version
Curv: 0.3-128-g3521724
Compiler: gcc 8.2.1 20181105 (Red Hat 8.2.1-5)
Kernel: Linux 4.19.3-200.fc28.x86_64 x86_64
GPU: Intel Open Source Technology Center, Mesa DRI Intel(R) HD Graphics 530 (Skylake GT2) 
OpenGL: 3.0 Mesa 18.0.5

I've been running the Intel GPU driver for several months (using Mesa 18.0.5) and I can't reproduce the problem.

@ivocavalcante has tested Curv on the Intel GPU with this version information, and has not reported any problem:

Curv: 0.4
Compiler: gcc 7.4.0
Kernel: Linux 5.0.0-23-generic x86_64
GPU: Intel Open Source Technology Center, Mesa DRI Intel(R) Ivybridge Mobile
OpenGL: 3.0 Mesa 19.0.2

Since I can't reproduce this bug or make any progress, I'm going to close the bug. Mesa 19 fixes a lot of bugs that were in Mesa 18, so hopefully the underlying issue has been fixed in Mesa. If @p-e-w has time in the future to retest with the Mesa 19 driver, and finds the same problem, he can reopen the bug.