Segfault with OpenCL and lensfun
With OpenCL enabled, darktable segfaults immediately after enabling the lens correction plugin. Sample RAW.
I'm running the current git version. darktable --disable-opencl works fine. git bisect identifies the opencl: added support for lens module commit as culprit.
Backtrace and output of darktable -d opencl are attached.
Hardware is a Radeon HD 6950 with Catalyst 12.6 drivers, running under Ubuntu precise (64-bit).
#6 Updated by Ulrich Pegelow over 7 years ago
- % Done changed from 10 to 50
- Status changed from Confirmed to In Progress
I pushed a few patches to git master which hopefully prevent DT from crashing in lens correction.
However, with the image provided by Gabriel I get black output. Background is that lensfun knows the lens but not the camera. In that case DT tries to get the crop factor from exif data, or - failing that - setting it to 1. What I found instead, is that DT sets crop factor to zero in all cases.
#7 Updated by Ulrich Pegelow over 7 years ago
I just pushed another patch to git master. At least for newly imported images this should now correctly deal with the case where lens is known to lensfun but camera not.
@Gabriel: Please check and report back if this solves your problem.
Side remark: lens correction lacks a clear feedback to user if camera/lens are found in lensfun database and if lens correction is applied.
#11 Updated by Ulrich Pegelow over 7 years ago
Hmm, we not even reach the point where DT would normally tell us something about the OpenCL kernels and their timings.
I assume you can run other OpenCL modules without problems? Can you please make an example with some modules but without lens (once again -d opencl -d perf).
One further thing to check: is there any dependency on interpolation mode (bilinear, bicubic, ...) which you can set in preferences?
#13 Updated by Gabriel Ebner over 7 years ago
- File mil-panasonic.xml mil-panasonic.xml added
- File without-lens-correction.txt without-lens-correction.txt added
Everything works fine without lens correction; debugging output with lens correction disabled is attached.
There is no dependency on the interpolation mode, debugging output is the same, backtrace too.
I'm using the current svn version of liblensfun, patched to support the GX1... which explains why you can't reproduce it. I've attached my version of mil-panasonic.xml.
#15 Updated by Ulrich Pegelow over 7 years ago
Even after installing lensfun 0.26 and your patched mil-panasonic.xml file I am not able to reproduce the crash. Everything runs absolutely smooth here.
So you are a bit on your own with this problem. Maybe it helps if you start with a complete re-install of darktable. So remove all installation files of DT from your disk, do a 'rm ./build', and then build and install DT anew.
#16 Updated by Gabriel Ebner over 7 years ago
- % Done changed from 50 to 70
- Status changed from In Progress to Patch attached
The memory transfers from the temporary buffer in process_cl were marked non-blocking, and the fglrx opencl runtime decided to read the buffer after the temporary buffer was already freed, triggering a segfault. Apparently the nvidia opencl runtime disregards the non-blocking flag and just reads the buffer immediately, thereby not triggering this bug.
I just had to change the memory transfers from non-blocking to blocking and the segfault was gone.
I have filed a pull request on github: https://github.com/darktable-org/darktable/pull/26