From 214375f923c86caf8eeda7089bea698b92fdb3d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Sun, 4 Mar 2012 15:13:22 +0100 Subject: [PATCH] Query KWin for available debug output This adds extensive support information about the running instance by printing out all used options, the compositing information including GL platform, loaded effects and active effects. The debug output can be retrieved through D-Bus: qdbus org.kde.kwin /KWin supportInformation or through a KWin Script (use desktop console): print(workspace.supportInformation()) REVIEW: 104142 --- org.kde.KWin.xml | 3 + scripting/workspace_wrapper.cpp | 5 ++ scripting/workspace_wrapper.h | 4 + workspace.cpp | 128 ++++++++++++++++++++++++++++++++ workspace.h | 1 + 5 files changed, 141 insertions(+) diff --git a/org.kde.KWin.xml b/org.kde.KWin.xml index f89b2c70f1..160f94e406 100644 --- a/org.kde.KWin.xml +++ b/org.kde.KWin.xml @@ -84,5 +84,8 @@ + + + diff --git a/scripting/workspace_wrapper.cpp b/scripting/workspace_wrapper.cpp index 53036ea361..ebcced6a17 100644 --- a/scripting/workspace_wrapper.cpp +++ b/scripting/workspace_wrapper.cpp @@ -180,6 +180,11 @@ QString WorkspaceWrapper::desktopName(int desktop) const return Workspace::self()->desktopName(desktop); } +QString WorkspaceWrapper::supportInformation() const +{ + return Workspace::self()->supportInformation(); +} + void WorkspaceWrapper::setupClientConnections(KWin::Client *client) { connect(client, SIGNAL(clientMinimized(KWin::Client*,bool)), SIGNAL(clientMinimized(KWin::Client*))); diff --git a/scripting/workspace_wrapper.h b/scripting/workspace_wrapper.h index 911420e5f5..b1c0cbb81f 100644 --- a/scripting/workspace_wrapper.h +++ b/scripting/workspace_wrapper.h @@ -160,6 +160,10 @@ void setter( rettype val ); * Returns the name for the given @p desktop. **/ Q_SCRIPTABLE QString desktopName(int desktop) const; + /** + * Provides support information about the currently running KWin instance. + **/ + Q_SCRIPTABLE QString supportInformation() const; public Q_SLOTS: // all the available key bindings diff --git a/workspace.cpp b/workspace.cpp index 09e4775a57..0e4a02e99a 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -58,6 +58,8 @@ along with this program. If not, see . #include "deleted.h" #include "effects.h" #include "overlaywindow.h" +#include +#include #ifdef KWIN_BUILD_TILING #include "tiling/tile.h" #include "tiling/tilinglayout.h" @@ -2148,6 +2150,132 @@ void Workspace::dumpTiles() const { #endif } +QString Workspace::supportInformation() const +{ + QString support; + + support.append(ki18nc("Introductory text shown in the support information.", + "KWin Support Information:\n" + "The following information should be used when requesting support on e.g. http://forum.kde.org.\n" + "It provides information about the currently running instance, which options are used,\n" + "what OpenGL driver and which effects are running.\n" + "Please post the information provided underneath this introductory text to a paste bin service\n" + "like http://paste.kde.org instead of pasting into support threads.\n").toString()); + support.append("\n==========================\n\n"); + // all following strings are intended for support. They need to be pasted to e.g forums.kde.org + // it is expected that the support will happen in English language or that the people providing + // help understand English. Because of that all texts are not translated + support.append("Options\n"); + support.append("=======\n"); + const QMetaObject *metaOptions = options->metaObject(); + for (int i=0; ipropertyCount(); ++i) { + const QMetaProperty property = metaOptions->property(i); + if (QLatin1String(property.name()) == "objectName") { + continue; + } + support.append(QLatin1String(property.name()) % ": " % options->property(property.name()).toString() % '\n'); + } + support.append("\nCompositing\n"); + support.append( "===========\n"); + if (effects) { + support.append("Compositing is active\n"); + switch (effects->compositingType()) { + case OpenGLCompositing: { +#ifdef KWIN_HAVE_OPENGLES + support.append("Compositing Type: OpenGL ES 2.0\n"); +#else + support.append("Compositing Type: OpenGL\n"); +#endif + + GLPlatform *platform = GLPlatform::instance(); + support.append("OpenGL vendor string: " % platform->glVendorString() % '\n'); + support.append("OpenGL renderer string: " % platform->glRendererString() % '\n'); + support.append("OpenGL version string: " % platform->glVersionString() % '\n'); + + if (platform->supports(LimitedGLSL)) + support.append("OpenGL shading language version string: " % platform->glShadingLanguageVersionString() % '\n'); + + support.append("Driver: " % GLPlatform::driverToString(platform->driver()) % '\n'); + if (!platform->isMesaDriver()) + support.append("Driver version: " % GLPlatform::versionToString(platform->driverVersion()) % '\n'); + + support.append("GPU class: " % GLPlatform::chipClassToString(platform->chipClass()) % '\n'); + + support.append("OpenGL version: " % GLPlatform::versionToString(platform->glVersion()) % '\n'); + + if (platform->supports(LimitedGLSL)) + support.append("GLSL version: " % GLPlatform::versionToString(platform->glslVersion()) % '\n'); + + if (platform->isMesaDriver()) + support.append("Mesa version: " % GLPlatform::versionToString(platform->mesaVersion()) % '\n'); + if (platform->serverVersion() > 0) + support.append("X server version: " % GLPlatform::versionToString(platform->serverVersion()) % '\n'); + if (platform->kernelVersion() > 0) + support.append("Linux kernel version: " % GLPlatform::versionToString(platform->kernelVersion()) % '\n'); + + support.append("Direct rendering: "); + if (platform->isDirectRendering()) { + support.append("yes\n"); + } else { + support.append("no\n"); + } + support.append("Requires strict binding: "); + if (!platform->isLooseBinding()) { + support.append("yes\n"); + } else { + support.append("no\n"); + } + support.append("GLSL shaders: "); + if (platform->supports(GLSL)) { + if (platform->supports(LimitedGLSL)) { + support.append(" limited\n"); + } else { + support.append(" yes\n"); + } + } else { + support.append(" no\n"); + } + support.append("Texture NPOT support: "); + if (platform->supports(TextureNPOT)) { + if (platform->supports(LimitedNPOT)) { + support.append(" limited\n"); + } else { + support.append(" yes\n"); + } + } else { + support.append(" no\n"); + } + + if (ShaderManager::instance()->isValid()) { + support.append("OpenGL 2 Shaders are used\n"); + } else { + support.append("OpenGL 2 Shaders are not used. Legacy OpenGL 1.x code path is used.\n"); + } + break; + } + case XRenderCompositing: + support.append("Compositing Type: XRender\n"); + break; + case NoCompositing: + default: + support.append("Something is really broken, neither OpenGL nor XRender is used"); + } + support.append("\nLoaded Effects:\n"); + support.append( "---------------\n"); + foreach (const QString &effect, loadedEffects()) { + support.append(effect % '\n'); + } + support.append("\nCurrently Active Effects:\n"); + support.append( "-------------------------\n"); + foreach (const QString &effect, activeEffects()) { + support.append(effect % '\n'); + } + } else { + support.append("Compositing is not active\n"); + } + return support; +} + } // namespace #include "workspace.moc" diff --git a/workspace.h b/workspace.h index 3c5956936b..f8316b3163 100644 --- a/workspace.h +++ b/workspace.h @@ -448,6 +448,7 @@ public: bool stopActivity(const QString &id); bool startActivity(const QString &id); QStringList activeEffects() const; + QString supportInformation() const; void setCurrentScreen(int new_screen);