baldurk / renderdoc

RenderDoc is a stand-alone graphics debugging tool.
https://renderdoc.org
MIT License
8.86k stars 1.33k forks source link

[0.x/1.x] Segfault under Linux with mesa #721

Closed Ristovski closed 7 years ago

Ristovski commented 7 years ago

Edit: This has been identified as a mesa issue, see last comment.

Using renderdoc both from 0.x and 1.x branches results in a segmentation fault after Renderdoc finishes loading the frames after the application exits.

Edit: This only happens with OpenGL, Vulkan works fine.

Before the segfault occurs, renderdoc spits out this rather lengthy log: https://bpaste.net/raw/ab68561dd5e2

The gist of this issue might be related to "Error - Couldn't choose default framebuffer config"

Running via gdb yields the following:

#0  0x00007f3536f0f8ed in GLReplay::RenderCheckerboard(Vec3f, Vec3f) ()
   from /home/rafael/GitProjects/renderdoc/build/bin/librenderdoc.so
#1  0x00007f353743c1e4 in ReplayOutput::DisplayMesh() () from /home/rafael/GitProjects/renderdoc/build/bin/librenderdoc.so
#2  0x00007f353743c907 in ReplayOutput::Display() () from /home/rafael/GitProjects/renderdoc/build/bin/librenderdoc.so
#3  0x000000000081dae4 in BufferViewer::RT_UpdateAndDisplay (this=0x15e3ab0)
    at ../../qrenderdoc/Windows/BufferViewer.cpp:2546
#4  0x000000000081571f in BufferViewer::<lambda(IReplayController*)>::operator()(IReplayController *) const (
    __closure=0x1939f98, r=0x7f35100030d0) at ../../qrenderdoc/Windows/BufferViewer.cpp:1324
#5  0x0000000000824f0a in std::_Function_handler<void(IReplayController*), BufferViewer::OnLogfileLoaded()::<lambda(IReplayController*)> >::_M_invoke(const std::_Any_data &, <unknown type in /home/rafael/GitProjects/renderdoc/build/bin/qrenderdoc, CU 0xf91487, DIE 0x1016136>) (__functor=..., 
    __args#0=<unknown type in /home/rafael/GitProjects/renderdoc/build/bin/qrenderdoc, CU 0xf91487, DIE 0x1016136>)
    at /usr/lib/gcc/x86_64-pc-linux-gnu/8.0.0-alpha20170723/include/g++-v8/bits/std_function.h:316
#6  0x00000000005b03df in std::function<void (IReplayController*)>::operator()(IReplayController*) const (this=0x1939f98, 
    __args#0=0x7f35100030d0)
    at /usr/lib/gcc/x86_64-pc-linux-gnu/8.0.0-alpha20170723/include/g++-v8/bits/std_function.h:706
#7  0x00000000005acd0f in ReplayManager::run (this=0x7fffffffaa78) at ../../qrenderdoc/Code/ReplayManager.cpp:447
#8  0x00000000005aa32f in ReplayManager::<lambda()>::operator()(void) const (__closure=0x7f3518004c30)
    at ../../qrenderdoc/Code/ReplayManager.cpp:54
#9  0x00000000005ad75f in std::_Function_handler<void(), ReplayManager::OpenCapture(const QString&, float*)::<lambda()> >::_M_invoke(const std::_Any_data &) (__functor=...)
    at /usr/lib/gcc/x86_64-pc-linux-gnu/8.0.0-alpha20170723/include/g++-v8/bits/std_function.h:316
#10 0x00000000005afad4 in std::function<void ()>::operator()() const (this=0x7f3518004c30)
    at /usr/lib/gcc/x86_64-pc-linux-gnu/8.0.0-alpha20170723/include/g++-v8/bits/std_function.h:706
#11 0x00000000005af5f8 in LambdaThread::process (this=0x7f3518004c20) at ../../qrenderdoc/Code/QRDUtils.h:755
#12 0x00000000005b1bb4 in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (LambdaThread::*)()>::call(void (LambdaThread::*)(), LambdaThread*, void**) (
---Type <return> to continue, or q <return> to quit---
    aThread::process()>, o=0x7f3518004c20, arg=0x7f35216f8e70)
    at /usr/include/qt5/QtCore/qobjectdefs_impl.h:501
#13 0x00000000005b16b2 in QtPrivate::FunctionPointer<void (LambdaThread::*)()>::call<QtPrivate::List<>, void>(void (LambdaThread::*)(), LambdaThread*, void**) (f=(void (LambdaThread::*)(LambdaThread * const)) 0x5af5dc <LambdaThread::process()>, o=0x7f3518004c20, arg=0x7f35216f8e70)
    at /usr/include/qt5/QtCore/qobjectdefs_impl.h:520
#14 0x00000000005b0eb6 in QtPrivate::QSlotObject<void (LambdaThread::*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (which=1, this_=0x7f3518003c00, r=0x7f3518004c20, a=0x7f35216f8e70, ret=0x0) at /usr/include/qt5/QtCore/qobject_impl.h:143
#15 0x00007f353610c2be in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib64/libQt5Core.so.5
#16 0x00007f3535f451d3 in ?? () from /usr/lib64/libQt5Core.so.5
#17 0x00007f3535a18554 in start_thread () from /lib64/libpthread.so.0
#18 0x00007f3534e515ef in clone () from /lib64/libc.so.6

This issue was also present the first time I tried using renderdoc which was maybe half a year ago.

Happens both when running on Intel integrated and dedicated AMD.

Specs: Intel HD 4400 Haswell "Gen7.5" Radeon HD 8850M "Southern Islands" Xorg/mesa/llvm/clang all from git

baldurk commented 7 years ago

I think this is the key message:

Error   - Couldn't choose default framebuffer config

Which comes from here in the code. After that it might be a knock-on effect causing the other failures and probably the segfault.

I'm not sure what to make of this as I've never seen that fail before. You hardware sounds capable enough so maybe there's an issue somewhere in the software configuration. I'm not requesting anything outlandish like a depth/stencil buffer or anything, it's just an 8-bit double buffered sRGB backbuffer that should be supported anywhere. All the complex rendering happens off-screen.

Can you try modifying that code to take out some of the attribs and see by elimination which one is the problem? Also could you post the output of your glxinfo?

It might also help to use renderdoccmd replay proton.rdc for testing since then you don't go all the way through the Qt UI, and just do a simple window setup and preview.

Ristovski commented 7 years ago

This will be interesting :smiley:

glxinfo - Intel: https://bpaste.net/raw/0aa580f17ec1 glxinfo - Radeon: https://bpaste.net/raw/4b6405fc3879

Ristovski commented 7 years ago

Confirmed as mesa bug: https://bugs.freedesktop.org/show_bug.cgi?id=102264

baldurk commented 7 years ago

Committed a workaround that falls back to a non-SRGB fbconfig, tested to work.