Merge pull request #25879 from hpvb/fix-25629
Detect when primusrun/optirun is in use
This commit is contained in:
commit
89eb79aef1
1 changed files with 31 additions and 2 deletions
|
@ -243,8 +243,37 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
|
|||
// maybe contextgl wants to be in charge of creating the window
|
||||
#if defined(OPENGL_ENABLED)
|
||||
if (getenv("DRI_PRIME") == NULL) {
|
||||
print_verbose("Detecting GPUs, set DRI_PRIME in the environment to override GPU detection logic.");
|
||||
int use_prime = detect_prime();
|
||||
int use_prime = -1;
|
||||
|
||||
if (getenv("PRIMUS_DISPLAY") ||
|
||||
getenv("PRIMUS_libGLd") ||
|
||||
getenv("PRIMUS_libGLa") ||
|
||||
getenv("PRIMUS_libGL") ||
|
||||
getenv("PRIMUS_LOAD_GLOBAL") ||
|
||||
getenv("BUMBLEBEE_SOCKET")) {
|
||||
|
||||
print_verbose("Optirun/primusrun detected. Skipping GPU detection");
|
||||
use_prime = 0;
|
||||
}
|
||||
|
||||
if (getenv("LD_LIBRARY_PATH")) {
|
||||
String ld_library_path(getenv("LD_LIBRARY_PATH"));
|
||||
Vector<String> libraries = ld_library_path.split(":");
|
||||
|
||||
for (int i = 0; i < libraries.size(); ++i) {
|
||||
if (FileAccess::exists(libraries[i] + "/libGL.so.1") ||
|
||||
FileAccess::exists(libraries[i] + "/libGL.so")) {
|
||||
|
||||
print_verbose("Custom libGL override detected. Skipping GPU detection");
|
||||
use_prime = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (use_prime == -1) {
|
||||
print_verbose("Detecting GPUs, set DRI_PRIME in the environment to override GPU detection logic.");
|
||||
use_prime = detect_prime();
|
||||
}
|
||||
|
||||
if (use_prime) {
|
||||
print_line("Found discrete GPU, setting DRI_PRIME=1 to use it.");
|
||||
|
|
Loading…
Reference in a new issue