Improve multi-head detection for OpenGLIsUnsafe

This was currently basically broken:
* Screen number got always attached
* openGLIsBroken did not check for screen number
-> KCM reported "everything is fine" while it wasn't

Now changed to:
* only attach screen number if it is a multi-head setup
* use same logic in both Composite and CompositingPrefs

Still problematic:
* kcm is not multi-head aware so it will report everything is fine in
  case of a broken multi-head setup

REVIEW: 110631
This commit is contained in:
Martin Gräßlin 2013-05-24 14:50:17 +02:00
parent 79d09f5336
commit bd01bfefb4
2 changed files with 11 additions and 4 deletions

View file

@ -162,6 +162,7 @@ void Compositor::setup()
}
extern int screen_number; // main.cpp
extern bool is_multihead;
void Compositor::slotCompositingOptionsInitialized()
{
@ -182,7 +183,7 @@ void Compositor::slotCompositingOptionsInitialized()
// Some broken drivers crash on glXQuery() so to prevent constant KWin crashes:
KSharedConfigPtr unsafeConfigPtr = KGlobal::config();
KConfigGroup unsafeConfig(unsafeConfigPtr, "Compositing");
const QString openGLIsUnsafe = "OpenGLIsUnsafe" + QString::number(screen_number);
const QString openGLIsUnsafe = "OpenGLIsUnsafe" + (is_multihead ? QString::number(screen_number) : "");
if (unsafeConfig.readEntry(openGLIsUnsafe, false))
kWarning(1212) << "KWin has detected that your OpenGL library is unsafe to use";
else {

View file

@ -38,6 +38,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace KWin
{
extern int screen_number; // main.cpp
extern bool is_multihead;
CompositingPrefs::CompositingPrefs()
: mEnableDirectRendering(true)
{
@ -49,15 +52,17 @@ CompositingPrefs::~CompositingPrefs()
bool CompositingPrefs::openGlIsBroken()
{
return KConfigGroup(KGlobal::config(), "Compositing").readEntry("OpenGLIsUnsafe", false);
const QString unsafeKey("OpenGLIsUnsafe" + (is_multihead ? QString::number(screen_number) : ""));
return KConfigGroup(KGlobal::config(), "Compositing").readEntry(unsafeKey, false);
}
bool CompositingPrefs::compositingPossible()
{
// first off, check whether we figured that we'll crash on detection because of a buggy driver
KConfigGroup gl_workaround_group(KGlobal::config(), "Compositing");
const QString unsafeKey("OpenGLIsUnsafe" + (is_multihead ? QString::number(screen_number) : ""));
if (gl_workaround_group.readEntry("Backend", "OpenGL") == "OpenGL" &&
gl_workaround_group.readEntry("OpenGLIsUnsafe", false))
gl_workaround_group.readEntry(unsafeKey, false))
return false;
if (!Xcb::Extensions::self()->isCompositeAvailable()) {
@ -85,8 +90,9 @@ QString CompositingPrefs::compositingNotPossibleReason()
{
// first off, check whether we figured that we'll crash on detection because of a buggy driver
KConfigGroup gl_workaround_group(KGlobal::config(), "Compositing");
const QString unsafeKey("OpenGLIsUnsafe" + (is_multihead ? QString::number(screen_number) : ""));
if (gl_workaround_group.readEntry("Backend", "OpenGL") == "OpenGL" &&
gl_workaround_group.readEntry("OpenGLIsUnsafe", false))
gl_workaround_group.readEntry(unsafeKey, false))
return i18n("<b>OpenGL compositing (the default) has crashed KWin in the past.</b><br>"
"This was most likely due to a driver bug."
"<p>If you think that you have meanwhile upgraded to a stable driver,<br>"