Emit new frame signals from the software backend

Introduce an autotest case too.

Change-Id: I658b09b6e4e5b30cdc2174fdf21f60adf93e44ff
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
This commit is contained in:
Laszlo Agocs 2020-06-21 22:04:18 +02:00
parent 25348752a3
commit 6ca0145f06
3 changed files with 28 additions and 0 deletions

View File

@ -158,6 +158,8 @@ void QSGSoftwareRenderLoop::renderWindow(QQuickWindow *window, bool isNewExpose)
emit window->afterAnimating();
emit window->beforeFrameBegin();
cd->syncSceneGraph();
rc->endSync();
@ -196,6 +198,8 @@ void QSGSoftwareRenderLoop::renderWindow(QQuickWindow *window, bool isNewExpose)
cd->fireFrameSwapped();
}
emit window->afterFrameEnd();
qint64 swapTime = 0;
if (profileFrames)
swapTime = renderTimer.nsecsElapsed();

View File

@ -477,6 +477,8 @@ void QSGSoftwareRenderThread::syncAndRender()
const bool exposeRequested = (pendingUpdate & ExposeRequest) == ExposeRequest;
pendingUpdate = 0;
emit exposedWindow->beforeFrameBegin();
if (syncRequested)
sync(exposeRequested);
@ -537,6 +539,8 @@ void QSGSoftwareRenderThread::syncAndRender()
qCDebug(QSG_RASTER_LOG_RENDERLOOP, "RT - rendering done");
emit exposedWindow->afterFrameEnd();
if (exposeRequested) {
qCDebug(QSG_RASTER_LOG_RENDERLOOP, "RT - wake gui after initial expose");
waitCondition.wakeOne();

View File

@ -455,6 +455,7 @@ private slots:
#endif
void animatingSignal();
void frameSignals();
void contentItemSize();
@ -2341,6 +2342,25 @@ void tst_qquickwindow::animatingSignal()
QTRY_VERIFY(spy.count() > 1);
}
void tst_qquickwindow::frameSignals()
{
QQuickWindow window;
window.setTitle(QTest::currentTestFunction());
window.setGeometry(100, 100, 300, 200);
QSignalSpy beforeSpy(&window, SIGNAL(beforeFrameBegin()));
QSignalSpy afterSpy(&window, SIGNAL(afterFrameEnd()));
window.show();
QTRY_VERIFY(window.isExposed());
QSGRendererInterface *rif = window.rendererInterface();
QVERIFY(rif);
QTRY_VERIFY(beforeSpy.count() > 1);
QTRY_VERIFY(afterSpy.count() > 1);
QTRY_COMPARE(beforeSpy.count(), afterSpy.count());
}
// QTBUG-36938
void tst_qquickwindow::contentItemSize()
{