sna: Restore TearFree operation after switching everything off

We give up on TearFree if we ever see an error whilst page flipping (in
the hope that we can keep displaying via direct use of the scanout).
With the advent of MST, this can happen simply by the user unplugging a
dock causing connectors to disappear and if we flip before we see the
uevent telling us which outputs are disabled, we get an error.

So, lets try and re-enable TearFree on the next opportunity, when all
the outputs are off and we can rebuild the shadow buffer.

Reported-by: Martin Jørgensen <mkj@gotu.dk>
References: https://bugs.freedesktop.org/show_bug.cgi?id=96180
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2016-05-28 19:23:38 +01:00
parent 46ffdf295d
commit 4458f1bf8a
3 changed files with 13 additions and 3 deletions

View File

@ -259,8 +259,9 @@ struct sna {
#define SNA_NO_VSYNC 0x40
#define SNA_TRIPLE_BUFFER 0x80
#define SNA_TEAR_FREE 0x100
#define SNA_FORCE_SHADOW 0x200
#define SNA_FLUSH_GTT 0x400
#define SNA_WANT_TEAR_FREE 0x200
#define SNA_FORCE_SHADOW 0x400
#define SNA_FLUSH_GTT 0x800
#define SNA_PERFORMANCE 0x1000
#define SNA_POWERSAVE 0x2000
#define SNA_HAS_FLIP 0x10000

View File

@ -7076,6 +7076,15 @@ sna_crtc_config_notify(ScreenPtr screen)
probe_capabilities(sna);
sna_present_update(sna);
/* Allow TearFree to come back on when everything is off */
if (!sna->mode.front_active && sna->flags & SNA_WANT_TEAR_FREE) {
if ((sna->flags & SNA_TEAR_FREE) == 0)
DBG(("%s: enable TearFree next modeset\n",
__FUNCTION__));
sna->flags |= SNA_TEAR_FREE;
}
sna->mode.dirty = false;
}

View File

@ -481,7 +481,7 @@ static bool setup_tear_free(struct sna *sna)
from = X_CONFIG;
if (enable)
sna->flags |= SNA_TEAR_FREE;
sna->flags |= SNA_WANT_TEAR_FREE | SNA_TEAR_FREE;
done:
xf86DrvMsg(sna->scrn->scrnIndex, from, "TearFree %sabled\n",