summaryrefslogtreecommitdiff
path: root/src/drmmode_display.c
diff options
context:
space:
mode:
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 1e4622d..31aa1db 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -467,10 +467,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);
@@ -1062,11 +1071,12 @@ drmmode_crtc_gamma_set(xf86CrtcPtr crtc, uint16_t * red, uint16_t * green,
static Bool drmmode_set_scanout_pixmap(xf86CrtcPtr crtc, PixmapPtr ppix)
{
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+ AMDGPUInfoPtr info = AMDGPUPTR(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;
}
@@ -1076,6 +1086,14 @@ static Bool 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);
@@ -2010,6 +2028,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