OpenGL initialisation is taking forever

As a part of frame capturing using Nvidia APIs, I’m trying to create OpenGL context and use it to capture frames. I’m using the native APIs provided by Xlib.h, gl.h and glx.h to create OpenGL context.

My order of calling the APIs looks like below,

  1. XOpenDisplay
  2. glXChooseFBConfig
  3. glXCreateNewContext
  4. XCreatePixmap
  5. glXCreatePixmap
  6. glXMakeCurrent

Out of the above APIs, one of them is taking a long time and my code got stuck forever. I suspect XOpenDisplay could be causing the issue, as I have found similar issues reported on the Internet. But, not sure.

If it helps, I’m facing this issue after restarting my machine. Before that, it used to work properly.

Did anyone face similar issues with OpenGL?
Is it something to do with the driver or kernel?
Or any other suggestions on what might have gone wrong?

Please help.

OS & Hardware details:
OS: RHEL 7.5
GPU Card: NVIDIA Quadro RTX 5000
Driver version: 470.63.01
CUDA version: 11.4

Try driver 465

Support for RHEL 7.5 ended on April 30, 2020.