summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2010-10-07 12:01:55 +0200
committerSøren Sandmann Pedersen <ssp@redhat.com>2011-01-26 08:12:18 -0500
commit9b3e355f37841a6c25ebf2452614d3618367dc9c (patch)
treed790c716eaa4f2f38fa0995e75351ccd38d141b3
parent50e4a57bbe7535d289116c93fe79d20a435fb1ef (diff)
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. 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.
-rw-r--r--src/qxl_driver.c44
1 files changed, 39 insertions, 5 deletions
diff --git a/src/qxl_driver.c b/src/qxl_driver.c
index 3024829..5942335 100644
--- a/src/qxl_driver.c
+++ b/src/qxl_driver.c
@@ -1481,10 +1481,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;
@@ -1526,7 +1554,7 @@ qxl_pre_init(ScrnInfoPtr pScrn, int flags)
clockRanges = xnfcalloc(sizeof(ClockRange), 1);
clockRanges->next = NULL;
clockRanges->minClock = 10000;
- clockRanges->maxClock = 165000;
+ clockRanges->maxClock = 400000;
clockRanges->clockIndex = -1;
clockRanges->interlaceAllowed = clockRanges->doubleScanAllowed = 0;
clockRanges->ClockMulFactor = clockRanges->ClockDivFactor = 1;
@@ -1534,13 +1562,13 @@ 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].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) {
pScrn->monitor->vrefresh[0].lo = 50;
- pScrn->monitor->vrefresh[0].hi = 70;
+ pScrn->monitor->vrefresh[0].hi = 75;
pScrn->monitor->nVrefresh = 1;
}
@@ -1549,6 +1577,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,