From ea21759cec0875794f0b67f91d9aabe1fdf8403e Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Fri, 25 Jan 2019 07:13:48 -0600 Subject: [PATCH] vidmode: Let the driver resize the framebuffer when switching modes Resize the framebuffer when switching modes with VidMode. This allows better interaction with randr, which may have shrunk the framebuffer when changing to a smaller mode. --- hw/xfree86/common/xf86VidMode.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/xfree86/common/xf86VidMode.c b/hw/xfree86/common/xf86VidMode.c index 7e12ea2cc..e1e47fbfe 100644 --- a/hw/xfree86/common/xf86VidMode.c +++ b/hw/xfree86/common/xf86VidMode.c @@ -42,6 +42,7 @@ #include "os.h" #include "xf86.h" #include "xf86Priv.h" +#include "xf86Crtc.h" #include "extinit.h" #ifdef XF86VIDMODE @@ -247,11 +248,16 @@ xf86VidModeSwitchMode(ScreenPtr pScreen, DisplayModePtr mode) { ScrnInfoPtr pScrn; DisplayModePtr pTmpMode; + xf86CrtcConfigPtr config; Bool retval; pScrn = xf86ScreenToScrn(pScreen); /* save in case we fail */ pTmpMode = pScrn->currentMode; + /* let the driver resize the framebuffer */ + config = XF86_CRTC_CONFIG_PTR(pScrn); + if (!(*config->funcs->resize) (pScrn, mode->HDisplay, mode->VDisplay)) + return FALSE; /* Force a mode switch */ pScrn->currentMode = NULL; retval = xf86SwitchMode(pScrn->pScreen, mode);