sna: Support TearFree on slaved outputs
By always forcing the shadow intermediatory, we can enable TearFree even ona slave scanout. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
3140d72826
commit
7026ffe560
|
|
@ -1633,6 +1633,11 @@ static bool use_shadow(struct sna *sna, xf86CrtcPtr crtc)
|
|||
return true;
|
||||
}
|
||||
|
||||
if (sna->flags & SNA_TEAR_FREE && to_sna_crtc(crtc)->slave_pixmap) {
|
||||
DBG(("%s: tear-free shadow required\n", __FUNCTION__));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (sna->scrn->virtualX > sna->mode.max_crtc_width ||
|
||||
sna->scrn->virtualY > sna->mode.max_crtc_height) {
|
||||
DBG(("%s: framebuffer too large (%dx%d) > (%dx%d)\n",
|
||||
|
|
|
|||
|
|
@ -487,10 +487,8 @@ static void setup_dri(struct sna *sna)
|
|||
|
||||
static bool enable_tear_free(struct sna *sna)
|
||||
{
|
||||
#if HAS_PIXMAP_SHARING
|
||||
if (sna->scrn->is_gpu)
|
||||
if (sna->flags & SNA_LINEAR_FB)
|
||||
return false;
|
||||
#endif
|
||||
|
||||
/* Under certain conditions, we should enable TearFree by default,
|
||||
* for example when the hardware requires pageflipping to run within
|
||||
|
|
@ -502,6 +500,33 @@ static bool enable_tear_free(struct sna *sna)
|
|||
return ENABLE_TEAR_FREE;
|
||||
}
|
||||
|
||||
static void setup_tear_free(struct sna *sna)
|
||||
{
|
||||
MessageType from;
|
||||
Bool enable;
|
||||
|
||||
if (sna->flags & SNA_LINEAR_FB)
|
||||
return;
|
||||
|
||||
if ((sna->flags & SNA_HAS_FLIP) == 0) {
|
||||
from = X_PROBED;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (!xf86GetOptValBool(sna->Options, OPTION_TEAR_FREE, &enable)) {
|
||||
enable = enable_tear_free(sna);
|
||||
from = X_DEFAULT;
|
||||
} else
|
||||
from = X_CONFIG;
|
||||
|
||||
if (enable)
|
||||
sna->flags |= SNA_TEAR_FREE;
|
||||
|
||||
done:
|
||||
xf86DrvMsg(sna->scrn->scrnIndex, from, "TearFree %sabled\n",
|
||||
sna->flags & SNA_TEAR_FREE ? "en" : "dis");
|
||||
}
|
||||
|
||||
/**
|
||||
* This is called before ScreenInit to do any require probing of screen
|
||||
* configuration.
|
||||
|
|
@ -666,11 +691,7 @@ static Bool sna_pre_init(ScrnInfoPtr scrn, int flags)
|
|||
}
|
||||
scrn->currentMode = scrn->modes;
|
||||
|
||||
if ((sna->flags & (SNA_HAS_FLIP | SNA_LINEAR_FB)) == SNA_HAS_FLIP &&
|
||||
xf86ReturnOptValBool(sna->Options, OPTION_TEAR_FREE, enable_tear_free(sna)))
|
||||
sna->flags |= SNA_TEAR_FREE;
|
||||
xf86DrvMsg(scrn->scrnIndex, X_CONFIG, "TearFree %sabled\n",
|
||||
sna->flags & SNA_TEAR_FREE ? "en" : "dis");
|
||||
setup_tear_free(sna);
|
||||
|
||||
xf86SetGamma(scrn, zeros);
|
||||
xf86SetDpi(scrn, 0, 0);
|
||||
|
|
|
|||
Loading…
Reference in New Issue