aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xfree86
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-12-10 19:06:59 +0000
committermarha <marha@users.sourceforge.net>2010-12-10 19:06:59 +0000
commit3a20d23b48c1051e1f22295fd886cc7f643417f6 (patch)
tree5192dddd9ecf591de2e22504f7268c2935382d90 /xorg-server/hw/xfree86
parent531a0d974b98074978535f086a73b6b662fa0cea (diff)
downloadvcxsrv-3a20d23b48c1051e1f22295fd886cc7f643417f6.tar.gz
vcxsrv-3a20d23b48c1051e1f22295fd886cc7f643417f6.tar.bz2
vcxsrv-3a20d23b48c1051e1f22295fd886cc7f643417f6.zip
xserver git update 10/12/2010
Diffstat (limited to 'xorg-server/hw/xfree86')
-rw-r--r--xorg-server/hw/xfree86/common/Makefile.am4
-rw-r--r--xorg-server/hw/xfree86/common/xf86AutoConfig.c4
-rw-r--r--xorg-server/hw/xfree86/common/xf86Config.c13
-rw-r--r--xorg-server/hw/xfree86/common/xf86Configure.c33
-rw-r--r--xorg-server/hw/xfree86/common/xf86Helper.c15
-rw-r--r--xorg-server/hw/xfree86/common/xf86Init.c3
-rw-r--r--xorg-server/hw/xfree86/common/xf86Option.c5
-rw-r--r--xorg-server/hw/xfree86/common/xf86ShowOpts.c10
-rw-r--r--xorg-server/hw/xfree86/common/xf86pciBus.c4
-rw-r--r--xorg-server/hw/xfree86/common/xf86sbusBus.c6
-rw-r--r--xorg-server/hw/xfree86/dixmods/extmod/modinit.c5
-rw-r--r--xorg-server/hw/xfree86/dri/dri.c7
-rw-r--r--xorg-server/hw/xfree86/loader/loadmod.c18
-rw-r--r--xorg-server/hw/xfree86/loader/sdksyms.sh1
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Crtc.c8
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Modes.c4
-rw-r--r--xorg-server/hw/xfree86/modes/xf86cvt.c594
-rw-r--r--xorg-server/hw/xfree86/os-support/solaris/solaris-amd64.S134
-rw-r--r--xorg-server/hw/xfree86/os-support/solaris/solaris-ia32.S134
-rw-r--r--xorg-server/hw/xfree86/os-support/solaris/solaris-sparcv8plus.S276
-rw-r--r--xorg-server/hw/xfree86/os-support/solaris/sun_VTsw.c2
-rw-r--r--xorg-server/hw/xfree86/os-support/solaris/sun_agp.c2
-rw-r--r--xorg-server/hw/xfree86/os-support/solaris/sun_apm.c452
-rw-r--r--xorg-server/hw/xfree86/os-support/solaris/sun_bell.c2
-rw-r--r--xorg-server/hw/xfree86/os-support/solaris/sun_vid.c2
-rw-r--r--xorg-server/hw/xfree86/parser/Flags.c13
-rw-r--r--xorg-server/hw/xfree86/parser/Makefile.am101
-rw-r--r--xorg-server/hw/xfree86/parser/Pointer.c470
-rw-r--r--xorg-server/hw/xfree86/ramdac/Makefile.am38
-rw-r--r--xorg-server/hw/xfree86/utils/cvt/Makefile.am81
-rw-r--r--xorg-server/hw/xfree86/utils/cvt/cvt.c582
-rw-r--r--xorg-server/hw/xfree86/utils/gtf/Makefile.am88
-rw-r--r--xorg-server/hw/xfree86/vbe/vbeModes.c4
-rw-r--r--xorg-server/hw/xfree86/xaa/Makefile.am52
34 files changed, 1571 insertions, 1596 deletions
diff --git a/xorg-server/hw/xfree86/common/Makefile.am b/xorg-server/hw/xfree86/common/Makefile.am
index c4067aa62..56caaa5ab 100644
--- a/xorg-server/hw/xfree86/common/Makefile.am
+++ b/xorg-server/hw/xfree86/common/Makefile.am
@@ -24,8 +24,8 @@ BUSSOURCES = xf86pciBus.c xf86fbBus.c xf86noBus.c $(SBUS_SOURCES)
MODEDEFSOURCES = $(srcdir)/vesamodes $(srcdir)/extramodes
xf86DefModeSet.c: $(srcdir)/modeline2c.awk $(MODEDEFSOURCES)
- cat $(MODEDEFSOURCES) | LC_ALL=C $(AWK) -f $(srcdir)/modeline2c.awk > $@
- echo >> $@
+ $(AM_V_GEN)cat $(MODEDEFSOURCES) | LC_ALL=C $(AWK) -f $(srcdir)/modeline2c.awk > $@
+ $(AM_V_GEN)echo >> $@
BUILT_SOURCES = xf86DefModeSet.c
diff --git a/xorg-server/hw/xfree86/common/xf86AutoConfig.c b/xorg-server/hw/xfree86/common/xf86AutoConfig.c
index 14b266d38..384f08103 100644
--- a/xorg-server/hw/xfree86/common/xf86AutoConfig.c
+++ b/xorg-server/hw/xfree86/common/xf86AutoConfig.c
@@ -297,8 +297,8 @@ copyScreen(confScreenPtr oscreen, GDevPtr odev, int i, char *driver)
}
memcpy(cptr, odev, sizeof(GDevRec));
- cptr->identifier = Xprintf("Autoconfigured Video Device %s", driver);
- if (!cptr->identifier) {
+ if (asprintf(&cptr->identifier, "Autoconfigured Video Device %s", driver)
+ == -1) {
free(cptr);
free(nscreen);
return FALSE;
diff --git a/xorg-server/hw/xfree86/common/xf86Config.c b/xorg-server/hw/xfree86/common/xf86Config.c
index c439221f9..4246f6d71 100644
--- a/xorg-server/hw/xfree86/common/xf86Config.c
+++ b/xorg-server/hw/xfree86/common/xf86Config.c
@@ -208,9 +208,7 @@ xf86ValidateFontPath(char *path)
continue;
}
else {
- p1 = xnfalloc(strlen(dir_elem)+strlen(DIR_FILE)+1);
- strcpy(p1, dir_elem);
- strcat(p1, DIR_FILE);
+ XNFasprintf(&p1, "%s%s", dir_elem, DIR_FILE);
flag = stat(p1, &stat_buf);
if (flag == 0)
if (!S_ISREG(stat_buf.st_mode))
@@ -585,12 +583,11 @@ configFiles(XF86ConfFilesPtr fileconf)
else if (fileconf && fileconf->file_fontpath) {
pathFrom = X_CONFIG;
if (xf86Info.useDefaultFontPath) {
- defaultFontPath = Xprintf("%s%s%s",
- fileconf->file_fontpath,
- *temp_path ? "," : "", temp_path);
- if (defaultFontPath != NULL) {
+ if (asprintf(&defaultFontPath, "%s%s%s", fileconf->file_fontpath,
+ *temp_path ? "," : "", temp_path) == -1)
+ defaultFontPath = NULL;
+ else
must_copy = FALSE;
- }
}
else
defaultFontPath = fileconf->file_fontpath;
diff --git a/xorg-server/hw/xfree86/common/xf86Configure.c b/xorg-server/hw/xfree86/common/xf86Configure.c
index 6cce1cdd5..c106f3754 100644
--- a/xorg-server/hw/xfree86/common/xf86Configure.c
+++ b/xorg-server/hw/xfree86/common/xf86Configure.c
@@ -205,12 +205,9 @@ configureScreenSection (int screennum)
int depths[] = { 1, 4, 8, 15, 16, 24/*, 32*/ };
parsePrologue (XF86ConfScreenPtr, XF86ConfScreenRec)
- ptr->scrn_identifier = malloc(18);
- sprintf(ptr->scrn_identifier, "Screen%d", screennum);
- ptr->scrn_monitor_str = malloc(19);
- sprintf(ptr->scrn_monitor_str, "Monitor%d", screennum);
- ptr->scrn_device_str = malloc(16);
- sprintf(ptr->scrn_device_str, "Card%d", screennum);
+ XNFasprintf(&ptr->scrn_identifier, "Screen%d", screennum);
+ XNFasprintf(&ptr->scrn_monitor_str, "Monitor%d", screennum);
+ XNFasprintf(&ptr->scrn_device_str, "Card%d", screennum);
for (i=0; i<sizeof(depths)/sizeof(depths[0]); i++)
{
@@ -256,14 +253,13 @@ optionTypeToString(OptionValueType type)
static XF86ConfDevicePtr
configureDeviceSection (int screennum)
{
- char identifier[16];
OptionInfoPtr p;
int i = 0;
parsePrologue (XF86ConfDevicePtr, XF86ConfDeviceRec)
/* Move device info to parser structure */
- sprintf(identifier, "Card%d", screennum);
- ptr->dev_identifier = strdup(identifier);
+ if (asprintf(&ptr->dev_identifier, "Card%d", screennum) == -1)
+ ptr->dev_identifier = NULL;
ptr->dev_chipset = DevToConfig[screennum].GDev.chipset;
ptr->dev_busid = DevToConfig[screennum].GDev.busID;
ptr->dev_driver = DevToConfig[screennum].GDev.driver;
@@ -306,10 +302,8 @@ configureDeviceSection (int screennum)
int len = strlen(ptr->dev_comment) + strlen(prefix) +
strlen(middle) + strlen(suffix) + 1;
- optname = malloc(strlen(p->name) + 2 + 1);
- if (!optname)
+ if (asprintf(&optname, "\"%s\"", p->name) == -1)
break;
- sprintf(optname, "\"%s\"", p->name);
len += max(20, strlen(optname));
len += strlen(opttype);
@@ -370,16 +364,14 @@ configureLayoutSection (void)
aptr->adj_x = 0;
aptr->adj_y = 0;
aptr->adj_scrnum = scrnum;
- aptr->adj_screen_str = xnfalloc(18);
- sprintf(aptr->adj_screen_str, "Screen%d", scrnum);
+ XNFasprintf(&aptr->adj_screen_str, "Screen%d", scrnum);
if (scrnum == 0) {
aptr->adj_where = CONF_ADJ_ABSOLUTE;
aptr->adj_refscreen = NULL;
}
else {
aptr->adj_where = CONF_ADJ_RIGHTOF;
- aptr->adj_refscreen = xnfalloc(18);
- sprintf(aptr->adj_refscreen, "Screen%d", scrnum - 1);
+ XNFasprintf(&aptr->adj_refscreen, "Screen%d", scrnum - 1);
}
ptr->lay_adjacency_lst =
(XF86ConfAdjacencyPtr)xf86addListItem((glp)ptr->lay_adjacency_lst,
@@ -443,8 +435,7 @@ configureMonitorSection (int screennum)
{
parsePrologue (XF86ConfMonitorPtr, XF86ConfMonitorRec)
- ptr->mon_identifier = malloc(19);
- sprintf(ptr->mon_identifier, "Monitor%d", screennum);
+ XNFasprintf(&ptr->mon_identifier, "Monitor%d", screennum);
ptr->mon_vendor = strdup("Monitor Vendor");
ptr->mon_modelname = strdup("Monitor Model");
@@ -491,11 +482,9 @@ configureDDCMonitorSection (int screennum)
parsePrologue (XF86ConfMonitorPtr, XF86ConfMonitorRec)
- ptr->mon_identifier = malloc(19);
- sprintf(ptr->mon_identifier, "Monitor%d", screennum);
+ XNFasprintf(&ptr->mon_identifier, "Monitor%d", screennum);
ptr->mon_vendor = strdup(ConfiguredMonitor->vendor.name);
- ptr->mon_modelname = malloc(12);
- sprintf(ptr->mon_modelname, "%x", ConfiguredMonitor->vendor.prod_id);
+ XNFasprintf(&ptr->mon_modelname, "%x", ConfiguredMonitor->vendor.prod_id);
/* features in centimetres, we want millimetres */
mon_width = 10 * ConfiguredMonitor->features.hsize ;
diff --git a/xorg-server/hw/xfree86/common/xf86Helper.c b/xorg-server/hw/xfree86/common/xf86Helper.c
index 9b6daaf41..8f61c4c72 100644
--- a/xorg-server/hw/xfree86/common/xf86Helper.c
+++ b/xorg-server/hw/xfree86/common/xf86Helper.c
@@ -1193,9 +1193,13 @@ xf86VIDrvMsgVerb(InputInfoPtr dev, MessageType type, int verb, const char *forma
{
char *msg;
- msg = Xprintf("%s: %s: %s", dev->drv->driverName, dev->name, format);
- LogVMessageVerb(type, verb, msg, args);
- free(msg);
+ if (asprintf(&msg, "%s: %s: %s", dev->drv->driverName, dev->name, format)
+ == -1) {
+ LogVMessageVerb(type, verb, "%s", args);
+ } else {
+ LogVMessageVerb(type, verb, msg, args);
+ free(msg);
+ }
}
/* Print input driver message, with verbose level specified directly */
@@ -1280,11 +1284,8 @@ xf86LogInit(void)
/* Get the log file name */
if (xf86LogFileFrom == X_DEFAULT) {
/* Append the display number and ".log" */
- lf = malloc(strlen(xf86LogFile) + strlen("%s") +
- strlen(LOGSUFFIX) + 1);
- if (!lf)
+ if (asprintf(&lf, "%s%%s" LOGSUFFIX, xf86LogFile) == -1)
FatalError("Cannot allocate space for the log file name\n");
- sprintf(lf, "%s%%s" LOGSUFFIX, xf86LogFile);
xf86LogFile = lf;
}
diff --git a/xorg-server/hw/xfree86/common/xf86Init.c b/xorg-server/hw/xfree86/common/xf86Init.c
index a6740e69f..f3ce3f696 100644
--- a/xorg-server/hw/xfree86/common/xf86Init.c
+++ b/xorg-server/hw/xfree86/common/xf86Init.c
@@ -536,8 +536,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
for (i = 0; i < xf86NumScreens; i++) {
if (xf86Screens[i]->name == NULL) {
- xf86Screens[i]->name = xnfalloc(strlen("screen") + 10 + 1);
- sprintf(xf86Screens[i]->name, "screen%d", i);
+ XNFasprintf(&xf86Screens[i]->name, "screen%d", i);
xf86MsgVerb(X_WARNING, 0,
"Screen driver %d has no name set, using `%s'.\n",
i, xf86Screens[i]->name);
diff --git a/xorg-server/hw/xfree86/common/xf86Option.c b/xorg-server/hw/xfree86/common/xf86Option.c
index 97deb1436..d7b294a86 100644
--- a/xorg-server/hw/xfree86/common/xf86Option.c
+++ b/xorg-server/hw/xfree86/common/xf86Option.c
@@ -638,13 +638,10 @@ ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p,
newn = n + 2;
} else {
free(n);
- n = malloc(strlen(p->name) + 2 + 1);
- if (!n) {
+ if (asprintf(&n, "No%s", p->name) == -1) {
p->found = FALSE;
return FALSE;
}
- strcpy(n, "No");
- strcat(n, p->name);
newn = n;
}
if ((s = xf86findOptionValue(options, newn)) != NULL) {
diff --git a/xorg-server/hw/xfree86/common/xf86ShowOpts.c b/xorg-server/hw/xfree86/common/xf86ShowOpts.c
index 831e6b787..7aa79eb6a 100644
--- a/xorg-server/hw/xfree86/common/xf86ShowOpts.c
+++ b/xorg-server/hw/xfree86/common/xf86ShowOpts.c
@@ -97,11 +97,8 @@ void DoShowOptions (void) {
);
continue;
}
- pSymbol = malloc(
- strlen(xf86DriverList[i]->driverName) + strlen("ModuleData") + 1
- );
- strcpy (pSymbol, xf86DriverList[i]->driverName);
- strcat (pSymbol, "ModuleData");
+ XNFasprintf(&pSymbol, "%sModuleData",
+ xf86DriverList[i]->driverName);
initData = LoaderSymbol (pSymbol);
if (initData) {
XF86ModuleVersionInfo *vers = initData->vers;
@@ -111,6 +108,9 @@ void DoShowOptions (void) {
);
for (p = pOption; p->name != NULL; p++) {
const char *opttype = optionTypeToSting(p->type);
+ /* XXX: Why overallocate by 2 bytes?
+ * Otherwise, this would be strdup()
+ */
char *optname = malloc(strlen(p->name) + 2 + 1);
if (!optname) {
continue;
diff --git a/xorg-server/hw/xfree86/common/xf86pciBus.c b/xorg-server/hw/xfree86/common/xf86pciBus.c
index aef7d277a..2f04ac12f 100644
--- a/xorg-server/hw/xfree86/common/xf86pciBus.c
+++ b/xorg-server/hw/xfree86/common/xf86pciBus.c
@@ -1347,9 +1347,9 @@ xf86PciConfigureNewDev(void *busData, struct pci_device *pVideo,
pVideo = (struct pci_device *) busData;
- GDev->busID = xnfalloc(16);
xf86FormatPciBusNumber(pVideo->bus, busnum);
- sprintf(GDev->busID, "PCI:%s:%d:%d", busnum, pVideo->dev, pVideo->func);
+ XNFasprintf(&GDev->busID, "PCI:%s:%d:%d",
+ busnum, pVideo->dev, pVideo->func);
GDev->chipID = pVideo->device_id;
GDev->chipRev = pVideo->revision;
diff --git a/xorg-server/hw/xfree86/common/xf86sbusBus.c b/xorg-server/hw/xfree86/common/xf86sbusBus.c
index f9244bca7..c0de88dda 100644
--- a/xorg-server/hw/xfree86/common/xf86sbusBus.c
+++ b/xorg-server/hw/xfree86/common/xf86sbusBus.c
@@ -706,11 +706,9 @@ xf86SbusConfigureNewDev(void *busData, sbusDevicePtr sBus, GDevRec *GDev)
sparcPromClose();
}
if (promPath) {
- GDev->busID = xnfalloc(strlen(promPath) + 6);
- sprintf(GDev->busID, "SBUS:%s", promPath);
+ XNFasprintf(&GDev->busID, "SBUS:%s", promPath);
free(promPath);
} else {
- GDev->busID = xnfalloc(12);
- sprintf(GDev->busID, "SBUS:fb%d", sBus->fbNum);
+ XNFsprintf(&GDev->busID, "SBUS:fb%d", sBus->fbNum);
}
}
diff --git a/xorg-server/hw/xfree86/dixmods/extmod/modinit.c b/xorg-server/hw/xfree86/dixmods/extmod/modinit.c
index c0c17d722..ee3e52855 100644
--- a/xorg-server/hw/xfree86/dixmods/extmod/modinit.c
+++ b/xorg-server/hw/xfree86/dixmods/extmod/modinit.c
@@ -146,11 +146,8 @@ extmodSetup(pointer module, pointer opts, int *errmaj, int *errmin)
for (i = 0; extensionModules[i].name != NULL; i++) {
if (opts) {
char *s;
- s = (char *)malloc(strlen(extensionModules[i].name) + 5);
- if (s) {
+ if (Xasprinf(&s, "omit%s", extensionModules[i].name) != -1) {
pointer o;
- strcpy(s, "omit");
- strcat(s, extensionModules[i].name);
o = xf86FindOption(opts, s);
free(s);
if (o) {
diff --git a/xorg-server/hw/xfree86/dri/dri.c b/xorg-server/hw/xfree86/dri/dri.c
index c2f81b1c6..9ca5ecd0b 100644
--- a/xorg-server/hw/xfree86/dri/dri.c
+++ b/xorg-server/hw/xfree86/dri/dri.c
@@ -2426,13 +2426,10 @@ DRICreatePCIBusID(const struct pci_device * dev)
{
char *busID;
- busID = malloc(20);
- if (busID == NULL)
+ if (asprintf(&busID, "pci:%04x:%02x:%02x.%d",
+ dev->domain, dev->bus, dev->dev, dev->func) == -1)
return NULL;
- snprintf(busID, 20, "pci:%04x:%02x:%02x.%d", dev->domain, dev->bus,
- dev->dev, dev->func);
-
return busID;
}
diff --git a/xorg-server/hw/xfree86/loader/loadmod.c b/xorg-server/hw/xfree86/loader/loadmod.c
index 6fcb06df2..dbc16eab7 100644
--- a/xorg-server/hw/xfree86/loader/loadmod.c
+++ b/xorg-server/hw/xfree86/loader/loadmod.c
@@ -406,22 +406,22 @@ FindModuleInSubdir(const char *dirpath, const char *module)
snprintf(tmpBuf, PATH_MAX, "lib%s.so", module);
if (strcmp(direntry->d_name, tmpBuf) == 0) {
- ret = malloc(strlen(tmpBuf) + strlen(dirpath) + 1);
- sprintf(ret, "%s%s", dirpath, tmpBuf);
+ if (asprintf(&ret, "%s%s", dirpath, tmpBuf) == -1)
+ ret = NULL;
break;
}
snprintf(tmpBuf, PATH_MAX, "%s_drv.so", module);
if (strcmp(direntry->d_name, tmpBuf) == 0) {
- ret = malloc(strlen(tmpBuf) + strlen(dirpath) + 1);
- sprintf(ret, "%s%s", dirpath, tmpBuf);
+ if (asprintf(&ret, "%s%s", dirpath, tmpBuf) == -1)
+ ret = NULL;
break;
}
snprintf(tmpBuf, PATH_MAX, "%s.so", module);
if (strcmp(direntry->d_name, tmpBuf) == 0) {
- ret = malloc(strlen(tmpBuf) + strlen(dirpath) + 1);
- sprintf(ret, "%s%s", dirpath, tmpBuf);
+ if (asprintf(&ret, "%s%s", dirpath, tmpBuf) == -1)
+ ret = NULL;
break;
}
}
@@ -933,16 +933,14 @@ doLoadModule(const char *module, const char *path, const char **subdirlist,
* now check if the special data object <modulename>ModuleData is
* present.
*/
- p = malloc(strlen(name) + strlen("ModuleData") + 1);
- if (!p) {
+ if (asprintf(&p, "%sModuleData", name) == -1) {
+ p = NULL;
if (errmaj)
*errmaj = LDR_NOMEM;
if (errmin)
*errmin = 0;
goto LoadModule_fail;
}
- strcpy(p, name);
- strcat(p, "ModuleData");
initdata = LoaderSymbol(p);
if (initdata) {
ModuleSetupProc setup;
diff --git a/xorg-server/hw/xfree86/loader/sdksyms.sh b/xorg-server/hw/xfree86/loader/sdksyms.sh
index d69ae769e..c25aaf010 100644
--- a/xorg-server/hw/xfree86/loader/sdksyms.sh
+++ b/xorg-server/hw/xfree86/loader/sdksyms.sh
@@ -253,6 +253,7 @@ cat > sdksyms.c << EOF
/* include/Makefile.am */
#include "XIstubs.h"
+#include "Xprintf.h"
#include "closestr.h"
#include "closure.h"
#include "colormap.h"
diff --git a/xorg-server/hw/xfree86/modes/xf86Crtc.c b/xorg-server/hw/xfree86/modes/xf86Crtc.c
index 99658e0ca..b08f57f34 100644
--- a/xorg-server/hw/xfree86/modes/xf86Crtc.c
+++ b/xorg-server/hw/xfree86/modes/xf86Crtc.c
@@ -510,7 +510,6 @@ static void
xf86OutputSetMonitor (xf86OutputPtr output)
{
char *option_name;
- static const char monitor_prefix[] = "monitor-";
char *monitor;
if (!output->name)
@@ -520,11 +519,8 @@ xf86OutputSetMonitor (xf86OutputPtr output)
output->options = xnfalloc (sizeof (xf86OutputOptions));
memcpy (output->options, xf86OutputOptions, sizeof (xf86OutputOptions));
-
- option_name = xnfalloc (strlen (monitor_prefix) +
- strlen (output->name) + 1);
- strcpy (option_name, monitor_prefix);
- strcat (option_name, output->name);
+
+ XNFasprintf(&option_name, "monitor-%s", output->name);
monitor = xf86findOptionValue (output->scrn->options, option_name);
if (!monitor)
monitor = output->name;
diff --git a/xorg-server/hw/xfree86/modes/xf86Modes.c b/xorg-server/hw/xfree86/modes/xf86Modes.c
index 6b34ec11c..335bb43ee 100644
--- a/xorg-server/hw/xfree86/modes/xf86Modes.c
+++ b/xorg-server/hw/xfree86/modes/xf86Modes.c
@@ -132,8 +132,8 @@ xf86SetModeDefaultName(DisplayModePtr mode)
free(mode->name);
- mode->name = XNFprintf("%dx%d%s", mode->HDisplay, mode->VDisplay,
- interlaced ? "i" : "");
+ XNFasprintf(&mode->name, "%dx%d%s", mode->HDisplay, mode->VDisplay,
+ interlaced ? "i" : "");
}
/*
diff --git a/xorg-server/hw/xfree86/modes/xf86cvt.c b/xorg-server/hw/xfree86/modes/xf86cvt.c
index 1da5fe50b..9992fa4c4 100644
--- a/xorg-server/hw/xfree86/modes/xf86cvt.c
+++ b/xorg-server/hw/xfree86/modes/xf86cvt.c
@@ -1,301 +1,293 @@
-/*
- * Copyright 2005-2006 Luc Verhaegen.
- *
- * 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
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice 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 MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) 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.
- */
-
-/*
- * The reason for having this function in a file of its own is
- * so that ../utils/cvt/cvt can link to it, and that xf86CVTMode
- * code is shared directly.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#else
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#endif
-
-#include "xf86.h"
-#include "xf86Modes.h"
-
-#include <string.h>
-
-/*
- * Generate a CVT standard mode from HDisplay, VDisplay and VRefresh.
- *
- * These calculations are stolen from the CVT calculation spreadsheet written
- * by Graham Loveridge. He seems to be claiming no copyright and there seems to
- * be no license attached to this. He apparently just wants to see his name
- * mentioned.
- *
- * This file can be found at http://www.vesa.org/Public/CVT/CVTd6r1.xls
- *
- * Comments and structure corresponds to the comments and structure of the xls.
- * This should ease importing of future changes to the standard (not very
- * likely though).
- *
- * About margins; i'm sure that they are to be the bit between HDisplay and
- * HBlankStart, HBlankEnd and HTotal, VDisplay and VBlankStart, VBlankEnd and
- * VTotal, where the overscan colour is shown. FB seems to call _all_ blanking
- * outside sync "margin" for some reason. Since we prefer seeing proper
- * blanking instead of the overscan colour, and since the Crtc* values will
- * probably get altered after us, we will disable margins altogether. With
- * these calculations, Margins will plainly expand H/VDisplay, and we don't
- * want that. -- libv
- *
- */
-DisplayModePtr
-xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
- Bool Interlaced)
-{
- DisplayModeRec *Mode = xnfcalloc(1, sizeof(DisplayModeRec));
-
- /* 1) top/bottom margin size (% of height) - default: 1.8 */
-#define CVT_MARGIN_PERCENTAGE 1.8
-
- /* 2) character cell horizontal granularity (pixels) - default 8 */
-#define CVT_H_GRANULARITY 8
-
- /* 4) Minimum vertical porch (lines) - default 3 */
-#define CVT_MIN_V_PORCH 3
-
- /* 4) Minimum number of vertical back porch lines - default 6 */
-#define CVT_MIN_V_BPORCH 6
-
- /* Pixel Clock step (kHz) */
-#define CVT_CLOCK_STEP 250
-
- Bool Margins = FALSE;
- float VFieldRate, HPeriod;
- int HDisplayRnd, HMargin;
- int VDisplayRnd, VMargin, VSync;
- float Interlace; /* Please rename this */
-
- /* CVT default is 60.0Hz */
- if (!VRefresh)
- VRefresh = 60.0;
-
- /* 1. Required field rate */
- if (Interlaced)
- VFieldRate = VRefresh * 2;
- else
- VFieldRate = VRefresh;
-
- /* 2. Horizontal pixels */
- HDisplayRnd = HDisplay - (HDisplay % CVT_H_GRANULARITY);
-
- /* 3. Determine left and right borders */
- if (Margins) {
- /* right margin is actually exactly the same as left */
- HMargin = (((float) HDisplayRnd) * CVT_MARGIN_PERCENTAGE / 100.0);
- HMargin -= HMargin % CVT_H_GRANULARITY;
- } else
- HMargin = 0;
-
- /* 4. Find total active pixels */
- Mode->HDisplay = HDisplayRnd + 2*HMargin;
-
- /* 5. Find number of lines per field */
- if (Interlaced)
- VDisplayRnd = VDisplay / 2;
- else
- VDisplayRnd = VDisplay;
-
- /* 6. Find top and bottom margins */
- /* nope. */
- if (Margins)
- /* top and bottom margins are equal again. */
- VMargin = (((float) VDisplayRnd) * CVT_MARGIN_PERCENTAGE / 100.0);
- else
- VMargin = 0;
-
- Mode->VDisplay = VDisplay + 2*VMargin;
-
- /* 7. Interlace */
- if (Interlaced)
- Interlace = 0.5;
- else
- Interlace = 0.0;
-
- /* Determine VSync Width from aspect ratio */
- if (!(VDisplay % 3) && ((VDisplay * 4 / 3) == HDisplay))
- VSync = 4;
- else if (!(VDisplay % 9) && ((VDisplay * 16 / 9) == HDisplay))
- VSync = 5;
- else if (!(VDisplay % 10) && ((VDisplay * 16 / 10) == HDisplay))
- VSync = 6;
- else if (!(VDisplay % 4) && ((VDisplay * 5 / 4) == HDisplay))
- VSync = 7;
- else if (!(VDisplay % 9) && ((VDisplay * 15 / 9) == HDisplay))
- VSync = 7;
- else /* Custom */
- VSync = 10;
-
- if (!Reduced) { /* simplified GTF calculation */
-
- /* 4) Minimum time of vertical sync + back porch interval (µs)
- * default 550.0 */
-#define CVT_MIN_VSYNC_BP 550.0
-
- /* 3) Nominal HSync width (% of line period) - default 8 */
-#define CVT_HSYNC_PERCENTAGE 8
-
- float HBlankPercentage;
- int VSyncAndBackPorch, VBackPorch;
- int HBlank;
-
- /* 8. Estimated Horizontal period */
- HPeriod = ((float) (1000000.0 / VFieldRate - CVT_MIN_VSYNC_BP)) /
- (VDisplayRnd + 2 * VMargin + CVT_MIN_V_PORCH + Interlace);
-
- /* 9. Find number of lines in sync + backporch */
- if (((int)(CVT_MIN_VSYNC_BP / HPeriod) + 1) < (VSync + CVT_MIN_V_PORCH))
- VSyncAndBackPorch = VSync + CVT_MIN_V_PORCH;
- else
- VSyncAndBackPorch = (int)(CVT_MIN_VSYNC_BP / HPeriod) + 1;
-
- /* 10. Find number of lines in back porch */
- VBackPorch = VSyncAndBackPorch - VSync;
-
- /* 11. Find total number of lines in vertical field */
- Mode->VTotal = VDisplayRnd + 2 * VMargin + VSyncAndBackPorch + Interlace
- + CVT_MIN_V_PORCH;
-
- /* 5) Definition of Horizontal blanking time limitation */
- /* Gradient (%/kHz) - default 600 */
-#define CVT_M_FACTOR 600
-
- /* Offset (%) - default 40 */
-#define CVT_C_FACTOR 40
-
- /* Blanking time scaling factor - default 128 */
-#define CVT_K_FACTOR 128
-
- /* Scaling factor weighting - default 20 */
-#define CVT_J_FACTOR 20
-
-#define CVT_M_PRIME CVT_M_FACTOR * CVT_K_FACTOR / 256
-#define CVT_C_PRIME (CVT_C_FACTOR - CVT_J_FACTOR) * CVT_K_FACTOR / 256 + \
- CVT_J_FACTOR
-
- /* 12. Find ideal blanking duty cycle from formula */
- HBlankPercentage = CVT_C_PRIME - CVT_M_PRIME * HPeriod/1000.0;
-
- /* 13. Blanking time */
- if (HBlankPercentage < 20)
- HBlankPercentage = 20;
-
- HBlank = Mode->HDisplay * HBlankPercentage/(100.0 - HBlankPercentage);
- HBlank -= HBlank % (2*CVT_H_GRANULARITY);
-
- /* 14. Find total number of pixels in a line. */
- Mode->HTotal = Mode->HDisplay + HBlank;
-
- /* Fill in HSync values */
- Mode->HSyncEnd = Mode->HDisplay + HBlank / 2;
-
- Mode->HSyncStart = Mode->HSyncEnd -
- (Mode->HTotal * CVT_HSYNC_PERCENTAGE) / 100;
- Mode->HSyncStart += CVT_H_GRANULARITY -
- Mode->HSyncStart % CVT_H_GRANULARITY;
-
- /* Fill in VSync values */
- Mode->VSyncStart = Mode->VDisplay + CVT_MIN_V_PORCH;
- Mode->VSyncEnd = Mode->VSyncStart + VSync;
-
- } else { /* Reduced blanking */
- /* Minimum vertical blanking interval time (µs) - default 460 */
-#define CVT_RB_MIN_VBLANK 460.0
-
- /* Fixed number of clocks for horizontal sync */
-#define CVT_RB_H_SYNC 32.0
-
- /* Fixed number of clocks for horizontal blanking */
-#define CVT_RB_H_BLANK 160.0
-
- /* Fixed number of lines for vertical front porch - default 3 */
-#define CVT_RB_VFPORCH 3
-
- int VBILines;
-
- /* 8. Estimate Horizontal period. */
- HPeriod = ((float) (1000000.0 / VFieldRate - CVT_RB_MIN_VBLANK)) /
- (VDisplayRnd + 2*VMargin);
-
- /* 9. Find number of lines in vertical blanking */
- VBILines = ((float) CVT_RB_MIN_VBLANK) / HPeriod + 1;
-
- /* 10. Check if vertical blanking is sufficient */
- if (VBILines < (CVT_RB_VFPORCH + VSync + CVT_MIN_V_BPORCH))
- VBILines = CVT_RB_VFPORCH + VSync + CVT_MIN_V_BPORCH;
-
- /* 11. Find total number of lines in vertical field */
- Mode->VTotal = VDisplayRnd + 2 * VMargin + Interlace + VBILines;
-
- /* 12. Find total number of pixels in a line */
- Mode->HTotal = Mode->HDisplay + CVT_RB_H_BLANK;
-
- /* Fill in HSync values */
- Mode->HSyncEnd = Mode->HDisplay + CVT_RB_H_BLANK / 2;
- Mode->HSyncStart = Mode->HSyncEnd - CVT_RB_H_SYNC;
-
- /* Fill in VSync values */
- Mode->VSyncStart = Mode->VDisplay + CVT_RB_VFPORCH;
- Mode->VSyncEnd = Mode->VSyncStart + VSync;
- }
-
- /* 15/13. Find pixel clock frequency (kHz for xf86) */
- Mode->Clock = Mode->HTotal * 1000.0 / HPeriod;
- Mode->Clock -= Mode->Clock % CVT_CLOCK_STEP;
-
- /* 16/14. Find actual Horizontal Frequency (kHz) */
- Mode->HSync = ((float) Mode->Clock) / ((float) Mode->HTotal);
-
- /* 17/15. Find actual Field rate */
- Mode->VRefresh = (1000.0 * ((float) Mode->Clock)) /
- ((float) (Mode->HTotal * Mode->VTotal));
-
- /* 18/16. Find actual vertical frame frequency */
- /* ignore - just set the mode flag for interlaced */
- if (Interlaced)
- Mode->VTotal *= 2;
-
- {
- char Name[256];
- Name[0] = 0;
-
- snprintf(Name, 256, "%dx%d", HDisplay, VDisplay);
-
- Mode->name = xnfalloc(strlen(Name) + 1);
- memcpy(Mode->name, Name, strlen(Name) + 1);
- }
-
- if (Reduced)
- Mode->Flags |= V_PHSYNC | V_NVSYNC;
- else
- Mode->Flags |= V_NHSYNC | V_PVSYNC;
-
- if (Interlaced)
- Mode->Flags |= V_INTERLACE;
-
- return Mode;
-}
+/*
+ * Copyright 2005-2006 Luc Verhaegen.
+ *
+ * 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
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice 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 MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) 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.
+ */
+
+/*
+ * The reason for having this function in a file of its own is
+ * so that ../utils/cvt/cvt can link to it, and that xf86CVTMode
+ * code is shared directly.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#else
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#endif
+
+#include "xf86.h"
+#include "xf86Modes.h"
+
+#include <string.h>
+
+/*
+ * Generate a CVT standard mode from HDisplay, VDisplay and VRefresh.
+ *
+ * These calculations are stolen from the CVT calculation spreadsheet written
+ * by Graham Loveridge. He seems to be claiming no copyright and there seems to
+ * be no license attached to this. He apparently just wants to see his name
+ * mentioned.
+ *
+ * This file can be found at http://www.vesa.org/Public/CVT/CVTd6r1.xls
+ *
+ * Comments and structure corresponds to the comments and structure of the xls.
+ * This should ease importing of future changes to the standard (not very
+ * likely though).
+ *
+ * About margins; i'm sure that they are to be the bit between HDisplay and
+ * HBlankStart, HBlankEnd and HTotal, VDisplay and VBlankStart, VBlankEnd and
+ * VTotal, where the overscan colour is shown. FB seems to call _all_ blanking
+ * outside sync "margin" for some reason. Since we prefer seeing proper
+ * blanking instead of the overscan colour, and since the Crtc* values will
+ * probably get altered after us, we will disable margins altogether. With
+ * these calculations, Margins will plainly expand H/VDisplay, and we don't
+ * want that. -- libv
+ *
+ */
+DisplayModePtr
+xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
+ Bool Interlaced)
+{
+ DisplayModeRec *Mode = xnfcalloc(1, sizeof(DisplayModeRec));
+
+ /* 1) top/bottom margin size (% of height) - default: 1.8 */
+#define CVT_MARGIN_PERCENTAGE 1.8
+
+ /* 2) character cell horizontal granularity (pixels) - default 8 */
+#define CVT_H_GRANULARITY 8
+
+ /* 4) Minimum vertical porch (lines) - default 3 */
+#define CVT_MIN_V_PORCH 3
+
+ /* 4) Minimum number of vertical back porch lines - default 6 */
+#define CVT_MIN_V_BPORCH 6
+
+ /* Pixel Clock step (kHz) */
+#define CVT_CLOCK_STEP 250
+
+ Bool Margins = FALSE;
+ float VFieldRate, HPeriod;
+ int HDisplayRnd, HMargin;
+ int VDisplayRnd, VMargin, VSync;
+ float Interlace; /* Please rename this */
+
+ /* CVT default is 60.0Hz */
+ if (!VRefresh)
+ VRefresh = 60.0;
+
+ /* 1. Required field rate */
+ if (Interlaced)
+ VFieldRate = VRefresh * 2;
+ else
+ VFieldRate = VRefresh;
+
+ /* 2. Horizontal pixels */
+ HDisplayRnd = HDisplay - (HDisplay % CVT_H_GRANULARITY);
+
+ /* 3. Determine left and right borders */
+ if (Margins) {
+ /* right margin is actually exactly the same as left */
+ HMargin = (((float) HDisplayRnd) * CVT_MARGIN_PERCENTAGE / 100.0);
+ HMargin -= HMargin % CVT_H_GRANULARITY;
+ } else
+ HMargin = 0;
+
+ /* 4. Find total active pixels */
+ Mode->HDisplay = HDisplayRnd + 2*HMargin;
+
+ /* 5. Find number of lines per field */
+ if (Interlaced)
+ VDisplayRnd = VDisplay / 2;
+ else
+ VDisplayRnd = VDisplay;
+
+ /* 6. Find top and bottom margins */
+ /* nope. */
+ if (Margins)
+ /* top and bottom margins are equal again. */
+ VMargin = (((float) VDisplayRnd) * CVT_MARGIN_PERCENTAGE / 100.0);
+ else
+ VMargin = 0;
+
+ Mode->VDisplay = VDisplay + 2*VMargin;
+
+ /* 7. Interlace */
+ if (Interlaced)
+ Interlace = 0.5;
+ else
+ Interlace = 0.0;
+
+ /* Determine VSync Width from aspect ratio */
+ if (!(VDisplay % 3) && ((VDisplay * 4 / 3) == HDisplay))
+ VSync = 4;
+ else if (!(VDisplay % 9) && ((VDisplay * 16 / 9) == HDisplay))
+ VSync = 5;
+ else if (!(VDisplay % 10) && ((VDisplay * 16 / 10) == HDisplay))
+ VSync = 6;
+ else if (!(VDisplay % 4) && ((VDisplay * 5 / 4) == HDisplay))
+ VSync = 7;
+ else if (!(VDisplay % 9) && ((VDisplay * 15 / 9) == HDisplay))
+ VSync = 7;
+ else /* Custom */
+ VSync = 10;
+
+ if (!Reduced) { /* simplified GTF calculation */
+
+ /* 4) Minimum time of vertical sync + back porch interval (µs)
+ * default 550.0 */
+#define CVT_MIN_VSYNC_BP 550.0
+
+ /* 3) Nominal HSync width (% of line period) - default 8 */
+#define CVT_HSYNC_PERCENTAGE 8
+
+ float HBlankPercentage;
+ int VSyncAndBackPorch, VBackPorch;
+ int HBlank;
+
+ /* 8. Estimated Horizontal period */
+ HPeriod = ((float) (1000000.0 / VFieldRate - CVT_MIN_VSYNC_BP)) /
+ (VDisplayRnd + 2 * VMargin + CVT_MIN_V_PORCH + Interlace);
+
+ /* 9. Find number of lines in sync + backporch */
+ if (((int)(CVT_MIN_VSYNC_BP / HPeriod) + 1) < (VSync + CVT_MIN_V_PORCH))
+ VSyncAndBackPorch = VSync + CVT_MIN_V_PORCH;
+ else
+ VSyncAndBackPorch = (int)(CVT_MIN_VSYNC_BP / HPeriod) + 1;
+
+ /* 10. Find number of lines in back porch */
+ VBackPorch = VSyncAndBackPorch - VSync;
+
+ /* 11. Find total number of lines in vertical field */
+ Mode->VTotal = VDisplayRnd + 2 * VMargin + VSyncAndBackPorch + Interlace
+ + CVT_MIN_V_PORCH;
+
+ /* 5) Definition of Horizontal blanking time limitation */
+ /* Gradient (%/kHz) - default 600 */
+#define CVT_M_FACTOR 600
+
+ /* Offset (%) - default 40 */
+#define CVT_C_FACTOR 40
+
+ /* Blanking time scaling factor - default 128 */
+#define CVT_K_FACTOR 128
+
+ /* Scaling factor weighting - default 20 */
+#define CVT_J_FACTOR 20
+
+#define CVT_M_PRIME CVT_M_FACTOR * CVT_K_FACTOR / 256
+#define CVT_C_PRIME (CVT_C_FACTOR - CVT_J_FACTOR) * CVT_K_FACTOR / 256 + \
+ CVT_J_FACTOR
+
+ /* 12. Find ideal blanking duty cycle from formula */
+ HBlankPercentage = CVT_C_PRIME - CVT_M_PRIME * HPeriod/1000.0;
+
+ /* 13. Blanking time */
+ if (HBlankPercentage < 20)
+ HBlankPercentage = 20;
+
+ HBlank = Mode->HDisplay * HBlankPercentage/(100.0 - HBlankPercentage);
+ HBlank -= HBlank % (2*CVT_H_GRANULARITY);
+
+ /* 14. Find total number of pixels in a line. */
+ Mode->HTotal = Mode->HDisplay + HBlank;
+
+ /* Fill in HSync values */
+ Mode->HSyncEnd = Mode->HDisplay + HBlank / 2;
+
+ Mode->HSyncStart = Mode->HSyncEnd -
+ (Mode->HTotal * CVT_HSYNC_PERCENTAGE) / 100;
+ Mode->HSyncStart += CVT_H_GRANULARITY -
+ Mode->HSyncStart % CVT_H_GRANULARITY;
+
+ /* Fill in VSync values */
+ Mode->VSyncStart = Mode->VDisplay + CVT_MIN_V_PORCH;
+ Mode->VSyncEnd = Mode->VSyncStart + VSync;
+
+ } else { /* Reduced blanking */
+ /* Minimum vertical blanking interval time (µs) - default 460 */
+#define CVT_RB_MIN_VBLANK 460.0
+
+ /* Fixed number of clocks for horizontal sync */
+#define CVT_RB_H_SYNC 32.0
+
+ /* Fixed number of clocks for horizontal blanking */
+#define CVT_RB_H_BLANK 160.0
+
+ /* Fixed number of lines for vertical front porch - default 3 */
+#define CVT_RB_VFPORCH 3
+
+ int VBILines;
+
+ /* 8. Estimate Horizontal period. */
+ HPeriod = ((float) (1000000.0 / VFieldRate - CVT_RB_MIN_VBLANK)) /
+ (VDisplayRnd + 2*VMargin);
+
+ /* 9. Find number of lines in vertical blanking */
+ VBILines = ((float) CVT_RB_MIN_VBLANK) / HPeriod + 1;
+
+ /* 10. Check if vertical blanking is sufficient */
+ if (VBILines < (CVT_RB_VFPORCH + VSync + CVT_MIN_V_BPORCH))
+ VBILines = CVT_RB_VFPORCH + VSync + CVT_MIN_V_BPORCH;
+
+ /* 11. Find total number of lines in vertical field */
+ Mode->VTotal = VDisplayRnd + 2 * VMargin + Interlace + VBILines;
+
+ /* 12. Find total number of pixels in a line */
+ Mode->HTotal = Mode->HDisplay + CVT_RB_H_BLANK;
+
+ /* Fill in HSync values */
+ Mode->HSyncEnd = Mode->HDisplay + CVT_RB_H_BLANK / 2;
+ Mode->HSyncStart = Mode->HSyncEnd - CVT_RB_H_SYNC;
+
+ /* Fill in VSync values */
+ Mode->VSyncStart = Mode->VDisplay + CVT_RB_VFPORCH;
+ Mode->VSyncEnd = Mode->VSyncStart + VSync;
+ }
+
+ /* 15/13. Find pixel clock frequency (kHz for xf86) */
+ Mode->Clock = Mode->HTotal * 1000.0 / HPeriod;
+ Mode->Clock -= Mode->Clock % CVT_CLOCK_STEP;
+
+ /* 16/14. Find actual Horizontal Frequency (kHz) */
+ Mode->HSync = ((float) Mode->Clock) / ((float) Mode->HTotal);
+
+ /* 17/15. Find actual Field rate */
+ Mode->VRefresh = (1000.0 * ((float) Mode->Clock)) /
+ ((float) (Mode->HTotal * Mode->VTotal));
+
+ /* 18/16. Find actual vertical frame frequency */
+ /* ignore - just set the mode flag for interlaced */
+ if (Interlaced)
+ Mode->VTotal *= 2;
+
+ XNFasprintf(&Mode->name, "%dx%d", HDisplay, VDisplay);
+
+ if (Reduced)
+ Mode->Flags |= V_PHSYNC | V_NVSYNC;
+ else
+ Mode->Flags |= V_NHSYNC | V_PVSYNC;
+
+ if (Interlaced)
+ Mode->Flags |= V_INTERLACE;
+
+ return Mode;
+}
diff --git a/xorg-server/hw/xfree86/os-support/solaris/solaris-amd64.S b/xorg-server/hw/xfree86/os-support/solaris/solaris-amd64.S
index 94ffa40e7..a371f9b66 100644
--- a/xorg-server/hw/xfree86/os-support/solaris/solaris-amd64.S
+++ b/xorg-server/hw/xfree86/os-support/solaris/solaris-amd64.S
@@ -1,67 +1,67 @@
-/ Copyright 2005 Sun Microsystems, Inc. All rights reserved.
-/
-/ 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
-/ the rights to use, copy, modify, merge, publish, distribute, sublicense,
-/ and/or sell copies of the Software, and to permit persons to whom the
-/ 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 MERCHANTABILITY,
-/ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-/ THE AUTHORS OR COPYRIGHT HOLDERS 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.
-
-#ifdef INLINE_ASM
-#define FUNCTION_START(f,n) .inline f,n
-#define FUNCTION_END(f) .end
-#else
-#define _ASM
-#include <sys/asm_linkage.h>
-#define FUNCTION_START(f,n) ENTRY(f)
-#define FUNCTION_END(f) ret; SET_SIZE(f)
-#endif
-
- FUNCTION_START(inb,4)
- movq %rdi, %rdx
- xorq %rax, %rax
- inb (%dx)
- FUNCTION_END(inb)
-
- FUNCTION_START(inw,4)
- movq %rdi, %rdx
- xorq %rax, %rax
- inw (%dx)
- FUNCTION_END(inw)
-
- FUNCTION_START(inl,4)
- movq %rdi, %rdx
- xorq %rax, %rax
- inl (%dx)
- FUNCTION_END(inl)
-
- FUNCTION_START(outb,8)
- movq %rdi, %rdx
- movq %rsi, %rax
- outb (%dx)
- FUNCTION_END(outb)
-
- FUNCTION_START(outw,8)
- movq %rdi, %rdx
- movq %rsi, %rax
- outw (%dx)
- FUNCTION_END(outw)
-
- FUNCTION_START(outl,8)
- movq %rdi, %rdx
- movq %rsi, %rax
- outl (%dx)
- FUNCTION_END(outl)
-
+/ Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+/
+/ 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
+/ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+/ and/or sell copies of the Software, and to permit persons to whom the
+/ 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 MERCHANTABILITY,
+/ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+/ THE AUTHORS OR COPYRIGHT HOLDERS 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.
+
+#ifdef INLINE_ASM
+#define FUNCTION_START(f,n) .inline f,n
+#define FUNCTION_END(f) .end
+#else
+#define _ASM
+#include <sys/asm_linkage.h>
+#define FUNCTION_START(f,n) ENTRY(f)
+#define FUNCTION_END(f) ret; SET_SIZE(f)
+#endif
+
+ FUNCTION_START(inb,4)
+ movq %rdi, %rdx
+ xorq %rax, %rax
+ inb (%dx)
+ FUNCTION_END(inb)
+
+ FUNCTION_START(inw,4)
+ movq %rdi, %rdx
+ xorq %rax, %rax
+ inw (%dx)
+ FUNCTION_END(inw)
+
+ FUNCTION_START(inl,4)
+ movq %rdi, %rdx
+ xorq %rax, %rax
+ inl (%dx)
+ FUNCTION_END(inl)
+
+ FUNCTION_START(outb,8)
+ movq %rdi, %rdx
+ movq %rsi, %rax
+ outb (%dx)
+ FUNCTION_END(outb)
+
+ FUNCTION_START(outw,8)
+ movq %rdi, %rdx
+ movq %rsi, %rax
+ outw (%dx)
+ FUNCTION_END(outw)
+
+ FUNCTION_START(outl,8)
+ movq %rdi, %rdx
+ movq %rsi, %rax
+ outl (%dx)
+ FUNCTION_END(outl)
+
diff --git a/xorg-server/hw/xfree86/os-support/solaris/solaris-ia32.S b/xorg-server/hw/xfree86/os-support/solaris/solaris-ia32.S
index 4dadf7ffd..0068b06e4 100644
--- a/xorg-server/hw/xfree86/os-support/solaris/solaris-ia32.S
+++ b/xorg-server/hw/xfree86/os-support/solaris/solaris-ia32.S
@@ -1,67 +1,67 @@
-/ Copyright 2004 Sun Microsystems, Inc. All rights reserved.
-/
-/ 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
-/ the rights to use, copy, modify, merge, publish, distribute, sublicense,
-/ and/or sell copies of the Software, and to permit persons to whom the
-/ 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 MERCHANTABILITY,
-/ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-/ THE AUTHORS OR COPYRIGHT HOLDERS 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.
-
-#ifdef INLINE_ASM
-#define FUNCTION_START(f,n) .inline f,n
-#define FUNCTION_END(f) .end
-#else
-#define _ASM
-#include <sys/asm_linkage.h>
-#define FUNCTION_START(f,n) ENTRY(f)
-#define FUNCTION_END(f) ret; SET_SIZE(f)
-#endif
-
- FUNCTION_START(inb,4)
- movl (%esp), %edx
- xorl %eax, %eax
- inb (%dx)
- FUNCTION_END(inb)
-
- FUNCTION_START(inw,4)
- movl (%esp), %edx
- xorl %eax, %eax
- inw (%dx)
- FUNCTION_END(inw)
-
- FUNCTION_START(inl,4)
- movl (%esp), %edx
- xorl %eax, %eax
- inl (%dx)
- FUNCTION_END(inl)
-
- FUNCTION_START(outb,8)
- movl (%esp), %edx
- movl 4(%esp), %eax
- outb (%dx)
- FUNCTION_END(outb)
-
- FUNCTION_START(outw,8)
- movl (%esp), %edx
- movl 4(%esp), %eax
- outw (%dx)
- FUNCTION_END(outw)
-
- FUNCTION_START(outl,8)
- movl (%esp), %edx
- movl 4(%esp), %eax
- outl (%dx)
- FUNCTION_END(outl)
-
+/ Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+/
+/ 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
+/ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+/ and/or sell copies of the Software, and to permit persons to whom the
+/ 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 MERCHANTABILITY,
+/ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+/ THE AUTHORS OR COPYRIGHT HOLDERS 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.
+
+#ifdef INLINE_ASM
+#define FUNCTION_START(f,n) .inline f,n
+#define FUNCTION_END(f) .end
+#else
+#define _ASM
+#include <sys/asm_linkage.h>
+#define FUNCTION_START(f,n) ENTRY(f)
+#define FUNCTION_END(f) ret; SET_SIZE(f)
+#endif
+
+ FUNCTION_START(inb,4)
+ movl (%esp), %edx
+ xorl %eax, %eax
+ inb (%dx)
+ FUNCTION_END(inb)
+
+ FUNCTION_START(inw,4)
+ movl (%esp), %edx
+ xorl %eax, %eax
+ inw (%dx)
+ FUNCTION_END(inw)
+
+ FUNCTION_START(inl,4)
+ movl (%esp), %edx
+ xorl %eax, %eax
+ inl (%dx)
+ FUNCTION_END(inl)
+
+ FUNCTION_START(outb,8)
+ movl (%esp), %edx
+ movl 4(%esp), %eax
+ outb (%dx)
+ FUNCTION_END(outb)
+
+ FUNCTION_START(outw,8)
+ movl (%esp), %edx
+ movl 4(%esp), %eax
+ outw (%dx)
+ FUNCTION_END(outw)
+
+ FUNCTION_START(outl,8)
+ movl (%esp), %edx
+ movl 4(%esp), %eax
+ outl (%dx)
+ FUNCTION_END(outl)
+
diff --git a/xorg-server/hw/xfree86/os-support/solaris/solaris-sparcv8plus.S b/xorg-server/hw/xfree86/os-support/solaris/solaris-sparcv8plus.S
index 0f6d694fd..3bb8d241c 100644
--- a/xorg-server/hw/xfree86/os-support/solaris/solaris-sparcv8plus.S
+++ b/xorg-server/hw/xfree86/os-support/solaris/solaris-sparcv8plus.S
@@ -1,138 +1,138 @@
-/* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- *
- * 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
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * 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 MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS 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.
- */
-
-#ifdef INLINE_ASM
-#define FUNCTION_START(f,n) .inline f,n
-#define FUNCTION_END(f) .end
-#else
-#define _ASM
-#include <sys/asm_linkage.h>
-#define FUNCTION_START(f,n) ENTRY(f)
-#define FUNCTION_END(f) retl; nop; SET_SIZE(f)
-#endif
-
-/* Converted from common/compiler.h gcc inline format to Sun cc inline
- * format by Kenjiro Tsuji
- *
- * The value 0x88 means ASI_PRIMARY_LITTLE.
- * The store or load to/from the address space will be done
- * as little-endian. In the original xrog code, the value
- * is defined as the macro ASI_PL.
- *
- * In the original xorg code, "membar #StoreStore|#StoreLoad"
- * is directly implemented as an instruction "0x8143e00a".
- *
- */
-
- FUNCTION_START(outb, 0)
- stba %o1, [%o0] 0x88
- membar #StoreStore|#StoreLoad
- FUNCTION_END(outb)
-
- FUNCTION_START(outw, 0)
- stha %o1, [%o0] 0x88
- membar #StoreStore|#StoreLoad
- FUNCTION_END(outw)
-
- FUNCTION_START(outl, 0)
- sta %o1, [%o0] 0x88
- membar #StoreStore|#StoreLoad
- FUNCTION_END(outl)
-
- FUNCTION_START(inb, 0)
- lduba [%o0] 0x88, %o0
- FUNCTION_END(inb)
-
- FUNCTION_START(inw, 0)
- lduha [%o0] 0x88, %o0
- FUNCTION_END(inw)
-
- FUNCTION_START(inl, 0)
- lda [%o0] 0x88, %o0
- FUNCTION_END(inl)
-
- FUNCTION_START(xf86ReadMmio8, 0)
- lduba [%o0 + %o1] 0x88, %o0
- FUNCTION_END(xf86ReadMmio8)
-
- FUNCTION_START(xf86ReadMmio16Be, 0)
- lduh [%o0 + %o1], %o0
- FUNCTION_END(xf86ReadMmio16Be)
-
- FUNCTION_START(xf86ReadMmio16Le, 0)
- lduha [%o0 + %o1] 0x88, %o0
- FUNCTION_END(xf86ReadMmio16Le)
-
- FUNCTION_START(xf86ReadMmio32Be, 0)
- ld [%o0 + %o1], %o0
- FUNCTION_END(xf86ReadMmio32Be)
-
- FUNCTION_START(xf86ReadMmio32Le, 0)
- lda [%o0 + %o1] 0x88, %o0
- FUNCTION_END(xf86ReadMmio32Le)
-
- FUNCTION_START(xf86WriteMmio8, 0)
- stba %o2, [%o0 + %o1] 0x88
- membar #StoreStore|#StoreLoad
- FUNCTION_END(xf86WriteMmio8)
-
- FUNCTION_START(xf86WriteMmio16Be, 0)
- sth %o2, [%o0 + %o1]
- membar #StoreStore|#StoreLoad
- FUNCTION_END(xf86WriteMmio16Be)
-
- FUNCTION_START(xf86WriteMmio16Le, 0)
- stha %o2, [%o0 + %o1] 0x88
- membar #StoreStore|#StoreLoad
- FUNCTION_END(xf86WriteMmio16Le)
-
- FUNCTION_START(xf86WriteMmio32Be, 0)
- st %o2, [%o0 + %o1]
- membar #StoreStore|#StoreLoad
- FUNCTION_END(xf86WriteMmio32Be)
-
- FUNCTION_START(xf86WriteMmio32Le, 0)
- sta %o2, [%o0 + %o1] 0x88
- membar #StoreStore|#StoreLoad
- FUNCTION_END(xf86WriteMmio32Le)
-
- FUNCTION_START(xf86WriteMmio8NB, 0)
- add %o0, %o1, %o0
- stba %o2, [%o0] 0x88
- FUNCTION_END(xf86WriteMmio8NB)
-
- FUNCTION_START(xf86WriteMmio16BeNB, 0)
- sth %o2, [%o0 + %o1]
- FUNCTION_END(xf86WriteMmio16BeNB)
-
- FUNCTION_START(xf86WriteMmio16LeNB, 0)
- stha %o2, [%o0 + %o1] 0x88
- FUNCTION_END(xf86WriteMmio16LeNB)
-
- FUNCTION_START(xf86WriteMmio32BeNB, 0)
- st %o2, [%o0 + %o1]
- FUNCTION_END(xf86WriteMmio32BeNB)
-
- FUNCTION_START(xf86WriteMmio32LeNB, 0)
- sta %o2, [%o0 + %o1] 0x88
- FUNCTION_END(xf86WriteMmio32LeNB)
-
+/* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ *
+ * 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
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * 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 MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ */
+
+#ifdef INLINE_ASM
+#define FUNCTION_START(f,n) .inline f,n
+#define FUNCTION_END(f) .end
+#else
+#define _ASM
+#include <sys/asm_linkage.h>
+#define FUNCTION_START(f,n) ENTRY(f)
+#define FUNCTION_END(f) retl; nop; SET_SIZE(f)
+#endif
+
+/* Converted from common/compiler.h gcc inline format to Sun cc inline
+ * format by Kenjiro Tsuji
+ *
+ * The value 0x88 means ASI_PRIMARY_LITTLE.
+ * The store or load to/from the address space will be done
+ * as little-endian. In the original xrog code, the value
+ * is defined as the macro ASI_PL.
+ *
+ * In the original xorg code, "membar #StoreStore|#StoreLoad"
+ * is directly implemented as an instruction "0x8143e00a".
+ *
+ */
+
+ FUNCTION_START(outb, 0)
+ stba %o1, [%o0] 0x88
+ membar #StoreStore|#StoreLoad
+ FUNCTION_END(outb)
+
+ FUNCTION_START(outw, 0)
+ stha %o1, [%o0] 0x88
+ membar #StoreStore|#StoreLoad
+ FUNCTION_END(outw)
+
+ FUNCTION_START(outl, 0)
+ sta %o1, [%o0] 0x88
+ membar #StoreStore|#StoreLoad
+ FUNCTION_END(outl)
+
+ FUNCTION_START(inb, 0)
+ lduba [%o0] 0x88, %o0
+ FUNCTION_END(inb)
+
+ FUNCTION_START(inw, 0)
+ lduha [%o0] 0x88, %o0
+ FUNCTION_END(inw)
+
+ FUNCTION_START(inl, 0)
+ lda [%o0] 0x88, %o0
+ FUNCTION_END(inl)
+
+ FUNCTION_START(xf86ReadMmio8, 0)
+ lduba [%o0 + %o1] 0x88, %o0
+ FUNCTION_END(xf86ReadMmio8)
+
+ FUNCTION_START(xf86ReadMmio16Be, 0)
+ lduh [%o0 + %o1], %o0
+ FUNCTION_END(xf86ReadMmio16Be)
+
+ FUNCTION_START(xf86ReadMmio16Le, 0)
+ lduha [%o0 + %o1] 0x88, %o0
+ FUNCTION_END(xf86ReadMmio16Le)
+
+ FUNCTION_START(xf86ReadMmio32Be, 0)
+ ld [%o0 + %o1], %o0
+ FUNCTION_END(xf86ReadMmio32Be)
+
+ FUNCTION_START(xf86ReadMmio32Le, 0)
+ lda [%o0 + %o1] 0x88, %o0
+ FUNCTION_END(xf86ReadMmio32Le)
+
+ FUNCTION_START(xf86WriteMmio8, 0)
+ stba %o2, [%o0 + %o1] 0x88
+ membar #StoreStore|#StoreLoad
+ FUNCTION_END(xf86WriteMmio8)
+
+ FUNCTION_START(xf86WriteMmio16Be, 0)
+ sth %o2, [%o0 + %o1]
+ membar #StoreStore|#StoreLoad
+ FUNCTION_END(xf86WriteMmio16Be)
+
+ FUNCTION_START(xf86WriteMmio16Le, 0)
+ stha %o2, [%o0 + %o1] 0x88
+ membar #StoreStore|#StoreLoad
+ FUNCTION_END(xf86WriteMmio16Le)
+
+ FUNCTION_START(xf86WriteMmio32Be, 0)
+ st %o2, [%o0 + %o1]
+ membar #StoreStore|#StoreLoad
+ FUNCTION_END(xf86WriteMmio32Be)
+
+ FUNCTION_START(xf86WriteMmio32Le, 0)
+ sta %o2, [%o0 + %o1] 0x88
+ membar #StoreStore|#StoreLoad
+ FUNCTION_END(xf86WriteMmio32Le)
+
+ FUNCTION_START(xf86WriteMmio8NB, 0)
+ add %o0, %o1, %o0
+ stba %o2, [%o0] 0x88
+ FUNCTION_END(xf86WriteMmio8NB)
+
+ FUNCTION_START(xf86WriteMmio16BeNB, 0)
+ sth %o2, [%o0 + %o1]
+ FUNCTION_END(xf86WriteMmio16BeNB)
+
+ FUNCTION_START(xf86WriteMmio16LeNB, 0)
+ stha %o2, [%o0 + %o1] 0x88
+ FUNCTION_END(xf86WriteMmio16LeNB)
+
+ FUNCTION_START(xf86WriteMmio32BeNB, 0)
+ st %o2, [%o0 + %o1]
+ FUNCTION_END(xf86WriteMmio32BeNB)
+
+ FUNCTION_START(xf86WriteMmio32LeNB, 0)
+ sta %o2, [%o0 + %o1] 0x88
+ FUNCTION_END(xf86WriteMmio32LeNB)
+
diff --git a/xorg-server/hw/xfree86/os-support/solaris/sun_VTsw.c b/xorg-server/hw/xfree86/os-support/solaris/sun_VTsw.c
index e297f8c49..d145ac77b 100644
--- a/xorg-server/hw/xfree86/os-support/solaris/sun_VTsw.c
+++ b/xorg-server/hw/xfree86/os-support/solaris/sun_VTsw.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
diff --git a/xorg-server/hw/xfree86/os-support/solaris/sun_agp.c b/xorg-server/hw/xfree86/os-support/solaris/sun_agp.c
index 99c3abde5..8c5c45843 100644
--- a/xorg-server/hw/xfree86/os-support/solaris/sun_agp.c
+++ b/xorg-server/hw/xfree86/os-support/solaris/sun_agp.c
@@ -6,7 +6,7 @@
* Copyright © 2000 VA Linux Systems, Inc.
* Copyright © 2001 The XFree86 Project, Inc.
*/
-/* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+/* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
diff --git a/xorg-server/hw/xfree86/os-support/solaris/sun_apm.c b/xorg-server/hw/xfree86/os-support/solaris/sun_apm.c
index 23e14f17e..7a5128ffb 100644
--- a/xorg-server/hw/xfree86/os-support/solaris/sun_apm.c
+++ b/xorg-server/hw/xfree86/os-support/solaris/sun_apm.c
@@ -1,226 +1,226 @@
-/* Based on hw/xfree86/os-support/bsd/bsd_apm.c which bore no explicit
- * copyright notice, so is covered by the following notice:
- *
- * Copyright (C) 1994-2003 The XFree86 Project, Inc. All Rights Reserved.
- *
- * 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
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice 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 MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE XFREE86 PROJECT 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.
- *
- * Except as contained in this notice, the name of the XFree86 Project shall
- * not be used in advertising or otherwise to promote the sale, use or other
- * dealings in this Software without prior written authorization from the
- * XFree86 Project.
- */
-
-/* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- *
- * 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
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * 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 MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS 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.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include "os.h"
-#include "xf86.h"
-#include "xf86Priv.h"
-#define XF86_OS_PRIVS
-#include "xf86_OSproc.h"
-#include "xf86_OSlib.h"
-
-#ifndef PLEASE_FIX_THIS
-#define APM_STANDBY_REQ 0xa01
-#define APM_SUSPEND_REQ 0xa02
-#define APM_NORMAL_RESUME 0xa03
-#define APM_CRIT_RESUME 0xa04
-#define APM_BATTERY_LOW 0xa05
-#define APM_POWER_CHANGE 0xa06
-#define APM_UPDATE_TIME 0xa07
-#define APM_CRIT_SUSPEND_REQ 0xa08
-#define APM_USER_STANDBY_REQ 0xa09
-#define APM_USER_SUSPEND_REQ 0xa0a
-#define APM_SYS_STANDBY_RESUME 0xa0b
-#define APM_IOC_NEXTEVENT 0xa0c
-#define APM_IOC_RESUME 0xa0d
-#define APM_IOC_SUSPEND 0xa0e
-#define APM_IOC_STANDBY 0xa0f
-#endif
-
-typedef struct apm_event_info
-{
- int type;
-} apm_event_info;
-
-/*
- This may be replaced with a better device name
- very soon...
-*/
-#define APM_DEVICE "/dev/srn"
-#define APM_DEVICE1 "/dev/apm"
-
-static pointer APMihPtr = NULL;
-static void sunCloseAPM(void);
-
-static struct {
- u_int apmBsd;
- pmEvent xf86;
-} sunToXF86Array [] = {
- { APM_STANDBY_REQ, XF86_APM_SYS_STANDBY },
- { APM_SUSPEND_REQ, XF86_APM_SYS_SUSPEND },
- { APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME },
- { APM_CRIT_RESUME, XF86_APM_CRITICAL_RESUME },
- { APM_BATTERY_LOW, XF86_APM_LOW_BATTERY },
- { APM_POWER_CHANGE, XF86_APM_POWER_STATUS_CHANGE },
- { APM_UPDATE_TIME, XF86_APM_UPDATE_TIME },
- { APM_CRIT_SUSPEND_REQ, XF86_APM_CRITICAL_SUSPEND },
- { APM_USER_STANDBY_REQ, XF86_APM_USER_STANDBY },
- { APM_USER_SUSPEND_REQ, XF86_APM_USER_SUSPEND },
- { APM_SYS_STANDBY_RESUME, XF86_APM_STANDBY_RESUME },
-#ifdef APM_CAPABILITY_CHANGE
- { APM_CAPABILITY_CHANGE, XF86_APM_CAPABILITY_CHANGED },
-#endif
-};
-
-#define numApmEvents (sizeof(sunToXF86Array) / sizeof(sunToXF86Array[0]))
-
-static pmEvent
-sunToXF86(int type)
-{
- int i;
-
- for (i = 0; i < numApmEvents; i++) {
- if (type == sunToXF86Array[i].apmBsd) {
- return sunToXF86Array[i].xf86;
- }
- }
- return XF86_APM_UNKNOWN;
-}
-
-/*
- * APM events can be requested direclty from /dev/apm
- */
-static int
-sunPMGetEventFromOS(int fd, pmEvent *events, int num)
-{
- struct apm_event_info sunEvent;
- int i;
-
- for (i = 0; i < num; i++) {
-
- if (ioctl(fd, APM_IOC_NEXTEVENT, &sunEvent) < 0) {
- if (errno != EAGAIN) {
- xf86Msg(X_WARNING, "sunPMGetEventFromOS: APM_IOC_NEXTEVENT"
- " %s\n", strerror(errno));
- }
- break;
- }
- events[i] = sunToXF86(sunEvent.type);
- }
- xf86Msg(X_WARNING, "Got some events\n");
- return i;
-}
-
-static pmWait
-sunPMConfirmEventToOs(int fd, pmEvent event)
-{
- switch (event) {
-/* XXX: NOT CURRENTLY RETURNED FROM OS */
- case XF86_APM_SYS_STANDBY:
- case XF86_APM_USER_STANDBY:
- if (ioctl( fd, APM_IOC_STANDBY, NULL ) == 0)
- return PM_WAIT; /* should we stop the Xserver in standby, too? */
- else
- return PM_NONE;
- case XF86_APM_SYS_SUSPEND:
- case XF86_APM_CRITICAL_SUSPEND:
- case XF86_APM_USER_SUSPEND:
- xf86Msg(X_WARNING, "Got SUSPENDED\n");
- if (ioctl( fd, APM_IOC_SUSPEND, NULL ) == 0)
- return PM_CONTINUE;
- else {
- xf86Msg(X_WARNING, "sunPMConfirmEventToOs: APM_IOC_SUSPEND"
- " %s\n", strerror(errno));
- return PM_FAILED;
- }
- case XF86_APM_STANDBY_RESUME:
- case XF86_APM_NORMAL_RESUME:
- case XF86_APM_CRITICAL_RESUME:
- case XF86_APM_STANDBY_FAILED:
- case XF86_APM_SUSPEND_FAILED:
- xf86Msg(X_WARNING, "Got RESUME\n");
- if (ioctl( fd, APM_IOC_RESUME, NULL ) == 0)
- return PM_CONTINUE;
- else {
- xf86Msg(X_WARNING, "sunPMConfirmEventToOs: APM_IOC_RESUME"
- " %s\n", strerror(errno));
- return PM_FAILED;
- }
- default:
- return PM_NONE;
- }
-}
-
-PMClose
-xf86OSPMOpen(void)
-{
- int fd;
-
- if (APMihPtr || !xf86Info.pmFlag) {
- return NULL;
- }
-
- if ((fd = open(APM_DEVICE, O_RDWR)) == -1) {
- if ((fd = open(APM_DEVICE1, O_RDWR)) == -1) {
- return NULL;
- }
- }
- xf86PMGetEventFromOs = sunPMGetEventFromOS;
- xf86PMConfirmEventToOs = sunPMConfirmEventToOs;
- APMihPtr = xf86AddGeneralHandler(fd, xf86HandlePMEvents, NULL);
- return sunCloseAPM;
-}
-
-static void
-sunCloseAPM(void)
-{
- int fd;
-
- if (APMihPtr) {
- fd = xf86RemoveGeneralHandler(APMihPtr);
- close(fd);
- APMihPtr = NULL;
- }
-}
+/* Based on hw/xfree86/os-support/bsd/bsd_apm.c which bore no explicit
+ * copyright notice, so is covered by the following notice:
+ *
+ * Copyright (C) 1994-2003 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ * 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
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice 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 MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE XFREE86 PROJECT 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.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from the
+ * XFree86 Project.
+ */
+
+/* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ *
+ * 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
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * 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 MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#define XF86_OS_PRIVS
+#include "xf86_OSproc.h"
+#include "xf86_OSlib.h"
+
+#ifndef PLEASE_FIX_THIS
+#define APM_STANDBY_REQ 0xa01
+#define APM_SUSPEND_REQ 0xa02
+#define APM_NORMAL_RESUME 0xa03
+#define APM_CRIT_RESUME 0xa04
+#define APM_BATTERY_LOW 0xa05
+#define APM_POWER_CHANGE 0xa06
+#define APM_UPDATE_TIME 0xa07
+#define APM_CRIT_SUSPEND_REQ 0xa08
+#define APM_USER_STANDBY_REQ 0xa09
+#define APM_USER_SUSPEND_REQ 0xa0a
+#define APM_SYS_STANDBY_RESUME 0xa0b
+#define APM_IOC_NEXTEVENT 0xa0c
+#define APM_IOC_RESUME 0xa0d
+#define APM_IOC_SUSPEND 0xa0e
+#define APM_IOC_STANDBY 0xa0f
+#endif
+
+typedef struct apm_event_info
+{
+ int type;
+} apm_event_info;
+
+/*
+ This may be replaced with a better device name
+ very soon...
+*/
+#define APM_DEVICE "/dev/srn"
+#define APM_DEVICE1 "/dev/apm"
+
+static pointer APMihPtr = NULL;
+static void sunCloseAPM(void);
+
+static struct {
+ u_int apmBsd;
+ pmEvent xf86;
+} sunToXF86Array [] = {
+ { APM_STANDBY_REQ, XF86_APM_SYS_STANDBY },
+ { APM_SUSPEND_REQ, XF86_APM_SYS_SUSPEND },
+ { APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME },
+ { APM_CRIT_RESUME, XF86_APM_CRITICAL_RESUME },
+ { APM_BATTERY_LOW, XF86_APM_LOW_BATTERY },
+ { APM_POWER_CHANGE, XF86_APM_POWER_STATUS_CHANGE },
+ { APM_UPDATE_TIME, XF86_APM_UPDATE_TIME },
+ { APM_CRIT_SUSPEND_REQ, XF86_APM_CRITICAL_SUSPEND },
+ { APM_USER_STANDBY_REQ, XF86_APM_USER_STANDBY },
+ { APM_USER_SUSPEND_REQ, XF86_APM_USER_SUSPEND },
+ { APM_SYS_STANDBY_RESUME, XF86_APM_STANDBY_RESUME },
+#ifdef APM_CAPABILITY_CHANGE
+ { APM_CAPABILITY_CHANGE, XF86_APM_CAPABILITY_CHANGED },
+#endif
+};
+
+#define numApmEvents (sizeof(sunToXF86Array) / sizeof(sunToXF86Array[0]))
+
+static pmEvent
+sunToXF86(int type)
+{
+ int i;
+
+ for (i = 0; i < numApmEvents; i++) {
+ if (type == sunToXF86Array[i].apmBsd) {
+ return sunToXF86Array[i].xf86;
+ }
+ }
+ return XF86_APM_UNKNOWN;
+}
+
+/*
+ * APM events can be requested direclty from /dev/apm
+ */
+static int
+sunPMGetEventFromOS(int fd, pmEvent *events, int num)
+{
+ struct apm_event_info sunEvent;
+ int i;
+
+ for (i = 0; i < num; i++) {
+
+ if (ioctl(fd, APM_IOC_NEXTEVENT, &sunEvent) < 0) {
+ if (errno != EAGAIN) {
+ xf86Msg(X_WARNING, "sunPMGetEventFromOS: APM_IOC_NEXTEVENT"
+ " %s\n", strerror(errno));
+ }
+ break;
+ }
+ events[i] = sunToXF86(sunEvent.type);
+ }
+ xf86Msg(X_WARNING, "Got some events\n");
+ return i;
+}
+
+static pmWait
+sunPMConfirmEventToOs(int fd, pmEvent event)
+{
+ switch (event) {
+/* XXX: NOT CURRENTLY RETURNED FROM OS */
+ case XF86_APM_SYS_STANDBY:
+ case XF86_APM_USER_STANDBY:
+ if (ioctl( fd, APM_IOC_STANDBY, NULL ) == 0)
+ return PM_WAIT; /* should we stop the Xserver in standby, too? */
+ else
+ return PM_NONE;
+ case XF86_APM_SYS_SUSPEND:
+ case XF86_APM_CRITICAL_SUSPEND:
+ case XF86_APM_USER_SUSPEND:
+ xf86Msg(X_WARNING, "Got SUSPENDED\n");
+ if (ioctl( fd, APM_IOC_SUSPEND, NULL ) == 0)
+ return PM_CONTINUE;
+ else {
+ xf86Msg(X_WARNING, "sunPMConfirmEventToOs: APM_IOC_SUSPEND"
+ " %s\n", strerror(errno));
+ return PM_FAILED;
+ }
+ case XF86_APM_STANDBY_RESUME:
+ case XF86_APM_NORMAL_RESUME:
+ case XF86_APM_CRITICAL_RESUME:
+ case XF86_APM_STANDBY_FAILED:
+ case XF86_APM_SUSPEND_FAILED:
+ xf86Msg(X_WARNING, "Got RESUME\n");
+ if (ioctl( fd, APM_IOC_RESUME, NULL ) == 0)
+ return PM_CONTINUE;
+ else {
+ xf86Msg(X_WARNING, "sunPMConfirmEventToOs: APM_IOC_RESUME"
+ " %s\n", strerror(errno));
+ return PM_FAILED;
+ }
+ default:
+ return PM_NONE;
+ }
+}
+
+PMClose
+xf86OSPMOpen(void)
+{
+ int fd;
+
+ if (APMihPtr || !xf86Info.pmFlag) {
+ return NULL;
+ }
+
+ if ((fd = open(APM_DEVICE, O_RDWR)) == -1) {
+ if ((fd = open(APM_DEVICE1, O_RDWR)) == -1) {
+ return NULL;
+ }
+ }
+ xf86PMGetEventFromOs = sunPMGetEventFromOS;
+ xf86PMConfirmEventToOs = sunPMConfirmEventToOs;
+ APMihPtr = xf86AddGeneralHandler(fd, xf86HandlePMEvents, NULL);
+ return sunCloseAPM;
+}
+
+static void
+sunCloseAPM(void)
+{
+ int fd;
+
+ if (APMihPtr) {
+ fd = xf86RemoveGeneralHandler(APMihPtr);
+ close(fd);
+ APMihPtr = NULL;
+ }
+}
diff --git a/xorg-server/hw/xfree86/os-support/solaris/sun_bell.c b/xorg-server/hw/xfree86/os-support/solaris/sun_bell.c
index e064c9733..8cd4de25b 100644
--- a/xorg-server/hw/xfree86/os-support/solaris/sun_bell.c
+++ b/xorg-server/hw/xfree86/os-support/solaris/sun_bell.c
@@ -1,4 +1,4 @@
-/* Copyright 2004-2005 Sun Microsystems, Inc. All rights reserved.
+/* Copyright (c) 2004-2005, Oracle and/or its affiliates. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
diff --git a/xorg-server/hw/xfree86/os-support/solaris/sun_vid.c b/xorg-server/hw/xfree86/os-support/solaris/sun_vid.c
index 1991289fd..b7b7c0ed7 100644
--- a/xorg-server/hw/xfree86/os-support/solaris/sun_vid.c
+++ b/xorg-server/hw/xfree86/os-support/solaris/sun_vid.c
@@ -22,7 +22,7 @@
* OF THIS SOFTWARE.
*
*/
-/* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+/* Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
diff --git a/xorg-server/hw/xfree86/parser/Flags.c b/xorg-server/hw/xfree86/parser/Flags.c
index cdd023222..17e079a8c 100644
--- a/xorg-server/hw/xfree86/parser/Flags.c
+++ b/xorg-server/hw/xfree86/parser/Flags.c
@@ -61,8 +61,8 @@
#include "xf86Parser.h"
#include "xf86tokens.h"
#include "Configint.h"
-#include <math.h>
#include <X11/Xfuncproto.h>
+#include "Xprintf.h"
extern LexRec val;
@@ -143,9 +143,8 @@ xf86parseFlagsSection (void)
} else {
if (tokentype != NUMBER)
Error (NUMBER_MSG, tmp);
- valstr = malloc(16);
- if (valstr)
- sprintf(valstr, "%d", val.num);
+ if (asprintf(&valstr, "%d", val.num) == -1)
+ valstr = NULL;
}
}
ptr->flg_option_lst = xf86addNewOption
@@ -426,13 +425,9 @@ char *
xf86uLongToString(unsigned long i)
{
char *s;
- int l;
- l = ceil(log10((double)i) + 2.5);
- s = malloc(l);
- if (!s)
+ if (asprintf(&s, "%lu", i) == -1)
return NULL;
- sprintf(s, "%lu", i);
return s;
}
diff --git a/xorg-server/hw/xfree86/parser/Makefile.am b/xorg-server/hw/xfree86/parser/Makefile.am
index caf7079d4..6fe7b87c1 100644
--- a/xorg-server/hw/xfree86/parser/Makefile.am
+++ b/xorg-server/hw/xfree86/parser/Makefile.am
@@ -1,50 +1,51 @@
-if INSTALL_LIBXF86CONFIG
-noinst_LTLIBRARIES = libxf86config_internal.la
-lib_LIBRARIES = libxf86config.a
-LIBHEADERS = \
- xf86Optrec.h \
- xf86Parser.h
-else
-noinst_LTLIBRARIES = libxf86config_internal.la
-endif
-
-INTERNAL_SOURCES= \
- Device.c \
- Files.c \
- Flags.c \
- Input.c \
- InputClass.c \
- Layout.c \
- Module.c \
- Video.c \
- Monitor.c \
- Pointer.c \
- Screen.c \
- Vendor.c \
- read.c \
- scan.c \
- write.c \
- DRI.c \
- Extensions.c
-
-libxf86config_internal_la_SOURCES = \
- $(INTERNAL_SOURCES)
-
-libxf86config_a_SOURCES = \
- $(INTERNAL_SOURCES)
-libxf86config_a_CFLAGS = $(AM_CFLAGS)
-
-AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) \
- -DSYSCONFDIR=\"$(sysconfdir)\" \
- -DDATADIR=\"$(datadir)\"
-
-EXTRA_DIST = \
- Configint.h \
- configProcs.h \
- xf86Optrec.h \
- xf86Parser.h \
- xf86tokens.h
-
-sdk_HEADERS = \
- xf86Parser.h \
- xf86Optrec.h
+if INSTALL_LIBXF86CONFIG
+noinst_LTLIBRARIES = libxf86config_internal.la
+lib_LIBRARIES = libxf86config.a
+LIBHEADERS = \
+ xf86Optrec.h \
+ xf86Parser.h
+else
+noinst_LTLIBRARIES = libxf86config_internal.la
+endif
+
+INTERNAL_SOURCES= \
+ Device.c \
+ Files.c \
+ Flags.c \
+ Input.c \
+ InputClass.c \
+ Layout.c \
+ Module.c \
+ Video.c \
+ Monitor.c \
+ Pointer.c \
+ Screen.c \
+ Vendor.c \
+ read.c \
+ scan.c \
+ write.c \
+ DRI.c \
+ Extensions.c
+
+libxf86config_internal_la_SOURCES = \
+ $(INTERNAL_SOURCES)
+
+libxf86config_a_SOURCES = \
+ $(TOP_SRCDIR)/os/xprintf.c \
+ $(INTERNAL_SOURCES)
+libxf86config_a_CFLAGS = $(AM_CFLAGS)
+
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) \
+ -DSYSCONFDIR=\"$(sysconfdir)\" \
+ -DDATADIR=\"$(datadir)\"
+
+EXTRA_DIST = \
+ Configint.h \
+ configProcs.h \
+ xf86Optrec.h \
+ xf86Parser.h \
+ xf86tokens.h
+
+sdk_HEADERS = \
+ xf86Parser.h \
+ xf86Optrec.h
diff --git a/xorg-server/hw/xfree86/parser/Pointer.c b/xorg-server/hw/xfree86/parser/Pointer.c
index 56a26ba74..5e4db442e 100644
--- a/xorg-server/hw/xfree86/parser/Pointer.c
+++ b/xorg-server/hw/xfree86/parser/Pointer.c
@@ -1,237 +1,233 @@
-/*
- *
- * Copyright (c) 1997 Metro Link Incorporated
- *
- * 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
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice 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 MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE X CONSORTIUM 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.
- *
- * Except as contained in this notice, the name of the Metro Link shall not be
- * used in advertising or otherwise to promote the sale, use or other dealings
- * in this Software without prior written authorization from Metro Link.
- *
- */
-/*
- * Copyright (c) 1997-2003 by The XFree86 Project, 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
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice 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 MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) 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.
- *
- * Except as contained in this notice, the name of the copyright holder(s)
- * and author(s) shall not be used in advertising or otherwise to promote
- * the sale, use or other dealings in this Software without prior written
- * authorization from the copyright holder(s) and author(s).
- */
-
-
-/* View/edit this file with tab stops set to 4 */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86Parser.h"
-#include "xf86tokens.h"
-#include "Configint.h"
-
-extern LexRec val;
-
-static xf86ConfigSymTabRec PointerTab[] =
-{
- {PROTOCOL, "protocol"},
- {EMULATE3, "emulate3buttons"},
- {EM3TIMEOUT, "emulate3timeout"},
- {ENDSUBSECTION, "endsubsection"},
- {ENDSECTION, "endsection"},
- {PDEVICE, "device"},
- {PDEVICE, "port"},
- {BAUDRATE, "baudrate"},
- {SAMPLERATE, "samplerate"},
- {CLEARDTR, "cleardtr"},
- {CLEARRTS, "clearrts"},
- {CHORDMIDDLE, "chordmiddle"},
- {PRESOLUTION, "resolution"},
- {DEVICE_NAME, "devicename"},
- {ALWAYSCORE, "alwayscore"},
- {PBUTTONS, "buttons"},
- {ZAXISMAPPING, "zaxismapping"},
- {-1, ""},
-};
-
-static xf86ConfigSymTabRec ZMapTab[] =
-{
- {XAXIS, "x"},
- {YAXIS, "y"},
- {-1, ""},
-};
-
-#define CLEANUP xf86freeInputList
-
-XF86ConfInputPtr
-xf86parsePointerSection (void)
-{
- char *s, *s1, *s2;
- int l;
- int token;
- parsePrologue (XF86ConfInputPtr, XF86ConfInputRec)
-
- while ((token = xf86getToken (PointerTab)) != ENDSECTION)
- {
- switch (token)
- {
- case COMMENT:
- ptr->inp_comment = xf86addComment(ptr->inp_comment, val.str);
- break;
- case PROTOCOL:
- if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
- Error (QUOTE_MSG, "Protocol");
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("Protocol"),
- val.str);
- break;
- case PDEVICE:
- if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
- Error (QUOTE_MSG, "Device");
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("Device"),
- val.str);
- break;
- case EMULATE3:
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("Emulate3Buttons"),
- NULL);
- break;
- case EM3TIMEOUT:
- if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0)
- Error (POSITIVE_INT_MSG, "Emulate3Timeout");
- s = xf86uLongToString(val.num);
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("Emulate3Timeout"),
- s);
- break;
- case CHORDMIDDLE:
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("ChordMiddle"),
- NULL);
- break;
- case PBUTTONS:
- if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0)
- Error (POSITIVE_INT_MSG, "Buttons");
- s = xf86uLongToString(val.num);
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("Buttons"), s);
- break;
- case BAUDRATE:
- if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0)
- Error (POSITIVE_INT_MSG, "BaudRate");
- s = xf86uLongToString(val.num);
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("BaudRate"), s);
- break;
- case SAMPLERATE:
- if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0)
- Error (POSITIVE_INT_MSG, "SampleRate");
- s = xf86uLongToString(val.num);
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("SampleRate"), s);
- break;
- case PRESOLUTION:
- if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0)
- Error (POSITIVE_INT_MSG, "Resolution");
- s = xf86uLongToString(val.num);
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("Resolution"), s);
- break;
- case CLEARDTR:
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("ClearDTR"), NULL);
- break;
- case CLEARRTS:
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("ClearRTS"), NULL);
- break;
- case ZAXISMAPPING:
- switch (xf86getToken(ZMapTab)) {
- case NUMBER:
- if (val.num < 0)
- Error (ZAXISMAPPING_MSG, NULL);
- s1 = xf86uLongToString(val.num);
- if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0) {
- free(s1);
- Error (ZAXISMAPPING_MSG, NULL);
- }
- s2 = xf86uLongToString(val.num);
- l = strlen(s1) + 1 + strlen(s2) + 1;
- s = malloc(l);
- sprintf(s, "%s %s", s1, s2);
- free(s1);
- free(s2);
- break;
- case XAXIS:
- s = strdup("x");
- break;
- case YAXIS:
- s = strdup("y");
- break;
- default:
- Error (ZAXISMAPPING_MSG, NULL);
- break;
- }
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("ZAxisMapping"),
- s);
- break;
- case ALWAYSCORE:
- break;
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG, NULL);
- break;
- default:
- Error (INVALID_KEYWORD_MSG, xf86tokenString ());
- break;
- }
- }
-
- ptr->inp_identifier = strdup(CONF_IMPLICIT_POINTER);
- ptr->inp_driver = strdup("mouse");
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("CorePointer"), NULL);
-
-#ifdef DEBUG
- printf ("Pointer section parsed\n");
-#endif
-
- return ptr;
-}
-
-#undef CLEANUP
-
+/*
+ *
+ * Copyright (c) 1997 Metro Link Incorporated
+ *
+ * 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
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice 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 MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE X CONSORTIUM 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.
+ *
+ * Except as contained in this notice, the name of the Metro Link shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Metro Link.
+ *
+ */
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, 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
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice 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 MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) 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.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+
+/* View/edit this file with tab stops set to 4 */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Parser.h"
+#include "xf86tokens.h"
+#include "Configint.h"
+#include "Xprintf.h"
+
+extern LexRec val;
+
+static xf86ConfigSymTabRec PointerTab[] =
+{
+ {PROTOCOL, "protocol"},
+ {EMULATE3, "emulate3buttons"},
+ {EM3TIMEOUT, "emulate3timeout"},
+ {ENDSUBSECTION, "endsubsection"},
+ {ENDSECTION, "endsection"},
+ {PDEVICE, "device"},
+ {PDEVICE, "port"},
+ {BAUDRATE, "baudrate"},
+ {SAMPLERATE, "samplerate"},
+ {CLEARDTR, "cleardtr"},
+ {CLEARRTS, "clearrts"},
+ {CHORDMIDDLE, "chordmiddle"},
+ {PRESOLUTION, "resolution"},
+ {DEVICE_NAME, "devicename"},
+ {ALWAYSCORE, "alwayscore"},
+ {PBUTTONS, "buttons"},
+ {ZAXISMAPPING, "zaxismapping"},
+ {-1, ""},
+};
+
+static xf86ConfigSymTabRec ZMapTab[] =
+{
+ {XAXIS, "x"},
+ {YAXIS, "y"},
+ {-1, ""},
+};
+
+#define CLEANUP xf86freeInputList
+
+XF86ConfInputPtr
+xf86parsePointerSection (void)
+{
+ char *s;
+ unsigned long val1;
+ int token;
+ parsePrologue (XF86ConfInputPtr, XF86ConfInputRec)
+
+ while ((token = xf86getToken (PointerTab)) != ENDSECTION)
+ {
+ switch (token)
+ {
+ case COMMENT:
+ ptr->inp_comment = xf86addComment(ptr->inp_comment, val.str);
+ break;
+ case PROTOCOL:
+ if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
+ Error (QUOTE_MSG, "Protocol");
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("Protocol"),
+ val.str);
+ break;
+ case PDEVICE:
+ if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
+ Error (QUOTE_MSG, "Device");
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("Device"),
+ val.str);
+ break;
+ case EMULATE3:
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("Emulate3Buttons"),
+ NULL);
+ break;
+ case EM3TIMEOUT:
+ if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0)
+ Error (POSITIVE_INT_MSG, "Emulate3Timeout");
+ s = xf86uLongToString(val.num);
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("Emulate3Timeout"),
+ s);
+ break;
+ case CHORDMIDDLE:
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("ChordMiddle"),
+ NULL);
+ break;
+ case PBUTTONS:
+ if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0)
+ Error (POSITIVE_INT_MSG, "Buttons");
+ s = xf86uLongToString(val.num);
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("Buttons"), s);
+ break;
+ case BAUDRATE:
+ if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0)
+ Error (POSITIVE_INT_MSG, "BaudRate");
+ s = xf86uLongToString(val.num);
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("BaudRate"), s);
+ break;
+ case SAMPLERATE:
+ if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0)
+ Error (POSITIVE_INT_MSG, "SampleRate");
+ s = xf86uLongToString(val.num);
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("SampleRate"), s);
+ break;
+ case PRESOLUTION:
+ if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0)
+ Error (POSITIVE_INT_MSG, "Resolution");
+ s = xf86uLongToString(val.num);
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("Resolution"), s);
+ break;
+ case CLEARDTR:
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("ClearDTR"), NULL);
+ break;
+ case CLEARRTS:
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("ClearRTS"), NULL);
+ break;
+ case ZAXISMAPPING:
+ switch (xf86getToken(ZMapTab)) {
+ case NUMBER:
+ if (val.num < 0)
+ Error (ZAXISMAPPING_MSG, NULL);
+ val1 = val.num;
+ if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0) {
+ Error (ZAXISMAPPING_MSG, NULL);
+ }
+ if (asprintf(&s, "%ul %ul", val1, val.num) == -1)
+ s = NULL;
+ break;
+ case XAXIS:
+ s = strdup("x");
+ break;
+ case YAXIS:
+ s = strdup("y");
+ break;
+ default:
+ Error (ZAXISMAPPING_MSG, NULL);
+ break;
+ }
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("ZAxisMapping"),
+ s);
+ break;
+ case ALWAYSCORE:
+ break;
+ case EOF_TOKEN:
+ Error (UNEXPECTED_EOF_MSG, NULL);
+ break;
+ default:
+ Error (INVALID_KEYWORD_MSG, xf86tokenString ());
+ break;
+ }
+ }
+
+ ptr->inp_identifier = strdup(CONF_IMPLICIT_POINTER);
+ ptr->inp_driver = strdup("mouse");
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("CorePointer"), NULL);
+
+#ifdef DEBUG
+ printf ("Pointer section parsed\n");
+#endif
+
+ return ptr;
+}
+
+#undef CLEANUP
+
diff --git a/xorg-server/hw/xfree86/ramdac/Makefile.am b/xorg-server/hw/xfree86/ramdac/Makefile.am
index 98e367c88..e6f8ed552 100644
--- a/xorg-server/hw/xfree86/ramdac/Makefile.am
+++ b/xorg-server/hw/xfree86/ramdac/Makefile.am
@@ -1,19 +1,19 @@
-noinst_LTLIBRARIES = libramdac.la
-
-libramdac_la_SOURCES = xf86RamDac.c xf86RamDacCmap.c \
- xf86Cursor.c xf86HWCurs.c IBM.c BT.c TI.c \
- xf86BitOrder.c
-
-sdk_HEADERS = BT.h IBM.h TI.h xf86Cursor.h xf86RamDac.h
-
-DISTCLEANFILES = xf86BitOrder.c
-EXTRA_DIST = BTPriv.h IBMPriv.h TIPriv.h xf86CursorPriv.h xf86RamDacPriv.h \
- CURSOR.NOTES
-
-AM_CFLAGS = -DXAAReverseBitOrder=xf86ReverseBitOrder -DRAMDAC_MODULE \
- $(DIX_CFLAGS) $(XORG_CFLAGS)
-INCLUDES = $(XORG_INCS)
-
-xf86BitOrder.c:
- echo "#define XAAReverseBitOrder xf86ReverseBitOrder" > $@
- echo "#include \"$(srcdir)/../xaa/xaaBitOrder.c\"" >> $@
+noinst_LTLIBRARIES = libramdac.la
+
+libramdac_la_SOURCES = xf86RamDac.c xf86RamDacCmap.c \
+ xf86Cursor.c xf86HWCurs.c IBM.c BT.c TI.c \
+ xf86BitOrder.c
+
+sdk_HEADERS = BT.h IBM.h TI.h xf86Cursor.h xf86RamDac.h
+
+DISTCLEANFILES = xf86BitOrder.c
+EXTRA_DIST = BTPriv.h IBMPriv.h TIPriv.h xf86CursorPriv.h xf86RamDacPriv.h \
+ CURSOR.NOTES
+
+AM_CFLAGS = -DXAAReverseBitOrder=xf86ReverseBitOrder -DRAMDAC_MODULE \
+ $(DIX_CFLAGS) $(XORG_CFLAGS)
+INCLUDES = $(XORG_INCS)
+
+xf86BitOrder.c:
+ $(AM_V_GEN)echo "#define XAAReverseBitOrder xf86ReverseBitOrder" > $@
+ $(AM_V_GEN)echo "#include \"$(srcdir)/../xaa/xaaBitOrder.c\"" >> $@
diff --git a/xorg-server/hw/xfree86/utils/cvt/Makefile.am b/xorg-server/hw/xfree86/utils/cvt/Makefile.am
index 6b99cbd5f..7f8364f86 100644
--- a/xorg-server/hw/xfree86/utils/cvt/Makefile.am
+++ b/xorg-server/hw/xfree86/utils/cvt/Makefile.am
@@ -1,39 +1,42 @@
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
-#
-# 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
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# 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 MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-# THE AUTHORS OR COPYRIGHT HOLDERS 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.
-#
-
-bin_PROGRAMS = cvt
-
-INCLUDES = $(XORG_INCS) \
- -I$(top_srcdir)/hw/xfree86/ddc \
- -I$(top_srcdir)/hw/xfree86/parser
-
-# gah
-cvt_SOURCES = cvt.c $(top_srcdir)/hw/xfree86/modes/xf86cvt.c
-cvt_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
-
-man1_MANS = cvt.man
-
-CLEANFILES = $(man1_MANS)
-
-include $(top_srcdir)/cpprules.in
-
-EXTRA_DIST = cvt.man.pre
+# Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+#
+# 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
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# 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 MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS 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.
+#
+
+bin_PROGRAMS = cvt
+
+INCLUDES = $(XORG_INCS) \
+ -I$(top_srcdir)/hw/xfree86/ddc \
+ -I$(top_srcdir)/hw/xfree86/parser
+
+# gah
+cvt_SOURCES = cvt.c \
+ $(top_srcdir)/hw/xfree86/modes/xf86cvt.c \
+ $(top_srcdir)/os/xprintf.c
+
+cvt_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
+
+man1_MANS = cvt.man
+
+CLEANFILES = $(man1_MANS)
+
+include $(top_srcdir)/cpprules.in
+
+EXTRA_DIST = cvt.man.pre
diff --git a/xorg-server/hw/xfree86/utils/cvt/cvt.c b/xorg-server/hw/xfree86/utils/cvt/cvt.c
index cf0a479f2..1ff38118b 100644
--- a/xorg-server/hw/xfree86/utils/cvt/cvt.c
+++ b/xorg-server/hw/xfree86/utils/cvt/cvt.c
@@ -1,282 +1,300 @@
-/*
- * Copyright 2005-2006 Luc Verhaegen.
- *
- * 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
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice 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 MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) 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.
- *
- */
-
-/* Standalone VESA CVT standard timing modelines generator. */
-
-#include "xf86.h"
-
-/* xnfalloc implementation used by the server code we built in */
-pointer
-XNFalloc(unsigned long n)
-{
- pointer r;
-
- r = malloc(n);
- if (!r) {
- perror("malloc failed");
- exit(1);
- }
- return r;
-}
-
-/* xnfcalloc implementation used by the server code we built in */
-pointer
-XNFcalloc(unsigned long n)
-{
- pointer r;
-
- r = calloc(1, n);
- if (!r) {
- perror("calloc failed");
- exit(1);
- }
- return r;
-}
-
-/*
- * Quickly check wether this is a CVT standard mode.
- */
-static Bool
-CVTCheckStandard(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
- Bool Verbose)
-{
- Bool IsCVT = TRUE;
-
- if ((!(VDisplay % 3) && ((VDisplay * 4 / 3) == HDisplay)) ||
- (!(VDisplay % 9) && ((VDisplay * 16 / 9) == HDisplay)) ||
- (!(VDisplay % 10) && ((VDisplay * 16 / 10) == HDisplay)) ||
- (!(VDisplay % 4) && ((VDisplay * 5 / 4) == HDisplay)) ||
- (!(VDisplay % 9) && ((VDisplay * 15 / 9) == HDisplay)))
- ;
- else {
- if (Verbose)
- fprintf(stderr, "Warning: Aspect Ratio is not CVT standard.\n");
- IsCVT = FALSE;
- }
-
- if ((VRefresh != 50.0) && (VRefresh != 60.0) &&
- (VRefresh != 75.0) && (VRefresh != 85.0)) {
- if (Verbose)
- fprintf(stderr, "Warning: Refresh Rate is not CVT standard "
- "(50, 60, 75 or 85Hz).\n");
- IsCVT = FALSE;
- }
-
- return IsCVT;
-}
-
-
-/*
- * I'm not documenting --interlaced for obvious reasons, even though I did
- * implement it. I also can't deny having looked at gtf here.
- */
-static void
-PrintUsage(char *Name)
-{
- fprintf(stderr, "\n");
- fprintf(stderr, "usage: %s [-v|--verbose] [-r|--reduced] X Y [refresh]\n",
- Name);
- fprintf(stderr, "\n");
- fprintf(stderr, " -v|--verbose : Warn about CVT standard adherance.\n");
- fprintf(stderr, " -r|--reduced : Create a mode with reduced blanking "
- "(default: normal blanking).\n");
- fprintf(stderr, " X : Desired horizontal resolution "
- "(multiple of 8, required).\n");
- fprintf(stderr, " Y : Desired vertical resolution (required).\n");
- fprintf(stderr, " refresh : Desired refresh rate (default: 60.0Hz).\n");
- fprintf(stderr, "\n");
-
- fprintf(stderr, "Calculates VESA CVT (Coordinated Video Timing) modelines"
- " for use with X.\n");
-}
-
-
-/*
- *
- */
-static void
-PrintComment(DisplayModeRec *Mode, Bool CVT, Bool Reduced)
-{
- printf("# %dx%d %.2f Hz ", Mode->HDisplay, Mode->VDisplay, Mode->VRefresh);
-
- if (CVT) {
- printf("(CVT %.2fM",
- ((float) Mode->HDisplay * Mode->VDisplay) / 1000000.0);
-
- if (!(Mode->VDisplay % 3) &&
- ((Mode->VDisplay * 4 / 3) == Mode->HDisplay))
- printf("3");
- else if (!(Mode->VDisplay % 9) &&
- ((Mode->VDisplay * 16 / 9) == Mode->HDisplay))
- printf("9");
- else if (!(Mode->VDisplay % 10) &&
- ((Mode->VDisplay * 16 / 10) == Mode->HDisplay))
- printf("A");
- else if (!(Mode->VDisplay % 4) &&
- ((Mode->VDisplay * 5 / 4) == Mode->HDisplay))
- printf("4");
- else if (!(Mode->VDisplay % 9) &&
- ((Mode->VDisplay * 15 / 9) == Mode->HDisplay))
- printf("9");
-
- if (Reduced)
- printf("-R");
-
- printf(") ");
- } else
- printf("(CVT) ");
-
- printf("hsync: %.2f kHz; ", Mode->HSync);
- printf("pclk: %.2f MHz", ((float ) Mode->Clock) / 1000.0);
-
- printf("\n");
-}
-
-
-/*
- * Originally grabbed from xf86Mode.c.
- *
- * Ignoring the actual Mode->name, as the user will want something solid
- * to grab hold of.
- */
-static void
-PrintModeline(DisplayModePtr Mode, int HDisplay, int VDisplay, float VRefresh,
- Bool Reduced)
-{
- if (Reduced)
- printf("Modeline \"%dx%dR\" ", HDisplay, VDisplay);
- else
- printf("Modeline \"%dx%d_%.2f\" ", HDisplay, VDisplay, VRefresh);
-
- printf("%6.2f %i %i %i %i %i %i %i %i", Mode->Clock/1000., Mode->HDisplay,
- Mode->HSyncStart, Mode->HSyncEnd, Mode->HTotal, Mode->VDisplay,
- Mode->VSyncStart, Mode->VSyncEnd, Mode->VTotal);
-
- if (Mode->Flags & V_INTERLACE)
- printf(" interlace");
- if (Mode->Flags & V_PHSYNC)
- printf(" +hsync");
- if (Mode->Flags & V_NHSYNC)
- printf(" -hsync");
- if (Mode->Flags & V_PVSYNC)
- printf(" +vsync");
- if (Mode->Flags & V_NVSYNC)
- printf(" -vsync");
-
- printf("\n");
-}
-
-
-/*
- *
- */
-int
-main (int argc, char *argv[])
-{
- DisplayModeRec *Mode;
- int HDisplay = 0, VDisplay = 0;
- float VRefresh = 0.0;
- Bool Reduced = FALSE, Verbose = FALSE, IsCVT;
- Bool Interlaced = FALSE;
- int n;
-
- if ((argc < 3) || (argc > 7)) {
- PrintUsage(argv[0]);
- return 1;
- }
-
- /* This doesn't filter out bad flags properly. Bad flags get passed down
- * to atoi/atof, which then return 0, so that these variables can get
- * filled next time round. So this is just a cosmetic problem.
- */
- for (n = 1; n < argc; n++) {
- if (!strcmp(argv[n], "-r") || !strcmp(argv[n], "--reduced"))
- Reduced = TRUE;
- else if (!strcmp(argv[n], "-i") || !strcmp(argv[n], "--interlaced"))
- Interlaced = TRUE;
- else if (!strcmp(argv[n], "-v") || !strcmp(argv[n], "--verbose"))
- Verbose = TRUE;
- else if (!strcmp(argv[n], "-h") || !strcmp(argv[n], "--help")) {
- PrintUsage(argv[0]);
- return 0;
- } else if (!HDisplay) {
- HDisplay = atoi(argv[n]);
- if (!HDisplay) {
- PrintUsage(argv[0]);
- return 1;
- }
- }
- else if (!VDisplay) {
- VDisplay = atoi(argv[n]);
- if (!VDisplay) {
- PrintUsage(argv[0]);
- return 1;
- }
- }
- else if (!VRefresh) {
- VRefresh = atof(argv[n]);
- if (!VRefresh) {
- PrintUsage(argv[0]);
- return 1;
- }
- }
- else {
- PrintUsage(argv[0]);
- return 1;
- }
- }
-
- if (!HDisplay || !VDisplay) {
- PrintUsage(argv[0]);
- return 0;
- }
-
- /* Default to 60.0Hz */
- if (!VRefresh)
- VRefresh = 60.0;
-
- /* Horizontal timing is always a multiple of 8: round up. */
- if (HDisplay & 0x07) {
- HDisplay &= ~0x07;
- HDisplay += 8;
- }
-
- if (Reduced) {
- if ((VRefresh / 60.0) != floor(VRefresh / 60.0)) {
- fprintf(stderr,
- "\nERROR: Multiple of 60Hz refresh rate required for "
- " reduced blanking.\n");
- PrintUsage(argv[0]);
- return 0;
- }
- }
-
- IsCVT = CVTCheckStandard(HDisplay, VDisplay, VRefresh, Reduced, Verbose);
-
- Mode = xf86CVTMode(HDisplay, VDisplay, VRefresh, Reduced, Interlaced);
-
- PrintComment(Mode, IsCVT, Reduced);
- PrintModeline(Mode, HDisplay, VDisplay, VRefresh, Reduced);
-
- return 0;
-}
+/*
+ * Copyright 2005-2006 Luc Verhaegen.
+ *
+ * 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
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice 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 MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) 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.
+ *
+ */
+
+/* Standalone VESA CVT standard timing modelines generator. */
+
+#include "xf86.h"
+
+/* Error implementation used by the server code we built in */
+void
+Error(const char *str)
+{
+ perror(str);
+}
+
+/* FatalError implementation used by the server code we built in */
+void
+FatalError(const char *f, ...)
+{
+ va_list args;
+ va_start(args, f);
+ vfprintf(stderr, f, args);
+ va_end(args);
+ exit(1);
+}
+
+/* xnfalloc implementation used by the server code we built in */
+pointer
+XNFalloc(unsigned long n)
+{
+ pointer r;
+
+ r = malloc(n);
+ if (!r) {
+ perror("malloc failed");
+ exit(1);
+ }
+ return r;
+}
+
+/* xnfcalloc implementation used by the server code we built in */
+pointer
+XNFcalloc(unsigned long n)
+{
+ pointer r;
+
+ r = calloc(1, n);
+ if (!r) {
+ perror("calloc failed");
+ exit(1);
+ }
+ return r;
+}
+
+/*
+ * Quickly check wether this is a CVT standard mode.
+ */
+static Bool
+CVTCheckStandard(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
+ Bool Verbose)
+{
+ Bool IsCVT = TRUE;
+
+ if ((!(VDisplay % 3) && ((VDisplay * 4 / 3) == HDisplay)) ||
+ (!(VDisplay % 9) && ((VDisplay * 16 / 9) == HDisplay)) ||
+ (!(VDisplay % 10) && ((VDisplay * 16 / 10) == HDisplay)) ||
+ (!(VDisplay % 4) && ((VDisplay * 5 / 4) == HDisplay)) ||
+ (!(VDisplay % 9) && ((VDisplay * 15 / 9) == HDisplay)))
+ ;
+ else {
+ if (Verbose)
+ fprintf(stderr, "Warning: Aspect Ratio is not CVT standard.\n");
+ IsCVT = FALSE;
+ }
+
+ if ((VRefresh != 50.0) && (VRefresh != 60.0) &&
+ (VRefresh != 75.0) && (VRefresh != 85.0)) {
+ if (Verbose)
+ fprintf(stderr, "Warning: Refresh Rate is not CVT standard "
+ "(50, 60, 75 or 85Hz).\n");
+ IsCVT = FALSE;
+ }
+
+ return IsCVT;
+}
+
+
+/*
+ * I'm not documenting --interlaced for obvious reasons, even though I did
+ * implement it. I also can't deny having looked at gtf here.
+ */
+static void
+PrintUsage(char *Name)
+{
+ fprintf(stderr, "\n");
+ fprintf(stderr, "usage: %s [-v|--verbose] [-r|--reduced] X Y [refresh]\n",
+ Name);
+ fprintf(stderr, "\n");
+ fprintf(stderr, " -v|--verbose : Warn about CVT standard adherance.\n");
+ fprintf(stderr, " -r|--reduced : Create a mode with reduced blanking "
+ "(default: normal blanking).\n");
+ fprintf(stderr, " X : Desired horizontal resolution "
+ "(multiple of 8, required).\n");
+ fprintf(stderr, " Y : Desired vertical resolution (required).\n");
+ fprintf(stderr, " refresh : Desired refresh rate (default: 60.0Hz).\n");
+ fprintf(stderr, "\n");
+
+ fprintf(stderr, "Calculates VESA CVT (Coordinated Video Timing) modelines"
+ " for use with X.\n");
+}
+
+
+/*
+ *
+ */
+static void
+PrintComment(DisplayModeRec *Mode, Bool CVT, Bool Reduced)
+{
+ printf("# %dx%d %.2f Hz ", Mode->HDisplay, Mode->VDisplay, Mode->VRefresh);
+
+ if (CVT) {
+ printf("(CVT %.2fM",
+ ((float) Mode->HDisplay * Mode->VDisplay) / 1000000.0);
+
+ if (!(Mode->VDisplay % 3) &&
+ ((Mode->VDisplay * 4 / 3) == Mode->HDisplay))
+ printf("3");
+ else if (!(Mode->VDisplay % 9) &&
+ ((Mode->VDisplay * 16 / 9) == Mode->HDisplay))
+ printf("9");
+ else if (!(Mode->VDisplay % 10) &&
+ ((Mode->VDisplay * 16 / 10) == Mode->HDisplay))
+ printf("A");
+ else if (!(Mode->VDisplay % 4) &&
+ ((Mode->VDisplay * 5 / 4) == Mode->HDisplay))
+ printf("4");
+ else if (!(Mode->VDisplay % 9) &&
+ ((Mode->VDisplay * 15 / 9) == Mode->HDisplay))
+ printf("9");
+
+ if (Reduced)
+ printf("-R");
+
+ printf(") ");
+ } else
+ printf("(CVT) ");
+
+ printf("hsync: %.2f kHz; ", Mode->HSync);
+ printf("pclk: %.2f MHz", ((float ) Mode->Clock) / 1000.0);
+
+ printf("\n");
+}
+
+
+/*
+ * Originally grabbed from xf86Mode.c.
+ *
+ * Ignoring the actual Mode->name, as the user will want something solid
+ * to grab hold of.
+ */
+static void
+PrintModeline(DisplayModePtr Mode, int HDisplay, int VDisplay, float VRefresh,
+ Bool Reduced)
+{
+ if (Reduced)
+ printf("Modeline \"%dx%dR\" ", HDisplay, VDisplay);
+ else
+ printf("Modeline \"%dx%d_%.2f\" ", HDisplay, VDisplay, VRefresh);
+
+ printf("%6.2f %i %i %i %i %i %i %i %i", Mode->Clock/1000., Mode->HDisplay,
+ Mode->HSyncStart, Mode->HSyncEnd, Mode->HTotal, Mode->VDisplay,
+ Mode->VSyncStart, Mode->VSyncEnd, Mode->VTotal);
+
+ if (Mode->Flags & V_INTERLACE)
+ printf(" interlace");
+ if (Mode->Flags & V_PHSYNC)
+ printf(" +hsync");
+ if (Mode->Flags & V_NHSYNC)
+ printf(" -hsync");
+ if (Mode->Flags & V_PVSYNC)
+ printf(" +vsync");
+ if (Mode->Flags & V_NVSYNC)
+ printf(" -vsync");
+
+ printf("\n");
+}
+
+
+/*
+ *
+ */
+int
+main (int argc, char *argv[])
+{
+ DisplayModeRec *Mode;
+ int HDisplay = 0, VDisplay = 0;
+ float VRefresh = 0.0;
+ Bool Reduced = FALSE, Verbose = FALSE, IsCVT;
+ Bool Interlaced = FALSE;
+ int n;
+
+ if ((argc < 3) || (argc > 7)) {
+ PrintUsage(argv[0]);
+ return 1;
+ }
+
+ /* This doesn't filter out bad flags properly. Bad flags get passed down
+ * to atoi/atof, which then return 0, so that these variables can get
+ * filled next time round. So this is just a cosmetic problem.
+ */
+ for (n = 1; n < argc; n++) {
+ if (!strcmp(argv[n], "-r") || !strcmp(argv[n], "--reduced"))
+ Reduced = TRUE;
+ else if (!strcmp(argv[n], "-i") || !strcmp(argv[n], "--interlaced"))
+ Interlaced = TRUE;
+ else if (!strcmp(argv[n], "-v") || !strcmp(argv[n], "--verbose"))
+ Verbose = TRUE;
+ else if (!strcmp(argv[n], "-h") || !strcmp(argv[n], "--help")) {
+ PrintUsage(argv[0]);
+ return 0;
+ } else if (!HDisplay) {
+ HDisplay = atoi(argv[n]);
+ if (!HDisplay) {
+ PrintUsage(argv[0]);
+ return 1;
+ }
+ }
+ else if (!VDisplay) {
+ VDisplay = atoi(argv[n]);
+ if (!VDisplay) {
+ PrintUsage(argv[0]);
+ return 1;
+ }
+ }
+ else if (!VRefresh) {
+ VRefresh = atof(argv[n]);
+ if (!VRefresh) {
+ PrintUsage(argv[0]);
+ return 1;
+ }
+ }
+ else {
+ PrintUsage(argv[0]);
+ return 1;
+ }
+ }
+
+ if (!HDisplay || !VDisplay) {
+ PrintUsage(argv[0]);
+ return 0;
+ }
+
+ /* Default to 60.0Hz */
+ if (!VRefresh)
+ VRefresh = 60.0;
+
+ /* Horizontal timing is always a multiple of 8: round up. */
+ if (HDisplay & 0x07) {
+ HDisplay &= ~0x07;
+ HDisplay += 8;
+ }
+
+ if (Reduced) {
+ if ((VRefresh / 60.0) != floor(VRefresh / 60.0)) {
+ fprintf(stderr,
+ "\nERROR: Multiple of 60Hz refresh rate required for "
+ " reduced blanking.\n");
+ PrintUsage(argv[0]);
+ return 0;
+ }
+ }
+
+ IsCVT = CVTCheckStandard(HDisplay, VDisplay, VRefresh, Reduced, Verbose);
+
+ Mode = xf86CVTMode(HDisplay, VDisplay, VRefresh, Reduced, Interlaced);
+
+ PrintComment(Mode, IsCVT, Reduced);
+ PrintModeline(Mode, HDisplay, VDisplay, VRefresh, Reduced);
+
+ return 0;
+}
diff --git a/xorg-server/hw/xfree86/utils/gtf/Makefile.am b/xorg-server/hw/xfree86/utils/gtf/Makefile.am
index d1a6d611c..0852541bd 100644
--- a/xorg-server/hw/xfree86/utils/gtf/Makefile.am
+++ b/xorg-server/hw/xfree86/utils/gtf/Makefile.am
@@ -1,44 +1,44 @@
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
-#
-# 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
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# 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 MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-# THE AUTHORS OR COPYRIGHT HOLDERS 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.
-#
-
-bin_PROGRAMS = gtf
-
-gtf_SOURCES = gtf.c
-gtf_CFLAGS = $(XORG_CFLAGS)
-gtf_LDADD = -lm
-
-appmandir = $(APP_MAN_DIR)
-
-appman_PRE = gtf.man
-appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@)
-
-include $(top_srcdir)/cpprules.in
-
-EXTRA_DIST = gtf.man.pre
-BUILT_SOURCES = $(appman_PRE)
-CLEANFILES = $(appman_PRE) $(appman_DATA)
-
-SUFFIXES += .$(APP_MAN_SUFFIX) .man
-
-.man.$(APP_MAN_SUFFIX):
- -$(AM_V_at)rm -f $@
- $(AM_V_at)$(LN_S) $< $@
+# Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+#
+# 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
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# 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 MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS 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.
+#
+
+bin_PROGRAMS = gtf
+
+gtf_SOURCES = gtf.c
+gtf_CFLAGS = $(XORG_CFLAGS)
+gtf_LDADD = -lm
+
+appmandir = $(APP_MAN_DIR)
+
+appman_PRE = gtf.man
+appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@)
+
+include $(top_srcdir)/cpprules.in
+
+EXTRA_DIST = gtf.man.pre
+BUILT_SOURCES = $(appman_PRE)
+CLEANFILES = $(appman_PRE) $(appman_DATA)
+
+SUFFIXES += .$(APP_MAN_SUFFIX) .man
+
+.man.$(APP_MAN_SUFFIX):
+ -$(AM_V_at)rm -f $@
+ $(AM_V_at)$(LN_S) $< $@
diff --git a/xorg-server/hw/xfree86/vbe/vbeModes.c b/xorg-server/hw/xfree86/vbe/vbeModes.c
index 5b69b0096..9ccbe6b51 100644
--- a/xorg-server/hw/xfree86/vbe/vbeModes.c
+++ b/xorg-server/hw/xfree86/vbe/vbeModes.c
@@ -356,8 +356,8 @@ VBESetModeNames(DisplayModePtr pMode)
pMode->VDisplay > 10000 || pMode->VDisplay < 0) {
pMode->name = strdup("BADMODE");
} else {
- pMode->name = xnfalloc(4 + 1 + 4 + 1);
- sprintf(pMode->name, "%dx%d", pMode->HDisplay, pMode->VDisplay);
+ XNFasprintf(&pMode->name, "%dx%d",
+ pMode->HDisplay, pMode->VDisplay);
}
}
pMode = pMode->next;
diff --git a/xorg-server/hw/xfree86/xaa/Makefile.am b/xorg-server/hw/xfree86/xaa/Makefile.am
index ccba713a6..fcbc53a73 100644
--- a/xorg-server/hw/xfree86/xaa/Makefile.am
+++ b/xorg-server/hw/xfree86/xaa/Makefile.am
@@ -25,40 +25,40 @@ libxaa_la_SOURCES = xaaInit.c xaaGC.c xaaInitAccel.c xaaFallback.c \
$(LSB_FIRST) $(MSB_FIRST) $(LSB_FIXED) $(MSB_FIXED) \
$(LSB_3_FIRST) $(MSB_3_FIRST) $(LSB_3_FIXED) $(MSB_3_FIXED)
${POLYSEG}:
- echo "#define POLYSEGMENT" > $@
- echo '#include "$(srcdir)/${@:s-%=%}"' >> $@
+ $(AM_V_GEN)echo "#define POLYSEGMENT" > $@
+ $(AM_V_GEN)echo '#include "$(srcdir)/${@:s-%=%}"' >> $@
${LSB_FIRST}:
- echo "#define LSBFIRST" > $@
- echo '#include "$(srcdir)/${@:l-%=%}"' >> $@
+ $(AM_V_GEN)echo "#define LSBFIRST" > $@
+ $(AM_V_GEN)echo '#include "$(srcdir)/${@:l-%=%}"' >> $@
${LSB_3_FIRST}:
- echo "#define LSBFIRST" > $@
- echo "#define TRIPLE_BITS" >> $@
- echo '#include "$(srcdir)/${@:l3-%=%}"' >> $@
+ $(AM_V_GEN)echo "#define LSBFIRST" > $@
+ $(AM_V_GEN)echo "#define TRIPLE_BITS" >> $@
+ $(AM_V_GEN)echo '#include "$(srcdir)/${@:l3-%=%}"' >> $@
${LSB_FIXED}:
- echo "#define LSBFIRST" > $@
- echo "#define FIXEDBASE" >> $@
- echo '#include "$(srcdir)/${@:lf-%=%}"' >> $@
+ $(AM_V_GEN)echo "#define LSBFIRST" > $@
+ $(AM_V_GEN)echo "#define FIXEDBASE" >> $@
+ $(AM_V_GEN)echo '#include "$(srcdir)/${@:lf-%=%}"' >> $@
${LSB_3_FIXED}:
- echo "#define LSBFIRST" > $@
- echo "#define TRIPLE_BITS" >> $@
- echo "#define FIXEDBASE" >> $@
- echo '#include "$(srcdir)/${@:lf3-%=%}"' >> $@
+ $(AM_V_GEN)echo "#define LSBFIRST" > $@
+ $(AM_V_GEN)echo "#define TRIPLE_BITS" >> $@
+ $(AM_V_GEN)echo "#define FIXEDBASE" >> $@
+ $(AM_V_GEN)echo '#include "$(srcdir)/${@:lf3-%=%}"' >> $@
${MSB_FIRST}:
- echo "#define MSBFIRST" > $@
- echo '#include "$(srcdir)/${@:m-%=%}"' >> $@
+ $(AM_V_GEN)echo "#define MSBFIRST" > $@
+ $(AM_V_GEN)echo '#include "$(srcdir)/${@:m-%=%}"' >> $@
${MSB_3_FIRST}:
- echo "#define MSBFIRST" > $@
- echo "#define TRIPLE_BITS" >> $@
- echo '#include "$(srcdir)/${@:m3-%=%}"' >> $@
+ $(AM_V_GEN)echo "#define MSBFIRST" > $@
+ $(AM_V_GEN)echo "#define TRIPLE_BITS" >> $@
+ $(AM_V_GEN)echo '#include "$(srcdir)/${@:m3-%=%}"' >> $@
${MSB_FIXED}:
- echo "#define MSBFIRST" > $@
- echo "#define FIXEDBASE" >> $@
- echo '#include "$(srcdir)/${@:mf-%=%}"' >> $@
+ $(AM_V_GEN)echo "#define MSBFIRST" > $@
+ $(AM_V_GEN)echo "#define FIXEDBASE" >> $@
+ $(AM_V_GEN)echo '#include "$(srcdir)/${@:mf-%=%}"' >> $@
${MSB_3_FIXED}:
- echo "#define MSBFIRST" > $@
- echo "#define TRIPLE_BITS" >> $@
- echo "#define FIXEDBASE" >> $@
- echo '#include "$(srcdir)/${@:mf3-%=%}"' >> $@
+ $(AM_V_GEN)echo "#define MSBFIRST" > $@
+ $(AM_V_GEN)echo "#define TRIPLE_BITS" >> $@
+ $(AM_V_GEN)echo "#define FIXEDBASE" >> $@
+ $(AM_V_GEN)echo '#include "$(srcdir)/${@:mf3-%=%}"' >> $@
DISTCLEANFILES = $(POLYSEG) \
$(LSB_FIRST) $(LSB_FIXED) $(MSB_FIRST) $(MSB_FIXED) \