Performance degradation in glXCreateContext and glXMakeCurrent since 555

Since the release of version 555 and 560 I’ve been experiencing some very clear slower function calls for glXCreateContext and glXMakeCurrent that ends up generating a perceptively slower initialization of an OpenGL application. I wasn’t sure what was happening with my window initialization until I measured the performance of each function call during the initialization and found out that these two functions where much slower than before (latest fast version is 550.107.02, and currently using it because of this issue).
On average I can measure that:
glXCreateContext is taking ~47ms vs 6ms (almost 8x slower), and glXMakeCurrent is taking around ~66ms vs 22ms on 550 (3x slower). I know we are talking about a few milliseconds here but creates a very perceptible delay when creating a new window. I’m currently not using any compositing but I verified that this happens also with compositing.
Probably my logs won’t help much here they are: nvidia-bug-report.log.gz (866.7 KB)

Regarding on how I’m initializing my window this is being done by SDL2, my measurements where done by modifying SDL2 implementation to measure each function call, so I’m certain where this is happening, I haven’t found any other regression beside those function calls.

I’m not sure if this is the right place to report it, but I hope there’s someone who cares about this.

@Prognoz
Very nice report IMHO:
You should probably link this post in the main 560 driver thread too,

Hi @Prognoz
Thanks for writing this to us, could you please help to share repro program and steps so that we can duplicate similar behavior locally.

Thank you very much for answering. It’s actually very simple to reproduce in my case, the very minimal example will do the job.
Mesaured glXCreateContext and glXMakeCurrent are both much slower with the newer drivers: x11_opengl_window.cpp.txt (4.3 KB), (g++ -o x11_opengl_window x11_opengl_window.cpp -lX11 -lGL)

SDL2 minimap example which is where I detected initially the issue: sdl_opengl.cpp.txt (2.2 KB) (g++ -o sdl_opengl sdl_opengl.cpp -lSDL2 -lGL).

I tested both examples with older and newer drivers and I can measure the differences I mentioned. Sometimes (not always) both calls will take over 100ms on new driver, which seems way high. I do have a very common configuration, I’m testing with a single monitor, and an very up te date Linux kernel (6.10.5) and related packages (Mesa, etc).