summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorDave Airlie <airlied@linux.ie>2005-12-23 02:07:58 +0000
committerDave Airlie <airlied@linux.ie>2005-12-23 02:07:58 +0000
commitfeb735c5bb0cd391136f1c73476703dff82dc9b0 (patch)
tree79f3554d90b0ddf1c592db1954a96a5a286974e4 /hw
parentade104ce5a016623c1ce97b0d52b531185b35baf (diff)
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.
Diffstat (limited to 'hw')
-rw-r--r--hw/xgl/Makefile.am31
-rw-r--r--hw/xgl/egl/Makefile.am43
-rw-r--r--hw/xgl/egl/evdev.c76
-rw-r--r--hw/xgl/egl/kinput.c15
-rw-r--r--hw/xgl/egl/module/Makefile.am14
-rw-r--r--hw/xgl/egl/module/xeglmodule.c104
-rw-r--r--hw/xgl/egl/xegl.c621
-rw-r--r--hw/xgl/egl/xegl.h251
-rw-r--r--hw/xgl/egl/xeglinit.c131
-rw-r--r--hw/xgl/glx/Makefile.am31
-rw-r--r--hw/xgl/glx/module/Makefile.am14
-rw-r--r--hw/xgl/glx/module/xglxmodule.c104
-rw-r--r--hw/xgl/glx/xglx.c99
-rw-r--r--hw/xgl/glx/xglx.h64
-rw-r--r--hw/xgl/glx/xglxinit.c131
-rw-r--r--hw/xgl/glxext/Makefile.am13
-rw-r--r--hw/xgl/glxext/module/Makefile.am19
-rw-r--r--hw/xgl/glxext/module/glcoremodule.c38
-rw-r--r--hw/xgl/glxext/module/glxmodule.c38
-rw-r--r--hw/xgl/glxext/xglglxext.c (renamed from hw/xgl/xglglx.c)709
-rw-r--r--hw/xgl/glxext/xglglxext.h38
-rw-r--r--hw/xgl/xgl.h66
-rw-r--r--hw/xgl/xglcmap.c2
-rw-r--r--hw/xgl/xglhash.c108
-rw-r--r--hw/xgl/xglinit.c287
-rw-r--r--hw/xgl/xglloader.c129
-rw-r--r--hw/xgl/xglmodule.h45
-rw-r--r--hw/xgl/xglparse.c82
-rw-r--r--hw/xgl/xglpixmap.c30
-rw-r--r--hw/xgl/xglscreen.c33
-rw-r--r--hw/xgl/xglsync.c45
-rw-r--r--hw/xgl/xgltrap.c2
32 files changed, 2240 insertions, 1173 deletions
diff --git a/hw/xgl/Makefile.am b/hw/xgl/Makefile.am
index 0228c0d0a..3fc5f5915 100644
--- a/hw/xgl/Makefile.am
+++ b/hw/xgl/Makefile.am
@@ -1,17 +1,26 @@
-if XGLXSERVER
+if GLX
+GLX_SUBDIRS = glxext
+endif
+
+if XGLX
XGLX_SUBDIRS = glx
endif
-if XEGLSERVER
+if XEGL
XEGL_SUBDIRS = egl
endif
-SUBDIRS = . $(XGLX_SUBDIRS) $(XEGL_SUBDIRS)
+SUBDIRS = \
+ . \
+ $(GLX_SUBDIRS) \
+ $(XGLX_SUBDIRS) \
+ $(XEGL_SUBDIRS)
INCLUDES = \
@XGL_INCS@ \
@XSERVER_CFLAGS@ \
- @XGLSERVER_CFLAGS@
+ @XGLSERVER_CFLAGS@ \
+ -DMODULEPATH=\"@MODULEPATH@\"
noinst_LIBRARIES = libxgl.a
@@ -40,4 +49,18 @@ libxgl_a_SOURCES = \
xglglyph.c \
xgltrap.c \
xglhash.c \
+ xglloader.c \
xglglx.c
+
+if XGLSERVER
+Xgl_DEPENDENCIES = @XGL_LIBS@
+Xgl_LDFLAGS = -export-dynamic
+Xgl_SOURCES = xglinit.c
+Xgl_LDADD = \
+ @XGL_LIBS@ \
+ @XSERVER_LIBS@ \
+ @XGLSERVER_LIBS@
+Xgl_programs = Xgl
+endif
+
+bin_PROGRAMS = $(Xgl_programs)
diff --git a/hw/xgl/egl/Makefile.am b/hw/xgl/egl/Makefile.am
index d51b8bc90..8a9b9f539 100644
--- a/hw/xgl/egl/Makefile.am
+++ b/hw/xgl/egl/Makefile.am
@@ -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)
diff --git a/hw/xgl/egl/evdev.c b/hw/xgl/egl/evdev.c
index 634be73c4..43ccfb051 100644
--- a/hw/xgl/egl/evdev.c
+++ b/hw/xgl/egl/evdev.c
@@ -112,7 +112,7 @@ EvdevRead (int evdevPort, void *closure)
{
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 @@ EvdevRead (int evdevPort, void *closure)
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;
+ 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;
- }
- }
- else if (events[i].value==0) {
- 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;
- }
- }
- 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 @@ EvdevRead (int evdevPort, void *closure)
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 @@ EvdevRead1 (int evdevPort, void *closure)
}
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]))
diff --git a/hw/xgl/egl/kinput.c b/hw/xgl/egl/kinput.c
index 231331941..5cf4b688e 100644
--- a/hw/xgl/egl/kinput.c
+++ b/hw/xgl/egl/kinput.c
@@ -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 @@ KdMouseProc(DeviceIntPtr pDevice, int onoff)
}
Bool
-LegalModifier(unsigned int key, DevicePtr pDev)
+KdLegalModifier(unsigned int key, DevicePtr pDev)
{
return TRUE;
}
@@ -1518,12 +1517,10 @@ KdBlockHandler (int screen,
}
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 @@ KdWakeupHandler (int screen,
// 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 @@ miPointerScreenFuncRec kdPointerScreenFuncs =
};
void
-ProcessInputEvents ()
+KdProcessInputEvents (void)
{
mieqProcessInputEvents();
miPointerUpdate();
diff --git a/hw/xgl/egl/module/Makefile.am b/hw/xgl/egl/module/Makefile.am
new file mode 100644
index 000000000..c321926ba
--- /dev/null
+++ b/hw/xgl/egl/module/Makefile.am
@@ -0,0 +1,14 @@
+INCLUDES = \
+ @XEGL_INCS@ \
+ @XSERVER_CFLAGS@ \
+ @XEGLSERVER_CFLAGS@
+
+libxegl_la_LDFLAGS = -avoid-version
+libxegl_la_SOURCES = xeglmodule.c
+libxegl_la_LIBADD = \
+ @XEGL_MOD_LIBS@ \
+ @XEGLSERVER_LIBS@
+
+moduledir = @MODULEPATH@/xgl
+
+module_LTLIBRARIES = libxegl.la \ No newline at end of file
diff --git a/hw/xgl/egl/module/xeglmodule.c b/hw/xgl/egl/module/xeglmodule.c
new file mode 100644
index 000000000..ff695f614
--- /dev/null
+++ b/hw/xgl/egl/module/xeglmodule.c
@@ -0,0 +1,104 @@
+/*
+ * 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@novell.com>
+ */
+
+#include "xglmodule.h"
+#include "xegl.h"
+
+#include <glitz-egl.h>
+
+char *
+moduleVersion (void)
+{
+ return VERSION;
+}
+
+Bool
+moduleInit (const char *module)
+{
+ glitz_egl_init (module);
+
+ return TRUE;
+}
+
+void
+InitOutput (ScreenInfo *pScreenInfo,
+ int argc,
+ char **argv)
+{
+ xeglInitOutput (pScreenInfo, argc, argv);
+}
+
+Bool
+LegalModifier (unsigned int key,
+ DevicePtr pDev)
+{
+ return xeglLegalModifier (key, pDev);
+}
+
+void
+ProcessInputEvents (void)
+{
+ xeglProcessInputEvents ();
+}
+
+void
+InitInput (int argc,
+ char **argv)
+{
+ xeglInitInput (argc, argv);
+}
+
+void
+ddxUseMsg (void)
+{
+ ErrorF ("\nXegl usage:\n");
+ xeglUseMsg ();
+}
+
+int
+ddxProcessArgument (int argc,
+ char **argv,
+ int i)
+{
+ return xeglProcessArgument (argc, argv, i);
+}
+
+void
+AbortDDX (void)
+{
+ xeglAbort ();
+}
+
+void
+ddxGiveUp (void)
+{
+ xeglGiveUp ();
+}
+
+void
+OsVendorInit (void)
+{
+ xeglOsVendorInit ();
+}
diff --git a/hw/xgl/egl/xegl.c b/hw/xgl/egl/xegl.c
index 2f4b900d6..43908bdbb 100644
--- a/hw/xgl/egl/xegl.c
+++ b/hw/xgl/egl/xegl.c
@@ -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 @@ int xeglScreenPrivateIndex;
#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 @@ xeglAllocatePrivates (ScreenPtr pScreen)
if (xeglScreenPrivateIndex < 0)
return FALSE;
- xeglScreenGeneration = serverGeneration;
+ xeglScreenGeneration = serverGeneration;
}
pScreenPriv = xalloc (sizeof (xeglScreenRec));
@@ -109,189 +84,6 @@ xeglAllocatePrivates (ScreenPtr pScreen)
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 @@ xeglCloseScreen (int index,
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 @@ xeglCloseScreen (int index,
}
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 @@ xeglScreenInit (int index,
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 @@ InitOutput (ScreenInfo *pScreenInfo,
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 @@ xeglBlockHandler (pointer blockData,
glitz_surface_flush (pScreenPriv->surface);
glitz_drawable_finish (pScreenPriv->drawable);
+}
-// XSync (xdisplay, FALSE);
+void
+xeglInitInput (int argc,
+ char **argv)
+{
+ eglInitInput (&LinuxEvdevMouseFuncs, &LinuxEvdevKeyboardFuncs);
+ RegisterBlockAndWakeupHandlers (xeglBlockHandler, KdWakeupHandler, NULL);
}
-static void
-xeglWakeupHandler (pointer blockData,
- int result,
- pointer pReadMask)
+Bool
+xeglLegalModifier (unsigned int key,
+ DevicePtr pDev)
{
-#if 0
- ScreenPtr pScreen = currentScreen;
- XEvent X;
- xEvent x;
-
- while (XPending (xdisplay)) {
- XNextEvent (xdisplay, &X);
-
- 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
+ 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 @@ ddxProcessArgument (int argc, char **argv, int i)
return 1;
}
- return xglProcessArgument (&xglScreenInfo, argc, argv, i);
+ return 0;
}
void
-AbortDDX (void)
+xeglAbort (void)
{
}
void
-ddxGiveUp ()
+xeglGiveUp (void)
{
AbortDDX ();
}
void
-OsVendorInit (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)
+xeglOsVendorInit (void)
{
- 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
diff --git a/hw/xgl/egl/xegl.h b/hw/xgl/egl/xegl.h
index e75f233ad..cf21fca95 100644
--- a/hw/xgl/egl/xegl.h
+++ b/hw/xgl/egl/xegl.h
@@ -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@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 enum _kdMouseState {
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 KdGetScreenPriv(pScreen) ((xeglScreenPtr) \
- (pScreen)->devPrivates[kdScreenPrivateIndex].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);
+#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[xeglScreenPrivateIndex].ptr))
+#define KdScreenPriv(pScreen) \
+ xeglScreenPtr pScreenPriv = KdGetScreenPriv (pScreen)
+
+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_ */
diff --git a/hw/xgl/egl/xeglinit.c b/hw/xgl/egl/xeglinit.c
new file mode 100644
index 000000000..51100a4d1
--- /dev/null
+++ b/hw/xgl/egl/xeglinit.c
@@ -0,0 +1,131 @@
+/*
+ * Copyright © 2004 David Reveman
+ *
+ * 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
+ * David Reveman not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * David Reveman makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL DAVID REVEMAN 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@novell.com>
+ */
+
+#include "xegl.h"
+
+static xglScreenInfoRec xglScreenInfo = {
+ NULL, 0, 0, 0, 0,
+ DEFAULT_GEOMETRY_DATA_TYPE,
+ DEFAULT_GEOMETRY_USAGE,
+ FALSE,
+ XGL_DEFAULT_PBO_MASK,
+ FALSE,
+ FALSE
+};
+
+#ifdef GLXEXT
+static Bool loadGlx = TRUE;
+#endif
+
+void
+InitOutput (ScreenInfo *pScreenInfo,
+ int argc,
+ char **argv)
+{
+
+#ifdef GLXEXT
+ if (loadGlx)
+ {
+ if (!xglLoadGLXModules ())
+ FatalError ("No GLX modules loaded");
+ }
+#endif
+
+ xeglInitOutput (pScreenInfo, argc, argv);
+}
+
+Bool
+LegalModifier (unsigned int key,
+ DevicePtr pDev)
+{
+ return xeglLegalModifier (key, pDev);
+}
+
+void
+ProcessInputEvents (void)
+{
+ xeglProcessInputEvents ();
+}
+
+void
+InitInput (int argc,
+ char **argv)
+{
+ xeglInitInput (argc, argv);
+}
+
+void
+ddxUseMsg (void)
+{
+ ErrorF ("\nXgl usage:\n");
+
+#ifdef GLXEXT
+ ErrorF ("-noglx don't load glx extension\n");
+#endif
+
+ xglUseMsg ();
+ ErrorF ("\nXegl usage:\n");
+ xeglUseMsg ();
+}
+
+int
+ddxProcessArgument (int argc,
+ char **argv,
+ int i)
+{
+ int skip;
+
+#ifdef GLXEXT
+ if (!strcmp (argv[i], "-noglx"))
+ {
+ loadGlx = FALSE;
+ return 1;
+ }
+#endif
+
+ skip = xglProcessArgument (argc, argv, i);
+ if (skip)
+ return skip;
+
+ return xeglProcessArgument (argc, argv, i);
+}
+
+void
+AbortDDX (void)
+{
+ xeglAbort ();
+}
+
+void
+ddxGiveUp (void)
+{
+ xeglGiveUp ();
+}
+
+void
+OsVendorInit (void)
+{
+ xeglOsVendorInit ();
+}
diff --git a/hw/xgl/glx/Makefile.am b/hw/xgl/glx/Makefile.am
index 2ab66d8f6..138ee8cef 100644
--- a/hw/xgl/glx/Makefile.am
+++ b/hw/xgl/glx/Makefile.am
@@ -1,16 +1,33 @@
+if XGLSERVER
+MODULE_SUBDIRS = module
+endif
+
+SUBDIRS = \
+ . \
+ $(MODULE_SUBDIRS)
+
INCLUDES = \
- @XGL_INCS@ \
+ @XGLX_INCS@ \
@XSERVER_CFLAGS@ \
+ @XGLSERVER_CFLAGS@ \
@XGLXSERVER_CFLAGS@
-bin_PROGRAMS = Xglx
+noinst_LTLIBRARIES = libxglx.la
-Xglx_SOURCES = xglx.c
+libxglx_la_SOURCES = \
+ xglx.h \
+ xglx.c
-Xglx_LDADD = \
- @XGL_LIBS@ \
+if XGLXSERVER
+Xglx_DEPENDENCIES = @XGLX_LIBS@
+Xglx_LDFLAGS = -export-dynamic
+Xglx_SOURCES = xglxinit.c
+Xglx_LDADD = \
+ @XGLX_LIBS@ \
@XSERVER_LIBS@ \
+ @XGLSERVER_LIBS@ \
@XGLXSERVER_LIBS@
+Xglx_programs = Xglx
+endif
-Xglx_DEPENDENCIES = @XGL_LIBS@
-
+bin_PROGRAMS = $(Xglx_programs)
diff --git a/hw/xgl/glx/module/Makefile.am b/hw/xgl/glx/module/Makefile.am
new file mode 100644
index 000000000..dd5f09772
--- /dev/null
+++ b/hw/xgl/glx/module/Makefile.am
@@ -0,0 +1,14 @@
+INCLUDES = \
+ @XGLX_INCS@ \
+ @XSERVER_CFLAGS@ \
+ @XGLXSERVER_CFLAGS@
+
+libxglx_la_LDFLAGS = -avoid-version
+libxglx_la_SOURCES = xglxmodule.c
+libxglx_la_LIBADD = \
+ @XGLX_MOD_LIBS@ \
+ @XGLXSERVER_LIBS@
+
+moduledir = @MODULEPATH@/xgl
+
+module_LTLIBRARIES = libxglx.la \ No newline at end of file
diff --git a/hw/xgl/glx/module/xglxmodule.c b/hw/xgl/glx/module/xglxmodule.c
new file mode 100644
index 000000000..066cb8082
--- /dev/null
+++ b/hw/xgl/glx/module/xglxmodule.c
@@ -0,0 +1,104 @@
+/*
+ * 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@novell.com>
+ */
+
+#include "xglx.h"
+#include "xglmodule.h"
+
+#include <glitz-glx.h>
+
+char *
+moduleVersion (void)
+{
+ return VERSION;
+}
+
+Bool
+moduleInit (const char *module)
+{
+ glitz_glx_init (module);
+
+ return TRUE;
+}
+
+void
+InitOutput (ScreenInfo *pScreenInfo,
+ int argc,
+ char **argv)
+{
+ xglxInitOutput (pScreenInfo, argc, argv);
+}
+
+Bool
+LegalModifier (unsigned int key,
+ DevicePtr pDev)
+{
+ return xglxLegalModifier (key, pDev);
+}
+
+void
+ProcessInputEvents (void)
+{
+ xglxProcessInputEvents ();
+}
+
+void
+InitInput (int argc,
+ char **argv)
+{
+ xglxInitInput (argc, argv);
+}
+
+void
+ddxUseMsg (void)
+{
+ ErrorF ("\nXglx usage:\n");
+ xglxUseMsg ();
+}
+
+int
+ddxProcessArgument (int argc,
+ char **argv,
+ int i)
+{
+ return xglxProcessArgument (argc, argv, i);
+}
+
+void
+AbortDDX (void)
+{
+ xglxAbort ();
+}
+
+void
+ddxGiveUp (void)
+{
+ xglxGiveUp ();
+}
+
+void
+OsVendorInit (void)
+{
+ xglxOsVendorInit ();
+}
diff --git a/hw/xgl/glx/xglx.c b/hw/xgl/glx/xglx.c
index 95df887df..f8ac366b1 100644
--- a/hw/xgl/glx/xglx.c
+++ b/hw/xgl/glx/xglx.c
@@ -27,7 +27,12 @@
#include <X11/Xutil.h>
#include <glitz-glx.h>
-#include "xgl.h"
+#include "xglx.h"
+
+#ifdef GLXEXT
+#include "xglglxext.h"
+#endif
+
#include "inputstr.h"
#include "cursorstr.h"
#include "mipointer.h"
@@ -72,21 +77,13 @@ typedef struct _xglxCursor {
#define XGLX_CURSOR_PRIV(pCursor, pScreen) \
xglxCursorPtr pCursorPriv = XGLX_GET_CURSOR_PRIV (pCursor, pScreen)
-char *xDisplayName = NULL;
-Display *xdisplay = NULL;
-int xscreen;
-glitz_format_t *xglxCurrentFormat;
-CARD32 lastEventTime = 0;
-ScreenPtr currentScreen = NULL;
-Bool softCursor = FALSE;
-xglScreenInfoRec xglScreenInfo = {
- NULL, 0, 0, 0, 0, FALSE,
- DEFAULT_GEOMETRY_DATA_TYPE,
- DEFAULT_GEOMETRY_USAGE,
- FALSE,
- XGL_DEFAULT_PBO_MASK,
- FALSE
-};
+static char *xDisplayName = 0;
+static Display *xdisplay = 0;
+static int xscreen;
+static CARD32 lastEventTime = 0;
+static ScreenPtr currentScreen = 0;
+static Bool softCursor = FALSE;
+static Bool fullscreen = FALSE;
static Bool
xglxAllocatePrivates (ScreenPtr pScreen)
@@ -375,7 +372,7 @@ xglxScreenInit (int index,
pScreenPriv->colormap =
XCreateColormap (xdisplay, root, vinfo->visual, AllocNone);
- if (xglScreenInfo.fullscreen)
+ if (fullscreen)
{
xglScreenInfo.width = DisplayWidth (xdisplay, xscreen);
xglScreenInfo.height = DisplayHeight (xdisplay, xscreen);
@@ -405,7 +402,7 @@ xglxScreenInit (int index,
normalHints->max_width = xglScreenInfo.width;
normalHints->max_height = xglScreenInfo.height;
- if (xglScreenInfo.fullscreen)
+ if (fullscreen)
{
normalHints->x = 0;
normalHints->y = 0;
@@ -444,7 +441,7 @@ xglxScreenInit (int index,
XMapWindow (xdisplay, pScreenPriv->win);
- if (xglScreenInfo.fullscreen)
+ if (fullscreen)
{
XClientMessageEvent xev;
@@ -465,9 +462,14 @@ xglxScreenInit (int index,
xglScreenInfo.drawable = drawable;
- if (!xglScreenInit (pScreen, &xglScreenInfo))
+ if (!xglScreenInit (pScreen))
return FALSE;
-
+
+#ifdef GLXEXT
+ if (!xglInitVisualConfigs (pScreen))
+ return FALSE;
+#endif
+
XGL_SCREEN_WRAP (CloseScreen, xglxCloseScreen);
#ifdef ARGB_CURSOR
@@ -526,9 +528,9 @@ xglxScreenInit (int index,
}
void
-InitOutput (ScreenInfo *pScreenInfo,
- int argc,
- char **argv)
+xglxInitOutput (ScreenInfo *pScreenInfo,
+ int argc,
+ char **argv)
{
glitz_drawable_format_t *format, templ;
int i;
@@ -792,21 +794,22 @@ xglxKeybdProc (DeviceIntPtr pDevice,
}
Bool
-LegalModifier (unsigned int key,
- DevicePtr pDev)
+xglxLegalModifier (unsigned int key,
+ DevicePtr pDev)
{
return TRUE;
}
void
-ProcessInputEvents ()
+xglxProcessInputEvents (void)
{
mieqProcessInputEvents ();
miPointerUpdate ();
}
void
-InitInput (int argc, char **argv)
+xglxInitInput (int argc,
+ char **argv)
{
DeviceIntPtr pKeyboard, pPointer;
@@ -827,18 +830,36 @@ InitInput (int argc, char **argv)
}
void
-ddxUseMsg (void)
+xglxUseMsg (void)
{
- ErrorF ("\nXglx usage:\n");
+ ErrorF ("-screen WIDTH[/WIDTHMM]xHEIGHT[/HEIGHTMM] "
+ "specify screen characteristics\n");
+ ErrorF ("-fullscreen run fullscreen\n");
ErrorF ("-display string display name of the real server\n");
ErrorF ("-softcursor force software cursor\n");
-
- xglUseMsg ();
}
int
-ddxProcessArgument (int argc, char **argv, int i)
+xglxProcessArgument (int argc,
+ char **argv,
+ int i)
{
+ if (!strcmp (argv[i], "-screen"))
+ {
+ if ((i + 1) < argc)
+ {
+ xglParseScreen (argv[i + 1]);
+ }
+ else
+ return 1;
+
+ return 2;
+ }
+ else if (!strcmp (argv[i], "-fullscreen"))
+ {
+ fullscreen = TRUE;
+ return 1;
+ }
if (!strcmp (argv[i], "-display"))
{
if (++i < argc) {
@@ -853,22 +874,22 @@ ddxProcessArgument (int argc, char **argv, int i)
return 1;
}
- return xglProcessArgument (&xglScreenInfo, argc, argv, i);
+ return 0;
}
void
-AbortDDX (void)
-{
+xglxAbort (void)
+{
}
void
-ddxGiveUp ()
+xglxGiveUp ()
{
AbortDDX ();
}
void
-OsVendorInit (void)
+xglxOsVendorInit (void)
{
}
@@ -924,7 +945,7 @@ xglxCreateARGBCursor (ScreenPtr pScreen,
xformat = XRenderFindStandardFormat (xdisplay, PictStandardARGB32);
xpicture = XRenderCreatePicture (xdisplay, xpixmap, xformat, 0, 0);
-
+
cursor = XRenderCreateCursor (xdisplay, xpicture,
pCursor->bits->xhot,
pCursor->bits->yhot);
diff --git a/hw/xgl/glx/xglx.h b/hw/xgl/glx/xglx.h
new file mode 100644
index 000000000..cb2ea2af1
--- /dev/null
+++ b/hw/xgl/glx/xglx.h
@@ -0,0 +1,64 @@
+/*
+ * 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@novell.com>
+ */
+
+#ifndef _XGLX_H_
+#define _XGLX_H_
+
+#include "xgl.h"
+
+void
+xglxInitOutput (ScreenInfo *pScreenInfo,
+ int argc,
+ char **argv);
+
+Bool
+xglxLegalModifier (unsigned int key,
+ DevicePtr pDev);
+
+void
+xglxProcessInputEvents (void);
+
+void
+xglxInitInput (int argc,
+ char **argv);
+
+void
+xglxUseMsg (void);
+
+int
+xglxProcessArgument (int argc,
+ char **argv,
+ int i);
+
+void
+xglxAbort (void);
+
+void
+xglxGiveUp (void);
+
+void
+xglxOsVendorInit (void);
+
+#endif /* _XGLX_H_ */
diff --git a/hw/xgl/glx/xglxinit.c b/hw/xgl/glx/xglxinit.c
new file mode 100644
index 000000000..18bdca1f8
--- /dev/null
+++ b/hw/xgl/glx/xglxinit.c
@@ -0,0 +1,131 @@
+/*
+ * Copyright © 2004 David Reveman
+ *
+ * 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
+ * David Reveman not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * David Reveman makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL DAVID REVEMAN 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@novell.com>
+ */
+
+#include "xglx.h"
+
+static xglScreenInfoRec xglxScreenInfo = {
+ NULL, 0, 0, 0, 0,
+ DEFAULT_GEOMETRY_DATA_TYPE,
+ DEFAULT_GEOMETRY_USAGE,
+ FALSE,
+ XGL_DEFAULT_PBO_MASK,
+ FALSE,
+ FALSE
+};
+
+#ifdef GLXEXT
+static Bool loadGlx = TRUE;
+#endif
+
+void
+InitOutput (ScreenInfo *pScreenInfo,
+ int argc,
+ char **argv)
+{
+
+#ifdef GLXEXT
+ if (loadGlx)
+ {
+ if (!xglLoadGLXModules ())
+ FatalError ("No GLX modules loaded");
+ }
+#endif
+
+ xglxInitOutput (&xglxScreenInfo, pScreenInfo, argc, argv);
+}
+
+Bool
+LegalModifier (unsigned int key,
+ DevicePtr pDev)
+{
+ return xglxLegalModifier (key, pDev);
+}
+
+void
+ProcessInputEvents (void)
+{
+ xglxProcessInputEvents ();
+}
+
+void
+InitInput (int argc,
+ char **argv)
+{
+ xglxInitInput (&xglxScreenInfo, argc, argv);
+}
+
+void
+ddxUseMsg (void)
+{
+ ErrorF ("\nXgl usage:\n");
+
+#ifdef GLXEXT
+ ErrorF ("-noglx don't load glx extension\n");
+#endif
+
+ xglUseMsg ();
+ ErrorF ("\nXglx usage:\n");
+ xglxUseMsg ();
+}
+
+int
+ddxProcessArgument (int argc,
+ char **argv,
+ int i)
+{
+ int skip;
+
+#ifdef GLXEXT
+ if (!strcmp (argv[i], "-noglx"))
+ {
+ loadGlx = FALSE;
+ return 1;
+ }
+#endif
+
+ skip = xglProcessArgument (&xglxScreenInfo, argc, argv, i);
+ if (skip)
+ return skip;
+
+ return xglxProcessArgument (&xglxScreenInfo, argc, argv, i);
+}
+
+void
+AbortDDX (void)
+{
+ xglxAbort ();
+}
+
+void
+ddxGiveUp (void)
+{
+ xglxGiveUp ();
+}
+
+void
+OsVendorInit (void)
+{
+ xglxOsVendorInit ();
+}
diff --git a/hw/xgl/glxext/Makefile.am b/hw/xgl/glxext/Makefile.am
new file mode 100644
index 000000000..53d5fe841
--- /dev/null
+++ b/hw/xgl/glxext/Makefile.am
@@ -0,0 +1,13 @@
+SUBDIRS = module
+
+INCLUDES = \
+ @XGL_INCS@ \
+ @XSERVER_CFLAGS@
+
+libxglglxext_libraries = libxglglxext.la
+libxglglxext_la_SOURCES = \
+ xglglxext.h \
+ xglglxext.c
+
+noinst_LTLIBRARIES = $(libxglglxext_libraries)
+
diff --git a/hw/xgl/glxext/module/Makefile.am b/hw/xgl/glxext/module/Makefile.am
new file mode 100644
index 000000000..8272ae514
--- /dev/null
+++ b/hw/xgl/glxext/module/Makefile.am
@@ -0,0 +1,19 @@
+INCLUDES = \
+ @XGLX_INCS@ \
+ @XSERVER_CFLAGS@
+
+libglx_la_LDFLAGS = -avoid-version
+libglx_la_SOURCES = glxmodule.c
+libglx_la_LIBADD = $(top_builddir)/GL/glx/libglx.la
+libglx_modules = libglx.la
+
+libglcore_la_LDFLAGS = -avoid-version
+libglcore_la_SOURCES = glcoremodule.c
+libglcore_la_LIBADD = $(top_builddir)/GL/mesa/libglcore.la
+libglcore_modules = libglcore.la
+
+moduledir = @MODULEPATH@/xgl
+
+module_LTLIBRARIES = \
+ $(libglcore_modules) \
+ $(libglx_modules) \ No newline at end of file
diff --git a/hw/xgl/glxext/module/glcoremodule.c b/hw/xgl/glxext/module/glcoremodule.c
new file mode 100644
index 000000000..37aa9c658
--- /dev/null
+++ b/hw/xgl/glxext/module/glcoremodule.c
@@ -0,0 +1,38 @@
+/*
+ * 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@novell.com>
+ */
+
+#include "xglmodule.h"
+
+char *
+moduleVersion (void)
+{
+ return VERSION;
+}
+
+Bool
+moduleInit (const char *module)
+{
+ return TRUE;
+}
diff --git a/hw/xgl/glxext/module/glxmodule.c b/hw/xgl/glxext/module/glxmodule.c
new file mode 100644
index 000000000..37aa9c658
--- /dev/null
+++ b/hw/xgl/glxext/module/glxmodule.c
@@ -0,0 +1,38 @@
+/*
+ * 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@novell.com>
+ */
+
+#include "xglmodule.h"
+
+char *
+moduleVersion (void)
+{
+ return VERSION;
+}
+
+Bool
+moduleInit (const char *module)
+{
+ return TRUE;
+}
diff --git a/hw/xgl/xglglx.c b/hw/xgl/glxext/xglglxext.c
index 88e23e2a4..df365717f 100644
--- a/hw/xgl/xglglx.c
+++ b/hw/xgl/glxext/xglglxext.c
@@ -1,6 +1,6 @@
/*
* 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
@@ -24,10 +24,11 @@
*/
#include "xgl.h"
-
-#ifdef GLXEXT
+#include "xglglxext.h"
#include <GL/gl.h>
+#include <GL/glext.h>
+#include <GL/internal/glcore.h>
#include "glxserver.h"
#include "glxdrawable.h"
@@ -35,6 +36,7 @@
#include "glxutil.h"
#include "unpack.h"
#include "g_disptab.h"
+#include "glxext.h"
#include "micmap.h"
#define XGL_MAX_TEXTURE_UNITS 8
@@ -44,33 +46,6 @@
#define XGL_TEXTURE_3D_BIT (1 << 2)
#define XGL_TEXTURE_RECTANGLE_BIT (1 << 3)
#define XGL_TEXTURE_CUBE_MAP_BIT (1 << 4)
-
-extern void
-GlxSetVisualConfigs (int nconfigs,
- __GLXvisualConfig *configs,
- void **privates);
-
-extern void
-GlxWrapInitVisuals (miInitVisualsProcPtr *);
-
-extern int
-GlxInitVisuals (VisualPtr *visualp,
- DepthPtr *depthp,
- int *nvisualp,
- int *ndepthp,
- int *rootDepthp,
- VisualID *defaultVisp,
- unsigned long sizes,
- int bitsPerRGB,
- int preferredVis);
-
-extern void
-__glXFlushContextCache (void);
-
-extern __GLXscreenInfo __glDDXScreenInfo;
-
-extern __glProcTable __glMesaRenderTable;
-extern __glProcTableEXT __glMesaRenderTableEXT;
typedef Bool (*GLXScreenProbeProc) (int screen);
typedef __GLinterface *(*GLXCreateContextProc) (__GLimports *imports,
@@ -91,6 +66,8 @@ typedef struct _xglGLXScreenInfo {
static xglGLXScreenInfoRec screenInfoPriv;
+extern __GLXscreenInfo __glDDXScreenInfo;
+
typedef GLboolean (*GLResizeBuffersProc) (__GLdrawableBuffer *buffer,
GLint x,
GLint y,
@@ -99,7 +76,7 @@ typedef GLboolean (*GLResizeBuffersProc) (__GLdrawableBuffer *buffer,
__GLdrawablePrivate *glPriv,
GLuint bufferMask);
typedef void (*GLFreeBuffersProc) (__GLdrawablePrivate *glPriv);
-
+
typedef struct _xglGLBuffer {
GLXSwapBuffersProc swapBuffers;
GLXBindBuffersProc bindBuffers;
@@ -142,11 +119,6 @@ typedef struct _xglGLOp {
GLuint texture;
} bind_texture;
struct {
- GLenum target;
- GLenum pname;
- GLint params[4];
- } tex_parameter_iv;
- struct {
GLenum target;
GLenum pname;
GLfloat params[4];
@@ -156,7 +128,7 @@ typedef struct _xglGLOp {
GLint y;
GLsizei width;
GLsizei height;
- GLenum type;
+ GLenum type;
} copy_pixels;
struct {
GLenum target;
@@ -258,10 +230,11 @@ typedef struct _xglDisplayList {
} xglDisplayListRec;
typedef struct _xglTexObj {
- GLuint key;
- GLuint name;
- PixmapPtr pPixmap;
- int refcnt;
+ GLuint key;
+ GLuint name;
+ PixmapPtr pPixmap;
+ glitz_texture_object_t *object;
+ int refcnt;
} xglTexObjRec, *xglTexObjPtr;
typedef struct _xglTexUnit {
@@ -295,6 +268,7 @@ typedef struct _xglGLContext {
Bool needInit;
xglGLBufferPtr pDrawBuffer;
xglGLBufferPtr pReadBuffer;
+ GLuint fbo;
int drawXoff, drawYoff;
char *versionString;
GLenum errorValue;
@@ -317,6 +291,8 @@ typedef struct _xglGLContext {
static xglGLContextPtr cctx = NULL;
+//static void
+//xglSetCurrentContext (xglGLContextPtr pContext, glitz_drawable_t *drawable);
static void
xglSetCurrentContext (xglGLContextPtr pContext);
@@ -719,8 +695,10 @@ xglDeleteTexObj (xglTexObjPtr pTexObj)
if (pTexObj->pPixmap)
{
ScreenPtr pScreen = pTexObj->pPixmap->drawable.pScreen;
-
+
(*pScreen->DestroyPixmap) (pTexObj->pPixmap);
+
+ glitz_texture_object_destroy (pTexObj->object);
}
if (pTexObj->name)
@@ -731,6 +709,7 @@ xglDeleteTexObj (xglTexObjPtr pTexObj)
pTexObj->key = 0;
pTexObj->name = 0;
pTexObj->pPixmap = NULL;
+ pTexObj->object = NULL;
}
static void
@@ -1238,6 +1217,7 @@ xglGenTextures (GLsizei n,
pTexObj->key = name;
pTexObj->name = *textures;
pTexObj->pPixmap = NULL;
+ pTexObj->object = NULL;
pTexObj->refcnt = 1;
xglHashInsert (cctx->shared->texObjects, name, pTexObj);
@@ -1294,6 +1274,7 @@ xglBindTextureProc (xglGLOpPtr pOp)
pTexObj->key = pOp->u.bind_texture.texture;
pTexObj->pPixmap = NULL;
+ pTexObj->object = NULL;
pTexObj->refcnt = 1;
glGenTextures (1, &pTexObj->name);
@@ -1339,7 +1320,7 @@ xglSetupTextures (void)
xglTexUnitPtr pTexUnit;
xglTexObjPtr pTexObj[XGL_MAX_TEXTURE_UNITS];
int i, activeTexUnit;
-
+
for (i = 0; i < pContext->maxTexUnits; i++)
{
pTexObj[i] = NULL;
@@ -1351,7 +1332,7 @@ xglSetupTextures (void)
pTexObj[i] = pTexUnit->pRect;
else if (pTexUnit->enabled & XGL_TEXTURE_2D_BIT)
pTexObj[i] = pTexUnit->p2D;
-
+
if (pTexObj[i] && pTexObj[i]->pPixmap)
{
if (!xglSyncSurface (&pTexObj[i]->pPixmap->drawable))
@@ -1365,27 +1346,28 @@ xglSetupTextures (void)
if (pContext != cctx)
{
XGL_SCREEN_PRIV (pContext->pDrawBuffer->pGC->pScreen);
-
+
glitz_drawable_finish (pScreenPriv->drawable);
-
+
xglSetCurrentContext (pContext);
}
-
+
activeTexUnit = cctx->activeTexUnit;
for (i = 0; i < pContext->maxTexUnits; i++)
{
if (pTexObj[i])
{
- XGL_PIXMAP_PRIV (pTexObj[i]->pPixmap);
-
- activeTexUnit = GL_TEXTURE0_ARB + i;
- cctx->ActiveTextureARB (activeTexUnit);
- glitz_context_bind_texture (cctx->context, pPixmapPriv->surface);
+ if (i != activeTexUnit)
+ {
+ cctx->ActiveTextureARB (GL_TEXTURE0_ARB + i);
+ activeTexUnit = i;
+ }
+ glitz_context_bind_texture (cctx->context, pTexObj[i]->object);
}
}
- if (cctx->activeTexUnit != activeTexUnit)
- cctx->ActiveTextureARB (cctx->activeTexUnit);
+ if (activeTexUnit != cctx->activeTexUnit)
+ cctx->ActiveTextureARB (cctx->activeTexUnit);
}
static GLboolean
@@ -1510,6 +1492,36 @@ xglPrioritizeTextures (GLsizei n,
}
}
+static glitz_texture_filter_t
+xglTextureFilter (GLenum param)
+{
+ switch (param) {
+ case GL_LINEAR:
+ return GLITZ_TEXTURE_FILTER_LINEAR;
+ case GL_NEAREST:
+ default:
+ return GLITZ_TEXTURE_FILTER_NEAREST;
+ }
+}
+
+static glitz_texture_wrap_t
+xglTextureWrap (GLenum param)
+{
+ switch (param) {
+ case GL_CLAMP_TO_EDGE:
+ return GLITZ_TEXTURE_WRAP_CLAMP_TO_EDGE;
+ case GL_CLAMP_TO_BORDER:
+ return GLITZ_TEXTURE_WRAP_CLAMP_TO_BORDER;
+ case GL_REPEAT:
+ return GLITZ_TEXTURE_WRAP_REPEAT;
+ case GL_MIRRORED_REPEAT:
+ return GLITZ_TEXTURE_WRAP_MIRRORED_REPEAT;
+ case GL_CLAMP:
+ default:
+ return GLITZ_TEXTURE_WRAP_CLAMP;
+ }
+}
+
static void
xglTexParameterfvProc (xglGLOpPtr pOp)
{
@@ -1533,17 +1545,42 @@ xglTexParameterfvProc (xglGLOpPtr pOp)
if (pTexObj && pTexObj->pPixmap)
{
- XGL_PIXMAP_PRIV (pTexObj->pPixmap);
+ GLfloat *params = pOp->u.tex_parameter_fv.params;
- /* texture parameters should eventually go into a
- glitz_texture_object_t */
- glitz_context_bind_texture (cctx->context, pPixmapPriv->surface);
+ switch (pOp->u.tex_parameter_fv.pname) {
+ case GL_TEXTURE_MIN_FILTER:
+ glitz_texture_object_set_filter (pTexObj->object,
+ GLITZ_TEXTURE_FILTER_TYPE_MIN,
+ xglTextureFilter (params[0]));
+ break;
+ case GL_TEXTURE_MAG_FILTER:
+ glitz_texture_object_set_filter (pTexObj->object,
+ GLITZ_TEXTURE_FILTER_TYPE_MAG,
+ xglTextureFilter (params[0]));
+ break;
+ case GL_TEXTURE_WRAP_S:
+ glitz_texture_object_set_wrap (pTexObj->object,
+ GLITZ_TEXTURE_WRAP_TYPE_S,
+ xglTextureWrap (params[0]));
+ break;
+ case GL_TEXTURE_WRAP_T:
+ glitz_texture_object_set_wrap (pTexObj->object,
+ GLITZ_TEXTURE_WRAP_TYPE_T,
+ xglTextureWrap (params[0]));
+ break;
+ case GL_TEXTURE_BORDER_COLOR: {
+ glitz_color_t color;
- glTexParameterfv (pOp->u.tex_parameter_fv.target,
- pOp->u.tex_parameter_fv.pname,
- pOp->u.tex_parameter_fv.params);
-
- glBindTexture (pOp->u.tex_parameter_fv.target, pTexObj->name);
+ color.red = params[0] * 0xffff;
+ color.green = params[1] * 0xffff;
+ color.blue = params[2] * 0xffff;
+ color.alpha = params[3] * 0xffff;
+
+ glitz_texture_object_set_border_color (pTexObj->object, &color);
+ }
+ default:
+ break;
+ }
}
}
@@ -1553,7 +1590,7 @@ xglTexParameterfv (GLenum target,
const GLfloat *params)
{
xglGLOpRec gl;
-
+
gl.glProc = xglTexParameterfvProc;
gl.u.tex_parameter_fv.target = target;
@@ -1569,45 +1606,8 @@ xglTexParameterfv (GLenum target,
gl.u.tex_parameter_fv.params[0] = params[0];
break;
}
-
- xglGLOp (&gl);
-}
-
-static void
-xglTexParameterivProc (xglGLOpPtr pOp)
-{
- xglTexObjPtr pTexObj;
-
- glTexParameteriv (pOp->u.tex_parameter_iv.target,
- pOp->u.tex_parameter_iv.pname,
- pOp->u.tex_parameter_iv.params);
-
- switch (pOp->u.tex_parameter_iv.target) {
- case GL_TEXTURE_2D:
- pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].p2D;
- break;
- case GL_TEXTURE_RECTANGLE_NV:
- pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].pRect;
- break;
- default:
- pTexObj = NULL;
- break;
- }
-
- if (pTexObj && pTexObj->pPixmap)
- {
- XGL_PIXMAP_PRIV (pTexObj->pPixmap);
-
- /* texture parameters should eventually go into a
- glitz_texture_object_t */
- glitz_context_bind_texture (cctx->context, pPixmapPriv->surface);
- glTexParameteriv (pOp->u.tex_parameter_iv.target,
- pOp->u.tex_parameter_iv.pname,
- pOp->u.tex_parameter_iv.params);
-
- glBindTexture (pOp->u.tex_parameter_iv.target, pTexObj->name);
- }
+ xglGLOp (&gl);
}
static void
@@ -1616,23 +1616,24 @@ xglTexParameteriv (GLenum target,
const GLint *params)
{
xglGLOpRec gl;
-
- gl.glProc = xglTexParameterivProc;
- gl.u.tex_parameter_iv.target = target;
- gl.u.tex_parameter_iv.pname = pname;
+ gl.glProc = xglTexParameterfvProc;
+
+ gl.u.tex_parameter_fv.target = target;
+ gl.u.tex_parameter_fv.pname = pname;
switch (pname) {
case GL_TEXTURE_BORDER_COLOR:
- gl.u.tex_parameter_iv.params[3] = params[3];
- gl.u.tex_parameter_iv.params[2] = params[2];
- gl.u.tex_parameter_iv.params[1] = params[1];
- /* fall-through */
+ gl.u.tex_parameter_fv.params[3] = (GLfloat) params[3] / INT_MAX;
+ gl.u.tex_parameter_fv.params[2] = (GLfloat) params[2] / INT_MAX;
+ gl.u.tex_parameter_fv.params[1] = (GLfloat) params[1] / INT_MAX;
+ gl.u.tex_parameter_fv.params[0] = (GLfloat) params[0] / INT_MAX;
+ break;
default:
- gl.u.tex_parameter_iv.params[0] = params[0];
+ gl.u.tex_parameter_fv.params[0] = params[0];
break;
}
-
+
xglGLOp (&gl);
}
@@ -1674,12 +1675,9 @@ xglGetTexLevelParameterfv (GLenum target,
if (pTexObj && pTexObj->pPixmap)
{
- XGL_PIXMAP_PRIV (pTexObj->pPixmap);
-
- glitz_context_bind_texture (cctx->context, pPixmapPriv->surface);
+ glitz_context_bind_texture (cctx->context, pTexObj->object);
glGetTexLevelParameterfv (target, level, pname, params);
-
glBindTexture (target, pTexObj->name);
}
else
@@ -1708,12 +1706,9 @@ xglGetTexLevelParameteriv (GLenum target,
if (pTexObj && pTexObj->pPixmap)
{
- XGL_PIXMAP_PRIV (pTexObj->pPixmap);
-
- glitz_context_bind_texture (cctx->context, pPixmapPriv->surface);
+ glitz_context_bind_texture (cctx->context, pTexObj->object);
glGetTexLevelParameteriv (target, level, pname, params);
-
glBindTexture (target, pTexObj->name);
}
else
@@ -2008,6 +2003,7 @@ xglFlush (void)
if (REGION_NOTEMPTY (pBuffer->pDrawable->pScreen, &pBuffer->damage))
{
+ xglAddBitDamage (pBuffer->pDrawable, &pBuffer->damage);
DamageDamageRegion (pBuffer->pDrawable, &pBuffer->damage);
REGION_EMPTY (pBuffer->pDrawable->pScreen, &pBuffer->damage);
}
@@ -2025,6 +2021,7 @@ xglFinish (void)
if (REGION_NOTEMPTY (pBuffer->pDrawable->pScreen, &pBuffer->damage))
{
+ xglAddBitDamage (pBuffer->pDrawable, &pBuffer->damage);
DamageDamageRegion (pBuffer->pDrawable, &pBuffer->damage);
REGION_EMPTY (pBuffer->pDrawable->pScreen, &pBuffer->damage);
}
@@ -3394,6 +3391,65 @@ xglNoOpPointParameterivNV (GLenum pname, const GLint *params) {}
static void
xglNoOpActiveStencilFaceEXT (GLenum face) {}
+/* GL_EXT_framebuffer_object */
+static GLboolean
+xglNoOpIsRenderbufferEXT (GLuint renderbuffer)
+{
+ return FALSE;
+}
+static void
+xglNoOpBindRenderbufferEXT (GLenum target, GLuint renderbuffer) {}
+static void
+xglNoOpDeleteRenderbuffersEXT (GLsizei n, const GLuint *renderbuffers) {}
+static void
+xglNoOpGenRenderbuffersEXT (GLsizei n, GLuint *renderbuffers) {}
+static void
+xglNoOpRenderbufferStorageEXT (GLenum target, GLenum internalformat,
+ GLsizei width, GLsizei height) {}
+static void
+xglNoOpGetRenderbufferParameterivEXT (GLenum target, GLenum pname,
+ GLint *params) {}
+static GLboolean
+xglNoOpIsFramebufferEXT (GLuint framebuffer)
+{
+ return FALSE;
+}
+static void
+xglNoOpBindFramebufferEXT (GLenum target, GLuint framebuffer) {}
+static void
+xglNoOpDeleteFramebuffersEXT (GLsizei n, const GLuint *framebuffers) {}
+static void
+xglNoOpGenFramebuffersEXT (GLsizei n, GLuint *framebuffers) {}
+static GLenum
+xglNoOpCheckFramebufferStatusEXT (GLenum target)
+{
+ return GL_FRAMEBUFFER_UNSUPPORTED_EXT;
+}
+static void
+xglNoOpFramebufferTexture1DEXT (GLenum target, GLenum attachment,
+ GLenum textarget, GLuint texture,
+ GLint level) {}
+static void
+xglNoOpFramebufferTexture2DEXT (GLenum target, GLenum attachment,
+ GLenum textarget, GLuint texture,
+ GLint level) {}
+static void
+xglNoOpFramebufferTexture3DEXT (GLenum target, GLenum attachment,
+ GLenum textarget, GLuint texture,
+ GLint level, GLint zoffset) {}
+static void
+xglNoOpFramebufferRenderbufferEXT (GLenum target, GLenum attachment,
+ GLenum renderbuffertarget,
+ GLuint renderbuffer) {}
+static void
+xglNoOpGetFramebufferAttachmentParameterivEXT (GLenum target,
+ GLenum attachment,
+ GLenum pname,
+ GLint *params) {}
+static void
+xglNoOpGenerateMipmapEXT (GLenum target) {}
+
+
__glProcTableEXT __glNoOpRenderTableEXT = {
xglNoOpActiveTextureARB,
xglNoOpClientActiveTextureARB,
@@ -3437,7 +3493,24 @@ __glProcTableEXT __glNoOpRenderTableEXT = {
xglNoOpSecondaryColorPointerEXT,
xglNoOpPointParameteriNV,
xglNoOpPointParameterivNV,
- xglNoOpActiveStencilFaceEXT
+ xglNoOpActiveStencilFaceEXT,
+ xglNoOpIsRenderbufferEXT,
+ xglNoOpBindRenderbufferEXT,
+ xglNoOpDeleteRenderbuffersEXT,
+ xglNoOpGenRenderbuffersEXT,
+ xglNoOpRenderbufferStorageEXT,
+ xglNoOpGetRenderbufferParameterivEXT,
+ xglNoOpIsFramebufferEXT,
+ xglNoOpBindFramebufferEXT,
+ xglNoOpDeleteFramebuffersEXT,
+ xglNoOpGenFramebuffersEXT,
+ xglNoOpCheckFramebufferStatusEXT,
+ xglNoOpFramebufferTexture1DEXT,
+ xglNoOpFramebufferTexture2DEXT,
+ xglNoOpFramebufferTexture3DEXT,
+ xglNoOpFramebufferRenderbufferEXT,
+ xglNoOpGetFramebufferAttachmentParameterivEXT,
+ xglNoOpGenerateMipmapEXT
};
static void
@@ -3666,18 +3739,90 @@ xglInitExtensions (xglGLContextPtr pContext)
glitz_context_get_proc_address (pContext->context,
"glActiveStencilFaceEXT");
}
+
+ if (strstr (extensions, "GL_EXT_framebuffer_object"))
+ {
+ pContext->glRenderTableEXT.IsRenderbufferEXT =
+ (PFNGLISRENDERBUFFEREXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glIsRenderbufferEXT");
+ pContext->glRenderTableEXT.BindRenderbufferEXT =
+ (PFNGLBINDRENDERBUFFEREXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glBindRenderbufferEXT");
+ pContext->glRenderTableEXT.DeleteRenderbuffersEXT =
+ (PFNGLDELETERENDERBUFFERSEXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glDeleteRenderbuffersEXT");
+ pContext->glRenderTableEXT.GenRenderbuffersEXT =
+ (PFNGLGENRENDERBUFFERSEXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glGenRenderbuffersEXT");
+ pContext->glRenderTableEXT.RenderbufferStorageEXT =
+ (PFNGLRENDERBUFFERSTORAGEEXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glRenderbufferStorageEXT");
+ pContext->glRenderTableEXT.GetRenderbufferParameterivEXT =
+ (PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glGetRenderbufferParameterivEXT");
+ pContext->glRenderTableEXT.IsFramebufferEXT =
+ (PFNGLISFRAMEBUFFEREXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glIsFramebufferEXT");
+ pContext->glRenderTableEXT.BindFramebufferEXT =
+ (PFNGLBINDFRAMEBUFFEREXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glBindFramebufferEXT");
+ pContext->glRenderTableEXT.DeleteFramebuffersEXT =
+ (PFNGLDELETEFRAMEBUFFERSEXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glDeleteFramebuffersEXT");
+ pContext->glRenderTableEXT.GenFramebuffersEXT =
+ (PFNGLGENFRAMEBUFFERSEXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glGenFramebuffersEXT");
+ pContext->glRenderTableEXT.CheckFramebufferStatusEXT =
+ (PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glCheckFramebufferStatusEXT");
+ pContext->glRenderTableEXT.FramebufferTexture1DEXT =
+ (PFNGLFRAMEBUFFERTEXTURE1DEXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glFramebufferTexture1DEXT");
+ pContext->glRenderTableEXT.FramebufferTexture2DEXT =
+ (PFNGLFRAMEBUFFERTEXTURE2DEXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glFramebufferTexture2DEXT");
+ pContext->glRenderTableEXT.FramebufferTexture3DEXT =
+ (PFNGLFRAMEBUFFERTEXTURE3DEXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glFramebufferTexture3DEXT");
+ pContext->glRenderTableEXT.FramebufferRenderbufferEXT =
+ (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glFramebufferRenderbufferEXT");
+ pContext->glRenderTableEXT.GetFramebufferAttachmentParameterivEXT =
+ (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glGetFramebufferAttachment"
+ "ParameterivEXT");
+ pContext->glRenderTableEXT.GenerateMipmapEXT =
+ (PFNGLGENERATEMIPMAPEXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glGenerateMipmapEXT");
+ }
}
static void
xglSetCurrentContext (xglGLContextPtr pContext)
{
- XGL_SCREEN_PRIV (pContext->pDrawBuffer->pGC->pScreen);
+ XGL_SCREEN_PRIV (pContext->pDrawBuffer->pGC->pScreen);
cctx = pContext;
glitz_context_make_current (cctx->context, pScreenPriv->drawable);
- __glRenderTable = &__glNativeRenderTable;
- __glRenderTableEXT = &cctx->glRenderTableEXT;
+ GlxSetRenderTables (&__glNativeRenderTable, &cctx->glRenderTableEXT);
}
static void
@@ -3781,7 +3926,7 @@ xglLoseCurrent (__GLcontext *gc)
xglGLContextPtr pContext = (xglGLContextPtr) gc;
__GLinterface *iface = pContext->mIface;
- __glXFlushContextCache ();
+ GlxFlushContextCache ();
if (!iface)
return GL_TRUE;
@@ -3921,6 +4066,62 @@ xglCopyContext (__GLcontext *dst,
return status;
}
+static Bool
+xglResizeBuffer (__GLdrawablePrivate *glPriv,
+ int x,
+ int y,
+ unsigned int width,
+ unsigned int height)
+{
+ xglGLBufferPtr pBufferPriv = glPriv->private;
+ DrawablePtr pDrawable = pBufferPriv->pDrawable;
+
+ XGL_SCREEN_PRIV (pDrawable->pScreen);
+ XGL_DRAWABLE_PIXMAP (pBufferPriv->pDrawable);
+
+ if (pPixmap != pScreenPriv->pScreenPixmap)
+ {
+ if (glPriv->modes->doubleBufferMode)
+ {
+ glitz_surface_t *surface = pBufferPriv->backSurface;
+
+ if (!surface ||
+ (glitz_surface_get_width (surface) != width ||
+ glitz_surface_get_height (surface) != height))
+ {
+ glitz_format_t *format;
+
+ format = pScreenPriv->pixmapFormats[pDrawable->depth].format;
+
+ if (surface)
+ glitz_surface_destroy (surface);
+
+ pBufferPriv->backSurface =
+ glitz_surface_create (pScreenPriv->drawable, format,
+ width, height, 0, NULL);
+ if (!pBufferPriv->backSurface)
+ return FALSE;
+ }
+ }
+ }
+ else
+ {
+ if (glPriv->modes->doubleBufferMode)
+ {
+ if (!pBufferPriv->backSurface)
+ {
+ pBufferPriv->backSurface = pScreenPriv->backSurface;
+ glitz_surface_reference (pScreenPriv->backSurface);
+ }
+ }
+ }
+
+ ValidateGC (pDrawable, pBufferPriv->pGC);
+
+ return TRUE;
+}
+
+
static GLboolean
xglForceCurrent (__GLcontext *gc)
{
@@ -3973,29 +4174,39 @@ xglForceCurrent (__GLcontext *gc)
cctx->pDrawBuffer->yFlip = pDrawable->height;
}
- /* check if buffers have changed */
- if (cctx->pReadBuffer->pPixmap != pReadPixmap ||
- cctx->pDrawBuffer->pPixmap != pDrawPixmap)
+ /* draw buffer changed */
+ if (cctx->pDrawBuffer->pPixmap != pDrawPixmap ||
+ cctx->pReadBuffer->pPixmap != pReadPixmap)
{
- XGL_SCREEN_PRIV (pDrawable->pScreen);
- XGL_PIXMAP_PRIV (pDrawPixmap);
-
+ __GLinterface *iface = &pContext->iface;
+ __GLdrawablePrivate *drawPriv, *readPriv;
+
if (!xglPrepareTarget (pDrawable))
return FALSE;
- /* draw buffer is offscreen */
- if (pPixmapPriv->surface != pScreenPriv->surface)
- {
- /* NYI: framebuffer object setup */
- FatalError ("NYI: offscreen GL drawable\n");
- }
+ drawPriv = iface->imports.getDrawablePrivate (gc);
+ readPriv = iface->imports.getReadablePrivate (gc);
+
+ if (!xglResizeBuffer (drawPriv,
+ pDrawable->x,
+ pDrawable->y,
+ pDrawable->width,
+ pDrawable->height))
+ return FALSE;
+
+ if (!xglResizeBuffer (readPriv,
+ cctx->pReadBuffer->pDrawable->x,
+ cctx->pReadBuffer->pDrawable->y,
+ cctx->pReadBuffer->pDrawable->width,
+ cctx->pReadBuffer->pDrawable->height))
+ return FALSE;
cctx->pReadBuffer->pPixmap = pReadPixmap;
cctx->pDrawBuffer->pPixmap = pDrawPixmap;
}
}
- xglSetCurrentContext (pContext);
+ xglSetCurrentContext (pContext);//, cctx->pDrawBuffer);
if (cctx->needInit)
{
@@ -4051,9 +4262,6 @@ xglForceCurrent (__GLcontext *gc)
else
{
cctx = NULL;
- __glRenderTable = &__glMesaRenderTable;
- __glRenderTableEXT = &__glMesaRenderTableEXT;
-
status = (*iface->exports.forceCurrent) ((__GLcontext *) iface);
}
@@ -4128,10 +4336,8 @@ static void
xglLoseCurrentContext (void *closure)
{
cctx = NULL;
- __glRenderTable = &__glMesaRenderTable;
- __glRenderTableEXT = &__glMesaRenderTableEXT;
- __glXFlushContextCache ();
+ GlxFlushContextCache ();
}
static __GLinterface *
@@ -4173,6 +4379,7 @@ xglCreateContext (__GLimports *imports,
pContext->drawXoff = 0;
pContext->drawYoff = 0;
pContext->maxTexUnits = 0;
+ pContext->fbo = 0;
if (pContext->doubleBuffer)
{
@@ -4294,6 +4501,7 @@ xglSwapBuffers (__GLXdrawablePrivate *glxPriv)
glitz_surface_set_clip_region (surface, 0, 0, NULL, 0);
}
+ xglAddBitDamage (pDrawable, pGC->pCompositeClip);
DamageDamageRegion (pDrawable, pGC->pCompositeClip);
REGION_EMPTY (pGC->pScreen, &pBufferPriv->damage);
}
@@ -4323,33 +4531,8 @@ xglResizeBuffers (__GLdrawableBuffer *buffer,
if (pDrawable)
{
- if (glPriv->modes->doubleBufferMode)
- {
- glitz_surface_t *surface = pBufferPriv->backSurface;
-
- XGL_SCREEN_PRIV (pDrawable->pScreen);
-
- /* FIXME: copy color buffer bits, stencil bits and depth bits */
-
- if (surface != pScreenPriv->backSurface &&
- (glitz_surface_get_width (surface) != width ||
- glitz_surface_get_height (surface) != height))
- {
- glitz_format_t *format;
-
- format = pScreenPriv->pixmapFormats[pDrawable->depth].format;
-
- glitz_surface_destroy (surface);
-
- pBufferPriv->backSurface =
- glitz_surface_create (pScreenPriv->drawable, format,
- width, height, 0, NULL);
- if (!pBufferPriv->backSurface)
- status = GL_FALSE;
- }
- }
-
- ValidateGC (pDrawable, pBufferPriv->pGC);
+ if (!xglResizeBuffer (glPriv, x, y, width, height))
+ return GL_FALSE;
}
else if (pBufferPriv->private)
{
@@ -4383,7 +4566,7 @@ xglBindBuffers (__GLXdrawablePrivate *glxPriv,
/* Must be a GLXpixmap */
if (!glxPriv->pGlxPixmap)
- return __glXBadDrawable;
+ return BadDrawable;
pDrawable = glxPriv->pGlxPixmap->pDraw;
@@ -4400,16 +4583,27 @@ xglBindBuffers (__GLXdrawablePrivate *glxPriv,
if (pTexObj)
{
+ glitz_texture_object_t *object;
+
XGL_DRAWABLE_PIXMAP (pDrawable);
-
- pPixmap->refcnt++;
-
- if (pTexObj->pPixmap)
- (*pDrawable->pScreen->DestroyPixmap) (pTexObj->pPixmap);
-
- pTexObj->pPixmap = pPixmap;
+ XGL_PIXMAP_PRIV (pPixmap);
+
+ object = glitz_texture_object_create (pPixmapPriv->surface);
+ if (object)
+ {
+ pPixmap->refcnt++;
+
+ if (pTexObj->pPixmap)
+ (*pDrawable->pScreen->DestroyPixmap) (pTexObj->pPixmap);
+
+ if (pTexObj->object)
+ glitz_texture_object_destroy (pTexObj->object);
+
+ pTexObj->pPixmap = pPixmap;
+ pTexObj->object = object;
- return Success;
+ return Success;
+ }
}
}
else if (pBufferPriv->private)
@@ -4423,7 +4617,7 @@ xglBindBuffers (__GLXdrawablePrivate *glxPriv,
return status;
}
- return __glXBadContext;
+ return BadDrawable;
}
static int
@@ -4453,7 +4647,9 @@ xglReleaseBuffers (__GLXdrawablePrivate *glxPriv,
{
(*pDrawable->pScreen->DestroyPixmap) (pTexObj->pPixmap);
pTexObj->pPixmap = NULL;
-
+ glitz_texture_object_destroy (pTexObj->object);
+ pTexObj->object = NULL;
+
return Success;
}
else
@@ -4463,7 +4659,9 @@ xglReleaseBuffers (__GLXdrawablePrivate *glxPriv,
{
(*pDrawable->pScreen->DestroyPixmap) (pTexObj->pPixmap);
pTexObj->pPixmap = NULL;
-
+ glitz_texture_object_destroy (pTexObj->object);
+ pTexObj->object = NULL;
+
return Success;
}
}
@@ -4480,7 +4678,7 @@ xglReleaseBuffers (__GLXdrawablePrivate *glxPriv,
return status;
}
- return __glXBadContext;
+ return BadDrawable;
}
static void
@@ -4533,42 +4731,46 @@ xglCreateBuffer (__GLXdrawablePrivate *glxPriv)
REGION_INIT (pScreen, &pBufferPriv->damage, NullBox, 0);
- /* use native back buffer for regular windows */
- if (pDrawable->type == DRAWABLE_WINDOW
-
+ if (pScreenPriv->fbo ||
+ ((pDrawable->type == DRAWABLE_WINDOW)
+
#ifdef COMPOSITE
- /* this is a root window, can't be redirected */
- && (!((WindowPtr) pDrawable)->parent)
+ /* this is a root window, can't be redirected */
+ && (!((WindowPtr) pDrawable)->parent)
#endif
-
- )
+
+ ))
{
pBufferPriv->pDrawable = pDrawable;
-
- if (glxPriv->pGlxVisual->doubleBuffer)
- {
- pBufferPriv->backSurface = pScreenPriv->backSurface;
- glitz_surface_reference (pScreenPriv->backSurface);
- }
}
- else if (0) /* pScreenPriv->features &
- GLITZ_FEATURE_FRAMEBUFFER_OBJECT_MASK) */
+
+/* else if (pScreenPriv->fbo)
{
- pBufferPriv->pDrawable = pDrawable;
-
if (glxPriv->pGlxVisual->doubleBuffer)
{
- int depth = pDrawable->depth;
-
+ int depth = pDrawable->depth;
+
pBufferPriv->backSurface =
glitz_surface_create (pScreenPriv->drawable,
pScreenPriv->pixmapFormats[depth].format,
pDrawable->width, pDrawable->height,
0, NULL);
- if (!pBufferPriv->backSurface)
- FatalError ("xglCreateBuffer: glitz_surface_create\n");
+ if (pBufferPriv->backSurface)
+ {
+ if (glitz_surface_valid_target (pBufferPriv->backSurface))
+ {
+ pBufferPriv->pDrawable = pDrawable;
+ ErrorF ("Backbuffer created\n");
+ }
+ else
+ {
+ glitz_surface_destroy (pBufferPriv->backSurface);
+ pBufferPriv->backSurface = NULL;
+ }
+ }
}
}
+ */
else
{
(*screenInfoPriv.createBuffer) (glxPriv);
@@ -4595,29 +4797,27 @@ xglCreateBuffer (__GLXdrawablePrivate *glxPriv)
GLX_RENDER_TEXTURE_RGBA is set to TRUE. */
if (pDrawable->type != DRAWABLE_WINDOW)
{
- /* GL_ARB_texture_rectangle is required for sane texture coordinates.
- GL_ARB_texture_border_clamp is required right now as glitz will
- emulate it when missing, which means a 1 pixel translucent black
- border inside textures, that cannot be exposed to clients. */
- if (pScreenPriv->features &
- (GLITZ_FEATURE_TEXTURE_BORDER_CLAMP_MASK |
- GLITZ_FEATURE_TEXTURE_RECTANGLE_MASK))
+ XGL_DRAWABLE_PIXMAP (pDrawable);
+
+ if (xglCreatePixmapSurface (pPixmap))
{
- glitz_point_fixed_t point = { 1 << 16 , 1 << 16 };
-
- XGL_DRAWABLE_PIXMAP (pDrawable);
-
- if (xglCreatePixmapSurface (pPixmap))
+ glitz_texture_object_t *texture;
+
+ XGL_PIXMAP_PRIV (pPixmap);
+
+ texture = glitz_texture_object_create (pPixmapPriv->surface);
+ if (texture)
{
- XGL_PIXMAP_PRIV (pPixmap);
-
- /* FIXME: doesn't work for 1x1 textures */
- glitz_surface_translate_point (pPixmapPriv->surface,
- &point, &point);
- if (point.x > (1 << 16) || point.y > (1 << 16))
- glxPriv->texTarget = GLX_TEXTURE_RECTANGLE_EXT;
- else
+ switch (glitz_texture_object_get_target (texture)) {
+ case GLITZ_TEXTURE_TARGET_2D:
glxPriv->texTarget = GLX_TEXTURE_2D_EXT;
+ break;
+ case GLITZ_TEXTURE_TARGET_RECT:
+ glxPriv->texTarget = GLX_TEXTURE_RECTANGLE_EXT;
+ break;
+ }
+
+ glitz_texture_object_destroy (texture);
}
}
}
@@ -4657,44 +4857,6 @@ xglScreenProbe (int screen)
return status;
}
-static int
-xglXWaitX (__GLXclientState *cl, GLbyte *pc)
-{
- xGLXWaitXReq *req = (xGLXWaitXReq *) pc;
- __GLXcontext *cx;
-
- cx = (__GLXcontext *) __glXLookupContextByTag (cl, req->contextTag);
- if (cx)
- {
- xglGLContextPtr pContext = (xglGLContextPtr) cx->gc;
- __GLXcontext *glxCtx = (__GLXcontext *)
- pContext->iface.imports.other;
-
- XGL_SCREEN_PRIV (glxCtx->pScreen);
-
- glitz_drawable_finish (pScreenPriv->drawable);
-
- return Success;
- }
- else
- {
- cl->client->errorValue = req->contextTag;
- return __glXBadContextTag;
- }
-}
-
-static int
-xglXSwapWaitX (__GLXclientState *cl, GLbyte *pc)
-{
- xGLXWaitXReq *req = (xGLXWaitXReq *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- __GLX_SWAP_SHORT (&req->length);
- __GLX_SWAP_INT (&req->contextTag);
-
- return xglXWaitX (cl, pc);
-}
-
static Bool
xglDestroyWindow (WindowPtr pWin)
{
@@ -4742,7 +4904,7 @@ xglInitVisualConfigs (ScreenPtr pScreen)
XGL_SCREEN_PRIV (pScreen);
XGL_SCREEN_WRAP (DestroyWindow, xglDestroyWindow);
-
+
depth = pScreenPriv->pVisual->pPixel->depth;
bpp = pScreenPriv->pVisual->pPixel->masks.bpp;
format = glitz_drawable_get_format (pScreenPriv->drawable);
@@ -4861,9 +5023,6 @@ xglInitVisualConfigs (ScreenPtr pScreen)
{
screenInfoPriv.screenProbe = __glDDXScreenInfo.screenProbe;
__glDDXScreenInfo.screenProbe = xglScreenProbe;
-
- __glXSingleTable[9] = xglXWaitX;
- __glXSwapSingleTable[9] = xglXSwapWaitX;
}
visuals = pScreen->visuals;
@@ -4872,11 +5031,11 @@ xglInitVisualConfigs (ScreenPtr pScreen)
ndepths = pScreen->numDepths;
rootDepth = pScreen->rootDepth;
defaultVis = pScreen->rootVisual;
-
+
/* Find installed colormaps */
- numInstalledCmaps = (*pScreen->ListInstalledColormaps) (pScreen,
+ numInstalledCmaps = (*pScreen->ListInstalledColormaps) (pScreen,
installedCmaps);
-
+
GlxWrapInitVisuals (&initVisualsProc);
GlxInitVisuals (&visuals, &depths, &nvisuals, &ndepths, &rootDepth,
&defaultVis, ((unsigned long) 1 << (bpp - 1)), 8, -1);
@@ -4885,15 +5044,15 @@ xglInitVisualConfigs (ScreenPtr pScreen)
for (i = 0; i < numInstalledCmaps; i++)
{
int j;
-
+
installedCmap = LookupIDByType (installedCmaps[i], RT_COLORMAP);
if (!installedCmap)
continue;
-
+
j = installedCmap->pVisual - pScreen->visuals;
installedCmap->pVisual = &visuals[j];
}
-
+
pScreen->visuals = visuals;
pScreen->numVisuals = nvisuals;
pScreen->allowedDepths = depths;
@@ -4904,8 +5063,6 @@ xglInitVisualConfigs (ScreenPtr pScreen)
xfree (installedCmaps);
xfree (pConfigPriv);
xfree (pConfig);
-
+
return TRUE;
}
-
-#endif /* GLXEXT */
diff --git a/hw/xgl/glxext/xglglxext.h b/hw/xgl/glxext/xglglxext.h
new file mode 100644
index 000000000..491b26881
--- /dev/null
+++ b/hw/xgl/glxext/xglglxext.h
@@ -0,0 +1,38 @@
+/*
+ * 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@novell.com>
+ */
+
+#ifndef _XGL_GLXEXT_H_
+#define _XGL_GLXEXT_H_
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "scrnintstr.h"
+
+Bool
+xglInitVisualConfigs (ScreenPtr pScreen);
+
+#endif /* _XGL_GLXEXT_H_ */
diff --git a/hw/xgl/xgl.h b/hw/xgl/xgl.h
index 8158f5bb6..ceb18ddaa 100644
--- a/hw/xgl/xgl.h
+++ b/hw/xgl/xgl.h
@@ -55,7 +55,7 @@ typedef struct _GCFuncs *GCFuncsPtr;
extern WindowPtr *WindowTable;
-#define XGL_DEFAULT_PBO_MASK 0 /* don't use PBO as default */
+#define XGL_DEFAULT_PBO_MASK 0
typedef struct _xglScreenInfo {
glitz_drawable_t *drawable;
@@ -63,14 +63,16 @@ typedef struct _xglScreenInfo {
unsigned int height;
unsigned int widthMm;
unsigned int heightMm;
- Bool fullscreen;
int geometryDataType;
int geometryUsage;
Bool yInverted;
int pboMask;
Bool lines;
+ Bool fbo;
} xglScreenInfoRec, *xglScreenInfoPtr;
+extern xglScreenInfoRec xglScreenInfo;
+
typedef struct _xglPixelFormat {
CARD8 depth, bitsPerRGB;
glitz_pixel_masks_t masks;
@@ -213,6 +215,7 @@ typedef struct _xglScreen {
Bool yInverted;
int pboMask;
Bool lines;
+ Bool fbo;
xglGeometryRec scratchGeometry;
#ifdef RENDER
@@ -489,24 +492,21 @@ xglParseFindNext (char *cur,
char *last);
void
-xglParseScreen (xglScreenInfoPtr pScreenInfo,
- char *arg);
+xglParseScreen (char *arg);
void
xglUseMsg (void);
int
-xglProcessArgument (xglScreenInfoPtr pScreenInfo,
- int argc,
- char **argv,
- int i);
+xglProcessArgument (int argc,
+ char **argv,
+ int i);
/* xglscreen.c */
Bool
-xglScreenInit (ScreenPtr pScreen,
- xglScreenInfoPtr pScreenInfo);
+xglScreenInit (ScreenPtr pScreen);
Bool
xglFinishScreenInit (ScreenPtr pScreen);
@@ -872,6 +872,10 @@ void
xglAddCurrentSurfaceDamage (DrawablePtr pDrawable);
void
+xglAddBitDamage (DrawablePtr pDrawable,
+ RegionPtr pRegion);
+
+void
xglAddCurrentBitDamage (DrawablePtr pDrawable);
@@ -1327,10 +1331,47 @@ xglAddTraps (PicturePtr pDst,
#endif
+#ifdef XLOADABLE
+
+/* xglloader.c */
+
+typedef struct _xglSymbol {
+ void **ptr;
+ const char *name;
+} xglSymbolRec, *xglSymbolPtr;
+
+void *
+xglLoadModule (const char *name);
+
+void
+xglUnloadModule (void *handle);
+
+Bool
+xglLookupSymbols (void *handle,
+ xglSymbolPtr sym,
+ int nSym);
+
+#endif
+
#ifdef GLXEXT
+/* xglglx.c */
+
+Bool
+xglLoadGLXModules (void);
+
+void
+xglUnloadGLXModules (void);
+
+#endif
+
+/* xglhash.c */
+
typedef struct _xglHashTable *xglHashTablePtr;
+Bool
+xglLoadHashFuncs (void *handle);
+
xglHashTablePtr
xglNewHashTable (void);
@@ -1361,9 +1402,4 @@ unsigned int
xglHashFindFreeKeyBlock (xglHashTablePtr pTable,
unsigned int numKeys);
-Bool
-xglInitVisualConfigs (ScreenPtr pScreen);
-
-#endif
-
#endif /* _XGL_H_ */
diff --git a/hw/xgl/xglcmap.c b/hw/xgl/xglcmap.c
index 9e383223d..f0c2ba2e4 100644
--- a/hw/xgl/xglcmap.c
+++ b/hw/xgl/xglcmap.c
@@ -23,6 +23,7 @@
* Author: David Reveman <davidr@novell.com>
*/
+#include <stdint.h>
#include "xgl.h"
#include "colormapst.h"
#include "micmap.h"
@@ -147,7 +148,6 @@ xglSetVisualTypesAndMasks (ScreenInfo *pScreenInfo,
nxglVisuals++;
}
}
-
}
}
diff --git a/hw/xgl/xglhash.c b/hw/xgl/xglhash.c
index a541d7dd4..2635422f8 100644
--- a/hw/xgl/xglhash.c
+++ b/hw/xgl/xglhash.c
@@ -1,6 +1,6 @@
/*
* 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
@@ -12,11 +12,11 @@
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * 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,
+ * 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.
*
@@ -25,58 +25,77 @@
#include "xgl.h"
-#ifdef GLXEXT
-
-/* This is just a wrapper around Mesa's hash functions. */
-
-extern struct _mesa_HashTable *
-_mesa_NewHashTable (void);
-
-extern void
-_mesa_DeleteHashTable (struct _mesa_HashTable *table);
-
-extern void *
-_mesa_HashLookup (const struct _mesa_HashTable *table,
- unsigned int key);
-
-extern void
-_mesa_HashInsert (struct _mesa_HashTable *table,
- unsigned int key,
- void *data);
-
-extern void
-_mesa_HashRemove (struct _mesa_HashTable *table,
- unsigned int key);
-
-extern unsigned int
-_mesa_HashFirstEntry (struct _mesa_HashTable *table);
-
-extern unsigned int
-_mesa_HashNextEntry (const struct _mesa_HashTable *table,
- unsigned int key);
+#define SYM(ptr, name) { (void **) &(ptr), (name) }
+
+typedef struct _xglHashFunc {
+ xglHashTablePtr (*NewHashTable) (void);
+ void (*DeleteHashTable) (xglHashTablePtr pTable);
+ void *(*HashLookup) (const xglHashTablePtr pTable,
+ unsigned int key);
+ void (*HashInsert) (xglHashTablePtr pTable,
+ unsigned int key,
+ void *data);
+ void (*HashRemove) (xglHashTablePtr pTable,
+ unsigned int key);
+ unsigned int (*HashFirstEntry) (xglHashTablePtr pTable);
+ unsigned int (*HashNextEntry) (const xglHashTablePtr pTable,
+ unsigned int key);
+ unsigned int (*HashFindFreeKeyBlock) (xglHashTablePtr pTable,
+ unsigned int numKeys);
+} xglHashFuncRec;
+
+static xglHashFuncRec __hashFunc;
+
+static void *hashHandle = 0;
+
+Bool
+xglLoadHashFuncs (void *handle)
+{
-extern unsigned int
-_mesa_HashFindFreeKeyBlock (struct _mesa_HashTable *table,
- unsigned int numKeys);
+#ifdef XLOADABLE
+ xglSymbolRec sym[] = {
+ SYM (__hashFunc.NewHashTable, "_mesa_NewHashTable"),
+ SYM (__hashFunc.DeleteHashTable, "_mesa_DeleteHashTable"),
+ SYM (__hashFunc.HashLookup, "_mesa_HashLookup"),
+ SYM (__hashFunc.HashInsert, "_mesa_HashInsert"),
+ SYM (__hashFunc.HashRemove, "_mesa_HashRemove"),
+ SYM (__hashFunc.HashFirstEntry, "_mesa_HashFirstEntry"),
+ SYM (__hashFunc.HashNextEntry, "_mesa_HashNextEntry"),
+ SYM (__hashFunc.HashFindFreeKeyBlock, "_mesa_HashFindFreeKeyBlock")
+ };
+
+ if (!xglLookupSymbols (handle, sym, sizeof (sym) / sizeof (sym[0])))
+ return FALSE;
+
+ hashHandle = handle;
+
+ return TRUE;
+#else
+ return FALSE;
+#endif
+}
xglHashTablePtr
xglNewHashTable (void)
{
- return (xglHashTablePtr) _mesa_NewHashTable ();
+ if (!hashHandle)
+ return 0;
+
+ return (*__hashFunc.NewHashTable) ();
}
void
xglDeleteHashTable (xglHashTablePtr pTable)
{
- _mesa_DeleteHashTable ((struct _mesa_HashTable *) pTable);
+ (*__hashFunc.DeleteHashTable) (pTable);
}
void *
xglHashLookup (const xglHashTablePtr pTable,
unsigned int key)
{
- return _mesa_HashLookup ((struct _mesa_HashTable *) pTable, key);
+ return (*__hashFunc.HashLookup) (pTable, key);
}
void
@@ -84,35 +103,32 @@ xglHashInsert (xglHashTablePtr pTable,
unsigned int key,
void *data)
{
- _mesa_HashInsert ((struct _mesa_HashTable *) pTable, key, data);
+ (*__hashFunc.HashInsert) (pTable, key, data);
}
void
xglHashRemove (xglHashTablePtr pTable,
unsigned int key)
{
- _mesa_HashRemove ((struct _mesa_HashTable *) pTable, key);
+ (*__hashFunc.HashRemove) (pTable, key);
}
unsigned int
xglHashFirstEntry (xglHashTablePtr pTable)
{
- return _mesa_HashFirstEntry ((struct _mesa_HashTable *) pTable);
+ return (*__hashFunc.HashFirstEntry) (pTable);
}
unsigned int
xglHashNextEntry (const xglHashTablePtr pTable,
unsigned int key)
{
- return _mesa_HashNextEntry ((struct _mesa_HashTable *) pTable, key);
+ return (*__hashFunc.HashNextEntry) (pTable, key);
}
unsigned int
xglHashFindFreeKeyBlock (xglHashTablePtr pTable,
unsigned int numKeys)
{
- return _mesa_HashFindFreeKeyBlock ((struct _mesa_HashTable *) pTable,
- numKeys);
+ return (*__hashFunc.HashFindFreeKeyBlock) (pTable, numKeys);
}
-
-#endif
diff --git a/hw/xgl/xglinit.c b/hw/xgl/xglinit.c
new file mode 100644
index 000000000..e6af7eef2
--- /dev/null
+++ b/hw/xgl/xglinit.c
@@ -0,0 +1,287 @@
+/*
+ * 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@novell.com>
+ */
+
+#include "xgl.h"
+#include "micmap.h"
+#include "mipointer.h"
+#include "fb.h"
+
+#define DEAFULT_DDX_MODULE_NAME "xglx"
+
+static char *ddxModuleName = DEAFULT_DDX_MODULE_NAME;
+
+xglScreenInfoRec xglScreenInfo = {
+ NULL, 0, 0, 0, 0,
+ DEFAULT_GEOMETRY_DATA_TYPE,
+ DEFAULT_GEOMETRY_USAGE,
+ FALSE,
+ XGL_DEFAULT_PBO_MASK,
+ FALSE,
+ FALSE
+};
+
+#ifdef GLXEXT
+static Bool loadGlx = TRUE;
+#endif
+
+typedef struct _xglDDXFunc {
+ void (*initOutput) (ScreenInfo *pScreenInfo,
+ int argc,
+ char **argv);
+ void (*initInput) (int argc,
+ char **argv);
+ Bool (*legalModifier) (unsigned int key,
+ DevicePtr pDev);
+ void (*processInputEvents) (void);
+ void (*useMsg) (void);
+ int (*processArgument) (int argc,
+ char **argv,
+ int i);
+ void (*abort) (void);
+ void (*giveUp) (void);
+ void (*osVendorInit) (void);
+} xglDDXFuncRec;
+
+static xglDDXFuncRec __ddxFunc;
+
+#define SYMFUNC(name) ((void *) (name))
+#define SYMVAR(name) ((void *) &(name))
+
+/*
+ * The following table is used to make sure that all symbols required by
+ * dynamically loaded modules are present in the main program. Add more symbols
+ * as needed.
+ */
+
+void *symTab[] = {
+ SYMFUNC (xglKbdCtrl),
+ SYMFUNC (xglSetPixmapFormats),
+ SYMVAR (xglVisuals),
+
+ SYMFUNC (mieqEnqueue),
+ SYMFUNC (mieqInit),
+ SYMFUNC (mieqProcessInputEvents),
+ SYMFUNC (miPointerAbsoluteCursor),
+ SYMFUNC (miRegisterPointerDevice),
+ SYMFUNC (miPointerWarpCursor),
+ SYMFUNC (miDCInitialize),
+ SYMFUNC (miPointerAbsoluteCursor),
+ SYMFUNC (miPointerUpdate),
+ SYMFUNC (miRegisterRedirectBorderClipProc)
+};
+
+#define SYM(ptr, name) { (void **) &(ptr), (name) }
+
+static Bool
+xglEnsureDDXModule (void)
+{
+
+#ifdef XLOADABLE
+ static void *ddxHandle = 0;
+ static Bool status = TRUE;
+
+ if (!status)
+ return FALSE;
+
+ if (!ddxHandle)
+ {
+ xglSymbolRec sym[] = {
+ SYM (__ddxFunc.initOutput, "InitOutput"),
+ SYM (__ddxFunc.initInput, "InitInput"),
+ SYM (__ddxFunc.legalModifier, "LegalModifier"),
+ SYM (__ddxFunc.processInputEvents, "ProcessInputEvents"),
+ SYM (__ddxFunc.useMsg, "ddxUseMsg"),
+ SYM (__ddxFunc.processArgument, "ddxProcessArgument"),
+ SYM (__ddxFunc.abort, "AbortDDX"),
+ SYM (__ddxFunc.giveUp, "ddxGiveUp"),
+ SYM (__ddxFunc.osVendorInit, "OsVendorInit")
+ };
+
+ ddxHandle = xglLoadModule (ddxModuleName);
+ if (!ddxHandle)
+ return (status = FALSE);
+
+ if (!xglLookupSymbols (ddxHandle, sym, sizeof (sym) / sizeof (sym[0])))
+ {
+ xglUnloadModule (ddxHandle);
+ ddxHandle = 0;
+
+ return (status = FALSE);
+ }
+ }
+
+ return TRUE;
+#else
+ return FALSE;
+#endif
+
+}
+
+void
+InitOutput (ScreenInfo *pScreenInfo,
+ int argc,
+ char **argv)
+{
+ (void) symTab;
+
+ if (!xglEnsureDDXModule ())
+ FatalError ("No DDX module loaded");
+
+#ifdef GLXEXT
+ if (loadGlx)
+ {
+ if (!xglLoadGLXModules ())
+ FatalError ("No GLX modules loaded");
+ }
+#endif
+
+ (*__ddxFunc.initOutput) (pScreenInfo, argc, argv);
+}
+
+Bool
+LegalModifier (unsigned int key,
+ DevicePtr pDev)
+{
+ return (*__ddxFunc.legalModifier) (key, pDev);
+}
+
+void
+ProcessInputEvents (void)
+{
+ (*__ddxFunc.processInputEvents) ();
+}
+
+void
+InitInput (int argc,
+ char **argv)
+{
+ if (!xglEnsureDDXModule ())
+ FatalError ("No DDX module loaded");
+
+ (*__ddxFunc.initInput) (argc, argv);
+}
+
+void
+ddxUseMsg (void)
+{
+ ErrorF ("\nXgl usage:\n");
+ ErrorF ("-ddx module specify ddx module\n");
+
+#ifdef GLXEXT
+ ErrorF ("-noglx don't load glx extension\n");
+#endif
+
+ if (xglEnsureDDXModule ())
+ (*__ddxFunc.useMsg) ();
+}
+
+#define LOPT(s, l) { (s), (l) }
+#define OPT(s) LOPT (s, 0)
+
+int
+ddxProcessArgument (int argc,
+ char **argv,
+ int i)
+{
+ struct _option {
+ char *name;
+ int length;
+ } commonOption[] = {
+ LOPT (":", 1), OPT ("-a"), OPT ("-ac"), OPT ("-audit"), OPT ("-auth"),
+ OPT ("bc"), OPT ("-br"), OPT ("+bs"), OPT ("-bs"), OPT ("c"), OPT ("-c"),
+ OPT ("-cc"), OPT ("-co"), OPT ("-core"), OPT ("-dpi"),
+ OPT ("-deferglyphs"), OPT ("-f"), OPT ("-fc"), OPT ("-fn"), OPT ("-fp"),
+ OPT ("-help"), OPT ("-nolisten"), OPT ("-noreset"), OPT ("-p"),
+ OPT ("-pn"), OPT ("-nopn"), OPT ("r"), OPT ("-r"), OPT ("-s"),
+ OPT ("-su"), OPT ("-t"), OPT ("-terminate"), OPT ("-to"), OPT ("-tst"),
+ OPT ("v"), OPT ("-v"), OPT ("-wm"), OPT ("-x"), OPT ("-I"),
+ LOPT ("tty", 3)
+ };
+ int skip, j;
+
+ for (j = 0; j < sizeof (commonOption) / sizeof (commonOption[0]); j++)
+ {
+ if (commonOption[j].length)
+ {
+ if (!strncmp (argv[i], commonOption[j].name, commonOption[j].length))
+ return 0;
+ }
+ else
+ {
+ if (!strcmp (argv[i], commonOption[j].name))
+ return 0;
+ }
+ }
+
+ if (!strcmp (argv[i], "-ddx"))
+ {
+ if ((i + 1) < argc)
+ {
+ ddxModuleName = argv[i + 1];
+ }
+ else
+ return 1;
+
+ return 2;
+ }
+
+#ifdef GLXEXT
+ else if (!strcmp (argv[i], "-noglx"))
+ {
+ loadGlx = FALSE;
+ return 1;
+ }
+#endif
+
+ skip = xglProcessArgument (argc, argv, i);
+ if (skip)
+ return skip;
+
+ if (xglEnsureDDXModule ())
+ return (*__ddxFunc.processArgument) (argc, argv, i);
+
+ return 0;
+}
+
+void
+AbortDDX (void)
+{
+ if (xglEnsureDDXModule ())
+ (*__ddxFunc.abort) ();
+}
+
+void
+ddxGiveUp (void)
+{
+ if (xglEnsureDDXModule ())
+ (*__ddxFunc.giveUp) ();
+}
+
+void
+OsVendorInit (void)
+{
+ if (xglEnsureDDXModule ())
+ (*__ddxFunc.osVendorInit) ();
+}
diff --git a/hw/xgl/xglloader.c b/hw/xgl/xglloader.c
new file mode 100644
index 000000000..9a311aecd
--- /dev/null
+++ b/hw/xgl/xglloader.c
@@ -0,0 +1,129 @@
+/*
+ * 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@novell.com>
+ */
+
+#include "xgl.h"
+#include "xglmodule.h"
+
+#ifdef XLOADABLE
+
+#include <dlfcn.h>
+
+#define SYM(ptr, name) { (void **) &(ptr), (name) }
+
+void *
+xglLoadModule (const char *name)
+{
+ ModuleVersionProcPtr moduleVersion;
+ ModuleInitProcPtr moduleInit;
+ void *handle = 0;
+ char *module;
+ xglSymbolRec mSym[] = {
+ SYM (moduleVersion, "moduleVersion"),
+ SYM (moduleInit, "moduleInit")
+ };
+
+ module = malloc (strlen (MODULEPATH "/xgl/lib.so") + strlen (name) + 1);
+ if (!module)
+ return 0;
+
+ sprintf (module, MODULEPATH "/xgl/lib%s.so", name);
+
+ handle = dlopen (module, RTLD_NOW);
+ if (handle)
+ {
+ if (xglLookupSymbols (handle, mSym, sizeof (mSym) / sizeof (mSym[0])))
+ {
+ const char *version;
+
+ version = (*moduleVersion) ();
+ if (strcmp (VERSION, version) == 0)
+ {
+ if (!(*moduleInit) (module))
+ {
+ dlclose (handle);
+ handle = 0;
+ }
+ }
+ else
+ {
+ ErrorF ("Module version mismatch. "
+ "%s is %s Xserver is" VERSION "\n",
+ module, version);
+
+ dlclose (handle);
+ handle = 0;
+ }
+ }
+ else
+ {
+ dlclose (handle);
+ handle = 0;
+ }
+ }
+ else
+ ErrorF ("dlopen: %s\n", dlerror ());
+
+ free (module);
+
+ return handle;
+}
+
+void
+xglUnloadModule (void *handle)
+{
+ dlclose (handle);
+}
+
+Bool
+xglLookupSymbols (void *handle,
+ xglSymbolPtr sym,
+ int nSym)
+{
+ void *symbol;
+ char *error;
+ int i;
+
+ /* avoid previous error */
+ dlerror ();
+
+ for (i = 0; i < nSym; i++)
+ {
+ symbol = dlsym (handle, sym[i].name);
+ if (!symbol)
+ {
+ error = dlerror ();
+ if (error != 0)
+ ErrorF ("dlsym: %s: %s\n", sym[i].name, error);
+
+ return FALSE;
+ }
+
+ *(sym[i].ptr) = symbol;
+ }
+
+ return TRUE;
+}
+
+#endif
diff --git a/hw/xgl/xglmodule.h b/hw/xgl/xglmodule.h
new file mode 100644
index 000000000..0dcabebca
--- /dev/null
+++ b/hw/xgl/xglmodule.h
@@ -0,0 +1,45 @@
+/*
+ * 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@novell.com>
+ */
+
+#ifndef _XGL_MODULE_H_
+#define _XGL_MODULE_H_
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <X11/Xdefs.h>
+#include "misc.h"
+
+typedef const char *(*ModuleVersionProcPtr) (void);
+typedef Bool (*ModuleInitProcPtr) (const char *module);
+
+char *
+moduleVersion (void);
+
+Bool
+moduleInit (const char *module);
+
+#endif /* _XGL_MODULE_H_ */
diff --git a/hw/xgl/xglparse.c b/hw/xgl/xglparse.c
index 663d79872..c1f7e6527 100644
--- a/hw/xgl/xglparse.c
+++ b/hw/xgl/xglparse.c
@@ -44,18 +44,17 @@ xglParseFindNext (char *cur,
}
void
-xglParseScreen (xglScreenInfoPtr pScreenInfo,
- char *arg)
+xglParseScreen (char *arg)
{
char delim;
char save[1024];
int i, pixels, mm;
-
- pScreenInfo->width = 0;
- pScreenInfo->height = 0;
- pScreenInfo->widthMm = 0;
- pScreenInfo->heightMm = 0;
-
+
+ xglScreenInfo.width = 0;
+ xglScreenInfo.height = 0;
+ xglScreenInfo.widthMm = 0;
+ xglScreenInfo.heightMm = 0;
+
if (!arg)
return;
@@ -82,13 +81,13 @@ xglParseScreen (xglScreenInfoPtr pScreenInfo,
if (i == 0)
{
- pScreenInfo->width = pixels;
- pScreenInfo->widthMm = mm;
+ xglScreenInfo.width = pixels;
+ xglScreenInfo.widthMm = mm;
}
else
{
- pScreenInfo->height = pixels;
- pScreenInfo->heightMm = mm;
+ xglScreenInfo.height = pixels;
+ xglScreenInfo.heightMm = mm;
}
if (delim != 'x')
@@ -99,79 +98,66 @@ xglParseScreen (xglScreenInfoPtr pScreenInfo,
void
xglUseMsg (void)
{
- ErrorF ("-screen WIDTH[/WIDTHMM]xHEIGHT[/HEIGHTMM] "
- "specify screen characteristics\n");
- ErrorF ("-fullscreen run fullscreen\n");
ErrorF ("-vertextype [short|float] set vertex data type\n");
- ErrorF ("-vbostream "
- "use vertex buffer objects for streaming of vertex data\n");
ErrorF ("-yinverted Y is upside-down\n");
- ErrorF ("-pbomask [1|4|8|16|32] "
- "set bpp's to use with pixel buffer objects\n");
ErrorF ("-lines "
"accelerate lines that are not vertical or horizontal\n");
+ ErrorF ("-vbo "
+ "use vertex buffer objects for streaming of vertex data\n");
+ ErrorF ("-pbomask [1|4|8|16|32] "
+ "set bpp's to use with pixel buffer objects\n");
+ ErrorF ("-fbo "
+ "use frame buffer objects for accelerate offscreen drawing\n");
}
int
-xglProcessArgument (xglScreenInfoPtr pScreenInfo,
- int argc,
- char **argv,
- int i)
+xglProcessArgument (int argc,
+ char **argv,
+ int i)
{
- if (!strcmp (argv[i], "-screen"))
+ if (!strcmp (argv[i], "-vertextype"))
{
if ((i + 1) < argc)
{
- xglParseScreen (pScreenInfo, argv[i + 1]);
+ if (!strcasecmp (argv[i + 1], "short"))
+ xglScreenInfo.geometryDataType = GEOMETRY_DATA_TYPE_SHORT;
+ else if (!strcasecmp (argv[i + 1], "float"))
+ xglScreenInfo.geometryDataType = GEOMETRY_DATA_TYPE_FLOAT;
}
else
return 1;
return 2;
}
- else if (!strcmp (argv[i], "-fullscreen"))
+ else if (!strcmp (argv[i], "-yinverted"))
{
- pScreenInfo->fullscreen = TRUE;
+ xglScreenInfo.yInverted = TRUE;
return 1;
}
- else if (!strcmp (argv[i], "-vertextype"))
- {
- if ((i + 1) < argc)
- {
- if (!strcasecmp (argv[i + 1], "short"))
- pScreenInfo->geometryDataType = GEOMETRY_DATA_TYPE_SHORT;
- else if (!strcasecmp (argv[i + 1], "float"))
- pScreenInfo->geometryDataType = GEOMETRY_DATA_TYPE_FLOAT;
- }
- else
- return 1;
-
- return 2;
- }
- else if (!strcmp (argv[i], "-vbostream"))
+ else if (!strcmp (argv[i], "-lines"))
{
- pScreenInfo->geometryUsage = GEOMETRY_USAGE_STREAM;
+ xglScreenInfo.lines = TRUE;
return 1;
}
- else if (!strcmp (argv[i], "-yinverted"))
+ else if (!strcmp (argv[i], "-vbo"))
{
- pScreenInfo->yInverted = TRUE;
+ xglScreenInfo.geometryUsage = GEOMETRY_USAGE_STREAM;
return 1;
}
else if (!strcmp (argv[i], "-pbomask"))
{
if ((i + 1) < argc)
{
- pScreenInfo->pboMask = atoi (argv[i + 1]);
+ xglScreenInfo.pboMask = atoi (argv[i + 1]);
}
else
return 1;
return 2;
}
- else if (!strcmp (argv[i], "-lines"))
+ else if (!strcmp (argv[i], "-fbo"))
{
- pScreenInfo->lines = TRUE;
+ xglScreenInfo.fbo = TRUE;
return 1;
}
diff --git a/hw/xgl/xglpixmap.c b/hw/xgl/xglpixmap.c
index c7c87f8c4..8f043081e 100644
--- a/hw/xgl/xglpixmap.c
+++ b/hw/xgl/xglpixmap.c
@@ -114,6 +114,8 @@ xglPixmapSurfaceInit (PixmapPtr pPixmap,
if (width && height)
{
+ XGL_SCREEN_PRIV (pPixmap->drawable.pScreen);
+
if (width == 1 && height == 1)
{
pPixmapPriv->acceleratedTile = TRUE;
@@ -124,19 +126,27 @@ xglPixmapSurfaceInit (PixmapPtr pPixmap,
(POWER_OF_TWO (width) && POWER_OF_TWO (height)))
pPixmapPriv->acceleratedTile = TRUE;
}
-
- pPixmapPriv->target = xglPixmapTargetOut;
-
- /*
- * Do not allow accelerated drawing to bitmaps.
- */
- if (pPixmap->drawable.depth == 1)
- pPixmapPriv->target = xglPixmapTargetNo;
/*
- * Drawing to really small pixmaps is not worth accelerating.
+ * Accelerated drawing to pixmaps when using FBOs
*/
- if (width < 8 && height < 8)
+ if (pScreenPriv->fbo)
+ {
+ pPixmapPriv->target = xglPixmapTargetOut;
+
+ /*
+ * Do not allow accelerated drawing to bitmaps.
+ */
+ if (pPixmap->drawable.depth == 1)
+ pPixmapPriv->target = xglPixmapTargetNo;
+
+ /*
+ * Drawing to really small pixmaps is not worth accelerating.
+ */
+ if (width < 8 && height < 8)
+ pPixmapPriv->target = xglPixmapTargetNo;
+ }
+ else
pPixmapPriv->target = xglPixmapTargetNo;
}
}
diff --git a/hw/xgl/xglscreen.c b/hw/xgl/xglscreen.c
index 76ea92241..26f2848c5 100644
--- a/hw/xgl/xglscreen.c
+++ b/hw/xgl/xglscreen.c
@@ -134,8 +134,7 @@ xglAllocatePrivates (ScreenPtr pScreen)
}
Bool
-xglScreenInit (ScreenPtr pScreen,
- xglScreenInfoPtr pScreenInfo)
+xglScreenInit (ScreenPtr pScreen)
{
xglScreenPtr pScreenPriv;
int depth, bpp;
@@ -152,9 +151,9 @@ xglScreenInit (ScreenPtr pScreen,
pScreenPriv->pScreenPixmap = NULL;
pScreenPriv->pVisual = &xglVisuals[0];
- pScreenPriv->drawable = pScreenInfo->drawable;
+ pScreenPriv->drawable = xglScreenInfo.drawable;
pScreenPriv->features =
- glitz_drawable_get_features (pScreenInfo->drawable);
+ glitz_drawable_get_features (xglScreenInfo.drawable);
depth = pScreenPriv->pVisual->pPixel->depth;
bpp = pScreenPriv->pVisual->pPixel->masks.bpp;
@@ -163,11 +162,12 @@ xglScreenInit (ScreenPtr pScreen,
if (!pScreenPriv->pixmapFormats[depth].format)
return FALSE;
- pScreenPriv->geometryDataType = pScreenInfo->geometryDataType;
- pScreenPriv->geometryUsage = pScreenInfo->geometryUsage;
- pScreenPriv->yInverted = pScreenInfo->yInverted;
- pScreenPriv->pboMask = pScreenInfo->pboMask;
- pScreenPriv->lines = pScreenInfo->lines;
+ pScreenPriv->geometryDataType = xglScreenInfo.geometryDataType;
+ pScreenPriv->geometryUsage = xglScreenInfo.geometryUsage;
+ pScreenPriv->yInverted = xglScreenInfo.yInverted;
+ pScreenPriv->pboMask = xglScreenInfo.pboMask;
+ pScreenPriv->lines = xglScreenInfo.lines;
+ pScreenPriv->fbo = xglScreenInfo.fbo;
GEOMETRY_INIT (pScreen, &pScreenPriv->scratchGeometry,
GLITZ_GEOMETRY_TYPE_VERTEX,
@@ -176,7 +176,7 @@ xglScreenInit (ScreenPtr pScreen,
pScreenPriv->surface =
glitz_surface_create (pScreenPriv->drawable,
pScreenPriv->pixmapFormats[depth].format,
- pScreenInfo->width, pScreenInfo->height,
+ xglScreenInfo.width, xglScreenInfo.height,
0, NULL);
if (!pScreenPriv->surface)
return FALSE;
@@ -191,9 +191,9 @@ xglScreenInit (ScreenPtr pScreen,
monitorResolution = XGL_DEFAULT_DPI;
if (!fbSetupScreen (pScreen, NULL,
- pScreenInfo->width, pScreenInfo->height,
+ xglScreenInfo.width, xglScreenInfo.height,
monitorResolution, monitorResolution,
- pScreenInfo->width, bpp))
+ xglScreenInfo.width, bpp))
return FALSE;
pScreen->SaveScreen = xglSaveScreen;
@@ -202,9 +202,9 @@ xglScreenInit (ScreenPtr pScreen,
pScreen->DestroyPixmap = xglDestroyPixmap;
if (!fbFinishScreenInit (pScreen, NULL,
- pScreenInfo->width, pScreenInfo->height,
+ xglScreenInfo.width, xglScreenInfo.height,
monitorResolution, monitorResolution,
- pScreenInfo->width, bpp))
+ xglScreenInfo.width, bpp))
return FALSE;
#ifdef MITSHM
@@ -276,11 +276,6 @@ xglScreenInit (ScreenPtr pScreen,
return FALSE;
#endif
-#ifdef GLXEXT
- if (!xglInitVisualConfigs (pScreen))
- return FALSE;
-#endif
-
/* Damage is required */
DamageSetup (pScreen);
diff --git a/hw/xgl/xglsync.c b/hw/xgl/xglsync.c
index 6299e1db8..0fa3aa05a 100644
--- a/hw/xgl/xglsync.c
+++ b/hw/xgl/xglsync.c
@@ -293,7 +293,13 @@ xglPrepareTarget (DrawablePtr pDrawable)
switch (pPixmapPriv->target) {
case xglPixmapTargetNo:
+ break;
case xglPixmapTargetOut:
+ if (xglSyncSurface (pDrawable))
+ {
+ pPixmapPriv->target = xglPixmapTargetIn;
+ return TRUE;
+ }
break;
case xglPixmapTargetIn:
if (xglSyncSurface (pDrawable))
@@ -359,12 +365,47 @@ xglAddCurrentSurfaceDamage (DrawablePtr pDrawable)
}
void
+xglAddBitDamage (DrawablePtr pDrawable,
+ RegionPtr pRegion)
+{
+ BoxPtr pBox;
+ BoxPtr pExt;
+ int nBox;
+
+ XGL_DRAWABLE_PIXMAP_PRIV (pDrawable);
+
+ pBox = REGION_RECTS (pRegion);
+ pExt = REGION_EXTENTS (pDrawable->pScreen, pRegion);
+ nBox = REGION_NUM_RECTS (pRegion);
+
+ if (pExt->x1 < pPixmapPriv->bitBox.x2 &&
+ pExt->y1 < pPixmapPriv->bitBox.y2 &&
+ pExt->x2 > pPixmapPriv->bitBox.x1 &&
+ pExt->y2 > pPixmapPriv->bitBox.y1)
+ {
+ while (nBox--)
+ {
+ if (pBox->x1 < pPixmapPriv->bitBox.x2 &&
+ pBox->y1 < pPixmapPriv->bitBox.y2 &&
+ pBox->x2 > pPixmapPriv->bitBox.x1 &&
+ pBox->y2 > pPixmapPriv->bitBox.y1)
+ {
+ pPixmapPriv->bitBox = miEmptyBox;
+ pPixmapPriv->allBits = FALSE;
+ return;
+ }
+
+ pBox++;
+ }
+ }
+}
+
+void
xglAddCurrentBitDamage (DrawablePtr pDrawable)
{
XGL_DRAWABLE_PIXMAP_PRIV (pDrawable);
- if (pPixmapPriv->target == xglPixmapTargetIn &&
- pPixmapPriv->damageBox.x1 < pPixmapPriv->bitBox.x2 &&
+ if (pPixmapPriv->damageBox.x1 < pPixmapPriv->bitBox.x2 &&
pPixmapPriv->damageBox.y1 < pPixmapPriv->bitBox.y2 &&
pPixmapPriv->damageBox.x2 > pPixmapPriv->bitBox.x1 &&
pPixmapPriv->damageBox.y2 > pPixmapPriv->bitBox.y1)
diff --git a/hw/xgl/xgltrap.c b/hw/xgl/xgltrap.c
index c643f11a4..8f792a6c5 100644
--- a/hw/xgl/xgltrap.c
+++ b/hw/xgl/xgltrap.c
@@ -173,7 +173,7 @@ xglTrapezoids (CARD8 op,
target = xglPrepareTarget (pDst->pDrawable);
if (nTrap > 1 && op != PictOpAdd && maskFormat &&
- (overlap || op != PictOpOver))
+ (!target || overlap || op != PictOpOver))
{
PixmapPtr pPixmap;
GCPtr pGC;