summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@gmail.com>2012-07-15 09:38:55 -0400
committerMarc-André Lureau <marcandre.lureau@gmail.com>2012-07-15 19:24:32 +0200
commitc1b537fcafc3b9121d8c79cf5e98566158f34ab6 (patch)
tree87a40535ee269b4c78438bee56d487ea097642fb
parentef4f158a18f03444d358b5ece39db636f76365f9 (diff)
Return a preferred mode matching the current modeelmarco.master
This make gnome-settings-daemon not switch resolution automatically to the largest available.
-rw-r--r--src/qxl_driver.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/qxl_driver.c b/src/qxl_driver.c
index 0d15ccd..daa7606 100644
--- a/src/qxl_driver.c
+++ b/src/qxl_driver.c
@@ -1710,8 +1710,8 @@ qxl_check_device(ScrnInfoPtr pScrn, qxl_screen_t *qxl)
}
#endif /* !XSPICE */
-static DisplayModePtr qxl_add_mode(qxl_screen_t *qxl, ScrnInfoPtr pScrn,
- int width, int height, int type)
+static DisplayModePtr
+screen_create_mode(ScrnInfoPtr pScrn, int width, int height, int type)
{
DisplayModePtr mode;
@@ -1732,7 +1732,18 @@ static DisplayModePtr qxl_add_mode(qxl_screen_t *qxl, ScrnInfoPtr pScrn,
xf86SetModeDefaultName(mode);
xf86SetModeCrtc(mode, pScrn->adjustFlags); /* needed? xf86-video-modesetting does this */
+
+ return mode;
+}
+
+static DisplayModePtr
+qxl_add_mode(qxl_screen_t *qxl, ScrnInfoPtr pScrn, int width, int height, int type)
+{
+ DisplayModePtr mode;
+
+ mode = screen_create_mode(pScrn, width, height, type);
qxl->x_modes = xf86ModesAdd(qxl->x_modes, mode);
+
return mode;
}
@@ -1740,9 +1751,18 @@ static DisplayModePtr
qxl_output_get_modes(xf86OutputPtr output)
{
qxl_output_private *qxl_output = output->driver_private;
+ DisplayModePtr modes = xf86DuplicateModes(qxl_output->qxl->pScrn, qxl_output->qxl->x_modes);
+
+ if (output &&
+ output->crtc && output->crtc->enabled) {
+ DisplayModePtr crtc_mode = &output->crtc->mode;
+ crtc_mode = screen_create_mode(qxl_output->qxl->pScrn, crtc_mode->HDisplay, crtc_mode->VDisplay, M_T_PREFERRED);
+ output->crtc->mode = *crtc_mode;
+ modes = xf86ModesAdd(modes, crtc_mode);
+ }
/* xf86ProbeOutputModes owns this memory */
- return xf86DuplicateModes(qxl_output->qxl->pScrn, qxl_output->qxl->x_modes);
+ return modes;
}
static void