add support for graphicssystem selection
REVIEW: 103430 CCBUG: 289904 (cherry picked from commit ded4ed4e9dc32316c41a43b6e906bece4b92338f)
This commit is contained in:
parent
f135206781
commit
5b40492a84
5 changed files with 44 additions and 3 deletions
|
@ -232,8 +232,17 @@ void Workspace::finishCompositing()
|
|||
void Workspace::fallbackToXRenderCompositing()
|
||||
{
|
||||
finishCompositing();
|
||||
options->compositingMode = XRenderCompositing;
|
||||
setupCompositing();
|
||||
KConfigGroup config(KSharedConfig::openConfig("kwinrc"), "Compositing");
|
||||
config.writeEntry("Backend", "XRender");
|
||||
config.writeEntry("GraphicsSystem", "native");
|
||||
config.sync();
|
||||
if (Extensions::nonNativePixmaps()) { // must restart to change the graphicssystem
|
||||
restartKWin("automatic graphicssystem change for XRender backend");
|
||||
return;
|
||||
} else {
|
||||
options->compositingMode = XRenderCompositing;
|
||||
setupCompositing();
|
||||
}
|
||||
}
|
||||
|
||||
void Workspace::lostCMSelection()
|
||||
|
|
|
@ -134,7 +134,8 @@ void Extensions::init()
|
|||
kDebug(1212) << "Extensions: shape: 0x" << QString::number(shape_version, 16)
|
||||
<< " composite: 0x" << QString::number(composite_version, 16)
|
||||
<< " render: 0x" << QString::number(render_version, 16)
|
||||
<< " fixes: 0x" << QString::number(fixes_version, 16) << endl;
|
||||
<< " fixes: 0x" << QString::number(fixes_version, 16)
|
||||
<< " non_native_pixmaps: " << non_native_pixmaps << endl;
|
||||
}
|
||||
|
||||
void Extensions::fillExtensionsData(const char**& extensions, int& nextensions, int*&opcodes, int*& error_bases)
|
||||
|
|
16
main.cpp
16
main.cpp
|
@ -409,6 +409,22 @@ KDE_EXPORT int kdemain(int argc, char * argv[])
|
|||
|
||||
KWorkSpace::trimMalloc();
|
||||
|
||||
// the raster graphicssystem has a quite terrible performance on the XRender backend or when not
|
||||
// compositing at all while some to many decorations suffer from bad performance of the native
|
||||
// graphicssystem (lack of implementation, QGradient internally uses the raster system and
|
||||
// XPutImage's the result because some graphics drivers have insufficient or bad performing
|
||||
// implementations of XRenderCreate*Gradient)
|
||||
//
|
||||
// Therefore we allow configurationa and do some automagic selection to discourage
|
||||
// ""known to be stupid" ideas ;-P
|
||||
// The invalid system parameter "" will use the systems default graphicssystem
|
||||
// "!= XRender" is intended since eg. pot. SW backends likely would profit from raster as well
|
||||
KConfigGroup config(KSharedConfig::openConfig("kwinrc"), "Compositing");
|
||||
QString preferredSystem("native");
|
||||
if (config.readEntry("Enabled", true) && config.readEntry("Backend", "OpenGL") != "XRender")
|
||||
preferredSystem = "";
|
||||
QApplication::setGraphicsSystem(config.readEntry("GraphicsSystem", preferredSystem));
|
||||
|
||||
Display* dpy = XOpenDisplay(NULL);
|
||||
if (!dpy) {
|
||||
fprintf(stderr, "%s: FATAL ERROR while trying to open display %s\n",
|
||||
|
|
|
@ -1044,10 +1044,24 @@ void Workspace::slotReconfigure()
|
|||
}
|
||||
}
|
||||
|
||||
void Workspace::restartKWin(const QString &reason)
|
||||
{
|
||||
kDebug(1212) << "restarting kwin for:" << reason;
|
||||
char cmd[1024]; // copied from crashhandler - maybe not the best way to do?
|
||||
sprintf(cmd, "%s --replace &", QFile::encodeName(QCoreApplication::applicationFilePath()).constData());
|
||||
system(cmd);
|
||||
}
|
||||
|
||||
void Workspace::slotReinitCompositing()
|
||||
{
|
||||
// Reparse config. Config options will be reloaded by setupCompositing()
|
||||
KGlobal::config()->reparseConfiguration();
|
||||
const QString graphicsSystem = KConfigGroup(KSharedConfig::openConfig("kwinrc"), "Compositing").readEntry("GraphicsSystem", "");
|
||||
if ((Extensions::nonNativePixmaps() && graphicsSystem == "native") ||
|
||||
(!Extensions::nonNativePixmaps() && (graphicsSystem == "raster" || graphicsSystem == "raster")) ) {
|
||||
restartKWin("explicitly reconfigured graphicsSystem change");
|
||||
return;
|
||||
}
|
||||
|
||||
// Update any settings that can be set in the compositing kcm.
|
||||
#ifdef KWIN_BUILD_SCREENEDGES
|
||||
|
|
|
@ -702,6 +702,7 @@ private:
|
|||
void initShortcuts();
|
||||
void initDesktopPopup();
|
||||
void initActivityPopup();
|
||||
void restartKWin(const QString &reason);
|
||||
void discardPopup();
|
||||
void setupWindowShortcut(Client* c);
|
||||
void checkCursorPos();
|
||||
|
|
Loading…
Reference in a new issue