diff options
author | Keith Packard <keithp@keithp.com> | 2003-11-07 23:29:29 +0000 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2003-11-07 23:29:29 +0000 |
commit | 1280f79054dc16ccf321006cd2de53e0f53c7b70 (patch) | |
tree | ac4407e62100fdefc489561c85926cc913ea8572 | |
parent | d319a0a610c90524ad29cab3c6d4d21b5298fc7f (diff) |
Ok, Composite extension is semi-working; when no-one asks for redirection,
the server seems to act as before. With RedirectSubwindows (root,
automatic), the server looks just like a regular X server. Now to go
rewrite the (currently lame) compositing manager to get some real
action on the screen.
Some of the fixes here are to make valgrind quiet with various ioctls used
by kdrive/linux.
Also fixed a bug where fbdev initialization was out of order in fbdev.c and
smi.c
-rw-r--r-- | hw/kdrive/fbdev/fbdev.c | 7 | ||||
-rw-r--r-- | hw/kdrive/linux/keyboard.c | 1 | ||||
-rw-r--r-- | hw/kdrive/linux/linux.c | 4 | ||||
-rw-r--r-- | hw/kdrive/linux/mouse.c | 44 | ||||
-rw-r--r-- | hw/kdrive/smi/smi.c | 2 |
5 files changed, 43 insertions, 15 deletions
diff --git a/hw/kdrive/fbdev/fbdev.c b/hw/kdrive/fbdev/fbdev.c index cb0a1b399..113584070 100644 --- a/hw/kdrive/fbdev/fbdev.c +++ b/hw/kdrive/fbdev/fbdev.c @@ -40,11 +40,15 @@ fbdevInitialize (KdCardInfo *card, FbdevPriv *priv) perror("Error opening /dev/fb0\n"); return FALSE; } + /* quiet valgrind */ + memset (&priv->fix, '\0', sizeof (priv->fix)); if ((k=ioctl(priv->fd, FBIOGET_FSCREENINFO, &priv->fix)) < 0) { perror("Error with /dev/fb ioctl FIOGET_FSCREENINFO"); close (priv->fd); return FALSE; } + /* quiet valgrind */ + memset (&priv->var, '\0', sizeof (priv->var)); if ((k=ioctl(priv->fd, FBIOGET_VSCREENINFO, &priv->var)) < 0) { perror("Error with /dev/fb ioctl FIOGET_VSCREENINFO"); close (priv->fd); @@ -197,12 +201,13 @@ fbdevScreenInit (KdScreenInfo *screen) if (!scrpriv) return FALSE; memset (scrpriv, '\0', sizeof (FbdevScrPriv)); + screen->driver = scrpriv; if (!fbdevScreenInitialize (screen, scrpriv)) { + screen->driver = 0; xfree (scrpriv); return FALSE; } - screen->driver = scrpriv; return TRUE; } diff --git a/hw/kdrive/linux/keyboard.c b/hw/kdrive/linux/keyboard.c index dba87a00d..27757c3dd 100644 --- a/hw/kdrive/linux/keyboard.c +++ b/hw/kdrive/linux/keyboard.c @@ -135,6 +135,7 @@ readKernelMapping(void) k[j] = NoSymbol; kbe.kb_table = tbl[j]; + kbe.kb_value = 0; if (ioctl(LinuxConsoleFd, KDGKBENT, &kbe)) continue; diff --git a/hw/kdrive/linux/linux.c b/hw/kdrive/linux/linux.c index 2badebebe..555102925 100644 --- a/hw/kdrive/linux/linux.c +++ b/hw/kdrive/linux/linux.c @@ -118,6 +118,7 @@ LinuxInit (void) * Linux doesn't switch to an active vt after the last close of a vt, * so we do this ourselves by remembering which is active now. */ + memset (&vts, '\0', sizeof (vts)); /* valgrind */ if (ioctl(LinuxConsoleFd, VT_GETSTATE, &vts) == 0) { activeVT = vts.v_active; @@ -376,6 +377,7 @@ LinuxSpecialKey (KeySym sym) if (XK_F1 <= sym && sym <= XK_F12) { con = sym - XK_F1 + 1; + memset (&vts, '\0', sizeof (vts)); /* valgrind */ ioctl (LinuxConsoleFd, VT_GETSTATE, &vts); if (con != vts.v_active && (vts.v_state & (1 << con))) { @@ -420,6 +422,7 @@ LinuxFini (void) VT.mode = VT_AUTO; ioctl(LinuxConsoleFd, VT_SETMODE, &VT); /* set dflt vt handling */ } + memset (&vts, '\0', sizeof (vts)); /* valgrind */ ioctl (LinuxConsoleFd, VT_GETSTATE, &vts); /* * Find a legal VT to switch to, either the one we started from @@ -448,6 +451,7 @@ LinuxFini (void) fd = open ("/dev/tty0", O_RDWR|O_NDELAY, 0); if (fd >= 0) { + memset (&vts, '\0', sizeof (vts)); /* valgrind */ ioctl (fd, VT_GETSTATE, &vts); if (ioctl (fd, VT_DISALLOCATE, vtno) < 0) fprintf (stderr, "Can't deallocate console %d errno %d\n", vtno, errno); diff --git a/hw/kdrive/linux/mouse.c b/hw/kdrive/linux/mouse.c index 689c7e9e7..1faffd27b 100644 --- a/hw/kdrive/linux/mouse.c +++ b/hw/kdrive/linux/mouse.c @@ -38,6 +38,7 @@ #undef DEBUG #undef DEBUG_BYTES #define KBUFIO_SIZE 256 +#define MOUSE_TIMEOUT 100 typedef struct _kbufio { int fd; @@ -52,20 +53,32 @@ MouseWaitForReadable (int fd, int timeout) fd_set set; struct timeval tv, *tp; int n; + CARD32 done; - FD_ZERO (&set); - FD_SET (fd, &set); - if (timeout == -1) - tp = 0; - else + done = GetTimeInMillis () + timeout; + for (;;) { - tv.tv_sec = timeout / 1000; - tv.tv_usec = (timeout % 1000) * 1000; - tp = &tv; + FD_ZERO (&set); + FD_SET (fd, &set); + if (timeout == -1) + tp = 0; + else + { + tv.tv_sec = timeout / 1000; + tv.tv_usec = (timeout % 1000) * 1000; + tp = &tv; + } + n = select (fd + 1, &set, 0, 0, tp); + if (n > 0) + return TRUE; + if (n < 0 && (errno == EAGAIN || errno == EINTR)) + { + timeout = (int) (done - GetTimeInMillis ()); + if (timeout > 0) + continue; + } + break; } - n = select (fd + 1, &set, 0, 0, tp); - if (n > 0) - return TRUE; return FALSE; } @@ -76,7 +89,12 @@ MouseReadByte (Kbufio *b, int timeout) if (b->avail <= b->used) { if (timeout && !MouseWaitForReadable (b->fd, timeout)) + { +#ifdef DEBUG_BYTES + ErrorF ("\tTimeout %d\n", timeout); +#endif return -1; + } n = read (b->fd, b->buf, KBUFIO_SIZE); if (n <= 0) return -1; @@ -443,7 +461,7 @@ ps2SkipInit (KdMouseInfo *mi, int ninit, Bool ret_next) waiting = FALSE; while (ninit || ret_next) { - c = MouseReadByte (&km->iob, 100); + c = MouseReadByte (&km->iob, MOUSE_TIMEOUT); if (c == -1) break; /* look for ACK */ @@ -895,7 +913,7 @@ MouseRead (int mousePort, void *closure) timeout = 0; } else - timeout = 100; + timeout = MOUSE_TIMEOUT; } } } diff --git a/hw/kdrive/smi/smi.c b/hw/kdrive/smi/smi.c index aaa0b8356..635fca4da 100644 --- a/hw/kdrive/smi/smi.c +++ b/hw/kdrive/smi/smi.c @@ -62,6 +62,7 @@ smiScreenInit (KdScreenInfo *screen) if (!smis) return FALSE; memset (smis, '\0', sizeof (SmiScreenInfo)); + screen->driver = smis; if (!subScreenInitialize (screen, &smis->sub)) { xfree (smis); @@ -75,7 +76,6 @@ smiScreenInit (KdScreenInfo *screen) #else smis->screen = smic->sub.fb; #endif - screen->driver = smis; LEAVE(); return TRUE; } |