Merge remote-tracking branch 'ajax/dead-code'

This commit is contained in:
Keith Packard 2014-10-02 10:24:33 -07:00
commit e9651e3dbc
22 changed files with 37 additions and 693 deletions

View File

@ -571,25 +571,6 @@ xf86DriverlistFromCompile(void)
return driverlist;
}
/*
* xf86ConfigError --
* Print a READABLE ErrorMessage!!! All information that is
* available is printed.
*/
static void
_X_ATTRIBUTE_PRINTF(1, 2)
xf86ConfigError(const char *msg, ...)
{
va_list ap;
ErrorF("\nConfig Error:\n");
va_start(ap, msg);
VErrorF(msg, ap);
va_end(ap);
ErrorF("\n");
return;
}
static void
configFiles(XF86ConfFilesPtr fileconf)
{
@ -779,7 +760,7 @@ static OptionInfoRec FlagOptions[] = {
{0}, FALSE},
};
static Bool
static void
configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
{
XF86OptionPtr optp, tmp;
@ -893,12 +874,10 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
if ((s = xf86GetOptValString(FlagOptions, FLAG_LOG))) {
if (!xf86NameCmp(s, "flush")) {
xf86Msg(X_CONFIG, "Flushing logfile enabled\n");
xf86Info.log = LogFlush;
LogSetParameter(XLOG_FLUSH, TRUE);
}
else if (!xf86NameCmp(s, "sync")) {
xf86Msg(X_CONFIG, "Syncing logfile enabled\n");
xf86Info.log = LogSync;
LogSetParameter(XLOG_FLUSH, TRUE);
LogSetParameter(XLOG_SYNC, TRUE);
}
@ -980,10 +959,8 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
XkbFreeRMLVOSet(&set, FALSE);
xf86Info.useDefaultFontPath = TRUE;
xf86Info.useDefaultFontPathFrom = X_DEFAULT;
if (xf86GetOptValBool(FlagOptions, FLAG_USE_DEFAULT_FONT_PATH, &value)) {
xf86Info.useDefaultFontPath = value;
xf86Info.useDefaultFontPathFrom = X_CONFIG;
}
/* Make sure that timers don't overflow CARD32's after multiplying */
@ -994,9 +971,8 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
if ((i >= 0) && (i < MAX_TIME_IN_MIN))
ScreenSaverTime = defaultScreenSaverTime = i * MILLI_PER_MIN;
else if (i != -1)
xf86ConfigError
("BlankTime value %d outside legal range of 0 - %d minutes", i,
MAX_TIME_IN_MIN);
ErrorF("BlankTime value %d outside legal range of 0 - %d minutes\n",
i, MAX_TIME_IN_MIN);
#ifdef DPMSExtension
i = -1;
@ -1004,25 +980,22 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
if ((i >= 0) && (i < MAX_TIME_IN_MIN))
DPMSStandbyTime = i * MILLI_PER_MIN;
else if (i != -1)
xf86ConfigError
("StandbyTime value %d outside legal range of 0 - %d minutes", i,
MAX_TIME_IN_MIN);
ErrorF("StandbyTime value %d outside legal range of 0 - %d minutes\n",
i, MAX_TIME_IN_MIN);
i = -1;
xf86GetOptValInteger(FlagOptions, FLAG_DPMS_SUSPENDTIME, &i);
if ((i >= 0) && (i < MAX_TIME_IN_MIN))
DPMSSuspendTime = i * MILLI_PER_MIN;
else if (i != -1)
xf86ConfigError
("SuspendTime value %d outside legal range of 0 - %d minutes", i,
MAX_TIME_IN_MIN);
ErrorF("SuspendTime value %d outside legal range of 0 - %d minutes\n",
i, MAX_TIME_IN_MIN);
i = -1;
xf86GetOptValInteger(FlagOptions, FLAG_DPMS_OFFTIME, &i);
if ((i >= 0) && (i < MAX_TIME_IN_MIN))
DPMSOffTime = i * MILLI_PER_MIN;
else if (i != -1)
xf86ConfigError
("OffTime value %d outside legal range of 0 - %d minutes", i,
MAX_TIME_IN_MIN);
ErrorF("OffTime value %d outside legal range of 0 - %d minutes\n",
i, MAX_TIME_IN_MIN);
#endif
i = -1;
@ -1037,7 +1010,7 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
case -1:
break;
default:
xf86ConfigError("Pixmap option's value (%d) must be 24 or 32\n", i);
ErrorF("Pixmap option's value (%d) must be 24 or 32\n", i);
return FALSE;
}
if (xf86Pix24 != Pix24DontCare) {
@ -1073,8 +1046,6 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
xf86Info.dri2From = X_CONFIG;
}
#endif
return TRUE;
}
Bool
@ -2049,8 +2020,8 @@ configMonitor(MonPtr monitorp, XF86ConfMonitorPtr conf_monitor)
badgamma = monitorp->gamma.blue;
}
if (badgamma > GAMMA_ZERO) {
xf86ConfigError("Gamma value %.f is out of range (%.2f - %.1f)\n",
badgamma, GAMMA_MIN, GAMMA_MAX);
ErrorF("Gamma value %.f is out of range (%.2f - %.1f)\n", badgamma,
GAMMA_MIN, GAMMA_MAX);
return FALSE;
}
@ -2109,8 +2080,7 @@ configDisplay(DispPtr displayp, XF86ConfDisplayPtr conf_display)
if (conf_display->disp_visual) {
displayp->defaultVisual = lookupVisual(conf_display->disp_visual);
if (displayp->defaultVisual == -1) {
xf86ConfigError("Invalid visual name: \"%s\"",
conf_display->disp_visual);
ErrorF("Invalid visual name: \"%s\"\n", conf_display->disp_visual);
return FALSE;
}
}
@ -2168,7 +2138,6 @@ configDevice(GDevPtr devicep, XF86ConfDevicePtr conf_device, Bool active)
devicep->IOBase = conf_device->dev_io_base;
devicep->clockchip = conf_device->dev_clockchip;
devicep->busID = conf_device->dev_busid;
devicep->textClockFreq = conf_device->dev_textclockfreq;
devicep->chipID = conf_device->dev_chipid;
devicep->chipRev = conf_device->dev_chiprev;
devicep->options = conf_device->dev_option_lst;
@ -2503,11 +2472,7 @@ xf86HandleConfigFile(Bool autoconfig)
}
#endif
/* Now process everything else */
if (!configServerFlags(xf86configptr->conf_flags, xf86ConfigLayout.options)) {
ErrorF("Problem when converting the config data structures\n");
return CONFIG_PARSE_ERROR;
}
configServerFlags(xf86configptr->conf_flags, xf86ConfigLayout.options);
configFiles(xf86configptr->conf_files);
configExtensions(xf86configptr->conf_extensions);
#ifdef XF86DRI

View File

@ -267,7 +267,6 @@ configureDeviceSection(int screennum)
for (i = 0; (i < MAXDACSPEEDS) && (i < CONF_MAXDACSPEEDS); i++)
ptr->dev_dacSpeeds[i] = DevToConfig[screennum].GDev.dacSpeeds[i];
ptr->dev_videoram = DevToConfig[screennum].GDev.videoRam;
ptr->dev_textclockfreq = DevToConfig[screennum].GDev.textClockFreq;
ptr->dev_bios_base = DevToConfig[screennum].GDev.BiosBase;
ptr->dev_mem_base = DevToConfig[screennum].GDev.MemBase;
ptr->dev_io_base = DevToConfig[screennum].GDev.IOBase;

View File

@ -120,7 +120,6 @@ xf86InfoRec xf86Info = {
.pixmap24 = Pix24DontCare,
.pix24From = X_DEFAULT,
.pmFlag = TRUE,
.log = LogNone,
.disableRandR = FALSE,
.randRFrom = X_DEFAULT,
#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS)

View File

@ -233,12 +233,6 @@ xf86PrintBanner(void)
"\tto make sure that you have the latest version.\n");
}
static void
xf86PrintMarkers(void)
{
LogPrintMarkers();
}
Bool
xf86PrivsElevated(void)
{
@ -421,7 +415,7 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
xf86ServerName = argv[0];
xf86PrintBanner();
xf86PrintMarkers();
LogPrintMarkers();
if (xf86LogFile) {
time_t t;
const char *ct;

View File

@ -36,12 +36,6 @@
#include "xf86str.h"
typedef enum {
LogNone,
LogFlush,
LogSync
} Log;
typedef enum {
XF86_GlxVisualsMinimal,
XF86_GlxVisualsTypical,
@ -91,7 +85,6 @@ typedef struct {
Pix24Flags pixmap24;
MessageType pix24From;
Bool pmFlag;
Log log;
Bool disableRandR;
MessageType randRFrom;
Bool aiglx;
@ -100,7 +93,6 @@ typedef struct {
MessageType glxVisualsFrom;
Bool useDefaultFontPath;
MessageType useDefaultFontPathFrom;
Bool ignoreABI;
Bool forceInputDevices; /* force xorg.conf or built-in input devices */

View File

@ -74,7 +74,6 @@ typedef struct _CMapLink {
} CMapLink, *CMapLinkPtr;
typedef struct {
ScrnInfoPtr pScrn;
CloseScreenProcPtr CloseScreen;
CreateColormapProcPtr CreateColormap;
DestroyColormapProcPtr DestroyColormap;
@ -123,7 +122,7 @@ static int CMapSetDGAMode(ScrnInfoPtr, int, DGADevicePtr);
#endif
static int CMapChangeGamma(ScrnInfoPtr, Gamma);
static void ComputeGamma(CMapScreenPtr);
static void ComputeGamma(ScrnInfoPtr, CMapScreenPtr);
static Bool CMapAllocateColormapPrivate(ColormapPtr);
static void CMapRefreshColors(ColormapPtr, int, int *);
static void CMapSetOverscan(ColormapPtr, int, int *);
@ -194,7 +193,6 @@ xf86HandleColormaps(ScreenPtr pScreen,
pScreen->InstallColormap = CMapInstallColormap;
pScreen->StoreColors = CMapStoreColors;
pScreenPriv->pScrn = pScrn;
pScrn->LoadPalette = loadPalette;
pScrn->SetOverscan = setOverscan;
pScreenPriv->maxColors = maxColors;
@ -221,7 +219,7 @@ xf86HandleColormaps(ScreenPtr pScreen,
#endif
pScrn->ChangeGamma = CMapChangeGamma;
ComputeGamma(pScreenPriv);
ComputeGamma(pScrn, pScreenPriv);
/* get the default map */
dixLookupResourceByType((void **) &pDefMap, pScreen->defColormap,
@ -660,8 +658,7 @@ CMapRefreshColors(ColormapPtr pmap, int defs, int *indices)
}
if (LOAD_PALETTE(pmap))
(*pScrn->LoadPalette) (pScreenPriv->pScrn, defs, indices,
colors, pmap->pVisual);
(*pScrn->LoadPalette) (pScrn, defs, indices, colors, pmap->pVisual);
if (pScrn->SetOverscan)
CMapSetOverscan(pmap, defs, indices);
@ -822,7 +819,7 @@ CMapSetOverscan(ColormapPtr pmap, int defs, int *indices)
#ifdef DEBUGOVERSCAN
ErrorF("SetOverscan() called from CmapSetOverscan\n");
#endif
pScrn->SetOverscan(pScreenPriv->pScrn, overscan);
pScrn->SetOverscan(pScrn, overscan);
}
}
}
@ -851,7 +848,7 @@ CMapUnwrapScreen(ScreenPtr pScreen)
}
static void
ComputeGamma(CMapScreenPtr priv)
ComputeGamma(ScrnInfoPtr pScrn, CMapScreenPtr priv)
{
int elements = priv->gammaElements - 1;
double RedGamma, GreenGamma, BlueGamma;
@ -859,28 +856,25 @@ ComputeGamma(CMapScreenPtr priv)
#ifndef DONT_CHECK_GAMMA
/* This check is to catch drivers that are not initialising pScrn->gamma */
if (priv->pScrn->gamma.red < GAMMA_MIN ||
priv->pScrn->gamma.red > GAMMA_MAX ||
priv->pScrn->gamma.green < GAMMA_MIN ||
priv->pScrn->gamma.green > GAMMA_MAX ||
priv->pScrn->gamma.blue < GAMMA_MIN ||
priv->pScrn->gamma.blue > GAMMA_MAX) {
if (pScrn->gamma.red < GAMMA_MIN || pScrn->gamma.red > GAMMA_MAX ||
pScrn->gamma.green < GAMMA_MIN || pScrn->gamma.green > GAMMA_MAX ||
pScrn->gamma.blue < GAMMA_MIN || pScrn->gamma.blue > GAMMA_MAX) {
xf86DrvMsgVerb(priv->pScrn->scrnIndex, X_WARNING, 0,
xf86DrvMsgVerb(pScrn->scrnIndex, X_WARNING, 0,
"The %s driver didn't call xf86SetGamma() to initialise\n"
"\tthe gamma values.\n", priv->pScrn->driverName);
xf86DrvMsgVerb(priv->pScrn->scrnIndex, X_WARNING, 0,
"\tthe gamma values.\n", pScrn->driverName);
xf86DrvMsgVerb(pScrn->scrnIndex, X_WARNING, 0,
"PLEASE FIX THE `%s' DRIVER!\n",
priv->pScrn->driverName);
priv->pScrn->gamma.red = 1.0;
priv->pScrn->gamma.green = 1.0;
priv->pScrn->gamma.blue = 1.0;
pScrn->driverName);
pScrn->gamma.red = 1.0;
pScrn->gamma.green = 1.0;
pScrn->gamma.blue = 1.0;
}
#endif
RedGamma = 1.0 / (double) priv->pScrn->gamma.red;
GreenGamma = 1.0 / (double) priv->pScrn->gamma.green;
BlueGamma = 1.0 / (double) priv->pScrn->gamma.blue;
RedGamma = 1.0 / (double) pScrn->gamma.red;
GreenGamma = 1.0 / (double) pScrn->gamma.green;
BlueGamma = 1.0 / (double) pScrn->gamma.blue;
for (i = 0; i <= elements; i++) {
if (RedGamma == 1.0)
@ -933,7 +927,7 @@ CMapChangeGamma(ScrnInfoPtr pScrn, Gamma gamma)
pScrn->gamma.green = gamma.green;
pScrn->gamma.blue = gamma.blue;
ComputeGamma(pScreenPriv);
ComputeGamma(pScrn, pScreenPriv);
/* mark all colormaps on this screen */
pLink = pScreenPriv->maps;

View File

@ -403,7 +403,6 @@ typedef struct {
Bool active;
Bool inUse;
int videoRam;
int textClockFreq;
unsigned long BiosBase; /* Base address of video BIOS */
unsigned long MemBase; /* Frame buffer base address */
unsigned long IOBase;
@ -753,7 +752,6 @@ typedef struct _ScrnInfoRec {
unsigned long memPhysBase; /* Physical address of FB */
unsigned long fbOffset; /* Offset of FB in the above */
int memClk; /* memory clock */
int textClockFreq; /* clock of text mode */
Bool flipPixels; /* swap default black/white */
void *options;

View File

@ -1117,10 +1117,6 @@ xf86XVClipNotify(WindowPtr pWin, int dx, int dy)
pPriv->pCompositeClip = NULL;
if (pPriv->AdaptorRec->ClipNotify)
(*pPriv->AdaptorRec->ClipNotify) (pPriv->pScrn, pPriv->DevPriv.ptr,
pWin, dx, dy);
pPriv->clipChanged = TRUE;
if (ScreenPriv->PostValidateTree == PostValidateTreeUndefined) {

View File

@ -95,8 +95,6 @@ typedef int (*QueryImageAttributesFuncPtr) (ScrnInfoPtr pScrn, int image,
unsigned short *width,
unsigned short *height,
int *pitches, int *offsets);
typedef void (*ClipNotifyFuncPtr) (ScrnInfoPtr pScrn, void *data,
WindowPtr window, int dx, int dy);
typedef enum {
XV_OFF,
@ -145,7 +143,6 @@ typedef struct {
PutImageFuncPtr PutImage;
ReputImageFuncPtr ReputImage; /* image/still */
QueryImageAttributesFuncPtr QueryImageAttributes;
ClipNotifyFuncPtr ClipNotify;
} XF86VideoAdaptorRec, *XF86VideoAdaptorPtr;
typedef struct {

View File

@ -61,7 +61,6 @@ typedef struct {
PutImageFuncPtr PutImage;
ReputImageFuncPtr ReputImage;
QueryImageAttributesFuncPtr QueryImageAttributes;
ClipNotifyFuncPtr ClipNotify;
} XvAdaptorRecPrivate, *XvAdaptorRecPrivatePtr;
typedef struct {

View File

@ -468,61 +468,3 @@ xf86DoEDID_DDC2(ScrnInfoPtr pScrn, I2CBusPtr pBus)
{
return xf86DoEEDID(pScrn, pBus, FALSE);
}
/* XXX write me */
static void *
DDC2ReadDisplayID(void)
{
return FALSE;
}
/**
* Attempts to probe the monitor for DisplayID information, if NoDDC and
* NoDDC2 are unset. DisplayID blocks are interpreted and the results
* returned in an xf86MonPtr.
*
* This function does not affect the list of modes used by drivers -- it is up
* to the driver to decide policy on what to do with DisplayID information.
*
* @return pointer to a new xf86MonPtr containing the DisplayID information.
* @return NULL if no monitor attached or failure to interpret the DisplayID.
*/
xf86MonPtr
xf86DoDisplayID(ScrnInfoPtr pScrn, I2CBusPtr pBus)
{
unsigned char *did = NULL;
xf86MonPtr tmp = NULL;
I2CDevPtr dev = NULL;
/* Default DDC and DDC2 to enabled. */
Bool noddc = FALSE, noddc2 = FALSE;
OptionInfoPtr options;
options = malloc(sizeof(DDCOptions));
if (!options)
return NULL;
memcpy(options, DDCOptions, sizeof(DDCOptions));
xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options);
xf86GetOptValBool(options, DDCOPT_NODDC, &noddc);
xf86GetOptValBool(options, DDCOPT_NODDC2, &noddc2);
free(options);
if (noddc || noddc2)
return NULL;
if (!(dev = DDC2Init(pBus)))
return NULL;
if ((did = DDC2ReadDisplayID())) {
tmp = calloc(1, sizeof(*tmp));
if (!tmp)
return NULL;
tmp->scrnIndex = pScrn->scrnIndex;
tmp->flags |= MONITOR_DISPLAYID;
tmp->rawData = did;
}
return tmp;
}

View File

@ -48,11 +48,6 @@ extern _X_EXPORT Bool xf86SetDDCproperties(ScrnInfoPtr pScreen, xf86MonPtr DDC);
extern _X_EXPORT Bool
xf86MonitorIsHDMI(xf86MonPtr mon);
extern _X_EXPORT xf86MonPtr xf86DoDisplayID(ScrnInfoPtr pScrn, I2CBusPtr pBus);
extern _X_EXPORT void
xf86DisplayIDMonitorSet(int scrnIndex, MonPtr mon, xf86MonPtr DDC);
extern _X_EXPORT DisplayModePtr
FindDMTMode(int hsize, int vsize, int refresh, Bool rb);

View File

@ -71,24 +71,6 @@
#include <dlfcn.h>
#include <X11/Xos.h>
#if defined(DL_LAZY)
#define DLOPEN_LAZY DL_LAZY
#elif defined(RTLD_LAZY)
#define DLOPEN_LAZY RTLD_LAZY
#elif defined(__FreeBSD__)
#define DLOPEN_LAZY 1
#else
#define DLOPEN_LAZY 0
#endif
#if defined(LD_GLOBAL)
#define DLOPEN_GLOBAL LD_GLOBAL
#elif defined(RTLD_GLOBAL)
#define DLOPEN_GLOBAL RTLD_GLOBAL
#else
#define DLOPEN_GLOBAL 0
#endif
#else
#error i have no dynamic linker and i must scream
#endif
@ -128,7 +110,7 @@ LoaderOpen(const char *module, int *errmaj, int *errmin)
xf86Msg(X_INFO, "Loading %s\n", module);
if (!(ret = dlopen(module, DLOPEN_LAZY | DLOPEN_GLOBAL))) {
if (!(ret = dlopen(module, RTLD_LAZY | RTLD_GLOBAL))) {
xf86Msg(X_ERROR, "Failed to load %s: %s\n", module, dlerror());
if (errmaj)
*errmaj = LDR_NOLOAD;
@ -151,7 +133,7 @@ LoaderSymbol(const char *name)
return p;
if (!global_scope)
global_scope = dlopen(NULL, DLOPEN_LAZY | DLOPEN_GLOBAL);
global_scope = dlopen(NULL, RTLD_LAZY | RTLD_GLOBAL);
if (global_scope)
return dlsym(global_scope, name);

View File

@ -1449,12 +1449,6 @@ This optional entry specifies the chip revision number.
This can be used to override the auto-detection, but that should only be done
when the driver-specific documentation recommends it.
.TP 7
.BI "TextClockFreq " "freq"
This optional entry specifies the pixel clock frequency that is used
for the regular text mode.
The frequency is specified in MHz.
This is rarely used.
.TP 7
.BI "MatchSeat " "seat\-id"
Only apply this
.B Device

View File

@ -10,7 +10,6 @@ libxf86modes_la_SOURCES = \
xf86Cursors.c \
xf86cvt.c \
xf86gtf.c \
xf86DisplayIDModes.c \
xf86EdidModes.c \
xf86Modes.c \
xf86Modes.h \

View File

@ -1,444 +0,0 @@
/*
* Copyright 2009 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software")
* to deal in the software without restriction, including without limitation
* on the rights to use, copy, modify, merge, publish, distribute, sub
* license, and/or sell copies of the Software, and to permit persons to whom
* them Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTIBILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Authors:
* Adam Jackson <ajax@redhat.com>
*/
#include "xorg-config.h"
#include "xf86.h"
#include "xf86Modes.h"
#include "xf86str.h"
#include "edid.h"
#include "xf86DDC.h"
typedef void (*did_proc) (int scrnIndex, unsigned char *data, void *closure);
#define DID_PRODUCT_ID 0x00
#define DID_DISPLAY_PARAMETERS 0x01
#define DID_COLOR_INFO 0x02
#define DID_TIMING_1_DETAILED 0x03
#define DID_TIMING_2_DETAILED 0x04
#define DID_TIMING_3_SHORT 0x05
#define DID_TIMING_4_DMT 0x06
#define DID_TIMING_VESA 0x07
#define DID_TIMING_CEA 0x08
#define DID_TIMING_RANGE_LIMITS 0x09
#define DID_PRODUCT_SERIAL 0x0A
#define DID_ASCII_STRING 0x0B
#define DID_DISPLAY_DEVICE 0x0C
#define DID_POWER_SEQUENCING 0x0D
#define DID_TRANSFER_INFO 0x0E
#define DID_DISPLAY_INTERFACE 0x0F
#define DID_STEREO 0x10
#define DID_VENDOR 0x7F
#define extract_le16(x, i) ((x[i+1] << 8) + (x[i]))
#define extract_le24(x, i) ((x[i+2] << 16) + (x[i+1] << 8) + (x[i]))
static DisplayModePtr
modeCalloc(void)
{
return calloc(1, sizeof(DisplayModeRec));
}
/*
* How awesome is it to have two detailed timing formats, neither of which
* are compatible with the format in EDID? So awesome.
*/
static void
didDetailedTiming1(int i, unsigned char *x, MonPtr mon)
{
DisplayModePtr m = modeCalloc();
if (!m)
return;
m->Clock = extract_le24(x, 0);
m->HDisplay = extract_le16(x, 4);
m->HSyncStart = m->HDisplay + (extract_le16(x, 8) & 0x7f);
m->HSyncEnd = m->HSyncStart + extract_le16(x, 10);
m->HTotal = m->HDisplay + extract_le16(x, 6);
m->Flags |= (x[9] & 0x80) ? V_PHSYNC : V_NHSYNC;
m->VDisplay = extract_le16(x, 12);
m->VSyncStart = m->VDisplay + (extract_le16(x, 16) & 0x7f);
m->VSyncEnd = m->VSyncStart + extract_le16(x, 18);
m->VTotal = m->VDisplay + extract_le16(x, 14);
m->Flags |= (x[17] & 0x80) ? V_PVSYNC : V_NVSYNC;
m->type = M_T_DRIVER;
if (x[3] & 0x80)
m->type |= M_T_PREFERRED;
/* XXX double check handling of this */
if (x[3] & 0x10)
m->Flags |= V_INTERLACE;
mon->Modes = xf86ModesAdd(mon->Modes, m);
}
/* XXX no sync bits. what to do? */
static void
didDetailedTiming2(int i, unsigned char *x, MonPtr mon)
{
DisplayModePtr mode = modeCalloc();
if (!mode)
return;
mode->Clock = extract_le24(x, 0);
/* horiz sizes are in character cells, not pixels, hence * 8 */
mode->HDisplay = ((extract_le16(x, 4) & 0x01ff) + 1) * 8;
mode->HSyncStart = mode->HDisplay + (((x[6] & 0xf0) >> 4) + 1) * 8;
mode->HSyncEnd = mode->HSyncStart + ((x[6] & 0x0f) + 1) * 8;
mode->HTotal = mode->HDisplay + ((x[5] >> 1) + 1) * 8;
mode->VDisplay = extract_le16(x, 7) & 0x07ff;
mode->VSyncStart = mode->VDisplay + (x[10] >> 4) + 1;
mode->VSyncEnd = mode->VSyncStart + (x[10] & 0x0f) + 1;
mode->VTotal = mode->VDisplay + x[9];
mode->status = M_T_DRIVER;
if (x[3] & 0x80)
mode->status |= M_T_PREFERRED;
/* XXX double check handling of this */
if (x[3] & 0x10)
mode->Flags |= V_INTERLACE;
mon->Modes = xf86ModesAdd(mon->Modes, mode);
}
static void
didShortTiming(int i, unsigned char *x, MonPtr mon)
{
DisplayModePtr m;
int w, h, r;
w = (x[1] + 1) * 8;
switch (x[0] & 0x0f) {
case 0:
h = w;
break;
case 1:
h = (w * 4) / 5;
break;
case 2:
h = (w * 3) / 4;
break;
case 3:
h = (w * 9) / 15;
break;
case 4:
h = (w * 9) / 16;
break;
case 5:
h = (w * 10) / 16;
break;
default:
return;
}
r = (x[2] & 0x7f) + 1;
m = xf86CVTMode(w, h, r, ! !(x[0] & 0x10), ! !(x[2] & 0x80));
m->type = M_T_DRIVER;
if (x[0] & 0x80)
m->type |= M_T_PREFERRED;
mon->Modes = xf86ModesAdd(mon->Modes, m);
}
static void
didDMTTiming(int i, unsigned char *x, void *closure)
{
MonPtr mon = closure;
mon->Modes = xf86ModesAdd(mon->Modes, xf86DuplicateMode(DMTModes + *x));
}
#define RB 1
#define INT 2
static const struct did_dmt {
short w, h, r, f;
} did_dmt[] = {
/* byte 3 */
{640, 350, 85, 0},
{640, 400, 85, 0},
{720, 400, 85, 0},
{640, 480, 60, 0},
{640, 480, 72, 0},
{640, 480, 75, 0},
{640, 480, 85, 0},
{800, 600, 56, 0},
/* byte 4 */
{800, 600, 60, 0},
{800, 600, 72, 0},
{800, 600, 75, 0},
{800, 600, 85, 0},
{800, 600, 120, RB},
{848, 480, 60, 0},
{1024, 768, 43, INT},
{1024, 768, 60, 0},
/* byte 5 */
{1024, 768, 70, 0},
{1024, 768, 75, 0},
{1024, 768, 85, 0},
{1024, 768, 120, RB},
{1152, 864, 75, 0},
{1280, 768, 60, RB},
{1280, 768, 60, 0},
{1280, 768, 75, 0},
/* byte 6 */
{1280, 768, 85, 0},
{1280, 768, 120, RB},
{1280, 800, 60, RB},
{1280, 800, 60, 0},
{1280, 800, 75, 0},
{1280, 800, 85, 0},
{1280, 800, 120, RB},
{1280, 960, 60, 0},
/* byte 7 */
{1280, 960, 85, 0},
{1280, 960, 120, RB},
{1280, 1024, 60, 0},
{1280, 1024, 75, 0},
{1280, 1024, 85, 0},
{1280, 1024, 120, RB},
{1360, 768, 60, 0},
{1360, 768, 120, RB},
/* byte 8 */
{1400, 1050, 60, RB},
{1400, 1050, 60, 0},
{1400, 1050, 75, 0},
{1400, 1050, 85, 0},
{1400, 1050, 120, RB},
{1440, 900, 60, RB},
{1440, 900, 60, 0},
{1440, 900, 75, 0},
/* byte 9 */
{1440, 900, 85, 0},
{1440, 900, 120, RB},
{1600, 1200, 60, 0},
{1600, 1200, 65, 0},
{1600, 1200, 70, 0},
{1600, 1200, 75, 0},
{1600, 1200, 85, 0},
{1600, 1200, 120, RB},
/* byte a */
{1680, 1050, 60, RB},
{1680, 1050, 60, 0},
{1680, 1050, 75, 0},
{1680, 1050, 85, 0},
{1680, 1050, 120, RB},
{1792, 1344, 60, 0},
{1792, 1344, 75, 0},
{1792, 1344, 120, RB},
/* byte b */
{1856, 1392, 60, 0},
{1856, 1392, 75, 0},
{1856, 1392, 120, RB},
{1920, 1200, 60, RB},
{1920, 1200, 60, 0},
{1920, 1200, 75, 0},
{1920, 1200, 85, 0},
{1920, 1200, 120, RB},
/* byte c */
{1920, 1440, 60, 0},
{1920, 1440, 75, 0},
{1920, 1440, 120, RB},
{2560, 1600, 60, RB},
{2560, 1600, 60, 0},
{2560, 1600, 75, 0},
{2560, 1600, 85, 0},
{2560, 1600, 120, RB},
};
static void
didVesaTiming(int scrn, unsigned char *x, MonPtr mon)
{
int i, j;
x += 3;
for (i = 0; i < 10; i++)
for (j = 0; j < 8; j++)
if (x[i] & (1 << j)) {
const struct did_dmt *d = &(did_dmt[i * 8 + j]);
if (d->f == INT)
continue;
mon->Modes = xf86ModesAdd(mon->Modes,
FindDMTMode(d->w, d->h, d->r,
d->f == RB));
}
}
static void
handleDisplayIDBlock(int scrnIndex, unsigned char *x, void *closure)
{
MonPtr mon = closure;
switch (x[0]) {
case DID_DISPLAY_PARAMETERS:
/* w/h are in decimillimeters */
mon->widthmm = (extract_le16(x, 3) + 5) / 10;
mon->heightmm = (extract_le16(x, 5) + 5) / 10;
/* XXX pixel count, feature flags, gamma, aspect, color depth */
break;
case DID_TIMING_RANGE_LIMITS:
{
int n;
mon->maxPixClock = max(mon->maxPixClock, extract_le24(x, 6) * 10);
n = mon->nHsync++;
if (n < MAX_HSYNC) {
mon->hsync[n].lo = x[9];
mon->hsync[n].hi = x[10];
}
else {
n = MAX_HSYNC;
}
n = mon->nVrefresh++;
if (n < MAX_VREFRESH) {
mon->vrefresh[n].lo = x[13];
mon->vrefresh[n].hi = x[14];
}
else {
n = MAX_VREFRESH;
}
break;
}
case DID_TIMING_1_DETAILED:
{
int i;
for (i = 0; i < x[2]; i += 20)
didDetailedTiming1(scrnIndex, x + i + 3, mon);
break;
}
case DID_TIMING_2_DETAILED:
{
int i;
for (i = 0; i < x[2]; i += 11)
didDetailedTiming2(scrnIndex, x + i + 3, mon);
break;
}
case DID_TIMING_3_SHORT:
{
int i;
for (i = 0; i < x[2]; i += 3)
didShortTiming(scrnIndex, x + i + 3, mon);
break;
}
case DID_TIMING_4_DMT:
{
int i;
for (i = 0; i < x[2]; i++)
didDMTTiming(scrnIndex, x + i + 3, mon);
break;
}
case DID_TIMING_VESA:
didVesaTiming(scrnIndex, x, mon);
break;
/* XXX pixel format, ar, orientation, subpixel, dot pitch, bit depth */
case DID_DISPLAY_DEVICE:
/* XXX interface, links, color encoding, ss, drm */
case DID_DISPLAY_INTERFACE:
/* XXX stereo */
case DID_STEREO:
/* nothing interesting in these */
case DID_COLOR_INFO:
case DID_PRODUCT_SERIAL:
case DID_ASCII_STRING:
case DID_POWER_SEQUENCING:
case DID_TRANSFER_INFO:
case DID_VENDOR:
break;
/* warn about anything else */
default:
xf86DrvMsg(scrnIndex, X_WARNING,
"Unknown DisplayID block type %hx\n", x[0]);
break;
}
}
static void
forEachDisplayIDBlock(int scrnIndex, unsigned char *did, did_proc proc,
void *closure)
{
int num_extensions = did[3];
int section_size = did[1];
unsigned char *block;
do {
if ((did[0] & 0xf0) != 0x10) /* not 1.x, abort */
return;
/* XXX also, checksum */
block = did + 4;
while (section_size > 0) {
int block_size = (block[2] + 2);
proc(scrnIndex, block, closure);
section_size -= block_size;
block += block_size;
}
did += (did[1] + 5);
} while (num_extensions--);
}
/*
* Fill out MonPtr with xf86MonPtr information.
*/
void
xf86DisplayIDMonitorSet(int scrnIndex, MonPtr mon, xf86MonPtr DDC)
{
if (!mon || !DDC)
return;
mon->DDC = DDC;
forEachDisplayIDBlock(scrnIndex, DDC->rawData, handleDisplayIDBlock, mon);
}

View File

@ -83,7 +83,6 @@ xf86ConfigSymTabRec DeviceTab[] = {
{CARD, "card"},
{DRIVER, "driver"},
{BUSID, "busid"},
{TEXTCLOCKFRQ, "textclockfreq"},
{IRQ, "irq"},
{SCREEN, "screen"},
{-1, ""},
@ -212,11 +211,6 @@ xf86parseDeviceSection(void)
ptr->dev_clocks = i;
xf86unGetToken(token);
break;
case TEXTCLOCKFRQ:
if ((token = xf86getSubToken(&(ptr->dev_comment))) != NUMBER)
Error(NUMBER_MSG, "TextClockFreq");
ptr->dev_textclockfreq = (int) (xf86_lex_val.realnum * 1000.0 + 0.5);
break;
case MATCHSEAT:
if (xf86getSubToken(&(ptr->dev_comment)) != STRING)
Error(QUOTE_MSG, "MatchSeat");
@ -312,10 +306,6 @@ xf86printDeviceSection(FILE * cf, XF86ConfDevicePtr ptr)
fprintf(cf, "%.1f ", (double) ptr->dev_clock[i] / 1000.0);
fprintf(cf, "\n");
}
if (ptr->dev_textclockfreq) {
fprintf(cf, "\tTextClockFreq %.1f\n",
(double) ptr->dev_textclockfreq / 1000.0);
}
if (ptr->dev_busid)
fprintf(cf, "\tBusID \"%s\"\n", ptr->dev_busid);
if (ptr->dev_screen > 0)

View File

@ -211,7 +211,6 @@ typedef struct {
const char *dev_ramdac;
int dev_dacSpeeds[CONF_MAXDACSPEEDS];
int dev_videoram;
int dev_textclockfreq;
unsigned long dev_bios_base;
unsigned long dev_mem_base;
unsigned long dev_io_base;

View File

@ -187,7 +187,6 @@ typedef enum {
CHIPREV,
CARD,
BUSID,
TEXTCLOCKFRQ,
IRQ,
/* Keyboard tokens */

View File

@ -46,7 +46,7 @@
* dramatically in this case).
*/
#if defined(__cplusplus) && !defined(_NO_INLINE)
#if defined(__cplusplus)
#define _INLINE inline
#else
#define _INLINE static

View File

@ -57,7 +57,6 @@ typedef struct {
Bool active;
Bool inUse;
int videoRam;
int textClockFreq;
void *options;
int screen; /* For multi-CRTC cards */
} GDevRec, *GDevPtr;

View File

@ -235,42 +235,7 @@ miExpandDirectColors(ColormapPtr pmap, int ndef, xColorItem * indefs,
Bool
miCreateDefColormap(ScreenPtr pScreen)
{
/*
* In the following sources PC X server vendors may want to delete
* "_not_tog" from "#ifdef WIN32_not_tog"
*/
#ifdef WIN32_not_tog
/*
* these are the MS-Windows desktop colors, adjusted for X's 16-bit
* color specifications.
*/
static xColorItem citems[] = {
{0, 0, 0, 0, 0, 0},
{1, 0x8000, 0, 0, 0, 0},
{2, 0, 0x8000, 0, 0, 0},
{3, 0x8000, 0x8000, 0, 0, 0},
{4, 0, 0, 0x8000, 0, 0},
{5, 0x8000, 0, 0x8000, 0, 0},
{6, 0, 0x8000, 0x8000, 0, 0},
{7, 0xc000, 0xc000, 0xc000, 0, 0},
{8, 0xc000, 0xdc00, 0xc000, 0, 0},
{9, 0xa600, 0xca00, 0xf000, 0, 0},
{246, 0xff00, 0xfb00, 0xf000, 0, 0},
{247, 0xa000, 0xa000, 0xa400, 0, 0},
{248, 0x8000, 0x8000, 0x8000, 0, 0},
{249, 0xff00, 0, 0, 0, 0},
{250, 0, 0xff00, 0, 0, 0},
{251, 0xff00, 0xff00, 0, 0, 0},
{252, 0, 0, 0xff00, 0, 0},
{253, 0xff00, 0, 0xff00, 0, 0},
{254, 0, 0xff00, 0xff00, 0, 0},
{255, 0xff00, 0xff00, 0xff00, 0, 0}
};
#define NUM_DESKTOP_COLORS sizeof citems / sizeof citems[0]
int i;
#else
unsigned short zero = 0, ones = 0xFFFF;
#endif
Pixel wp, bp;
VisualPtr pVisual;
ColormapPtr cmap;
@ -294,21 +259,12 @@ miCreateDefColormap(ScreenPtr pScreen)
if (pScreen->rootDepth > 1) {
wp = pScreen->whitePixel;
bp = pScreen->blackPixel;
#ifdef WIN32_not_tog
for (i = 0; i < NUM_DESKTOP_COLORS; i++) {
if (AllocColor(cmap,
&citems[i].red, &citems[i].green, &citems[i].blue,
&citems[i].pixel, 0) != Success)
return FALSE;
}
#else
if ((AllocColor(cmap, &ones, &ones, &ones, &wp, 0) !=
Success) ||
(AllocColor(cmap, &zero, &zero, &zero, &bp, 0) != Success))
return FALSE;
pScreen->whitePixel = wp;
pScreen->blackPixel = bp;
#endif
}
(*pScreen->InstallColormap) (cmap);