diff options
author | Ken Moore <ken@ixsystems.com> | 2016-09-26 11:28:27 -0400 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2016-09-26 11:28:27 -0400 |
commit | b8ec11e213bb3021e348d53a07554511342b4482 (patch) | |
tree | d3fcd57d0de0ff2898ac4dc2d5090a79e2a848c0 | |
parent | Make sure that the extra lumina utilities check/set the XDG_* environment var... (diff) | |
download | lumina-b8ec11e213bb3021e348d53a07554511342b4482.tar.gz lumina-b8ec11e213bb3021e348d53a07554511342b4482.tar.bz2 lumina-b8ec11e213bb3021e348d53a07554511342b4482.zip |
Add auto-detection of GPU acceleration to the start-lumina-desktop utility if compton is used, and automatically adjust the compton settings to use GPU accelleration or not. (Requires "glxinfo" utility installed).
-rw-r--r-- | src-qt5/core/lumina-session/session.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src-qt5/core/lumina-session/session.cpp b/src-qt5/core/lumina-session/session.cpp index 5f9ca6c4..0e88a227 100644 --- a/src-qt5/core/lumina-session/session.cpp +++ b/src-qt5/core/lumina-session/session.cpp @@ -95,7 +95,7 @@ void LSession::start(){ //Compositing manager QSettings settings("lumina-desktop","sessionsettings"); if(settings.value("enableCompositing",true).toBool()){ - if(LUtils::isValidBinary("compton")){ + if(LUtils::isValidBinary("compton")){ QString set = QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/compton.conf"; if(!QFile::exists(set)){ if(QFile::exists(LOS::LuminaShare()+"/compton.conf")){ @@ -106,6 +106,16 @@ void LSession::start(){ qDebug() << "Using default compton settings"; startProcess("compositing","compton"); }else{ + //Auto-detect if GLX is available on the system and turn it on/off as needed + if(LUtils::isValidBinary("glxinfo")){ + bool hasAccel =! LUtils::getCmdOutput("glxinfo -B").filter("direct rendering:").filter("Yes").isEmpty(); + qDebug() << "Detected GPU Acceleration:" << hasAccel; + QStringList info = LUtils::readFile(set); + for(int i=0; i<info.length(); i++){ + if(info[i].section("=",0,0).simplified()=="backend"){ info[i] = QString("backend = \"")+ (hasAccel ? "glx" : "xrender")+"\""; break; } //replace this line + } + LUtils::writeFile(set, info, true); + } startProcess("compositing","compton --config \""+set+"\"", QStringList() << set); } }else if(LUtils::isValidBinary("xcompmgr")){ startProcess("compositing","xcompmgr"); } |