Kludge around duplicate code added in hw/xfree86/modes.
Code added in hw/xfree86/modes came from the server-1.3-branch. Portions of this code had previously been integrated into xf86Mode.c and edid_modes.c. To preserve hw/xfree86/modes as much as possible, the duplicate code from the other files has been disabled; a more careful review would figure out where that code actually belonged.
This commit is contained in:
parent
258beebc77
commit
f350909d16
|
@ -368,6 +368,7 @@ xf86HandleBuiltinMode(ScrnInfoPtr scrp,
|
|||
return MODE_OK;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/** Calculates the horizontal sync rate of a mode */
|
||||
_X_EXPORT double
|
||||
xf86ModeHSync(DisplayModePtr mode)
|
||||
|
@ -411,6 +412,7 @@ xf86SetModeDefaultName(DisplayModePtr mode)
|
|||
|
||||
mode->name = XNFprintf("%dx%d", mode->HDisplay, mode->VDisplay);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* xf86LookupMode
|
||||
|
@ -680,6 +682,7 @@ xf86LookupMode(ScrnInfoPtr scrp, DisplayModePtr modep,
|
|||
}
|
||||
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* xf86SetModeCrtc
|
||||
*
|
||||
|
@ -733,7 +736,9 @@ xf86SetModeCrtc(DisplayModePtr p, int adjustFlags)
|
|||
p->CrtcHAdjusted = FALSE;
|
||||
p->CrtcVAdjusted = FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/**
|
||||
* Allocates and returns a copy of pMode, including pointers within pMode.
|
||||
*/
|
||||
|
@ -814,6 +819,7 @@ xf86ModesEqual(DisplayModePtr pMode1, DisplayModePtr pMode2)
|
|||
return FALSE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* xf86CheckModeForMonitor
|
||||
|
@ -2040,6 +2046,7 @@ add(char **p, char *new)
|
|||
strcat(*p, new);
|
||||
}
|
||||
|
||||
#if 0
|
||||
_X_EXPORT void
|
||||
xf86PrintModeline(int scrnIndex,DisplayModePtr mode)
|
||||
{
|
||||
|
@ -2075,6 +2082,7 @@ xf86PrintModeline(int scrnIndex,DisplayModePtr mode)
|
|||
mode->VTotal, flags);
|
||||
xfree(flags);
|
||||
}
|
||||
#endif
|
||||
|
||||
_X_EXPORT void
|
||||
xf86PrintModes(ScrnInfoPtr scrp)
|
||||
|
@ -2145,6 +2153,7 @@ xf86PrintModes(ScrnInfoPtr scrp)
|
|||
} while (p != NULL && p != scrp->modes);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/**
|
||||
* Adds the new mode into the mode list, and returns the new list
|
||||
*
|
||||
|
@ -2168,3 +2177,4 @@ xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new)
|
|||
|
||||
return modes;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -3,8 +3,7 @@ sdk_HEADERS = edid.h vdif.h xf86DDC.h
|
|||
noinst_LIBRARIES = libddc.a
|
||||
|
||||
libddc_a_SOURCES = xf86DDC.c edid.c interpret_edid.c print_edid.c \
|
||||
interpret_vdif.c print_vdif.c ddcProperty.c \
|
||||
edid_modes.c
|
||||
interpret_vdif.c print_vdif.c ddcProperty.c
|
||||
|
||||
INCLUDES = $(XORG_INCS) -I$(srcdir)/../i2c
|
||||
|
||||
|
|
|
@ -24,4 +24,4 @@ sdk_HEADERS = \
|
|||
xf86RandR12.h \
|
||||
xf86Rename.h
|
||||
|
||||
AM_CFLAGS = $(XORG_CFLAGS)
|
||||
AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
|
||||
|
|
|
@ -259,6 +259,50 @@ 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
|
||||
xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC)
|
||||
{
|
||||
|
@ -341,3 +385,106 @@ xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC)
|
|||
}
|
||||
return Modes;
|
||||
}
|
||||
|
||||
/*
|
||||
* Fill out MonPtr with xf86MonPtr information.
|
||||
*/
|
||||
void
|
||||
xf86DDCMonitorSet(int scrnIndex, MonPtr Monitor, xf86MonPtr DDC)
|
||||
{
|
||||
DisplayModePtr Modes = NULL, Mode;
|
||||
int i, clock;
|
||||
Bool have_hsync = FALSE, have_vrefresh = FALSE;
|
||||
|
||||
if (!Monitor || !DDC)
|
||||
return;
|
||||
|
||||
Monitor->DDC = DDC;
|
||||
|
||||
Monitor->widthmm = 10 * DDC->features.hsize;
|
||||
Monitor->heightmm = 10 * DDC->features.vsize;
|
||||
|
||||
/* If this is a digital display, then we can use reduced blanking */
|
||||
if (DDC->features.input_type)
|
||||
Monitor->reducedblanking = TRUE;
|
||||
/* Allow the user to also enable this through config */
|
||||
|
||||
Modes = xf86DDCGetModes(scrnIndex, DDC);
|
||||
|
||||
/* Skip EDID ranges if they were specified in the config file */
|
||||
have_hsync = (Monitor->nHsync != 0);
|
||||
have_vrefresh = (Monitor->nVrefresh != 0);
|
||||
|
||||
/* Go through the detailed monitor sections */
|
||||
for (i = 0; i < DET_TIMINGS; i++) {
|
||||
switch (DDC->det_mon[i].type) {
|
||||
case DS_RANGES:
|
||||
if (!have_hsync) {
|
||||
if (!Monitor->nHsync)
|
||||
xf86DrvMsg(scrnIndex, X_INFO,
|
||||
"Using EDID range info for horizontal sync\n");
|
||||
Monitor->hsync[Monitor->nHsync].lo =
|
||||
DDC->det_mon[i].section.ranges.min_h;
|
||||
Monitor->hsync[Monitor->nHsync].hi =
|
||||
DDC->det_mon[i].section.ranges.max_h;
|
||||
Monitor->nHsync++;
|
||||
} else {
|
||||
xf86DrvMsg(scrnIndex, X_INFO,
|
||||
"Using hsync ranges from config file\n");
|
||||
}
|
||||
|
||||
if (!have_vrefresh) {
|
||||
if (!Monitor->nVrefresh)
|
||||
xf86DrvMsg(scrnIndex, X_INFO,
|
||||
"Using EDID range info for vertical refresh\n");
|
||||
Monitor->vrefresh[Monitor->nVrefresh].lo =
|
||||
DDC->det_mon[i].section.ranges.min_v;
|
||||
Monitor->vrefresh[Monitor->nVrefresh].hi =
|
||||
DDC->det_mon[i].section.ranges.max_v;
|
||||
Monitor->nVrefresh++;
|
||||
} else {
|
||||
xf86DrvMsg(scrnIndex, X_INFO,
|
||||
"Using vrefresh ranges from config file\n");
|
||||
}
|
||||
|
||||
clock = DDC->det_mon[i].section.ranges.max_clock * 1000;
|
||||
if (clock > Monitor->maxPixClock)
|
||||
Monitor->maxPixClock = clock;
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (Modes) {
|
||||
/* Print Modes */
|
||||
xf86DrvMsg(scrnIndex, X_INFO, "Printing DDC gathered Modelines:\n");
|
||||
|
||||
Mode = Modes;
|
||||
while (Mode) {
|
||||
xf86PrintModeline(scrnIndex, Mode);
|
||||
Mode = Mode->next;
|
||||
}
|
||||
|
||||
/* Do we still need ranges to be filled in? */
|
||||
if (!Monitor->nHsync || !Monitor->nVrefresh)
|
||||
DDCGuessRangesFromModes(scrnIndex, Monitor, Modes);
|
||||
|
||||
/* look for last Mode */
|
||||
Mode = Modes;
|
||||
|
||||
while (Mode->next)
|
||||
Mode = Mode->next;
|
||||
|
||||
/* add to MonPtr */
|
||||
if (Monitor->Modes) {
|
||||
Monitor->Last->next = Modes;
|
||||
Modes->prev = Monitor->Last;
|
||||
Monitor->Last = Mode;
|
||||
} else {
|
||||
Monitor->Modes = Modes;
|
||||
Monitor->Last = Mode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue