[Spice-devel] [PATCH xf86-video-qxl] Make non default qxl modes available

Hans de Goede hdegoede at redhat.com
Mon Sep 13 07:30:28 PDT 2010


Currently unless an xorg.conf with modelines is used a lot of the
qxl supported modes like 1920x1080 are not available, because the xorg
default modelines set does not have modelines for them.

This patch adds modelines to the driver for all modes supported by qxl
bringing the xorg driver up to par with the windows driver wrt supported
resolutions.

Note that an xorg.conf specifying a large enough virtual screen size is
still needed for resolutions > 1024x768, but one no longer needs to add
modelines in it. I hope to fix this with a separate patch.
---
 src/qxl_driver.c |   33 +++++++++++++++++++++++++++++++--
 1 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/src/qxl_driver.c b/src/qxl_driver.c
index 36cec6e..fa79a3d 100644
--- a/src/qxl_driver.c
+++ b/src/qxl_driver.c
@@ -1239,6 +1239,29 @@ qxl_valid_mode(int scrn, DisplayModePtr p, Bool flag, int pass)
     return MODE_OK;
 }
 
+/* Modelines for modes which are known by the qxl device, but are not in the
+   server default mode table (DMTModes). Idea copied from the vmware xorg
+   driver (which is also MIT licensed), the modes were generated using gtf. */
+#define MODEPREFIX NULL, NULL, NULL, 0, M_T_DRIVER
+#define MODESUFFIX 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,FALSE,FALSE,0,NULL,0,0.0,0.0
+static DisplayModeRec qxl_modes[] = {
+    /* 4:3 */
+    { MODEPREFIX,  41500,  832,  864,  952, 1072, 0,  624,  625,  628,  646, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 832x624 at 60Hz */
+    { MODEPREFIX,  81620, 1152, 1216, 1336, 1520, 0,  864,  865,  868,  895, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 1152x864 at 60Hz */
+    { MODEPREFIX,  82170, 1152, 1216, 1336, 1520, 0,  870,  871,  874,  901, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 1152x870 at 60Hz */
+    /* 16:9 */
+    { MODEPREFIX,  74480, 1280, 1336, 1472, 1664, 0,  720,  721,  724,  746, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 1280x720 at 60Hz */
+    { MODEPREFIX,  85500, 1366, 1494, 1624, 1798, 0,  768,  770,  776,  795, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX }, /* 1366x768 at 60Hz, from mythtv wiki */
+    { MODEPREFIX, 119000, 1600, 1696, 1864, 2128, 0,  900,  901,  904,  932, 0, V_PHSYNC | V_NVSYNC, MODESUFFIX }, /* 1600x900 at 60Hz */
+    { MODEPREFIX, 172800, 1920, 2040, 2248, 2576, 0, 1080, 1081, 1084, 1118, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 1920x1080 at 60Hz */
+    /* Other widescreen-ish */
+    { MODEPREFIX,  29580,  800,  816,  896,  992, 0,  480,  481,  484,  497, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x480 at 60Hz */
+    { MODEPREFIX,  48960, 1024, 1064, 1168, 1312, 0,  600,  601,  604,  622, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 1024x600 at 60Hz */
+    { MODEPREFIX,  79330, 1280, 1344, 1480, 1680, 0,  760,  761,  764,  787, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 1280x760 at 60Hz */
+    /* Plain weird */
+    { MODEPREFIX,  49010,  960, 1000, 1096, 1232, 0,  640,  641,  644,  663, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 960x640 at 60Hz */
+};
+
 static Bool
 qxl_pre_init(ScrnInfoPtr pScrn, int flags)
 {
@@ -1246,6 +1269,8 @@ qxl_pre_init(ScrnInfoPtr pScrn, int flags)
     qxl_screen_t *qxl = NULL;
     ClockRangePtr clockRanges = NULL;
     int *linePitches = NULL;
+    int i;
+    DisplayModePtr mode;
 
     CHECK_POINT();
     
@@ -1266,6 +1291,10 @@ qxl_pre_init(ScrnInfoPtr pScrn, int flags)
 #endif
 
     pScrn->monitor = pScrn->confScreen->monitor;
+    for (i = 0; i < sizeof(qxl_modes)/sizeof(DisplayModeRec); i++) {
+        mode = xf86DuplicateMode(&(qxl_modes[i]));
+        xf86ModesAdd(pScrn->monitor->Modes, mode);
+    }
 
     if (!qxl_color_setup(pScrn))
 	goto out;
@@ -1284,7 +1313,7 @@ qxl_pre_init(ScrnInfoPtr pScrn, int flags)
     clockRanges = xnfcalloc(sizeof(ClockRange), 1);
     clockRanges->next = NULL;
     clockRanges->minClock = 10000;
-    clockRanges->maxClock = 165000;
+    clockRanges->maxClock = 175000;
     clockRanges->clockIndex = -1;
     clockRanges->interlaceAllowed = clockRanges->doubleScanAllowed = 0;
     clockRanges->ClockMulFactor = clockRanges->ClockDivFactor = 1;
@@ -1292,7 +1321,7 @@ qxl_pre_init(ScrnInfoPtr pScrn, int flags)
 
     /* override QXL monitor stuff */
     if (pScrn->monitor->nHsync <= 0) {
-	pScrn->monitor->hsync[0].lo = 31.5;
+	pScrn->monitor->hsync[0].lo = 29.0;
 	pScrn->monitor->hsync[0].hi = 80.0;
 	pScrn->monitor->nHsync = 1;
     }
-- 
1.7.2.2



More information about the Spice-devel mailing list