[Spice-devel] [PATCH xf86-video-qxl 2/2] qxl: Don't add the current mode to the modelist as preferred-mode (rhbz#894421)

Hans de Goede hdegoede at redhat.com
Thu Jan 24 03:54:17 PST 2013


Adding the current mode to the monitor modelist as "extra" preferred
mode means that each time the modelist gets queried, and the resolution
has changed, a different modelist is returned for the output. A different
modelist gets seen as a different monitor by gnome-settings-daemon, causing
it to think that the monitor has been unplugged and replaced with another
one and to re-do any auto-configuration for that monitor.

This causes undesirable "funny" side-effects such as described in detail
here: https://bugzilla.redhat.com/show_bug.cgi?id=894421#c7

This patch fixes the "initial resolution too large" problem the adding
of the current mode to the list was added for, by instead marking 1024x768,
which is our default resolution, as preferred mode.

Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
 src/qxl_driver.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/qxl_driver.c b/src/qxl_driver.c
index c383c14..063e7a6 100644
--- a/src/qxl_driver.c
+++ b/src/qxl_driver.c
@@ -61,6 +61,9 @@
 
 extern void compat_init_scrn (ScrnInfoPtr);
 
+#define DEFAULT_WIDTH 1024
+#define DEFAULT_HEIGHT 768
+
 #ifdef WITH_CHECK_POINT
 #define CHECK_POINT() ErrorF ("%s: %d  (%s)\n", __FILE__, __LINE__, __FUNCTION__);
 #else
@@ -2083,15 +2086,6 @@ 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 modes;
 }
@@ -2322,8 +2316,8 @@ qxl_init_randr (ScrnInfoPtr pScrn, qxl_screen_t *qxl)
 	qxl_crtc->output = output;
     }
     
-    qxl->virtual_x = 1024;
-    qxl->virtual_y = 768;
+    qxl->virtual_x = DEFAULT_WIDTH;
+    qxl->virtual_y = DEFAULT_HEIGHT;
     
     pScrn->display->virtualX = qxl->virtual_x;
     pScrn->display->virtualY = qxl->virtual_y;
@@ -2339,6 +2333,7 @@ qxl_initialize_x_modes (qxl_screen_t *qxl, ScrnInfoPtr pScrn,
 {
     int i;
     int size;
+    int preferred_flag;
     
     *max_x = *max_y = 0;
     /* Create a list of modes used by the qxl_output_get_modes */
@@ -2354,8 +2349,13 @@ qxl_initialize_x_modes (qxl_screen_t *qxl, ScrnInfoPtr pScrn,
 		continue;
 	    }
 	    
+            if (qxl->modes[i].x_res == 1024 && qxl->modes[i].y_res == 768)
+                preferred_flag = M_T_PREFERRED;
+            else
+                preferred_flag = 0;
+
 	    qxl_add_mode (qxl, pScrn, qxl->modes[i].x_res, qxl->modes[i].y_res,
-	                  M_T_DRIVER);
+	                  M_T_DRIVER | preferred_flag);
 	    if (qxl->modes[i].x_res > *max_x)
 		*max_x = qxl->modes[i].x_res;
 	    if (qxl->modes[i].y_res > *max_y)
-- 
1.8.1



More information about the Spice-devel mailing list