From a76b8bf67696ae69888cc6237417e7c8f07f8da6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 17 Aug 2010 10:29:03 +0200 Subject: Prevented Xorg crash in qtdemo when running corkboards example. The crash happens in the Nvidia driver in glXReleaseTexImageEXT when scrolling the corkboard using the mouse. To work around it we detect the Nvidia driver versions where this is known to be a problem and skip using the texture from pixmap extension in those cases. Task-number: QTBUG-12914 Reviewed-by: Trond --- src/opengl/qgl.cpp | 30 +++++++++++++++++++++++++----- src/opengl/qgl_p.h | 3 +++ 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 4daa866..74bde36 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1688,6 +1688,10 @@ void QGLContextPrivate::init(QPaintDevice *dev, const QGLFormat &format) workaround_needsFullClearOnEveryFrame = false; workaround_brokenFBOReadBack = false; workaroundsCached = false; + + workaround_brokenTextureFromPixmap = false; + workaround_brokenTextureFromPixmap_init = false; + for (int i = 0; i < QT_GL_VERTEX_ARRAY_TRACKED_COUNT; ++i) vertexAttributeArraysEnabledState[i] = false; } @@ -2570,11 +2574,27 @@ QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target, && xinfo && xinfo->screen() == pixmap.x11Info().screen() && target == GL_TEXTURE_2D) { - texture = bindTextureFromNativePixmap(const_cast(&pixmap), key, options); - if (texture) { - texture->options |= QGLContext::MemoryManagedBindOption; - texture->boundPixmap = pd; - boundPixmaps.insert(pd, QPixmap(pixmap)); + if (!workaround_brokenTextureFromPixmap_init) { + workaround_brokenTextureFromPixmap_init = true; + + const QByteArray versionString(reinterpret_cast(glGetString(GL_VERSION))); + const int pos = versionString.indexOf("NVIDIA "); + + if (pos >= 0) { + const QByteArray nvidiaVersionString = versionString.mid(pos + strlen("NVIDIA ")); + + if (nvidiaVersionString.startsWith("195") || nvidiaVersionString.startsWith("256")) + workaround_brokenTextureFromPixmap = true; + } + } + + if (!workaround_brokenTextureFromPixmap) { + texture = bindTextureFromNativePixmap(const_cast(&pixmap), key, options); + if (texture) { + texture->options |= QGLContext::MemoryManagedBindOption; + texture->boundPixmap = pd; + boundPixmaps.insert(pd, QPixmap(pixmap)); + } } } #endif diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 32feacd..ca0d3fa 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -393,6 +393,9 @@ public: uint workaround_brokenFBOReadBack : 1; uint workaroundsCached : 1; + uint workaround_brokenTextureFromPixmap : 1; + uint workaround_brokenTextureFromPixmap_init : 1; + QPaintDevice *paintDevice; QColor transpColor; QGLContext *q_ptr; -- cgit v0.12 From cc6dc0aeefde881a95f5fea2b26f2f3d7bdc6e15 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Tue, 17 Aug 2010 10:08:20 +0200 Subject: Cocoa: parent windows shows on screen when they should be hidden The reason is the cocoa method that adds a window as a child of another, it ends up showing both the parent and the child window regardless. And this could in some cases also cause a crash. So we therefore need to be careful when calling that function, and be sure that the parent is actually visible. In addition, addChildWindow reset the stacking level of the child window, and made e.g. normal child windows pop in front of tool child windows. This could easily be seen in e.g. Designer. Task-number: QTBUG-12866 Reviewed-by: prasanth --- src/gui/kernel/qwidget_mac.mm | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 8ae6a99..4ed4ccc 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -2796,10 +2796,16 @@ void QWidgetPrivate::setSubWindowStacking(bool set) if (QWidget *parent = q->parentWidget()) { if (parent->testAttribute(Qt::WA_WState_Created)) { - if (set) - [qt_mac_window_for(parent) addChildWindow:qt_mac_window_for(q) ordered:NSWindowAbove]; - else + if (set) { + if (parent->isVisible()) { + NSWindow *childwin = qt_mac_window_for(q); + int childLevel = [childwin level]; + [qt_mac_window_for(parent) addChildWindow:childwin ordered:NSWindowAbove]; + [childwin setLevel:childLevel]; + } + } else { [qt_mac_window_for(parent) removeChildWindow:qt_mac_window_for(q)]; + } } } @@ -2807,10 +2813,14 @@ void QWidgetPrivate::setSubWindowStacking(bool set) for (int i=0; iisWindow() && child->testAttribute(Qt::WA_WState_Created) && child->isVisibleTo(q)) { - if (set) - [qt_mac_window_for(q) addChildWindow:qt_mac_window_for(child) ordered:NSWindowAbove]; - else + if (set) { + NSWindow *childwin = qt_mac_window_for(child); + int childLevel = [childwin level]; + [qt_mac_window_for(q) addChildWindow:childwin ordered:NSWindowAbove]; + [childwin setLevel:childLevel]; + } else { [qt_mac_window_for(q) removeChildWindow:qt_mac_window_for(child)]; + } } } } -- cgit v0.12 From ff405f5623d7ed18c881c097368e3e9afd2e9443 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 17 Aug 2010 10:45:17 +0200 Subject: Outline / fill inconsistency in X11 paint engine. Change ebbab30af417dfbf3df47dec15c0e2f8d6a30fa6 broke outline / fill consistency in the X11 engine. Since the positioning of lines is more important we'll round the fill coordinates the same way. The bug was visible in the filltest.qps arthur test. Reviewed-by: Gunnar Sletta --- src/gui/painting/qpaintengine_x11.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/painting/qpaintengine_x11.cpp b/src/gui/painting/qpaintengine_x11.cpp index e521e01..5307142 100644 --- a/src/gui/painting/qpaintengine_x11.cpp +++ b/src/gui/painting/qpaintengine_x11.cpp @@ -1516,8 +1516,8 @@ void QX11PaintEnginePrivate::fillPolygon_translated(const QPointF *polygonPoints for (int i = 0; i < pointCount; ++i) { translated_points[i] = polygonPoints[i] + offset; - translated_points[i].rx() = qRound(translated_points[i].x()) + offs; - translated_points[i].ry() = qRound(translated_points[i].y()) + offs; + translated_points[i].rx() = qFloor(translated_points[i].x()) + offs; + translated_points[i].ry() = qFloor(translated_points[i].y()) + offs; } fillPolygon_dev(translated_points.data(), pointCount, gcMode, mode); @@ -1754,8 +1754,8 @@ void QX11PaintEnginePrivate::fillPath(const QPainterPath &path, QX11PaintEngineP for (int j = 0; j < polys.at(i).size(); ++j) { translated_points[j] = polys.at(i).at(j); if (!X11->use_xrender || !(render_hints & QPainter::Antialiasing)) { - translated_points[j].rx() = qRound(translated_points[j].rx() + aliasedCoordinateDelta) + offs; - translated_points[j].ry() = qRound(translated_points[j].ry() + aliasedCoordinateDelta) + offs; + translated_points[j].rx() = qFloor(translated_points[j].rx() + aliasedCoordinateDelta) + offs; + translated_points[j].ry() = qFloor(translated_points[j].ry() + aliasedCoordinateDelta) + offs; } } -- cgit v0.12 From 63434c07fbe4e3d8735a9e28200ce9b3b121bec8 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 12 Aug 2010 19:47:41 +0200 Subject: fix QMAKE_SUBSTITUTES with shadow builds still doesn't work for nested directories, but that's because fileFixify() is plain broken. on the way, remove a superfluous check: we know that the input file name ends with .in - three lines up we made sure it does. Reviewed-by: joerg --- qmake/generators/makefile.cpp | 6 +++--- tests/auto/qmake/testdata/substitutes/sub/test2.in | 1 + tests/auto/qmake/testdata/substitutes/test.in | 2 ++ tests/auto/qmake/testdata/substitutes/test.pro | 2 ++ tests/auto/qmake/testdata/substitutes_build/README | 1 + tests/auto/qmake/tst_qmake.cpp | 16 ++++++++++++++++ 6 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 tests/auto/qmake/testdata/substitutes/sub/test2.in create mode 100644 tests/auto/qmake/testdata/substitutes/test.in create mode 100644 tests/auto/qmake/testdata/substitutes/test.pro create mode 100644 tests/auto/qmake/testdata/substitutes_build/README diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 45a96f5..851e587 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -471,9 +471,9 @@ MakefileGenerator::init() subs.at(i).toLatin1().constData()); continue; } - QFile in(fileFixify(subs.at(i))), out(fileInfo(subs.at(i)).fileName()); - if(out.fileName().endsWith(".in")) - out.setFileName(out.fileName().left(out.fileName().length()-3)); + QFile in(fileFixify(subs.at(i))); + QFile out(fileFixify(subs.at(i).left(subs.at(i).length()-3), + qmake_getpwd(), Option::output_dir)); if(in.open(QFile::ReadOnly)) { QString contents; QStack state; diff --git a/tests/auto/qmake/testdata/substitutes/sub/test2.in b/tests/auto/qmake/testdata/substitutes/sub/test2.in new file mode 100644 index 0000000..78a6069 --- /dev/null +++ b/tests/auto/qmake/testdata/substitutes/sub/test2.in @@ -0,0 +1 @@ +heya diff --git a/tests/auto/qmake/testdata/substitutes/test.in b/tests/auto/qmake/testdata/substitutes/test.in new file mode 100644 index 0000000..2fa05e0 --- /dev/null +++ b/tests/auto/qmake/testdata/substitutes/test.in @@ -0,0 +1,2 @@ +test +tst diff --git a/tests/auto/qmake/testdata/substitutes/test.pro b/tests/auto/qmake/testdata/substitutes/test.pro new file mode 100644 index 0000000..5bce312 --- /dev/null +++ b/tests/auto/qmake/testdata/substitutes/test.pro @@ -0,0 +1,2 @@ +QMAKE_SUBSTITUTES += test.in +# doesn't work for the time being: sub/test2.in diff --git a/tests/auto/qmake/testdata/substitutes_build/README b/tests/auto/qmake/testdata/substitutes_build/README new file mode 100644 index 0000000..81dc596 --- /dev/null +++ b/tests/auto/qmake/testdata/substitutes_build/README @@ -0,0 +1 @@ +Placeholder file to ensure this directory exists diff --git a/tests/auto/qmake/tst_qmake.cpp b/tests/auto/qmake/tst_qmake.cpp index 5efe714..825e49b 100644 --- a/tests/auto/qmake/tst_qmake.cpp +++ b/tests/auto/qmake/tst_qmake.cpp @@ -90,6 +90,7 @@ private slots: void bundle_spaces(); #endif void includefunction(); + void substitutes(); private: TestCompiler test_compiler; @@ -477,6 +478,21 @@ void tst_qmake::includefunction() QVERIFY(test_compiler.commandOutput().contains(warningMsg)); } +void tst_qmake::substitutes() +{ + QString workDir = base_path + "/testdata/substitutes"; + QVERIFY( test_compiler.qmake( workDir, "test" )); + QVERIFY( test_compiler.exists( workDir, "test", Exe, "1.0.0" )); + //QVERIFY( test_compiler.exists( workDir, "sub/test2", Exe, "1.0.0" )); + QVERIFY( test_compiler.makeDistClean( workDir )); + + QString buildDir = base_path + "/testdata/substitutes_build"; + QVERIFY( test_compiler.qmake( workDir, "test", buildDir )); + QVERIFY( test_compiler.exists( buildDir, "test", Exe, "1.0.0" )); + //QVERIFY( test_compiler.exists( buildDir, "sub/test2", Exe, "1.0.0" )); + QVERIFY( test_compiler.makeDistClean( buildDir )); +} + QTEST_MAIN(tst_qmake) #include "tst_qmake.moc" -- cgit v0.12 From 2b5469fcb541fd0c37c04acbe1470228272f8adf Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 17 Aug 2010 11:57:58 +0200 Subject: exclude QtXmlPatterns from the completeness assessment that context is a *huge* collection of cryptic error messages, translation of which does not add too much value. so skip it. --- translations/check-ts.xq | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translations/check-ts.xq b/translations/check-ts.xq index 2d6404c..1062e90 100644 --- a/translations/check-ts.xq +++ b/translations/check-ts.xq @@ -1,3 +1,3 @@ for $file in tokenize($files, codepoints-to-string(10)) - let $fresh := doc($file)/TS/context/message[not (translation/@type = 'obsolete')] + let $fresh := doc($file)/TS/context[not (name = 'QtXmlPatterns')]/message[not (translation/@type = 'obsolete')] return concat($file, ":", count($fresh/translation[not (@type = 'unfinished')]) * 100 idiv count($fresh)) -- cgit v0.12 From 40a2971d2ebe2b7409c13ab049ed26b249033d8e Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Tue, 17 Aug 2010 13:34:10 +0200 Subject: Fix compilation: QT_NO_TEXTSTREAM Merge-request: 2450 Reviewed-by: Oswald Buddenhagen --- src/plugins/bearer/connman/qconnmanservice_linux.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/bearer/connman/qconnmanservice_linux.cpp b/src/plugins/bearer/connman/qconnmanservice_linux.cpp index eb88317..b15589e 100644 --- a/src/plugins/bearer/connman/qconnmanservice_linux.cpp +++ b/src/plugins/bearer/connman/qconnmanservice_linux.cpp @@ -1053,7 +1053,9 @@ bool QConnmanDeviceInterface::setProperty(const QString &name, const QDBusVarian { // QList args; +#ifndef QT_NO_TEXTSTREAM qWarning() << __FUNCTION__ << name << value.variant(); +#endif // args << qVariantFromValue(name); // args << qVariantFromValue(value); -- cgit v0.12 From 608ed55d87a714be9b0b9681345bd012b40db4e5 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Tue, 17 Aug 2010 14:37:32 +0200 Subject: Cocoa: add autotest to be more safe regarding child window stacking Autotests only. Use native events on mac to check that child windows stays on top of parent windows. Reviewed-by: prasanth --- tests/auto/macnativeevents/tst_macnativeevents.cpp | 80 ++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/tests/auto/macnativeevents/tst_macnativeevents.cpp b/tests/auto/macnativeevents/tst_macnativeevents.cpp index ffd0596..ac7d661 100644 --- a/tests/auto/macnativeevents/tst_macnativeevents.cpp +++ b/tests/auto/macnativeevents/tst_macnativeevents.cpp @@ -67,6 +67,11 @@ private slots: void testDragWindow(); void testMouseEnter(); void testChildDialogInFrontOfModalParent(); +#ifdef QT_MAC_USE_COCOA + void testChildWindowInFrontOfParentWindow(); + void testChildToolWindowInFrontOfChildNormalWindow(); + void testChildWindowInFrontOfStaysOnTopParentWindow(); +#endif void testKeyPressOnToplevel(); }; @@ -308,6 +313,81 @@ void tst_MacNativeEvents::testChildDialogInFrontOfModalParent() QVERIFY(!child.isVisible()); } +#ifdef QT_MAC_USE_COCOA +void tst_MacNativeEvents::testChildWindowInFrontOfParentWindow() +{ + // Test that a child window always stacks in front of its parent window. + // Do this by first click on the parent, then on the child window button. + QWidget parent; + QPushButton child("a button", &parent); + child.setWindowFlags(Qt::Window); + connect(&child, SIGNAL(clicked()), &child, SLOT(close())); + parent.show(); + child.show(); + + QPoint parent_p = parent.geometry().bottomLeft() + QPoint(20, -20); + QPoint child_p = child.geometry().center(); + + NativeEventList native; + native.append(new QNativeMouseButtonEvent(parent_p, Qt::LeftButton, 1, Qt::NoModifier)); + native.append(new QNativeMouseButtonEvent(parent_p, Qt::LeftButton, 0, Qt::NoModifier)); + native.append(new QNativeMouseButtonEvent(child_p, Qt::LeftButton, 1, Qt::NoModifier)); + native.append(new QNativeMouseButtonEvent(child_p, Qt::LeftButton, 0, Qt::NoModifier)); + + native.play(); + QTest::qWait(100); + QVERIFY(!child.isVisible()); +} + +void tst_MacNativeEvents::testChildToolWindowInFrontOfChildNormalWindow() +{ + // Test that a child tool window always stacks in front of normal sibling windows. + // Do this by first click on the sibling, then on the tool window button. + QWidget parent; + QWidget normalChild(&parent, Qt::Window); + QPushButton toolChild("a button", &parent); + toolChild.setWindowFlags(Qt::Tool); + connect(&toolChild, SIGNAL(clicked()), &toolChild, SLOT(close())); + parent.show(); + normalChild.show(); + toolChild.show(); + + QPoint normalChild_p = normalChild.geometry().bottomLeft() + QPoint(20, -20); + QPoint toolChild_p = toolChild.geometry().center(); + + NativeEventList native; + native.append(new QNativeMouseButtonEvent(normalChild_p, Qt::LeftButton, 1, Qt::NoModifier)); + native.append(new QNativeMouseButtonEvent(normalChild_p, Qt::LeftButton, 0, Qt::NoModifier)); + native.append(new QNativeMouseButtonEvent(toolChild_p, Qt::LeftButton, 1, Qt::NoModifier)); + native.append(new QNativeMouseButtonEvent(toolChild_p, Qt::LeftButton, 0, Qt::NoModifier)); + + native.play(); + QTest::qWait(100); + QVERIFY(!toolChild.isVisible()); +} + +void tst_MacNativeEvents::testChildWindowInFrontOfStaysOnTopParentWindow() +{ + // Test that a child window stacks on top of a stays-on-top parent. + QWidget parent(0, Qt::WindowStaysOnTopHint); + QPushButton button("close", &parent); + button.setWindowFlags(Qt::Window); + connect(&button, SIGNAL(clicked()), &button, SLOT(close())); + parent.show(); + button.show(); + QPoint inside = button.geometry().center(); + + // Post a click on the button to close the child dialog: + NativeEventList native; + native.append(new QNativeMouseButtonEvent(inside, Qt::LeftButton, 1, Qt::NoModifier)); + native.append(new QNativeMouseButtonEvent(inside, Qt::LeftButton, 0, Qt::NoModifier)); + + native.play(); + QTest::qWait(100); + QVERIFY(!button.isVisible()); +} +#endif + void tst_MacNativeEvents::testKeyPressOnToplevel() { // Check that we receive keyevents for -- cgit v0.12 From ab97e11919927d38bfc2be990d2b4dd1327083ea Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 17 Aug 2010 15:15:31 +0200 Subject: qgrayraster: Remove unnecessary indirection in QT_FT_Outline_Decompose MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since this function is only used inside qgrayraster.c, we can call the gray_* functions directly instead of going through function pointers. This allows inlining trivial methods like gray_line_to() et al. Reviewed-by: Samuel Rødal --- src/gui/painting/qgrayraster.c | 44 +++++++++--------------------------------- 1 file changed, 9 insertions(+), 35 deletions(-) diff --git a/src/gui/painting/qgrayraster.c b/src/gui/painting/qgrayraster.c index 539a33c..94039fb 100644 --- a/src/gui/painting/qgrayraster.c +++ b/src/gui/painting/qgrayraster.c @@ -1355,10 +1355,6 @@ /* */ /* outline :: A pointer to the source target. */ /* */ - /* func_interface :: A table of `emitters', i.e,. function pointers */ - /* called during decomposition to indicate path */ - /* operations. */ - /* */ /* user :: A typeless pointer which is passed to each */ /* emitter during the decomposition. It can be */ /* used to store the state during the */ @@ -1369,15 +1365,10 @@ /* */ static int QT_FT_Outline_Decompose( const QT_FT_Outline* outline, - const QT_FT_Outline_Funcs* func_interface, void* user ) { #undef SCALED -#if 0 -#define SCALED( x ) ( ( (x) << shift ) - delta ) -#else #define SCALED( x ) (x) -#endif QT_FT_Vector v_last; QT_FT_Vector v_control; @@ -1392,12 +1383,6 @@ int error; char tag; /* current point's state */ -#if 0 - int shift = func_interface->shift; - TPos delta = func_interface->delta; -#endif - - first = 0; for ( n = 0; n < outline->n_contours; n++ ) @@ -1451,7 +1436,7 @@ tags--; } - error = func_interface->move_to( &v_start, user ); + error = gray_move_to( &v_start, user ); if ( error ) goto Exit; @@ -1471,7 +1456,7 @@ vec.x = SCALED( point->x ); vec.y = SCALED( point->y ); - error = func_interface->line_to( &vec, user ); + error = gray_line_to( &vec, user ); if ( error ) goto Exit; continue; @@ -1498,7 +1483,7 @@ if ( tag == QT_FT_CURVE_TAG_ON ) { - error = func_interface->conic_to( &v_control, &vec, + error = gray_conic_to( &v_control, &vec, user ); if ( error ) goto Exit; @@ -1511,7 +1496,7 @@ v_middle.x = ( v_control.x + vec.x ) / 2; v_middle.y = ( v_control.y + vec.y ) / 2; - error = func_interface->conic_to( &v_control, &v_middle, + error = gray_conic_to( &v_control, &v_middle, user ); if ( error ) goto Exit; @@ -1520,7 +1505,7 @@ goto Do_Conic; } - error = func_interface->conic_to( &v_control, &v_start, + error = gray_conic_to( &v_control, &v_start, user ); goto Close; } @@ -1551,20 +1536,20 @@ vec.x = SCALED( point->x ); vec.y = SCALED( point->y ); - error = func_interface->cubic_to( &vec1, &vec2, &vec, user ); + error = gray_cubic_to( &vec1, &vec2, &vec, user ); if ( error ) goto Exit; continue; } - error = func_interface->cubic_to( &vec1, &vec2, &v_start, user ); + error = gray_cubic_to( &vec1, &vec2, &v_start, user ); goto Close; } } } /* close the contour with a line segment */ - error = func_interface->line_to( &v_start, user ); + error = gray_line_to( &v_start, user ); Close: if ( error ) @@ -1592,22 +1577,11 @@ static int gray_convert_glyph_inner( RAS_ARG ) { - static - const QT_FT_Outline_Funcs func_interface = - { - (QT_FT_Outline_MoveTo_Func) gray_move_to, - (QT_FT_Outline_LineTo_Func) gray_line_to, - (QT_FT_Outline_ConicTo_Func)gray_conic_to, - (QT_FT_Outline_CubicTo_Func)gray_cubic_to, - 0, - 0 - }; - volatile int error = 0; if ( qt_ft_setjmp( ras.jump_buffer ) == 0 ) { - error = QT_FT_Outline_Decompose( &ras.outline, &func_interface, &ras ); + error = QT_FT_Outline_Decompose( &ras.outline, &ras ); gray_record_cell( RAS_VAR ); } else -- cgit v0.12 From acfa3c743c23ca2443d618bda6f3c01f78777b77 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Tue, 17 Aug 2010 16:31:14 +0200 Subject: Add tests/benchmarks/README With some information from the dev mailing list. Reviewed-by: Thiago --- tests/benchmarks/README | 81 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 tests/benchmarks/README diff --git a/tests/benchmarks/README b/tests/benchmarks/README new file mode 100644 index 0000000..d437299 --- /dev/null +++ b/tests/benchmarks/README @@ -0,0 +1,81 @@ +The most reliable way of running benchmarks is to do it in an otherwise idle +system. On a busy system, the results will vary according to the other tasks +demanding attention in the system. + +We have managed to obtain quite reliable results by doing the following on +Linux (and you need root): + + - switching the scheduler to a Real-Time mode + - setting the processor affinity to one single processor + - disabling the other thread of the same core + +This should work rather well for CPU-intensive tasks. A task that is in Real- +Time mode will simply not be preempted by the OS. But if you make OS syscalls, +especially I/O ones, your task will be de-scheduled. Note that this includes +page faults, so if you can, make sure your benchmark's warmup code paths touch +most of the data. + +To do this you need a tool called schedtool (package schedtool), from +http://freequaos.host.sk/schedtool/ + +From this point on, we are using CPU0 for all tasks: + +If you have a Hyperthreaded multi-core processor (Core-i5 and Core-i7), you +have to disable the other thread of the same core as CPU0. To discover which +one it is: + +$ cat /sys/devices/system/cpu/cpu0/topology/thread_siblings_list + +This will print something like 0,4, meaning that CPUs 0 and 4 are sibling +threads on the same core. So we'll turn CPU 4 off: + +(as root) +# echo 0 > /sys/devices/system/cpu/cpu4/online + +To turn it back on, echo 1 into the same file. + +To run a task on CPU 0 exclusively, using FIFO RT priority 10, you run the +following: + +(as root) +# schedtool -F -p 10 -a 1 -e ./taskname + +For example: +# schedtool -F -p 10 -a 1 -e ./tst_bench_qstring -tickcounter + +Warning: if your task livelocks or takes far too long to complete, your system +may be unusable for a long time, especially if you don't have other cores to +run stuff on. To prevent that, run it before schedtool and time it. + +You can also limit the CPU time that the task is allowed to take. Run in the +same shell as you'll run schedtool: + +$ ulimit -s 300 +To limit to 300 seconds (5 minutes) + +If your task runs away, it will get a SIGXCPU after consuming 5 minutes of CPU +time (5 minutes running at 100%). + +If your app is multithreaded, you may want to give it more CPUs, like CPU0 and +CPU1 with -a 3 (it's a bitmask). + +For best results, you should disable ALL other cores and threads of the same +processor. The new Core-i7 have one processor with 4 cores, +each core can run 2 threads; the older Mac Pros have two processors with 4 +cores each. So on those Mac Pros, you'd disable cores 1, 2 and 3, while on the +Core-i7, you'll need to disable all other CPUs. + +However, disabling just the sibling thread seems to produce very reliable +results for me already, with variance often below 0.5% (even though there are +some measurable spikes). + +Other things to try: + +Running the benchmark with highest priority, i.e. "sudo nice -19" +usually produces stable results on some machines. If the benchmark also +involves displaying something on the screen (on X11), running it with +"-sync" is a must. Though, in that case the "real" cost is not correct, +but it is useful to discover regressions. + +Also; not many people know about ionice (1) + ionice - get/set program io scheduling class and priority -- cgit v0.12 From db41f54d5cfe9e1cfa13c78536718ca34f008284 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 17 Aug 2010 16:46:21 +0200 Subject: make error messages consistent this re-uses an existing string and obsoletes another one, so it is ok during string freeze. --- tools/assistant/tools/assistant/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/assistant/tools/assistant/main.cpp b/tools/assistant/tools/assistant/main.cpp index 51ea9f9..02507ae 100644 --- a/tools/assistant/tools/assistant/main.cpp +++ b/tools/assistant/tools/assistant/main.cpp @@ -355,7 +355,7 @@ int main(int argc, char *argv[]) QHelpEngineCore cachedCollection(cachedCollectionFile); if (!cachedCollection.setupData()) { cmd.showMessage(QCoreApplication::translate("Assistant", - "Error reading collection file '%1': %2"). + "Error reading collection file '%1': %2."). arg(cachedCollectionFile). arg(cachedCollection.error()), true); return EXIT_FAILURE; -- cgit v0.12 From 569b28760ba84a2cc5315bf06c173035dc14afc6 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Tue, 17 Aug 2010 17:30:34 +0200 Subject: Cocoa, Autotest: disable autotest that was added a bit premature The test is actually correct, but cannot be enabled before a second revision on the setStackingOrder function in qwidget_mac.mm has been rewritten to handle inter-child window stacking order Reviewed-by: prasanth --- tests/auto/macnativeevents/tst_macnativeevents.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/auto/macnativeevents/tst_macnativeevents.cpp b/tests/auto/macnativeevents/tst_macnativeevents.cpp index ac7d661..d582417 100644 --- a/tests/auto/macnativeevents/tst_macnativeevents.cpp +++ b/tests/auto/macnativeevents/tst_macnativeevents.cpp @@ -69,7 +69,7 @@ private slots: void testChildDialogInFrontOfModalParent(); #ifdef QT_MAC_USE_COCOA void testChildWindowInFrontOfParentWindow(); - void testChildToolWindowInFrontOfChildNormalWindow(); +// void testChildToolWindowInFrontOfChildNormalWindow(); void testChildWindowInFrontOfStaysOnTopParentWindow(); #endif void testKeyPressOnToplevel(); @@ -339,6 +339,7 @@ void tst_MacNativeEvents::testChildWindowInFrontOfParentWindow() QVERIFY(!child.isVisible()); } +/* This test can be enabled once setStackingOrder has been fixed in qwidget_mac.mm void tst_MacNativeEvents::testChildToolWindowInFrontOfChildNormalWindow() { // Test that a child tool window always stacks in front of normal sibling windows. @@ -365,7 +366,7 @@ void tst_MacNativeEvents::testChildToolWindowInFrontOfChildNormalWindow() QTest::qWait(100); QVERIFY(!toolChild.isVisible()); } - +*/ void tst_MacNativeEvents::testChildWindowInFrontOfStaysOnTopParentWindow() { // Test that a child window stacks on top of a stays-on-top parent. -- cgit v0.12 From 749ad26d255327c9fa3fe857a30983cc6dfef0d9 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Tue, 17 Aug 2010 17:33:42 +0200 Subject: Cocoa: revert parts of cc6dc0aeefde881a95f5fea2b26f2f3d7bdc6e15 The reason is that we tried to fix the stacking order of child windows while we fixed a crash. But the patch turned out to break an auto-test Reviewed-by: prasanth --- src/gui/kernel/qwidget_mac.mm | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 4ed4ccc..1979c84 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -2799,9 +2799,7 @@ void QWidgetPrivate::setSubWindowStacking(bool set) if (set) { if (parent->isVisible()) { NSWindow *childwin = qt_mac_window_for(q); - int childLevel = [childwin level]; [qt_mac_window_for(parent) addChildWindow:childwin ordered:NSWindowAbove]; - [childwin setLevel:childLevel]; } } else { [qt_mac_window_for(parent) removeChildWindow:qt_mac_window_for(q)]; @@ -2815,9 +2813,7 @@ void QWidgetPrivate::setSubWindowStacking(bool set) if (child->isWindow() && child->testAttribute(Qt::WA_WState_Created) && child->isVisibleTo(q)) { if (set) { NSWindow *childwin = qt_mac_window_for(child); - int childLevel = [childwin level]; [qt_mac_window_for(q) addChildWindow:childwin ordered:NSWindowAbove]; - [childwin setLevel:childLevel]; } else { [qt_mac_window_for(q) removeChildWindow:qt_mac_window_for(child)]; } -- cgit v0.12