Problem with QOpenGLWidget and CUDA interoperabilitly
-
Hi All.
I am trying to implement OpenGL/CUDA interoperability on a Jetson TK1 (R21.3) with QOpenGLWidget and Qt 5.4.1. I use the same approach as described in
https://blog.qt.io/blog/2015/03/03/qt-weekly-28-qt-and-cuda-on-the-jetson-tk1/By the way, according to the lastest CUDA programming guide the call to cudaGLSetGLDevice() is not needed anymore. But the problem exists either way. Interestingly when using cudaGLSetGLDevice(), also any subsequent cudaMalloc fails with segfault.
In the meantime for testing I have stripped down my initializeGL() to minimal code:
initializeOpenGLFunctions(); cudaError_t err; err = cudaSetDevice(0); if ( err != cudaSuccess ) { QMessageBox::critical(NULL, "Error", "cudaSetDevice failed"); } glGenBuffers(1, &m_pbo); glBindBuffer(GL_PIXEL_UNPACK_BUFFER, m_pbo); glBufferData(GL_PIXEL_UNPACK_BUFFER, 768 * 768 * sizeof(GLubyte) * 4, NULL, GL_DYNAMIC_COPY); glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); err = cudaGraphicsGLRegisterBuffer(&_pcudagl_pbo_resource, m_pbo, cudaGraphicsMapFlagsNone); QMessageBox::critical(NULL, "Error", "Here");
I have the following member variables in the class:
GLuint m_pbo; cudaGraphicsResource_t _pcudagl_pbo_resource = NULL;
The function cudaGraphicsGLRegisterBuffer() crashes with a segmentation fault. m_pbo gets set to 1 by glGenBuffers();
Does anybody have an idea what causes this issue? Any tips to solve it?
-
Hi and welcome to devnet,
That might be a driver issue. In any case, I'd recommend posting that question on the interest mailing list You'll find there Qt's developers/maintainers (this forum is more user oriented)
-
I've solved it. It was a driver issue.
The issue was related to the wrong libEGL.so being used. In fact mesa-egl overwrites the tegra-egl in /usr/lib/arm-linux-gnueabihf in the L4T system.
See also: https://devtalk.nvidia.com/default/topic/810657/?comment=4460041
Replacing the link back to tegra-egl version fixed it.
-
Good !
Thanks for sharing the solution
Since you have it working now, please update the thread title prepending [solved] so other forum users may know a solution has been found :)