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
This commit is contained in:
Keith Packard 2003-11-07 23:29:29 +00:00
parent d319a0a610
commit 1280f79054
5 changed files with 43 additions and 15 deletions

View File

@ -40,11 +40,15 @@ fbdevInitialize (KdCardInfo *card, FbdevPriv *priv)
perror("Error opening /dev/fb0\n"); perror("Error opening /dev/fb0\n");
return FALSE; return FALSE;
} }
/* quiet valgrind */
memset (&priv->fix, '\0', sizeof (priv->fix));
if ((k=ioctl(priv->fd, FBIOGET_FSCREENINFO, &priv->fix)) < 0) { if ((k=ioctl(priv->fd, FBIOGET_FSCREENINFO, &priv->fix)) < 0) {
perror("Error with /dev/fb ioctl FIOGET_FSCREENINFO"); perror("Error with /dev/fb ioctl FIOGET_FSCREENINFO");
close (priv->fd); close (priv->fd);
return FALSE; return FALSE;
} }
/* quiet valgrind */
memset (&priv->var, '\0', sizeof (priv->var));
if ((k=ioctl(priv->fd, FBIOGET_VSCREENINFO, &priv->var)) < 0) { if ((k=ioctl(priv->fd, FBIOGET_VSCREENINFO, &priv->var)) < 0) {
perror("Error with /dev/fb ioctl FIOGET_VSCREENINFO"); perror("Error with /dev/fb ioctl FIOGET_VSCREENINFO");
close (priv->fd); close (priv->fd);
@ -197,12 +201,13 @@ fbdevScreenInit (KdScreenInfo *screen)
if (!scrpriv) if (!scrpriv)
return FALSE; return FALSE;
memset (scrpriv, '\0', sizeof (FbdevScrPriv)); memset (scrpriv, '\0', sizeof (FbdevScrPriv));
screen->driver = scrpriv;
if (!fbdevScreenInitialize (screen, scrpriv)) if (!fbdevScreenInitialize (screen, scrpriv))
{ {
screen->driver = 0;
xfree (scrpriv); xfree (scrpriv);
return FALSE; return FALSE;
} }
screen->driver = scrpriv;
return TRUE; return TRUE;
} }

View File

@ -135,6 +135,7 @@ readKernelMapping(void)
k[j] = NoSymbol; k[j] = NoSymbol;
kbe.kb_table = tbl[j]; kbe.kb_table = tbl[j];
kbe.kb_value = 0;
if (ioctl(LinuxConsoleFd, KDGKBENT, &kbe)) if (ioctl(LinuxConsoleFd, KDGKBENT, &kbe))
continue; continue;

View File

@ -118,6 +118,7 @@ LinuxInit (void)
* Linux doesn't switch to an active vt after the last close of a vt, * 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. * so we do this ourselves by remembering which is active now.
*/ */
memset (&vts, '\0', sizeof (vts)); /* valgrind */
if (ioctl(LinuxConsoleFd, VT_GETSTATE, &vts) == 0) if (ioctl(LinuxConsoleFd, VT_GETSTATE, &vts) == 0)
{ {
activeVT = vts.v_active; activeVT = vts.v_active;
@ -376,6 +377,7 @@ LinuxSpecialKey (KeySym sym)
if (XK_F1 <= sym && sym <= XK_F12) if (XK_F1 <= sym && sym <= XK_F12)
{ {
con = sym - XK_F1 + 1; con = sym - XK_F1 + 1;
memset (&vts, '\0', sizeof (vts)); /* valgrind */
ioctl (LinuxConsoleFd, VT_GETSTATE, &vts); ioctl (LinuxConsoleFd, VT_GETSTATE, &vts);
if (con != vts.v_active && (vts.v_state & (1 << con))) if (con != vts.v_active && (vts.v_state & (1 << con)))
{ {
@ -420,6 +422,7 @@ LinuxFini (void)
VT.mode = VT_AUTO; VT.mode = VT_AUTO;
ioctl(LinuxConsoleFd, VT_SETMODE, &VT); /* set dflt vt handling */ ioctl(LinuxConsoleFd, VT_SETMODE, &VT); /* set dflt vt handling */
} }
memset (&vts, '\0', sizeof (vts)); /* valgrind */
ioctl (LinuxConsoleFd, VT_GETSTATE, &vts); ioctl (LinuxConsoleFd, VT_GETSTATE, &vts);
/* /*
* Find a legal VT to switch to, either the one we started from * 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); fd = open ("/dev/tty0", O_RDWR|O_NDELAY, 0);
if (fd >= 0) if (fd >= 0)
{ {
memset (&vts, '\0', sizeof (vts)); /* valgrind */
ioctl (fd, VT_GETSTATE, &vts); ioctl (fd, VT_GETSTATE, &vts);
if (ioctl (fd, VT_DISALLOCATE, vtno) < 0) if (ioctl (fd, VT_DISALLOCATE, vtno) < 0)
fprintf (stderr, "Can't deallocate console %d errno %d\n", vtno, errno); fprintf (stderr, "Can't deallocate console %d errno %d\n", vtno, errno);

View File

@ -38,6 +38,7 @@
#undef DEBUG #undef DEBUG
#undef DEBUG_BYTES #undef DEBUG_BYTES
#define KBUFIO_SIZE 256 #define KBUFIO_SIZE 256
#define MOUSE_TIMEOUT 100
typedef struct _kbufio { typedef struct _kbufio {
int fd; int fd;
@ -52,20 +53,32 @@ MouseWaitForReadable (int fd, int timeout)
fd_set set; fd_set set;
struct timeval tv, *tp; struct timeval tv, *tp;
int n; int n;
CARD32 done;
FD_ZERO (&set); done = GetTimeInMillis () + timeout;
FD_SET (fd, &set); for (;;)
if (timeout == -1)
tp = 0;
else
{ {
tv.tv_sec = timeout / 1000; FD_ZERO (&set);
tv.tv_usec = (timeout % 1000) * 1000; FD_SET (fd, &set);
tp = &tv; 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; return FALSE;
} }
@ -76,7 +89,12 @@ MouseReadByte (Kbufio *b, int timeout)
if (b->avail <= b->used) if (b->avail <= b->used)
{ {
if (timeout && !MouseWaitForReadable (b->fd, timeout)) if (timeout && !MouseWaitForReadable (b->fd, timeout))
{
#ifdef DEBUG_BYTES
ErrorF ("\tTimeout %d\n", timeout);
#endif
return -1; return -1;
}
n = read (b->fd, b->buf, KBUFIO_SIZE); n = read (b->fd, b->buf, KBUFIO_SIZE);
if (n <= 0) if (n <= 0)
return -1; return -1;
@ -443,7 +461,7 @@ ps2SkipInit (KdMouseInfo *mi, int ninit, Bool ret_next)
waiting = FALSE; waiting = FALSE;
while (ninit || ret_next) while (ninit || ret_next)
{ {
c = MouseReadByte (&km->iob, 100); c = MouseReadByte (&km->iob, MOUSE_TIMEOUT);
if (c == -1) if (c == -1)
break; break;
/* look for ACK */ /* look for ACK */
@ -895,7 +913,7 @@ MouseRead (int mousePort, void *closure)
timeout = 0; timeout = 0;
} }
else else
timeout = 100; timeout = MOUSE_TIMEOUT;
} }
} }
} }

View File

@ -62,6 +62,7 @@ smiScreenInit (KdScreenInfo *screen)
if (!smis) if (!smis)
return FALSE; return FALSE;
memset (smis, '\0', sizeof (SmiScreenInfo)); memset (smis, '\0', sizeof (SmiScreenInfo));
screen->driver = smis;
if (!subScreenInitialize (screen, &smis->sub)) if (!subScreenInitialize (screen, &smis->sub))
{ {
xfree (smis); xfree (smis);
@ -75,7 +76,6 @@ smiScreenInit (KdScreenInfo *screen)
#else #else
smis->screen = smic->sub.fb; smis->screen = smic->sub.fb;
#endif #endif
screen->driver = smis;
LEAVE(); LEAVE();
return TRUE; return TRUE;
} }