diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2014-07-17 17:04:02 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2014-07-17 17:04:02 +0100 |
commit | 7026ffe56005bbc36dc37cafc7ebb2a7f09fefdd (patch) | |
tree | 3003767437c5b118f1d6e096228c951054449b01 | |
parent | 3140d72826b5227f7f7ac9a428faa4bcfd4b377b (diff) |
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>
-rw-r--r-- | src/sna/sna_display.c | 5 | ||||
-rw-r--r-- | src/sna/sna_driver.c | 37 |
2 files changed, 34 insertions, 8 deletions
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c index 072a2851..efb4197a 100644 --- a/src/sna/sna_display.c +++ b/src/sna/sna_display.c @@ -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", diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c index 2eac852f..e5e7783a 100644 --- a/src/sna/sna_driver.c +++ b/src/sna/sna_driver.c @@ -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); |