summaryrefslogtreecommitdiff
path: root/src/drmmode_display.c
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2016-09-02 11:08:28 +0900
committerMichel Dänzer <michel@daenzer.net>2016-09-06 17:18:27 +0900
commit38797a33117222dadbc89e5f21ed8cd5deef9bea (patch)
tree60e16cff6eb1307249ba0b1273a8a801e767b5eb /src/drmmode_display.c
parenteda1f3df6aaed683036369fe8820da4dac3c2ae2 (diff)
Make TearFree effective with PRIME slave scanout
TearFree can now prevent tearing with any possible display configuration. Note that there may still be inter-GPU tearing if the primary GPU uses a different driver. v2: * Also test dirty->slave_dst in radeon_prime_scanout_do_update Reviewed-by: Alex Deucher <alexander.deucher@amd.com> [v1]
Diffstat (limited to 'src/drmmode_display.c')
-rw-r--r--src/drmmode_display.c33
1 files changed, 28 insertions, 5 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 2b80c21d..34f77351 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -528,10 +528,19 @@ drmmode_crtc_scanout_destroy(drmmode_ptr drmmode,
static void
drmmode_crtc_scanout_free(drmmode_crtc_private_ptr drmmode_crtc)
{
- drmmode_crtc_scanout_destroy(drmmode_crtc->drmmode,
- &drmmode_crtc->scanout[0]);
- drmmode_crtc_scanout_destroy(drmmode_crtc->drmmode,
- &drmmode_crtc->scanout[1]);
+ if (drmmode_crtc->flip_pending) {
+ drmmode_crtc->scanout_destroy[0] = drmmode_crtc->scanout[0];
+ drmmode_crtc->scanout[0].pixmap = NULL;
+ drmmode_crtc->scanout[0].bo = NULL;
+ drmmode_crtc->scanout_destroy[1] = drmmode_crtc->scanout[1];
+ drmmode_crtc->scanout[1].pixmap = NULL;
+ drmmode_crtc->scanout[1].bo = NULL;
+ } else {
+ drmmode_crtc_scanout_destroy(drmmode_crtc->drmmode,
+ &drmmode_crtc->scanout[0]);
+ drmmode_crtc_scanout_destroy(drmmode_crtc->drmmode,
+ &drmmode_crtc->scanout[1]);
+ }
if (drmmode_crtc->scanout_damage) {
DamageDestroy(drmmode_crtc->scanout_damage);
@@ -1120,11 +1129,12 @@ static Bool
drmmode_set_scanout_pixmap(xf86CrtcPtr crtc, PixmapPtr ppix)
{
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+ RADEONInfoPtr info = RADEONPTR(crtc->scrn);
if (!ppix) {
if (crtc->randr_crtc->scanout_pixmap)
PixmapStopDirtyTracking(crtc->randr_crtc->scanout_pixmap,
- drmmode_crtc->scanout[0].pixmap);
+ drmmode_crtc->scanout[drmmode_crtc->scanout_id].pixmap);
drmmode_crtc_scanout_free(drmmode_crtc);
return TRUE;
}
@@ -1134,6 +1144,14 @@ drmmode_set_scanout_pixmap(xf86CrtcPtr crtc, PixmapPtr ppix)
ppix->drawable.height))
return FALSE;
+ if (info->tear_free &&
+ !drmmode_crtc_scanout_create(crtc, &drmmode_crtc->scanout[1],
+ ppix->drawable.width,
+ ppix->drawable.height)) {
+ drmmode_crtc_scanout_free(drmmode_crtc);
+ return FALSE;
+ }
+
#ifdef HAS_DIRTYTRACKING_ROTATION
PixmapStartDirtyTracking(ppix, drmmode_crtc->scanout[0].pixmap,
0, 0, 0, 0, RR_Rotate_0);
@@ -2200,6 +2218,11 @@ drmmode_clear_pending_flip(xf86CrtcPtr crtc)
drmmode_crtc_dpms(crtc, drmmode_crtc->pending_dpms_mode);
}
+
+ drmmode_crtc_scanout_destroy(drmmode_crtc->drmmode,
+ &drmmode_crtc->scanout_destroy[0]);
+ drmmode_crtc_scanout_destroy(drmmode_crtc->drmmode,
+ &drmmode_crtc->scanout_destroy[1]);
}
static void