summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Makefile.am2
-rw-r--r--src/i830_crt.c2
-rw-r--r--src/i830_display.c8
-rw-r--r--src/i830_display.h12
-rw-r--r--src/i830_edid_modes.c58
-rw-r--r--src/i830_modes.c8
-rw-r--r--src/i830_randr.c4
-rw-r--r--src/i830_xf86Modes.c34
-rw-r--r--src/i830_xf86Modes.h42
-rw-r--r--src/i830_xf86cvt.c13
10 files changed, 81 insertions, 102 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 52def8b8..583925f2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -62,6 +62,7 @@ i810_drv_la_SOURCES = \
i830_display.h \
i830_driver.c \
i830_dvo.c \
+ i830_edid_modes.c \
i830.h \
i830_i2c.c \
i830_io.c \
@@ -79,6 +80,7 @@ i810_drv_la_SOURCES = \
i830_tv.c \
i830_xf86Modes.h \
i830_xf86Modes.c \
+ i830_xf86cvt.c \
i915_3d.c \
i915_3d.h \
i915_reg.h \
diff --git a/src/i830_crt.c b/src/i830_crt.c
index f067260d..76a8007c 100644
--- a/src/i830_crt.c
+++ b/src/i830_crt.c
@@ -316,7 +316,7 @@ i830_crt_get_modes(ScrnInfoPtr pScrn, I830OutputPtr output)
fixed_mon.vrefresh[0].lo = 50.0;
fixed_mon.vrefresh[0].hi = 70.0;
- modes = i830xf86DuplicateModes(pScrn, pScrn->monitor->Modes);
+ modes = xf86DuplicateModes(pScrn, pScrn->monitor->Modes);
i830xf86ValidateModesSync(pScrn, modes, &fixed_mon);
i830xf86PruneInvalidModes(pScrn, &modes, TRUE);
diff --git a/src/i830_display.c b/src/i830_display.c
index 04f85cc2..e2e4b6e4 100644
--- a/src/i830_display.c
+++ b/src/i830_display.c
@@ -321,7 +321,7 @@ i830PipeFindClosestMode(ScrnInfoPtr pScrn, int pipe, DisplayModePtr pMode)
assert(pScan->VRefresh != 0.0);
/* If there's an exact match, we're done. */
- if (I830ModesEqual(pScan, pMode)) {
+ if (xf86ModesEqual(pScan, pMode)) {
pBest = pMode;
break;
}
@@ -366,7 +366,7 @@ i830PipeFindClosestMode(ScrnInfoPtr pScrn, int pipe, DisplayModePtr pMode)
"No suitable mode found to program for the pipe.\n"
" continuing with desired mode %dx%d@%.1f\n",
pMode->HDisplay, pMode->VDisplay, pMode->VRefresh);
- } else if (!I830ModesEqual(pBest, pMode)) {
+ } else if (!xf86ModesEqual(pBest, pMode)) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Choosing pipe %d's mode %dx%d@%.1f instead of xf86 "
"mode %dx%d@%.1f\n", pipe,
@@ -434,7 +434,7 @@ i830PipeSetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode, int pipe,
Bool didLock = FALSE;
#endif
- if (I830ModesEqual(&pI830Pipe->curMode, pMode))
+ if (xf86ModesEqual(&pI830Pipe->curMode, pMode))
return TRUE;
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Requested pix clock: %d\n",
@@ -957,7 +957,7 @@ i830GetLoadDetectPipe(ScrnInfoPtr pScrn, I830OutputPtr output)
output->pipe = i;
output->enabled = TRUE;
- I830xf86SetModeCrtc(&mode, INTERLACE_HALVE_V);
+ xf86SetModeCrtc(&mode, INTERLACE_HALVE_V);
i830PipeSetMode(pScrn, &mode, i, FALSE);
diff --git a/src/i830_display.h b/src/i830_display.h
index 322f635c..266d0b28 100644
--- a/src/i830_display.h
+++ b/src/i830_display.h
@@ -25,6 +25,8 @@
*
*/
+#include "xorgVersion.h"
+
/* i830_display.c */
DisplayModePtr
i830PipeFindClosestMode(ScrnInfoPtr pScrn, int pipe, DisplayModePtr pMode);
@@ -41,8 +43,12 @@ Bool i830PipeInUse(ScrnInfoPtr pScrn, int pipe);
/** @{
*/
-DisplayModePtr i830xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC);
-DisplayModePtr i830xf86CVTMode(int HDisplay, int VDisplay, float VRefresh,
- Bool Reduced, Bool Interlaced);
+#if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,1,99,2,0)
+DisplayModePtr i830_xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC);
+DisplayModePtr i830_xf86CVTMode(int HDisplay, int VDisplay, float VRefresh,
+ Bool Reduced, Bool Interlaced);
+#define xf86DDCGetModes i830_xf86DDCGetModes
+#define xf86CVTMode i830_xf86CVTMode
+#endif /* XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,1,99,2) */
/** @} */
diff --git a/src/i830_edid_modes.c b/src/i830_edid_modes.c
index 05df60ce..fcb71d23 100644
--- a/src/i830_edid_modes.c
+++ b/src/i830_edid_modes.c
@@ -25,8 +25,8 @@
* @file This is a copy of edid_modes.c from the X Server, for compatibility
* with old X Servers.
*/
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
+#ifdef HAVE_CONFIG_H
+#include <config.h>
#endif
#include "xf86.h"
@@ -35,6 +35,10 @@
#include "property.h"
#include "propertyst.h"
#include "xf86DDC.h"
+#include "i830.h"
+#include "i830_display.h"
+
+#if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,1,99,2,0)
/*
* TODO:
@@ -92,7 +96,7 @@ DDCModesFromStandardTiming(int scrnIndex, struct std_timings *timing)
for (i = 0; i < STD_TIMINGS; i++) {
if (timing[i].hsize && timing[i].vsize && timing[i].refresh) {
- Mode = i830xf86CVTMode(timing[i].hsize, timing[i].vsize,
+ Mode = xf86CVTMode(timing[i].hsize, timing[i].vsize,
timing[i].refresh, FALSE, FALSE);
Mode->type = M_T_DRIVER;
Modes = xf86ModesAdd(Modes, Mode);
@@ -164,52 +168,8 @@ DDCModeFromDetailedTiming(int scrnIndex, struct detailed_timings *timing,
return Mode;
}
-/*
- *
- */
-static void
-DDCGuessRangesFromModes(int scrnIndex, MonPtr Monitor, DisplayModePtr Modes)
-{
- DisplayModePtr Mode = Modes;
-
- if (!Monitor || !Modes)
- return;
-
- /* set up the ranges for scanning through the modes */
- Monitor->nHsync = 1;
- Monitor->hsync[0].lo = 1024.0;
- Monitor->hsync[0].hi = 0.0;
-
- Monitor->nVrefresh = 1;
- Monitor->vrefresh[0].lo = 1024.0;
- Monitor->vrefresh[0].hi = 0.0;
-
- while (Mode) {
- if (!Mode->HSync)
- Mode->HSync = ((float) Mode->Clock ) / ((float) Mode->HTotal);
-
- if (!Mode->VRefresh)
- Mode->VRefresh = (1000.0 * ((float) Mode->Clock)) /
- ((float) (Mode->HTotal * Mode->VTotal));
-
- if (Mode->HSync < Monitor->hsync[0].lo)
- Monitor->hsync[0].lo = Mode->HSync;
-
- if (Mode->HSync > Monitor->hsync[0].hi)
- Monitor->hsync[0].hi = Mode->HSync;
-
- if (Mode->VRefresh < Monitor->vrefresh[0].lo)
- Monitor->vrefresh[0].lo = Mode->VRefresh;
-
- if (Mode->VRefresh > Monitor->vrefresh[0].hi)
- Monitor->vrefresh[0].hi = Mode->VRefresh;
-
- Mode = Mode->next;
- }
-}
-
DisplayModePtr
-i830xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC)
+xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC)
{
int preferred, i;
DisplayModePtr Modes = NULL, Mode;
@@ -247,3 +207,5 @@ i830xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC)
return Modes;
}
+
+#endif /* XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,1,99,2,0) */
diff --git a/src/i830_modes.c b/src/i830_modes.c
index 9e952c8e..60bedad5 100644
--- a/src/i830_modes.c
+++ b/src/i830_modes.c
@@ -158,11 +158,11 @@ i830_reprobe_output_modes(ScrnInfoPtr pScrn)
/* The code to choose the best mode per pipe later on will require
* VRefresh to be set.
*/
- mode->VRefresh = i830xf86ModeVRefresh(mode);
- I830xf86SetModeCrtc(mode, INTERLACE_HALVE_V);
+ mode->VRefresh = xf86ModeVRefresh(mode);
+ xf86SetModeCrtc(mode, INTERLACE_HALVE_V);
#ifdef DEBUG_REPROBE
- PrintModeline(pScrn->scrnIndex, mode);
+ xf86PrintModeline(pScrn->scrnIndex, mode);
#endif
}
}
@@ -203,7 +203,7 @@ i830_set_xf86_modes_from_outputs(ScrnInfoPtr pScrn)
for (i = 0; i < pI830->num_outputs; i++) {
if (pI830->output[i].probed_modes != NULL) {
pScrn->modes =
- i830xf86DuplicateModes(pScrn, pI830->output[i].probed_modes);
+ xf86DuplicateModes(pScrn, pI830->output[i].probed_modes);
break;
}
}
diff --git a/src/i830_randr.c b/src/i830_randr.c
index 389805a0..9def4d8d 100644
--- a/src/i830_randr.c
+++ b/src/i830_randr.c
@@ -117,7 +117,7 @@ I830RandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
return FALSE;
RRRegisterRate (pScreen, pSize, refresh);
- if (I830ModesEqual(mode, scrp->currentMode) &&
+ if (xf86ModesEqual(mode, scrp->currentMode) &&
mode->HDisplay == scrp->virtualX &&
mode->VDisplay == scrp->virtualY)
{
@@ -509,7 +509,7 @@ I830RandRCrtcNotify (RRCrtcPtr crtc)
for (j = 0; j < rrout->numModes; j++)
{
DisplayModePtr outMode = rrout->modes[j]->devPrivate;
- if (I830ModesEqual(pipeMode, outMode))
+ if (xf86ModesEqual(pipeMode, outMode))
{
mode = rrout->modes[j];
break;
diff --git a/src/i830_xf86Modes.c b/src/i830_xf86Modes.c
index 24cc23bd..809acf50 100644
--- a/src/i830_xf86Modes.c
+++ b/src/i830_xf86Modes.c
@@ -45,13 +45,14 @@
* there but we still want to use. We need to come up with better API here.
*/
+#if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,1,99,2,0)
/**
* Calculates the horizontal sync rate of a mode.
*
* Exact copy of xf86Mode.c's.
*/
double
-i830xf86ModeHSync(DisplayModePtr mode)
+xf86ModeHSync(DisplayModePtr mode)
{
double hsync = 0.0;
@@ -69,7 +70,7 @@ i830xf86ModeHSync(DisplayModePtr mode)
* Exact copy of xf86Mode.c's.
*/
double
-i830xf86ModeVRefresh(DisplayModePtr mode)
+xf86ModeVRefresh(DisplayModePtr mode)
{
double refresh = 0.0;
@@ -89,7 +90,7 @@ i830xf86ModeVRefresh(DisplayModePtr mode)
/** Sets a default mode name of <width>x<height> on a mode. */
void
-i830xf86SetModeDefaultName(DisplayModePtr mode)
+xf86SetModeDefaultName(DisplayModePtr mode)
{
if (mode->name != NULL)
xfree(mode->name);
@@ -98,7 +99,7 @@ i830xf86SetModeDefaultName(DisplayModePtr mode)
}
/*
- * I830xf86SetModeCrtc
+ * xf86SetModeCrtc
*
* Initialises the Crtc parameters for a mode. The initialisation includes
* adjustments for interlaced and double scan modes.
@@ -106,7 +107,7 @@ i830xf86SetModeDefaultName(DisplayModePtr mode)
* Exact copy of xf86Mode.c's.
*/
void
-I830xf86SetModeCrtc(DisplayModePtr p, int adjustFlags)
+xf86SetModeCrtc(DisplayModePtr p, int adjustFlags)
{
if ((p == NULL) || ((p->type & M_T_CRTC_C) == M_T_BUILTIN))
return;
@@ -191,7 +192,7 @@ I830xf86SetModeCrtc(DisplayModePtr p, int adjustFlags)
* Allocates and returns a copy of pMode, including pointers within pMode.
*/
DisplayModePtr
-i830xf86DuplicateMode(DisplayModePtr pMode)
+xf86DuplicateMode(DisplayModePtr pMode)
{
DisplayModePtr pNew;
@@ -200,7 +201,7 @@ i830xf86DuplicateMode(DisplayModePtr pMode)
pNew->next = NULL;
pNew->prev = NULL;
if (pNew->name == NULL) {
- i830xf86SetModeDefaultName(pMode);
+ xf86SetModeDefaultName(pMode);
} else {
pNew->name = xnfstrdup(pMode->name);
}
@@ -215,7 +216,7 @@ i830xf86DuplicateMode(DisplayModePtr pMode)
* \param modeList doubly-linked mode list
*/
DisplayModePtr
-i830xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList)
+xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList)
{
DisplayModePtr first = NULL, last = NULL;
DisplayModePtr mode;
@@ -223,7 +224,7 @@ i830xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList)
for (mode = modeList; mode != NULL; mode = mode->next) {
DisplayModePtr new;
- new = i830xf86DuplicateMode(mode);
+ new = xf86DuplicateMode(mode);
/* Insert pNew into modeList */
if (last) {
@@ -249,7 +250,7 @@ i830xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList)
* This isn't in xf86Modes.c, but it might deserve to be there.
*/
Bool
-I830ModesEqual(DisplayModePtr pMode1, DisplayModePtr pMode2)
+xf86ModesEqual(DisplayModePtr pMode1, DisplayModePtr pMode2)
{
if (pMode1->Clock == pMode2->Clock &&
pMode1->HDisplay == pMode2->HDisplay &&
@@ -285,7 +286,7 @@ add(char **p, char *new)
* Convenient VRefresh printing was added, though, compared to xf86Mode.c
*/
void
-PrintModeline(int scrnIndex,DisplayModePtr mode)
+xf86PrintModeline(int scrnIndex,DisplayModePtr mode)
{
char tmp[256];
char *flags = xnfcalloc(1, 1);
@@ -317,9 +318,10 @@ PrintModeline(int scrnIndex,DisplayModePtr mode)
mode->name, mode->VRefresh, mode->Clock/1000., mode->HDisplay,
mode->HSyncStart, mode->HSyncEnd, mode->HTotal,
mode->VDisplay, mode->VSyncStart, mode->VSyncEnd,
- mode->VTotal, flags, i830xf86ModeHSync(mode));
+ mode->VTotal, flags, xf86ModeHSync(mode));
xfree(flags);
}
+#endif /* XORG_VERSION_CURRENT <= 7.1.99.2 */
/**
* Marks as bad any modes with unsupported flags.
@@ -393,8 +395,8 @@ i830xf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList,
bad = TRUE;
for (i = 0; i < mon->nHsync; i++) {
- if (i830xf86ModeHSync(mode) >= mon->hsync[i].lo &&
- i830xf86ModeHSync(mode) <= mon->hsync[i].hi)
+ if (xf86ModeHSync(mode) >= mon->hsync[i].lo &&
+ xf86ModeHSync(mode) <= mon->hsync[i].hi)
{
bad = FALSE;
}
@@ -404,8 +406,8 @@ i830xf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList,
bad = TRUE;
for (i = 0; i < mon->nVrefresh; i++) {
- if (i830xf86ModeVRefresh(mode) >= mon->vrefresh[i].lo &&
- i830xf86ModeVRefresh(mode) <= mon->vrefresh[i].hi)
+ if (xf86ModeVRefresh(mode) >= mon->vrefresh[i].lo &&
+ xf86ModeVRefresh(mode) <= mon->vrefresh[i].hi)
{
bad = FALSE;
}
diff --git a/src/i830_xf86Modes.h b/src/i830_xf86Modes.h
index 262a45cb..d057ef53 100644
--- a/src/i830_xf86Modes.h
+++ b/src/i830_xf86Modes.h
@@ -25,26 +25,27 @@
*
*/
-double
-i830xf86ModeHSync(DisplayModePtr mode);
+#include "xorgVersion.h"
-double
-i830xf86ModeVRefresh(DisplayModePtr mode);
-
-DisplayModePtr
-i830xf86DuplicateMode(DisplayModePtr pMode);
-
-DisplayModePtr
-i830xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList);
-
-void
-i830xf86SetModeDefaultName(DisplayModePtr mode);
-
-void
-I830xf86SetModeCrtc(DisplayModePtr p, int adjustFlags);
-
-Bool
-I830ModesEqual(DisplayModePtr pMode1, DisplayModePtr pMode2);
+#if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,1,99,2,0)
+double i830_xf86ModeHSync(DisplayModePtr mode);
+double i830_xf86ModeVRefresh(DisplayModePtr mode);
+DisplayModePtr i830_xf86DuplicateMode(DisplayModePtr pMode);
+DisplayModePtr i830_xf86DuplicateModes(ScrnInfoPtr pScrn,
+ DisplayModePtr modeList);
+void i830_xf86SetModeDefaultName(DisplayModePtr mode);
+void i830_xf86SetModeCrtc(DisplayModePtr p, int adjustFlags);
+Bool i830_xf86ModesEqual(DisplayModePtr pMode1, DisplayModePtr pMode2);
+void i830_xf86PrintModeline(int scrnIndex,DisplayModePtr mode);
+#define xf86ModeHSync i830_xf86ModeHSync
+#define xf86ModeVRefresh i830_xf86ModeVRefresh
+#define xf86DuplicateMode i830_xf86DuplicateMode
+#define xf86DuplicateModes i830_xf86DuplicateModes
+#define xf86SetModeDefaultName i830_xf86SetModeDefaultName
+#define xf86SetModeCrtc i830_xf86SetModeCrtc
+#define xf86ModesEqual i830_xf86ModesEqual
+#define xf86PrintModeline i830_xf86PrintModeline
+#endif /* XORG_VERSION_CURRENT <= 7.1.99.2 */
void
i830xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList,
@@ -72,6 +73,3 @@ i830xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList,
void
i830xf86ValidateModesUserConfig(ScrnInfoPtr pScrn, DisplayModePtr modeList);
-
-void
-PrintModeline(int scrnIndex,DisplayModePtr mode);
diff --git a/src/i830_xf86cvt.c b/src/i830_xf86cvt.c
index b0f97273..00140561 100644
--- a/src/i830_xf86cvt.c
+++ b/src/i830_xf86cvt.c
@@ -31,8 +31,16 @@
* code is shared directly.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "xf86.h"
+#include "i830.h"
+#include "i830_display.h"
+
+#if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,1,99,2,0)
/*
* Generate a CVT standard mode from HDisplay, VDisplay and VRefresh.
*
@@ -58,8 +66,8 @@
*
*/
_X_EXPORT DisplayModePtr
-i830xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
- Bool Interlaced)
+xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
+ Bool Interlaced)
{
DisplayModeRec *Mode = xnfalloc(sizeof(DisplayModeRec));
@@ -295,3 +303,4 @@ i830xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
return Mode;
}
+#endif /* XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,1,99,2,0) */