summaryrefslogtreecommitdiff
path: root/hw/xfree86
diff options
context:
space:
mode:
Diffstat (limited to 'hw/xfree86')
-rw-r--r--hw/xfree86/common/xf86AutoConfig.c231
-rw-r--r--hw/xfree86/common/xf86Config.c38
-rw-r--r--hw/xfree86/common/xf86Config.h5
-rw-r--r--hw/xfree86/common/xf86Events.c4
-rw-r--r--hw/xfree86/common/xf86Globals.c2
-rw-r--r--hw/xfree86/common/xf86Helper.c2
-rw-r--r--hw/xfree86/common/xf86Init.c10
-rw-r--r--hw/xfree86/common/xf86Privstr.h2
-rw-r--r--hw/xfree86/common/xf86str.h1
-rw-r--r--hw/xfree86/dri/dri.c4
-rw-r--r--hw/xfree86/modes/xf86Crtc.c61
-rw-r--r--hw/xfree86/modes/xf86Crtc.h3
-rw-r--r--hw/xfree86/modes/xf86EdidModes.c207
-rw-r--r--hw/xfree86/modes/xf86Modes.c11
-rw-r--r--hw/xfree86/modes/xf86Modes.h3
-rw-r--r--hw/xfree86/os-support/assyntax.h2
-rw-r--r--hw/xfree86/os-support/bus/Pci.h2
-rw-r--r--hw/xfree86/os-support/bus/ix86Pci.c20
-rw-r--r--hw/xfree86/os-support/shared/stdResource.c2
-rw-r--r--hw/xfree86/os-support/solaris/sun_bios.c4
-rw-r--r--hw/xfree86/os-support/solaris/sun_init.c12
-rw-r--r--hw/xfree86/os-support/solaris/sun_vid.c14
-rw-r--r--hw/xfree86/os-support/sysv/sysv_video.c4
-rw-r--r--hw/xfree86/os-support/xf86_OSlib.h12
-rw-r--r--hw/xfree86/parser/Configint.h4
-rw-r--r--hw/xfree86/parser/Device.c20
-rw-r--r--hw/xfree86/parser/Screen.c24
-rw-r--r--hw/xfree86/parser/read.c2
-rw-r--r--hw/xfree86/utils/xorgcfg/Makefile.am2
-rw-r--r--hw/xfree86/utils/xorgconfig/xorgconfig.c2
-rw-r--r--hw/xfree86/xf4bpp/vgaSolid.c6
31 files changed, 523 insertions, 193 deletions
diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c
index 4bdf1ceb8..a6bfc0190 100644
--- a/hw/xfree86/common/xf86AutoConfig.c
+++ b/hw/xfree86/common/xf86AutoConfig.c
@@ -39,6 +39,7 @@
#include "xf86Config.h"
#include "xf86Priv.h"
#include "xf86_OSlib.h"
+#include "dirent.h"
/* Sections for the default built-in configuration. */
@@ -174,7 +175,7 @@ videoPtrToDriverName(struct pci_device *dev)
case 0x8086:
if ((dev->device_id == 0x00d1) || (dev->device_id == 0x7800))
return "i740";
- else return "i810";
+ else return "intel";
case 0x102b: return "mga";
case 0x10c8: return "neomagic";
case 0x105d: return "i128";
@@ -214,27 +215,10 @@ xf86AutoConfig(void)
{
const char **p;
char buf[1024];
- struct pci_device_iterator *iter;
- struct pci_device * info = NULL;
const char *driver = NULL;
ConfigStatus ret;
- /* Find the primary device, and get some information about it. */
- iter = pci_slot_match_iterator_create(NULL);
- while ((info = pci_device_next(iter)) != NULL) {
- if (xf86IsPrimaryPci(info)) {
- break;
- }
- }
-
- pci_iterator_destroy(iter);
-
- if (!info) {
- ErrorF("Primary device is not PCI\n");
- }
-
- if (info)
- driver = videoPtrToDriverName(info);
+ driver = chooseVideoDriver();
AppendToConfig(BUILTIN_MODULE_SECTION);
AppendToConfig(BUILTIN_MONITOR_SECTION);
@@ -287,3 +271,212 @@ xf86AutoConfig(void)
return (ret == CONFIG_OK);
}
+
+int
+xchomp(char *line)
+{
+ size_t len = 0;
+
+ if (!line) {
+ return 1;
+ }
+
+ len = strlen(line);
+ if (line[len - 1] == '\n' && len > 0) {
+ line[len - 1] = '\0';
+ }
+ return 0;
+}
+
+GDevPtr
+autoConfigDevice(GDevPtr preconf_device)
+{
+ GDevPtr ptr = NULL;
+
+ if (!xf86configptr) {
+ return NULL;
+ }
+
+ /* If there's a configured section with no driver chosen, use it */
+ if (preconf_device) {
+ ptr = preconf_device;
+ } else {
+ ptr = (GDevPtr)xalloc(sizeof(GDevRec));
+ if (!ptr) {
+ return NULL;
+ }
+ memset((GDevPtr)ptr, 0, sizeof(GDevRec));
+ ptr->chipID = -1;
+ ptr->chipRev = -1;
+ ptr->irq = -1;
+
+ ptr->active = TRUE;
+ ptr->claimed = FALSE;
+ ptr->identifier = "Autoconfigured Video Device";
+ ptr->driver = NULL;
+ }
+ if (!ptr->driver) {
+ ptr->driver = chooseVideoDriver();
+ }
+
+ /* TODO Handle multiple screen sections */
+ if (xf86ConfigLayout.screens && !xf86ConfigLayout.screens->screen->device) {
+ xf86ConfigLayout.screens->screen->device = ptr;
+ ptr->myScreenSection = xf86ConfigLayout.screens->screen;
+ }
+ xf86Msg(X_DEFAULT, "Assigned the driver to the xf86ConfigLayout\n");
+
+ return ptr;
+}
+
+static void
+matchDriverFromFiles (char** matches, uint16_t match_vendor, uint16_t match_chip)
+{
+ DIR *idsdir;
+ FILE *fp;
+ struct dirent *direntry;
+ char *line = NULL;
+ size_t len;
+ ssize_t read;
+ char path_name[256], vendor_str[5], chip_str[5];
+ uint16_t vendor, chip;
+ int i, j;
+ idsdir = opendir("/usr/share/xserver-xorg/pci");
+
+ if (idsdir) {
+ direntry = readdir(idsdir);
+ /* Read the directory */
+ while (direntry) {
+ if (direntry->d_name[0] == '.') {
+ direntry = readdir(idsdir);
+ continue;
+ }
+ len = strlen(direntry->d_name);
+ /* A tiny bit of sanity checking. We should probably do better */
+ if (strncmp(&(direntry->d_name[len-4]), ".ids", 4) == 0) {
+ /* We need the full path name to open the file */
+ strncpy(path_name, "/usr/share/xserver-xorg/pci/", 256);
+ strncat(path_name, direntry->d_name, (256 - strlen(path_name)));
+ fp = fopen(path_name, "r");
+ if (fp == NULL) {
+ xf86Msg(X_ERROR, "Could not open %s for reading. Exiting.\n", path_name);
+ goto end;
+ }
+ /* Read the file */
+ while ((read = getline(&line, &len, fp)) != -1) {
+ xchomp(line);
+ if (isdigit(line[0])) {
+ strncpy(vendor_str, line, 4);
+ vendor_str[4] = '\0';
+ vendor = (int)strtol(vendor_str, NULL, 16);
+ if ((strlen(&line[4])) == 0) {
+ chip_str[0] = '\0';
+ chip = -1;
+ } else {
+ /* Handle trailing whitespace */
+ if (isspace(line[4])) {
+ chip_str[0] = '\0';
+ chip = -1;
+ } else {
+ /* Ok, it's a real ID */
+ strncpy(chip_str, &line[4], 4);
+ chip_str[4] = '\0';
+ chip = (int)strtol(chip_str, NULL, 16);
+ }
+ }
+ if (vendor == match_vendor && chip == match_chip ) {
+ i = 0;
+ while (matches[i]) {
+ i++;
+ }
+ matches[i] = (char*)xalloc(sizeof(char) * strlen(direntry->d_name) - 3);
+ if (!matches[i]) {
+ xf86Msg(X_ERROR, "Could not allocate space for the module name. Exiting.\n");
+ goto end;
+ }
+ /* hack off the .ids suffix. This should guard
+ * against other problems, but it will end up
+ * taking off anything after the first '.' */
+ for (j = 0; j < (strlen(direntry->d_name) - 3) ; j++) {
+ if (direntry->d_name[j] == '.') {
+ matches[i][j] = '\0';
+ break;
+ } else {
+ matches[i][j] = direntry->d_name[j];
+ }
+ }
+ xf86Msg(X_INFO, "Matched %s from file name %s in autoconfig\n", matches[i], direntry->d_name);
+
+ }
+ } else {
+ /* TODO Handle driver overrides here */
+ }
+ }
+ fclose(fp);
+ }
+ direntry = readdir(idsdir);
+ }
+ }
+ end:
+ xfree(line);
+ closedir(idsdir);
+}
+
+char*
+chooseVideoDriver(void)
+{
+ struct pci_device * info = NULL;
+ struct pci_device_iterator *iter;
+ char *chosen_driver = NULL;
+ int i;
+ char *matches[20]; /* If we have more than 20 drivers we're in trouble */
+
+ for (i=0 ; i<20 ; i++)
+ matches[i] = NULL;
+
+ /* Find the primary device, and get some information about it. */
+ iter = pci_slot_match_iterator_create(NULL);
+ while ((info = pci_device_next(iter)) != NULL) {
+ if (xf86IsPrimaryPci(info)) {
+ break;
+ }
+ }
+
+ pci_iterator_destroy(iter);
+
+ if (!info) {
+ ErrorF("Primary device is not PCI\n");
+ }
+
+ matchDriverFromFiles(matches, info->vendor_id, info->device_id);
+
+ /* TODO Handle multiple drivers claiming to support the same PCI ID */
+ if (matches[0]) {
+ chosen_driver = matches[0];
+ } else {
+ chosen_driver = videoPtrToDriverName(info);
+ #if 0 /* Save for later */
+ #if defined __i386__ || defined __amd64__ || defined __hurd__
+ chosen_driver = "vesa";
+ #elif defined __alpha__
+ chosen_driver = "vga";
+ #elif defined __sparc__
+ chosen_driver = "sunffb";
+ #else
+ chosen_driver = "fbdev";
+ #endif
+ #endif
+ }
+
+ xf86Msg(X_DEFAULT, "Matched %s for the autoconfigured driver\n", chosen_driver);
+
+ i = 0;
+ while (matches[i]) {
+ if (matches[i] != chosen_driver) {
+ xfree(matches[i]);
+ }
+ i++;
+ }
+
+ return chosen_driver;
+}
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 71e008069..96fadc9dd 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -77,7 +77,7 @@ extern DeviceAssocRec mouse_assoc;
#include "picture.h"
#endif
-#if (defined(i386) || defined(__i386__)) && \
+#if (defined(__i386__)) && \
(defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
defined(__NetBSD__) || defined(linux) || \
(defined(SVR4) && !defined(sun)) || defined(__GNU__))
@@ -877,7 +877,7 @@ static OptionInfoRec FlagOptions[] = {
{0}, FALSE },
};
-#if defined(i386) || defined(__i386__)
+#ifdef __i386__
static Bool
detectPC98(void)
{
@@ -1164,7 +1164,7 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
xf86Info.pixmap24 = Pix24DontCare;
xf86Info.pix24From = X_DEFAULT;
}
-#if defined(i386) || defined(__i386__)
+#ifdef __i386__
if (xf86GetOptValBool(FlagOptions, FLAG_PC98, &value)) {
xf86Info.pc98 = value;
if (value) {
@@ -1813,11 +1813,6 @@ configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen)
if (!servlayoutp)
return FALSE;
- if (conf_screen == NULL) {
- xf86ConfigError("No Screen sections present\n");
- return FALSE;
- }
-
/*
* which screen section is the active one?
*
@@ -1905,6 +1900,12 @@ configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen, int scrnum,
XF86ConfAdaptorLinkPtr conf_adaptor;
Bool defaultMonitor = FALSE;
+ if (!conf_screen) {
+ conf_screen = xnfcalloc(1, sizeof(XF86ConfScreenRec));
+ conf_screen->scrn_identifier = "Default Screen Section";
+ xf86Msg(X_DEFAULT, "No screen section available. Using defaults.\n");
+ }
+
xf86Msg(from, "|-->Screen \"%s\" (%d)\n", conf_screen->scrn_identifier,
scrnum);
/*
@@ -1939,9 +1940,20 @@ configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen, int scrnum,
if (!configMonitor(screenp->monitor,conf_screen->scrn_monitor))
return FALSE;
}
+ /* Configure the device. If there isn't one configured, attach to the
+ * first inactive one that we can configure. If there's none that work,
+ * set it to NULL so that the section can be autoconfigured later */
screenp->device = xnfcalloc(1, sizeof(GDevRec));
- configDevice(screenp->device,conf_screen->scrn_device, TRUE);
- screenp->device->myScreenSection = screenp;
+ if ((!conf_screen->scrn_device) && (xf86configptr->conf_device_lst)) {
+ conf_screen->scrn_device = xf86configptr->conf_device_lst;
+ xf86Msg(X_DEFAULT, "No device specified for screen \"%s\".\n"
+ "\tUsing the first device section listed.\n", screenp->id);
+ }
+ if (configDevice(screenp->device,conf_screen->scrn_device, TRUE)) {
+ screenp->device->myScreenSection = screenp;
+ } else {
+ screenp->device = NULL;
+ }
screenp->options = conf_screen->scrn_option_lst;
/*
@@ -2230,13 +2242,17 @@ configDevice(GDevPtr devicep, XF86ConfDevicePtr conf_device, Bool active)
{
int i;
+ if (!conf_device) {
+ return FALSE;
+ }
+
if (active)
xf86Msg(X_CONFIG, "| |-->Device \"%s\"\n",
conf_device->dev_identifier);
else
xf86Msg(X_CONFIG, "|-->Inactive Device \"%s\"\n",
conf_device->dev_identifier);
-
+
devicep->identifier = conf_device->dev_identifier;
devicep->vendor = conf_device->dev_vendor;
devicep->board = conf_device->dev_board;
diff --git a/hw/xfree86/common/xf86Config.h b/hw/xfree86/common/xf86Config.h
index b8b5fd42a..a174e463b 100644
--- a/hw/xfree86/common/xf86Config.h
+++ b/hw/xfree86/common/xf86Config.h
@@ -34,6 +34,8 @@
#define _xf86_config_h
#include "xf86Optrec.h"
+#include "xf86Parser.h"
+#include "xf86str.h"
#ifdef HAVE_PARSER_DECLS
/*
@@ -65,5 +67,8 @@ Bool xf86BuiltinInputDriver(const char *);
ConfigStatus xf86HandleConfigFile(Bool);
Bool xf86AutoConfig(void);
+GDevPtr autoConfigDevice(GDevPtr preconf_device);
+char* chooseVideoDriver(void);
+int xchomp(char *line);
#endif /* _xf86_config_h */
diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index c31879ca3..574602f43 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -317,7 +317,7 @@ xf86ProcessActionEvent(ActionEvent action, void *arg)
}
break;
#if !defined(__SOL8__) && !defined(sgi) && \
- (!defined(sun) || defined(i386)) && defined(VT_ACTIVATE)
+ (!defined(sun) || defined(__i386__)) && defined(VT_ACTIVATE)
case ACTION_SWITCHSCREEN:
if (VTSwitchEnabled && !xf86Info.dontVTSwitch && arg) {
int vtno = *((int *) arg);
@@ -340,7 +340,7 @@ xf86ProcessActionEvent(ActionEvent action, void *arg)
#else
if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno + 1) < 0)
#endif
-#if defined (__SCO__) || (defined(sun) && defined (i386) && defined (SVR4)) || defined(__UNIXWARE__)
+#if defined (__SCO__) || (defined(sun) && defined (__i386__) && defined (SVR4)) || defined(__UNIXWARE__)
if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, 0) < 0)
#else
if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, 1) < 0)
diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c
index 4b5105632..d796d627c 100644
--- a/hw/xfree86/common/xf86Globals.c
+++ b/hw/xfree86/common/xf86Globals.c
@@ -126,7 +126,7 @@ xf86InfoRec xf86Info = {
PCIOsConfig, /* pciFlags */
Pix24DontCare, /* pixmap24 */
X_DEFAULT, /* pix24From */
-#if defined(i386) || defined(__i386__)
+#ifdef __i386__
FALSE, /* pc98 */
#endif
TRUE, /* pmFlag */
diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c
index b6fc6b629..1ef79730c 100644
--- a/hw/xfree86/common/xf86Helper.c
+++ b/hw/xfree86/common/xf86Helper.c
@@ -2341,7 +2341,7 @@ xf86GetAllowMouseOpenFail()
_X_EXPORT Bool
xf86IsPc98()
{
-#if defined(i386) || defined(__i386__)
+#ifdef __i386__
return xf86Info.pc98;
#else
return FALSE;
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 9ff2da73a..b3cae2707 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -563,6 +563,16 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
}
/* Load all driver modules specified in the config file */
+ /* If there aren't any specified in the config file, autoconfig them */
+ /* FIXME: Does not handle multiple active screen sections, but I'm not
+ * sure if we really want to handle that case*/
+ GDevPtr configured_device = xf86ConfigLayout.screens->screen->device;
+ if ((!configured_device) || (!configured_device->driver)) {
+ if (!autoConfigDevice(configured_device)) {
+ xf86Msg(X_ERROR, "Automatic driver configuration failed\n");
+ return ;
+ }
+ }
if ((modulelist = xf86DriverlistFromConfig())) {
xf86LoadModules(modulelist, NULL);
xfree(modulelist);
diff --git a/hw/xfree86/common/xf86Privstr.h b/hw/xfree86/common/xf86Privstr.h
index 09ebb0717..75d497471 100644
--- a/hw/xfree86/common/xf86Privstr.h
+++ b/hw/xfree86/common/xf86Privstr.h
@@ -109,7 +109,7 @@ typedef struct {
PciProbeType pciFlags;
Pix24Flags pixmap24;
MessageType pix24From;
-#if defined(i386) || defined(__i386__)
+#ifdef __i386__
Bool pc98;
#endif
Bool pmFlag;
diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h
index 0365ddd62..af98b4fd5 100644
--- a/hw/xfree86/common/xf86str.h
+++ b/hw/xfree86/common/xf86str.h
@@ -142,6 +142,7 @@ typedef enum {
# define M_T_DEFAULT 0x10 /* (VESA) default modes */
# define M_T_USERDEF 0x20 /* One of the modes from the config file */
# define M_T_DRIVER 0x40 /* Supplied by the driver (EDID, etc) */
+# define M_T_USERPREF 0x80 /* mode preferred by the user config */
/* Video mode */
typedef struct _DisplayModeRec {
diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c
index 84c0508bc..c35386354 100644
--- a/hw/xfree86/dri/dri.c
+++ b/hw/xfree86/dri/dri.c
@@ -953,7 +953,7 @@ static Bool
DRICreateDummyContext(ScreenPtr pScreen, Bool needCtxPriv)
{
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
- __GLXscreen *pGLXScreen = __glXgetActiveScreen(pScreen->myNum);
+ __GLXscreen *pGLXScreen = glxGetScreen(pScreen);
__GLcontextModes *modes = pGLXScreen->modes;
void **pVisualConfigPriv = pGLXScreen->pVisualPriv;
DRIContextPrivPtr pDRIContextPriv;
@@ -1017,7 +1017,7 @@ DRICreateContext(ScreenPtr pScreen, VisualPtr visual,
XID context, drm_context_t * pHWContext)
{
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
- __GLXscreen *pGLXScreen = __glXgetActiveScreen(pScreen->myNum);
+ __GLXscreen *pGLXScreen = glxGetScreen(pScreen);
__GLcontextModes *modes = pGLXScreen->modes;
void **pVisualConfigPriv = pGLXScreen->pVisualPriv;
DRIContextPrivPtr pDRIContextPriv;
diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 064ff1689..0a48d5bd3 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -711,7 +711,8 @@ xf86DefaultMode (xf86OutputPtr output, int width, int height)
for (mode = output->probed_modes; mode; mode = mode->next)
{
int dpi;
- int preferred = (mode->type & M_T_PREFERRED) != 0;
+ int preferred = (((mode->type & M_T_PREFERRED) != 0) +
+ ((mode->type & M_T_USERPREF) != 0));
int diff;
if (xf86ModeWidth (mode, output->initial_rotation) > width ||
@@ -1415,7 +1416,7 @@ xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY)
mode->prev = NULL;
output->probed_modes = mode;
}
- mode->type |= M_T_PREFERRED;
+ mode->type |= (M_T_PREFERRED|M_T_USERPREF);
}
else
mode->type &= ~M_T_PREFERRED;
@@ -1532,6 +1533,7 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
int o, c;
DisplayModePtr target_mode = NULL;
+ int target_preferred = 0;
Rotation target_rotation = RR_Rotate_0;
xf86CrtcPtr *crtcs;
DisplayModePtr *modes;
@@ -1572,43 +1574,34 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
}
/*
- * Let outputs with preferred modes drive screen size
+ * User preferred > preferred > other modes
*/
for (o = 0; o < config->num_output; o++)
{
- xf86OutputPtr output = config->output[o];
+ xf86OutputPtr output = config->output[o];
+ DisplayModePtr default_mode;
+ int default_preferred;
- if (enabled[o] &&
- xf86OutputHasPreferredMode (output, width, height))
+ if (!enabled[o])
+ continue;
+ default_mode = xf86DefaultMode (output, width, height);
+ if (!default_mode)
+ continue;
+ default_preferred = (((default_mode->type & M_T_PREFERRED) != 0) +
+ ((default_mode->type & M_T_USERPREF) != 0));
+ if (default_preferred > target_preferred || !target_mode)
{
- target_mode = xf86DefaultMode (output, width, height);
+ target_mode = default_mode;
+ target_preferred = default_preferred;
target_rotation = output->initial_rotation;
- if (target_mode)
- {
- modes[o] = target_mode;
- config->compat_output = o;
- break;
- }
- }
- }
- if (!target_mode)
- {
- for (o = 0; o < config->num_output; o++)
- {
- xf86OutputPtr output = config->output[o];
- if (enabled[o])
- {
- target_mode = xf86DefaultMode (output, width, height);
- target_rotation = output->initial_rotation;
- if (target_mode)
- {
- modes[o] = target_mode;
- config->compat_output = o;
- break;
- }
- }
+ config->compat_output = o;
}
}
+ if (target_mode)
+ modes[config->compat_output] = target_mode;
+ /*
+ * Fill in other output modes
+ */
for (o = 0; o < config->num_output; o++)
{
xf86OutputPtr output = config->output[o];
@@ -2134,8 +2127,12 @@ _X_EXPORT xf86MonPtr
xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus)
{
ScrnInfoPtr scrn = output->scrn;
+ xf86MonPtr mon;
+
+ mon = xf86DoEDID_DDC2 (scrn->scrnIndex, pDDCBus);
+ xf86DDCApplyQuirks (scrn->scrnIndex, pDDCBus);
- return xf86DoEDID_DDC2 (scrn->scrnIndex, pDDCBus);
+ return mon;
}
static char *_xf86ConnectorNames[] = { "None", "VGA", "DVI-I", "DVI-D",
diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h
index 9693e12bb..4c843cd83 100644
--- a/hw/xfree86/modes/xf86Crtc.h
+++ b/hw/xfree86/modes/xf86Crtc.h
@@ -39,6 +39,9 @@
#ifndef M_T_DRIVER
#define M_T_DRIVER 0x40
#endif
+#ifndef M_T_USERPREF
+#define M_T_USERPREF 0x80
+#endif
#ifndef HARDWARE_CURSOR_ARGB
#define HARDWARE_CURSOR_ARGB 0x00004000
#endif
diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c
index 8b5e69d9a..9fa5fef9e 100644
--- a/hw/xfree86/modes/xf86EdidModes.c
+++ b/hw/xfree86/modes/xf86EdidModes.c
@@ -54,6 +54,16 @@ typedef enum {
DDC_QUIRK_PREFER_LARGE_60 = 1 << 0,
/* 135MHz clock is too high, drop a bit */
DDC_QUIRK_135_CLOCK_TOO_HIGH = 1 << 1,
+ /* Prefer the largest mode at 75 Hz */
+ DDC_QUIRK_PREFER_LARGE_75 = 1 << 2,
+ /* Convert detailed timing's horizontal from units of cm to mm */
+ DDC_QUIRK_DETAILED_H_IN_CM = 1 << 3,
+ /* Convert detailed timing's vertical from units of cm to mm */
+ DDC_QUIRK_DETAILED_V_IN_CM = 1 << 4,
+ /* Detailed timing descriptors have bogus size values, so just take the
+ * maximum size and use that.
+ */
+ DDC_QUIRK_DETAILED_USE_MAXIMUM_SIZE = 1 << 5,
} ddc_quirk_t;
static Bool quirk_prefer_large_60 (int scrnIndex, xf86MonPtr DDC)
@@ -81,6 +91,52 @@ static Bool quirk_prefer_large_60 (int scrnIndex, xf86MonPtr DDC)
return FALSE;
}
+static Bool quirk_prefer_large_75 (int scrnIndex, xf86MonPtr DDC)
+{
+ /* Bug #11603: Funai Electronics PM36B */
+ if (memcmp (DDC->vendor.name, "FCM", 4) == 0 &&
+ DDC->vendor.prod_id == 13600)
+ return TRUE;
+
+ return FALSE;
+}
+
+static Bool quirk_detailed_h_in_cm (int scrnIndex, xf86MonPtr DDC)
+{
+ /* Bug #10304: "LGPhilipsLCD LP154W01-A5" */
+ /* Bug #12784: "LGPhilipsLCD LP154W01-TLA2" */
+ if (memcmp (DDC->vendor.name, "LPL", 4) == 0 &&
+ DDC->vendor.prod_id == 0)
+ return TRUE;
+
+ /* Bug #11603: Funai Electronics PM36B */
+ if (memcmp (DDC->vendor.name, "FCM", 4) == 0 &&
+ DDC->vendor.prod_id == 13600)
+ return TRUE;
+
+ return FALSE;
+}
+
+static Bool quirk_detailed_v_in_cm (int scrnIndex, xf86MonPtr DDC)
+{
+ /* Bug #11603: Funai Electronics PM36B */
+ if (memcmp (DDC->vendor.name, "FCM", 4) == 0 &&
+ DDC->vendor.prod_id == 13600)
+ return TRUE;
+
+ return FALSE;
+}
+
+static Bool quirk_detailed_use_maximum_size (int scrnIndex, xf86MonPtr DDC)
+{
+ /* Bug #10304: LGPhilipsLCD LP154W01-A5 */
+ if (memcmp (DDC->vendor.name, "LPL", 4) == 0 &&
+ DDC->vendor.prod_id == 0)
+ return TRUE;
+
+ return FALSE;
+}
+
static Bool quirk_135_clock_too_high (int scrnIndex, xf86MonPtr DDC)
{
/* Envision Peripherals, Inc. EN-7100e. See bug #9550. */
@@ -106,6 +162,22 @@ static const ddc_quirk_map_t ddc_quirks[] = {
quirk_135_clock_too_high, DDC_QUIRK_135_CLOCK_TOO_HIGH,
"Recommended 135MHz pixel clock is too high"
},
+ {
+ quirk_prefer_large_75, DDC_QUIRK_PREFER_LARGE_75,
+ "Detailed timing is not preferred, use largest mode at 75Hz"
+ },
+ {
+ quirk_detailed_h_in_cm, DDC_QUIRK_DETAILED_H_IN_CM,
+ "Detailed timings give horizontal size in cm."
+ },
+ {
+ quirk_detailed_v_in_cm, DDC_QUIRK_DETAILED_V_IN_CM,
+ "Detailed timings give vertical size in cm."
+ },
+ {
+ quirk_detailed_use_maximum_size, DDC_QUIRK_DETAILED_USE_MAXIMUM_SIZE,
+ "Detailed timings give sizes in cm."
+ },
{
NULL, DDC_QUIRK_NONE,
"No known quirks"
@@ -303,6 +375,98 @@ DDCGuessRangesFromModes(int scrnIndex, MonPtr Monitor, DisplayModePtr Modes)
}
}
+static ddc_quirk_t
+xf86DDCDetectQuirks(int scrnIndex, xf86MonPtr DDC, Bool verbose)
+{
+ ddc_quirk_t quirks;
+ int i;
+
+ quirks = DDC_QUIRK_NONE;
+ for (i = 0; ddc_quirks[i].detect; i++) {
+ if (ddc_quirks[i].detect (scrnIndex, DDC)) {
+ if (verbose) {
+ xf86DrvMsg (scrnIndex, X_INFO, " EDID quirk: %s\n",
+ ddc_quirks[i].description);
+ }
+ quirks |= ddc_quirks[i].quirk;
+ }
+ }
+
+ return quirks;
+}
+
+/**
+ * Applies monitor-specific quirks to the decoded EDID information.
+ *
+ * Note that some quirks applying to the mode list are still implemented in
+ * xf86DDCGetModes.
+ */
+void
+xf86DDCApplyQuirks(int scrnIndex, xf86MonPtr DDC)
+{
+ ddc_quirk_t quirks = xf86DDCDetectQuirks (scrnIndex, DDC, FALSE);
+ int i;
+
+ for (i = 0; i < DET_TIMINGS; i++) {
+ struct detailed_monitor_section *det_mon = &DDC->det_mon[i];
+
+ if (det_mon->type != DT)
+ continue;
+
+ if (quirks & DDC_QUIRK_DETAILED_H_IN_CM)
+ det_mon->section.d_timings.h_size *= 10;
+
+ if (quirks & DDC_QUIRK_DETAILED_V_IN_CM)
+ det_mon->section.d_timings.v_size *= 10;
+
+ if (quirks & DDC_QUIRK_DETAILED_USE_MAXIMUM_SIZE) {
+ det_mon->section.d_timings.h_size = 10 * DDC->features.hsize;
+ det_mon->section.d_timings.v_size = 10 * DDC->features.vsize;
+ }
+ }
+}
+
+/**
+ * Walks the modes list, finding the mode with the largest area which is
+ * closest to the target refresh rate, and marks it as the only preferred mode.
+*/
+static void
+xf86DDCSetPreferredRefresh(int scrnIndex, DisplayModePtr modes,
+ float target_refresh)
+{
+ DisplayModePtr mode, best = modes;
+
+ for (mode = modes; mode; mode = mode->next)
+ {
+ mode->type &= ~M_T_PREFERRED;
+
+ if (mode == best) continue;
+
+ if (mode->HDisplay * mode->VDisplay >
+ best->HDisplay * best->VDisplay)
+ {
+ best = mode;
+ continue;
+ }
+ if (mode->HDisplay * mode->VDisplay ==
+ best->HDisplay * best->VDisplay)
+ {
+ double mode_refresh = xf86ModeVRefresh (mode);
+ double best_refresh = xf86ModeVRefresh (best);
+ double mode_dist = fabs(mode_refresh - target_refresh);
+ double best_dist = fabs(best_refresh - target_refresh);
+
+ if (mode_dist < best_dist)
+ {
+ best = mode;
+ continue;
+ }
+ }
+ }
+ if (best)
+ best->type |= M_T_PREFERRED;
+}
+
_X_EXPORT DisplayModePtr
xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC)
{
@@ -312,15 +476,9 @@ xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC)
xf86DrvMsg (scrnIndex, X_INFO, "EDID vendor \"%s\", prod id %d\n",
DDC->vendor.name, DDC->vendor.prod_id);
- quirks = DDC_QUIRK_NONE;
- for (i = 0; ddc_quirks[i].detect; i++)
- if (ddc_quirks[i].detect (scrnIndex, DDC))
- {
- xf86DrvMsg (scrnIndex, X_INFO, " EDID quirk: %s\n",
- ddc_quirks[i].description);
- quirks |= ddc_quirks[i].quirk;
- }
-
+
+ quirks = xf86DDCDetectQuirks(scrnIndex, DDC, TRUE);
+
preferred = PREFERRED_TIMING_MODE(DDC->features.msc);
if (quirks & DDC_QUIRK_PREFER_LARGE_60)
preferred = 0;
@@ -357,32 +515,11 @@ xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC)
Modes = xf86ModesAdd(Modes, Mode);
if (quirks & DDC_QUIRK_PREFER_LARGE_60)
- {
- DisplayModePtr best = Modes;
- for (Mode = Modes; Mode; Mode = Mode->next)
- {
- if (Mode == best) continue;
- if (Mode->HDisplay * Mode->VDisplay > best->HDisplay * best->VDisplay)
- {
- best = Mode;
- continue;
- }
- if (Mode->HDisplay * Mode->VDisplay == best->HDisplay * best->VDisplay)
- {
- double mode_refresh = xf86ModeVRefresh (Mode);
- double best_refresh = xf86ModeVRefresh (best);
- double mode_dist = fabs(mode_refresh - 60.0);
- double best_dist = fabs(best_refresh - 60.0);
- if (mode_dist < best_dist)
- {
- best = Mode;
- continue;
- }
- }
- }
- if (best)
- best->type |= M_T_PREFERRED;
- }
+ xf86DDCSetPreferredRefresh(scrnIndex, Modes, 60);
+
+ if (quirks & DDC_QUIRK_PREFER_LARGE_75)
+ xf86DDCSetPreferredRefresh(scrnIndex, Modes, 75);
+
return Modes;
}
diff --git a/hw/xfree86/modes/xf86Modes.c b/hw/xfree86/modes/xf86Modes.c
index f49c2921c..99817898a 100644
--- a/hw/xfree86/modes/xf86Modes.c
+++ b/hw/xfree86/modes/xf86Modes.c
@@ -389,8 +389,8 @@ xf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList,
bad = TRUE;
for (i = 0; i < mon->nHsync; i++) {
- if (xf86ModeHSync(mode) >= mon->hsync[i].lo &&
- xf86ModeHSync(mode) <= mon->hsync[i].hi)
+ if (xf86ModeHSync(mode) >= mon->hsync[i].lo * (1-SYNC_TOLERANCE) &&
+ xf86ModeHSync(mode) <= mon->hsync[i].hi * (1+SYNC_TOLERANCE))
{
bad = FALSE;
}
@@ -400,8 +400,8 @@ xf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList,
bad = TRUE;
for (i = 0; i < mon->nVrefresh; i++) {
- if (xf86ModeVRefresh(mode) >= mon->vrefresh[i].lo &&
- xf86ModeVRefresh(mode) <= mon->vrefresh[i].hi)
+ if (xf86ModeVRefresh(mode) >= mon->vrefresh[i].lo * (1-SYNC_TOLERANCE) &&
+ xf86ModeVRefresh(mode) <= mon->vrefresh[i].hi * (1+SYNC_TOLERANCE))
{
bad = FALSE;
}
@@ -434,7 +434,8 @@ xf86ValidateModesClocks(ScrnInfoPtr pScrn, DisplayModePtr modeList,
for (mode = modeList; mode != NULL; mode = mode->next) {
Bool good = FALSE;
for (i = 0; i < n_ranges; i++) {
- if (mode->Clock >= min[i] && mode->Clock <= max[i]) {
+ if (mode->Clock >= min[i] * (1-SYNC_TOLERANCE) &&
+ mode->Clock <= max[i] * (1+SYNC_TOLERANCE)) {
good = TRUE;
break;
}
diff --git a/hw/xfree86/modes/xf86Modes.h b/hw/xfree86/modes/xf86Modes.h
index 2bd4edeba..3722d25a0 100644
--- a/hw/xfree86/modes/xf86Modes.h
+++ b/hw/xfree86/modes/xf86Modes.h
@@ -95,4 +95,7 @@ xf86GetMonitorModes (ScrnInfoPtr pScrn, XF86ConfMonitorPtr conf_monitor);
DisplayModePtr
xf86GetDefaultModes (Bool interlaceAllowed, Bool doubleScanAllowed);
+void
+xf86DDCApplyQuirks(int scrnIndex, xf86MonPtr DDC);
+
#endif /* _XF86MODES_H_ */
diff --git a/hw/xfree86/os-support/assyntax.h b/hw/xfree86/os-support/assyntax.h
index 718312cf0..d3e96e5fd 100644
--- a/hw/xfree86/os-support/assyntax.h
+++ b/hw/xfree86/os-support/assyntax.h
@@ -91,7 +91,7 @@
#define GNU_ASSEMBLER
#endif
-#if (defined(__STDC__) && !defined(UNIXCPP)) || (defined (sun) && defined (i386) && defined (SVR4) && defined (__STDC__) && !defined (__GNUC__))
+#if (defined(__STDC__) && !defined(UNIXCPP)) || (defined (sun) && defined (__i386__) && defined (SVR4) && defined (__STDC__) && !defined (__GNUC__))
#define CONCAT(x, y) x ## y
#else
#define CONCAT(x, y) x/**/y
diff --git a/hw/xfree86/os-support/bus/Pci.h b/hw/xfree86/os-support/bus/Pci.h
index bb93260d1..6bd0eb7fc 100644
--- a/hw/xfree86/os-support/bus/Pci.h
+++ b/hw/xfree86/os-support/bus/Pci.h
@@ -210,7 +210,7 @@
# define ARCH_PCI_INIT ia64linuxPciInit
# endif
# define XF86SCANPCI_WRAPPER ia64ScanPCIWrapper
-#elif defined(__i386__) || defined(i386)
+#elif defined(__i386__)
# if defined(linux)
# define ARCH_PCI_INIT linuxPciInit
# else
diff --git a/hw/xfree86/os-support/bus/ix86Pci.c b/hw/xfree86/os-support/bus/ix86Pci.c
index 3ed4f1422..e54246355 100644
--- a/hw/xfree86/os-support/bus/ix86Pci.c
+++ b/hw/xfree86/os-support/bus/ix86Pci.c
@@ -188,8 +188,8 @@ static pciBusFuncs_t ix86Funcs0 = {
/* pciReadLong */ ix86PciReadLongSetup,
/* pciWriteLong */ ix86PciWriteLongSetup,
/* pciSetBitsLong */ ix86PciSetBitsLongSetup,
-#endif
/* pciAddrHostToBus */ pciAddrNOOP,
+#endif
/* pciAddrBusToHost */ pciAddrNOOP
};
@@ -198,8 +198,8 @@ static pciBusFuncs_t ix86Funcs1 = {
/* pciReadLong */ ix86PciReadLongCFG1,
/* pciWriteLong */ ix86PciWriteLongCFG1,
/* pciSetBitsLong */ ix86PciSetBitsLongCFG1,
-#endif
/* pciAddrHostToBus */ pciAddrNOOP,
+#endif
/* pciAddrBusToHost */ pciAddrNOOP
};
@@ -208,8 +208,8 @@ static pciBusFuncs_t ix86Funcs2 = {
/* pciReadLong */ ix86PciReadLongCFG2,
/* pciWriteLong */ ix86PciWriteLongCFG2,
/* pciSetBitsLong */ ix86PciSetBitsLongCFG2,
-#endif
/* pciAddrHostToBus */ pciAddrNOOP,
+#endif
/* pciAddrBusToHost */ pciAddrNOOP
};
@@ -223,6 +223,20 @@ static pciBusInfo_t ix86Pci0 = {
/* bridge */ NULL
};
+_X_EXPORT pointer
+xf86MapDomainMemory(int ScreenNum, int Flags, struct pci_device *dev,
+ ADDRESS Base, unsigned long Size)
+{
+ return xf86MapVidMem(ScreenNum, Flags, Base, Size);
+}
+
+IOADDRESS
+xf86MapLegacyIO(struct pci_device *dev)
+{
+ (void)dev;
+ return 0;
+}
+
static Bool
ix86PciBusCheck(void)
{
diff --git a/hw/xfree86/os-support/shared/stdResource.c b/hw/xfree86/os-support/shared/stdResource.c
index 7229d55b5..c144211f0 100644
--- a/hw/xfree86/os-support/shared/stdResource.c
+++ b/hw/xfree86/os-support/shared/stdResource.c
@@ -44,7 +44,7 @@
#include "bus/Pci.h"
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \
- defined(__DragonFly__)
+ defined(__DragonFly__) || defined(__sun)
#define xf86StdAccResFromOS xf86AccResFromOS
#endif
diff --git a/hw/xfree86/os-support/solaris/sun_bios.c b/hw/xfree86/os-support/solaris/sun_bios.c
index 6a132f5a3..1223dcd68 100644
--- a/hw/xfree86/os-support/solaris/sun_bios.c
+++ b/hw/xfree86/os-support/solaris/sun_bios.c
@@ -26,7 +26,7 @@
#include <xorg-config.h>
#endif
-#ifdef i386
+#ifdef __i386__
#define _NEED_SYSI86
#endif
#include "xf86.h"
@@ -66,7 +66,7 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
Offset += Base & (psize - 1);
Base &= ~(psize - 1);
mlen = (Offset + Len + psize - 1) & ~(psize - 1);
-#if defined(i386) && !defined(__SOL8__)
+#if defined(__i386__) && !defined(__SOL8__)
if (Base >= 0xA0000 && Base + mlen < 0xFFFFF && xf86Info.vtno >= 0)
sprintf(solx86_vtname, "/dev/vt%02d", xf86Info.vtno);
else
diff --git a/hw/xfree86/os-support/solaris/sun_init.c b/hw/xfree86/os-support/solaris/sun_init.c
index 08d35c59c..c7fac524f 100644
--- a/hw/xfree86/os-support/solaris/sun_init.c
+++ b/hw/xfree86/os-support/solaris/sun_init.c
@@ -29,7 +29,7 @@
#include "xf86.h"
#include "xf86Priv.h"
#include "xf86_OSlib.h"
-#if defined(__i386) || defined(__x86)
+#if defined(__i386__) || defined(__x86)
# include <sys/kd.h>
#endif
@@ -40,7 +40,7 @@ static int VTnum = -1;
static int xf86StartVT = -1;
#endif
-#if defined(__SOL8__) || !defined(__i386)
+#if defined(__SOL8__) || !defined(__i386__)
static char fb_dev[PATH_MAX] = "/dev/fb";
#else
static char fb_dev[PATH_MAX] = "/dev/console";
@@ -209,11 +209,11 @@ xf86CloseConsole(void)
#ifdef HAS_USL_VTS
struct vt_mode VT;
#endif
-#if defined(__SOL8__) || !defined(i386)
+#if defined(__SOL8__) || !defined(__i386__)
int tmp;
#endif
-#if !defined(i386) && !defined(__x86)
+#if !defined(__i386__) && !defined(__x86)
if (!xf86DoProbe && !xf86DoConfigure) {
int fd;
@@ -332,7 +332,7 @@ xf86ProcessArgument(int argc, char **argv, int i)
#endif /* HAS_USL_VTS */
-#if defined(__SOL8__) || !defined(i386)
+#if defined(__SOL8__) || !defined(__i386__)
if ((i + 1) < argc) {
if (!strcmp(argv[i], "-dev")) {
@@ -352,7 +352,7 @@ void xf86UseMsg()
#ifdef HAS_USL_VTS
ErrorF("vtXX Use the specified VT number\n");
#endif
-#if defined(__SOL8__) || !defined(i386)
+#if defined(__SOL8__) || !defined(__i386__)
ErrorF("-dev <fb> Framebuffer device\n");
#endif
ErrorF("-keeptty Don't detach controlling tty\n");
diff --git a/hw/xfree86/os-support/solaris/sun_vid.c b/hw/xfree86/os-support/solaris/sun_vid.c
index 4f2ab871f..494b2cfbf 100644
--- a/hw/xfree86/os-support/solaris/sun_vid.c
+++ b/hw/xfree86/os-support/solaris/sun_vid.c
@@ -28,7 +28,7 @@
#include <sys/types.h> /* get __x86 definition if not set by compiler */
-#if defined(i386) || defined(__x86)
+#if defined(__i386__) || defined(__x86)
#define _NEED_SYSI86
#endif
#include "xf86.h"
@@ -108,7 +108,7 @@ xf86MapVidMem(int ScreenNum, int Flags, unsigned long Base, unsigned long Size)
* TSI - 2001.09 - SPARC changes
*/
-#if defined(i386) && !defined(__SOL8__)
+#if defined(__i386__) && !defined(__SOL8__)
if(Base < 0xFFFFF)
sprintf(vtname, "/dev/vt%02d", xf86Info.vtno);
else
@@ -148,14 +148,14 @@ xf86UnMapVidMem(int ScreenNum, pointer Base, unsigned long Size)
/* I/O Permissions section */
/***************************************************************************/
-#if defined(i386) || defined(__x86)
+#if defined(__i386__) || defined(__x86)
static Bool ExtendedEnabled = FALSE;
#endif
_X_EXPORT Bool
xf86EnableIO(void)
{
-#if defined(i386) || defined(__x86)
+#if defined(__i386__) || defined(__x86)
if (ExtendedEnabled)
return TRUE;
@@ -171,7 +171,7 @@ xf86EnableIO(void)
_X_EXPORT void
xf86DisableIO(void)
{
-#if defined(i386) || defined(__x86)
+#if defined(__i386__) || defined(__x86)
if(!ExtendedEnabled)
return;
@@ -188,7 +188,7 @@ xf86DisableIO(void)
_X_EXPORT Bool xf86DisableInterrupts(void)
{
-#if defined(i386) || defined(__x86)
+#if defined(__i386__) || defined(__x86)
if (!ExtendedEnabled && (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0))
return FALSE;
@@ -207,7 +207,7 @@ _X_EXPORT Bool xf86DisableInterrupts(void)
_X_EXPORT void xf86EnableInterrupts(void)
{
-#if defined(i386) || defined(__x86)
+#if defined(__i386__) || defined(__x86)
if (!ExtendedEnabled && (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0))
return;
diff --git a/hw/xfree86/os-support/sysv/sysv_video.c b/hw/xfree86/os-support/sysv/sysv_video.c
index 5811947bd..9972bcaa4 100644
--- a/hw/xfree86/os-support/sysv/sysv_video.c
+++ b/hw/xfree86/os-support/sysv/sysv_video.c
@@ -234,7 +234,7 @@ unmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
return;
}
-#if defined(SVR4) && defined(i386) && !defined(sun)
+#if defined(SVR4) && defined(__i386__) && !defined(sun)
/*
* For some SVR4 versions, a 32-bit read is done for the first location
* in each page when the page is first mapped. If this is done while
@@ -270,7 +270,7 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem)
pVidMem->linearSupported = linearVidMem();
pVidMem->mapMem = mapVidMem;
pVidMem->unmapMem = unmapVidMem;
-#if defined(SVR4) && defined(i386) && !defined(sun)
+#if defined(SVR4) && defined(__i386__) && !defined(sun)
pVidMem->readSideEffects = readSideEffects;
#endif
pVidMem->initialised = TRUE;
diff --git a/hw/xfree86/os-support/xf86_OSlib.h b/hw/xfree86/os-support/xf86_OSlib.h
index fcc79be38..662dbaace 100644
--- a/hw/xfree86/os-support/xf86_OSlib.h
+++ b/hw/xfree86/os-support/xf86_OSlib.h
@@ -100,7 +100,7 @@ typedef signed long xf86ssize_t;
/**************************************************************************/
#if (defined(SYSV) || defined(SVR4)) && \
!defined(DGUX) && !defined(sgi) && \
- (defined(sun) || defined(i386))
+ (defined(sun) || defined(__i386__))
# ifdef SCO325
# ifndef _SVID3
# define _SVID3
@@ -140,7 +140,7 @@ typedef signed long xf86ssize_t;
# endif /* SVR4 && !sun */
/* V86SC_IOPL was moved to <sys/sysi86.h> on Solaris 7 and later */
# if defined(sun) && defined (SVR4) /* Solaris? */
-# if defined(i386) || defined(__x86) /* on x86 or x64? */
+# if defined(__i386__) || defined(__x86) /* on x86 or x64? */
# if !defined(V86SC_IOPL) /* Solaris 7 or later? */
# include <sys/v86.h> /* Nope */
# endif
@@ -148,7 +148,7 @@ typedef signed long xf86ssize_t;
# else
# include <sys/v86.h> /* Not solaris */
# endif /* sun && i386 && SVR4 */
-# if defined(sun) && (defined (i386) || defined(__x86)) && defined (SVR4)
+# if defined(sun) && (defined (__i386__) || defined(__x86)) && defined (SVR4)
# include <sys/psw.h>
# endif
# endif /* _NEED_SYSI86 */
@@ -224,15 +224,11 @@ typedef signed long xf86ssize_t;
# define POSIX_TTY
# endif
-# if defined(sun) && defined (i386) && defined (SVR4) && !defined(__SOL8__)
+# if defined(sun) && defined (__i386__) && defined (SVR4) && !defined(__SOL8__)
# define USE_VT_SYSREQ
# define VT_SYSREQ_DEFAULT TRUE
# endif
-# if defined(ATT) && !defined(i386)
-# define i386 /* not defined in ANSI C mode */
-# endif /* ATT && !i386 */
-
# ifdef SYSV
# if !defined(ISC) || defined(ISC202) || defined(ISC22)
# define NEED_STRERROR
diff --git a/hw/xfree86/parser/Configint.h b/hw/xfree86/parser/Configint.h
index c20c1958c..4d5fbcfab 100644
--- a/hw/xfree86/parser/Configint.h
+++ b/hw/xfree86/parser/Configint.h
@@ -186,8 +186,6 @@ else\
"The Inactive keyword must be followed by a Device name in quotes."
#define UNDEFINED_SCREEN_MSG \
"Undefined Screen \"%s\" referenced by ServerLayout \"%s\"."
-#define UNDEFINED_MONITOR_MSG \
-"Undefined Monitor \"%s\" referenced by Screen \"%s\"."
#define UNDEFINED_MODES_MSG \
"Undefined Modes Section \"%s\" referenced by Monitor \"%s\"."
#define UNDEFINED_DEVICE_MSG \
@@ -204,8 +202,6 @@ else\
"This section must have an Identifier line."
#define ONLY_ONE_MSG \
"This section must have only one of either %s line."
-#define UNDEFINED_DRIVER_MSG \
-"Device section \"%s\" must have a Driver line."
#define UNDEFINED_INPUTDRIVER_MSG \
"InputDevice section \"%s\" must have a Driver line."
#define INVALID_GAMMA_MSG \
diff --git a/hw/xfree86/parser/Device.c b/hw/xfree86/parser/Device.c
index 6ad5601b5..216789fc1 100644
--- a/hw/xfree86/parser/Device.c
+++ b/hw/xfree86/parser/Device.c
@@ -357,26 +357,6 @@ xf86freeDeviceList (XF86ConfDevicePtr ptr)
}
}
-int
-xf86validateDevice (XF86ConfigPtr p)
-{
- XF86ConfDevicePtr device = p->conf_device_lst;
-
- if (!device) {
- xf86validationError ("At least one Device section is required.");
- return (FALSE);
- }
-
- while (device) {
- if (!device->dev_driver) {
- xf86validationError (UNDEFINED_DRIVER_MSG, device->dev_identifier);
- return (FALSE);
- }
- device = device->list.next;
- }
- return (TRUE);
-}
-
XF86ConfDevicePtr
xf86findDevice (const char *ident, XF86ConfDevicePtr p)
{
diff --git a/hw/xfree86/parser/Screen.c b/hw/xfree86/parser/Screen.c
index 79e1d24ef..4524f17f6 100644
--- a/hw/xfree86/parser/Screen.c
+++ b/hw/xfree86/parser/Screen.c
@@ -498,12 +498,6 @@ xf86validateScreen (XF86ConfigPtr p)
XF86ConfDevicePtr device;
XF86ConfAdaptorLinkPtr adaptor;
- if (!screen)
- {
- xf86validationError ("At least one Screen section is required.");
- return (FALSE);
- }
-
while (screen)
{
if (screen->scrn_obso_driver && !screen->scrn_identifier)
@@ -512,13 +506,7 @@ xf86validateScreen (XF86ConfigPtr p)
monitor = xf86findMonitor (screen->scrn_monitor_str, p->conf_monitor_lst);
if (screen->scrn_monitor_str)
{
- if (!monitor)
- {
- xf86validationError (UNDEFINED_MONITOR_MSG,
- screen->scrn_monitor_str, screen->scrn_identifier);
- return (FALSE);
- }
- else
+ if (monitor)
{
screen->scrn_monitor = monitor;
if (!xf86validateMonitor(p, screen))
@@ -526,15 +514,7 @@ xf86validateScreen (XF86ConfigPtr p)
}
}
- device = xf86findDevice (screen->scrn_device_str, p->conf_device_lst);
- if (!device)
- {
- xf86validationError (UNDEFINED_DEVICE_MSG,
- screen->scrn_device_str, screen->scrn_identifier);
- return (FALSE);
- }
- else
- screen->scrn_device = device;
+ screen->scrn_device= xf86findDevice (screen->scrn_device_str, p->conf_device_lst);
adaptor = screen->scrn_adaptor_lst;
while (adaptor)
diff --git a/hw/xfree86/parser/read.c b/hw/xfree86/parser/read.c
index 9f79696ac..430da0a5a 100644
--- a/hw/xfree86/parser/read.c
+++ b/hw/xfree86/parser/read.c
@@ -80,8 +80,6 @@ static xf86ConfigSymTabRec TopLevelTab[] =
static int
xf86validateConfig (XF86ConfigPtr p)
{
- if (!xf86validateDevice (p))
- return FALSE;
if (!xf86validateScreen (p))
return FALSE;
if (!xf86validateInput (p))
diff --git a/hw/xfree86/utils/xorgcfg/Makefile.am b/hw/xfree86/utils/xorgcfg/Makefile.am
index 309ed5c0a..e7113035f 100644
--- a/hw/xfree86/utils/xorgcfg/Makefile.am
+++ b/hw/xfree86/utils/xorgcfg/Makefile.am
@@ -33,7 +33,7 @@ INCLUDES = $(XORG_INCS) -I$(top_srcdir)/hw/xfree86/parser
OPTIONSPATH=$(libdir)/X11
-xorgcfg_CFLAGS = $(XORG_CFLAGS) $(CURSESDEFINES) \
+xorgcfg_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) $(CURSESDEFINES) \
$(XORGCFG_DEP_CFLAGS) -DXKB_RULES_DIR=\"$(XKB_BASE_DIRECTORY)/rules\" \
-DPROJECT_ROOT=\"$(PROJECTROOT)\" -DOPTIONSPATH=\"$(OPTIONSPATH)\"
xorgcfg_LDADD = $(XORGCFG_DEP_LIBS) ../../parser/libxf86config.a $(LOADERLIB) \
diff --git a/hw/xfree86/utils/xorgconfig/xorgconfig.c b/hw/xfree86/utils/xorgconfig/xorgconfig.c
index 8d9c03f5d..f50b4e225 100644
--- a/hw/xfree86/utils/xorgconfig/xorgconfig.c
+++ b/hw/xfree86/utils/xorgconfig/xorgconfig.c
@@ -631,7 +631,7 @@ mouse_configuration(void) {
config_emulate3buttons = 0;
printf("\n");
-#if (defined(sun) && (defined(__i386) || defined(__x86)))
+#if (defined(sun) && (defined(__i386__) || defined(__x86)))
/* SPARC & USB mice (VUID or AUTO protocols) default to /dev/mouse,
but PS/2 mice default to /dev/kdmouse */
if ((config_mousetype != M_AUTO) && (config_mousetype != M_VUID)) {
diff --git a/hw/xfree86/xf4bpp/vgaSolid.c b/hw/xfree86/xf4bpp/vgaSolid.c
index 501bd3db0..0ef18cfeb 100644
--- a/hw/xfree86/xf4bpp/vgaSolid.c
+++ b/hw/xfree86/xf4bpp/vgaSolid.c
@@ -54,7 +54,7 @@ static void fastFill
{
int stop_count = bytewidth ;
register int row_jump = bytes_per_line - bytewidth ;
-#if !defined(OLDHC) && defined(BSDrt) && !defined(i386)
+#if !defined(OLDHC) && defined(BSDrt) && !defined(__i386__)
register const unsigned int notZero = ((unsigned char)(~0x0));
#else
#define notZero ((unsigned char)(~0))
@@ -112,7 +112,7 @@ static void fastFillRMW
{
int stop_count = bytewidth ;
register int row_jump = bytes_per_line - bytewidth ;
-#if !defined(OLDHC) && defined(BSDrt) && !defined(i386)
+#if !defined(OLDHC) && defined(BSDrt) && !defined(__i386__)
register const unsigned int notZero = ((unsigned char)(~0x0));
#endif
register int tmp ;
@@ -369,7 +369,7 @@ register unsigned int height ; /* MUST BE > 0 !! */
{
int stop_count = wordwidth ;
register int row_jump = bytes_per_line - wordwidth*2 ;
-#if !defined(OLDHC) && defined(BSDrt) && !defined(i386) && 0
+#if !defined(OLDHC) && defined(BSDrt) && !defined(__i386__) && 0
register const int notZero = ~0x0 ;
#else
#define notZero ( ~0 )