From b8ec11e213bb3021e348d53a07554511342b4482 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Mon, 26 Sep 2016 11:28:27 -0400 Subject: 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). --- src-qt5/core/lumina-session/session.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src-qt5/core/lumina-session/session.cpp') 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 Date: Thu, 29 Sep 2016 16:15:59 -0400 Subject: Add a session option to disable compositing if no GPU acceleration is detected sessionsettings.conf: "compositingWithGpuAccelOnly": (false by default) --- src-qt5/core/lumina-session/session.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src-qt5/core/lumina-session/session.cpp') diff --git a/src-qt5/core/lumina-session/session.cpp b/src-qt5/core/lumina-session/session.cpp index 0e88a227..5b0d7980 100644 --- a/src-qt5/core/lumina-session/session.cpp +++ b/src-qt5/core/lumina-session/session.cpp @@ -107,6 +107,7 @@ void LSession::start(){ startProcess("compositing","compton"); }else{ //Auto-detect if GLX is available on the system and turn it on/off as needed + bool startcompton = true; if(LUtils::isValidBinary("glxinfo")){ bool hasAccel =! LUtils::getCmdOutput("glxinfo -B").filter("direct rendering:").filter("Yes").isEmpty(); qDebug() << "Detected GPU Acceleration:" << hasAccel; @@ -115,10 +116,11 @@ void LSession::start(){ if(info[i].section("=",0,0).simplified()=="backend"){ info[i] = QString("backend = \"")+ (hasAccel ? "glx" : "xrender")+"\""; break; } //replace this line } LUtils::writeFile(set, info, true); + if( !hasAccel && settings.value("compositingWithGpuAccelOnly",false).toBool() ){ startcompton = false; } } - startProcess("compositing","compton --config \""+set+"\"", QStringList() << set); + if(startcompton){ startProcess("compositing","compton --config \""+set+"\"", QStringList() << set); } } - }else if(LUtils::isValidBinary("xcompmgr")){ startProcess("compositing","xcompmgr"); } + }else if(LUtils::isValidBinary("xcompmgr") && !settings.value("compositingWithGpuAccelOnly",false).toBool() ){ startProcess("compositing","xcompmgr"); } } //Desktop Next startProcess("runtime","lumina-desktop"); -- cgit From 70611ebc270d9ab05c99b507104bec503090792f Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Fri, 30 Sep 2016 13:15:25 -0400 Subject: Adjust the default settings for the new GPU accel detection routine to prefer no compositing if GPU accel is not available. --- src-qt5/core/lumina-session/session.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src-qt5/core/lumina-session/session.cpp') diff --git a/src-qt5/core/lumina-session/session.cpp b/src-qt5/core/lumina-session/session.cpp index 5b0d7980..937f05d0 100644 --- a/src-qt5/core/lumina-session/session.cpp +++ b/src-qt5/core/lumina-session/session.cpp @@ -116,11 +116,11 @@ void LSession::start(){ if(info[i].section("=",0,0).simplified()=="backend"){ info[i] = QString("backend = \"")+ (hasAccel ? "glx" : "xrender")+"\""; break; } //replace this line } LUtils::writeFile(set, info, true); - if( !hasAccel && settings.value("compositingWithGpuAccelOnly",false).toBool() ){ startcompton = false; } + if( !hasAccel && settings.value("compositingWithGpuAccelOnly",true).toBool() ){ startcompton = false; } } if(startcompton){ startProcess("compositing","compton --config \""+set+"\"", QStringList() << set); } } - }else if(LUtils::isValidBinary("xcompmgr") && !settings.value("compositingWithGpuAccelOnly",false).toBool() ){ startProcess("compositing","xcompmgr"); } + }else if(LUtils::isValidBinary("xcompmgr") && !settings.value("compositingWithGpuAccelOnly",true).toBool() ){ startProcess("compositing","xcompmgr"); } } //Desktop Next startProcess("runtime","lumina-desktop"); -- cgit