From 6fd9d4e4b3e4cbd6cdd9ee35f0a5a2f2107c9ce3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Thu, 4 Sep 2008 19:48:52 +0000 Subject: [PATCH] Create a new window for each tested pixmap with selfcheck, otherwise second test fails for some reason with BadAlloc in glXCreatePixmap(). Maybe nvidia bug, but could be also some hidden KWin bug (according to GLX docs, glXCreatePixmap() can give BadAlloc only when it can't allocate, which is nonsense here, but glXCreateWindow() says that BadAlloc may mean calling it twice on the same window, so maybe here it's twice with the same pixmap - I don't see where the bug could be though). svn path=/trunk/KDE/kdebase/workspace/; revision=857141 --- scene_opengl.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/scene_opengl.cpp b/scene_opengl.cpp index 689f0d7d36..721886024c 100644 --- a/scene_opengl.cpp +++ b/scene_opengl.cpp @@ -633,16 +633,16 @@ void SceneOpenGL::selfCheckSetup( QRegion& damage ) img.setPixel( 2, 0, QColor( Qt::blue ).rgb()); img.setPixel( 3, 0, QColor( Qt::white ).rgb()); img.setPixel( 4, 0, QColor( Qt::black ).rgb()); - XSetWindowAttributes wa; - wa.override_redirect = True; - ::Window window = XCreateWindow( display(), rootWindow(), 0, 0, 5, 1, 0, QX11Info::appDepth(), - CopyFromParent, CopyFromParent, CWOverrideRedirect, &wa ); QPixmap pix = QPixmap::fromImage( img ); - XSetWindowBackgroundPixmap( display(), window, pix.handle()); - XClearWindow( display(), window ); - XMapWindow( display(), window ); foreach( const QPoint& p, selfCheckPoints()) { + XSetWindowAttributes wa; + wa.override_redirect = True; + ::Window window = XCreateWindow( display(), rootWindow(), 0, 0, 5, 1, 0, QX11Info::appDepth(), + CopyFromParent, CopyFromParent, CWOverrideRedirect, &wa ); + XSetWindowBackgroundPixmap( display(), window, pix.handle()); + XClearWindow( display(), window ); + XMapWindow( display(), window ); XMoveWindow( display(), window, p.x(), p.y()); Pixmap wpix = XCompositeNameWindowPixmap( display(), window ); glXWaitX(); @@ -653,10 +653,11 @@ void SceneOpenGL::selfCheckSetup( QRegion& damage ) texture.render( infiniteRegion(), rect ); Workspace::self()->addRepaint( rect ); texture.unbind(); + glXWaitGL(); XFreePixmap( display(), wpix ); damage |= rect; + XDestroyWindow( display(), window ); } - XDestroyWindow( display(), window ); } void SceneOpenGL::selfCheckFinish()