aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xfree86/os-support/linux
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-04-16 09:17:34 +0200
committermarha <marha@users.sourceforge.net>2012-04-16 09:17:34 +0200
commitd6d3999ccb2cb72d55820770260172eccbbb68d7 (patch)
tree568ce82dd1a8e2edbbe8cd4cb5ab5b14157f34f6 /xorg-server/hw/xfree86/os-support/linux
parentfffd436e9c2ec6f5aa501ee57d0e4ade7293ee60 (diff)
downloadvcxsrv-d6d3999ccb2cb72d55820770260172eccbbb68d7.tar.gz
vcxsrv-d6d3999ccb2cb72d55820770260172eccbbb68d7.tar.bz2
vcxsrv-d6d3999ccb2cb72d55820770260172eccbbb68d7.zip
libX11 xserver pixman mesa git update 16 Apr 2012
Diffstat (limited to 'xorg-server/hw/xfree86/os-support/linux')
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/lnx_acpi.c118
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/lnx_bell.c2
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/lnx_ev56.c30
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/lnx_kmod.c127
4 files changed, 138 insertions, 139 deletions
diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_acpi.c b/xorg-server/hw/xfree86/os-support/linux/lnx_acpi.c
index 5fad19451..d98efa247 100644
--- a/xorg-server/hw/xfree86/os-support/linux/lnx_acpi.c
+++ b/xorg-server/hw/xfree86/os-support/linux/lnx_acpi.c
@@ -14,7 +14,7 @@
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
-
+
#define ACPI_SOCKET "/var/run/acpid.socket"
#define ACPI_VIDEO_NOTIFY_SWITCH 0x80
@@ -43,8 +43,8 @@ static CARD32
lnxACPIReopen(OsTimerPtr timer, CARD32 time, pointer arg)
{
if (lnxACPIOpen()) {
- TimerFree(timer);
- return 0;
+ TimerFree(timer);
+ return 0;
}
return ACPI_REOPEN_DELAY;
@@ -53,7 +53,7 @@ lnxACPIReopen(OsTimerPtr timer, CARD32 time, pointer arg)
#define LINE_LENGTH 80
static int
-lnxACPIGetEventFromOs(int fd, pmEvent *events, int num)
+lnxACPIGetEventFromOs(int fd, pmEvent * events, int num)
{
char ev[LINE_LENGTH];
int n;
@@ -61,59 +61,59 @@ lnxACPIGetEventFromOs(int fd, pmEvent *events, int num)
memset(ev, 0, LINE_LENGTH);
do {
- n = read( fd, ev, LINE_LENGTH );
+ n = read(fd, ev, LINE_LENGTH);
} while ((n == -1) && (errno == EAGAIN || errno == EINTR));
if (n <= 0) {
- lnxCloseACPI();
- TimerSet(NULL, 0, ACPI_REOPEN_DELAY, lnxACPIReopen, NULL);
- return 0;
+ lnxCloseACPI();
+ TimerSet(NULL, 0, ACPI_REOPEN_DELAY, lnxACPIReopen, NULL);
+ return 0;
}
/* FIXME: this only processes the first read ACPI event & might break
* with interrupted reads. */
-
+
/* Check that we have a video event */
if (!strncmp(ev, "video", 5)) {
- char *video = NULL;
- char *GFX = NULL;
- char *notify = NULL;
- char *data = NULL; /* doesn't appear to be used in the kernel */
- unsigned long int notify_l, data_l;
+ char *video = NULL;
+ char *GFX = NULL;
+ char *notify = NULL;
+ char *data = NULL; /* doesn't appear to be used in the kernel */
+ unsigned long int notify_l, data_l;
- video = strtok(ev, " ");
+ video = strtok(ev, " ");
- GFX = strtok(NULL, " ");
+ GFX = strtok(NULL, " ");
#if 0
- ErrorF("GFX: %s\n",GFX);
+ ErrorF("GFX: %s\n", GFX);
#endif
- notify = strtok(NULL, " ");
- notify_l = strtoul(notify, NULL, 16);
+ notify = strtok(NULL, " ");
+ notify_l = strtoul(notify, NULL, 16);
#if 0
- ErrorF("notify: 0x%lx\n",notify_l);
+ ErrorF("notify: 0x%lx\n", notify_l);
#endif
- data = strtok(NULL, " ");
- data_l = strtoul(data, NULL, 16);
+ data = strtok(NULL, " ");
+ data_l = strtoul(data, NULL, 16);
#if 0
- ErrorF("data: 0x%lx\n",data_l);
+ ErrorF("data: 0x%lx\n", data_l);
#endif
- /* Differentiate between events */
- switch (notify_l) {
- case ACPI_VIDEO_NOTIFY_SWITCH:
- case ACPI_VIDEO_NOTIFY_CYCLE:
- case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT:
- case ACPI_VIDEO_NOTIFY_PREV_OUTPUT:
- events[0] = XF86_APM_CAPABILITY_CHANGED;
- return 1;
- case ACPI_VIDEO_NOTIFY_PROBE:
- return 0;
- default:
- return 0;
- }
+ /* Differentiate between events */
+ switch (notify_l) {
+ case ACPI_VIDEO_NOTIFY_SWITCH:
+ case ACPI_VIDEO_NOTIFY_CYCLE:
+ case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT:
+ case ACPI_VIDEO_NOTIFY_PREV_OUTPUT:
+ events[0] = XF86_APM_CAPABILITY_CHANGED;
+ return 1;
+ case ACPI_VIDEO_NOTIFY_PROBE:
+ return 0;
+ default:
+ return 0;
+ }
}
-
+
return 0;
}
@@ -123,42 +123,42 @@ lnxACPIConfirmEventToOs(int fd, pmEvent event)
/* No ability to send back to the kernel in ACPI */
switch (event) {
default:
- return PM_NONE;
+ return PM_NONE;
}
}
PMClose
lnxACPIOpen(void)
{
- int fd;
+ int fd;
struct sockaddr_un addr;
int r = -1;
static int warned = 0;
DebugF("ACPI: OSPMOpen called\n");
if (ACPIihPtr || !xf86Info.pmFlag)
- return NULL;
-
+ return NULL;
+
DebugF("ACPI: Opening device\n");
if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) > -1) {
- memset(&addr, 0, sizeof(addr));
- addr.sun_family = AF_UNIX;
- strcpy(addr.sun_path, ACPI_SOCKET);
- if ((r = connect(fd, (struct sockaddr*)&addr, sizeof(addr))) == -1) {
- if (!warned)
- xf86MsgVerb(X_WARNING,3,"Open ACPI failed (%s) (%s)\n",
- ACPI_SOCKET, strerror(errno));
- warned = 1;
- shutdown(fd, 2);
- close(fd);
- return NULL;
- }
+ memset(&addr, 0, sizeof(addr));
+ addr.sun_family = AF_UNIX;
+ strcpy(addr.sun_path, ACPI_SOCKET);
+ if ((r = connect(fd, (struct sockaddr *) &addr, sizeof(addr))) == -1) {
+ if (!warned)
+ xf86MsgVerb(X_WARNING, 3, "Open ACPI failed (%s) (%s)\n",
+ ACPI_SOCKET, strerror(errno));
+ warned = 1;
+ shutdown(fd, 2);
+ close(fd);
+ return NULL;
+ }
}
xf86PMGetEventFromOs = lnxACPIGetEventFromOs;
xf86PMConfirmEventToOs = lnxACPIConfirmEventToOs;
- ACPIihPtr = xf86AddGeneralHandler(fd,xf86HandlePMEvents,NULL);
- xf86MsgVerb(X_INFO,3,"Open ACPI successful (%s)\n", ACPI_SOCKET);
+ ACPIihPtr = xf86AddGeneralHandler(fd, xf86HandlePMEvents, NULL);
+ xf86MsgVerb(X_INFO, 3, "Open ACPI successful (%s)\n", ACPI_SOCKET);
warned = 0;
return lnxCloseACPI;
@@ -171,9 +171,9 @@ lnxCloseACPI(void)
DebugF("ACPI: Closing device\n");
if (ACPIihPtr) {
- fd = xf86RemoveGeneralHandler(ACPIihPtr);
- shutdown(fd, 2);
- close(fd);
- ACPIihPtr = NULL;
+ fd = xf86RemoveGeneralHandler(ACPIihPtr);
+ shutdown(fd, 2);
+ close(fd);
+ ACPIihPtr = NULL;
}
}
diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_bell.c b/xorg-server/hw/xfree86/os-support/linux/lnx_bell.c
index 75cdd3ebc..e1d3cbf17 100644
--- a/xorg-server/hw/xfree86/os-support/linux/lnx_bell.c
+++ b/xorg-server/hw/xfree86/os-support/linux/lnx_bell.c
@@ -42,5 +42,5 @@ xf86OSRingBell(int loudness, int pitch, int duration)
ioctl(xf86Info.consoleFd, KDMKTONE,
((1193190 / pitch) & 0xffff) |
- (((unsigned long)duration * loudness / 50) << 16));
+ (((unsigned long) duration * loudness / 50) << 16));
}
diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_ev56.c b/xorg-server/hw/xfree86/os-support/linux/lnx_ev56.c
index cb3460d29..49950705a 100644
--- a/xorg-server/hw/xfree86/os-support/linux/lnx_ev56.c
+++ b/xorg-server/hw/xfree86/os-support/linux/lnx_ev56.c
@@ -10,74 +10,74 @@ int readDense8(pointer Base, register unsigned long Offset);
int readDense16(pointer Base, register unsigned long Offset);
int readDense32(pointer Base, register unsigned long Offset);
void
-writeDenseNB8(int Value, pointer Base, register unsigned long Offset);
+ writeDenseNB8(int Value, pointer Base, register unsigned long Offset);
void
-writeDenseNB16(int Value, pointer Base, register unsigned long Offset);
+ writeDenseNB16(int Value, pointer Base, register unsigned long Offset);
void
-writeDenseNB32(int Value, pointer Base, register unsigned long Offset);
+ writeDenseNB32(int Value, pointer Base, register unsigned long Offset);
void
-writeDense8(int Value, pointer Base, register unsigned long Offset);
+ writeDense8(int Value, pointer Base, register unsigned long Offset);
void
-writeDense16(int Value, pointer Base, register unsigned long Offset);
+ writeDense16(int Value, pointer Base, register unsigned long Offset);
void
-writeDense32(int Value, pointer Base, register unsigned long Offset);
+ writeDense32(int Value, pointer Base, register unsigned long Offset);
int
readDense8(pointer Base, register unsigned long Offset)
{
mem_barrier();
- return *(volatile CARD8*) ((unsigned long)Base+(Offset));
+ return *(volatile CARD8 *) ((unsigned long) Base + (Offset));
}
int
readDense16(pointer Base, register unsigned long Offset)
{
mem_barrier();
- return *(volatile CARD16*) ((unsigned long)Base+(Offset));
+ return *(volatile CARD16 *) ((unsigned long) Base + (Offset));
}
int
readDense32(pointer Base, register unsigned long Offset)
{
mem_barrier();
- return *(volatile CARD32*)((unsigned long)Base+(Offset));
+ return *(volatile CARD32 *) ((unsigned long) Base + (Offset));
}
void
writeDenseNB8(int Value, pointer Base, register unsigned long Offset)
{
- *(volatile CARD8*)((unsigned long)Base+(Offset)) = Value;
+ *(volatile CARD8 *) ((unsigned long) Base + (Offset)) = Value;
}
void
writeDenseNB16(int Value, pointer Base, register unsigned long Offset)
{
- *(volatile CARD16*)((unsigned long)Base + (Offset)) = Value;
+ *(volatile CARD16 *) ((unsigned long) Base + (Offset)) = Value;
}
void
writeDenseNB32(int Value, pointer Base, register unsigned long Offset)
{
- *(volatile CARD32*)((unsigned long)Base+(Offset)) = Value;
+ *(volatile CARD32 *) ((unsigned long) Base + (Offset)) = Value;
}
void
writeDense8(int Value, pointer Base, register unsigned long Offset)
{
write_mem_barrier();
- *(volatile CARD8 *)((unsigned long)Base+(Offset)) = Value;
+ *(volatile CARD8 *) ((unsigned long) Base + (Offset)) = Value;
}
void
writeDense16(int Value, pointer Base, register unsigned long Offset)
{
write_mem_barrier();
- *(volatile CARD16 *)((unsigned long)Base+(Offset)) = Value;
+ *(volatile CARD16 *) ((unsigned long) Base + (Offset)) = Value;
}
void
writeDense32(int Value, pointer Base, register unsigned long Offset)
{
write_mem_barrier();
- *(volatile CARD32 *)((unsigned long)Base+(Offset)) = Value;
+ *(volatile CARD32 *) ((unsigned long) Base + (Offset)) = Value;
}
diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_kmod.c b/xorg-server/hw/xfree86/os-support/linux/lnx_kmod.c
index 0b9493d27..0a17c2a81 100644
--- a/xorg-server/hw/xfree86/os-support/linux/lnx_kmod.c
+++ b/xorg-server/hw/xfree86/os-support/linux/lnx_kmod.c
@@ -11,11 +11,9 @@
#include "xf86_OSlib.h"
#include "xf86.h"
-
#define MODPROBE_PATH_FILE "/proc/sys/kernel/modprobe"
#define MAX_PATH 1024
-
#if 0
/* XFree86 #defines execl to be the xf86execl() function which does
* a fork AND exec. We don't want that. We want the regular,
@@ -26,7 +24,6 @@
#endif
#endif
-
/*
* Load a Linux kernel module.
* This is used by the DRI/DRM to load a DRM kernel module when
@@ -39,74 +36,76 @@
int
xf86LoadKernelModule(const char *modName)
{
- char mpPath[MAX_PATH] = "";
- int fd = -1, status, n;
- pid_t pid;
+ char mpPath[MAX_PATH] = "";
+ int fd = -1, status, n;
+ pid_t pid;
+
+ /* get the path to the modprobe program */
+ fd = open(MODPROBE_PATH_FILE, O_RDONLY);
+ if (fd >= 0) {
+ int count = read(fd, mpPath, MAX_PATH - 1);
+
+ if (count <= 0) {
+ mpPath[0] = 0;
+ }
+ else if (mpPath[count - 1] == '\n') {
+ mpPath[count - 1] = 0; /* replaces \n with \0 */
+ }
+ close(fd);
+ /* if this worked, mpPath will be "/sbin/modprobe" or similar. */
+ }
- /* get the path to the modprobe program */
- fd = open(MODPROBE_PATH_FILE, O_RDONLY);
- if (fd >= 0) {
- int count = read(fd, mpPath, MAX_PATH - 1);
- if (count <= 0) {
- mpPath[0] = 0;
- }
- else if (mpPath[count - 1] == '\n') {
- mpPath[count - 1] = 0; /* replaces \n with \0 */
- }
- close(fd);
- /* if this worked, mpPath will be "/sbin/modprobe" or similar. */
- }
+ if (mpPath[0] == 0) {
+ /* we failed to get the path from the system, use a default */
+ strcpy(mpPath, "/sbin/modprobe");
+ }
- if (mpPath[0] == 0) {
- /* we failed to get the path from the system, use a default */
- strcpy(mpPath, "/sbin/modprobe");
- }
+ /* now fork/exec the modprobe command */
+ /*
+ * It would be good to capture stdout/stderr so that it can be directed
+ * to the log file. modprobe errors currently are missing from the log
+ * file.
+ */
+ switch (pid = fork()) {
+ case 0: /* child */
+ /* change real/effective user ID to 0/0 as we need to
+ * preinstall agpgart module for some DRM modules
+ */
+ if (setreuid(0, 0)) {
+ xf86Msg(X_WARNING, "LoadKernelModule: "
+ "Setting of real/effective user Id to 0/0 failed");
+ }
+ setenv("PATH", "/sbin", 1);
+ n = execl(mpPath, "modprobe", modName, NULL);
+ xf86Msg(X_WARNING, "LoadKernelModule %s\n", strerror(errno));
+ exit(EXIT_FAILURE); /* if we get here the child's exec failed */
+ break;
+ case -1: /* fork failed */
+ return 0;
+ default: /* fork worked */
+ {
+ /* XXX we loop over waitpid() because it sometimes fails on
+ * the first attempt. Don't know why!
+ */
+ int count = 0, p;
- /* now fork/exec the modprobe command */
- /*
- * It would be good to capture stdout/stderr so that it can be directed
- * to the log file. modprobe errors currently are missing from the log
- * file.
- */
- switch (pid = fork()) {
- case 0: /* child */
- /* change real/effective user ID to 0/0 as we need to
- * preinstall agpgart module for some DRM modules
- */
- if (setreuid(0,0)) {
- xf86Msg(X_WARNING,"LoadKernelModule: "
- "Setting of real/effective user Id to 0/0 failed");
- }
- setenv("PATH","/sbin",1);
- n = execl(mpPath, "modprobe", modName, NULL);
- xf86Msg(X_WARNING,"LoadKernelModule %s\n",strerror(errno));
- exit(EXIT_FAILURE); /* if we get here the child's exec failed */
- break;
- case -1: /* fork failed */
- return 0;
- default: /* fork worked */
- {
- /* XXX we loop over waitpid() because it sometimes fails on
- * the first attempt. Don't know why!
- */
- int count = 0, p;
- do {
+ do {
p = waitpid(pid, &status, 0);
- } while (p == -1 && count++ < 4);
+ } while (p == -1 && count++ < 4);
- if (p == -1) {
+ if (p == -1) {
return 0;
- }
+ }
- if (WIFEXITED(status) && WEXITSTATUS(status) == 0) {
- return 1; /* success! */
- }
- else {
+ if (WIFEXITED(status) && WEXITSTATUS(status) == 0) {
+ return 1; /* success! */
+ }
+ else {
return 0;
- }
- }
- }
+ }
+ }
+ }
- /* never get here */
- return 0;
+ /* never get here */
+ return 0;
}