Commit 1280f790 authored by Keith Packard's avatar Keith Packard

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
parent d319a0a6
......@@ -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;
}
......
......@@ -135,6 +135,7 @@ readKernelMapping(void)
k[j] = NoSymbol;
kbe.kb_table = tbl[j];
kbe.kb_value = 0;
if (ioctl(LinuxConsoleFd, KDGKBENT, &kbe))
continue;
......
......@@ -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);
......
......@@ -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;
}
}
}
......
......@@ -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;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment