aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xfree86/modes/xf86Modes.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/xfree86/modes/xf86Modes.c')
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Modes.c34
1 files changed, 25 insertions, 9 deletions
diff --git a/xorg-server/hw/xfree86/modes/xf86Modes.c b/xorg-server/hw/xfree86/modes/xf86Modes.c
index ea398ad81..1522fa731 100644
--- a/xorg-server/hw/xfree86/modes/xf86Modes.c
+++ b/xorg-server/hw/xfree86/modes/xf86Modes.c
@@ -52,7 +52,7 @@ extern XF86ConfigPtr xf86configptr;
* Exact copy of xf86Mode.c's.
*/
_X_EXPORT double
-xf86ModeHSync(DisplayModePtr mode)
+xf86ModeHSync(const DisplayModeRec *mode)
{
double hsync = 0.0;
@@ -70,7 +70,7 @@ xf86ModeHSync(DisplayModePtr mode)
* Exact copy of xf86Mode.c's.
*/
_X_EXPORT double
-xf86ModeVRefresh(DisplayModePtr mode)
+xf86ModeVRefresh(const DisplayModeRec *mode)
{
double refresh = 0.0;
@@ -89,7 +89,7 @@ xf86ModeVRefresh(DisplayModePtr mode)
}
_X_EXPORT int
-xf86ModeWidth (DisplayModePtr mode, Rotation rotation)
+xf86ModeWidth (const DisplayModeRec *mode, Rotation rotation)
{
switch (rotation & 0xf) {
case RR_Rotate_0:
@@ -104,7 +104,7 @@ xf86ModeWidth (DisplayModePtr mode, Rotation rotation)
}
_X_EXPORT int
-xf86ModeHeight (DisplayModePtr mode, Rotation rotation)
+xf86ModeHeight (const DisplayModeRec *mode, Rotation rotation)
{
switch (rotation & 0xf) {
case RR_Rotate_0:
@@ -206,7 +206,7 @@ xf86SetModeCrtc(DisplayModePtr p, int adjustFlags)
* Allocates and returns a copy of pMode, including pointers within pMode.
*/
_X_EXPORT DisplayModePtr
-xf86DuplicateMode(DisplayModePtr pMode)
+xf86DuplicateMode(const DisplayModeRec *pMode)
{
DisplayModePtr pNew;
@@ -264,7 +264,7 @@ xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList)
* This isn't in xf86Modes.c, but it might deserve to be there.
*/
_X_EXPORT Bool
-xf86ModesEqual(DisplayModePtr pMode1, DisplayModePtr pMode2)
+xf86ModesEqual(const DisplayModeRec *pMode1, const DisplayModeRec *pMode2)
{
if (pMode1->Clock == pMode2->Clock &&
pMode1->HDisplay == pMode2->HDisplay &&
@@ -509,10 +509,27 @@ xf86ValidateModesBandwidth(ScrnInfoPtr pScrn, DisplayModePtr modeList,
for (mode = modeList; mode != NULL; mode = mode->next) {
if (xf86ModeBandwidth(mode, depth) > bandwidth)
+#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
mode->status = MODE_BANDWIDTH;
+#else
+ /* MODE_BANDWIDTH didn't exist in xserver 1.2 */
+ mode->status = MODE_BAD;
+#endif
}
}
+Bool
+xf86ModeIsReduced(const DisplayModeRec *mode)
+{
+ if ((((mode->HDisplay * 5 / 4) & ~0x07) > mode->HTotal) &&
+ ((mode->HTotal - mode->HDisplay) == 160) &&
+ ((mode->HSyncEnd - mode->HDisplay) == 80) &&
+ ((mode->HSyncEnd - mode->HSyncStart) == 32) &&
+ ((mode->VSyncStart - mode->VDisplay) == 3))
+ return TRUE;
+ return FALSE;
+}
+
/**
* Marks as bad any reduced-blanking modes.
*
@@ -521,7 +538,6 @@ xf86ValidateModesBandwidth(ScrnInfoPtr pScrn, DisplayModePtr modeList,
_X_EXPORT void
xf86ValidateModesReducedBlanking(ScrnInfoPtr pScrn, DisplayModePtr modeList)
{
- Bool mode_is_reduced = FALSE;
DisplayModePtr mode;
for (mode = modeList; mode != NULL; mode = mode->next) {
@@ -677,12 +693,12 @@ xf86GetMonitorModes (ScrnInfoPtr pScrn, XF86ConfMonitorPtr conf_monitor)
_X_EXPORT DisplayModePtr
xf86GetDefaultModes (Bool interlaceAllowed, Bool doubleScanAllowed)
{
- DisplayModePtr head = NULL, prev = NULL, mode;
+ DisplayModePtr head = NULL, mode;
int i;
for (i = 0; i < xf86NumDefaultModes; i++)
{
- DisplayModePtr defMode = &xf86DefaultModes[i];
+ const DisplayModeRec *defMode = &xf86DefaultModes[i];
if (!interlaceAllowed && (defMode->Flags & V_INTERLACE))
continue;