[hwcomposer] Adjust present strategy for block on retrace

Heavily inspired by how the glxbackend works: present happens on
rendering start and not on end frame. In addition present needs to
check whether there is something to show to not block incorrectly.

This is needed as present might also be called from going to idle.

With this change the Nexus5 has a decend refresh rate shown in the
totally accurate fps effect. Before it was capped at around 30 fps
which indicates that the refresh rate was halfed.

On the tearfing front the change seems to not have any negative
impact.
This commit is contained in:
Martin Gräßlin 2015-10-29 14:13:40 +01:00
parent c35c464b1d
commit e379d06f34

View file

@ -145,7 +145,12 @@ bool EglHwcomposerBackend::makeContextCurrent()
void EglHwcomposerBackend::present()
{
if (lastDamage().isEmpty()) {
return;
}
eglSwapBuffers(eglDisplay(), surface());
setLastDamage(QRegion());
}
void EglHwcomposerBackend::screenGeometryChanged(const QSize &size)
@ -155,6 +160,8 @@ void EglHwcomposerBackend::screenGeometryChanged(const QSize &size)
QRegion EglHwcomposerBackend::prepareRenderingFrame()
{
present();
// TODO: buffer age?
startRenderTimer();
// triggers always a full repaint
@ -163,9 +170,8 @@ QRegion EglHwcomposerBackend::prepareRenderingFrame()
void EglHwcomposerBackend::endRenderingFrame(const QRegion &renderedRegion, const QRegion &damagedRegion)
{
Q_UNUSED(renderedRegion)
Q_UNUSED(damagedRegion)
present();
setLastDamage(renderedRegion);
}
SceneOpenGL::TexturePrivate *EglHwcomposerBackend::createBackendTexture(SceneOpenGL::Texture *texture)