Set CUDA_DISABLE_PERF_BOOST to workaround p2 power level issue. Required nvidia driver >= 580.105.08

This commit is contained in:
dec05eba
2025-11-05 00:57:58 +01:00
parent dc15c69848
commit 96c62f2db2

View File

@@ -3102,6 +3102,10 @@ int main(int argc, char **argv) {
set_display_server_environment_variables(); set_display_server_environment_variables();
// Linux nvidia driver 580.105.08 added the environment variable CUDA_DISABLE_PERF_BOOST to disable the p2 power level issue,
// where running cuda (which includes nvenc) causes the gpu to be forcefully set to p2 power level which on many nvidia gpus
// decreases gpu performance in games. On my GTX 1080 it decreased game performance by 10% for absolutely no reason.
setenv("CUDA_DISABLE_PERF_BOOST", "1", true);
// Stop nvidia driver from buffering frames // Stop nvidia driver from buffering frames
setenv("__GL_MaxFramesAllowed", "1", true); setenv("__GL_MaxFramesAllowed", "1", true);
// If this is set to 1 then cuGraphicsGLRegisterImage will fail for egl context with error: invalid OpenGL or DirectX context, // If this is set to 1 then cuGraphicsGLRegisterImage will fail for egl context with error: invalid OpenGL or DirectX context,