Blame SOURCES/nouveau-1.0.11-cleanup-reverse-prime-fb.patch

e53e0d
From d2e62df6e5d4f95d613c6862eb22d6e016fb9bed Mon Sep 17 00:00:00 2001
e53e0d
From: Hans de Goede <hdegoede@redhat.com>
e53e0d
Date: Fri, 3 Jun 2016 14:38:50 +0200
e53e0d
Subject: [PATCH xf86-video-nouveau] Properly cleanup fb for
e53e0d
 reverse-prime-offload
e53e0d
e53e0d
drmmode_set_scanout_pixmap(pix) adds drmmod->fb_id through a call
e53e0d
to drmmode_xf86crtc_resize(), but on a subsequent
e53e0d
drmmode_set_scanout_pixmap(NULL) it would not remove the fb.
e53e0d
e53e0d
This keeps the crtc marked as busy, which causes the dgpu to not
e53e0d
being able to runtime suspend, after an output attached to the dgpu
e53e0d
has been used once. Which causes burning through an additional 10W
e53e0d
of power and the laptop to run quite hot.
e53e0d
e53e0d
This commit adds the missing remove fb call, allowing the dgpu to runtime
e53e0d
suspend after an external monitor has been plugged into the laptop.
e53e0d
e53e0d
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
e53e0d
---
e53e0d
 src/drmmode_display.c | 8 +++++++-
e53e0d
 1 file changed, 7 insertions(+), 1 deletion(-)
e53e0d
e53e0d
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
e53e0d
index b950f42..f326e46 100644
e53e0d
--- a/src/drmmode_display.c
e53e0d
+++ b/src/drmmode_display.c
e53e0d
@@ -680,10 +680,16 @@ drmmode_set_scanout_pixmap(xf86CrtcPtr crtc, PixmapPtr ppix)
e53e0d
 	PixmapPtr screenpix = screen->GetScreenPixmap(screen);
e53e0d
 	xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
e53e0d
 	drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
e53e0d
+	drmmode_ptr drmmode = drmmode_crtc->drmmode;
e53e0d
 	int c, total_width = 0, max_height = 0, this_x = 0;
e53e0d
 	if (!ppix) {
e53e0d
-		if (crtc->randr_crtc->scanout_pixmap)
e53e0d
+		if (crtc->randr_crtc->scanout_pixmap) {
e53e0d
 			PixmapStopDirtyTracking(crtc->randr_crtc->scanout_pixmap, screenpix);
e53e0d
+			if (drmmode && drmmode->fb_id) {
e53e0d
+				drmModeRmFB(drmmode->fd, drmmode->fb_id);
e53e0d
+				drmmode->fb_id = 0;
e53e0d
+			}
e53e0d
+		}
e53e0d
 		drmmode_crtc->scanout_pixmap_x = 0;
e53e0d
 		return TRUE;
e53e0d
 	}
e53e0d
-- 
e53e0d
2.7.4
e53e0d