[xserver-commit] xserver/hw/kdrive/linux keyboard.c,1.14,1.15 linux.c,1.15,1.16 mouse.c,1.12,1.13

Keith Packard xserver-commit@pdx.freedesktop.org
Fri, 07 Nov 2003 15:29:31 -0800


Committed by: keithp

Update of /cvs/xserver/xserver/hw/kdrive/linux
In directory pdx:/tmp/cvs-serv8754/hw/kdrive/linux

Modified Files:
	keyboard.c linux.c mouse.c 
Log Message:
	* composite/compalloc.c: (compReportDamage), (compRedirectWindow),
	(compFreeClientWindow), (compFreeClientSubwindows),
	(compRedirectOneSubwindow), (compUnredirectOneSubwindow),
	(compAllocPixmap), (compFreePixmap), (compReallocPixmap):
	* composite/compext.c: (CompositeExtensionInit):
	* composite/compinit.c: (compScreenInit):
	* composite/compint.h:
	* composite/compwindow.c: (compCheckRedirect),
	(compReparentWindow), (compCopyWindow), (compDestroyWindow),
	(compSetRedirectBorderClip), (compGetRedirectBorderClip),
	(compWindowUpdateAutomatic), (compWindowUpdate):
	* fb/fb.h:
	* fb/fbpixmap.c: (fbCreatePixmapBpp):
	* fb/fbwindow.c: (fbCopyWindow):
	* hw/kdrive/fbdev/fbdev.c: (fbdevInitialize), (fbdevScreenInit):
	* hw/kdrive/linux/keyboard.c: (readKernelMapping):
	* hw/kdrive/linux/linux.c: (LinuxInit), (LinuxSpecialKey),
	(LinuxFini):
	* hw/kdrive/linux/mouse.c: (MouseWaitForReadable), (MouseReadByte),
	(ps2SkipInit), (MouseRead):
	* hw/kdrive/smi/smi.c: (smiScreenInit):
	* include/pixmapstr.h:
	* mi/mi.h:
	* mi/midispcur.c:
	* mi/mivaltree.c: (miRegisterRedirectBorderClipProc),
	(miComputeClips):
	* miext/damage/damage.c: (DamageDamageRegion):
	* miext/damage/damage.h:
	* render/mipict.c: (miValidatePicture):
	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


Index: keyboard.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/linux/keyboard.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- keyboard.c	2 Nov 2003 19:56:10 -0000	1.14
+++ keyboard.c	7 Nov 2003 23:29:29 -0000	1.15
@@ -135,6 +135,7 @@
 	    k[j] = NoSymbol;
 
 	    kbe.kb_table = tbl[j];
+	    kbe.kb_value = 0;
 	    if (ioctl(LinuxConsoleFd, KDGKBENT, &kbe))
 		continue;
 

Index: linux.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/linux/linux.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- linux.c	2 Nov 2003 19:56:10 -0000	1.15
+++ linux.c	7 Nov 2003 23:29:29 -0000	1.16
@@ -118,6 +118,7 @@
      * 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 @@
     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 @@
 	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 @@
     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);

Index: mouse.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/linux/mouse.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- mouse.c	2 Nov 2003 19:56:10 -0000	1.12
+++ mouse.c	7 Nov 2003 23:29:29 -0000	1.13
@@ -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 @@
     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 @@
     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 @@
     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 @@
 		timeout = 0;
 	    }
 	    else
-		timeout = 100;
+		timeout = MOUSE_TIMEOUT;
 	}
     }
 }