summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriLisa Wu <liswu@ati.com>2007-08-20 15:44:07 +0200
committerMatthias Hopf <mhopf@suse.de>2007-08-20 15:44:07 +0200
commita0d0fcd3bab765b4db25e04884fd8a342abb9c66 (patch)
treeba4fc1b7bf978b758912e7053c12cf57c582dadd
parentd0895f67e327bb268fd59fcfd8fc22678d804f57 (diff)
Fix crash with no valid mode in xorg.conf's modelist and empty Virtual
If the resolution defined in xorg.conf failed to find a matching mode in the supported modelist, and no virtual desktop dimensions are defined the xorg.conf either, virtual X and Y dimension will be set to 0 which will cause Xserver crash. (Novell bugzilla #296856, closed)
-rw-r--r--src/radeon_modes.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/radeon_modes.c b/src/radeon_modes.c
index 1a63971..e1635e0 100644
--- a/src/radeon_modes.c
+++ b/src/radeon_modes.c
@@ -299,6 +299,8 @@ int RADEONValidateDDCModes(ScrnInfoPtr pScrn1, char **ppModeName,
DisplayModePtr first = NULL;
DisplayModePtr ddcModes = NULL;
int count = 0;
+ int maxXRes = 0;
+ int maxYRes = 0;
int i, width, height;
ScrnInfoPtr pScrn = pScrn1;
@@ -334,13 +336,13 @@ int RADEONValidateDDCModes(ScrnInfoPtr pScrn1, char **ppModeName,
p->Flags |= RADEON_USE_RMX;
}
- maxVirtX = MAX(maxVirtX, p->HDisplay);
- maxVirtY = MAX(maxVirtY, p->VDisplay);
+ maxXRes = maxVirtX = MAX(maxVirtX, p->HDisplay);
+ maxYRes = maxVirtY = MAX(maxVirtY, p->VDisplay);
count++;
last = p;
}
-
+
/* Match up modes that are specified in the XF86Config file */
if (ppModeName[0]) {
DisplayModePtr next;
@@ -378,9 +380,21 @@ int RADEONValidateDDCModes(ScrnInfoPtr pScrn1, char **ppModeName,
break;
}
}
+ if (!p) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ " %dx%d is not supported by the device\n",
+ width, height);
+ }
}
}
-
+ /* just for sanity check, if maxVirtX and maxVirtY are not
+ * specified, set max resolution that panel support for the max
+ * virtual dimensions */
+ if ((!maxVirtX) || (!maxVirtY)) {
+ maxVirtX = maxXRes;
+ maxVirtY = maxYRes;
+ }
+
/*
* Add remaining DDC modes if they're smaller than the user
* specified modes