[xorg-x11-drv-qxl/f14/master] - Add support for using resolutions > 1024x768 without needing an xorg.conf - Restore textmode font

Hans de Goede jwrdegoede at fedoraproject.org
Sat Oct 9 20:41:52 UTC 2010


commit 52e25380b1d311ca885eba84d702dc53e2def8c4
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Sat Oct 9 22:42:04 2010 +0200

    - Add support for using resolutions > 1024x768 without needing an xorg.conf
    - Restore textmode font when switching back to a textmode virtual console

 0001-Make-non-default-qxl-modes-available.patch    |   98 ++++++++++++++
 ...l-resolution-match-actual-resolution-on-s.patch |   34 +++++
 ...ult-virtual-size-to-match-the-highest-ava.patch |  114 ++++++++++++++++
 ...tion-of-text-mode-font-when-leaving-the-v.patch |  136 ++++++++++++++++++++
 ...eak-the-vfresh-range-of-the-default-monit.patch |   26 ++++
 xorg-x11-drv-qxl.spec                              |   17 +++-
 6 files changed, 424 insertions(+), 1 deletions(-)
---
diff --git a/0001-Make-non-default-qxl-modes-available.patch b/0001-Make-non-default-qxl-modes-available.patch
new file mode 100644
index 0000000..28737c0
--- /dev/null
+++ b/0001-Make-non-default-qxl-modes-available.patch
@@ -0,0 +1,98 @@
+From e000ac81eaaa0c186259e65678afffd346639544 Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede at redhat.com>
+Date: Thu, 7 Oct 2010 12:01:55 +0200
+Subject: [PATCH xf86-drv-qxl F14-branch 1/5] Make non default qxl modes available
+
+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 code to dynamically generate modelines for all modes
+in the qxl mode list, 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. This is fixed in my next patch.
+---
+ src/qxl_driver.c |   40 +++++++++++++++++++++++++++++++++++++---
+ 1 files changed, 37 insertions(+), 3 deletions(-)
+
+diff --git a/src/qxl_driver.c b/src/qxl_driver.c
+index 9c1377d..d8e687b 100644
+--- a/src/qxl_driver.c
++++ b/src/qxl_driver.c
+@@ -1440,10 +1440,38 @@ qxl_valid_mode(int scrn, DisplayModePtr p, Bool flag, int pass)
+     return MODE_OK;
+ }
+ 
++static void qxl_add_mode(ScrnInfoPtr pScrn, int width, int height, int type)
++{
++    DisplayModePtr mode;
++
++    /* Skip already present modes */
++    for (mode = pScrn->monitor->Modes; mode; mode = mode->next)
++        if (mode->HDisplay == width && mode->VDisplay == height)
++            return;
++
++    mode = xnfcalloc(1, sizeof(DisplayModeRec));
++
++    mode->status = MODE_OK;
++    mode->type = type;
++    mode->HDisplay   = width;
++    mode->HSyncStart = (width * 105 / 100 + 7) & ~7;
++    mode->HSyncEnd   = (width * 115 / 100 + 7) & ~7;
++    mode->HTotal     = (width * 130 / 100 + 7) & ~7;
++    mode->VDisplay   = height;
++    mode->VSyncStart = height + 1;
++    mode->VSyncEnd   = height + 4;
++    mode->VTotal     = height * 1035 / 1000;
++    mode->Clock = mode->HTotal * mode->VTotal * 60 / 1000;
++    mode->Flags = V_NHSYNC | V_PVSYNC;
++
++    xf86SetModeDefaultName(mode);
++    xf86ModesAdd(pScrn->monitor->Modes, mode);
++}
++
+ static Bool
+ qxl_pre_init(ScrnInfoPtr pScrn, int flags)
+ {
+-    int scrnIndex = pScrn->scrnIndex;
++    int i, scrnIndex = pScrn->scrnIndex;
+     qxl_screen_t *qxl = NULL;
+     ClockRangePtr clockRanges = NULL;
+     int *linePitches = NULL;
+@@ -1485,7 +1513,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;
+@@ -1493,7 +1521,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;
+     }
+@@ -1508,6 +1536,12 @@ qxl_pre_init(ScrnInfoPtr pScrn, int flags)
+     	pScrn->display->virtualY = 768;
+     }
+     
++    /* Add any modes not in xorg's default mode list */
++    for (i = 0; i < qxl->num_modes; i++)
++        if (qxl->modes[i].orientation == 0)
++            qxl_add_mode(pScrn, qxl->modes[i].x_res, qxl->modes[i].y_res,
++                         M_T_DRIVER);
++
+     if (0 >= xf86ValidateModes(pScrn, pScrn->monitor->Modes,
+ 			       pScrn->display->modes, clockRanges, linePitches,
+ 			       128, 2048, 128 * 4, 128, 2048,
+-- 
+1.7.2.2
+
diff --git a/0002-Make-virtual-resolution-match-actual-resolution-on-s.patch b/0002-Make-virtual-resolution-match-actual-resolution-on-s.patch
new file mode 100644
index 0000000..9091894
--- /dev/null
+++ b/0002-Make-virtual-resolution-match-actual-resolution-on-s.patch
@@ -0,0 +1,34 @@
+From 5baed5c7091873f6273c3a17c4933f1307364b0d Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede at redhat.com>
+Date: Thu, 7 Oct 2010 18:35:58 +0200
+Subject: [PATCH xf86-drv-qxl F14-branch 2/5] Make virtual resolution match actual resolution on startup
+
+When setting a Virtual size in xorg.conf, currently there can be
+a difference between the actual output resolution (say 1600x1200) and
+the virtual resolution (for example 2048x1600). This causes parts
+of the desktop too be unreachable because the cursor is bound to
+the spicec window and thus one cannot pan over the virtual desktop.
+
+Moreover other parts of the driver don't seem to like this and I've
+seen several hangs / crashes which I think are related.
+---
+ src/qxl_driver.c |    3 +++
+ 1 files changed, 3 insertions(+), 0 deletions(-)
+
+diff --git a/src/qxl_driver.c b/src/qxl_driver.c
+index d8e687b..3b8728c 100644
+--- a/src/qxl_driver.c
++++ b/src/qxl_driver.c
+@@ -1180,6 +1180,9 @@ qxl_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+     
+     pScreen->totalPixmapSize = 100;
+ 
++    pScrn->virtualX = pScrn->currentMode->HDisplay;
++    pScrn->virtualY = pScrn->currentMode->VDisplay;
++
+     if (!fbScreenInit(pScreen, qxl->fb,
+ 		      pScrn->virtualX, pScrn->virtualY,
+ 		      pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth,
+-- 
+1.7.2.2
+
diff --git a/0003-Change-default-virtual-size-to-match-the-highest-ava.patch b/0003-Change-default-virtual-size-to-match-the-highest-ava.patch
new file mode 100644
index 0000000..1cdb8f0
--- /dev/null
+++ b/0003-Change-default-virtual-size-to-match-the-highest-ava.patch
@@ -0,0 +1,114 @@
+From 99200fd56204459f8e451e59f7eceeece58bcf70 Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede at redhat.com>
+Date: Thu, 7 Oct 2010 12:03:24 +0200
+Subject: [PATCH xf86-drv-qxl F14-branch 3/5] Change default virtual size to match the highest available resolution
+
+With the old default virtual size of 1024x768, using higher resolutions
+is not possible without an xorg.conf. Since the default now a days is
+to not have an xorg.conf, this is sort of unfortunate.
+
+This patch makes these higher resolutions available, while keeping the
+default resolution used when none is specified through xorg.conf at
+1024x786, so that the spice client window won't be way too large for
+smaller screens by default.
+
+This change does come at the prize of using more memory, but that
+seems like a reasonable price to pay to give us parity wrt supported
+resolutions with the windows driver. Also this is a must have to allow
+the to be written Linux agent to change the guest resolution to match
+the client machines one when running in auto fullscreen mode.
+
+In the long run we should add support for resizing the fb on the fly to
+match the resolution.
+
+This patch also adjusts a few (fake) clock limits to make all the
+modes reported by the qxl device when compiled with a 16MB framebuffer
+work.
+---
+ src/qxl_driver.c |   35 +++++++++++++++++++++++++----------
+ 1 files changed, 25 insertions(+), 10 deletions(-)
+
+diff --git a/src/qxl_driver.c b/src/qxl_driver.c
+index 3b8728c..0db6e5f 100644
+--- a/src/qxl_driver.c
++++ b/src/qxl_driver.c
+@@ -1478,6 +1478,8 @@ qxl_pre_init(ScrnInfoPtr pScrn, int flags)
+     qxl_screen_t *qxl = NULL;
+     ClockRangePtr clockRanges = NULL;
+     int *linePitches = NULL;
++    DisplayModePtr mode;
++    unsigned int max_x = 0, max_y = 0;
+     
+     CHECK_POINT();
+     
+@@ -1516,7 +1518,7 @@ qxl_pre_init(ScrnInfoPtr pScrn, int flags)
+     clockRanges = xnfcalloc(sizeof(ClockRange), 1);
+     clockRanges->next = NULL;
+     clockRanges->minClock = 10000;
+-    clockRanges->maxClock = 175000;
++    clockRanges->maxClock = 400000;
+     clockRanges->clockIndex = -1;
+     clockRanges->interlaceAllowed = clockRanges->doubleScanAllowed = 0;
+     clockRanges->ClockMulFactor = clockRanges->ClockDivFactor = 1;
+@@ -1524,8 +1526,8 @@ qxl_pre_init(ScrnInfoPtr pScrn, int flags)
+     
+     /* override QXL monitor stuff */
+     if (pScrn->monitor->nHsync <= 0) {
+-	pScrn->monitor->hsync[0].lo = 29.0;
+-	pScrn->monitor->hsync[0].hi = 80.0;
++	pScrn->monitor->hsync[0].lo =  29.0;
++	pScrn->monitor->hsync[0].hi = 160.0;
+ 	pScrn->monitor->nHsync = 1;
+     }
+     if (pScrn->monitor->nVrefresh <= 0) {
+@@ -1534,20 +1536,25 @@ qxl_pre_init(ScrnInfoPtr pScrn, int flags)
+ 	pScrn->monitor->nVrefresh = 1;
+     }
+     
+-    if (pScrn->display->virtualX == 0 && pScrn->display->virtualY == 0) {
+-    	pScrn->display->virtualX = 1024;
+-    	pScrn->display->virtualY = 768;
+-    }
+-    
+     /* Add any modes not in xorg's default mode list */
+     for (i = 0; i < qxl->num_modes; i++)
+-        if (qxl->modes[i].orientation == 0)
++        if (qxl->modes[i].orientation == 0) {
+             qxl_add_mode(pScrn, qxl->modes[i].x_res, qxl->modes[i].y_res,
+                          M_T_DRIVER);
++            if (qxl->modes[i].x_res > max_x)
++                max_x = qxl->modes[i].x_res;
++            if (qxl->modes[i].y_res > max_y)
++                max_y = qxl->modes[i].y_res;
++        }
++
++    if (pScrn->display->virtualX == 0 && pScrn->display->virtualY == 0) {
++    	pScrn->display->virtualX = max_x;
++    	pScrn->display->virtualY = max_y;
++    }
+ 
+     if (0 >= xf86ValidateModes(pScrn, pScrn->monitor->Modes,
+ 			       pScrn->display->modes, clockRanges, linePitches,
+-			       128, 2048, 128 * 4, 128, 2048,
++			       128, max_x, 128 * 4, 128, max_y,
+ 			       pScrn->display->virtualX,
+ 			       pScrn->display->virtualY,
+ 			       128 * 1024 * 1024, LOOKUP_BEST_REFRESH))
+@@ -1557,6 +1564,14 @@ qxl_pre_init(ScrnInfoPtr pScrn, int flags)
+     
+     xf86PruneDriverModes(pScrn);
+     pScrn->currentMode = pScrn->modes;
++    /* If no modes are specified in xorg.conf, default to 1024x768 */
++    if (pScrn->display->modes == NULL || pScrn->display->modes[0] == NULL)
++        for (mode = pScrn->modes; mode; mode = mode->next)
++            if (mode->HDisplay == 1024 && mode->VDisplay == 768) {
++                pScrn->currentMode = mode;
++                break;
++            }
++
+     xf86PrintModes(pScrn);
+     xf86SetDpi(pScrn, 0, 0);
+     
+-- 
+1.7.2.2
+
diff --git a/0004-Fix-restoration-of-text-mode-font-when-leaving-the-v.patch b/0004-Fix-restoration-of-text-mode-font-when-leaving-the-v.patch
new file mode 100644
index 0000000..c9cbe5d
--- /dev/null
+++ b/0004-Fix-restoration-of-text-mode-font-when-leaving-the-v.patch
@@ -0,0 +1,136 @@
+From 00e7b003d7b0267d0cd28906bd93e1dd5fc48338 Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede at redhat.com>
+Date: Thu, 7 Oct 2010 18:35:23 +0200
+Subject: [PATCH xf86-drv-qxl F14-branch 4/5] Fix restoration of text mode font when leaving the vt (rhbz#633647)
+
+---
+ src/qxl.h        |    2 ++
+ src/qxl_driver.c |   41 ++++++++++++++++++++++++++++++-----------
+ 2 files changed, 32 insertions(+), 11 deletions(-)
+
+diff --git a/src/qxl.h b/src/qxl.h
+index 678a0f2..e126546 100644
+--- a/src/qxl.h
++++ b/src/qxl.h
+@@ -40,6 +40,7 @@
+ #endif
+ #include "fb.h"
+ #include "uxa/uxa.h"
++#include "vgaHW.h"
+ 
+ #define hidden _X_HIDDEN
+ 
+@@ -659,6 +660,7 @@ struct _qxl_screen_t
+     pciVideoPtr			pci;
+     PCITAG			pci_tag;
+ #endif
++    vgaRegRec                   vgaRegs;
+ 
+     uxa_driver_t *		uxa;
+     
+diff --git a/src/qxl_driver.c b/src/qxl_driver.c
+index 0db6e5f..c403c3c 100644
+--- a/src/qxl_driver.c
++++ b/src/qxl_driver.c
+@@ -36,9 +36,6 @@
+ #include "qxl.h"
+ #include "assert.h"
+ 
+-#define qxl_save_state(x) do { (void)x; } while (0)
+-#define qxl_restore_state(x) do { (void)x; } while (0)
+-
+ #if 0
+ #define CHECK_POINT() ErrorF ("%s: %d  (%s)\n", __FILE__, __LINE__, __FUNCTION__);
+ #endif
+@@ -272,6 +269,22 @@ qxl_map_memory(qxl_screen_t *qxl, int scrnIndex)
+     return TRUE;
+ }
+ 
++static void
++qxl_save_state(ScrnInfoPtr pScrn)
++{
++    qxl_screen_t *qxl = pScrn->driverPrivate;
++
++    vgaHWSaveFonts(pScrn, &qxl->vgaRegs);
++}
++
++static void
++qxl_restore_state(ScrnInfoPtr pScrn)
++{
++    qxl_screen_t *qxl = pScrn->driverPrivate;
++
++    vgaHWRestoreFonts(pScrn, &qxl->vgaRegs);
++}
++
+ static Bool
+ qxl_close_screen(int scrnIndex, ScreenPtr pScreen)
+ {
+@@ -279,8 +292,10 @@ qxl_close_screen(int scrnIndex, ScreenPtr pScreen)
+     qxl_screen_t *qxl = pScrn->driverPrivate;
+     Bool result;
+     
+-    if (pScrn->vtSema)
++    if (pScrn->vtSema) {
++        qxl_restore_state(pScrn);
+ 	qxl_unmap_memory(qxl, scrnIndex);
++    }
+     pScrn->vtSema = FALSE;
+ 
+     ErrorF ("Freeing %p\n", qxl->fb);
+@@ -1156,7 +1171,7 @@ qxl_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+     printf ("ram_header at %d\n", qxl->rom->ram_header_offset);
+     printf ("surf0 size: %d\n", qxl->rom->surface0_area_size);
+     
+-    qxl_save_state(qxl);
++    qxl_save_state(pScrn);
+     qxl_blank_screen(pScreen, SCREEN_SAVER_ON);
+     
+     miClearVisualTypes();
+@@ -1271,20 +1286,19 @@ static Bool
+ qxl_enter_vt(int scrnIndex, int flags)
+ {
+     ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+-    qxl_screen_t *qxl = pScrn->driverPrivate;
+-    
+-    qxl_save_state(qxl);
+     
++    qxl_save_state(pScrn);
+     qxl_switch_mode(scrnIndex, pScrn->currentMode, 0);
++
+     return TRUE;
+ }
+ 
+ static void
+ qxl_leave_vt(int scrnIndex, int flags)
+ {
+-    qxl_screen_t *qxl = xf86Screens[scrnIndex]->driverPrivate;
++    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+     
+-    qxl_restore_state(qxl);
++    qxl_restore_state(pScrn);
+ }
+ 
+ static Bool
+@@ -1576,13 +1590,18 @@ qxl_pre_init(ScrnInfoPtr pScrn, int flags)
+     xf86SetDpi(pScrn, 0, 0);
+     
+     if (!xf86LoadSubModule(pScrn, "fb") ||
+-	!xf86LoadSubModule(pScrn, "ramdac"))
++	!xf86LoadSubModule(pScrn, "ramdac") ||
++	!xf86LoadSubModule(pScrn, "vgahw"))
+     {
+ 	goto out;
+     }
+     
+     print_modes (qxl, scrnIndex);
+     
++    /* VGA hardware initialisation */
++    if (!vgaHWGetHWRec(pScrn))
++        return FALSE;
++
+     /* hate */
+     qxl_unmap_memory(qxl, scrnIndex);
+     
+-- 
+1.7.2.2
+
diff --git a/0005-Slightly-tweak-the-vfresh-range-of-the-default-monit.patch b/0005-Slightly-tweak-the-vfresh-range-of-the-default-monit.patch
new file mode 100644
index 0000000..58c9fae
--- /dev/null
+++ b/0005-Slightly-tweak-the-vfresh-range-of-the-default-monit.patch
@@ -0,0 +1,26 @@
+From 2860259d083377fcf1681b845c6849c8b48eec63 Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede at redhat.com>
+Date: Sat, 9 Oct 2010 22:11:16 +0200
+Subject: [PATCH xf86-drv-qxl F14-branch 5/5] Slightly tweak the vfresh range of the default monitor
+
+One last tweak to also get 832x624 to work.
+---
+ src/qxl_driver.c |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/src/qxl_driver.c b/src/qxl_driver.c
+index c403c3c..e5d7c34 100644
+--- a/src/qxl_driver.c
++++ b/src/qxl_driver.c
+@@ -1546,7 +1546,7 @@ qxl_pre_init(ScrnInfoPtr pScrn, int flags)
+     }
+     if (pScrn->monitor->nVrefresh <= 0) {
+ 	pScrn->monitor->vrefresh[0].lo = 50;
+-	pScrn->monitor->vrefresh[0].hi = 70;
++	pScrn->monitor->vrefresh[0].hi = 75;
+ 	pScrn->monitor->nVrefresh = 1;
+     }
+     
+-- 
+1.7.2.2
+
diff --git a/xorg-x11-drv-qxl.spec b/xorg-x11-drv-qxl.spec
index cee4ae7..87f71d9 100644
--- a/xorg-x11-drv-qxl.spec
+++ b/xorg-x11-drv-qxl.spec
@@ -5,7 +5,7 @@
 Summary:   Xorg X11 qxl video driver
 Name:      xorg-x11-drv-qxl
 Version:   0.0.20.f14b
-Release:   2%{?dist}.1
+Release:   3%{?dist}
 URL:       http://www.x.org
 Source0:   http://xorg.freedesktop.org/releases/individual/driver/%{tarball}-%{version}.tar.bz2
 License: MIT
@@ -20,6 +20,12 @@ BuildRequires: glib2-devel
 
 Requires:  xorg-x11-server-Xorg >= 1.1.0-1
 Patch0:  0001-Update-to-the-new-dixPrivate-ABI.patch
+Patch1:  0001-Make-non-default-qxl-modes-available.patch
+Patch2:  0002-Make-virtual-resolution-match-actual-resolution-on-s.patch
+Patch3:  0003-Change-default-virtual-size-to-match-the-highest-ava.patch
+Patch4:  0004-Fix-restoration-of-text-mode-font-when-leaving-the-v.patch
+Patch5:  0005-Slightly-tweak-the-vfresh-range-of-the-default-monit.patch
+
 
 %description 
 X.Org X11 qxl video driver.
@@ -27,6 +33,11 @@ X.Org X11 qxl video driver.
 %prep
 %setup -q -n %{tarball}-%{version}
 %patch0 -p1 -b .devprivates
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
+%patch5 -p1
 
 %build
 %configure --disable-static
@@ -50,6 +61,10 @@ rm -rf $RPM_BUILD_ROOT
 %{driverdir}/qxl_drv.so
 
 %changelog
+* Sat Oct  9 2010 Hans de Goede <hdegoede at redhat.com> 0.0.20.f14b-3
+- Add support for using resolutions > 1024x768 without needing an xorg.conf
+- Restore textmode font when switching back to a textmode virtual console
+
 * Fri Oct 08 2010 Jesse Keating <jkeating at redhat.com> - 0.0.20.f14b-2.1
 - Rebuild for gcc bug 634757
 


More information about the scm-commits mailing list