Don't enable DRI_PRIME if nouveau is loaded
This commit is contained in:
parent
cf0716952d
commit
bfade869f3
1 changed files with 20 additions and 1 deletions
|
@ -243,7 +243,26 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
|
||||||
// Set DRI_PRIME if not set. This means that Godot should default to a higher-power GPU if it exists.
|
// Set DRI_PRIME if not set. This means that Godot should default to a higher-power GPU if it exists.
|
||||||
// Note: Due to the final '0' parameter to setenv any existing DRI_PRIME environment variables will not
|
// Note: Due to the final '0' parameter to setenv any existing DRI_PRIME environment variables will not
|
||||||
// be overwritten.
|
// be overwritten.
|
||||||
|
bool enable_dri_prime = true;
|
||||||
|
// Check if Nouveau is loaded, we don't want to force dGPU usage with that driver.
|
||||||
|
if (FileAccess *f = FileAccess::open("/proc/modules", FileAccess::READ)) {
|
||||||
|
// Match driver name + space
|
||||||
|
String nouveau_str = "nouveau ";
|
||||||
|
|
||||||
|
while (!f->eof_reached()) {
|
||||||
|
String line = f->get_line();
|
||||||
|
|
||||||
|
if (line.begins_with(nouveau_str)) {
|
||||||
|
enable_dri_prime = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
f->close();
|
||||||
|
memdelete(f);
|
||||||
|
}
|
||||||
|
if (enable_dri_prime) {
|
||||||
setenv("DRI_PRIME", "1", 0);
|
setenv("DRI_PRIME", "1", 0);
|
||||||
|
}
|
||||||
|
|
||||||
ContextGL_X11::ContextType opengl_api_type = ContextGL_X11::GLES_3_0_COMPATIBLE;
|
ContextGL_X11::ContextType opengl_api_type = ContextGL_X11::GLES_3_0_COMPATIBLE;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue