Use 3x2 sized pixmap for the self-check rather than 5x1, to also
check for Y inversion (bnc#450801, although I have no idea what the real problem there is). svn path=/trunk/KDE/kdebase/workspace/; revision=904309
This commit is contained in:
parent
31e4e950b6
commit
6fef8fe8bd
3 changed files with 28 additions and 22 deletions
|
@ -331,7 +331,7 @@ QList< QPoint > Scene::selfCheckPoints() const
|
||||||
++screen )
|
++screen )
|
||||||
{ // test top-left and bottom-right of every screen
|
{ // test top-left and bottom-right of every screen
|
||||||
ret.append( Kephal::ScreenUtils::screenGeometry( screen ).topLeft());
|
ret.append( Kephal::ScreenUtils::screenGeometry( screen ).topLeft());
|
||||||
ret.append( Kephal::ScreenUtils::screenGeometry( screen ).bottomRight() + QPoint( -5 + 1, -1 + 1 )
|
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
|
+ QPoint( -1, 0 )); // intentionally moved one up, since the source windows will be one down
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -627,12 +627,13 @@ bool SceneOpenGL::initDrawableConfigs()
|
||||||
// It would be still nice to check somehow if compositing is not awfully slow.
|
// It would be still nice to check somehow if compositing is not awfully slow.
|
||||||
bool SceneOpenGL::selfCheck()
|
bool SceneOpenGL::selfCheck()
|
||||||
{
|
{
|
||||||
QImage img( 5, 1, QImage::Format_RGB32 );
|
QImage img( 3, 2, QImage::Format_RGB32 );
|
||||||
img.setPixel( 0, 0, QColor( Qt::red ).rgb());
|
img.setPixel( 0, 0, QColor( Qt::red ).rgb());
|
||||||
img.setPixel( 1, 0, QColor( Qt::green ).rgb());
|
img.setPixel( 1, 0, QColor( Qt::green ).rgb());
|
||||||
img.setPixel( 2, 0, QColor( Qt::blue ).rgb());
|
img.setPixel( 2, 0, QColor( Qt::blue ).rgb());
|
||||||
img.setPixel( 3, 0, QColor( Qt::white ).rgb());
|
img.setPixel( 0, 1, QColor( Qt::white ).rgb());
|
||||||
img.setPixel( 4, 0, QColor( Qt::black ).rgb());
|
img.setPixel( 1, 1, QColor( Qt::black ).rgb());
|
||||||
|
img.setPixel( 2, 1, QColor( Qt::white ).rgb());
|
||||||
QPixmap pix = QPixmap::fromImage( img );
|
QPixmap pix = QPixmap::fromImage( img );
|
||||||
QList< QPoint > points = selfCheckPoints();
|
QList< QPoint > points = selfCheckPoints();
|
||||||
QRegion reg;
|
QRegion reg;
|
||||||
|
@ -647,7 +648,7 @@ bool SceneOpenGL::selfCheck()
|
||||||
{
|
{
|
||||||
XSetWindowAttributes wa;
|
XSetWindowAttributes wa;
|
||||||
wa.override_redirect = True;
|
wa.override_redirect = True;
|
||||||
::Window window = XCreateWindow( display(), rootWindow(), 0, 0, 5, 1, 0, QX11Info::appDepth(),
|
::Window window = XCreateWindow( display(), rootWindow(), 0, 0, 3, 2, 0, QX11Info::appDepth(),
|
||||||
CopyFromParent, CopyFromParent, CWOverrideRedirect, &wa );
|
CopyFromParent, CopyFromParent, CWOverrideRedirect, &wa );
|
||||||
XSetWindowBackgroundPixmap( display(), window, pix.handle());
|
XSetWindowBackgroundPixmap( display(), window, pix.handle());
|
||||||
XClearWindow( display(), window );
|
XClearWindow( display(), window );
|
||||||
|
@ -659,9 +660,9 @@ bool SceneOpenGL::selfCheck()
|
||||||
Pixmap wpix = XCompositeNameWindowPixmap( display(), window );
|
Pixmap wpix = XCompositeNameWindowPixmap( display(), window );
|
||||||
glXWaitX();
|
glXWaitX();
|
||||||
Texture texture;
|
Texture texture;
|
||||||
texture.load( wpix, QSize( 5, 1 ), QX11Info::appDepth());
|
texture.load( wpix, QSize( 3, 2 ), QX11Info::appDepth());
|
||||||
texture.bind();
|
texture.bind();
|
||||||
QRect rect( p.x(), p.y(), 5, 1 );
|
QRect rect( p.x(), p.y(), 3, 2 );
|
||||||
texture.render( infiniteRegion(), rect );
|
texture.render( infiniteRegion(), rect );
|
||||||
texture.unbind();
|
texture.unbind();
|
||||||
glXWaitGL();
|
glXWaitGL();
|
||||||
|
@ -673,18 +674,20 @@ bool SceneOpenGL::selfCheck()
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
foreach( const QPoint& p, points )
|
foreach( const QPoint& p, points )
|
||||||
{
|
{
|
||||||
QPixmap pix = QPixmap::grabWindow( rootWindow(), p.x(), p.y(), 5, 1 );
|
QPixmap pix = QPixmap::grabWindow( rootWindow(), p.x(), p.y(), 3, 2 );
|
||||||
QImage img = pix.toImage();
|
QImage img = pix.toImage();
|
||||||
// kDebug(1212) << "P:" << QColor( img.pixel( 0, 0 )).name();
|
// kDebug(1212) << "P:" << QColor( img.pixel( 0, 0 )).name();
|
||||||
// kDebug(1212) << "P:" << QColor( img.pixel( 1, 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( 2, 0 )).name();
|
||||||
// kDebug(1212) << "P:" << QColor( img.pixel( 3, 0 )).name();
|
// kDebug(1212) << "P:" << QColor( img.pixel( 0, 1 )).name();
|
||||||
// kDebug(1212) << "P:" << QColor( img.pixel( 4, 0 )).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()
|
if( img.pixel( 0, 0 ) != QColor( Qt::red ).rgb()
|
||||||
|| img.pixel( 1, 0 ) != QColor( Qt::green ).rgb()
|
|| img.pixel( 1, 0 ) != QColor( Qt::green ).rgb()
|
||||||
|| img.pixel( 2, 0 ) != QColor( Qt::blue ).rgb()
|
|| img.pixel( 2, 0 ) != QColor( Qt::blue ).rgb()
|
||||||
|| img.pixel( 3, 0 ) != QColor( Qt::white ).rgb()
|
|| img.pixel( 0, 1 ) != QColor( Qt::white ).rgb()
|
||||||
|| img.pixel( 4, 0 ) != QColor( Qt::black ).rgb())
|
|| img.pixel( 1, 1 ) != QColor( Qt::black ).rgb()
|
||||||
|
|| img.pixel( 2, 1 ) != QColor( Qt::white ).rgb())
|
||||||
{
|
{
|
||||||
kError( 1212 ) << "Compositing self-check failed, disabling compositing.";
|
kError( 1212 ) << "Compositing self-check failed, disabling compositing.";
|
||||||
ok = false;
|
ok = false;
|
||||||
|
|
|
@ -169,12 +169,13 @@ void SceneXrender::createBuffer()
|
||||||
// Just like SceneOpenGL::selfCheck()
|
// Just like SceneOpenGL::selfCheck()
|
||||||
bool SceneXrender::selfCheck()
|
bool SceneXrender::selfCheck()
|
||||||
{
|
{
|
||||||
QImage img( 5, 1, QImage::Format_RGB32 );
|
QImage img( 3, 2, QImage::Format_RGB32 );
|
||||||
img.setPixel( 0, 0, QColor( Qt::red ).rgb());
|
img.setPixel( 0, 0, QColor( Qt::red ).rgb());
|
||||||
img.setPixel( 1, 0, QColor( Qt::green ).rgb());
|
img.setPixel( 1, 0, QColor( Qt::green ).rgb());
|
||||||
img.setPixel( 2, 0, QColor( Qt::blue ).rgb());
|
img.setPixel( 2, 0, QColor( Qt::blue ).rgb());
|
||||||
img.setPixel( 3, 0, QColor( Qt::white ).rgb());
|
img.setPixel( 0, 1, QColor( Qt::white ).rgb());
|
||||||
img.setPixel( 4, 0, QColor( Qt::black ).rgb());
|
img.setPixel( 1, 1, QColor( Qt::black ).rgb());
|
||||||
|
img.setPixel( 2, 1, QColor( Qt::white ).rgb());
|
||||||
QPixmap pix = QPixmap::fromImage( img );
|
QPixmap pix = QPixmap::fromImage( img );
|
||||||
QList< QPoint > points = selfCheckPoints();
|
QList< QPoint > points = selfCheckPoints();
|
||||||
QRegion reg;
|
QRegion reg;
|
||||||
|
@ -189,7 +190,7 @@ bool SceneXrender::selfCheck()
|
||||||
{
|
{
|
||||||
XSetWindowAttributes wa;
|
XSetWindowAttributes wa;
|
||||||
wa.override_redirect = True;
|
wa.override_redirect = True;
|
||||||
::Window window = XCreateWindow( display(), rootWindow(), 0, 0, 5, 1, 0, QX11Info::appDepth(),
|
::Window window = XCreateWindow( display(), rootWindow(), 0, 0, 3, 2, 0, QX11Info::appDepth(),
|
||||||
CopyFromParent, CopyFromParent, CWOverrideRedirect, &wa );
|
CopyFromParent, CopyFromParent, CWOverrideRedirect, &wa );
|
||||||
XSetWindowBackgroundPixmap( display(), window, pix.handle());
|
XSetWindowBackgroundPixmap( display(), window, pix.handle());
|
||||||
XClearWindow( display(), window );
|
XClearWindow( display(), window );
|
||||||
|
@ -203,7 +204,7 @@ bool SceneXrender::selfCheck()
|
||||||
XGetWindowAttributes( display(), window, &attrs );
|
XGetWindowAttributes( display(), window, &attrs );
|
||||||
XRenderPictFormat* format = XRenderFindVisualFormat( display(), attrs.visual );
|
XRenderPictFormat* format = XRenderFindVisualFormat( display(), attrs.visual );
|
||||||
Picture pic = XRenderCreatePicture( display(), wpix, format, 0, 0 );
|
Picture pic = XRenderCreatePicture( display(), wpix, format, 0, 0 );
|
||||||
QRect rect( p.x(), p.y(), 5, 1 );
|
QRect rect( p.x(), p.y(), 3, 2 );
|
||||||
XRenderComposite( display(), PictOpSrc, pic, None, buffer, 0, 0, 0, 0,
|
XRenderComposite( display(), PictOpSrc, pic, None, buffer, 0, 0, 0, 0,
|
||||||
rect.x(), rect.y(), rect.width(), rect.height());
|
rect.x(), rect.y(), rect.width(), rect.height());
|
||||||
XFreePixmap( display(), wpix );
|
XFreePixmap( display(), wpix );
|
||||||
|
@ -213,18 +214,20 @@ bool SceneXrender::selfCheck()
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
foreach( const QPoint& p, points )
|
foreach( const QPoint& p, points )
|
||||||
{
|
{
|
||||||
QPixmap pix = QPixmap::grabWindow( rootWindow(), p.x(), p.y(), 5, 1 );
|
QPixmap pix = QPixmap::grabWindow( rootWindow(), p.x(), p.y(), 3, 2 );
|
||||||
QImage img = pix.toImage();
|
QImage img = pix.toImage();
|
||||||
// kDebug(1212) << "P:" << QColor( img.pixel( 0, 0 )).name();
|
// kDebug(1212) << "P:" << QColor( img.pixel( 0, 0 )).name();
|
||||||
// kDebug(1212) << "P:" << QColor( img.pixel( 1, 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( 2, 0 )).name();
|
||||||
// kDebug(1212) << "P:" << QColor( img.pixel( 3, 0 )).name();
|
// kDebug(1212) << "P:" << QColor( img.pixel( 0, 1 )).name();
|
||||||
// kDebug(1212) << "P:" << QColor( img.pixel( 4, 0 )).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()
|
if( img.pixel( 0, 0 ) != QColor( Qt::red ).rgb()
|
||||||
|| img.pixel( 1, 0 ) != QColor( Qt::green ).rgb()
|
|| img.pixel( 1, 0 ) != QColor( Qt::green ).rgb()
|
||||||
|| img.pixel( 2, 0 ) != QColor( Qt::blue ).rgb()
|
|| img.pixel( 2, 0 ) != QColor( Qt::blue ).rgb()
|
||||||
|| img.pixel( 3, 0 ) != QColor( Qt::white ).rgb()
|
|| img.pixel( 0, 1 ) != QColor( Qt::white ).rgb()
|
||||||
|| img.pixel( 4, 0 ) != QColor( Qt::black ).rgb())
|
|| img.pixel( 1, 1 ) != QColor( Qt::black ).rgb()
|
||||||
|
|| img.pixel( 2, 1 ) != QColor( Qt::white ).rgb())
|
||||||
{
|
{
|
||||||
kError( 1212 ) << "Compositing self-check failed, disabling compositing.";
|
kError( 1212 ) << "Compositing self-check failed, disabling compositing.";
|
||||||
ok = false;
|
ok = false;
|
||||||
|
|
Loading…
Reference in a new issue