Commit b8ef71fb authored by Hans de Goede's avatar Hans de Goede
Browse files

modesetting: Properly cleanup fb for reverse-prime-offload

drmmode_set_scanout_pixmap_gpu(pix) adds drmmod->fb_id through a call
to drmmode_xf86crtc_resize(), but on a subsequent
drmmode_set_scanout_pixmap_gpu(NULL) it would not remove the fb.

This keeps the crtc marked as busy, which causes the dgpu to not
being able to runtime suspend, after an output attached to the dgpu
has been used once. Which causes burning through an additional 10W
of power and the laptop to run quite hot.

This commit adds the missing remove fb call, allowing the dgpu to runtime
suspend after an external monitor has been plugged into the laptop.

Note this also makes drmmode_set_scanout_pixmap_gpu(NULL) match the
behavior of drmmode_set_scanout_pixmap_cpu(NULL) which was already
removing the fb.
Signed-off-by: default avatarHans de Goede <>
Reviewed-by: default avatarDave Airlie <>
parent 15595d29
...@@ -635,11 +635,17 @@ drmmode_set_scanout_pixmap_gpu(xf86CrtcPtr crtc, PixmapPtr ppix) ...@@ -635,11 +635,17 @@ drmmode_set_scanout_pixmap_gpu(xf86CrtcPtr crtc, PixmapPtr ppix)
PixmapPtr screenpix = screen->GetScreenPixmap(screen); PixmapPtr screenpix = screen->GetScreenPixmap(screen);
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
drmmode_ptr drmmode = drmmode_crtc->drmmode;
int c, total_width = 0, max_height = 0, this_x = 0; int c, total_width = 0, max_height = 0, this_x = 0;
if (!ppix) { if (!ppix) {
if (crtc->randr_crtc->scanout_pixmap) if (crtc->randr_crtc->scanout_pixmap) {
PixmapStopDirtyTracking(crtc->randr_crtc->scanout_pixmap, screenpix); PixmapStopDirtyTracking(crtc->randr_crtc->scanout_pixmap, screenpix);
if (drmmode->fb_id) {
drmModeRmFB(drmmode->fd, drmmode->fb_id);
drmmode->fb_id = 0;
drmmode_crtc->prime_pixmap_x = 0; drmmode_crtc->prime_pixmap_x = 0;
return TRUE; return TRUE;
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment