add support for graphicssystem selection
REVIEW: 103430 CCBUG: 289904
This commit is contained in:
parent
a04cb2ed09
commit
0b23c516a7
5 changed files with 44 additions and 3 deletions
|
@ -232,8 +232,17 @@ void Workspace::finishCompositing()
|
||||||
void Workspace::fallbackToXRenderCompositing()
|
void Workspace::fallbackToXRenderCompositing()
|
||||||
{
|
{
|
||||||
finishCompositing();
|
finishCompositing();
|
||||||
options->compositingMode = XRenderCompositing;
|
KConfigGroup config(KSharedConfig::openConfig("kwinrc"), "Compositing");
|
||||||
setupCompositing();
|
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()
|
void Workspace::lostCMSelection()
|
||||||
|
|
|
@ -134,7 +134,8 @@ void Extensions::init()
|
||||||
kDebug(1212) << "Extensions: shape: 0x" << QString::number(shape_version, 16)
|
kDebug(1212) << "Extensions: shape: 0x" << QString::number(shape_version, 16)
|
||||||
<< " composite: 0x" << QString::number(composite_version, 16)
|
<< " composite: 0x" << QString::number(composite_version, 16)
|
||||||
<< " render: 0x" << QString::number(render_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)
|
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();
|
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);
|
Display* dpy = XOpenDisplay(NULL);
|
||||||
if (!dpy) {
|
if (!dpy) {
|
||||||
fprintf(stderr, "%s: FATAL ERROR while trying to open display %s\n",
|
fprintf(stderr, "%s: FATAL ERROR while trying to open display %s\n",
|
||||||
|
|
|
@ -1020,10 +1020,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()
|
void Workspace::slotReinitCompositing()
|
||||||
{
|
{
|
||||||
// Reparse config. Config options will be reloaded by setupCompositing()
|
// Reparse config. Config options will be reloaded by setupCompositing()
|
||||||
KGlobal::config()->reparseConfiguration();
|
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.
|
// Update any settings that can be set in the compositing kcm.
|
||||||
#ifdef KWIN_BUILD_SCREENEDGES
|
#ifdef KWIN_BUILD_SCREENEDGES
|
||||||
|
|
|
@ -698,6 +698,7 @@ private:
|
||||||
void initShortcuts();
|
void initShortcuts();
|
||||||
void initDesktopPopup();
|
void initDesktopPopup();
|
||||||
void initActivityPopup();
|
void initActivityPopup();
|
||||||
|
void restartKWin(const QString &reason);
|
||||||
void discardPopup();
|
void discardPopup();
|
||||||
void setupWindowShortcut(Client* c);
|
void setupWindowShortcut(Client* c);
|
||||||
void checkCursorPos();
|
void checkCursorPos();
|
||||||
|
|
Loading…
Reference in a new issue