Remove compositing self-check

Removes the last bits of the self-check at compositing startup.
It seems like they were only added to XRender because they were
in OpenGL and there they are not available for quite some time.

Also removes the now obsolete disable functionality checks from UI.

REVIEW: 101756
icc-effect-5.14.5
Martin Gräßlin 2011-06-25 12:33:51 +02:00
parent e766fe0a82
commit 6cfdbfe1dc
7 changed files with 1 additions and 176 deletions

View File

@ -119,7 +119,6 @@ KWinCompositingConfig::KWinCompositingConfig(QWidget *parent, const QVariantList
connect(ui.compositingType, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
connect(ui.compositingType, SIGNAL(currentIndexChanged(int)), this, SLOT(toogleSmoothScaleUi(int)));
connect(ui.windowThumbnails, SIGNAL(activated(int)), this, SLOT(changed()));
connect(ui.disableChecks, SIGNAL(toggled(bool)), this, SLOT(changed()));
connect(ui.unredirectFullscreen , SIGNAL(toggled(bool)), this, SLOT(changed()));
connect(ui.glScaleFilter, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
connect(ui.xrScaleFilter, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
@ -391,7 +390,6 @@ void KWinCompositingConfig::loadAdvancedTab()
ui.windowThumbnails->setCurrentIndex(2);
else // shown, or default
ui.windowThumbnails->setCurrentIndex(1);
ui.disableChecks->setChecked(config.readEntry("DisableChecks", false));
ui.unredirectFullscreen->setChecked(config.readEntry("UnredirectFullscreen", false));
ui.xrScaleFilter->setCurrentIndex((int)config.readEntry("XRenderSmoothScale", false));
@ -556,7 +554,6 @@ bool KWinCompositingConfig::saveAdvancedTab()
|| config.readEntry("GLDirect", mDefaultPrefs.enableDirectRendering())
!= ui.glDirect->isChecked()
|| config.readEntry("GLVSync", mDefaultPrefs.enableVSync()) != ui.glVSync->isChecked()
|| config.readEntry("DisableChecks", false) != ui.disableChecks->isChecked()
|| config.readEntry<bool>("GLLegacy", false) == ui.glShaders->isChecked()) {
m_showConfirmDialog = true;
advancedChanged = true;
@ -567,7 +564,6 @@ bool KWinCompositingConfig::saveAdvancedTab()
config.writeEntry("Backend", (ui.compositingType->currentIndex() == OPENGL_INDEX) ? "OpenGL" : "XRender");
config.writeEntry("HiddenPreviews", hps[ ui.windowThumbnails->currentIndex()]);
config.writeEntry("DisableChecks", ui.disableChecks->isChecked());
config.writeEntry("UnredirectFullscreen", ui.unredirectFullscreen->isChecked());
config.writeEntry("XRenderSmoothScale", ui.xrScaleFilter->currentIndex() == 1);
@ -722,7 +718,6 @@ void KWinCompositingConfig::defaults()
ui.compositingType->setCurrentIndex(0);
ui.windowThumbnails->setCurrentIndex(1);
ui.disableChecks->setChecked(false);
ui.unredirectFullscreen->setChecked(false);
ui.xrScaleFilter->setCurrentIndex(0);
ui.glScaleFilter->setCurrentIndex(2);

View File

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>544</width>
<width>552</width>
<height>523</height>
</rect>
</property>
@ -553,13 +553,6 @@
</item>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="disableChecks">
<property name="text">
<string>Disable functionality checks</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="3">

View File

@ -320,7 +320,6 @@ void Options::reloadCompositingSettings(bool force)
prefs.detect();
useCompositing = config.readEntry("Enabled" , prefs.recommendCompositing());
disableCompositingChecks = config.readEntry("DisableChecks", false);
glDirect = config.readEntry("GLDirect", prefs.enableDirectRendering());
glVSync = config.readEntry("GLVSync", prefs.enableVSync());
glSmoothScale = qBound(-1, config.readEntry("GLTextureFilter", 2), 2);

View File

@ -93,7 +93,6 @@ Scene* scene = 0;
Scene::Scene(Workspace* ws)
: wspace(ws)
, has_waitSync(false)
, selfCheckDone(false)
, lanczos_filter(new LanczosFilter())
{
}
@ -321,31 +320,6 @@ void Scene::finalDrawWindow(EffectWindowImpl* w, int mask, QRegion region, Windo
w->sceneWindow()->performPaint(mask, region, data);
}
QList< QPoint > Scene::selfCheckPoints() const
{
QList< QPoint > ret;
// Use Kephal directly, we're interested in "real" screens, not depending on our config.
// TODO: Does Kephal allow fake screens as well? We cannot use QDesktopWidget as it will cause a crash if
// the number of screens is different to what Kephal returns.
for (int screen = 0;
screen < Kephal::ScreenUtils::numScreens();
++screen) {
// test top-left and bottom-right of every screen
ret.append(Kephal::ScreenUtils::screenGeometry(screen).topLeft());
ret.append(Kephal::ScreenUtils::screenGeometry(screen).bottomRight() + QPoint(-3 + 1, -2 + 1)
+ QPoint(-1, 0)); // intentionally moved one up, since the source windows will be one down
}
return ret;
}
QRegion Scene::selfCheckRegion() const
{
QRegion reg;
foreach (const QPoint & p, selfCheckPoints())
reg |= QRect(p, QSize(selfCheckWidth(), selfCheckHeight()));
return reg;
}
//****************************************
// Scene::Window
//****************************************

18
scene.h
View File

@ -121,11 +121,6 @@ protected:
void finalDrawWindow(EffectWindowImpl* w, int mask, QRegion region, WindowPaintData& data);
// compute time since the last repaint
void updateTimeDiff();
QList< QPoint > selfCheckPoints() const;
QRegion selfCheckRegion() const;
// dimensions of the test pixmap for selfcheck
int selfCheckWidth() const;
int selfCheckHeight() const;
// saved data for 2nd pass of optimized screen painting
struct Phase2Data {
Phase2Data(Window* w, QRegion r, QRegion c, int m, const WindowQuadList& q)
@ -154,7 +149,6 @@ protected:
QTime last_time;
Workspace* wspace;
bool has_waitSync;
bool selfCheckDone;
LanczosFilter* lanczos_filter;
};
@ -246,18 +240,6 @@ protected:
extern Scene* scene;
inline
int Scene::selfCheckWidth() const
{
return 3;
}
inline
int Scene::selfCheckHeight() const
{
return 2;
}
inline
int Scene::Window::x() const
{

View File

@ -125,11 +125,6 @@ SceneXrender::SceneXrender(Workspace* ws)
kError(1212) << "XRender compositing setup failed";
return;
}
if (!initting) { // see comment for opengl version
if (!selfCheck())
return;
selfCheckDone = true;
}
init_ok = true;
}
@ -162,107 +157,6 @@ void SceneXrender::createBuffer()
XFreePixmap(display(), pixmap); // The picture owns the pixmap now
}
// Just like SceneOpenGL::selfCheck()
bool SceneXrender::selfCheck()
{
QRegion reg = selfCheckRegion();
if (wspace->overlayWindow()) {
// avoid covering the whole screen too soon
wspace->setOverlayShape(reg);
wspace->showOverlay();
}
selfCheckSetup();
flushBuffer(PAINT_SCREEN_REGION, reg);
bool ok = selfCheckFinish();
if (wspace->overlayWindow())
wspace->hideOverlay();
return ok;
}
void SceneXrender::selfCheckSetup()
{
KXErrorHandler err;
QImage img(selfCheckWidth(), selfCheckHeight(), QImage::Format_RGB32);
img.setPixel(0, 0, QColor(Qt::red).rgb());
img.setPixel(1, 0, QColor(Qt::green).rgb());
img.setPixel(2, 0, QColor(Qt::blue).rgb());
img.setPixel(0, 1, QColor(Qt::white).rgb());
img.setPixel(1, 1, QColor(Qt::black).rgb());
img.setPixel(2, 1, QColor(Qt::white).rgb());
QPixmap pix = QPixmap::fromImage(img);
bool mustFreePix = false;
if (pix.handle() == 0) {
mustFreePix = true;
Pixmap xPix = XCreatePixmap(display(), rootWindow(), pix.width(), pix.height(), DefaultDepth(display(), DefaultScreen(display())));
pix = QPixmap::fromX11Pixmap(xPix, QPixmap::ExplicitlyShared);
QPainter p(&pix);
p.drawImage(QPoint(0, 0), img);
}
foreach (const QPoint & p, selfCheckPoints()) {
XSetWindowAttributes wa;
wa.override_redirect = True;
::Window window = XCreateWindow(display(), rootWindow(), 0, 0, selfCheckWidth(), selfCheckHeight(),
0, QX11Info::appDepth(), CopyFromParent, CopyFromParent, CWOverrideRedirect, &wa);
XSetWindowBackgroundPixmap(display(), window, pix.handle());
XClearWindow(display(), window);
XMapWindow(display(), window);
// move the window one down to where the result will be rendered too, just in case
// the render would fail completely and eventual check would try to read this window's contents
XMoveWindow(display(), window, p.x() + 1, p.y());
XCompositeRedirectWindow(display(), window, CompositeRedirectAutomatic);
Pixmap wpix = XCompositeNameWindowPixmap(display(), window);
XWindowAttributes attrs;
XGetWindowAttributes(display(), window, &attrs);
XRenderPictFormat* format = XRenderFindVisualFormat(display(), attrs.visual);
Picture pic = XRenderCreatePicture(display(), wpix, format, 0, 0);
QRect rect(p.x(), p.y(), selfCheckWidth(), selfCheckHeight());
XRenderComposite(display(), PictOpSrc, pic, None, buffer, 0, 0, 0, 0,
rect.x(), rect.y(), rect.width(), rect.height());
XRenderFreePicture(display(), pic);
XFreePixmap(display(), wpix);
XDestroyWindow(display(), window);
}
if (mustFreePix)
XFreePixmap(display(), pix.handle());
err.error(true); // just sync and discard
}
bool SceneXrender::selfCheckFinish()
{
KXErrorHandler err;
bool ok = true;
foreach (const QPoint & p, selfCheckPoints()) {
QPixmap pix = QPixmap::grabWindow(rootWindow(), p.x(), p.y(), selfCheckWidth(), selfCheckHeight());
QImage img = pix.toImage();
// kDebug(1212) << "P:" << QColor( img.pixel( 0, 0 )).name();
// kDebug(1212) << "P:" << QColor( img.pixel( 1, 0 )).name();
// kDebug(1212) << "P:" << QColor( img.pixel( 2, 0 )).name();
// kDebug(1212) << "P:" << QColor( img.pixel( 0, 1 )).name();
// kDebug(1212) << "P:" << QColor( img.pixel( 1, 1 )).name();
// kDebug(1212) << "P:" << QColor( img.pixel( 2, 1 )).name();
if (img.pixel(0, 0) != QColor(Qt::red).rgb()
|| img.pixel(1, 0) != QColor(Qt::green).rgb()
|| img.pixel(2, 0) != QColor(Qt::blue).rgb()
|| img.pixel(0, 1) != QColor(Qt::white).rgb()
|| img.pixel(1, 1) != QColor(Qt::black).rgb()
|| img.pixel(2, 1) != QColor(Qt::white).rgb()) {
kError(1212) << "XRender compositing self-check failed, disabling compositing.";
ok = false;
break;
}
}
if (err.error(true))
ok = false;
if (ok)
kDebug(1212) << "XRender compositing self-check passed.";
if (!ok && options->disableCompositingChecks) {
kWarning(1212) << "Compositing checks disabled, proceeding regardless of self-check failure.";
return true;
}
return ok;
}
// the entry point for painting
void SceneXrender::paint(QRegion damage, ToplevelList toplevels)
{
@ -275,17 +169,8 @@ void SceneXrender::paint(QRegion damage, ToplevelList toplevels)
paintScreen(&mask, &damage);
if (wspace->overlayWindow()) // show the window only after the first pass, since
wspace->showOverlay(); // that pass may take long
if (!selfCheckDone) {
selfCheckSetup();
damage |= selfCheckRegion();
}
lastRenderTime = t.elapsed();
flushBuffer(mask, damage);
if (!selfCheckDone) {
if (!selfCheckFinish())
QTimer::singleShot(0, Workspace::self(), SLOT(finishCompositing()));
selfCheckDone = true;
}
// do cleanup
stacking_order.clear();
}

View File

@ -59,9 +59,6 @@ private:
void paintTransformedScreen(int mask);
void createBuffer();
void flushBuffer(int mask, QRegion damage);
bool selfCheck();
void selfCheckSetup();
bool selfCheckFinish();
XRenderPictFormat* format;
Picture front;
static Picture buffer;