RESOLVED FIXED 98654
[Qt][WTR] Do a forced repaint before generating pixel results
https://bugs.webkit.org/show_bug.cgi?id=98654
Summary [Qt][WTR] Do a forced repaint before generating pixel results
Balazs Kelemen
Reported 2012-10-08 09:14:30 PDT
The CoordinatedGraphics rendering backend needs an extra step of synchronisation in order to generate reliable pixel snapshots. Currently pixel results are generated at the end of the test run synchronously so we should slightly change WTR in order to allow delaying the dump after WKPageForceRepaint call us back.
Attachments
Patch (16.67 KB, patch)
2012-10-08 09:49 PDT, Balazs Kelemen
no flags
Patch (14.71 KB, patch)
2012-10-09 10:22 PDT, Balazs Kelemen
no flags
Patch (7.09 KB, patch)
2012-10-10 10:33 PDT, Balazs Kelemen
no flags
Patch (10.55 KB, patch)
2012-10-11 05:47 PDT, Balazs Kelemen
no flags
Patch (10.59 KB, patch)
2012-10-11 08:47 PDT, Balazs Kelemen
no flags
Patch (10.47 KB, patch)
2012-10-12 09:12 PDT, Balazs Kelemen
no flags
Balazs Kelemen
Comment 1 2012-10-08 09:49:05 PDT
Jocelyn Turcotte
Comment 2 2012-10-09 05:46:30 PDT
Comment on attachment 167549 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=167549&action=review > Tools/WebKitTestRunner/qt/TestInvocationQt.cpp:117 > + if (!s_watchDog) > + s_watchDog = new ForceRepaintDoneWatchDog(this); > + s_watchDog->start(); It feels like you're basically implementing what runUntil already does. How about adding the extra async step to the chain of steps that we have in TestInvocation::invoke, keep textOutput, pixelResult and repaintRects in member variables, and use runUntil there to wait until the platform code obtained the dumped pixels, and then dump the results? That would also prevent other platforms that want to use pixel tests with coordinated graphics classes to have to re-implement all this in their TestController.
Balazs Kelemen
Comment 3 2012-10-09 10:22:01 PDT
Balazs Kelemen
Comment 4 2012-10-10 10:33:05 PDT
Jocelyn Turcotte
Comment 5 2012-10-11 02:29:38 PDT
Comment on attachment 168028 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=168028&action=review > Tools/WebKitTestRunner/TestInvocation.h:57 > + // Some platforms want to force a repaint before generating pixel result. > + static void forceRepaintDoneCallback(WKErrorRef, void* context) > + { > + reinterpret_cast<TestInvocation*>(context)->forceRepaintDone(); > + } This can go in the .cpp > Tools/WebKitTestRunner/TestInvocation.h:58 > + void forceRepaintDone(); Maybe put this under #if PLATFORM(QT)? > Tools/WebKitTestRunner/qt/TestInvocationQt.cpp:78 > + TestController::shared().runUntil(m_gotRepaint, TestController::ShortTimeout); This is using the same instance of TestController and are running a runUntil on top of another runUntil, including the full stack up to didReceiveMessageFromInjectedBundle. If it really is working well this might be fine since it's simpler for now, but if it starts smelling bad we could pick parts of your last patch to have this runUntil running after the previous one is finished. > Tools/WebKitTestRunner/qt/TestInvocationQt.cpp:81 > + if (m_gotRepaint) { In which cases is this false, can't we just assert?
Balazs Kelemen
Comment 6 2012-10-11 02:37:30 PDT
> This is using the same instance of TestController and are running a runUntil on top of another runUntil, including the full stack up to didReceiveMessageFromInjectedBundle. > If it really is working well this might be fine since it's simpler for now, but if it starts smelling bad we could pick parts of your last patch to have this runUntil running after the previous one is finished. Ok, I'm going to check how it affects performance and whether a nested runLoop could work for all platforms. > > > Tools/WebKitTestRunner/qt/TestInvocationQt.cpp:81 > > + if (m_gotRepaint) { > > In which cases is this false, can't we just assert? It is false if smg is wrong with the synchronisation. Given that it is a bit fragile according to our experiences in connection this work, and that we want to run this on bots I believe it's better to handle this case gracefully.
Balazs Kelemen
Comment 7 2012-10-11 05:47:15 PDT
Jocelyn Turcotte
Comment 8 2012-10-11 06:20:36 PDT
Comment on attachment 168202 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=168202&action=review > Tools/WebKitTestRunner/qt/TestInvocationQt.cpp:70 > + reinterpret_cast<TestInvocation*>(context)->m_gotRepaint = true; static_cast > Tools/WebKitTestRunner/qt/TestInvocationQt.cpp:90 > + } else { > + // The test harness expects an image so we output an empty one. > + WKRect windowRect = TestController::shared().mainWebView()->windowFrame(); > + image = QImage(QSize(windowRect.size.width, windowRect.size.height), QImage::Format_ARGB32_Premultiplied); > + image.fill(Qt::black); > + } That case is pretty silent, we could try to make it obvious from the test results by printing it red. We could also print an error if you end up delaying the stderr #EOF like you proposed.
Balazs Kelemen
Comment 9 2012-10-11 08:47:16 PDT
Balazs Kelemen
Comment 10 2012-10-11 08:49:04 PDT
> > Tools/WebKitTestRunner/qt/TestInvocationQt.cpp:70 > > + reinterpret_cast<TestInvocation*>(context)->m_gotRepaint = true; > > static_cast Fixed. > > > Tools/WebKitTestRunner/qt/TestInvocationQt.cpp:90 > > + } else { > > + // The test harness expects an image so we output an empty one. > > + WKRect windowRect = TestController::shared().mainWebView()->windowFrame(); > > + image = QImage(QSize(windowRect.size.width, windowRect.size.height), QImage::Format_ARGB32_Premultiplied); > > + image.fill(Qt::black); > > + } > > That case is pretty silent, we could try to make it obvious from the test results by printing it red. We could also print an error if you end up delaying the stderr #EOF like you proposed. Ok, changed it to red. Later we can add the error message.
Balazs Kelemen
Comment 11 2012-10-12 01:44:20 PDT
Comment on attachment 168235 [details] Patch Clearing flags on attachment: 168235 Committed r131160: <http://trac.webkit.org/changeset/131160>
Balazs Kelemen
Comment 12 2012-10-12 01:44:25 PDT
All reviewed patches have been landed. Closing bug.
Csaba Osztrogonác
Comment 13 2012-10-12 04:25:00 PDT
(In reply to comment #11) > (From update of attachment 168235 [details]) > Clearing flags on attachment: 168235 > > Committed r131160: <http://trac.webkit.org/changeset/131160> It made layout testing extremely slow - http://build.webkit.sed.hu/builders/x86-64%20Linux%20Qt%20Release%20WebKit2%20%28Amazon%20EC2%29/builds/9671/steps/layout-test 2.5 hours - 9800 tests :((((
WebKit Review Bot
Comment 14 2012-10-12 04:56:37 PDT
Re-opened since this is blocked by bug 99163
Balazs Kelemen
Comment 15 2012-10-12 05:02:43 PDT
(In reply to comment #14) > Re-opened since this is blocked by bug 99163 Sorry, I realized that it should not be landed without the patch in bug 95992 because it makes pixel and ref tests time out.
Balazs Kelemen
Comment 16 2012-10-12 09:06:31 PDT
Let's do one more iteration as I realized that I am leaking memory.
Balazs Kelemen
Comment 17 2012-10-12 09:12:12 PDT
Created attachment 168433 [details] Patch Fixed memory leak by correctly adopting the snapshot image.
Balazs Kelemen
Comment 18 2012-10-15 10:17:24 PDT
WebKit Review Bot
Comment 19 2012-10-15 12:47:03 PDT
Re-opened since this is blocked by bug 99354
Csaba Osztrogonác
Comment 20 2012-10-15 12:56:41 PDT
(In reply to comment #18) > Landed in http://trac.webkit.org/changeset/131306 Rolled out, because it broke layout testing again - http://trac.webkit.org/changeset/131339 I stopped the test after 3 hours 8 minutes (after an editing test). Normally all tests take only 25 minutes.
Balazs Kelemen
Comment 22 2012-10-18 08:15:45 PDT
Note You need to log in before you can comment on or make changes to this bug.