summaryrefslogtreecommitdiff
path: root/hw/dmx/dmxsync.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2012-03-21 12:55:09 -0700
committerKeith Packard <keithp@keithp.com>2012-03-21 13:54:42 -0700
commit9838b7032ea9792bec21af424c53c07078636d21 (patch)
treeb72d0827dac50f0f3b8eab29b3b7639546d735d7 /hw/dmx/dmxsync.c
parent75199129c603fc8567185ac31866c9518193cb78 (diff)
Introduce a consistent coding style
This is strictly the application of the script 'x-indent-all.sh' from util/modular. Compared to the patch that Daniel posted in January, I've added a few indent flags: -bap -psl -T PrivatePtr -T pmWait -T _XFUNCPROTOBEGIN -T _XFUNCPROTOEND -T _X_EXPORT The typedefs were needed to make the output of sdksyms.sh match the previous output, otherwise, the code is formatted badly enough that sdksyms.sh generates incorrect output. The generated code was compared with the previous version and found to be essentially identical -- "assert" line numbers and BUILD_TIME were the only differences found. The comparison was done with this script: dir1=$1 dir2=$2 for dir in $dir1 $dir2; do (cd $dir && find . -name '*.o' | while read file; do dir=`dirname $file` base=`basename $file .o` dump=$dir/$base.dump objdump -d $file > $dump done) done find $dir1 -name '*.dump' | while read dump; do otherdump=`echo $dump | sed "s;$dir1;$dir2;"` diff -u $dump $otherdump done Signed-off-by: Keith Packard <keithp@keithp.com> Acked-by: Daniel Stone <daniel@fooishbar.org> Acked-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'hw/dmx/dmxsync.c')
-rw-r--r--hw/dmx/dmxsync.c78
1 files changed, 46 insertions, 32 deletions
diff --git a/hw/dmx/dmxsync.c b/hw/dmx/dmxsync.c
index 2c7ccb837..bf28584b4 100644
--- a/hw/dmx/dmxsync.c
+++ b/hw/dmx/dmxsync.c
@@ -56,22 +56,24 @@
#include "dmxlog.h"
#include <sys/time.h>
-static int dmxSyncInterval = 100; /* Default interval in milliseconds */
+static int dmxSyncInterval = 100; /* Default interval in milliseconds */
static OsTimerPtr dmxSyncTimer;
-static int dmxSyncPending;
+static int dmxSyncPending;
-static void dmxDoSync(DMXScreenInfo *dmxScreen)
+static void
+dmxDoSync(DMXScreenInfo * dmxScreen)
{
dmxScreen->needsSync = FALSE;
if (!dmxScreen->beDisplay)
- return; /* FIXME: Is this correct behavior for sync stats? */
+ return; /* FIXME: Is this correct behavior for sync stats? */
if (!dmxStatInterval) {
XSync(dmxScreen->beDisplay, False);
- } else {
+ }
+ else {
struct timeval start, stop;
-
+
gettimeofday(&start, 0);
XSync(dmxScreen->beDisplay, False);
gettimeofday(&stop, 0);
@@ -79,28 +81,31 @@ static void dmxDoSync(DMXScreenInfo *dmxScreen)
}
}
-static CARD32 dmxSyncCallback(OsTimerPtr timer, CARD32 time, pointer arg)
+static CARD32
+dmxSyncCallback(OsTimerPtr timer, CARD32 time, pointer arg)
{
- int i;
+ int i;
if (dmxSyncPending) {
for (i = 0; i < dmxNumScreens; i++) {
DMXScreenInfo *dmxScreen = &dmxScreens[i];
- if (dmxScreen->needsSync) dmxDoSync(dmxScreen);
+
+ if (dmxScreen->needsSync)
+ dmxDoSync(dmxScreen);
}
}
dmxSyncPending = 0;
return 0; /* Do not place on queue again */
}
-static void dmxSyncBlockHandler(pointer blockData, OSTimePtr pTimeout,
- pointer pReadMask)
+static void
+dmxSyncBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadMask)
{
TimerForce(dmxSyncTimer);
}
-static void dmxSyncWakeupHandler(pointer blockData, int result,
- pointer pReadMask)
+static void
+dmxSyncWakeupHandler(pointer blockData, int result, pointer pReadMask)
{
}
@@ -112,24 +117,27 @@ static void dmxSyncWakeupHandler(pointer blockData, int result,
*
* Note that the parameter to this routine is a string, since it will
* usually be called from #ddxProcessArgument in \a dmxinit.c */
-void dmxSyncActivate(const char *interval)
+void
+dmxSyncActivate(const char *interval)
{
dmxSyncInterval = (interval ? atoi(interval) : 100);
- if (dmxSyncInterval < 0) dmxSyncInterval = 0;
+ if (dmxSyncInterval < 0)
+ dmxSyncInterval = 0;
}
/** Initialize the XSync() batching optimization, but only if
* #dmxSyncActivate was last called with a non-negative value. */
-void dmxSyncInit(void)
+void
+dmxSyncInit(void)
{
if (dmxSyncInterval) {
RegisterBlockAndWakeupHandlers(dmxSyncBlockHandler,
- dmxSyncWakeupHandler,
- NULL);
+ dmxSyncWakeupHandler, NULL);
dmxLog(dmxInfo, "XSync batching with %d ms interval\n",
dmxSyncInterval);
- } else {
+ }
+ else {
dmxLog(dmxInfo, "XSync batching disabled\n");
}
}
@@ -147,7 +155,8 @@ void dmxSyncInit(void)
* If \a dmxScreen is \a NULL, then all pending syncs will be flushed
* immediately.
*/
-void dmxSync(DMXScreenInfo *dmxScreen, Bool now)
+void
+dmxSync(DMXScreenInfo * dmxScreen, Bool now)
{
static unsigned long dmxGeneration = 0;
@@ -159,35 +168,40 @@ void dmxSync(DMXScreenInfo *dmxScreen, Bool now)
* 2) freed, if it was on a queue (dmxSyncPending != 0), or
* 3) allocated, if it wasn't on a queue (dmxSyncPending == 0)
*/
- if (dmxSyncTimer && !dmxSyncPending) free(dmxSyncTimer);
- dmxSyncTimer = NULL;
- now = TRUE;
+ if (dmxSyncTimer && !dmxSyncPending)
+ free(dmxSyncTimer);
+ dmxSyncTimer = NULL;
+ now = TRUE;
dmxGeneration = serverGeneration;
}
- /* Queue sync */
+ /* Queue sync */
if (dmxScreen) {
dmxScreen->needsSync = TRUE;
++dmxSyncPending;
}
- /* Do sync or set time for later */
+ /* Do sync or set time for later */
if (now || !dmxScreen) {
- if (!TimerForce(dmxSyncTimer)) dmxSyncCallback(NULL, 0, NULL);
+ if (!TimerForce(dmxSyncTimer))
+ dmxSyncCallback(NULL, 0, NULL);
/* At this point, dmxSyncPending == 0 because
* dmxSyncCallback must have been called. */
if (dmxSyncPending)
dmxLog(dmxFatal, "dmxSync(%s,%d): dmxSyncPending = %d\n",
dmxScreen ? dmxScreen->name : "", now, dmxSyncPending);
- } else {
+ }
+ else {
dmxScreen->needsSync = TRUE;
if (dmxSyncPending == 1)
dmxSyncTimer = TimerSet(dmxSyncTimer, 0, dmxSyncInterval,
dmxSyncCallback, NULL);
}
- } else {
- /* If dmxSyncInterval is not being used,
- * then all the backends are already
- * up-to-date. */
- if (dmxScreen) dmxDoSync(dmxScreen);
+ }
+ else {
+ /* If dmxSyncInterval is not being used,
+ * then all the backends are already
+ * up-to-date. */
+ if (dmxScreen)
+ dmxDoSync(dmxScreen);
}
}