xserver/hw/xgl/egl Makefile.am, 1.3, 1.4 evdev.c, 1.3, 1.4 kinput.c, 1.1, 1.2 xegl.c, 1.5, 1.6 xegl.h, 1.1, 1.2 xeglinit.c, NONE, 1.1

Dave Airlie xserver-commit at pdx.freedesktop.org
Thu Dec 22 18:08:00 PST 2005


Committed by: airlied

Update of /cvs/xserver/xserver/hw/xgl/egl
In directory gabe:/tmp/cvs-serv19869/hw/xgl/egl

Modified Files:
	Makefile.am evdev.c kinput.c xegl.c xegl.h 
Added Files:
	xeglinit.c 
Log Message:
Well there were a couple of snapshots later than CVS available outside of 
Novell, so I've done a crazy merge to try and get them into a workable 
CVS, I suspect I may have failed.. there is a pre-xgldrop-merge tag if I did.


Index: Makefile.am
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/egl/Makefile.am,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- Makefile.am	13 Jun 2005 16:38:06 -0000	1.3
+++ Makefile.am	23 Dec 2005 02:07:58 -0000	1.4
@@ -1,22 +1,37 @@
+if XGLSERVER
+MODULE_SUBDIRS = module
+endif
+
+SUBDIRS =		  \
+	.		  \
+	$(MODULE_SUBDIRS)
+
 INCLUDES =		    \
-	@XGL_INCS@	    \
+	@XEGL_INCS@	    \
 	@XSERVER_CFLAGS@    \
-	@XGLXSERVER_CFLAGS@
+	@XGLSERVER_CFLAGS@  \
+	@XEGLSERVER_CFLAGS@
 
-bin_PROGRAMS = Xegl
+noinst_LTLIBRARIES = libxegl.la
 
-Xegl_SOURCES =	    \
-	xegl.h	    \
-	xegl.c	    \
-	xeglinput.c \
-	kkeymap.h   \
-	kinput.c    \
+libxegl_la_SOURCES = \
+	xegl.h	     \
+	xegl.c	     \
+	xeglinput.c  \
+	kkeymap.h    \
+	kinput.c     \
 	evdev.c
 
-Xegl_LDADD =		  \
-	@XGL_LIBS@	  \
-	@XSERVER_LIBS@	  \
+if XEGLSERVER
+Xegl_DEPENDENCIES = @XEGL_LIBS@
+Xegl_LDFLAGS	  = -export-dynamic
+Xegl_SOURCES	  = xeglinit.c
+Xegl_LDADD	  =	  \
+	@XEGL_LIBS@	  \
+	@XSERVER_LIBS@    \
+	@XGLSERVER_LIBS@  \
 	@XEGLSERVER_LIBS@
+Xegl_programs	  = Xegl
+endif
 
-Xegl_DEPENDENCIES = @XGL_LIBS@
-
+bin_PROGRAMS = $(Xegl_programs)

Index: evdev.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/egl/evdev.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- evdev.c	15 Aug 2005 08:24:45 -0000	1.3
+++ evdev.c	23 Dec 2005 02:07:58 -0000	1.4
@@ -112,7 +112,7 @@
 {
     KdMouseInfo		*mi = closure;
     Kevdev		*ke = mi->driver;
-    int			i, n;
+    int			i, n, f = 0;
     struct input_event	events[NUM_EVENTS];
 
     n = read (evdevPort, &events, NUM_EVENTS * sizeof (struct input_event));
@@ -131,46 +131,26 @@
 		ErrorF ("key %d %d\n", events[i].code, events[i].value);
 	    else
 		ErrorF ("key 0x%x %d\n", events[i].code, events[i].value);
-	    
-	    if (events[i].value==1) {
-	      switch (events[i].code) {
-	      case BTN_LEFT:
-                flags |= KD_BUTTON_1;
-                break;
-	      case BTN_RIGHT:
-		flags |= KD_BUTTON_3;
-                break;
-	      case BTN_MIDDLE:
-                flags |= KD_BUTTON_2;
-                break;
-	      case BTN_FORWARD:
-                flags |= KD_BUTTON_4;
-                break;
-	      case BTN_BACK:
-                flags |= KD_BUTTON_5;
-                break;
-	      }
-	    }
-	    else if (events[i].value==0) {
-	      switch (events[i].code) {
-	      case BTN_LEFT:
-                flags &= ~KD_BUTTON_1;
+            switch (events[i].code) {
+            case BTN_LEFT:
+                f = KD_BUTTON_1;
                 break;
-	      case BTN_RIGHT:
-		flags &= ~KD_BUTTON_3;
+            case BTN_RIGHT:
+                f = KD_BUTTON_2;
                 break;
-	      case BTN_MIDDLE:
-                flags &= ~KD_BUTTON_2;
+            case BTN_MIDDLE:
+                f = KD_BUTTON_3;
                 break;
-	      case BTN_FORWARD:
-                flags &= ~KD_BUTTON_4;
+            case BTN_FORWARD:
+                f = KD_BUTTON_4;
                 break;
-	      case BTN_BACK:
-                flags &= ~KD_BUTTON_5;
+            case BTN_BACK:
+                f = KD_BUTTON_5;
                 break;
-	      }
-	    }
-	    KdEnqueueMouseEvent (mi, KD_MOUSE_DELTA | flags, 0, 0);
+            }
+            flags |= f;
+            KdEnqueueMouseEvent (mi, KD_MOUSE_DELTA | flags, 0, 0);
+            ErrorF("Flags is %x\n", flags);
 	    break;
 	case EV_REL:
 	    ke->rel[events[i].code] += events[i].value;
@@ -186,12 +166,12 @@
 int EvdevInputType;
 
 char *kdefaultEvdev[] =  {
-  //    "/dev/input/event0",
-    "/dev/input/event1",
-    //   "/dev/input/event2",
-    // "/dev/input/event3",
-    //    "/dev/input/event4",
-    //   "/dev/input/event5",
+//    "/dev/input/event0",
+//    "/dev/input/event1",
+//    "/dev/input/event2",
+//    "/dev/input/event3",
+//    "/dev/input/event4",
+    "/dev/input/event5",
 };
 
 #define NUM_DEFAULT_EVDEV    (sizeof (kdefaultEvdev) / sizeof (kdefaultEvdev[0]))
@@ -497,12 +477,12 @@
 }
 
 char *kdefaultEvdev1[] =  {
-    "/dev/input/event0",
-    //    "/dev/input/event1",
-    //    "/dev/input/event2",
-    //    "/dev/input/event3",
-    //    "/dev/input/event4",
-    //    "/dev/input/event5",
+//    "/dev/input/event0",
+//    "/dev/input/event1",
+//    "/dev/input/event2",
+    "/dev/input/event3",
+//    "/dev/input/event4",
+//    "/dev/input/event5",
 };
 
 #define NUM_DEFAULT_EVDEV1    (sizeof (kdefaultEvdev1) / sizeof (kdefaultEvdev1[0]))

Index: kinput.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/egl/kinput.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- kinput.c	4 Jun 2005 23:33:03 -0000	1.1
+++ kinput.c	23 Dec 2005 02:07:58 -0000	1.2
@@ -30,7 +30,6 @@
 #include <signal.h>
 #include <stdio.h>
 
-#include "xgl.h"
 #include "xegl.h"
 #include "mipointer.h"
 #include "inputstr.h"
@@ -348,7 +347,7 @@
 }
 
 Bool
-LegalModifier(unsigned int key, DevicePtr pDev)
+KdLegalModifier(unsigned int key, DevicePtr pDev)
 {
     return TRUE;
 }
@@ -1518,12 +1517,10 @@
 }
 
 void
-KdWakeupHandler (int		screen,
-		 pointer    	data,
-		 unsigned long	lresult,
-		 pointer	readmask)
+KdWakeupHandler (pointer data,
+		 int	 result,
+		 pointer readmask)
 {
-    int		result = (int) lresult;
     fd_set	*pReadmask = (fd_set *) readmask;
     int		i;
     KdMouseInfo	*mi;
@@ -1555,7 +1552,7 @@
 //      kdProcessSwitch ();
 }
 
-#define KdScreenOrigin(pScreen) (&(KdGetScreenPriv(pScreen)->screen->origin))
+#define KdScreenOrigin(pScreen) (&(KdGetScreenPriv (pScreen)->origin))
 
 static Bool
 KdCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
@@ -1673,7 +1670,7 @@
 };
 
 void
-ProcessInputEvents ()
+KdProcessInputEvents (void)
 {
     mieqProcessInputEvents();
     miPointerUpdate();

Index: xegl.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/egl/xegl.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- xegl.c	23 Dec 2005 00:08:35 -0000	1.5
+++ xegl.c	23 Dec 2005 02:07:58 -0000	1.6
@@ -33,7 +33,6 @@
 
 #include <glitz-egl.h>
 
-#include "xgl.h"
 #include "inputstr.h"
 #include "cursorstr.h"
 #include "mipointer.h"
@@ -46,7 +45,7 @@
 int xeglScreenGeneration = -1;
 int xeglScreenPrivateIndex;
 
-#define XEGL_GET_SCREEN_PRIV(pScreen) 				         \
+#define XEGL_GET_SCREEN_PRIV(pScreen)				         \
     ((xeglScreenPtr) (pScreen)->devPrivates[xeglScreenPrivateIndex].ptr)
 
 #define XEGL_SET_SCREEN_PRIV(pScreen, v)			       \
@@ -55,34 +54,10 @@
 #define XEGL_SCREEN_PRIV(pScreen)			       \
     xeglScreenPtr pScreenPriv = XEGL_GET_SCREEN_PRIV (pScreen)
 
-typedef struct _xeglCursor {
-    Cursor cursor;
-} xeglCursorRec, *xeglCursorPtr;
-
-#define XEGL_GET_CURSOR_PRIV(pCursor, pScreen)		   \
-    ((xeglCursorPtr) (pCursor)->devPriv[(pScreen)->myNum])
-
-#define XEGL_SET_CURSOR_PRIV(pCursor, pScreen, v)	 \
-    ((pCursor)->devPriv[(pScreen)->myNum] = (pointer) v)
-
-#define XEGL_CURSOR_PRIV(pCursor, pScreen)			        \
-    xeglCursorPtr pCursorPriv = XEGL_GET_CURSOR_PRIV (pCursor, pScreen)
-
-char		 *xDisplayName = NULL;
-EGLDisplay	 xdisplay;
-EGLScreenMESA    xscreen;
-glitz_format_t	 *xeglCurrentFormat;
-CARD32		 lastEventTime = 0;
-ScreenPtr	 currentScreen = NULL;
-Bool		 softCursor = TRUE;
-xglScreenInfoRec xglScreenInfo = {
-    NULL, 0, 0, 0, 0, FALSE,
-    DEFAULT_GEOMETRY_DATA_TYPE,
-    DEFAULT_GEOMETRY_USAGE,
-    FALSE,
-    XGL_DEFAULT_PBO_MASK,
-    FALSE
-};
+static EGLDisplay    eDisplay;
+static EGLScreenMESA eScreen;
+static ScreenPtr     currentScreen = 0;
+static Bool	     softCursor = TRUE;
 
 extern miPointerScreenFuncRec kdPointerScreenFuncs;
 
@@ -97,7 +72,7 @@
 	if (xeglScreenPrivateIndex < 0)
 	    return FALSE;
 
- 	xeglScreenGeneration = serverGeneration;
+	xeglScreenGeneration = serverGeneration;
     }
 
     pScreenPriv = xalloc (sizeof (xeglScreenRec));
@@ -109,189 +84,6 @@
     return TRUE;
 }
 
-static void
-xeglConstrainCursor (ScreenPtr pScreen,
-		     BoxPtr    pBox)
-{
-}
-
-static void
-xeglCursorLimits (ScreenPtr pScreen,
-		  CursorPtr pCursor,
-		  BoxPtr    pHotBox,
-		  BoxPtr    pTopLeftBox)
-{
-    *pTopLeftBox = *pHotBox;
-}
-
-static Bool
-xeglDisplayCursor (ScreenPtr pScreen,
-		   CursorPtr pCursor)
-{
-#if 0
-    XEGL_SCREEN_PRIV (pScreen);
-    XEGL_CURSOR_PRIV (pCursor, pScreen);
-
-    XDefineCursor (xdisplay, pScreenPriv->win, pCursorPriv->cursor);
-#endif
-    return TRUE;
-}
-
-#ifdef ARGB_CURSOR
-
-static Bool
-xeglARGBCursorSupport (void);
-
-static Cursor
-xeglCreateARGBCursor (ScreenPtr pScreen,
-		      CursorPtr pCursor);
-
-#endif
-
-static Bool
-xeglRealizeCursor (ScreenPtr pScreen,
-		   CursorPtr pCursor)
-{
-#if 0
-    xeglCursorPtr pCursorPriv;
-    XImage	  *ximage;
-    Pixmap	  source, mask;
-    XColor	  fgColor, bgColor;
-    GC		  xgc;
-    unsigned long valuemask;
-    XGCValues	  values;
-
-    XEGL_SCREEN_PRIV (pScreen);
-
-    valuemask = GCForeground | GCBackground;
-
-    values.foreground = 1L;
-    values.background = 0L;
-
-    pCursorPriv = xalloc (sizeof (xeglCursorRec));
-    if (!pCursorPriv)
-	return FALSE;
-
-    XEGL_SET_CURSOR_PRIV (pCursor, pScreen, pCursorPriv);
-
-#ifdef ARGB_CURSOR
-    if (pCursor->bits->argb)
-    {
-	pCursorPriv->cursor = xeglCreateARGBCursor (pScreen, pCursor);
-	if (pCursorPriv->cursor)
-	    return TRUE;
-    }
-#endif
-
-    source = XCreatePixmap (xdisplay,
-			    pScreenPriv->win,
-			    pCursor->bits->width,
-			    pCursor->bits->height,
-			    1);
-
-    mask = XCreatePixmap (xdisplay,
-			  pScreenPriv->win,
-			  pCursor->bits->width,
-			  pCursor->bits->height,
-			  1);
-
-    xgc = XCreateGC (xdisplay, source, valuemask, &values);
-
-    ximage = XCreateImage (xdisplay,
-			   DefaultVisual (xdisplay, xscreen),
-			   1, XYBitmap, 0,
-			   (char *) pCursor->bits->source,
-			   pCursor->bits->width,
-			   pCursor->bits->height,
-			   BitmapPad (xdisplay), 0);
-
-    XPutImage (xdisplay, source, xgc, ximage,
-	       0, 0, 0, 0, pCursor->bits->width, pCursor->bits->height);
-
-    XFree (ximage);
-
-    ximage = XCreateImage (xdisplay,
-			   DefaultVisual (xdisplay, xscreen),
-			   1, XYBitmap, 0,
-			   (char *) pCursor->bits->mask,
-			   pCursor->bits->width,
-			   pCursor->bits->height,
-			   BitmapPad (xdisplay), 0);
-
-    XPutImage (xdisplay, mask, xgc, ximage,
-	       0, 0, 0, 0, pCursor->bits->width, pCursor->bits->height);
-
-    XFree (ximage);
-    XFreeGC (xdisplay, xgc);
-
-    fgColor.red   = pCursor->foreRed;
-    fgColor.green = pCursor->foreGreen;
-    fgColor.blue  = pCursor->foreBlue;
-
-    bgColor.red   = pCursor->backRed;
-    bgColor.green = pCursor->backGreen;
-    bgColor.blue  = pCursor->backBlue;
-
-    pCursorPriv->cursor =
-	XCreatePixmapCursor (xdisplay, source, mask, &fgColor, &bgColor,
-			     pCursor->bits->xhot, pCursor->bits->yhot);
-
-    XFreePixmap (xdisplay, mask);
-    XFreePixmap (xdisplay, source);
-#endif
-    return TRUE;
-}
-
-static Bool
-xeglUnrealizeCursor (ScreenPtr pScreen,
-		     CursorPtr pCursor)
-{
-#if 0
-    XEGL_CURSOR_PRIV (pCursor, pScreen);
-
-    XFreeCursor (xdisplay, pCursorPriv->cursor);
-    xfree (pCursorPriv);
-#endif
-    return TRUE;
-}
-
-static void
-xeglRecolorCursor (ScreenPtr pScreen,
-		   CursorPtr pCursor,
-		   Bool	     displayed)
-{
-#if 0
-    XColor fgColor, bgColor;
-
-    XEGL_CURSOR_PRIV (pCursor, pScreen);
-
-    fgColor.red   = pCursor->foreRed;
-    fgColor.green = pCursor->foreGreen;
-    fgColor.blue  = pCursor->foreBlue;
-
-    bgColor.red   = pCursor->backRed;
-    bgColor.green = pCursor->backGreen;
-    bgColor.blue  = pCursor->backBlue;
-
-    XRecolorCursor (xdisplay, pCursorPriv->cursor, &fgColor, &bgColor);
-#endif
-}
-
-static Bool
-xeglSetCursorPosition (ScreenPtr pScreen,
-		       int	 x,
-		       int	 y,
-		       Bool	 generateEvent)
-{
-#if 0
-    XEGL_SCREEN_PRIV (pScreen);
-
-    XWarpPointer (xdisplay, pScreenPriv->win, pScreenPriv->win,
-		  0, 0, 0, 0, x, y);
-#endif
-    return TRUE;
-}
-
 static Bool
 xeglCloseScreen (int	   index,
 		 ScreenPtr pScreen)
@@ -305,13 +97,7 @@
 	glitz_drawable_destroy (drawable);
 
     xglClearVisualTypes ();
-#if 0
-    if (pScreenPriv->win)
-	XDestroyWindow (xdisplay, pScreenPriv->win);
 
-    if (pScreenPriv->colormap)
-	XFreeColormap (xdisplay, pScreenPriv->colormap);
-#endif
     XGL_SCREEN_UNWRAP (CloseScreen);
     xfree (pScreenPriv);
 
@@ -319,121 +105,21 @@
 }
 
 static Bool
-xeglCursorOffScreen (ScreenPtr *ppScreen, int *x, int *y)
-{
-    return FALSE;
-}
-
-static void
-xeglCrossScreen (ScreenPtr pScreen, Bool entering)
-{
-}
-
-static void
-xeglWarpCursor (ScreenPtr pScreen, int x, int y)
-{
-    miPointerWarpCursor (pScreen, x, y);
-}
-
-miPointerScreenFuncRec xeglPointerScreenFuncs = {
-    xeglCursorOffScreen,
-    xeglCrossScreen,
-    xeglWarpCursor
-};
-
-static void
-xeglMoveCursor(ScreenPtr pScreen, int x, int y)
-{
-}
-
-
-#define FB_CUR_SETIMAGE 0x01
-#define FB_CUR_SETPOS   0x02
-#define FB_CUR_SETHOT   0x04
-#define FB_CUR_SETCMAP  0x08
-#define FB_CUR_SETSHAPE 0x10
-#define FB_CUR_SETSIZE  0x20
-#define FB_CUR_SETALL   0xFF
-
-struct fbcurpos {
-        unsigned short x, y;
-};
-
-struct fb_cmap_user {
-        unsigned long start;                    /* First entry  */
-        unsigned long len;                      /* Number of entries */
-        unsigned short *red;              /* Red values   */
-        unsigned short *green;
-        unsigned short *blue;
-        unsigned short *transp;           /* transparency, can be NULL */
-};
-
-struct fb_image_user {
-        unsigned long dx;                       /* Where to place image */
-        unsigned long dy;
-        unsigned long width;                    /* Size of image */
-        unsigned long height;
-        unsigned long fg_color;                 /* Only used when a mono bitmap */
-        unsigned long bg_color;
-        unsigned char depth;                    /* Depth of the image */
-        const char *data;        /* Pointer to image data */
-        struct fb_cmap_user cmap;       /* color map info */
-};
-
-struct fb_cursor_user {
-        unsigned short set;             /* what to set */
-        unsigned short enable;          /* cursor on/off */
-        unsigned short rop;             /* bitop operation */
-        const char *mask;               /* cursor mask bits */
-        struct fbcurpos hot;            /* cursor hot spot */
-        struct fb_image_user image;     /* Cursor image */
-};
-#define FBIO_CURSOR            _IOWR('F', 0x08, struct fb_cursor_user)
-
-
-static void
-xeglSetCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
-{
-#if 0
-    int fd, err;
-    struct fb_cursor_user cursor;
-
-    fd = open("/dev/fb0", O_RDWR);
-    memset(&cursor, 0, sizeof(cursor));
-    cursor.set = FB_CUR_SETPOS;
-    cursor.image.dx = 50;
-    cursor.image.dy = 50;
-    cursor.enable = 1;
-    err = ioctl(fd, FBIO_CURSOR, &cursor);
-    err = errno;
-    printf("errno %d\n", err);
-    close(fd);
-#endif
-}
-
-miPointerSpriteFuncRec eglPointerSpriteFuncs = {
-        xeglRealizeCursor,
-        xeglUnrealizeCursor,
-        xeglSetCursor,
-        xeglMoveCursor,
-};
-
-static Bool
 xeglScreenInit (int	  index,
 		ScreenPtr pScreen,
 		int	  argc,
 		char	  **argv)
 {
-    EGLSurface screen_surf;
-    EGLModeMESA mode;
-    int count;
+    EGLSurface		    eSurface;
+    EGLModeMESA		    mode;
+    int			    count;
     xeglScreenPtr	    pScreenPriv;
     glitz_drawable_format_t *format;
     glitz_drawable_t	    *drawable;
     const EGLint screenAttribs[] = {
-        EGL_WIDTH, 1024,
-        EGL_HEIGHT, 768,
-        EGL_NONE
+	EGL_WIDTH, 1024,
+	EGL_HEIGHT, 768,
+	EGL_NONE
     };
 
     xglScreenInfo.width = 1024;
@@ -448,114 +134,71 @@
 
     pScreenPriv = XEGL_GET_SCREEN_PRIV (pScreen);
 
-    if (xglScreenInfo.fullscreen)
-    {
-//	xglScreenInfo.width    = DisplayWidth (xdisplay, xscreen);
-//	xglScreenInfo.height   = DisplayHeight (xdisplay, xscreen);
-//	xglScreenInfo.widthMm  = DisplayWidthMM (xdisplay, xscreen);
-//	xglScreenInfo.heightMm = DisplayHeightMM (xdisplay, xscreen);
-    }
-    else if (xglScreenInfo.width == 0 || xglScreenInfo.height == 0)
+    if (xglScreenInfo.width == 0 || xglScreenInfo.height == 0)
     {
 	xglScreenInfo.width  = XEGL_DEFAULT_SCREEN_WIDTH;
 	xglScreenInfo.height = XEGL_DEFAULT_SCREEN_HEIGHT;
     }
 
-    eglGetModesMESA(xdisplay, xscreen, &mode, 1, &count);
-    screen_surf = eglCreateScreenSurfaceMESA(xdisplay, format->id, screenAttribs);
-    if (screen_surf == EGL_NO_SURFACE) {
-        printf("failed to create screen surface\n");
-        return FALSE;
-    }
-
-    eglShowSurfaceMESA(xdisplay, xscreen, screen_surf, mode);
+    eglGetModesMESA (eDisplay, eScreen, &mode, 1, &count);
 
-    drawable = glitz_egl_create_surface (xdisplay, xscreen, format, screen_surf,
-                                         xglScreenInfo.width, xglScreenInfo.height);
-    if (!drawable)
+    eSurface = eglCreateScreenSurfaceMESA (eDisplay, format->id, screenAttribs);
+    if (eSurface == EGL_NO_SURFACE)
     {
-	ErrorF ("[%d] couldn't create glitz drawable for window\n", index);
+	ErrorF ("failed to create screen surface\n");
 	return FALSE;
     }
 
-//    XSelectInput (xdisplay, pScreenPriv->win, ExposureMask);
-//    XMapWindow (xdisplay, pScreenPriv->win);
+    eglShowSurfaceMESA (eDisplay, eScreen, eSurface, mode);
 
-    if (xglScreenInfo.fullscreen)
+    drawable = glitz_egl_create_surface (eDisplay, eScreen, format, eSurface,
+					 xglScreenInfo.width,
+					 xglScreenInfo.height);
+    if (!drawable)
     {
-#if 0
-	XClientMessageEvent xev;
-
-	memset (&xev, 0, sizeof (xev));
-
-	xev.type = ClientMessage;
-	xev.message_type = XInternAtom (xdisplay, "_NET_WM_STATE", FALSE);
-	xev.display = xdisplay;
-	xev.window = pScreenPriv->win;
-	xev.format = 32;
-	xev.data.l[0] = 1;
-	xev.data.l[1] =
-	    XInternAtom (xdisplay, "_NET_WM_STATE_FULLSCREEN", FALSE);
-
-	XSendEvent (xdisplay, root, FALSE, SubstructureRedirectMask,
-		    (XEvent *) &xev);
-#endif
+	ErrorF ("[%d] couldn't create glitz drawable for window\n", index);
+	return FALSE;
     }
 
     xglScreenInfo.drawable = drawable;
 
-    if (!xglScreenInit (pScreen, &xglScreenInfo))
+    if (!xglScreenInit (pScreen))
 	return FALSE;
 
-    XGL_SCREEN_WRAP (CloseScreen, xeglCloseScreen);
-
-#ifdef ARGB_CURSOR
-    if (!xeglARGBCursorSupport ())
-	softCursor = TRUE;
+#ifdef GLXEXT
+    if (!xglInitVisualConfigs (pScreen))
+	return FALSE;
 #endif
-    miDCInitialize (pScreen, &xeglPointerScreenFuncs);
-    miCreateDefColormap (pScreen);
 
-//  miPointerInitialize(pScreen, &eglPointerSpriteFuncs,
-//    &kdPointerScreenFuncs, FALSE);
+    XGL_SCREEN_WRAP (CloseScreen, xeglCloseScreen);
+
+    miDCInitialize (pScreen, &kdPointerScreenFuncs);
 
     if (!xglFinishScreenInit (pScreen))
 	return FALSE;
 
-//    while (XNextEvent (xdisplay, &xevent))
-//	if (xevent.type == Expose)
-//	    break;
-
-//    XSelectInput (xdisplay, pScreenPriv->win,
-//		  ButtonPressMask | ButtonReleaseMask |
-//		  KeyPressMask | KeyReleaseMask | EnterWindowMask |
-//		  PointerMotionMask);
-
     return TRUE;
 }
 
 void
-InitOutput (ScreenInfo *pScreenInfo,
-	    int	       argc,
-	    char       **argv)
+xeglInitOutput (ScreenInfo *pScreenInfo,
+		int	   argc,
+		char       **argv)
 {
     glitz_drawable_format_t *format, templ;
-    int i, maj, min, count;
+    int			    i, maj, min, count;
     unsigned long	    mask;
 
     xglSetPixmapFormats (pScreenInfo);
 
-    if (!xdisplay)
+    if (!eDisplay)
     {
-        xdisplay = eglGetDisplay(":0");
-        assert(xdisplay);
+	eDisplay = eglGetDisplay ("!fb_dri");
 
-        if (!eglInitialize(xdisplay, &maj, &min))
+	if (!eglInitialize (eDisplay, &maj, &min))
 	    FatalError ("can't open display");
 
-        eglGetScreensMESA(xdisplay, &xscreen, 1, &count);
-
-        glitz_egl_init (NULL);
+	eglGetScreensMESA (eDisplay, &eScreen, 1, &count);
     }
 
     templ.samples          = 1;
@@ -564,7 +207,7 @@
 
     mask = GLITZ_FORMAT_SAMPLES_MASK;
 
-    format = glitz_egl_find_config (xdisplay, xscreen,
+    format = glitz_egl_find_config (eDisplay, eScreen,
 				    mask, &templ, 0);
 
     if (!format)
@@ -589,105 +232,52 @@
 
     glitz_surface_flush (pScreenPriv->surface);
     glitz_drawable_finish (pScreenPriv->drawable);
-
-//  XSync (xdisplay, FALSE);
 }
 
-static void
-xeglWakeupHandler (pointer blockData,
-		   int     result,
-		   pointer pReadMask)
+void
+xeglInitInput (int  argc,
+	       char **argv)
 {
-#if 0
-    ScreenPtr pScreen = currentScreen;
-    XEvent    X;
-    xEvent    x;
-
-    while (XPending (xdisplay)) {
-	XNextEvent (xdisplay, &X);
+    eglInitInput (&LinuxEvdevMouseFuncs, &LinuxEvdevKeyboardFuncs);
+    RegisterBlockAndWakeupHandlers (xeglBlockHandler, KdWakeupHandler, NULL);
+}
 
-	switch (X.type) {
-	case KeyPress:
-	    x.u.u.type = KeyPress;
-	    x.u.u.detail = X.xkey.keycode;
-	    x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis ();
-	    mieqEnqueue (&x);
-	    break;
-	case KeyRelease:
-	    x.u.u.type = KeyRelease;
-	    x.u.u.detail = X.xkey.keycode;
-	    x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis ();
-	    mieqEnqueue (&x);
-	    break;
-	case ButtonPress:
-	    x.u.u.type = ButtonPress;
-	    x.u.u.detail = X.xbutton.button;
-	    x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis ();
-	    mieqEnqueue (&x);
-	    break;
-	case ButtonRelease:
-	    x.u.u.type = ButtonRelease;
-	    x.u.u.detail = X.xbutton.button;
-	    x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis ();
-	    mieqEnqueue (&x);
-	    break;
-	case MotionNotify:
-	    x.u.u.type = MotionNotify;
-	    x.u.keyButtonPointer.rootX = X.xmotion.x;
-	    x.u.keyButtonPointer.rootY = X.xmotion.y;
-	    x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis ();
-	    miPointerAbsoluteCursor (X.xmotion.x, X.xmotion.y, lastEventTime);
-	    mieqEnqueue (&x);
-	    break;
-	case EnterNotify:
-	    if (X.xcrossing.detail != NotifyInferior) {
-		if (pScreen) {
-		    NewCurrentScreen (pScreen, X.xcrossing.x, X.xcrossing.y);
-		    x.u.u.type = MotionNotify;
-		    x.u.keyButtonPointer.rootX = X.xcrossing.x;
-		    x.u.keyButtonPointer.rootY = X.xcrossing.y;
-		    x.u.keyButtonPointer.time = lastEventTime =
-			GetTimeInMillis ();
-		    mieqEnqueue (&x);
-		}
-	    }
-	    break;
-	default:
-	    break;
-	}
-    }
-#endif
+Bool
+xeglLegalModifier (unsigned int key,
+		   DevicePtr    pDev)
+{
+    return KdLegalModifier (key, pDev);
 }
 
 void
-InitInput (int argc, char **argv)
+xeglProcessInputEvents (void)
 {
-    eglInitInput (&LinuxEvdevMouseFuncs, &LinuxEvdevKeyboardFuncs);
-    RegisterBlockAndWakeupHandlers (xeglBlockHandler,
-                                    KdWakeupHandler,
-                                    NULL);
+    KdProcessInputEvents ();
 }
 
 void
-ddxUseMsg (void)
+xeglUseMsg (void)
 {
-    ErrorF ("\nXegl usage:\n");
-    ErrorF ("-display string        display name of the real server\n");
+    ErrorF ("-screen WIDTH[/WIDTHMM]xHEIGHT[/HEIGHTMM] "
+	    "specify screen characteristics\n");
     ErrorF ("-softcursor            force software cursor\n");
-
-    xglUseMsg ();
 }
 
 int
-ddxProcessArgument (int argc, char **argv, int i)
+xeglProcessArgument (int  argc,
+		     char **argv,
+		     int  i)
 {
-    if (!strcmp (argv[i], "-display"))
+    if (!strcmp (argv[i], "-screen"))
     {
-	if (++i < argc) {
-	    xDisplayName = argv[i];
-	    return 2;
+	if ((i + 1) < argc)
+	{
+	    xglParseScreen (argv[i + 1]);
 	}
-	return 0;
+	else
+	    return 1;
+
+	return 2;
     }
     else if (!strcmp (argv[i], "-softcursor"))
     {
@@ -695,90 +285,21 @@
 	return 1;
     }
 
-    return xglProcessArgument (&xglScreenInfo, argc, argv, i);
+    return 0;
 }
 
 void
-AbortDDX (void)
+xeglAbort (void)
 {
 }
 
 void
-ddxGiveUp ()
+xeglGiveUp (void)
 {
     AbortDDX ();
 }
 
 void
-OsVendorInit (void)
+xeglOsVendorInit (void)
 {
 }
-
-#ifdef ARGB_CURSOR
-
-//#include <X11/extensions/Xrender.h>
-
-static Bool
-xeglARGBCursorSupport (void)
-{
-#if 0
-    int renderMajor, renderMinor;
-
-    if (!XRenderQueryVersion (xdisplay, &renderMajor, &renderMinor))
-	renderMajor = renderMinor = -1;
-
-    return (renderMajor > 0 || renderMinor > 4);
-#endif
-    return TRUE;
-}
-
-static Cursor
-xeglCreateARGBCursor (ScreenPtr pScreen,
-		      CursorPtr pCursor)
-{
-    Cursor            cursor;
-#if 0
-    Pixmap	      xpixmap;
-    GC		      xgc;
-    XImage	      *ximage;
-    XRenderPictFormat *xformat;
-    Picture	      xpicture;
-
-    XEGL_SCREEN_PRIV (pScreen);
-
-    xpixmap = XCreatePixmap (xdisplay,
-			     pScreenPriv->win,
-			     pCursor->bits->width,
-			     pCursor->bits->height,
-			     32);
-
-    xgc = XCreateGC (xdisplay, xpixmap, 0, NULL);
-
-    ximage = XCreateImage (xdisplay,
-			   DefaultVisual (xdisplay, xscreen),
-			   32, ZPixmap, 0,
-			   (char *) pCursor->bits->argb,
-			   pCursor->bits->width,
-			   pCursor->bits->height,
-			   32, pCursor->bits->width * 4);
-
-    XPutImage (xdisplay, xpixmap, xgc, ximage,
-	       0, 0, 0, 0, pCursor->bits->width, pCursor->bits->height);
-
-    XFree (ximage);
-    XFreeGC (xdisplay, xgc);
-
-    xformat = XRenderFindStandardFormat (xdisplay, PictStandardARGB32);
-    xpicture = XRenderCreatePicture (xdisplay, xpixmap, xformat, 0, 0);
-
-    cursor = XRenderCreateCursor (xdisplay, xpicture,
-				  pCursor->bits->xhot,
-				  pCursor->bits->yhot);
-
-    XRenderFreePicture (xdisplay, xpicture);
-    XFreePixmap (xdisplay, xpixmap);
-#endif
-    return cursor;
-}
-
-#endif

Index: xegl.h
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/egl/xegl.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- xegl.h	4 Jun 2005 23:33:03 -0000	1.1
+++ xegl.h	23 Dec 2005 02:07:58 -0000	1.2
@@ -1,3 +1,33 @@
+/*
+ * Copyright © 2005 Novell, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Novell, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * Novell, Inc. makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: David Reveman <davidr at novell.com>
+ */
+
+#ifndef _XEGL_H_
+#define _XEGL_H_
+
+#include "xgl.h"
+
 #include "randrstr.h"
 
 #define KD_BUTTON_1     0x01
@@ -8,33 +38,33 @@
 #define KD_MOUSE_DELTA  0x80000000
 
 typedef struct _KdMouseFuncs {
-    Bool            (*Init) (void);
-    void            (*Fini) (void);
+    Bool (*Init) (void);
+    void (*Fini) (void);
 } KdMouseFuncs;
 
 typedef struct _KdKeyboardFuncs {
-    void            (*Load) (void);
-    int             (*Init) (void);
-    void            (*Leds) (int);
-    void            (*Bell) (int, int, int);
-    void            (*Fini) (void);
-    int             LockLed;
+    void (*Load) (void);
+    int  (*Init) (void);
+    void (*Leds) (int);
+    void (*Bell) (int, int, int);
+    void (*Fini) (void);
+    int  LockLed;
 } KdKeyboardFuncs;
 
 typedef struct _KdOsFuncs {
-    int             (*Init) (void);
-    void            (*Enable) (void);
-    Bool            (*SpecialKey) (KeySym);
-    void            (*Disable) (void);
-    void            (*Fini) (void);
-    void            (*pollEvents) (void);
+    int  (*Init)       (void);
+    void (*Enable)     (void);
+    Bool (*SpecialKey) (KeySym);
+    void (*Disable)    (void);
+    void (*Fini)       (void);
+    void (*pollEvents) (void);
 } KdOsFuncs;
 
 typedef struct _KdMouseMatrix {
-    int     matrix[2][3];
+    int matrix[2][3];
 } KdMouseMatrix;
 
-typedef enum _kdMouseState {
+typedef enum _KdMouseState {
     start,
     button_1_pend,
     button_1_down,
@@ -51,81 +81,134 @@
 
 typedef struct _KdMouseInfo {
     struct _KdMouseInfo *next;
-    void                *driver;
-    void                *closure;
-    char                *name;
-    char                *prot;
-    char                map[KD_MAX_BUTTON];
-    int                 nbutton;
-    Bool                emulateMiddleButton;
-    unsigned long       emulationTimeout;
-    Bool                timeoutPending;
-    KdMouseState        mouseState;
-    Bool                eventHeld;
-    xEvent              heldEvent;
-    unsigned char       buttonState;
-    int                 emulationDx, emulationDy;
-    int                 inputType;
-    Bool                transformCoordinates;
+    void		*driver;
+    void		*closure;
+    char		*name;
+    char		*prot;
+    char		map[KD_MAX_BUTTON];
+    int			nbutton;
+    Bool		emulateMiddleButton;
+    unsigned long	emulationTimeout;
+    Bool		timeoutPending;
+    KdMouseState	mouseState;
+    Bool		eventHeld;
+    xEvent		heldEvent;
+    unsigned char	buttonState;
+    int			emulationDx, emulationDy;
+    int			inputType;
+    Bool		transformCoordinates;
 } KdMouseInfo;
 
-typedef struct _KdScreenInfo {
-    struct _KdScreenInfo    *next;
-    ScreenPtr   pScreen;
-    void        *driver;
-    Rotation    randr;  /* rotation and reflection */
-    int         width;
-    int         height;
-    int         rate;
-    int         width_mm;
-    int         height_mm;
-    int         subpixel_order;
-    Bool        dumb;
-    Bool        softCursor;
-    int         mynum;
-    DDXPointRec origin;
-} KdScreenInfo;
-
-#define KD_MAX_FB 2
-#define KD_MAX_PSEUDO_DEPTH 8
-#define KD_MAX_PSEUDO_SIZE           (1 << KD_MAX_PSEUDO_DEPTH)
-
 typedef struct _xeglScreen {
-    Window             win;
-    Colormap           colormap;
     CloseScreenProcPtr CloseScreen;
-    KdScreenInfo       *screen;
-    ColormapPtr     pInstalledmap[KD_MAX_FB];         /* current colormap */
+    ScreenPtr	       pScreen;
+    DDXPointRec	       origin;
 } xeglScreenRec, *xeglScreenPtr;
 
-extern KdMouseInfo *kdMouseInfo;
-extern KdOsFuncs *kdOsFuncs;
-extern Bool kdDontZap;
-extern Bool kdDisableZaphod;
-extern int kdScreenPrivateIndex;
-extern KdMouseFuncs LinuxEvdevMouseFuncs;
+extern KdMouseInfo     *kdMouseInfo;
+extern KdOsFuncs       *kdOsFuncs;
+extern Bool	       kdDontZap;
+extern Bool	       kdDisableZaphod;
+extern int	       xeglScreenPrivateIndex;
+extern KdMouseFuncs    LinuxEvdevMouseFuncs;
 extern KdKeyboardFuncs LinuxEvdevKeyboardFuncs;
 
-#define RR_Rotate_All   (RR_Rotate_0|RR_Rotate_90|RR_Rotate_180|RR_Rotate_270)
-#define RR_Reflect_All  (RR_Reflect_X|RR_Reflect_Y)
+#define RR_Rotate_All						 \
+    (RR_Rotate_0 | RR_Rotate_90 | RR_Rotate_180 | RR_Rotate_270)
+#define RR_Reflect_All (RR_Reflect_X | RR_Reflect_Y)
 
-#define KdGetScreenPriv(pScreen) ((xeglScreenPtr) \
-                                  (pScreen)->devPrivates[kdScreenPrivateIndex].ptr)
-#define KdScreenPriv(pScreen) xeglScreenPtr pScreenPriv = KdGetScreenPriv(pScreen)
+#define KdGetScreenPriv(pScreen)					   \
+    ((xeglScreenPtr) ((pScreen)->devPrivates[xeglScreenPrivateIndex].ptr))
+#define KdScreenPriv(pScreen)				  \
+    xeglScreenPtr pScreenPriv = KdGetScreenPriv (pScreen)
 
-extern void eglInitInput(KdMouseFuncs *pMouseFuncs, KdKeyboardFuncs *pKeyboardFuncs);
-extern void KdParseMouse(char *arg);
-extern KdMouseInfo *KdMouseInfoAdd(void);
-extern void KdMouseInfoDispose(KdMouseInfo *mi);
-extern int KdAllocInputType(void);
-extern char *KdSaveString (char *str);
-extern Bool KdRegisterFd(int type, int fd, void (*read) (int fd, void *closure), void *closure);
-extern void KdUnregisterFds(int type, Bool do_close);
-extern void KdEnqueueKeyboardEvent(unsigned char scan_code, unsigned char is_up);
-extern void KdEnqueueMouseEvent(KdMouseInfo *mi, unsigned long flags, int rx, int ry);
-extern void KdRegisterFdEnableDisable(int fd,
-                                int (*enable)(int fd, void *closure),
-                                void (*disable)(int fd, void *closure));
-extern void KdWakeupHandler(int screen, pointer data, unsigned long lresult, pointer readmask);
+void
+eglInitInput (KdMouseFuncs    *pMouseFuncs,
+	      KdKeyboardFuncs *pKeyboardFuncs);
+
+void
+KdParseMouse (char *arg);
+
+KdMouseInfo *
+KdMouseInfoAdd (void);
+
+void
+KdMouseInfoDispose (KdMouseInfo *mi);
 
+int
+KdAllocInputType (void);
+
+char *
+KdSaveString (char *str);
+
+Bool
+KdRegisterFd (int  type,
+	      int  fd,
+	      void (*read) (int fd, void *closure),
+	      void *closure);
+
+void
+KdUnregisterFds (int  type,
+		 Bool do_close);
 
+void
+KdEnqueueKeyboardEvent (unsigned char scan_code,
+			unsigned char is_up);
+
+void
+KdEnqueueMouseEvent (KdMouseInfo   *mi,
+		     unsigned long flags,
+		     int	   rx,
+		     int	   ry);
+
+void
+KdRegisterFdEnableDisable (int  fd,
+			   int  (*enable)  (int fd, void *closure),
+			   void (*disable) (int fd, void *closure));
+
+void
+KdWakeupHandler (pointer data,
+		 int	 result,
+		 pointer readmask);
+
+Bool
+KdLegalModifier (unsigned int key, 
+		 DevicePtr    pDev);
+
+void
+KdProcessInputEvents (void);
+
+void
+xeglInitOutput (ScreenInfo *pScreenInfo,
+		int	   argc,
+		char       **argv);
+
+Bool
+xeglLegalModifier (unsigned int key,
+		   DevicePtr    pDev);
+
+void
+xeglProcessInputEvents (void);
+
+void
+xeglInitInput (int  argc,
+	       char **argv);
+
+void
+xeglUseMsg (void);
+
+int
+xeglProcessArgument (int  argc,
+		     char **argv,
+		     int  i);
+
+void
+xeglAbort (void);
+
+void
+xeglGiveUp (void);
+
+void
+xeglOsVendorInit (void);
+
+#endif /* _XEGL_H_ */

--- NEW FILE: xeglinit.c ---
(This appears to be a binary file; contents omitted.)



More information about the xserver-commit mailing list