summaryrefslogtreecommitdiff
authorAdam Jackson <ajax@redhat.com>2008-06-12 20:00:50 (GMT)
committer Adam Jackson <ajax@redhat.com>2008-06-12 20:00:50 (GMT)
commitd15b3790307053587df8daed1936ff6923881b63 (patch) (side-by-side diff)
tree8aadb2d5cecf9c1e497097d20e99879bdc7c20a4
parentc37a93b4850866c713e3cbf39a08bbc9645e24d4 (diff)
downloadxserver-d15b3790307053587df8daed1936ff6923881b63.zip
xserver-d15b3790307053587df8daed1936ff6923881b63.tar.gz
Remove xgl.
This code hasn't been updated with anything even resembling what anyone is shipping in nearly thirty months. It hasn't built out of the box since 7.1. Most of its features over AIGLX are accomplished with DRI2 and friends.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--configure.ac70
-rw-r--r--hw/Makefile.am7
-rw-r--r--hw/xgl/Makefile.am83
-rw-r--r--hw/xgl/egl/Makefile.am44
-rw-r--r--hw/xgl/egl/evdev.c646
-rw-r--r--hw/xgl/egl/kinput.c1670
-rw-r--r--hw/xgl/egl/kkeymap.h55
-rw-r--r--hw/xgl/egl/module/Makefile.am15
-rw-r--r--hw/xgl/egl/module/xeglmodule.c104
-rw-r--r--hw/xgl/egl/xegl.c303
-rw-r--r--hw/xgl/egl/xegl.h214
-rw-r--r--hw/xgl/egl/xeglinit.c131
-rw-r--r--hw/xgl/egl/xeglinput.c168
-rw-r--r--hw/xgl/glx/Makefile.am48
-rw-r--r--hw/xgl/glx/module/Makefile.am21
-rw-r--r--hw/xgl/glx/module/xglxmodule.c104
-rw-r--r--hw/xgl/glx/xglx.c1444
-rw-r--r--hw/xgl/glx/xglx.h138
-rw-r--r--hw/xgl/glx/xglxinit.c168
-rw-r--r--hw/xgl/glx/xglxorg.c674
-rw-r--r--hw/xgl/glxext/Makefile.am21
-rw-r--r--hw/xgl/glxext/module/Makefile.am22
-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.c5772
-rw-r--r--hw/xgl/glxext/xglglxext.h41
-rw-r--r--hw/xgl/glxext/xglglxlog.c4519
-rw-r--r--hw/xgl/xgl.h1474
-rw-r--r--hw/xgl/xglarea.c323
-rw-r--r--hw/xgl/xglcmap.c466
-rw-r--r--hw/xgl/xglcompose.c281
-rw-r--r--hw/xgl/xglcopy.c130
-rw-r--r--hw/xgl/xglfill.c742
-rw-r--r--hw/xgl/xglgc.c645
-rw-r--r--hw/xgl/xglgeometry.c724
-rw-r--r--hw/xgl/xglget.c88
-rw-r--r--hw/xgl/xglglx.c260
-rw-r--r--hw/xgl/xglglx.h79
-rw-r--r--hw/xgl/xglglyph.c1170
-rw-r--r--hw/xgl/xglhash.c134
-rw-r--r--hw/xgl/xglinit.c332
-rw-r--r--hw/xgl/xglinput.c263
-rw-r--r--hw/xgl/xglloader.c130
-rw-r--r--hw/xgl/xglmodule.h45
-rw-r--r--hw/xgl/xgloutput.c181
-rw-r--r--hw/xgl/xglparse.c257
-rw-r--r--hw/xgl/xglpict.c787
-rw-r--r--hw/xgl/xglpixmap.c744
-rw-r--r--hw/xgl/xglscreen.c473
-rw-r--r--hw/xgl/xglshm.c123
-rw-r--r--hw/xgl/xglsolid.c159
-rw-r--r--hw/xgl/xglsync.c453
-rw-r--r--hw/xgl/xgltile.c268
-rw-r--r--hw/xgl/xgltrap.c481
-rw-r--r--hw/xgl/xglwindow.c166
-rw-r--r--hw/xgl/xglxv.c634
-rw-r--r--include/xgl-config.h.in14
57 files changed, 2 insertions, 28582 deletions
diff --git a/configure.ac b/configure.ac
index ccb7c29..4d654da 100644
--- a/configure.ac
+++ b/configure.ac
@@ -40,8 +40,6 @@ AC_CONFIG_HEADERS(include/xorg-server.h)
dnl dix-config.h covers most of the DIX (i.e. everything but the DDX, not just
dnl dix/).
AC_CONFIG_HEADERS(include/dix-config.h)
-dnl xgl-config.h covers the Xgl DDX.
-AC_CONFIG_HEADERS(include/xgl-config.h)
dnl xorg-config.h covers the Xorg DDX.
AC_CONFIG_HEADERS(include/xorg-config.h)
dnl xkb-config.h covers XKB for the Xorg and Xnest DDXs.
@@ -567,9 +565,6 @@ AC_ARG_ENABLE(xvfb, AS_HELP_STRING([--enable-xvfb], [Build Xvfb server
AC_ARG_ENABLE(xnest, AS_HELP_STRING([--enable-xnest], [Build Xnest server (default: auto)]), [XNEST=$enableval], [XNEST=auto])
AC_ARG_ENABLE(xquartz, AS_HELP_STRING([--enable-xquartz], [Build Xquartz server for OS-X (default: auto)]), [XQUARTZ=$enableval], [XQUARTZ=auto])
AC_ARG_ENABLE(xwin, AS_HELP_STRING([--enable-xwin], [Build XWin server (default: auto)]), [XWIN=$enableval], [XWIN=auto])
-AC_ARG_ENABLE(xgl, AS_HELP_STRING([--enable-xgl], [Build Xgl server (default: no)]), [XGL=$enableval], [XGL=no])
-AC_ARG_ENABLE(xglx, AS_HELP_STRING([--enable-xglx], [Build Xglx xgl module (default: no)]), [XGLX=$enableval], [XGLX=no])
-AC_ARG_ENABLE(xegl, AS_HELP_STRING([--enable-xegl], [Build Xegl xgl module (default: no)]), [XEGL=$enableval], [XEGL=no])
dnl legacy fb support
AC_ARG_ENABLE(mfb, AS_HELP_STRING([--enable-mfb], [Build legacy mono framebuffer support (default: disable)]), [MFB=$enableval], [MFB=no])
dnl kdrive and its subsystems
@@ -1252,62 +1247,6 @@ if test "x$XORG" = xauto; then
fi
AC_MSG_RESULT([$XORG])
-dnl Xgl DDX
-
-AC_MSG_CHECKING([whether to build Xgl DDX])
-if test "x$XGL" != xno; then
- PKG_CHECK_MODULES([XGLMODULES], [glitz-glx >= 0.4.3], [XGL=yes], [XGL=no])
- AC_SUBST(XGLMODULES_CFLAGS)
-fi
-AC_MSG_RESULT([$XGL])
-AM_CONDITIONAL(XGL, [test "x$XGL" = xyes])
-
-if test "x$XGL" = xyes; then
- XGL_LIBS="$FB_LIB $COMPOSITE_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $MIEXT_LAYER_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB"
- XGL_SYS_LIBS="$XGLMODULES_LIBS $GLX_SYS_LIBS $DLOPEN_LIBS"
- AC_SUBST([XGL_LIBS])
- AC_SUBST([XGL_SYS_LIBS])
- AC_DEFINE(XGL_MODULAR, 1, [Use loadable XGL modules])
-
- xglmoduledir="$moduledir/xgl"
- AC_SUBST([xglmoduledir])
- AC_DEFINE_DIR(XGL_MODULE_PATH, xglmoduledir, [Default XGL module search path])
-fi
-
-dnl Xegl DDX
-
-AC_MSG_CHECKING([whether to build Xegl DDX])
-if test "x$XEGL" != xno; then
- PKG_CHECK_MODULES([XGLMODULES], [glitz-glx >= 0.4.3], [XEGL=yes], [XEGL=no])
- AC_SUBST(XEGLMODULES_CFLAGS)
-fi
-AC_MSG_RESULT([$XEGL])
-AM_CONDITIONAL(XEGL, [test "x$XEGL" = xyes])
-
-if test "x$XEGL" = xyes; then
- XEGL_LIBS="$FB_LIB $COMPOSITE_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $MIEXT_LAYER_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB"
- XEGL_SYS_LIBS = "$XEGL_SYS_LIBS $XEGLMODULES_LIBS $GLX_SYS_LIBS"
- AC_SUBST([XEGL_LIBS])
- AC_SUBST([XEGL_SYS_LIBS])
-fi
-
-dnl Xglx DDX
-
-AC_MSG_CHECKING([whether to build Xglx DDX])
-if test "x$XGLX" != xno; then
- PKG_CHECK_MODULES([XGLXMODULES], [glitz-glx >= 0.4.3 xrender], [XGLX=yes], [XGLX=no])
- AC_SUBST(XGLXMODULES_CFLAGS)
-fi
-AC_MSG_RESULT([$XGLX])
-AM_CONDITIONAL(XGLX, [test "x$XGLX" = xyes])
-
-if test "x$XGLX" = xyes; then
- XGLX_LIBS="$FB_LIB $COMPOSITE_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $MIEXT_LAYER_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB"
- XGLX_SYS_LIBS="$XGLX_SYS_LIBS $XGLXMODULES_LIBS $GLX_SYS_LIBS"
- AC_SUBST([XGLX_LIBS])
- AC_SUBST([XGLX_SYS_LIBS])
-fi
-
xorg_bus_linuxpci=no
xorg_bus_bsdpci=no
xorg_bus_ix86pci=no
@@ -1315,7 +1254,7 @@ xorg_bus_ppcpci=no
xorg_bus_sparcpci=no
xorg_bus_sparc=no
-if test "x$XORG" = xyes -o "x$XGL" = xyes; then
+if test "x$XORG" = xyes; then
XORG_DDXINCS='-I$(top_srcdir)/hw/xfree86 -I$(top_srcdir)/hw/xfree86/include -I$(top_srcdir)/hw/xfree86/common'
XORG_OSINCS='-I$(top_srcdir)/hw/xfree86/os-support -I$(top_srcdir)/hw/xfree86/os-support/bus -I$(top_srcdir)/os'
XORG_INCS="$XORG_DDXINCS $XORG_OSINCS"
@@ -2054,13 +1993,6 @@ hw/dmx/input/Makefile
hw/dmx/glxProxy/Makefile
hw/dmx/Makefile
hw/vfb/Makefile
-hw/xgl/Makefile
-hw/xgl/egl/Makefile
-hw/xgl/egl/module/Makefile
-hw/xgl/glx/Makefile
-hw/xgl/glx/module/Makefile
-hw/xgl/glxext/Makefile
-hw/xgl/glxext/module/Makefile
hw/xnest/Makefile
hw/xwin/Makefile
hw/xquartz/Makefile
diff --git a/hw/Makefile.am b/hw/Makefile.am
index 4589b7e..7409906 100644
--- a/hw/Makefile.am
+++ b/hw/Makefile.am
@@ -18,10 +18,6 @@ if XWIN
XWIN_SUBDIRS = xwin
endif
-if XGL
-XGL_SUBDIRS = xgl
-endif
-
if KDRIVE
KDRIVE_SUBDIRS = kdrive
endif
@@ -32,7 +28,6 @@ endif
SUBDIRS = \
$(XORG_SUBDIRS) \
- $(XGL_SUBDIRS) \
$(XWIN_SUBDIRS) \
$(XVFB_SUBDIRS) \
$(XNEST_SUBDIRS) \
@@ -40,7 +35,7 @@ SUBDIRS = \
$(KDRIVE_SUBDIRS) \
$(XQUARTZ_SUBDIRS)
-DIST_SUBDIRS = dmx xfree86 vfb xnest xwin xquartz kdrive xgl
+DIST_SUBDIRS = dmx xfree86 vfb xnest xwin xquartz kdrive
relink:
for i in $(SUBDIRS) ; do $(MAKE) -C $$i relink ; done
diff --git a/hw/xgl/Makefile.am b/hw/xgl/Makefile.am
deleted file mode 100644
index 8df8ae9..0000000
--- a/hw/xgl/Makefile.am
+++ b/dev/null
@@ -1,83 +0,0 @@
-if GLX
-GLX_SUBDIRS = glxext
-endif
-
-if XGLX
-XGLX_SUBDIRS = glx
-endif
-
-if XEGL
-XEGL_SUBDIRS = egl
-endif
-
-DIST_SUBDIRS = glxext glx egl
-
-SUBDIRS = \
- . \
- $(GLX_SUBDIRS) \
- $(XGLX_SUBDIRS) \
- $(XEGL_SUBDIRS)
-
-AM_CFLAGS = \
- $(DIX_CFLAGS) \
- -DHAVE_XGL_CONFIG_H \
- -DHAVE_DIX_CONFIG_H \
- -I$(top_srcdir)/glx \
- -I$(top_srcdir)/GL/include \
- -I@MESA_SOURCE@/include \
- -I@MESA_SOURCE@/src/mesa/glapi \
- $(XGLMODULES_CFLAGS)
-
-noinst_LIBRARIES = libxgl.a
-
-libxgl_a_SOURCES = \
- xgl.h \
- xglmodule.h \
- xglglx.h \
- xglinput.c \
- xgloutput.c \
- xglcmap.c \
- xglparse.c \
- xglscreen.c \
- xglarea.c \
- xglgeometry.c \
- xglpixmap.c \
- xglsync.c \
- xglsolid.c \
- xgltile.c \
- xglcopy.c \
- xglfill.c \
- xglwindow.c \
- xglget.c \
- xglgc.c \
- xglshm.c \
- xglcompose.c \
- xglpict.c \
- xglglyph.c \
- xgltrap.c \
- xglloader.c \
- xglhash.c \
- xglglx.c \
- xglxv.c
-
-EXTRA_DIST = \
- xglmodule.h
-
-Xgl_LDFLAGS = -export-dynamic
-Xgl_SOURCES = \
- xglinit.c \
- $(top_srcdir)/mi/miinitext.c \
- $(top_srcdir)/Xext/dpmsstubs.c \
- $(top_srcdir)/Xi/stubs.c \
- $(top_srcdir)/fb/fbcmap.c
-
-XGL_LIBS = \
- libxgl.a \
- @XGL_LIBS@ \
- $(XSERVER_LIBS)
-
-Xgl_DEPENDENCIES = $(XGL_LIBS)
-Xgl_LDADD = $(XGL_LIBS) $(XSERVER_SYS_LIBS) $(XGL_SYS_LIBS)
-Xgl_programs = Xgl
-
-bin_PROGRAMS = $(Xgl_programs)
diff --git a/hw/xgl/egl/Makefile.am b/hw/xgl/egl/Makefile.am
deleted file mode 100644
index 8c4e9af..0000000
--- a/hw/xgl/egl/Makefile.am
+++ b/dev/null
@@ -1,44 +0,0 @@
-if XGL
-XGL_MODULE_DIRS = module
-endif
-
-DIST_SUBDIRS = module
-
-SUBDIRS = \
- . \
- $(XGL_MODULE_DIRS)
-
-AM_CFLAGS = \
- $(DIX_CFLAGS) \
- -DHAVE_XGL_CONFIG_H \
- -DHAVE_DIX_CONFIG_H \
- $(XEGLMODULES_CFLAGS)
-
-noinst_LTLIBRARIES = libxegl.la
-
-libxegl_la_SOURCES = \
- xegl.h \
- xegl.c \
- xeglinput.c \
- kkeymap.h \
- kinput.c \
- evdev.c
-
-XEGL_LIBS = \
- @XEGL_LIBS@ \
- libxegl.la \
- ../libxgl.a \
- $XSERVER_LIBS
-
-Xegl_LDFLAGS = -export-dynamic
-Xegl_SOURCES = \
- xeglinit.c \
- $(top_srcdir)/mi/miinitext.c \
- $(top_srcdir)/Xext/dpmsstubs.c \
- $(top_srcdir)/Xi/stubs.c \
- $(top_srcdir)/fb/fbcmap.c
-
-Xegl_DEPENDENCIES = $(XEGL_LIBS)
-Xegl_LDADD = $(XEGL_LIBS) $(XSERVER_SYS_LIBS) $(XEGL_SYS_LIBS)
-
-bin_PROGRAMS = Xegl
diff --git a/hw/xgl/egl/evdev.c b/hw/xgl/egl/evdev.c
deleted file mode 100644
index fff4524..0000000
--- a/hw/xgl/egl/evdev.c
+++ b/dev/null
@@ -1,646 +0,0 @@
-/*
- * Copyright © 2004 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-
-#include <xgl-config.h>
-#define NEED_EVENTS
-#include <errno.h>
-#include <linux/input.h>
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include <X11/Xpoll.h>
-#define XK_PUBLISHING
-#include <X11/keysym.h>
-#include "inputstr.h"
-#include "kkeymap.h"
-#include "scrnintstr.h"
-#include "xegl.h"
-
-#define NUM_EVENTS 128
-#define ABS_UNSET -65535
-
-#define BITS_PER_LONG (sizeof(long) * 8)
-#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1)
-#define ISBITSET(x,y) ((x)[LONG(y)] & BIT(y))
-#define OFF(x) ((x)%BITS_PER_LONG)
-#define LONG(x) ((x)/BITS_PER_LONG)
-#define BIT(x) (1 << OFF(x))
-#define SETBIT(x,y) ((x)[LONG(y)] |= BIT(y))
-#define CLRBIT(x,y) ((x)[LONG(y)] &= ~BIT(y))
-#define ASSIGNBIT(x,y,z) ((x)[LONG(y)] = ((x)[LONG(y)] & ~BIT(y)) | (z << OFF(y)))
-
-typedef struct _kevdevMouse {
- /* current device state */
- int rel[REL_MAX + 1];
- int abs[ABS_MAX + 1];
- int prevabs[ABS_MAX + 1];
- long key[NBITS(KEY_MAX + 1)];
-
- /* supported device info */
- long relbits[NBITS(REL_MAX + 1)];
- long absbits[NBITS(ABS_MAX + 1)];
- long keybits[NBITS(KEY_MAX + 1)];
- struct input_absinfo absinfo[ABS_MAX + 1];
- int max_rel;
- int max_abs;
-} Kevdev;
-
-static int flags = 0;
-
-static void
-EvdevMotion (KdMouseInfo *mi)
-{
- Kevdev *ke = mi->driver;
- int i;
-
- for (i = 0; i <= ke->max_rel; i++)
- if (ke->rel[i])
- {
- KdEnqueueMouseEvent (mi, flags | KD_MOUSE_DELTA, ke->rel[0], ke->rel[1]);
- int a;
-// ErrorF ("rel");
- for (a = 0; a <= ke->max_rel; a++)
- {
-// if (ISBITSET (ke->relbits, a))
-// ErrorF (" %d=%d", a, ke->rel[a]);
- ke->rel[a] = 0;
- }
-// ErrorF ("\n");
- break;
- }
- for (i = 0; i < ke->max_abs; i++)
- if (ke->abs[i] != ke->prevabs[i])
- {
- KdEnqueueMouseEvent (mi, flags, ke->abs[0], ke->abs[1]);
- int a;
-// ErrorF ("abs");
- for (a = 0; a <= ke->max_abs; a++)
- {
-// if (ISBITSET (ke->absbits, a))
-// ErrorF (" %d=%d", a, ke->abs[a]);
- ke->prevabs[a] = ke->abs[a];
- }
-// ErrorF ("\n");
- break;
- }
-}
-
-static void
-EvdevRead (int evdevPort, void *closure)
-{
- KdMouseInfo *mi = closure;
- Kevdev *ke = mi->driver;
- int i, n;
- struct input_event events[NUM_EVENTS];
-
- n = read (evdevPort, &events, NUM_EVENTS * sizeof (struct input_event));
- if (n <= 0)
- return;
- n /= sizeof (struct input_event);
- for (i = 0; i < n; i++)
- {
- switch (events[i].type) {
- case EV_SYN:
- break;
- case EV_KEY:
- EvdevMotion (mi);
- ASSIGNBIT(ke->key,events[i].code, events[i].value);
- if (events[i].code < 0x100)
- ErrorF ("key %d %d\n", events[i].code, events[i].value);
- else
- ErrorF ("key 0x%x %d\n", events[i].code, events[i].value);
-
- if (events[i].value==1) {
- switch (events[i].code) {
- case BTN_LEFT:
- flags |= KD_BUTTON_1;
- break;
- case BTN_RIGHT:
- flags |= KD_BUTTON_3;
- break;
- case BTN_MIDDLE:
- flags |= KD_BUTTON_2;
- break;
- case BTN_FORWARD:
- flags |= KD_BUTTON_4;
- break;
- case BTN_BACK:
- flags |= KD_BUTTON_5;
- break;
- }
- }
- else if (events[i].value==0) {
- switch (events[i].code) {
- case BTN_LEFT:
- flags &= ~KD_BUTTON_1;
- 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);
- break;
- case EV_REL:
- ke->rel[events[i].code] += events[i].value;
- break;
- case EV_ABS:
- ke->abs[events[i].code] = events[i].value;
- break;
- }
- }
- EvdevMotion (mi);
-}
-
-int EvdevInputType;
-
-char *kdefaultEvdev[] = {
- // "/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]))
-
-static Bool
-EvdevInit (void)
-{
- int i;
- int fd;
- KdMouseInfo *mi, *next;
- int n = 0;
- char *prot;
- char name[100];
-
- if (!EvdevInputType)
- EvdevInputType = KdAllocInputType ();
-
- for (mi = kdMouseInfo; mi; mi = next)
- {
- next = mi->next;
- prot = mi->prot;
- if (mi->inputType)
- continue;
- if (!mi->name)
- {
- for (i = 0; i < NUM_DEFAULT_EVDEV; i++)
- {
- fd = open (kdefaultEvdev[i], 2);
- if (fd >= 0)
- {
- ioctl(fd, EVIOCGRAB, 1);
-
- ioctl(fd, EVIOCGNAME(sizeof(name)), name);
- ErrorF("Name is %s\n", name);
- ioctl(fd, EVIOCGPHYS(sizeof(name)), name);
- ErrorF("Phys Loc is %s\n", name);
- ioctl(fd, EVIOCGUNIQ(sizeof(name)), name);
- ErrorF("Unique is %s\n", name);
-
- mi->name = KdSaveString (kdefaultEvdev[i]);
- break;
- }
- }
- }
- else
- fd = open (mi->name, 2);
-
- if (fd >= 0)
- {
- unsigned long ev[NBITS(EV_MAX)];
- Kevdev *ke;
-
- if (ioctl (fd, EVIOCGBIT(0 /*EV*/, sizeof (ev)), ev) < 0)
- {
- perror ("EVIOCGBIT 0");
- close (fd);
- continue;
- }
- ke = xalloc (sizeof (Kevdev));
- if (!ke)
- {
- close (fd);
- continue;
- }
- memset (ke, '\0', sizeof (Kevdev));
- if (ISBITSET (ev, EV_KEY))
- {
- if (ioctl (fd, EVIOCGBIT (EV_KEY, sizeof (ke->keybits)),
- ke->keybits) < 0)
- {
- perror ("EVIOCGBIT EV_KEY");
- xfree (ke);
- close (fd);
- continue;
- }
- }
- if (ISBITSET (ev, EV_REL))
- {
- if (ioctl (fd, EVIOCGBIT (EV_REL, sizeof (ke->relbits)),
- ke->relbits) < 0)
- {
- perror ("EVIOCGBIT EV_REL");
- xfree (ke);
- close (fd);
- continue;
- }
- for (ke->max_rel = REL_MAX; ke->max_rel >= 0; ke->max_rel--)
- if (ISBITSET(ke->relbits, ke->max_rel))
- break;
- }
- if (ISBITSET (ev, EV_ABS))
- {
- int i;
-
- if (ioctl (fd, EVIOCGBIT (EV_ABS, sizeof (ke->absbits)),
- ke->absbits) < 0)
- {
- perror ("EVIOCGBIT EV_ABS");
- xfree (ke);
- close (fd);
- continue;
- }
- for (ke->max_abs = ABS_MAX; ke->max_abs >= 0; ke->max_abs--)
- if (ISBITSET(ke->absbits, ke->max_abs))
- break;
- for (i = 0; i <= ke->max_abs; i++)
- {
- if (ISBITSET (ke->absbits, i))
- if (ioctl (fd, EVIOCGABS(i), &ke->absinfo[i]) < 0)
- {
- perror ("EVIOCGABS");
- break;
- }
- ke->prevabs[i] = ABS_UNSET;
- }
- if (i <= ke->max_abs)
- {
- xfree (ke);
- close (fd);
- continue;
- }
- }
- mi->driver = ke;
- mi->inputType = EvdevInputType;
- if (KdRegisterFd (EvdevInputType, fd, EvdevRead, (void *) mi))
- n++;
- }
- }
- return TRUE;
-}
-
-static void
-EvdevFini (void)
-{
- KdMouseInfo *mi;
-
- KdUnregisterFds (EvdevInputType, TRUE);
- for (mi = kdMouseInfo; mi; mi = mi->next)
- {
- if (mi->inputType == EvdevInputType)
- {
- xfree (mi->driver);
- mi->driver = 0;
- mi->inputType = 0;
- }
- }
-}
-
-KdMouseFuncs LinuxEvdevMouseFuncs = {
- EvdevInit,
- EvdevFini,
-};
-
-
-KeySym evdevKeymap[(112 - 1 + 1) * 2] = {
-/* These are directly mapped from DOS scanset 0 */
-/* 1 8 */ XK_Escape, NoSymbol,
-/* 2 9 */ XK_1, XK_exclam,
-/* 3 10 */ XK_2, XK_at,
-/* 4 11 */ XK_3, XK_numbersign,
-/* 5 12 */ XK_4, XK_dollar,
-/* 6 13 */ XK_5, XK_percent,
-/* 7 14 */ XK_6, XK_asciicircum,
-/* 8 15 */ XK_7, XK_ampersand,
-/* 9 16 */ XK_8, XK_asterisk,
-/* 10 17 */ XK_9, XK_parenleft,
-/* 11 18 */ XK_0, XK_parenright,
-/* 12 19 */ XK_minus, XK_underscore,
-/* 13 20 */ XK_equal, XK_plus,
-/* 14 21 */ XK_BackSpace, NoSymbol,
-/* 15 22 */ XK_Tab, NoSymbol,
-/* 16 23 */ XK_Q, NoSymbol,
-/* 17 24 */ XK_W, NoSymbol,
-/* 18 25 */ XK_E, NoSymbol,
-/* 19 26 */ XK_R, NoSymbol,
-/* 20 27 */ XK_T, NoSymbol,
-/* 21 28 */ XK_Y, NoSymbol,
-/* 22 29 */ XK_U, NoSymbol,
-/* 23 30 */ XK_I, NoSymbol,
-/* 24 31 */ XK_O, NoSymbol,
-/* 25 32 */ XK_P, NoSymbol,
-/* 26 33 */ XK_bracketleft, XK_braceleft,
-/* 27 34 */ XK_bracketright, XK_braceright,
-/* 28 35 */ XK_Return, NoSymbol,
-/* 29 36 */ XK_Control_L, NoSymbol,
-/* 30 37 */ XK_A, NoSymbol,
-/* 31 38 */ XK_S, NoSymbol,
-/* 32 39 */ XK_D, NoSymbol,
-/* 33 40 */ XK_F, NoSymbol,
-/* 34 41 */ XK_G, NoSymbol,
-/* 35 42 */ XK_H, NoSymbol,
-/* 36 43 */ XK_J, NoSymbol,
-/* 37 44 */ XK_K, NoSymbol,
-/* 38 45 */ XK_L, NoSymbol,
-/* 39 46 */ XK_semicolon, XK_colon,
-/* 40 47 */ XK_apostrophe, XK_quotedbl,
-/* 41 48 */ XK_grave, XK_asciitilde,
-/* 42 49 */ XK_Shift_L, NoSymbol,
-/* 43 50 */ XK_backslash, XK_bar,
-/* 44 51 */ XK_Z, NoSymbol,
-/* 45 52 */ XK_X, NoSymbol,
-/* 46 53 */ XK_C, NoSymbol,
-/* 47 54 */ XK_V, NoSymbol,
-/* 48 55 */ XK_B, NoSymbol,
-/* 49 56 */ XK_N, NoSymbol,
-/* 50 57 */ XK_M, NoSymbol,
-/* 51 58 */ XK_comma, XK_less,
-/* 52 59 */ XK_period, XK_greater,
-/* 53 60 */ XK_slash, XK_question,
-/* 54 61 */ XK_Shift_R, NoSymbol,
-/* 55 62 */ XK_KP_Multiply, NoSymbol,
-/* 56 63 */ XK_Alt_L, XK_Meta_L,
-/* 57 64 */ XK_space, NoSymbol,
-/* 58 65 */ XK_Caps_Lock, NoSymbol,
-/* 59 66 */ XK_F1, NoSymbol,
-/* 60 67 */ XK_F2, NoSymbol,
-/* 61 68 */ XK_F3, NoSymbol,
-/* 62 69 */ XK_F4, NoSymbol,
-/* 63 70 */ XK_F5, NoSymbol,
-/* 64 71 */ XK_F6, NoSymbol,
-/* 65 72 */ XK_F7, NoSymbol,
-/* 66 73 */ XK_F8, NoSymbol,
-/* 67 74 */ XK_F9, NoSymbol,
-/* 68 75 */ XK_F10, NoSymbol,
-/* 69 76 */ XK_Break, XK_Pause,
-/* 70 77 */ XK_Scroll_Lock, NoSymbol,
-/* 71 78 */ XK_KP_Home, XK_KP_7,
-/* 72 79 */ XK_KP_Up, XK_KP_8,
-/* 73 80 */ XK_KP_Page_Up, XK_KP_9,
-/* 74 81 */ XK_KP_Subtract, NoSymbol,
-/* 75 82 */ XK_KP_Left, XK_KP_4,
-/* 76 83 */ XK_KP_5, NoSymbol,
-/* 77 84 */ XK_KP_Right, XK_KP_6,
-/* 78 85 */ XK_KP_Add, NoSymbol,
-/* 79 86 */ XK_KP_End, XK_KP_1,
-/* 80 87 */ XK_KP_Down, XK_KP_2,
-/* 81 88 */ XK_KP_Page_Down, XK_KP_3,
-/* 82 89 */ XK_KP_Insert, XK_KP_0,
-/* 83 90 */ XK_KP_Delete, XK_KP_Decimal,
-/* 84 91 */ NoSymbol, NoSymbol,
-/* 85 92 */ NoSymbol, NoSymbol,
-/* 86 93 */ NoSymbol, NoSymbol,
-/* 87 94 */ XK_F11, NoSymbol,
-/* 88 95 */ XK_F12, NoSymbol,
-
-/* These are remapped from the extended set (using ExtendMap) */
-
-/* 89 96 */ XK_Control_R, NoSymbol,
-/* 90 97 */ XK_KP_Enter, NoSymbol,
-/* 91 98 */ XK_KP_Divide, NoSymbol,
-/* 92 99 */ XK_Sys_Req, XK_Print,
-/* 93 100 */ XK_Alt_R, XK_Meta_R,
-/* 94 101 */ XK_Num_Lock, NoSymbol,
-/* 95 102 */ XK_Home, NoSymbol,
-/* 96 103 */ XK_Up, NoSymbol,
-/* 97 104 */ XK_Page_Up, NoSymbol,
-/* 98 105 */ XK_Left, NoSymbol,
-/* 99 106 */ XK_Right, NoSymbol,
-/* 100 107 */ XK_End, NoSymbol,
-/* 101 108 */ XK_Down, NoSymbol,
-/* 102 109 */ XK_Page_Down, NoSymbol,
-/* 103 110 */ XK_Insert, NoSymbol,
-/* 104 111 */ XK_Delete, NoSymbol,
-/* 105 112 */ XK_Super_L, NoSymbol,
-/* 106 113 */ XK_Super_R, NoSymbol,
-/* 107 114 */ XK_Menu, NoSymbol,
-/* 108 115 */ NoSymbol, NoSymbol,
-/* 109 116 */ NoSymbol, NoSymbol,
-/* 110 117 */ NoSymbol, NoSymbol,
-/* 111 118 */ NoSymbol, NoSymbol,
-/* 112 119 */ NoSymbol, NoSymbol,
-};
-
-static void
-EvdevRead1 (int evdevPort, void *closure)
-{
- int i, n, xk;
- struct input_event events[NUM_EVENTS];
-
- n = read (evdevPort, &events, NUM_EVENTS * sizeof (struct input_event));
- if (n <= 0)
- return;
- n /= sizeof (struct input_event);
- for (i = 0; i < n; i++)
- {
- switch (events[i].type) {
- case EV_SYN:
- break;
- case EV_KEY:
- xk = events[i].code;
- if (events[i].code < 0x100)
- ErrorF ("key %d %d xk %d\n", events[i].code, events[i].value, xk);
- else
- ErrorF ("key 0x%x %d xk %d\n", events[i].code, events[i].value, xk);
- if (events[i].value == 2) {
- //KdEnqueueKeyboardEvent (xk, 0);
- KdEnqueueKeyboardEvent (xk, 0);
- } else
- KdEnqueueKeyboardEvent (xk, !events[i].value);
- break;
- }
- }
-}
-
-char *kdefaultEvdev1[] = {
- "/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]))
-
-static Bool
-EvdevKbdInit (void)
-{
- int i;
- int fd;
- int n = 0;
- char name[100];
-
- if (!EvdevInputType)
- EvdevInputType = KdAllocInputType ();
-
- for (i = 0; i < NUM_DEFAULT_EVDEV; i++)
- {
- fd = open (kdefaultEvdev1[i], 2);
- if (fd >= 0)
- {
- ioctl(fd, EVIOCGRAB, 1);
-
- ioctl(fd, EVIOCGNAME(sizeof(name)), name);
- ErrorF("Name is %s\n", name);
- ioctl(fd, EVIOCGPHYS(sizeof(name)), name);
- ErrorF("Phys Loc is %s\n", name);
- ioctl(fd, EVIOCGUNIQ(sizeof(name)), name);
- ErrorF("Unique is %s\n", name);
-
- }
-
- if (fd >= 0)
- {
- unsigned long ev[NBITS(EV_MAX)];
- Kevdev *ke;
-
- if (ioctl (fd, EVIOCGBIT(0 /*EV*/, sizeof (ev)), ev) < 0)
- {
- perror ("EVIOCGBIT 0");
- close (fd);
- continue;
- }
- ke = xalloc (sizeof (Kevdev));
- if (!ke)
- {
- close (fd);
- continue;
- }
- memset (ke, '\0', sizeof (Kevdev));
- if (ISBITSET (ev, EV_KEY))
- {
- if (ioctl (fd, EVIOCGBIT (EV_KEY, sizeof (ke->keybits)),
- ke->keybits) < 0)
- {
- perror ("EVIOCGBIT EV_KEY");
- xfree (ke);
- close (fd);
- continue;
- }
- }
- if (ISBITSET (ev, EV_REL))
- {
- if (ioctl (fd, EVIOCGBIT (EV_REL, sizeof (ke->relbits)),
- ke->relbits) < 0)
- {
- perror ("EVIOCGBIT EV_REL");
- xfree (ke);
- close (fd);
- continue;
- }
- for (ke->max_rel = REL_MAX; ke->max_rel >= 0; ke->max_rel--)
- if (ISBITSET(ke->relbits, ke->max_rel))
- break;
- }
- if (ISBITSET (ev, EV_ABS))
- {
- int i;
-
- if (ioctl (fd, EVIOCGBIT (EV_ABS, sizeof (ke->absbits)),
- ke->absbits) < 0)
- {
- perror ("EVIOCGBIT EV_ABS");
- xfree (ke);
- close (fd);
- continue;
- }
- for (ke->max_abs = ABS_MAX; ke->max_abs >= 0; ke->max_abs--)
- if (ISBITSET(ke->absbits, ke->max_abs))
- break;
- for (i = 0; i <= ke->max_abs; i++)
- {
- if (ISBITSET (ke->absbits, i))
- if (ioctl (fd, EVIOCGABS(i), &ke->absinfo[i]) < 0)
- {
- perror ("EVIOCGABS");
- break;
- }
- ke->prevabs[i] = ABS_UNSET;
- }
- if (i <= ke->max_abs)
- {
- xfree (ke);
- close (fd);
- continue;
- }
- }
- if (KdRegisterFd (EvdevInputType, fd, EvdevRead1, NULL))
- n++;
- }
- }
- return TRUE;
-}
-
-static void EvdevKbdLoad(void)
-{
- kdMinScanCode = 1;
- kdMaxScanCode = 112;
- kdKeymapWidth = 2;
- memcpy (kdKeymap, evdevKeymap, sizeof (evdevKeymap));
-}
-
-static void
-EvdevKbdFini (void)
-{
-}
-
-static void
-EvdevKbdLeds (int leds)
-{
-}
-
-
-static void EvdevKbdBell(int volume, int pitch, int duration)
-{
-}
-
-
-KdKeyboardFuncs LinuxEvdevKeyboardFuncs = {
- EvdevKbdLoad,
- EvdevKbdInit,
- EvdevKbdLeds,
- EvdevKbdBell,
- EvdevKbdFini,
- 0,
-};
diff --git a/hw/xgl/egl/kinput.c b/hw/xgl/egl/kinput.c
deleted file mode 100644
index 6c1018c..0000000
--- a/hw/xgl/egl/kinput.c
+++ b/dev/null
@@ -1,1670 +0,0 @@
-/*
- * Copyright 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-
-#include <xgl-config.h>
-
-#include <signal.h>
-#include <stdio.h>
-
-#include "xegl.h"
-#include "mipointer.h"
-#include "inputstr.h"
-
-#define XK_PUBLISHING
-#include <X11/keysym.h>
-#if HAVE_X11_XF86KEYSYM_H
-#include <X11/XF86keysym.h>
-#endif
-#include "kkeymap.h"
-
-#ifdef XKB
-#define XKB_IN_SERVER
-#include <xkbsrv.h>
-#endif
-
-static DeviceIntPtr pKdKeyboard, pKdPointer;
-
-#define MAX_MOUSE_DRIVERS 6
-
-static KdMouseFuncs *kdMouseFuncs[MAX_MOUSE_DRIVERS];
-static int kdNMouseFuncs;
-static KdKeyboardFuncs *kdKeyboardFuncs;
-static int kdBellPitch;
-static int kdBellDuration;
-static int kdLeds;
-static Bool kdInputEnabled;
-static Bool kdOffScreen;
-static unsigned long kdOffScreenTime;
-static KdMouseMatrix kdMouseMatrix = {
- { { 1, 0, 0 },
- { 0, 1, 0 } }
-};
-
-int kdMouseButtonCount;
-int kdMinScanCode;
-int kdMaxScanCode;
-int kdMinKeyCode;
-int kdMaxKeyCode;
-int kdKeymapWidth = KD_MAX_WIDTH;
-KeySym kdKeymap[KD_MAX_LENGTH * KD_MAX_WIDTH];
-CARD8 kdModMap[MAP_LENGTH];
-KeySymsRec kdKeySyms;
-
-
-void
-KdResetInputMachine (void);
-
-#define KD_KEY_COUNT 248
-
-CARD8 kdKeyState[KD_KEY_COUNT/8];
-
-#define IsKeyDown(key) ((kdKeyState[(key) >> 3] >> ((key) & 7)) & 1)
-
-#define KD_MAX_INPUT_FDS 8
-
-typedef struct _kdInputFd {
- int type;
- int fd;
- void (*read) (int fd, void *closure);
- int (*enable) (int fd, void *closure);
- void (*disable) (int fd, void *closure);
- void *closure;
-} KdInputFd;
-
-KdInputFd kdInputFds[KD_MAX_INPUT_FDS];
-int kdNumInputFds;
-int kdInputTypeSequence;
-
-static void
-KdSigio (int sig)
-{
- int i;
-
- for (i = 0; i < kdNumInputFds; i++)
- (*kdInputFds[i].read) (kdInputFds[i].fd, kdInputFds[i].closure);
-}
-
-static void
-KdBlockSigio (void)
-{
- sigset_t set;
-
- sigemptyset (&set);
- sigaddset (&set, SIGIO);
- sigprocmask (SIG_BLOCK, &set, 0);
-}
-
-static void
-KdUnblockSigio (void)
-{
- sigset_t set;
-
- sigemptyset (&set);
- sigaddset (&set, SIGIO);
- sigprocmask (SIG_UNBLOCK, &set, 0);
-}
-
-#undef VERIFY_SIGIO
-#ifdef VERIFY_SIGIO
-
-void
-KdAssertSigioBlocked (char *where)
-{
- sigset_t set, old;
-
- sigemptyset (&set);
- sigprocmask (SIG_BLOCK, &set, &old);
- if (!sigismember (&old, SIGIO))
- ErrorF ("SIGIO not blocked at %s\n", where);
-}
-
-#else
-
-#define KdAssertSigioBlocked(s)
-
-#endif
-
-static int kdnFds;
-
-#ifdef FNONBLOCK
-#define NOBLOCK FNONBLOCK
-#else
-#define NOBLOCK FNDELAY
-#endif
-
-static void
-KdNonBlockFd (int fd)
-{
- int flags;
- flags = fcntl (fd, F_GETFL);
- flags |= FASYNC|NOBLOCK;
- fcntl (fd, F_SETFL, flags);
-}
-
-static void
-KdAddFd (int fd)
-{
- struct sigaction act;
- sigset_t set;
-
- kdnFds++;
- fcntl (fd, F_SETOWN, getpid());
- KdNonBlockFd (fd);
- AddEnabledDevice (fd);
- memset (&act, '\0', sizeof act);
- act.sa_handler = KdSigio;
- sigemptyset (&act.sa_mask);
- sigaddset (&act.sa_mask, SIGIO);
- sigaddset (&act.sa_mask, SIGALRM);
- sigaddset (&act.sa_mask, SIGVTALRM);
- sigaction (SIGIO, &act, 0);
- sigemptyset (&set);
- sigprocmask (SIG_SETMASK, &set, 0);
-}
-
-static void
-KdRemoveFd (int fd)
-{
- struct sigaction act;
- int flags;
-
- kdnFds--;
- RemoveEnabledDevice (fd);
- flags = fcntl (fd, F_GETFL);
- flags &= ~(FASYNC|NOBLOCK);
- fcntl (fd, F_SETFL, flags);
- if (kdnFds == 0)
- {
- memset (&act, '\0', sizeof act);
- act.sa_handler = SIG_IGN;
- sigemptyset (&act.sa_mask);
- sigaction (SIGIO, &act, 0);
- }
-}
-
-int
-KdAllocInputType (void)
-{
- return ++kdInputTypeSequence;
-}
-
-Bool
-KdRegisterFd (int type, int fd, void (*read) (int fd, void *closure), void *closure)
-{
- if (kdNumInputFds == KD_MAX_INPUT_FDS)
- return FALSE;
- kdInputFds[kdNumInputFds].type = type;
- kdInputFds[kdNumInputFds].fd = fd;
- kdInputFds[kdNumInputFds].read = read;
- kdInputFds[kdNumInputFds].enable = 0;
- kdInputFds[kdNumInputFds].disable = 0;
- kdInputFds[kdNumInputFds].closure = closure;
- ++kdNumInputFds;
- if (kdInputEnabled)
- KdAddFd (fd);
- return TRUE;
-}
-
-void
-KdRegisterFdEnableDisable (int fd,
- int (*enable) (int fd, void *closure),
- void (*disable) (int fd, void *closure))
-{
- int i;
-
- for (i = 0; i < kdNumInputFds; i++)
- if (kdInputFds[i].fd == fd)
- {
- kdInputFds[i].enable = enable;
- kdInputFds[i].disable = disable;
- break;
- }
-}
-
-void
-KdUnregisterFds (int type, Bool do_close)
-{
- int i, j;
-
- for (i = 0; i < kdNumInputFds;)
- {
- if (kdInputFds[i].type == type)
- {
- if (kdInputEnabled)
- KdRemoveFd (kdInputFds[i].fd);
- if (do_close)
- close (kdInputFds[i].fd);
- --kdNumInputFds;
- for (j = i; j < kdNumInputFds; j++)
- kdInputFds[j] = kdInputFds[j+1];
- }
- else
- i++;
- }
-}
-
-static void
-KdDisableInput (void)
-{
- int i;
-
- KdBlockSigio ();
-
- for (i = 0; i < kdNumInputFds; i++)
- {
- KdRemoveFd (kdInputFds[i].fd);
- if (kdInputFds[i].disable)
- (*kdInputFds[i].disable) (kdInputFds[i].fd, kdInputFds[i].closure);
- }
- kdInputEnabled = FALSE;
-}
-
-static void
-KdEnableInput (void)
-{
- xEvent xE;
- int i;
-
- kdInputEnabled = TRUE;
- for (i = 0; i < kdNumInputFds; i++)
- {
- KdNonBlockFd (kdInputFds[i].fd);
- if (kdInputFds[i].enable)
- kdInputFds[i].fd = (*kdInputFds[i].enable) (kdInputFds[i].fd, kdInputFds[i].closure);
- KdAddFd (kdInputFds[i].fd);
- }
-
- /* reset screen saver */
- xE.u.keyButtonPointer.time = GetTimeInMillis ();
- NoticeEventTime (&xE);
-
- KdUnblockSigio ();
-}
-
-static int
-KdMouseProc(DeviceIntPtr pDevice, int onoff)
-{
- BYTE map[KD_MAX_BUTTON];
- DevicePtr pDev = (DevicePtr)pDevice;
- int i;
-
- if (!pDev)
- return BadImplementation;
-
- switch (onoff)
- {
- case DEVICE_INIT:
- for (i = 1; i <= kdMouseButtonCount; i++)
- map[i] = i;
- InitPointerDeviceStruct(pDev, map, kdMouseButtonCount,
- miPointerGetMotionEvents,
- (PtrCtrlProcPtr)NoopDDA,
- miPointerGetMotionBufferSize());
- break;
-
- case DEVICE_ON:
- pDev->on = TRUE;
- pKdPointer = pDevice;
- for (i = 0; i < kdNMouseFuncs; i++)
- (*kdMouseFuncs[i]->Init)();
- break;
- case DEVICE_OFF:
- case DEVICE_CLOSE:
- if (pDev->on)
- {
- pDev->on = FALSE;
- pKdPointer = 0;
- for (i = 0; i < kdNMouseFuncs; i++)
- (*kdMouseFuncs[i]->Fini) ();
- }
- break;
- }
- return Success;
-}
-
-Bool
-KdLegalModifier(unsigned int key, DevicePtr pDev)
-{
- return TRUE;
-}
-
-static void
-KdBell (int volume, DeviceIntPtr pDev, pointer ctrl, int something)
-{
- if (kdInputEnabled)
- (*kdKeyboardFuncs->Bell) (volume, kdBellPitch, kdBellDuration);
-}
-
-
-static void
-KdSetLeds (void)
-{
- if (kdInputEnabled)
- (*kdKeyboardFuncs->Leds) (kdLeds);
-}
-
-static void
-KdSetLed (int led, Bool on)
-{
- NoteLedState (pKdKeyboard, led, on);
- kdLeds = pKdKeyboard->kbdfeed->ctrl.leds;
- KdSetLeds ();
-}
-
-static void
-KdSetMouseMatrix (KdMouseMatrix *matrix)
-{
- kdMouseMatrix = *matrix;
-}
-
-static void
-KdComputeMouseMatrix (KdMouseMatrix *m, Rotation randr, int width, int height)
-{
- int x_dir = 1, y_dir = 1;
- int i, j;
- int size[2];
-
- size[0] = width; size[1] = height;
- if (randr & RR_Reflect_X)
- x_dir = -1;
- if (randr & RR_Reflect_Y)
- y_dir = -1;
- switch (randr & (RR_Rotate_All)) {
- case RR_Rotate_0:
- m->matrix[0][0] = x_dir; m->matrix[0][1] = 0;
- m->matrix[1][0] = 0; m->matrix[1][1] = y_dir;
- break;
- case RR_Rotate_90:
- m->matrix[0][0] = 0; m->matrix[0][1] = -x_dir;
- m->matrix[1][0] = y_dir; m->matrix[1][1] = 0;
- break;
- case RR_Rotate_180:
- m->matrix[0][0] = -x_dir; m->matrix[0][1] = 0;
- m->matrix[1][0] = 0; m->matrix[1][1] = -y_dir;
- break;
- case RR_Rotate_270:
- m->matrix[0][0] = 0; m->matrix[0][1] = x_dir;
- m->matrix[1][0] = -y_dir; m->matrix[1][1] = 0;
- break;
- }
- for (i = 0; i < 2; i++)
- {
- m->matrix[i][2] = 0;
- for (j = 0 ; j < 2; j++)
- if (m->matrix[i][j] < 0)
- m->matrix[i][2] = size[j] - 1;
- }
-}
-
-static void
-KdKbdCtrl (DeviceIntPtr pDevice, KeybdCtrl *ctrl)
-{
- kdLeds = ctrl->leds;
- kdBellPitch = ctrl->bell_pitch;
- kdBellDuration = ctrl->bell_duration;
- KdSetLeds ();
-}
-
-static int
-KdKeybdProc(DeviceIntPtr pDevice, int onoff)
-{
- Bool ret;
- DevicePtr pDev = (DevicePtr)pDevice;
-#ifdef XKB
- XkbComponentNamesRec names;
-#endif
-
- if (!pDev)
- return BadImplementation;
-
- switch (onoff)
- {
- case DEVICE_INIT:
- if (pDev != (DevicePtr)inputInfo.keyboard)
- {
- return !Success;
- }
-#ifndef XKB
- ret = InitKeyboardDeviceStruct(pDev,
- &kdKeySyms,
- kdModMap,
- KdBell, KdKbdCtrl);
-#else
- memset(&names, 0, sizeof(XkbComponentNamesRec));
-
- XkbSetRulesDflts ("base", "pc101", "us", NULL, NULL);
- ret = XkbInitKeyboardDeviceStruct (pDev,
- &names,
- &kdKeySyms,
- kdModMap,
- KdBell, KdKbdCtrl);
-#endif
- if (!ret)
- return BadImplementation;
- break;
- case DEVICE_ON:
- pDev->on = TRUE;
- pKdKeyboard = pDevice;
- if (kdKeyboardFuncs)
- (*kdKeyboardFuncs->Init) ();
- break;
- case DEVICE_OFF:
- case DEVICE_CLOSE:
- pKdKeyboard = 0;
- if (pDev->on)
- {
- pDev->on = FALSE;
- if (kdKeyboardFuncs)
- (*kdKeyboardFuncs->Fini) ();
- }
- break;
- }
- return Success;
-}
-
-extern KeybdCtrl defaultKeyboardControl;
-
-static void
-KdInitAutoRepeats (void)
-{
- int key_code;
- unsigned char mask;
- int i;
- unsigned char *repeats;
-
- repeats = defaultKeyboardControl.autoRepeats;
- memset (repeats, '\0', 32);
- for (key_code = KD_MIN_KEYCODE; key_code <= KD_MAX_KEYCODE; key_code++)
- {
- if (!kdModMap[key_code])
- {
- i = key_code >> 3;
- mask = 1 << (key_code & 7);
- repeats[i] |= mask;
- }
- }
-}
-
-const KdKeySymModsRec kdKeySymMods[] = {
- { XK_Control_L, ControlMask },
- { XK_Control_R, ControlMask },
- { XK_Shift_L, ShiftMask },
- { XK_Shift_R, ShiftMask },
- { XK_Caps_Lock, LockMask },
- { XK_Shift_Lock, LockMask },
- { XK_Alt_L, Mod1Mask },
- { XK_Alt_R, Mod1Mask },
- { XK_Meta_L, Mod1Mask },
- { XK_Meta_R, Mod1Mask },
- { XK_Num_Lock, Mod2Mask },
- { XK_Super_L, Mod3Mask },
- { XK_Super_R, Mod3Mask },
- { XK_Hyper_L, Mod3Mask },
- { XK_Hyper_R, Mod3Mask },
- { XK_Mode_switch, Mod4Mask },
-#ifdef TOUCHSCREEN
- /* PDA specific hacks */
-#ifdef XF86XK_Start
- { XF86XK_Start, ControlMask },
-#endif
- { XK_Menu, ShiftMask },
- { XK_telephone, Mod1Mask },
-#ifdef XF86XK_AudioRecord
- { XF86XK_AudioRecord, Mod2Mask },
-#endif
-#ifdef XF86XK_Calendar
- { XF86XK_Calendar, Mod3Mask }
-#endif
-#endif
-};
-
-#define NUM_SYM_MODS (sizeof(kdKeySymMods) / sizeof(kdKeySymMods[0]))
-
-static void
-KdInitModMap (void)
-{
- int key_code;
- int row;
- int width;
- KeySym *syms;
- int i;
-
- width = kdKeySyms.mapWidth;
- for (key_code = kdMinKeyCode; key_code <= kdMaxKeyCode; key_code++)
- {
- kdModMap[key_code] = 0;
- syms = kdKeymap + (key_code - kdMinKeyCode) * width;
- for (row = 0; row < width; row++, syms++)
- {
- for (i = 0; i < NUM_SYM_MODS; i++)
- {
- if (*syms == kdKeySymMods[i].modsym)
- kdModMap[key_code] |= kdKeySymMods[i].modbit;
- }
- }
- }
-}
-
-static void
-KdAddMouseDriver(KdMouseFuncs *pMouseFuncs)
-{
- if (kdNMouseFuncs < MAX_MOUSE_DRIVERS)
- kdMouseFuncs[kdNMouseFuncs++] = pMouseFuncs;
-}
-
-void
-eglInitInput(KdMouseFuncs *pMouseFuncs,
- KdKeyboardFuncs *pKeyboardFuncs)
-{
- DeviceIntPtr pKeyboard, pPointer;
- KdMouseInfo *mi;
-
- if (!kdMouseInfo)
- KdParseMouse (0);
- kdMouseButtonCount = 0;
- for (mi = kdMouseInfo; mi; mi = mi->next)
- {
- if (mi->nbutton > kdMouseButtonCount)
- kdMouseButtonCount = mi->nbutton;
- }
-
- kdNMouseFuncs = 0;
- KdAddMouseDriver (pMouseFuncs);
- kdKeyboardFuncs = pKeyboardFuncs;
- memset (kdKeyState, '\0', sizeof (kdKeyState));
- if (kdKeyboardFuncs)
- (*kdKeyboardFuncs->Load) ();
- kdMinKeyCode = kdMinScanCode + KD_KEY_OFFSET;
- kdMaxKeyCode = kdMaxScanCode + KD_KEY_OFFSET;
- kdKeySyms.map = kdKeymap;
- kdKeySyms.minKeyCode = kdMinKeyCode;
- kdKeySyms.maxKeyCode = kdMaxKeyCode;
- kdKeySyms.mapWidth = kdKeymapWidth;
- kdLeds = 0;
- kdBellPitch = 1000;
- kdBellDuration = 200;
- kdInputEnabled = TRUE;
- KdInitModMap ();
- KdInitAutoRepeats ();
- KdResetInputMachine ();
- pPointer = AddInputDevice(KdMouseProc, TRUE);
- pKeyboard = AddInputDevice(KdKeybdProc, TRUE);
- RegisterPointerDevice(pPointer);
- RegisterKeyboardDevice(pKeyboard);
- miRegisterPointerDevice(screenInfo.screens[0], pPointer);
- mieqInit(&pKeyboard->public, &pPointer->public);
- {
- static long zero1, zero2;
-
- //SetExtInputCheck (&zero1, &zero2);
- ErrorF("Extended Input Devices not yet supported. Impelement it at line %d in %s\n",
- __LINE__, __FILE__);
- }
-}
-
-/*
- * Middle button emulation state machine
- *
- * Possible transitions:
- * Button 1 press v1
- * Button 1 release ^1
- * Button 2 press v2
- * Button 2 release ^2
- * Button 3 press v3
- * Button 3 release ^3
- * Button other press vo
- * Button other release ^o
- * Mouse motion <>
- * Keyboard event k
- * timeout ...
- * outside box <->
- *
- * States:
- * start
- * button_1_pend
- * button_1_down
- * button_2_down
- * button_3_pend
- * button_3_down
- * synthetic_2_down_13
- * synthetic_2_down_3
- * synthetic_2_down_1
- *
- * Transition diagram
- *
- * start
- * v1 -> (hold) (settimeout) button_1_pend
- * ^1 -> (deliver) start
- * v2 -> (deliver) button_2_down
- * ^2 -> (deliever) start
- * v3 -> (hold) (settimeout) button_3_pend
- * ^3 -> (deliver) start
- * vo -> (deliver) start
- * ^o -> (deliver) start
- * <> -> (deliver) start
- * k -> (deliver) start
- *
- * button_1_pend (button 1 is down, timeout pending)
- * ^1 -> (release) (deliver) start
- * v2 -> (release) (deliver) button_1_down
- * ^2 -> (release) (deliver) button_1_down
- * v3 -> (cleartimeout) (generate v2) synthetic_2_down_13
- * ^3 -> (release) (deliver) button_1_down
- * vo -> (release) (deliver) button_1_down
- * ^o -> (release) (deliver) button_1_down
- * <-> -> (release) (deliver) button_1_down
- * <> -> (deliver) button_1_pend
- * k -> (release) (deliver) button_1_down
- * ... -> (release) button_1_down
- *
- * button_1_down (button 1 is down)
- * ^1 -> (deliver) start
- * v2 -> (deliver) button_1_down
- * ^2 -> (deliver) button_1_down
- * v3 -> (deliver) button_1_down
- * ^3 -> (deliver) button_1_down
- * vo -> (deliver) button_1_down
- * ^o -> (deliver) button_1_down
- * <> -> (deliver) button_1_down
- * k -> (deliver) button_1_down
- *
- * button_2_down (button 2 is down)
- * v1 -> (deliver) button_2_down
- * ^1 -> (deliver) button_2_down
- * ^2 -> (deliver) start
- * v3 -> (deliver) button_2_down
- * ^3 -> (deliver) button_2_down
- * vo -> (deliver) button_2_down
- * ^o -> (deliver) button_2_down
- * <> -> (deliver) button_2_down
- * k -> (deliver) button_2_down
- *
- * button_3_pend (button 3 is down, timeout pending)
- * v1 -> (generate v2) synthetic_2_down
- * ^1 -> (release) (deliver) button_3_down
- * v2 -> (release) (deliver) button_3_down
- * ^2 -> (release) (deliver) button_3_down
- * ^3 -> (release) (deliver) start
- * vo -> (release) (deliver) button_3_down
- * ^o -> (release) (deliver) button_3_down
- * <-> -> (release) (deliver) button_3_down
- * <> -> (deliver) button_3_pend
- * k -> (release) (deliver) button_3_down
- * ... -> (release) button_3_down
- *
- * button_3_down (button 3 is down)
- * v1 -> (deliver) button_3_down
- * ^1 -> (deliver) button_3_down
- * v2 -> (deliver) button_3_down
- * ^2 -> (deliver) button_3_down
- * ^3 -> (deliver) start
- * vo -> (deliver) button_3_down
- * ^o -> (deliver) button_3_down
- * <> -> (deliver) button_3_down
- * k -> (deliver) button_3_down
- *
- * synthetic_2_down_13 (button 1 and 3 are down)
- * ^1 -> (generate ^2) synthetic_2_down_3
- * v2 -> synthetic_2_down_13
- * ^2 -> synthetic_2_down_13
- * ^3 -> (generate ^2) synthetic_2_down_1
- * vo -> (deliver) synthetic_2_down_13
- * ^o -> (deliver) synthetic_2_down_13
- * <> -> (deliver) synthetic_2_down_13
- * k -> (deliver) synthetic_2_down_13
- *
- * synthetic_2_down_3 (button 3 is down)
- * v1 -> (deliver) synthetic_2_down_3
- * ^1 -> (deliver) synthetic_2_down_3
- * v2 -> synthetic_2_down_3
- * ^2 -> synthetic_2_down_3
- * ^3 -> start
- * vo -> (deliver) synthetic_2_down_3
- * ^o -> (deliver) synthetic_2_down_3
- * <> -> (deliver) synthetic_2_down_3
- * k -> (deliver) synthetic_2_down_3
- *
- * synthetic_2_down_1 (button 1 is down)
- * ^1 -> start
- * v2 -> synthetic_2_down_1
- * ^2 -> synthetic_2_down_1
- * v3 -> (deliver) synthetic_2_down_1
- * ^3 -> (deliver) synthetic_2_down_1
- * vo -> (deliver) synthetic_2_down_1
- * ^o -> (deliver) synthetic_2_down_1
- * <> -> (deliver) synthetic_2_down_1
- * k -> (deliver) synthetic_2_down_1
- */
-
-typedef enum _inputClass {
- down_1, up_1,
- down_2, up_2,
- down_3, up_3,
- down_o, up_o,
- motion, outside_box,
- keyboard, timeout,
- num_input_class
-} KdInputClass;
-
-typedef enum _inputAction {
- noop,
- hold,
- setto,
- deliver,
- release,
- clearto,
- gen_down_2,
- gen_up_2
-} KdInputAction;
-
-#define MAX_ACTIONS 2
-
-typedef struct _inputTransition {
- KdInputAction actions[MAX_ACTIONS];
- KdMouseState nextState;
-} KdInputTransition;
-
-KdInputTransition kdInputMachine[num_input_states][num_input_class] = {
- /* start */
- {
- { { hold, setto }, button_1_pend }, /* v1 */
- { { deliver, noop }, start }, /* ^1 */
- { { deliver, noop }, button_2_down }, /* v2 */
- { { deliver, noop }, start }, /* ^2 */
- { { hold, setto }, button_3_pend }, /* v3 */
- { { deliver, noop }, start }, /* ^3 */
- { { deliver, noop }, start }, /* vo */
- { { deliver, noop }, start }, /* ^o */
- { { deliver, noop }, start }, /* <> */
- { { deliver, noop }, start }, /* <-> */
- { { noop, noop }, start }, /* k */
- { { noop, noop }, start }, /* ... */
- },
- /* button_1_pend */
- {
- { { noop, noop }, button_1_pend }, /* v1 */
- { { release, deliver }, start }, /* ^1 */
- { { release, deliver }, button_1_down }, /* v2 */
- { { release, deliver }, button_1_down }, /* ^2 */
- { { clearto, gen_down_2 }, synth_2_down_13 }, /* v3 */
- { { release, deliver }, button_1_down }, /* ^3 */
- { { release, deliver }, button_1_down }, /* vo */
- { { release, deliver }, button_1_down }, /* ^o */
- { { deliver, noop }, button_1_pend }, /* <> */
- { { release, deliver }, button_1_down }, /* <-> */
- { { noop, noop }, button_1_down }, /* k */
- { { release, noop }, button_1_down }, /* ... */
- },
- /* button_1_down */
- {
- { { noop, noop }, button_1_down }, /* v1 */
- { { deliver, noop }, start }, /* ^1 */
- { { deliver, noop }, button_1_down }, /* v2 */
- { { deliver, noop }, button_1_down }, /* ^2 */
- { { deliver, noop }, button_1_down }, /* v3 */
- { { deliver, noop }, button_1_down }, /* ^3 */
- { { deliver, noop }, button_1_down }, /* vo */
- { { deliver, noop }, button_1_down }, /* ^o */
- { { deliver, noop }, button_1_down }, /* <> */
- { { deliver, noop }, button_1_down }, /* <-> */
- { { noop, noop }, button_1_down }, /* k */
- { { noop, noop }, button_1_down }, /* ... */
- },
- /* button_2_down */
- {
- { { deliver, noop }, button_2_down }, /* v1 */
- { { deliver, noop }, button_2_down }, /* ^1 */
- { { noop, noop }, button_2_down }, /* v2 */
- { { deliver, noop }, start }, /* ^2 */
- { { deliver, noop }, button_2_down }, /* v3 */
- { { deliver, noop }, button_2_down }, /* ^3 */
- { { deliver, noop }, button_2_down }, /* vo */
- { { deliver, noop }, button_2_down }, /* ^o */
- { { deliver, noop }, button_2_down }, /* <> */
- { { deliver, noop }, button_2_down }, /* <-> */
- { { noop, noop }, button_2_down }, /* k */
- { { noop, noop }, button_2_down }, /* ... */
- },
- /* button_3_pend */
- {
- { { clearto, gen_down_2 }, synth_2_down_13 }, /* v1 */
- { { release, deliver }, button_3_down }, /* ^1 */
- { { release, deliver }, button_3_down }, /* v2 */
- { { release, deliver }, button_3_down }, /* ^2 */
- { { release, deliver }, button_3_down }, /* v3 */
- { { release, deliver }, start }, /* ^3 */
- { { release, deliver }, button_3_down }, /* vo */
- { { release, deliver }, button_3_down }, /* ^o */
- { { deliver, noop }, button_3_pend }, /* <> */
- { { release, deliver }, button_3_down }, /* <-> */
- { { release, noop }, button_3_down }, /* k */
- { { release, noop }, button_3_down }, /* ... */
- },
- /* button_3_down */
- {
- { { deliver, noop }, button_3_down }, /* v1 */
- { { deliver, noop }, button_3_down }, /* ^1 */
- { { deliver, noop }, button_3_down }, /* v2 */
- { { deliver, noop }, button_3_down }, /* ^2 */
- { { noop, noop }, button_3_down }, /* v3 */
- { { deliver, noop }, start }, /* ^3 */
- { { deliver, noop }, button_3_down }, /* vo */
- { { deliver, noop }, button_3_down }, /* ^o */
- { { deliver, noop }, button_3_down }, /* <> */
- { { deliver, noop }, button_3_down }, /* <-> */
- { { noop, noop }, button_3_down }, /* k */
- { { noop, noop }, button_3_down }, /* ... */
- },
- /* synthetic_2_down_13 */
- {
- { { noop, noop }, synth_2_down_13 }, /* v1 */
- { { gen_up_2, noop }, synth_2_down_3 }, /* ^1 */
- { { noop, noop }, synth_2_down_13 }, /* v2 */
- { { noop, noop }, synth_2_down_13 }, /* ^2 */
- { { noop, noop }, synth_2_down_13 }, /* v3 */
- { { gen_up_2, noop }, synth_2_down_1 }, /* ^3 */
- { { deliver, noop }, synth_2_down_13 }, /* vo */
- { { deliver, noop }, synth_2_down_13 }, /* ^o */
- { { deliver, noop }, synth_2_down_13 }, /* <> */
- { { deliver, noop }, synth_2_down_13 }, /* <-> */
- { { noop, noop }, synth_2_down_13 }, /* k */
- { { noop, noop }, synth_2_down_13 }, /* ... */
- },
- /* synthetic_2_down_3 */
- {
- { { deliver, noop }, synth_2_down_3 }, /* v1 */
- { { deliver, noop }, synth_2_down_3 }, /* ^1 */
- { { deliver, noop }, synth_2_down_3 }, /* v2 */
- { { deliver, noop }, synth_2_down_3 }, /* ^2 */
- { { noop, noop }, synth_2_down_3 }, /* v3 */
- { { noop, noop }, start }, /* ^3 */
- { { deliver, noop }, synth_2_down_3 }, /* vo */
- { { deliver, noop }, synth_2_down_3 }, /* ^o */
- { { deliver, noop }, synth_2_down_3 }, /* <> */
- { { deliver, noop }, synth_2_down_3 }, /* <-> */
- { { noop, noop }, synth_2_down_3 }, /* k */
- { { noop, noop }, synth_2_down_3 }, /* ... */
- },
- /* synthetic_2_down_1 */
- {
- { { noop, noop }, synth_2_down_1 }, /* v1 */
- { { noop, noop }, start }, /* ^1 */
- { { deliver, noop }, synth_2_down_1 }, /* v2 */
- { { deliver, noop }, synth_2_down_1 }, /* ^2 */
- { { deliver, noop }, synth_2_down_1 }, /* v3 */
- { { deliver, noop }, synth_2_down_1 }, /* ^3 */
- { { deliver, noop }, synth_2_down_1 }, /* vo */
- { { deliver, noop }, synth_2_down_1 }, /* ^o */
- { { deliver, noop }, synth_2_down_1 }, /* <> */
- { { deliver, noop }, synth_2_down_1 }, /* <-> */
- { { noop, noop }, synth_2_down_1 }, /* k */
- { { noop, noop }, synth_2_down_1 }, /* ... */
- },
-};
-
-#define EMULATION_WINDOW 10
-#define EMULATION_TIMEOUT 100
-
-#define EventX(e) ((e)->u.keyButtonPointer.rootX)
-#define EventY(e) ((e)->u.keyButtonPointer.rootY)
-
-static int
-KdInsideEmulationWindow (KdMouseInfo *mi, xEvent *ev)
-{
- if (ev->u.keyButtonPointer.pad1)
- {
- mi->emulationDx += EventX(ev);
- mi->emulationDy += EventY(ev);
- }
- else
- {
- mi->emulationDx = EventX(&mi->heldEvent) - EventX(ev);
- mi->emulationDy = EventY(&mi->heldEvent) - EventY(ev);
- }
- return (abs (mi->emulationDx) < EMULATION_WINDOW &&
- abs (mi->emulationDy) < EMULATION_WINDOW);
-}
-
-static KdInputClass
-KdClassifyInput (KdMouseInfo *mi, xEvent *ev)
-{
- switch (ev->u.u.type) {
- case ButtonPress:
- switch (ev->u.u.detail) {
- case 1: return down_1;
- case 2: return down_2;
- case 3: return down_3;
- default: return down_o;
- }
- break;
- case ButtonRelease:
- switch (ev->u.u.detail) {
- case 1: return up_1;
- case 2: return up_2;
- case 3: return up_3;
- default: return up_o;
- }
- break;
- case MotionNotify:
- if (mi->eventHeld && !KdInsideEmulationWindow(mi, ev))
- return outside_box;
- else
- return motion;
- default:
- return keyboard;
- }
- return keyboard;
-}
-
-#ifdef DEBUG
-char *kdStateNames[] = {
- "start",
- "button_1_pend",
- "button_1_down",
- "button_2_down",
- "button_3_pend",
- "button_3_down",
- "synth_2_down_13",
- "synth_2_down_3",
- "synthetic_2_down_1",
- "num_input_states"
-};
-
-char *kdClassNames[] = {
- "down_1", "up_1",
- "down_2", "up_2",
- "down_3", "up_3",
- "motion", "ouside_box",
- "keyboard", "timeout",
- "num_input_class"
-};
-
-char *kdActionNames[] = {
- "noop",
- "hold",
- "setto",
- "deliver",
- "release",
- "clearto",
- "gen_down_2",
- "gen_up_2",
-};
-#endif /* DEBUG */
-
-static void
-KdQueueEvent (xEvent *ev)
-{
- KdAssertSigioBlocked ("KdQueueEvent");
- if (ev->u.u.type == MotionNotify)
- {
- if (ev->u.keyButtonPointer.pad1)
- {
- ev->u.keyButtonPointer.pad1 = 0;
- miPointerDeltaCursor (ev->u.keyButtonPointer.rootX,
- ev->u.keyButtonPointer.rootY,
- ev->u.keyButtonPointer.time);
- }
- else
- {
- miPointerAbsoluteCursor(ev->u.keyButtonPointer.rootX,
- ev->u.keyButtonPointer.rootY,
- ev->u.keyButtonPointer.time);
- }
- }
- else
- {
- mieqEnqueue (ev);
- }
-}
-
-static void
-KdRunMouseMachine (KdMouseInfo *mi, KdInputClass c, xEvent *ev)
-{
- KdInputTransition *t;
- int a;
-
- t = &kdInputMachine[mi->mouseState][c];
- for (a = 0; a < MAX_ACTIONS; a++)
- {
- switch (t->actions[a]) {
- case noop:
- break;
- case hold:
- mi->eventHeld = TRUE;
- mi->emulationDx = 0;
- mi->emulationDy = 0;
- mi->heldEvent = *ev;
- break;
- case setto:
- mi->emulationTimeout = GetTimeInMillis () + EMULATION_TIMEOUT;
- mi->timeoutPending = TRUE;
- break;
- case deliver:
- KdQueueEvent (ev);
- break;
- case release:
- mi->eventHeld = FALSE;
- mi->timeoutPending = FALSE;
- KdQueueEvent (&mi->heldEvent);
- break;
- case clearto:
- mi->timeoutPending = FALSE;
- break;
- case gen_down_2:
- ev->u.u.detail = 2;
- mi->eventHeld = FALSE;
- KdQueueEvent (ev);
- break;
- case gen_up_2:
- ev->u.u.detail = 2;
- KdQueueEvent (ev);
- break;
- }
- }
- mi->mouseState = t->nextState;
-}
-
-void
-KdResetInputMachine (void)
-{
- KdMouseInfo *mi;
-
- for (mi = kdMouseInfo; mi; mi = mi->next)
- {
- mi->mouseState = start;
- mi->eventHeld = FALSE;
- }
-}
-
-static void
-KdHandleMouseEvent (KdMouseInfo *mi, xEvent *ev)
-{
- if (mi->emulateMiddleButton)
- KdRunMouseMachine (mi, KdClassifyInput (mi, ev), ev);
- else
- KdQueueEvent (ev);
-}
-
-static void
-KdReceiveTimeout (KdMouseInfo *mi)
-{
- KdRunMouseMachine (mi, timeout, 0);
-}
-
-#define KILL_SEQUENCE ((1L << KK_CONTROL)|(1L << KK_ALT)|(1L << KK_F8)|(1L << KK_F10))
-#define SPECIAL_SEQUENCE ((1L << KK_CONTROL) | (1L << KK_ALT))
-#define SETKILLKEY(b) (KdSpecialKeys |= (1L << (b)))
-#define CLEARKILLKEY(b) (KdSpecialKeys &= ~(1L << (b)))
-#define KEYMAP (pKdKeyboard->key->curKeySyms)
-#define KEYCOL1(k) (KEYMAP.map[((k)-kdMinKeyCode)*KEYMAP.mapWidth])
-
-CARD32 KdSpecialKeys = 0;
-
-extern char dispatchException;
-
-/*
- * kdCheckTermination
- *
- * This function checks for the key sequence that terminates the server. When
- * detected, it sets the dispatchException flag and returns. The key sequence
- * is:
- * Control-Alt
- * It's assumed that the server will be waken up by the caller when this
- * function returns.
- */
-
-extern int nClients;
-
-static void
-KdCheckSpecialKeys(xEvent *xE)
-{
- KeySym sym = KEYCOL1(xE->u.u.detail);
-
- if (!pKdKeyboard) return;
-
- /*
- * Ignore key releases
- */
-
- if (xE->u.u.type == KeyRelease) return;
-
-#ifdef XIPAQ
- /*
- * Check for buttons 1, 2 and 3 on the iPAQ
- */
- if (sym == XK_Pointer_Button1 && kdMouseInfo) {
- KdEnqueueMouseEvent(kdMouseInfo, KD_MOUSE_DELTA | KD_BUTTON_1, 0, 0);
- return;
- }
- if (sym == XK_Pointer_Button2 && kdMouseInfo) {
- KdEnqueueMouseEvent(kdMouseInfo, KD_MOUSE_DELTA | KD_BUTTON_2, 0, 0);
- return;
- }
- if (sym == XK_Pointer_Button3 && kdMouseInfo) {
- KdEnqueueMouseEvent(kdMouseInfo, KD_MOUSE_DELTA | KD_BUTTON_3, 0, 0);
- return;
- }
-#endif
-
- /*
- * Check for control/alt pressed
- */
- if ((pKdKeyboard->key->state & (ControlMask|Mod1Mask)) !=
- (ControlMask|Mod1Mask))
- return;
-
-
- /*
- * Let OS function see keysym first
- */
-
- if (kdOsFuncs->SpecialKey)
- if ((*kdOsFuncs->SpecialKey) (sym))
- return;
-
- /*
- * Now check for backspace or delete; these signal the
- * X server to terminate
- */
- switch (sym) {
- case XK_BackSpace:
- case XK_Delete:
- case XK_KP_Delete:
- /*
- * Set the dispatch exception flag so the server will terminate the
- * next time through the dispatch loop.
- */
- if (kdDontZap == FALSE)
- dispatchException |= DE_TERMINATE;
- break;
- }
-}
-
-/*
- * kdEnqueueKeyboardEvent
- *
- * This function converts hardware keyboard event information into an X event
- * and enqueues it using MI. It wakes up the server before returning so that
- * the event will be processed normally.
- *
- */
-
-static void
-KdHandleKeyboardEvent (xEvent *ev)
-{
- int key = ev->u.u.detail;
- int byte;
- CARD8 bit;
- KdMouseInfo *mi;
-
- byte = key >> 3;
- bit = 1 << (key & 7);
- switch (ev->u.u.type) {
- case KeyPress:
- kdKeyState[byte] |= bit;
- break;
- case KeyRelease:
- kdKeyState[byte] &= ~bit;
- break;
- }
- for (mi = kdMouseInfo; mi; mi = mi->next)
- KdRunMouseMachine (mi, keyboard, 0);
- KdQueueEvent (ev);
-}
-
-static void
-KdReleaseAllKeys (void)
-{
- xEvent xE;
- int key;
-
- KdBlockSigio ();
- for (key = 0; key < KD_KEY_COUNT; key++)
- if (IsKeyDown(key))
- {
- xE.u.keyButtonPointer.time = GetTimeInMillis();
- xE.u.u.type = KeyRelease;
- xE.u.u.detail = key;
- KdHandleKeyboardEvent (&xE);
- }
- KdUnblockSigio ();
-}
-
-static void
-KdCheckLock (void)
-{
- KeyClassPtr keyc = pKdKeyboard->key;
- Bool isSet, shouldBeSet;
-
- if (kdKeyboardFuncs->LockLed)
- {
- isSet = (kdLeds & (1 << (kdKeyboardFuncs->LockLed-1))) != 0;
- shouldBeSet = (keyc->state & LockMask) != 0;
- if (isSet != shouldBeSet)
- {
- KdSetLed (kdKeyboardFuncs->LockLed, shouldBeSet);
- }
- }
-}
-
-void
-KdEnqueueKeyboardEvent(unsigned char scan_code,
- unsigned char is_up)
-{
- unsigned char key_code;
- xEvent xE;
- KeyClassPtr keyc;
-
- if (!pKdKeyboard)
- return;
- keyc = pKdKeyboard->key;
-
- xE.u.keyButtonPointer.time = GetTimeInMillis();
-
- if (kdMinScanCode <= scan_code && scan_code <= kdMaxScanCode)
- {
- key_code = scan_code + KD_MIN_KEYCODE - kdMinScanCode;
-
- /*
- * Set up this event -- the type may be modified below
- */
- if (is_up)
- xE.u.u.type = KeyRelease;
- else
- xE.u.u.type = KeyPress;
- xE.u.u.detail = key_code;
-
- switch (KEYCOL1(key_code))
- {
- case XK_Num_Lock:
- case XK_Scroll_Lock:
- case XK_Shift_Lock:
- case XK_Caps_Lock:
- if (xE.u.u.type == KeyRelease)
- return;
- if (IsKeyDown (key_code))
- xE.u.u.type = KeyRelease;
- else
- xE.u.u.type = KeyPress;
- }
-
- /*
- * Check pressed keys which are already down
- */
- if (IsKeyDown (key_code) && xE.u.u.type == KeyPress)
- {
- KeybdCtrl *ctrl = &pKdKeyboard->kbdfeed->ctrl;
-
- /*
- * Check auto repeat
- */
- if (!ctrl->autoRepeat || keyc->modifierMap[key_code] ||
- !(ctrl->autoRepeats[key_code >> 3] & (1 << (key_code & 7))))
- {
- return;
- }
- /*
- * X delivers press/release even for autorepeat
- */
- xE.u.u.type = KeyRelease;
- KdHandleKeyboardEvent (&xE);
- xE.u.u.type = KeyPress;
- }
- /*
- * Check released keys which are already up
- */
- else if (!IsKeyDown (key_code) && xE.u.u.type == KeyRelease)
- {
- return;
- }
- KdCheckSpecialKeys (&xE);
- KdHandleKeyboardEvent (&xE);
- }
-}
-
-#define SetButton(mi, b, v, s) \
-{\
- xE.u.u.detail = mi->map[b]; \
- xE.u.u.type = v; \
- KdHandleMouseEvent (mi, &xE); \
-}
-
-#define Press(mi, b) SetButton(mi, b, ButtonPress, "Down")
-#define Release(mi, b) SetButton(mi, b, ButtonRelease, "Up")
-
-/*
- * kdEnqueueMouseEvent
- *
- * This function converts hardware mouse event information into X event
- * information. A mouse movement event is passed off to MI to generate
- * a MotionNotify event, if appropriate. Button events are created and
- * passed off to MI for enqueueing.
- */
-
-static void
-KdMouseAccelerate (DeviceIntPtr device, int *dx, int *dy)
-{
- PtrCtrl *pCtrl = &device->ptrfeed->ctrl;
- double speed = sqrt (*dx * *dx + *dy * *dy);
- double accel;
- double m;
-
- /*
- * Ok, so we want it moving num/den times faster at threshold*2
- *
- * accel = m *threshold + b
- * 1 = m * 0 + b -> b = 1
- *
- * num/den = m * (threshold * 2) + 1
- *
- * num / den - 1 = m * threshold * 2
- * (num / den - 1) / threshold * 2 = m
- */
- m = (((double) pCtrl->num / (double) pCtrl->den - 1.0) /
- ((double) pCtrl->threshold * 2.0));
- accel = m * speed + 1;
- *dx = accel * *dx;
- *dy = accel * *dy;
-}
-
-void
-KdEnqueueMouseEvent(KdMouseInfo *mi, unsigned long flags, int rx, int ry)
-{
- CARD32 ms;
- xEvent xE;
- unsigned char buttons;
- int x, y;
- int (*matrix)[3] = kdMouseMatrix.matrix;
- unsigned long button;
- int n;
-
- if (!pKdPointer)
- return;
-
- ms = GetTimeInMillis();
-
- if (flags & KD_MOUSE_DELTA)
- {
- if (mi->transformCoordinates)
- {
- x = matrix[0][0] * rx + matrix[0][1] * ry;
- y = matrix[1][0] * rx + matrix[1][1] * ry;
- }
- else
- {
- x = rx;
- y = ry;
- }
- KdMouseAccelerate (pKdPointer, &x, &y);
- xE.u.keyButtonPointer.pad1 = 1;
- }
- else
- {
- if (mi->transformCoordinates)
- {
- x = matrix[0][0] * rx + matrix[0][1] * ry + matrix[0][2];
- y = matrix[1][0] * rx + matrix[1][1] * ry + matrix[1][2];
- }
- else
- {
- x = rx;
- y = ry;
- }
- xE.u.keyButtonPointer.pad1 = 0;
- }
- xE.u.keyButtonPointer.time = ms;
- xE.u.keyButtonPointer.rootX = x;
- xE.u.keyButtonPointer.rootY = y;
-
- xE.u.u.type = MotionNotify;
- xE.u.u.detail = 0;
- KdHandleMouseEvent (mi, &xE);
-
- buttons = flags;
-
- for (button = KD_BUTTON_1, n = 0; button <= KD_BUTTON_5; button <<= 1, n++)
- {
- if ((mi->buttonState & button) ^ (buttons & button))
- {
- if (buttons & button)
- {
- Press(mi, n);
- }
- else
- {
- Release(mi, n);
- }
- }
- }
- mi->buttonState = buttons;
-}
-
-static void
-KdEnqueueMotionEvent (KdMouseInfo *mi, int x, int y)
-{
- xEvent xE;
- CARD32 ms;
-
- ms = GetTimeInMillis();
-
- xE.u.u.type = MotionNotify;
- xE.u.keyButtonPointer.time = ms;
- xE.u.keyButtonPointer.rootX = x;
- xE.u.keyButtonPointer.rootY = y;
-
- KdHandleMouseEvent (mi, &xE);
-}
-
-static void
-KdBlockHandler (int screen,
- pointer blockData,
- pointer timeout,
- pointer readmask)
-{
- KdMouseInfo *mi;
- int myTimeout=0;
-
- for (mi = kdMouseInfo; mi; mi = mi->next)
- {
- if (mi->timeoutPending)
- {
- int ms;
-
- ms = mi->emulationTimeout - GetTimeInMillis ();
- if (ms < 1)
- ms = 1;
- if(ms<myTimeout || myTimeout==0)
- myTimeout=ms;
- }
- }
- /* if we need to poll for events, do that */
- if(kdOsFuncs->pollEvents)
- {
- (*kdOsFuncs->pollEvents)();
- myTimeout=20;
- }
- if(myTimeout>0)
- AdjustWaitForDelay (timeout, myTimeout);
-}
-
-void
-KdWakeupHandler (pointer data,
- int result,
- pointer readmask)
-{
- fd_set *pReadmask = (fd_set *) readmask;
- int i;
- KdMouseInfo *mi;
-
- if (kdInputEnabled && result > 0)
- {
- for (i = 0; i < kdNumInputFds; i++)
- if (FD_ISSET (kdInputFds[i].fd, pReadmask))
- {
- KdBlockSigio ();
- (*kdInputFds[i].read) (kdInputFds[i].fd, kdInputFds[i].closure);
- KdUnblockSigio ();
- }
- }
- for (mi = kdMouseInfo; mi; mi = mi->next)
- {
- if (mi->timeoutPending)
- {
- if ((long) (GetTimeInMillis () - mi->emulationTimeout) >= 0)
- {
- mi->timeoutPending = FALSE;
- KdBlockSigio ();
- KdReceiveTimeout (mi);
- KdUnblockSigio ();
- }
- }
- }
-// if (kdSwitchPending)
-// kdProcessSwitch ();
-}
-
-#define KdScreenOrigin(pScreen) (&(KdGetScreenPriv (pScreen)->origin))
-
-static Bool
-KdCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
-{
- ScreenPtr pScreen = *ppScreen;
- ScreenPtr pNewScreen;
- int n;
- int dx, dy;
- int best_x, best_y;
- int n_best_x, n_best_y;
- CARD32 ms;
-
- if (kdDisableZaphod || screenInfo.numScreens <= 1)
- return FALSE;
-
- if (0 <= *x && *x < pScreen->width && 0 <= *y && *y < pScreen->height)
- return FALSE;
-
- ms = GetTimeInMillis ();
- if (kdOffScreen && (int) (ms - kdOffScreenTime) < 1000)
- return FALSE;
- kdOffScreen = TRUE;
- kdOffScreenTime = ms;
- n_best_x = -1;
- best_x = 32767;
- n_best_y = -1;
- best_y = 32767;
- for (n = 0; n < screenInfo.numScreens; n++)
- {
- pNewScreen = screenInfo.screens[n];
- if (pNewScreen == pScreen)
- continue;
- dx = KdScreenOrigin(pNewScreen)->x - KdScreenOrigin(pScreen)->x;
- dy = KdScreenOrigin(pNewScreen)->y - KdScreenOrigin(pScreen)->y;
- if (*x < 0)
- {
- if (dx <= 0 && -dx < best_x)
- {
- best_x = -dx;
- n_best_x = n;
- }
- }
- else if (*x >= pScreen->width)
- {
- if (dx >= 0 && dx < best_x)
- {
- best_x = dx;
- n_best_x = n;
- }
- }
- if (*y < 0)
- {
- if (dy <= 0 && -dy < best_y)
- {
- best_y = -dy;
- n_best_y = n;
- }
- }
- else if (*y >= pScreen->height)
- {
- if (dy >= 0 && dy < best_y)
- {
- best_y = dy;
- n_best_y = n;
- }
- }
- }
- if (best_y < best_x)
- n_best_x = n_best_y;
- if (n_best_x == -1)
- return FALSE;
- pNewScreen = screenInfo.screens[n_best_x];
-
- if (*x < 0)
- *x += pNewScreen->width;
- if (*y < 0)
- *y += pNewScreen->height;
-
- if (*x >= pScreen->width)
- *x -= pScreen->width;
- if (*y >= pScreen->height)
- *y -= pScreen->height;
-
- *ppScreen = pNewScreen;
- return TRUE;
-}
-
-static void
-KdCrossScreen(ScreenPtr pScreen, Bool entering)
-{
-#ifndef XIPAQ
-// if (entering)
-// KdEnableScreen (pScreen);
-// else
-// KdDisableScreen (pScreen);
-#endif
-}
-
-int KdCurScreen; /* current event screen */
-
-static void
-KdWarpCursor (ScreenPtr pScreen, int x, int y)
-{
- KdBlockSigio ();
- KdCurScreen = pScreen->myNum;
- miPointerWarpCursor (pScreen, x, y);
- KdUnblockSigio ();
-}
-
-miPointerScreenFuncRec kdPointerScreenFuncs =
-{
- KdCursorOffScreen,
- KdCrossScreen,
- KdWarpCursor
-};
-
-void
-KdProcessInputEvents (void)
-{
- mieqProcessInputEvents();
- miPointerUpdate();
-// if (kdSwitchPending)
-// KdProcessSwitch ();
- KdCheckLock ();
-}
diff --git a/hw/xgl/egl/kkeymap.h b/hw/xgl/egl/kkeymap.h
deleted file mode 100644
index 920e807..0000000
--- a/hw/xgl/egl/kkeymap.h
+++ b/dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 1999 Keith Packard
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD 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.
- */
-/*
- * All global variables and functions pertaining to keyboard key mapping
- * live in this header file.
- */
-
-#ifndef _KKEYMAP_H
-#define _KKEYMAP_H
-
-/* Offset of MIN_SCANCODE to 8 (X minimum scancode value) */
-#define KD_KEY_OFFSET (8 - kdMinScanCode)
-
-#define KD_MIN_KEYCODE 8
-#define KD_MAX_KEYCODE 254
-#define KD_MAX_WIDTH 4
-#define KD_MAX_LENGTH (KD_MAX_KEYCODE - KD_MIN_KEYCODE + 1)
-
-extern int kdMinScanCode;
-extern int kdMaxScanCode;
-extern int kdMinKeyCode;
-extern int kdMaxKeyCode;
-extern int kdKeymapWidth;
-
-extern KeySym kdKeymap[KD_MAX_LENGTH * KD_MAX_WIDTH];
-
-extern CARD8 kdModMap[MAP_LENGTH];
-
-extern KeySymsRec kdKeySyms;
-
-typedef struct {
- KeySym modsym;
- int modbit;
-} KdKeySymModsRec;
-
-#endif /* _KKEYMAP_H */
diff --git a/hw/xgl/egl/module/Makefile.am b/hw/xgl/egl/module/Makefile.am
deleted file mode 100644
index c84f85c..0000000
--- a/hw/xgl/egl/module/Makefile.am
+++ b/dev/null
@@ -1,15 +0,0 @@
-AM_CFLAGS = \
- $(DIX_CFLAGS) \
- -I$(srcdir)/.. \
- -I$(srcdir)/../.. \
- $(XEGLMODULES_CFLAGS)
-
-libxegl_la_LDFLAGS = -avoid-version
-libxegl_la_SOURCES = xeglmodule.c
-libxegl_la_LIBADD = \
- $(top_builddir)/hw/xgl/glx/libxegl.la \
- $(XEGLMODULES_LIBS)
-
-moduledir = @xglmoduledir@
-
-module_LTLIBRARIES = libxegl.la
diff --git a/hw/xgl/egl/module/xeglmodule.c b/hw/xgl/egl/module/xeglmodule.c
deleted file mode 100644
index abd0d0d..0000000
--- a/hw/xgl/egl/module/xeglmodule.c
+++ b/dev/null
@@ -1,104 +0,0 @@
-/*
- * 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,
- DeviceIntPtr 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
deleted file mode 100644
index 1cf615b..0000000
--- a/hw/xgl/egl/xegl.c
+++ b/dev/null
@@ -1,303 +0,0 @@
-/*
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <signal.h>
-#include <sys/ioctl.h>
-#include <errno.h>
-#include <math.h>
-
-#include <glitz-egl.h>
-
-#include "inputstr.h"
-#include "cursorstr.h"
-#include "mipointer.h"
-
-#include "xegl.h"
-
-#define XEGL_DEFAULT_SCREEN_WIDTH 800
-#define XEGL_DEFAULT_SCREEN_HEIGHT 600
-
-DevPrivateKey xeglScreenPrivateKey = &xeglScreenPrivateKey;
-
-#define XEGL_GET_SCREEN_PRIV(pScreen) ((xeglScreenPtr) \
- dixLookupPrivate(&(pScreen)->devPrivates, xeglScreenPrivateKey))
-
-#define XEGL_SET_SCREEN_PRIV(pScreen, v) \
- dixSetPrivate(&(pScreen)->devPrivates, xeglScreenPrivateKey, v)
-
-#define XEGL_SCREEN_PRIV(pScreen) \
- xeglScreenPtr pScreenPriv = XEGL_GET_SCREEN_PRIV (pScreen)
-
-static EGLDisplay eDisplay;
-static EGLScreenMESA eScreen;
-static ScreenPtr currentScreen = 0;
-static Bool softCursor = TRUE;
-
-extern miPointerScreenFuncRec kdPointerScreenFuncs;
-
-static Bool
-xeglAllocatePrivates (ScreenPtr pScreen)
-{
- xeglScreenPtr pScreenPriv;
-
- pScreenPriv = xalloc (sizeof (xeglScreenRec));
- if (!pScreenPriv)
- return FALSE;
-
- XEGL_SET_SCREEN_PRIV (pScreen, pScreenPriv);
-
- return TRUE;
-}
-
-static Bool
-xeglCloseScreen (int index,
- ScreenPtr pScreen)
-{
- glitz_drawable_t *drawable;
-
- XEGL_SCREEN_PRIV (pScreen);
-
- drawable = XGL_GET_SCREEN_PRIV (pScreen)->drawable;
- if (drawable)
- glitz_drawable_destroy (drawable);
-
- xglClearVisualTypes ();
-
- XGL_SCREEN_UNWRAP (CloseScreen);
- xfree (pScreenPriv);
-
- return (*pScreen->CloseScreen) (index, pScreen);
-}
-
-static Bool
-xeglScreenInit (int index,
- ScreenPtr pScreen,
- int argc,
- char **argv)
-{
- EGLSurface eSurface;
- EGLModeMESA mode;
- int count;
- xeglScreenPtr pScreenPriv;
- glitz_drawable_format_t *format;
- glitz_drawable_t *drawable;
- EGLint screenAttribs[] = {
- EGL_WIDTH, 1024,
- EGL_HEIGHT, 768,
- EGL_NONE
- };
-
- if (xglScreenInfo.width == 0 || xglScreenInfo.height == 0)
- {
- xglScreenInfo.width = XEGL_DEFAULT_SCREEN_WIDTH;
- xglScreenInfo.height = XEGL_DEFAULT_SCREEN_HEIGHT;
-
- }
-
- screenAttribs[1] = xglScreenInfo.width;
- screenAttribs[3] = xglScreenInfo.height;
-
- format = xglVisuals[0].format;
-
- if (!xeglAllocatePrivates (pScreen))
- return FALSE;
-
- currentScreen = pScreen;
-
- pScreenPriv = XEGL_GET_SCREEN_PRIV (pScreen);
-
- if (xglScreenInfo.width == 0 || xglScreenInfo.height == 0)
- {
- xglScreenInfo.width = XEGL_DEFAULT_SCREEN_WIDTH;
- xglScreenInfo.height = XEGL_DEFAULT_SCREEN_HEIGHT;
- }
-
- eglGetModesMESA (eDisplay, eScreen, &mode, 1, &count);
-
- eSurface = eglCreateScreenSurfaceMESA (eDisplay, format->id, screenAttribs);
- if (eSurface == EGL_NO_SURFACE)
- {
- ErrorF ("failed to create screen surface\n");
- return FALSE;
- }
-
- eglShowScreenSurfaceMESA (eDisplay, eScreen, eSurface, mode);
-
- drawable = glitz_egl_create_surface (eDisplay, eScreen, format, eSurface,
- xglScreenInfo.width,
- xglScreenInfo.height);
- if (!drawable)
- {
- ErrorF ("[%d] couldn't create glitz drawable for window\n", index);
- return FALSE;
- }
-
- xglScreenInfo.drawable = drawable;
-
- if (!xglScreenInit (pScreen))
- return FALSE;
-
-#ifdef GLXEXT
- if (!xglInitVisualConfigs (pScreen))
- return FALSE;
-#endif
-
- XGL_SCREEN_WRAP (CloseScreen, xeglCloseScreen);
-
- miDCInitialize (pScreen, &kdPointerScreenFuncs);
- miCreateDefColormap(pScreen);
-
- if (!xglFinishScreenInit (pScreen))
- return FALSE;
-
- return TRUE;
-}
-
-void
-xeglInitOutput (ScreenInfo *pScreenInfo,
- int argc,
- char **argv)
-{
- glitz_drawable_format_t *format, templ;
- int i, maj, min, count;
- unsigned long mask;
-
- xglSetPixmapFormats (pScreenInfo);
-
- if (!eDisplay)
- {
- eDisplay = eglGetDisplay (":0");
-
- if (!eglInitialize (eDisplay, &maj, &min))
- FatalError ("can't open display");
-
- eglGetScreensMESA (eDisplay, &eScreen, 1, &count);
- }
-
- templ.samples = 1;
- templ.doublebuffer = 1;
- templ.color.alpha_size = 8;
-
- mask = GLITZ_FORMAT_SAMPLES_MASK;
-
- format = glitz_egl_find_window_config (eDisplay, eScreen,
- mask, &templ, 0);
-
- if (!format)
- FatalError ("no visual format found");
-
- xglSetVisualTypesAndMasks (pScreenInfo, format, (1 << TrueColor));
-
- xglInitVisuals (pScreenInfo);
-
- AddScreen (xeglScreenInit, argc, argv);
-}
-
-static void
-xeglBlockHandler (pointer blockData,
- OSTimePtr pTimeout,
- pointer pReadMask)
-{
- XGL_SCREEN_PRIV (currentScreen);
-
- if (!xglSyncSurface (&pScreenPriv->pScreenPixmap->drawable))
- FatalError (XGL_SW_FAILURE_STRING);
-
- glitz_surface_flush (pScreenPriv->surface);
- glitz_drawable_finish (pScreenPriv->drawable);
-}
-
-void
-xeglInitInput (int argc,
- char **argv)
-{
- eglInitInput (&LinuxEvdevMouseFuncs, &LinuxEvdevKeyboardFuncs);
- RegisterBlockAndWakeupHandlers (xeglBlockHandler, KdWakeupHandler, NULL);
-}
-
-Bool
-xeglLegalModifier (unsigned int key,
- DeviceIntPtr pDev)
-{
- return KdLegalModifier (key, pDev);
-}
-
-void
-xeglProcessInputEvents (void)
-{
- KdProcessInputEvents ();
-}
-
-void
-xeglUseMsg (void)
-{
- ErrorF ("-screen WIDTH[/WIDTHMM]xHEIGHT[/HEIGHTMM] "
- "specify screen characteristics\n");
- ErrorF ("-softcursor force software cursor\n");
-}
-
-int
-xeglProcessArgument (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], "-softcursor"))
- {
- softCursor = TRUE;
- return 1;
- }
-
- return 0;
-}
-
-void
-xeglAbort (void)
-{
-}
-
-void
-xeglGiveUp (void)
-{
- AbortDDX ();
-}
-
-void
-xeglOsVendorInit (void)
-{
-}
diff --git a/hw/xgl/egl/xegl.h b/hw/xgl/egl/xegl.h
deleted file mode 100644
index 0a07397..0000000
--- a/hw/xgl/egl/xegl.h
+++ b/dev/null
@@ -1,214 +0,0 @@
-/*
- * 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
-#define KD_BUTTON_2 0x02
-#define KD_BUTTON_3 0x04
-#define KD_BUTTON_4 0x08
-#define KD_BUTTON_5 0x10
-#define KD_MOUSE_DELTA 0x80000000
-
-typedef struct _KdMouseFuncs {
- 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;
-} KdKeyboardFuncs;
-
-typedef struct _KdOsFuncs {
- 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];
-} KdMouseMatrix;
-
-typedef enum _KdMouseState {
- start,
- button_1_pend,
- button_1_down,
- button_2_down,
- button_3_pend,
- button_3_down,
- synth_2_down_13,
- synth_2_down_3,
- synth_2_down_1,
- num_input_states
-} KdMouseState;
-
-#define KD_MAX_BUTTON 7
-
-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;
-} KdMouseInfo;
-
-typedef struct _xeglScreen {
- CloseScreenProcPtr CloseScreen;
- ScreenPtr pScreen;
- DDXPointRec origin;
-} xeglScreenRec, *xeglScreenPtr;
-
-extern KdMouseInfo *kdMouseInfo;
-extern KdOsFuncs *kdOsFuncs;
-extern Bool kdDontZap;
-extern Bool kdDisableZaphod;
-extern DevPrivateKey xeglScreenPrivateKey;
-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) \
- dixLookupPrivate(&(pScreen)->devPrivates, xeglScreenPrivateKey))
-#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,
- DeviceIntPtr 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
deleted file mode 100644
index c28d946..0000000
--- a/hw/xgl/egl/xeglinit.c
+++ b/dev/null
@@ -1,131 +0,0 @@
-/*
- * 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,
- DeviceIntPtr 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/egl/xeglinput.c b/hw/xgl/egl/xeglinput.c
deleted file mode 100644
index 8c50b78..0000000
--- a/hw/xgl/egl/xeglinput.c
+++ b/dev/null
@@ -1,168 +0,0 @@
-#include "xgl.h"
-#include "xegl.h"
-
-KdOsFuncs *kdOsFuncs;
-Bool kdEmulateMiddleButton;
-Bool kdRawPointerCoordinates;
-Bool kdDontZap;
-Bool kdDisableZaphod;
-int kdScreenPrivateIndex;
-
-static char *
-KdParseFindNext (char *cur, char *delim, char *save, char *last)
-{
- while (*cur && !strchr (delim, *cur))
- {
- *save++ = *cur++;
- }
- *save = 0;
- *last = *cur;
- if (*cur)
- cur++;
- return cur;
-}
-
-/*
- * Mouse argument syntax:
- *
- * device,protocol,options...
- *
- * Options are any of:
- * 1-5 n button mouse
- * 2button emulate middle button
- * {NMO} Reorder buttons
- */
-char *
-KdSaveString (char *str)
-{
- char *n = (char *) xalloc (strlen (str) + 1);
-
- if (!n)
- return 0;
- strcpy (n, str);
- return n;
-}
-
-/*
- * Parse mouse information. Syntax:
- *
- * <device>,<nbutton>,<protocol>{,<option>}...
- *
- * options: {nmo} pointer mapping (e.g. {321})
- * 2button emulate middle button
- * 3button dont emulate middle button
- */
-void
-KdParseMouse (char *arg)
-{
- char save[1024];
- char delim;
- KdMouseInfo *mi;
- int i;
-
- mi = KdMouseInfoAdd ();
- if (!mi)
- return;
- mi->name = 0;
- mi->prot = 0;
- mi->emulateMiddleButton = kdEmulateMiddleButton;
- mi->transformCoordinates = !kdRawPointerCoordinates;
- mi->nbutton = 3;
- for (i = 0; i < KD_MAX_BUTTON; i++)
- mi->map[i] = i + 1;
-
- if (!arg)
- return;
- if (strlen (arg) >= sizeof (save))
- return;
- arg = KdParseFindNext (arg, ",", save, &delim);
- if (!save[0])
- return;
- mi->name = KdSaveString (save);
- if (delim != ',')
- return;
-
- arg = KdParseFindNext (arg, ",", save, &delim);
- if (!save[0])
- return;
-
- if ('1' <= save[0] && save[0] <= '0' + KD_MAX_BUTTON && save[1] == '\0')
- {
- mi->nbutton = save[0] - '0';
- if (mi->nbutton > KD_MAX_BUTTON)
- {
- UseMsg ();
- return;
- }
- }
-
- if (!delim != ',')
- return;
-
- arg = KdParseFindNext (arg, ",", save, &delim);
-
- if (save[0])
- mi->prot = KdSaveString (save);
-
- while (delim == ',')
- {
- arg = KdParseFindNext (arg, ",", save, &delim);
- if (save[0] == '{')
- {
- char *s = save + 1;
- i = 0;
- while (*s && *s != '}')
- {
- if ('1' <= *s && *s <= '0' + mi->nbutton)
- mi->map[i] = *s - '0';
- else
- UseMsg ();
- s++;
- }
- }
- else if (!strcmp (save, "2button"))
- mi->emulateMiddleButton = TRUE;
- else if (!strcmp (save, "3button"))
- mi->emulateMiddleButton = FALSE;
- else if (!strcmp (save, "rawcoord"))
- mi->transformCoordinates = FALSE;
- else if (!strcmp (save, "transform"))
- mi->transformCoordinates = TRUE;
- else
- UseMsg ();
- }
-}
-
-KdMouseInfo *kdMouseInfo;
-
-KdMouseInfo *
-KdMouseInfoAdd (void)
-{
- KdMouseInfo *mi, **prev;
-
- mi = (KdMouseInfo *) xalloc (sizeof (KdMouseInfo));
- if (!mi)
- return 0;
- bzero (mi, sizeof (KdMouseInfo));
- for (prev = &kdMouseInfo; *prev; prev = &(*prev)->next);
- *prev = mi;
- return mi;
-}
-
-void
-KdMouseInfoDispose (KdMouseInfo *mi)
-{
- KdMouseInfo **prev;
-
- for (prev = &kdMouseInfo; *prev; prev = &(*prev)->next)
- if (*prev == mi)
- {
- *prev = mi->next;
- if (mi->name)
- xfree (mi->name);
- if (mi->prot)
- xfree (mi->prot);
- xfree (mi);
- break;
- }
-}
diff --git a/hw/xgl/glx/Makefile.am b/hw/xgl/glx/Makefile.am
deleted file mode 100644
index ea34ea4..0000000
--- a/hw/xgl/glx/Makefile.am
+++ b/dev/null
@@ -1,48 +0,0 @@
-if XGL
-XGL_MODULE_DIRS = module
-endif
-
-DIST_SUBDIRS = module
-
-SUBDIRS = \
- . \
- $(XGL_MODULE_DIRS)
-
-AM_CFLAGS = \
- -I$(srcdir)/.. \
- -I$(srcdir)/../glxext \
- -I$(top_srcdir)/glx \
- -I$(top_srcdir)/GL/include \
- -I@MESA_SOURCE@/include \
- -I@MESA_SOURCE@/src/mesa/glapi \
- $(DIX_CFLAGS) \
- -DHAVE_XGL_CONFIG_H \
- -DHAVE_DIX_CONFIG_H \
- $(XGLXMODULES_CFLAGS)
-
-noinst_LTLIBRARIES = libxglx.la
-
-libxglx_la_SOURCES = \
- xglx.h \
- xglx.c \
- xglxorg.c
-
-# Xglx_DEPENDENCIES = @XGLX_LIBS@
-# Xglx_LDFLAGS = -export-dynamic
-# Xglx_SOURCES = \
-# xglxinit.c \
-# $(top_srcdir)/mi/miinitext.c \
-# $(top_srcdir)/Xext/dpmsstubs.c \
-# $(top_srcdir)/Xi/stubs.c \
-# $(top_srcdir)/fb/fbcmap.c
-#Xglx_LDADD = \
-# libxglx.la \
-# ../libxgl.a \
-# $(XORG_CORE_LIBS) \
-# $(XGLX_LIBS) \
-# $(EXTENSION_LIBS) \
-# $(XGLXMODULES_LIBS) \
-# -lXrandr
-#Xglx_programs = Xglx
-#
-#bin_PROGRAMS = $(Xglx_programs)
diff --git a/hw/xgl/glx/module/Makefile.am b/hw/xgl/glx/module/Makefile.am
deleted file mode 100644
index bd1c4b0..0000000
--- a/hw/xgl/glx/module/Makefile.am
+++ b/dev/null
@@ -1,21 +0,0 @@
-if GLX
-GLX_LIB = $(top_builddir)/hw/xgl/glxext/libxglglxext.la
-endif
-
-AM_CFLAGS = $(DIX_CFLAGS) \
- -I$(srcdir)/.. \
- -I$(srcdir)/../.. \
- $(XGLXMODULES_CFLAGS)
-
-libxglx_la_DEPENDENCIES = $(GLX_LIB)
-libxglx_la_LDFLAGS = -avoid-version
-libxglx_la_SOURCES = xglxmodule.c
-libxglx_la_LIBADD = \
- $(top_builddir)/hw/xgl/glx/libxglx.la \
- $(GLX_LIB) \
- $(XGLXMODULES_LIBS) \
- -lXrandr
-
-moduledir = @xglmoduledir@
-
-module_LTLIBRARIES = libxglx.la
diff --git a/hw/xgl/glx/module/xglxmodule.c b/hw/xgl/glx/module/xglxmodule.c
deleted file mode 100644
index 40af890..0000000
--- a/hw/xgl/glx/module/xglxmodule.c
+++ b/dev/null
@@ -1,104 +0,0 @@
-/*
- * 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,
- DeviceIntPtr 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
deleted file mode 100644
index 33b276b..0000000
--- a/hw/xgl/glx/xglx.c
+++ b/dev/null
@@ -1,1444 +0,0 @@
-/*
- * 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"
-
-#include <X11/extensions/Xrandr.h>
-#include <X11/cursorfont.h>
-
-#include <glitz-glx.h>
-
-#ifdef GLXEXT
-#include "xglglxext.h"
-#endif
-
-#include "inputstr.h"
-#include "cursorstr.h"
-#include "mipointer.h"
-
-#ifdef RANDR
-#include "randrstr.h"
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <signal.h>
-#include <math.h>
-
-#ifdef XKB
-#include <X11/extensions/XKB.h>
-#include <xkbsrv.h>
-#include <X11/extensions/XKBconfig.h>
-
-extern Bool
-XkbQueryExtension (Display *dpy,
- int *opcodeReturn,
- int *eventBaseReturn,
- int *errorBaseReturn,
- int *majorRtrn,
- int *minorRtrn);
-
-extern XkbDescPtr
-XkbGetKeyboard (Display *dpy,
- unsigned int which,
- unsigned int deviceSpec);
-
-extern Status
-XkbGetControls (Display *dpy,
- unsigned long which,
- XkbDescPtr desc);
-
-#ifndef XKB_BASE_DIRECTORY
-#define XKB_BASE_DIRECTORY "/usr/lib/X11/xkb/"
-#endif
-#ifndef XKB_CONFIG_FILE
-#define XKB_CONFIG_FILE "X0-config.keyboard"
-#endif
-#ifndef XKB_DFLT_RULES_FILE
-#define XKB_DFLT_RULES_FILE "xorg"
-#endif
-#ifndef XKB_DFLT_KB_LAYOUT
-#define XKB_DFLT_KB_LAYOUT "us"
-#endif
-#ifndef XKB_DFLT_KB_MODEL
-#define XKB_DFLT_KB_MODEL "pc101"
-#endif
-#ifndef XKB_DFLT_KB_VARIANT
-#define XKB_DFLT_KB_VARIANT NULL
-#endif
-#ifndef XKB_DFLT_KB_OPTIONS
-#define XKB_DFLT_KB_OPTIONS NULL
-#endif
-
-#endif
-
-#define XGLX_DEFAULT_SCREEN_WIDTH 800
-#define XGLX_DEFAULT_SCREEN_HEIGHT 600
-
-typedef struct _xglxScreen {
- Window win, root;
- Colormap colormap;
- Bool fullscreen;
- CloseScreenProcPtr CloseScreen;
-} xglxScreenRec, *xglxScreenPtr;
-
-DevPrivateKey xglxScreenPrivateKey = &xglxScreenPrivateKey;
-
-#define XGLX_GET_SCREEN_PRIV(pScreen) ((xglxScreenPtr) \
- dixLookupPrivate(&(pScreen)->devPrivates, xglxScreenPrivateKey))
-
-#define XGLX_SET_SCREEN_PRIV(pScreen, v) \
- dixSetPrivate(&(pScreen)->devPrivates, xglxScreenPrivateKey, v)
-
-#define XGLX_SCREEN_PRIV(pScreen) \
- xglxScreenPtr pScreenPriv = XGLX_GET_SCREEN_PRIV (pScreen)
-
-typedef struct _xglxCursor {
- Cursor cursor;
-} xglxCursorRec, *xglxCursorPtr;
-
-#define XGLX_GET_CURSOR_PRIV(pCursor, pScreen) \
- ((xglxCursorPtr)dixLookupPrivate(&(pCursor)->devPrivates, pScreen))
-
-#define XGLX_SET_CURSOR_PRIV(pCursor, pScreen, v) \
- dixSetPrivate(&(pCursor)->devPrivates, pScreen, v)
-
-#define XGLX_CURSOR_PRIV(pCursor, pScreen) \
- xglxCursorPtr pCursorPriv = XGLX_GET_CURSOR_PRIV (pCursor, pScreen)
-
-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 = TRUE;
-
-static Bool randrExtension = FALSE;
-static int randrEvent, randrError;
-
-static glitz_drawable_format_t *xglxScreenFormat = 0;
-
-static Bool
-xglxAllocatePrivates (ScreenPtr pScreen)
-{
- xglxScreenPtr pScreenPriv;
-
- pScreenPriv = xalloc (sizeof (xglxScreenRec));
- if (!pScreenPriv)
- return FALSE;
-
- XGLX_SET_SCREEN_PRIV (pScreen, pScreenPriv);
-
- return TRUE;
-}
-
-#ifdef RANDR
-
-#define DEFAULT_REFRESH_RATE 50
-
-static Bool
-xglxRandRGetInfo (ScreenPtr pScreen,
- Rotation *rotations)
-{
- RRScreenSizePtr pSize;
-
- *rotations = RR_Rotate_0;
-
- if (randrExtension)
- {
- XRRScreenConfiguration *xconfig;
- XRRScreenSize *sizes;
- int nSizes, currentSize = 0;
- short *rates, currentRate;
- int nRates, i, j;
-
- XGLX_SCREEN_PRIV (pScreen);
-
- xconfig = XRRGetScreenInfo (xdisplay, pScreenPriv->root);
- sizes = XRRConfigSizes (xconfig, &nSizes);
- currentRate = XRRConfigCurrentRate (xconfig);
-
- if (pScreenPriv->fullscreen)
- {
- Rotation rotation;
-
- currentSize = XRRConfigCurrentConfiguration (xconfig, &rotation);
-
- for (i = 0; i < nSizes; i++)
- {
- pSize = RRRegisterSize (pScreen,
- sizes[i].width,
- sizes[i].height,
- sizes[i].mwidth,
- sizes[i].mheight);
-
- rates = XRRConfigRates (xconfig, i, &nRates);
-
- for (j = 0; j < nRates; j++)
- {
- RRRegisterRate (pScreen, pSize, rates[j]);
-
- if (i == currentSize && rates[j] == currentRate)
- RRSetCurrentConfig (pScreen, RR_Rotate_0, currentRate,
- pSize);
- }
- }
- }
- else
- {
- pSize = RRRegisterSize (pScreen,
- pScreen->width,
- pScreen->height,
- pScreen->mmWidth,
- pScreen->mmHeight);
-
- for (i = 0; i < nSizes; i++)
- {
- rates = XRRConfigRates (xconfig, i, &nRates);
-
- for (j = 0; j < nRates; j++)
- {
- RRRegisterRate (pScreen, pSize, rates[j]);
-
- if (rates[j] == currentRate)
- RRSetCurrentConfig (pScreen, RR_Rotate_0, currentRate,
- pSize);
- }
- }
- }
-
- XRRFreeScreenConfigInfo (xconfig);
- }
- else
- {
- pSize = RRRegisterSize (pScreen,
- pScreen->width,
- pScreen->height,
- pScreen->mmWidth,
- pScreen->mmHeight);
-
- RRRegisterRate (pScreen, pSize, DEFAULT_REFRESH_RATE);
- RRSetCurrentConfig (pScreen, RR_Rotate_0, DEFAULT_REFRESH_RATE, pSize);
- }
-
- return TRUE;
-}
-
-static Bool
-xglxRandRSetConfig (ScreenPtr pScreen,
- Rotation rotations,
- int rate,
- RRScreenSizePtr pSize)
-{
- if (randrExtension)
- {
- XRRScreenConfiguration *xconfig;
- XRRScreenSize *sizes;
- int nSizes, currentSize;
- int i, size = -1;
- int status = RRSetConfigFailed;
- Rotation rotation;
-
- XGLX_SCREEN_PRIV (pScreen);
-
- xconfig = XRRGetScreenInfo (xdisplay, pScreenPriv->root);
- sizes = XRRConfigSizes (xconfig, &nSizes);
- currentSize = XRRConfigCurrentConfiguration (xconfig, &rotation);
-
- for (i = 0; i < nSizes; i++)
- {
- if (pScreenPriv->fullscreen)
- {
- if (sizes[i].width == pSize->width &&
- sizes[i].height == pSize->height &&
- sizes[i].mwidth == pSize->mmWidth &&
- sizes[i].mheight == pSize->mmHeight)
- {
- size = i;
- break;
- }
- }
- else
- {
- short *rates;
- int nRates, j;
-
- rates = XRRConfigRates (xconfig, i, &nRates);
-
- for (j = 0; j < nRates; j++)
- {
- if (rates[j] == rate)
- {
- size = i;
- if (i >= currentSize)
- break;
- }
- }
- }
- }
-
- if (size >= 0)
- status = XRRSetScreenConfigAndRate (xdisplay,
- xconfig,
- pScreenPriv->root,
- size,
- RR_Rotate_0,
- rate,
- CurrentTime);
-
- XRRFreeScreenConfigInfo (xconfig);
-
- if (status == RRSetConfigSuccess)
- {
- PixmapPtr pPixmap;
-
- pPixmap = (*pScreen->GetScreenPixmap) (pScreen);
-
- if (pScreenPriv->fullscreen)
- {
- XGL_PIXMAP_PRIV (pPixmap);
-
- xglSetRootClip (pScreen, FALSE);
-
- XResizeWindow (xdisplay, pScreenPriv->win,
- pSize->width, pSize->height);
-
- glitz_drawable_update_size (pPixmapPriv->drawable,
- pSize->width, pSize->height);
-
- pScreen->width = pSize->width;
- pScreen->height = pSize->height;
- pScreen->mmWidth = pSize->mmWidth;
- pScreen->mmHeight = pSize->mmHeight;
-
- (*pScreen->ModifyPixmapHeader) (pPixmap,
- pScreen->width,
- pScreen->height,
- pPixmap->drawable.depth,
- pPixmap->drawable.bitsPerPixel,
- 0, 0);
-
- xglSetRootClip (pScreen, TRUE);
- }
-
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-static Bool
-xglxRandRInit (ScreenPtr pScreen)
-{
- rrScrPrivPtr pScrPriv;
-
- if (!RRScreenInit (pScreen))
- return FALSE;
-
- pScrPriv = rrGetScrPriv (pScreen);
- pScrPriv->rrGetInfo = xglxRandRGetInfo;
- pScrPriv->rrSetConfig = xglxRandRSetConfig;
-
- return TRUE;
-}
-
-#endif
-
-static void
-xglxConstrainCursor (ScreenPtr pScreen,
- BoxPtr pBox)
-{
-}
-
-static void
-xglxCursorLimits (ScreenPtr pScreen,
- CursorPtr pCursor,
- BoxPtr pHotBox,
- BoxPtr pTopLeftBox)
-{
- *pTopLeftBox = *pHotBox;
-}
-
-static Bool
-xglxDisplayCursor (ScreenPtr pScreen,
- CursorPtr pCursor)
-{
- XGLX_SCREEN_PRIV (pScreen);
- XGLX_CURSOR_PRIV (pCursor, pScreen);
-
- XDefineCursor (xdisplay, pScreenPriv->win, pCursorPriv->cursor);
-
- return TRUE;
-}
-
-#ifdef ARGB_CURSOR
-
-static Bool
-xglxARGBCursorSupport (void);
-
-static Cursor
-xglxCreateARGBCursor (ScreenPtr pScreen,
- CursorPtr pCursor);
-
-#endif
-
-static Bool
-xglxRealizeCursor (ScreenPtr pScreen,
- CursorPtr pCursor)
-{
- xglxCursorPtr pCursorPriv;
- XImage *ximage;
- Pixmap source, mask;
- XColor fgColor, bgColor;
- XlibGC xgc;
- unsigned long valuemask;
- XGCValues values;
-
- XGLX_SCREEN_PRIV (pScreen);
-
- valuemask = GCForeground | GCBackground;
-
- values.foreground = 1L;
- values.background = 0L;
-
- pCursorPriv = xalloc (sizeof (xglxCursorRec));
- if (!pCursorPriv)
- return FALSE;
-
- XGLX_SET_CURSOR_PRIV (pCursor, pScreen, pCursorPriv);
-
-#ifdef ARGB_CURSOR
- if (pCursor->bits->argb)
- {
- pCursorPriv->cursor = xglxCreateARGBCursor (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);
-
- return TRUE;
-}
-
-static Bool
-xglxUnrealizeCursor (ScreenPtr pScreen,
- CursorPtr pCursor)
-{
- XGLX_CURSOR_PRIV (pCursor, pScreen);
-
- XFreeCursor (xdisplay, pCursorPriv->cursor);
- xfree (pCursorPriv);
-
- return TRUE;
-}
-
-static void
-xglxRecolorCursor (ScreenPtr pScreen,
- CursorPtr pCursor,
- Bool displayed)
-{
- XColor fgColor, bgColor;
-
- XGLX_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);
-}
-
-static Bool
-xglxSetCursorPosition (ScreenPtr pScreen,
- int x,
- int y,
- Bool generateEvent)
-{
- XGLX_SCREEN_PRIV (pScreen);
-
- XWarpPointer (xdisplay, pScreenPriv->win, pScreenPriv->win,
- 0, 0, 0, 0, x, y);
-
- return TRUE;
-}
-
-static Bool
-xglxCloseScreen (int index,
- ScreenPtr pScreen)
-{
- glitz_drawable_t *drawable;
-
- XGLX_SCREEN_PRIV (pScreen);
-
- drawable = XGL_GET_SCREEN_PRIV (pScreen)->drawable;
- if (drawable)
- glitz_drawable_destroy (drawable);
-
- xglClearVisualTypes ();
-
- if (pScreenPriv->win)
- XDestroyWindow (xdisplay, pScreenPriv->win);
-
- if (pScreenPriv->colormap)
- XFreeColormap (xdisplay, pScreenPriv->colormap);
-
- XGL_SCREEN_UNWRAP (CloseScreen);
- xfree (pScreenPriv);
-
- return (*pScreen->CloseScreen) (index, pScreen);
-}
-
-static Bool
-xglxCursorOffScreen (ScreenPtr *ppScreen, int *x, int *y)
-{
- return FALSE;
-}
-
-static void
-xglxCrossScreen (ScreenPtr pScreen, Bool entering)
-{
-}
-
-static void
-xglxWarpCursor (ScreenPtr pScreen, int x, int y)
-{
- miPointerWarpCursor (pScreen, x, y);
-}
-
-miPointerScreenFuncRec xglxPointerScreenFuncs = {
- xglxCursorOffScreen,
- xglxCrossScreen,
- xglxWarpCursor
-};
-
-static Bool
-xglxScreenInit (int index,
- ScreenPtr pScreen,
- int argc,
- char **argv)
-{
- XSetWindowAttributes xswa;
- XWMHints *wmHints;
- XSizeHints *normalHints;
- XClassHint *classHint;
- xglxScreenPtr pScreenPriv;
- XVisualInfo *vinfo;
- XEvent xevent;
- glitz_drawable_format_t *format;
- glitz_drawable_t *drawable;
-
- format = xglxScreenFormat;
-
- if (!xglxAllocatePrivates (pScreen))
- return FALSE;
-
- currentScreen = pScreen;
-
- pScreenPriv = XGLX_GET_SCREEN_PRIV (pScreen);
-
- pScreenPriv->root = RootWindow (xdisplay, xscreen);
- pScreenPriv->fullscreen = fullscreen;
-
- vinfo = glitz_glx_get_visual_info_from_format (xdisplay, xscreen, format);
- if (!vinfo)
- {
- ErrorF ("[%d] no visual info from format\n", index);
- return FALSE;
- }
-
- pScreenPriv->colormap =
- XCreateColormap (xdisplay, pScreenPriv->root, vinfo->visual,
- AllocNone);
-
- if (XRRQueryExtension (xdisplay, &randrEvent, &randrError))
- randrExtension = TRUE;
-
- if (fullscreen)
- {
- xglScreenInfo.width = DisplayWidth (xdisplay, xscreen);
- xglScreenInfo.height = DisplayHeight (xdisplay, xscreen);
- xglScreenInfo.widthMm = DisplayWidthMM (xdisplay, xscreen);
- xglScreenInfo.heightMm = DisplayHeightMM (xdisplay, xscreen);
-
- if (randrExtension)
- {
- XRRScreenConfiguration *xconfig;
- Rotation rotation;
- XRRScreenSize *sizes;
- int nSizes, currentSize;
-
- xconfig = XRRGetScreenInfo (xdisplay, pScreenPriv->root);
- currentSize = XRRConfigCurrentConfiguration (xconfig, &rotation);
- sizes = XRRConfigSizes (xconfig, &nSizes);
-
- xglScreenInfo.width = sizes[currentSize].width;
- xglScreenInfo.height = sizes[currentSize].height;
- xglScreenInfo.widthMm = sizes[currentSize].mwidth;
- xglScreenInfo.heightMm = sizes[currentSize].mheight;
-
- XRRFreeScreenConfigInfo (xconfig);
- }
- }
- else if (xglScreenInfo.width == 0 || xglScreenInfo.height == 0)
- {
- xglScreenInfo.width = XGLX_DEFAULT_SCREEN_WIDTH;
- xglScreenInfo.height = XGLX_DEFAULT_SCREEN_HEIGHT;
- }
-
- xswa.colormap = pScreenPriv->colormap;
-
- pScreenPriv->win =
- XCreateWindow (xdisplay, pScreenPriv->root, 0, 0,
- xglScreenInfo.width, xglScreenInfo.height, 0,
- vinfo->depth, InputOutput, vinfo->visual,
- CWColormap, &xswa);
-
- XFree (vinfo);
-
- normalHints = XAllocSizeHints ();
- normalHints->flags = PMinSize | PMaxSize | PSize;
- normalHints->min_width = xglScreenInfo.width;
- normalHints->min_height = xglScreenInfo.height;
- normalHints->max_width = xglScreenInfo.width;
- normalHints->max_height = xglScreenInfo.height;
-
- if (fullscreen)
- {
- normalHints->x = 0;
- normalHints->y = 0;
- normalHints->flags |= PPosition;
- }
-
- classHint = XAllocClassHint ();
- classHint->res_name = "xglx";
- classHint->res_class = "Xglx";
-
- wmHints = XAllocWMHints ();
- wmHints->flags = InputHint;
- wmHints->input = TRUE;
-
- Xutf8SetWMProperties (xdisplay, pScreenPriv->win, "Xglx", "Xglx", 0, 0,
- normalHints, wmHints, classHint);
-
- XFree (wmHints);
- XFree (classHint);
- XFree (normalHints);
-
- drawable = glitz_glx_create_drawable_for_window (xdisplay, xscreen,
- format, pScreenPriv->win,
- xglScreenInfo.width,
- xglScreenInfo.height);
- if (!drawable)
- {
- ErrorF ("[%d] couldn't create glitz drawable for window\n", index);
- return FALSE;
- }
-
- XSelectInput (xdisplay, pScreenPriv->win,
- ButtonPressMask | ButtonReleaseMask |
- KeyPressMask | KeyReleaseMask | EnterWindowMask |
- PointerMotionMask | ExposureMask);
-
- XMapWindow (xdisplay, pScreenPriv->win);
-
- if (fullscreen)
- {
- 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, pScreenPriv->root, FALSE,
- SubstructureRedirectMask, (XEvent *) &xev);
- }
-
- xglScreenInfo.drawable = drawable;
-
- if (!xglScreenInit (pScreen))
- return FALSE;
-
-#ifdef GLXEXT
- if (!xglInitVisualConfigs (pScreen))
- return FALSE;
-#endif
-
- XGL_SCREEN_WRAP (CloseScreen, xglxCloseScreen);
-
-#ifdef ARGB_CURSOR
- if (!xglxARGBCursorSupport ())
- softCursor = TRUE;
-#endif
-
- if (softCursor)
- {
- static char data = 0;
- XColor black, dummy;
- Pixmap bitmap;
- Cursor cursor;
-
- if (!XAllocNamedColor (xdisplay, pScreenPriv->colormap,
- "black", &black, &dummy))
- return FALSE;
-
- bitmap = XCreateBitmapFromData (xdisplay, pScreenPriv->win, &data,
- 1, 1);
- if (!bitmap)
- return FALSE;
-
- cursor = XCreatePixmapCursor (xdisplay, bitmap, bitmap, &black, &black,
- 0, 0);
- if (!cursor)
- return FALSE;
-
- XDefineCursor (xdisplay, pScreenPriv->win, cursor);
-
- XFreeCursor (xdisplay, cursor);
- XFreePixmap (xdisplay, bitmap);
- XFreeColors (xdisplay, pScreenPriv->colormap, &black.pixel, 1, 0);
-
- miDCInitialize (pScreen, &xglxPointerScreenFuncs);
- }
- else
- {
- pScreen->ConstrainCursor = xglxConstrainCursor;
- pScreen->CursorLimits = xglxCursorLimits;
- pScreen->DisplayCursor = xglxDisplayCursor;
- pScreen->RealizeCursor = xglxRealizeCursor;
- pScreen->UnrealizeCursor = xglxUnrealizeCursor;
- pScreen->RecolorCursor = xglxRecolorCursor;
- pScreen->SetCursorPosition = xglxSetCursorPosition;
- }
-
- if (!xglFinishScreenInit (pScreen))
- return FALSE;
-
-#ifdef RANDR
- if (!xglxRandRInit (pScreen))
- return FALSE;
-#endif
-
- while (XNextEvent (xdisplay, &xevent))
- if (xevent.type == Expose)
- break;
-
- return TRUE;
-}
-
-void
-xglxInitOutput (ScreenInfo *pScreenInfo,
- int argc,
- char **argv)
-{
- glitz_drawable_format_t *format, templ;
- int i;
- unsigned long mask;
- unsigned long extraMask[] = {
- GLITZ_FORMAT_DOUBLEBUFFER_MASK | GLITZ_FORMAT_ALPHA_SIZE_MASK,
- GLITZ_FORMAT_DOUBLEBUFFER_MASK,
- GLITZ_FORMAT_ALPHA_SIZE_MASK,
- 0
- };
-
- xglClearVisualTypes ();
-
- xglSetPixmapFormats (pScreenInfo);
-
- if (!xdisplay)
- {
- char *name = xDisplayName;
-
- if (!name)
- name = xglxInitXorg ();
-
- xdisplay = XOpenDisplay (name);
- if (!xdisplay)
- FatalError ("can't open display: %s\n", name ? name : "NULL");
-
- xscreen = DefaultScreen (xdisplay);
-
- if (!xDisplayName)
- XDefineCursor (xdisplay, RootWindow (xdisplay, xscreen),
- XCreateFontCursor (xdisplay, XC_watch));
- }
-
- templ.samples = 1;
- templ.doublebuffer = 1;
- templ.color.fourcc = GLITZ_FOURCC_RGB;
- templ.color.alpha_size = 8;
-
- mask = GLITZ_FORMAT_SAMPLES_MASK | GLITZ_FORMAT_FOURCC_MASK;
-
- for (i = 0; i < sizeof (extraMask) / sizeof (extraMask[0]); i++)
- {
- format = glitz_glx_find_window_format (xdisplay, xscreen,
- mask | extraMask[i],
- &templ, 0);
- if (format)
- break;
- }
-
- if (!format)
- FatalError ("no visual format found");
-
- xglScreenInfo.depth =
- format->color.red_size +
- format->color.green_size +
- format->color.blue_size;
-
- xglSetVisualTypes (xglScreenInfo.depth,
- (1 << TrueColor),
- format->color.red_size,
- format->color.green_size,
- format->color.blue_size);
-
- xglxScreenFormat = format;
-
- AddScreen (xglxScreenInit, argc, argv);
-}
-
-static Bool
-xglxExposurePredicate (Display *xdisplay,
- XEvent *xevent,
- char *args)
-{
- return (xevent->type == Expose);
-}
-
-static Bool
-xglxNotExposurePredicate (Display *xdisplay,
- XEvent *xevent,
- char *args)
-{
- return (xevent->type != Expose);
-}
-
-static int
-xglxWindowExposures (WindowPtr pWin,
- pointer pReg)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- RegionRec ClipList;
-
- if (HasBorder (pWin))
- {
- REGION_INIT (pScreen, &ClipList, NullBox, 0);
- REGION_SUBTRACT (pScreen, &ClipList, &pWin->borderClip,
- &pWin->winSize);
- REGION_INTERSECT (pScreen, &ClipList, &ClipList, (RegionPtr) pReg);
- miPaintWindow(pWin, &ClipList, PW_BORDER);
- REGION_UNINIT (pScreen, &ClipList);
- }
-
- REGION_INIT (pScreen, &ClipList, NullBox, 0);
- REGION_INTERSECT (pScreen, &ClipList, &pWin->clipList, (RegionPtr) pReg);
- (*pScreen->WindowExposures) (pWin, &ClipList, NullRegion);
- REGION_UNINIT (pScreen, &ClipList);
-
- return WT_WALKCHILDREN;
-}
-
-static void
-xglxBlockHandler (pointer blockData,
- OSTimePtr pTimeout,
- pointer pReadMask)
-{
- XEvent X;
- RegionRec region;
- BoxRec box;
-
- XGL_SCREEN_PRIV (currentScreen);
-
- while (XCheckIfEvent (xdisplay, &X, xglxExposurePredicate, NULL))
- {
- ScreenPtr pScreen = currentScreen;
-
- box.x1 = X.xexpose.x;
- box.y1 = X.xexpose.y;
- box.x2 = box.x1 + X.xexpose.width;
- box.y2 = box.y1 + X.xexpose.height;
-
- REGION_INIT (currentScreen, &region, &box, 1);
-
- WalkTree (pScreen, xglxWindowExposures, &region);
-
- REGION_UNINIT (pScreen, &region);
- }
-
- if (!xglSyncSurface (&pScreenPriv->pScreenPixmap->drawable))
- FatalError (XGL_SW_FAILURE_STRING);
-
- glitz_surface_flush (pScreenPriv->surface);
- glitz_drawable_flush (pScreenPriv->drawable);
-
- XFlush (xdisplay);
-}
-
-static void
-xglxWakeupHandler (pointer blockData,
- int result,
- pointer pReadMask)
-{
- ScreenPtr pScreen = currentScreen;
- XEvent X;
- xEvent x;
-
- while (XCheckIfEvent (xdisplay, &X, xglxNotExposurePredicate, NULL))
- {
- switch (X.type) {
- case KeyPress:
- x.u.u.type = KeyPress;
- x.u.u.detail = X.xkey.keycode;
- x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis ();
- mieqEnqueue (&x);
- break;
- case KeyRelease:
- x.u.u.type = KeyRelease;
- x.u.u.detail = X.xkey.keycode;
- x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis ();
- mieqEnqueue (&x);
- break;
- case ButtonPress:
- x.u.u.type = ButtonPress;
- x.u.u.detail = X.xbutton.button;
- x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis ();
- mieqEnqueue (&x);
- break;
- case ButtonRelease:
- x.u.u.type = ButtonRelease;
- x.u.u.detail = X.xbutton.button;
- x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis ();
- mieqEnqueue (&x);
- break;
- case MotionNotify:
- x.u.u.type = MotionNotify;
- x.u.u.detail = 0;
- 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.u.detail = 0;
- 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;
- }
- }
-}
-
-static void
-xglxBell (int volume,
- DeviceIntPtr pDev,
- pointer ctrl,
- int cls)
-{
- XBell (xdisplay, volume);
-}
-
-static void
-xglxKbdCtrl (DeviceIntPtr pDev,
- KeybdCtrl *ctrl)
-{
- unsigned long valueMask;
- XKeyboardControl values;
- int i;
-
- valueMask = KBKeyClickPercent | KBBellPercent | KBBellPitch |
- KBBellDuration | KBAutoRepeatMode;
-
- values.key_click_percent = ctrl->click;
- values.bell_percent = ctrl->bell;
- values.bell_pitch = ctrl->bell_pitch;
- values.bell_duration = ctrl->bell_duration;
- values.auto_repeat_mode = (ctrl->autoRepeat) ? AutoRepeatModeOn :
- AutoRepeatModeOff;
-
- XChangeKeyboardControl (xdisplay, valueMask, &values);
-
- valueMask = KBLed | KBLedMode;
-
- for (i = 1; i <= 32; i++)
- {
- values.led = i;
- values.led_mode = (ctrl->leds & (1 << (i - 1))) ? LedModeOn :
- LedModeOff;
-
- XChangeKeyboardControl (xdisplay, valueMask, &values);
- }
-}
-
-static int
-xglxKeybdProc (DeviceIntPtr pDevice,
- int onoff)
-{
- Bool ret = FALSE;
- DevicePtr pDev = (DevicePtr) pDevice;
-
- if (!pDev)
- return BadImplementation;
-
- switch (onoff) {
- case DEVICE_INIT: {
- XModifierKeymap *xmodMap;
- KeySym *xkeyMap;
- int minKeyCode, maxKeyCode, mapWidth, i, j;
- KeySymsRec xglxKeySyms;
- CARD8 xglxModMap[256];
- XKeyboardState values;
-
-#ifdef _XSERVER64
- KeySym64 *xkeyMap64;
- int len;
-#endif
-
-#ifdef XKB
- Bool xkbExtension = FALSE;
- int xkbOp, xkbEvent, xkbError, xkbMajor, xkbMinor;
-#endif
-
- if (pDev != (DevicePtr)inputInfo.keyboard)
- return !Success;
-
- xmodMap = XGetModifierMapping (xdisplay);
-
- XDisplayKeycodes (xdisplay, &minKeyCode, &maxKeyCode);
-
-#ifdef _XSERVER64
- xkeyMap64 = XGetKeyboardMapping (xdisplay,
- minKeyCode,
- maxKeyCode - minKeyCode + 1,
- &mapWidth);
-
- len = (maxKeyCode - minKeyCode + 1) * mapWidth;
- xkeyMap = (KeySym *) xalloc (len * sizeof (KeySym));
- for (i = 0; i < len; ++i)
- xkeyMap[i] = xkeyMap64[i];
-
- XFree (xkeyMap64);
-#else
- xkeyMap = XGetKeyboardMapping (xdisplay,
- minKeyCode,
- maxKeyCode - minKeyCode + 1,
- &mapWidth);
-#endif
-
- memset (xglxModMap, 0, 256);
-
- for (j = 0; j < 8; j++)
- {
- for (i = 0; i < xmodMap->max_keypermod; i++)
- {
- CARD8 keyCode;
-
- keyCode = xmodMap->modifiermap[j * xmodMap->max_keypermod + i];
- if (keyCode)
- xglxModMap[keyCode] |= 1 << j;
- }
- }
-
- XFreeModifiermap (xmodMap);
-
- xglxKeySyms.minKeyCode = minKeyCode;
- xglxKeySyms.maxKeyCode = maxKeyCode;
- xglxKeySyms.mapWidth = mapWidth;
- xglxKeySyms.map = xkeyMap;
-
-#ifdef XKB
- if (!noXkbExtension)
- xkbExtension = XkbQueryExtension (xdisplay,
- &xkbOp, &xkbEvent, &xkbError,
- &xkbMajor, &xkbMinor);
-
- if (xkbExtension)
- {
- XkbDescPtr desc;
- char *rules, *model, *layout, *variants, *options;
-
- desc = XkbGetKeyboard (xdisplay,
- XkbGBN_AllComponentsMask,
- XkbUseCoreKbd);
-
- if (desc && desc->geom)
- {
- XkbComponentNamesRec names;
- FILE *file;
-
- rules = XKB_DFLT_RULES_FILE;
- model = XKB_DFLT_KB_MODEL;
- layout = XKB_DFLT_KB_LAYOUT;
- variants = XKB_DFLT_KB_VARIANT;
- options = XKB_DFLT_KB_OPTIONS;
-
- XkbGetControls (xdisplay, XkbAllControlsMask, desc);
-
- memset (&names, 0, sizeof (XkbComponentNamesRec));
-
- XkbSetRulesDflts (rules, model, layout, variants, options);
-
- ret = XkbInitKeyboardDeviceStruct ((pointer) pDev,
- &names,
- &xglxKeySyms,
- xglxModMap,
- xglxBell,
- xglxKbdCtrl);
-
- if (ret)
- XkbDDXChangeControls ((pointer) pDev, desc->ctrls,
- desc->ctrls);
-
- XkbFreeKeyboard (desc, 0, False);
- }
- }
-#endif
-
- if (!ret)
- {
- XGetKeyboardControl (xdisplay, &values);
-
- memmove (defaultKeyboardControl.autoRepeats,
- values.auto_repeats, sizeof (values.auto_repeats));
-
- ret = InitKeyboardDeviceStruct (pDev,
- &xglxKeySyms,
- xglxModMap,
- xglxBell,
- xglxKbdCtrl);
- }
-
-#ifdef _XSERVER64
- xfree (xkeyMap);
-#else
- XFree (xkeyMap);
-#endif
-
- if (!ret)
- return BadImplementation;
-
- } break;
- case DEVICE_ON:
- pDev->on = TRUE;
- break;
- case DEVICE_OFF:
- case DEVICE_CLOSE:
- pDev->on = FALSE;
- break;
- }
-
- return Success;
-}
-
-Bool
-xglxLegalModifier (unsigned int key,
- DeviceIntPtr pDev)
-{
- return TRUE;
-}
-
-void
-xglxProcessInputEvents (void)
-{
- mieqProcessInputEvents ();
- miPointerUpdate ();
-}
-
-void
-xglxInitInput (int argc,
- char **argv)
-{
- DeviceIntPtr pKeyboard, pPointer;
-
- pPointer = AddInputDevice (xglMouseProc, TRUE);
- pKeyboard = AddInputDevice (xglxKeybdProc, TRUE);
-
- RegisterPointerDevice (pPointer);
- RegisterKeyboardDevice (pKeyboard);
-
- miRegisterPointerDevice (screenInfo.screens[0], pPointer);
- mieqInit (&pKeyboard->public, &pPointer->public);
-
- AddEnabledDevice (XConnectionNumber (xdisplay));
-
- RegisterBlockAndWakeupHandlers (xglxBlockHandler,
- xglxWakeupHandler,
- NULL);
-}
-
-void
-xglxUseMsg (void)
-{
- 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");
-
- if (!xDisplayName)
- xglxUseXorgMsg ();
-}
-
-int
-xglxProcessArgument (int argc,
- char **argv,
- int i)
-{
- static Bool checkDisplayName = FALSE;
-
- if (!checkDisplayName)
- {
- char *display = ":0";
- int j;
-
- for (j = i; j < argc; j++)
- {
- if (!strcmp (argv[j], "-display"))
- {
- if (++j < argc)
- xDisplayName = argv[j];
-
- break;
- }
- else if (argv[j][0] == ':')
- {
- display = argv[j];
- }
- }
-
- if (!xDisplayName)
- xDisplayName = getenv ("DISPLAY");
-
- if (xDisplayName)
- {
- int n;
-
- n = strspn (xDisplayName, ":0123456789");
- if (strncmp (xDisplayName, display, n) == 0)
- xDisplayName = 0;
- }
-
- if (xDisplayName)
- fullscreen = FALSE;
-
- checkDisplayName = TRUE;
- }
-
- 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;
- }
- else if (!strcmp (argv[i], "-display"))
- {
- if (++i < argc)
- return 2;
-
- return 0;
- }
- else if (!strcmp (argv[i], "-softcursor"))
- {
- softCursor = TRUE;
- return 1;
- }
- else if (!xDisplayName)
- {
- return xglxProcessXorgArgument (argc, argv, i);
- }
-
- return 0;
-}
-
-void
-xglxAbort (void)
-{
- xglxAbortXorg ();
-}
-
-void
-xglxGiveUp (void)
-{
- AbortDDX ();
-}
-
-void
-xglxOsVendorInit (void)
-{
-}
-
-#ifdef ARGB_CURSOR
-
-#include <X11/extensions/Xrender.h>
-
-static Bool
-xglxARGBCursorSupport (void)
-{
- int renderMajor, renderMinor;
-
- if (!XRenderQueryVersion (xdisplay, &renderMajor, &renderMinor))
- renderMajor = renderMinor = -1;
-
- return (renderMajor > 0 || renderMinor > 4);
-}
-
-static Cursor
-xglxCreateARGBCursor (ScreenPtr pScreen,
- CursorPtr pCursor)
-{
- Pixmap xpixmap;
- XlibGC xgc;
- XImage *ximage;
- XRenderPictFormat *xformat;
- Picture xpicture;
- Cursor cursor;
-
- XGLX_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);
-
- return cursor;
-}
-
-#endif
diff --git a/hw/xgl/glx/xglx.h b/hw/xgl/glx/xglx.h
deleted file mode 100644
index a8c8946..0000000
--- a/hw/xgl/glx/xglx.h
+++ b/dev/null
@@ -1,138 +0,0 @@
-/*
- * 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"
-
-#ifdef _XSERVER64
-#define _XSERVER64_tmp
-#undef _XSERVER64
-typedef unsigned long XID64;
-typedef unsigned long Mask64;
-typedef unsigned long Atom64;
-typedef unsigned long VisualID64;
-typedef unsigned long Time64;
-#define XID XID64
-#define Mask Mask64
-#define Atom Atom64
-#define VisualID VisualID64
-#define Time Time64
-typedef XID Window64;
-typedef XID Drawable64;
-typedef XID Font64;
-typedef XID Pixmap64;
-typedef XID Cursor64;
-typedef XID Colormap64;
-typedef XID GContext64;
-typedef XID KeySym64;
-#define Window Window64
-#define Drawable Drawable64
-#define Font Font64
-#define Pixmap Pixmap64
-#define Cursor Cursor64
-#define Colormap Colormap64
-#define GContext GContext64
-#define KeySym KeySym64
-#endif
-
-#define GC XlibGC
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#undef GC
-
-#ifdef _XSERVER64_tmp
-#ifndef _XSERVER64
-#define _XSERVER64
-#endif
-#undef _XSERVER64_tmp
-#undef XID
-#undef Mask
-#undef Atom
-#undef VisualID
-#undef Time
-#undef Window
-#undef Drawable
-#undef Font
-#undef Pixmap
-#undef Cursor
-#undef Colormap
-#undef GContext
-#undef KeySym
-#endif
-
-void
-xglxInitOutput (ScreenInfo *pScreenInfo,
- int argc,
- char **argv);
-
-Bool
-xglxLegalModifier (unsigned int key,
- DeviceIntPtr 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);
-
-#ifndef NXGLXORG
-
-void
-xglxUseXorgMsg (void);
-
-int
-xglxProcessXorgArgument (int argc,
- char **argv,
- int i);
-
-void
-xglxAbortXorg (void);
-
-char *
-xglxInitXorg (void);
-
-#endif
-
-#endif /* _XGLX_H_ */
diff --git a/hw/xgl/glx/xglxinit.c b/hw/xgl/glx/xglxinit.c
deleted file mode 100644
index 0348d1f..0000000
--- a/hw/xgl/glx/xglxinit.c
+++ b/dev/null
@@ -1,168 +0,0 @@
-/*
- * 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"
-#include "xglglx.h"
-
-xglScreenInfoRec xglScreenInfo = {
- NULL, 0, 0, 0, 0, 0,
- DEFAULT_GEOMETRY_DATA_TYPE,
- DEFAULT_GEOMETRY_USAGE,
- FALSE,
- XGL_DEFAULT_PBO_MASK,
- FALSE,
- {
- { FALSE, FALSE, { 0, 0, 0, 0 } },
- { FALSE, FALSE, { 0, 0, 0, 0 } },
- { FALSE, FALSE, { 0, 0, 0, 0 } },
- { FALSE, FALSE, { 0, 0, 0, 0 } }
- }
-};
-
-#ifdef GLXEXT
-static Bool loadGlx = TRUE;
-
-#ifndef NGLXEXTLOG
-static char *glxExtLogFile = 0;
-#endif
-
-#endif
-
-void
-InitOutput (ScreenInfo *pScreenInfo,
- int argc,
- char **argv)
-{
-
-#ifdef GLXEXT
- if (loadGlx)
- {
- if (!xglLoadGLXModules ())
- FatalError ("No GLX modules loaded");
-
-#ifndef NGLXEXTLOG
- if (glxExtLogFile)
- {
- __xglGLXLogFp = fopen (glxExtLogFile, "w");
- if (!__xglGLXLogFp)
- perror ("InitOutput");
- }
- else
- __xglGLXLogFp = 0;
-#endif
-
- }
-#endif
-
- xglxInitOutput (pScreenInfo, argc, argv);
-}
-
-Bool
-LegalModifier (unsigned int key,
- DeviceIntPtr pDev)
-{
- return xglxLegalModifier (key, pDev);
-}
-
-void
-ProcessInputEvents (void)
-{
- xglxProcessInputEvents ();
-}
-
-void
-InitInput (int argc,
- char **argv)
-{
- xglxInitInput (argc, argv);
-}
-
-void
-ddxUseMsg (void)
-{
- ErrorF ("\nXgl usage:\n");
-
-#ifdef GLXEXT
- ErrorF ("-noglx don't load glx extension\n");
-
-#ifndef NGLXEXTLOG
- ErrorF ("-glxlog file glx extension log file\n");
-#endif
-
-#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;
- }
-
-#ifndef NGLXEXTLOG
- else if (!strcmp (argv[i], "-glxlog"))
- {
- if (++i < argc)
- glxExtLogFile = argv[i];
- }
-#endif
-
-#endif
-
- skip = xglProcessArgument (argc, argv, i);
- if (skip)
- return skip;
-
- return xglxProcessArgument (argc, argv, i);
-}
-
-void
-AbortDDX (void)
-{
- xglxAbort ();
-}
-
-void
-ddxGiveUp (void)
-{
- xglxGiveUp ();
-}
-
-void
-OsVendorInit (void)
-{
- xglxOsVendorInit ();
-}
diff --git a/hw/xgl/glx/xglxorg.c b/hw/xgl/glx/xglxorg.c
deleted file mode 100644
index 1d6fc9a..0000000
--- a/hw/xgl/glx/xglxorg.c
+++ b/dev/null
@@ -1,674 +0,0 @@
-/*
- * 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.
- *
- * Authors: David Reveman <davidr@novell.com>
- * Matthias Hopf <mhopf@suse.de>
- */
-
-#include "xglx.h"
-
-#ifndef NXGLXORG
-
-#include <X11/Xauth.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-#include <ctype.h>
-#include <signal.h>
-#include <setjmp.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <sys/stat.h>
-#include <libgen.h>
-
-typedef void (*sighandler_t) (int);
-
-#define XORG_DIE_TIMEOUT 3
-#define XORG_DEV_RANDOM "/dev/urandom"
-
-static char xorgAuthBuf[256];
-static char *xorgAuthTempl = "/tmp/.Xgl-auth-XXXXXX";
-static char *xorgAuth = NULL;
-
-static char *xorgProgs[] = { "/usr/bin/Xorg", "/usr/X11R6/bin/Xorg" };
-static char *xorgProg = NULL;
-
-static char *xorgDisplay = ":93";
-static char *xorgTerminate = "-terminate";
-
-static pid_t xorgPid = 0;
-static int receivedUsr1 = 0;
-static jmp_buf jumpbuf;
-
-static Bool waitAndExit = FALSE;
-
-static char **xorgArgv = 0;
-static int nXorgArgv = 0;
-
-typedef struct _xglxArg *xglxArgPtr;
-
-typedef int (*xglxProcessArgumentProc) (xglxArgPtr, int, char **, int);
-
-typedef struct _xglxArg {
- xglxProcessArgumentProc processArgument;
- const char *name;
- const char *usage;
-} xglxArgRec;
-
-static int
-xglxAddXorgArguments (char **argv,
- int n)
-{
- char **newArgv;
- int i;
-
- newArgv = xrealloc (xorgArgv, sizeof (char *) * (nXorgArgv + n));
- if (!newArgv)
- return 0;
-
- for (i = 0; i < n; i++)
- newArgv[nXorgArgv + i] = argv[i];
-
- xorgArgv = newArgv;
- nXorgArgv += n;
-
- return n;
-}
-
-static int
-xglxProcessCommonXorgArgument (xglxArgPtr pArg,
- int n,
- int argc,
- char **argv,
- int i)
-{
- if (strcmp (argv[i], pArg->name) == 0)
- {
- if (i + n - 1 < argc)
- return xglxAddXorgArguments (&argv[i], n);
- }
-
- return 0;
-}
-
-#define PROCESS_COMMON_XORG_ARGUMENT_IMP(args) \
- static int \
- xglxProcess ## args ## CommonXorgArgument (xglxArgPtr pArg, \
- int argc, \
- char **argv, \
- int i) \
- { \
- return xglxProcessCommonXorgArgument (pArg, args, argc, argv, i); \
- }
-
-PROCESS_COMMON_XORG_ARGUMENT_IMP (1)
-PROCESS_COMMON_XORG_ARGUMENT_IMP (2)
-
-static int
-xglxProcessXorgVTArgument (xglxArgPtr pArg,
- int argc,
- char **argv,
- int i)
-{
- if (argv[i][0] == 'v' && argv[i][1] == 't' &&
- strspn (&argv[i][2], "0123456789") == strlen (&argv[i][2]))
- return xglxAddXorgArguments (&argv[i], 1);
-
- return 0;
-}
-
-static int
-xglxProcessXorgAcArgument (xglxArgPtr pArg,
- int argc,
- char **argv,
- int i)
-{
- static char *ac = "-ac";
-
- if (strcmp (argv[i], pArg->name) == 0)
- {
- if (xglxAddXorgArguments (&ac, 1))
- return 1;
- }
-
- return 0;
-}
-
-static int
-xglxProcessXorgVersionArgument (xglxArgPtr pArg,
- int argc,
- char **argv,
- int i)
-{
- static char *version = "-version";
-
- if (strcmp (argv[i], pArg->name) == 0)
- {
- if (xglxAddXorgArguments (&version, 1))
- {
- waitAndExit = TRUE;
- return 1;
- }
- }
-
- return 0;
-}
-
-static int
-xglxProcessXorgProgArgument (xglxArgPtr pArg,
- int argc,
- char **argv,
- int i)
-{
- if (strcmp (argv[i], pArg->name) == 0)
- {
- if (i + 1 < argc)
- {
- xorgProg = argv[i + 1];
- return 2;
- }
- }
-
- return 0;
-}
-
-static int
-xglxProcessXorgDisplayArgument (xglxArgPtr pArg,
- int argc,
- char **argv,
- int i)
-{
- if (strcmp (argv[i], pArg->name) == 0)
- {
- if (i + 1 < argc)
- {
- xorgDisplay = argv[i + 1];
- return 2;
- }
- }
-
- return 0;
-}
-
-static int
-xglxProcessXorgWaitExitArgument (xglxArgPtr pArg,
- int argc,
- char **argv,
- int i)
-{
- if (xglxProcessCommonXorgArgument (pArg, 1, argc, argv, i))
- {
- waitAndExit = TRUE;
- return 1;
- }
-
- return 0;
-}
-
-#define ARG(processArgument, name, usage) \
- { processArgument, name, usage }
-
-#define XORG_ARG(name, args) \
- ARG (xglxProcess ## args ## CommonXorgArgument, name, 0)
-
-#define XORG_UARG(name, usage, args) \
- ARG (xglxProcess ## args ## CommonXorgArgument, name, usage)
-
-xglxArgRec xorgUid0Args[] = {
- XORG_UARG ("-modulepath", " paths specify the module search path", 2),
- XORG_UARG ("-logfile", " file specify a log file name", 2),
- ARG (xglxProcessXorgWaitExitArgument, "-configure",
- " probe for devices and write an Xorg config")
-};
-
-xglxArgRec xorgUidArgs[] = {
- XORG_UARG ("-config",
- " file specify configuration file, relative to the\n"
- " Xorg config search path, "
- "only root can use absolute", 2)
-};
-
-xglxArgRec xorgArgs[] = {
- ARG (xglxProcessXorgWaitExitArgument, "-probeonly",
- " probe for devices, then exit"),
- XORG_UARG ("-verbose", " [n] verbose startup messages", 2),
- XORG_UARG ("-logverbose", " [n] verbose log messages", 2),
- XORG_UARG ("-quiet", " minimal startup messages", 1),
- XORG_UARG ("-depth", " n set colour depth. Default: 8", 2),
- XORG_UARG ("-gamma",
- " f set gamma value (0.1 < f < 10.0) "
- "Default: 1.0", 2),
- XORG_UARG ("-rgamma", " f set gamma value for red phase", 2),
- XORG_UARG ("-ggamma", " f set gamma value for green phase",
- 2),
- XORG_UARG ("-bgamma", " f set gamma value for blue phase", 2),
- XORG_UARG ("-layout",
- " name specify the ServerLayout section name", 2),
- XORG_UARG ("-screen",
- " name specify the Screen section name", 2),
- XORG_UARG ("-keyboard",
- " name specify the core keyboard InputDevice name", 2),
- XORG_UARG ("-pointer",
- " name specify the core pointer InputDevice name", 2),
- XORG_UARG ("-nosilk", " disable Silken Mouse", 1),
- XORG_UARG ("-disableModInDev",
- " disable dynamic modification of input device settings",
- 1),
- XORG_UARG ("-allowMouseOpenFail",
- " start server even if the mouse can't be initialized", 1),
- XORG_UARG ("-bestRefresh",
- " choose modes with the best refresh rate", 1),
- XORG_UARG ("-ignoreABI",
- " make module ABI mismatches non-fatal", 1),
- XORG_UARG ("-isolateDevice",
- " bus_id restrict device resets to bus_id (PCI only)", 2),
- ARG (xglxProcessXorgVTArgument, "vtXX",
- " use the specified VT number"),
- XORG_UARG ("-keeptty",
- " don't detach controlling tty "
- "(for debugging only)", 1),
- XORG_UARG ("-novtswitch", " don't immediately switch to new VT",
- 1),
- XORG_UARG ("-sharevts", " share VTs with another X server",
- 1),
- ARG (xglxProcessXorgAcArgument, "-xorgAc",
- " disable access control restrictions"),
- ARG (xglxProcessXorgProgArgument, "-xorgProgram",
- " server program"),
- ARG (xglxProcessXorgDisplayArgument, "-xorgDisplay",
- " server display"),
- ARG (xglxProcessXorgVersionArgument, "-xorgVersion",
- " show the server version")
-};
-
-xglxArgRec sharedArgs[] = {
- XORG_ARG ("-br", 1)
-};
-
-void
-xglxUseXorgMsg (void)
-{
- int i;
-
- ErrorF ("\nXorg usage:\n");
-
- if (getuid () == 0)
- {
- for (i = 0; i < sizeof (xorgUid0Args) / sizeof (xglxArgRec); i++)
- ErrorF ("%s%s\n", xorgUid0Args[i].name, xorgUid0Args[i].usage);
- }
- else
- {
- for (i = 0; i < sizeof (xorgUidArgs) / sizeof (xglxArgRec); i++)
- ErrorF ("%s%s\n", xorgUidArgs[i].name, xorgUidArgs[i].usage);
- }
-
- for (i = 0; i < sizeof (xorgArgs) / sizeof (xglxArgRec); i++)
- ErrorF ("%s%s\n", xorgArgs[i].name, xorgArgs[i].usage);
-}
-
-int
-xglxProcessXorgArgument (int argc,
- char **argv,
- int i)
-{
- int skip, j;
-
- if (nXorgArgv == 0)
- {
- if (!xglxAddXorgArguments (&xorgProg, 1))
- return 0;
- }
-
- if (getuid () == 0)
- {
- for (j = 0; j < sizeof (xorgUid0Args) / sizeof (xglxArgRec); j++)
- {
- skip = (*xorgUid0Args[j].processArgument) (&xorgUid0Args[j],
- argc, argv, i);
- if (skip)
- return skip;
- }
- }
- else
- {
- for (j = 0; j < sizeof (xorgUidArgs) / sizeof (xglxArgRec); j++)
- {
- skip = (*xorgUidArgs[j].processArgument) (&xorgUidArgs[j],
- argc, argv, i);
- if (skip)
- return skip;
- }
- }
-
- for (j = 0; j < sizeof (xorgArgs) / sizeof (xorgArgs[0]); j++)
- {
- skip = (*xorgArgs[j].processArgument) (&xorgArgs[j], argc, argv, i);
- if (skip)
- return skip;
- }
-
- for (j = 0; j < sizeof (sharedArgs) / sizeof (sharedArgs[0]); j++)
- {
- skip = (*sharedArgs[j].processArgument) (&sharedArgs[j], argc, argv, i);
- if (skip)
- return 0;
- }
-
- return 0;
-}
-
-static void
-sigAlarm (int sig)
-{
- ErrorF ("%s won't die, killing it\n", basename (xorgProg));
-
- kill (xorgPid, SIGKILL);
- if (xorgPid)
- while (waitpid (xorgPid, NULL, 0) == -1 && errno == EINTR);
-}
-
-void
-xglxAbortXorg (void)
-{
- sighandler_t oldSigAlarm;
- unsigned int oldAlarm;
- int status = 0;
- char *name;
-
- if (!xorgPid)
- return;
-
- name = basename (xorgProg);
-
- oldAlarm = alarm (0);
- oldSigAlarm = signal (SIGALRM, sigAlarm);
-
- kill (xorgPid, SIGTERM);
-
- alarm (XORG_DIE_TIMEOUT);
- while (waitpid (xorgPid, &status, 0) == -1 && errno == EINTR);
- alarm (0);
-
- signal (SIGALRM, oldSigAlarm);
- alarm (oldAlarm);
-
- if (WIFEXITED (status))
- {
- if (WEXITSTATUS (status))
- ErrorF ("%s died, exit status %d\n", name, WEXITSTATUS (status));
- }
- else if (WIFSIGNALED (status))
- ErrorF ("%s died, signal %d\n", name, WTERMSIG (status));
- else
- ErrorF ("%s died, dubious exit\n", name);
-
- if (xorgAuth)
- unlink (xorgAuth);
-}
-
-static void
-sigUsr1Waiting (int sig)
-{
- signal (sig, sigUsr1Waiting);
- receivedUsr1++;
-}
-
-static void
-sigUsr1Jump (int sig)
-{
-
-#ifdef HAVE_SIGPROCMASK
- sigset_t set;
-#endif
-
- signal (sig, sigUsr1Waiting);
-
-#ifdef HAVE_SIGPROCMASK
- sigemptyset (&set);
- sigaddset (&set, SIGUSR1);
- sigprocmask (SIG_UNBLOCK, &set, NULL);
-#endif
-
- longjmp (jumpbuf, 1);
-}
-
-#define AUTH_DATA_LEN 16 /* bytes of authorization data */
-
-static Bool
-xglxSetupAuth (char *name, int authFd)
-{
- Xauth auth;
- int randomFd;
- ssize_t bytes, size;
- char authHost[256];
- char authData[AUTH_DATA_LEN];
- FILE *file;
-
- auth.family = FamilyLocal;
-
- gethostname (authHost, sizeof (authHost));
-
- auth.address = authHost;
- auth.address_length = strlen (authHost);
-
- auth.number = strrchr (xorgDisplay, ':');
- if (!auth.number)
- {
- ErrorF ("Bad Xorg display name: %s\n", xorgDisplay);
- return FALSE;
- }
-
- auth.number++;
-
- auth.number_length = strlen (auth.number);
- if (!auth.number_length)
- {
- ErrorF ("Bad Xorg display name: %s\n", xorgDisplay);
- return FALSE;
- }
-
- auth.name = "MIT-MAGIC-COOKIE-1";
- auth.name_length = strlen (auth.name);
-
- randomFd = open (XORG_DEV_RANDOM, O_RDONLY);
- if (randomFd == -1)
- {
- ErrorF ("Failed to open " XORG_DEV_RANDOM "\n");
- return FALSE;
- }
-
- bytes = 0;
- do {
- size = read (randomFd, authData + bytes, AUTH_DATA_LEN - bytes);
- if (size <= 0)
- break;
-
- bytes += size;
- } while (bytes != AUTH_DATA_LEN);
-
- close (randomFd);
-
- if (bytes != AUTH_DATA_LEN)
- {
- ErrorF ("Failed to read %d random bytes from " XORG_DEV_RANDOM "\n",
- AUTH_DATA_LEN);
- return FALSE;
- }
-
- auth.data = authData;
- auth.data_length = AUTH_DATA_LEN;
-
- file = fdopen (authFd, "w");
- if (!file)
- {
- ErrorF ("Failed to open authorization file: %s\n", name);
- close (authFd);
- return FALSE;
- }
-
- XauWriteAuth (file, &auth);
- fclose (file);
-
- return TRUE;
-}
-
-char *
-xglxInitXorg (void)
-{
- sighandler_t oldSigUsr1;
- pid_t pid;
- char *name;
- char *auth[] = { "-auth", xorgAuthBuf, "-nolisten", "tcp" };
- char *saver[] = { "-dpms", "-v", "-s", "0" };
- char *endArg = NULL;
- int authFd;
- int mask;
-
- if (xorgPid)
- return xorgDisplay;
-
- if (!xorgProg)
- {
- struct stat buf;
- int i;
-
- for (i = 0; i < sizeof (xorgProgs) / sizeof (char *); i++)
- {
- if (stat (xorgProgs[i], &buf) == 0)
- {
- xorgProg = xorgProgs[i];
- break;
- }
- }
-
- if (!xorgProg)
- FatalError ("Can't find Xorg executable\n");
- }
-
- strcpy (xorgAuthBuf, xorgAuthTempl);
- mask = umask (0077);
- authFd = mkstemp (xorgAuthBuf);
- umask (mask);
- if (authFd == -1)
- FatalError ("Failed to generate unique authorization file\n");
-
- xorgAuth = xorgAuthBuf;
-
- if (nXorgArgv == 0)
- {
- if (!xglxAddXorgArguments (&xorgProg, 1))
- return 0;
- }
- else
- {
- xorgArgv[0] = xorgProg;
- }
-
- if (!xglxAddXorgArguments (auth, sizeof (auth) / sizeof (char *)))
- return 0;
-
- if (!xglxAddXorgArguments (saver, sizeof (saver) / sizeof (char *)))
- return 0;
-
- if (!xglxAddXorgArguments (&xorgDisplay, 1))
- return 0;
-
- if (!xglxAddXorgArguments (&xorgTerminate, 1))
- return 0;
-
- if (!xglxAddXorgArguments (&endArg, 1))
- return 0;
-
- name = basename (xorgProg);
-
- if (!xglxSetupAuth (xorgAuth, authFd))
- FatalError ("Failed to set up authorization: %s\n", xorgAuth);
-
- oldSigUsr1 = signal (SIGUSR1, sigUsr1Waiting);
-
- pid = fork ();
-
- switch (pid) {
- case -1:
- perror ("fork");
- FatalError ("fork");
- break;
- case 0:
- signal (SIGUSR1, SIG_IGN);
- execv (xorgArgv[0], xorgArgv);
- perror (xorgArgv[0]);
- exit (2);
- break;
- default:
- xorgPid = pid;
- break;
- }
-
- for (;;)
- {
- int status;
-
- signal (SIGUSR1, sigUsr1Waiting);
- if (setjmp (jumpbuf) && !waitAndExit)
- break;
-
- signal (SIGUSR1, sigUsr1Jump);
- if (receivedUsr1 && !waitAndExit)
- break;
-
- if (waitpid (xorgPid, &status, 0) != -1)
- {
- if (WIFEXITED (status))
- {
- if (waitAndExit)
- {
- if (WEXITSTATUS (status))
- FatalError ("%s died, exit status %d\n", name,
- WEXITSTATUS (status));
-
- exit (WEXITSTATUS (status));
- }
- else
- {
- FatalError ("%s died, exit status %d\n", name,
- WEXITSTATUS (status));
- }
- }
- else if (WIFSIGNALED (status))
- FatalError ("%s died, signal %d\n", name, WTERMSIG (status));
- else
- FatalError ("%s died, dubious exit\n", name);
- }
- }
-
- signal (SIGUSR1, oldSigUsr1);
-
- setenv ("XAUTHORITY", xorgAuth, 1);
-
- return xorgDisplay;
-}
-
-#endif
diff --git a/hw/xgl/glxext/Makefile.am b/hw/xgl/glxext/Makefile.am
deleted file mode 100644
index f79b855..0000000
--- a/hw/xgl/glxext/Makefile.am
+++ b/dev/null
@@ -1,21 +0,0 @@
-SUBDIRS = module
-
-AM_CFLAGS = \
- $(DIX_CFLAGS) \
- -DHAVE_XGL_CONFIG_H \
- -DHAVE_DIX_CONFIG_H \
- $(XGLMODULES_CFLAGS) \
- -I$(top_srcdir)/glx \
- -I$(top_srcdir)/GL/include \
- -I$(top_srcdir)/hw/xgl \
- -I@MESA_SOURCE@/include \
- -I@MESA_SOURCE@/src/mesa/glapi
-
-libxglglxext_libraries = libxglglxext.la
-libxglglxext_la_SOURCES = \
- xglglxext.h \
- xglglxext.c \
- xglglxlog.c
-
-noinst_LTLIBRARIES = $(libxglglxext_libraries)
-
diff --git a/hw/xgl/glxext/module/Makefile.am b/hw/xgl/glxext/module/Makefile.am
deleted file mode 100644
index 67653cd..0000000
--- a/hw/xgl/glxext/module/Makefile.am
+++ b/dev/null
@@ -1,22 +0,0 @@
-AM_CFLAGS = \
- $(DIX_CFLAGS) \
- -DHAVE_XGL_CONFIG_H \
- -DHAVE_DIX_CONFIG_H \
- $(XGLMODULES_CFLAGS) \
- -I$(top_srcdir)/hw/xgl
-
-libglx_la_LDFLAGS = -avoid-version
-libglx_la_SOURCES = glxmodule.c
-libglx_la_LIBADD = $(top_builddir)/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 = @XGL_MODULE_PATH@
-
-module_LTLIBRARIES = \
- $(libglcore_modules) \
- $(libglx_modules)
diff --git a/hw/xgl/glxext/module/glcoremodule.c b/hw/xgl/glxext/module/glcoremodule.c
deleted file mode 100644
index 37aa9c6..0000000
--- a/hw/xgl/glxext/module/glcoremodule.c
+++ b/dev/null
@@ -1,38 +0,0 @@
-/*
- * 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
deleted file mode 100644
index 37aa9c6..0000000
--- a/hw/xgl/glxext/module/glxmodule.c
+++ b/dev/null
@@ -1,38 +0,0 @@
-/*
- * 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/xglglxext.c b/hw/xgl/glxext/xglglxext.c
deleted file mode 100644
index c260d8e..0000000
--- a/hw/xgl/glxext/xglglxext.c
+++ b/dev/null
@@ -1,5772 +0,0 @@
-/*
- * 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 "xglglx.h"
-#include "xglglxext.h"
-
-#include <GL/gl.h>
-#include <GL/glext.h>
-#include <GL/internal/glcore.h>
-
-#include "glxserver.h"
-#include "glxdrawable.h"
-#include "glxscreens.h"
-#include "glxutil.h"
-#include "unpack.h"
-#include "g_disptab.h"
-#include "glapitable.h"
-#include "glxext.h"
-#include "micmap.h"
-
-#define XGL_MAX_TEXTURE_UNITS 8
-#define XGL_MAX_ATTRIB_STACK_DEPTH 16
-
-#define XGL_TEXTURE_1D_BIT (1 << 0)
-#define XGL_TEXTURE_2D_BIT (1 << 1)
-#define XGL_TEXTURE_3D_BIT (1 << 2)
-#define XGL_TEXTURE_RECTANGLE_BIT (1 << 3)
-#define XGL_TEXTURE_CUBE_MAP_BIT (1 << 4)
-
-typedef Bool (*GLXScreenProbeProc) (int screen);
-typedef __GLinterface *(*GLXCreateContextProc) (__GLimports *imports,
- __GLcontextModes *modes,
- __GLinterface *shareGC);
-typedef void (*GLXCreateBufferProc) (__GLXdrawablePrivate *glxPriv);
-typedef GLboolean (*GLXSwapBuffersProc) (__GLXdrawablePrivate *glxPriv);
-typedef int (*GLXBindBuffersProc) (__GLXdrawablePrivate *glxPriv,
- int buffer);
-typedef int (*GLXReleaseBuffersProc) (__GLXdrawablePrivate *glxPriv,
- int buffer);
-
-typedef struct _xglGLXScreenInfo {
- GLXScreenProbeProc screenProbe;
- GLXCreateContextProc createContext;
- GLXCreateBufferProc createBuffer;
-} xglGLXScreenInfoRec, *xglGLXScreenInfoPtr;
-
-extern __GLXscreenInfo *__xglScreenInfoPtr;
-
-static xglGLXScreenInfoRec screenInfoPriv;
-
-//extern __GLXscreenInfo __glDDXScreenInfo;
-
-typedef GLboolean (*GLResizeBuffersProc) (__GLdrawableBuffer *buffer,
- GLint x,
- GLint y,
- GLuint width,
- GLuint height,
- __GLdrawablePrivate *glPriv,
- GLuint bufferMask);
-typedef void (*GLFreeBuffersProc) (__GLdrawablePrivate *glPriv);
-
-typedef struct _xglGLBuffer {
- GLXSwapBuffersProc swapBuffers;
- GLXBindBuffersProc bindBuffers;
- GLXReleaseBuffersProc releaseBuffers;
- GLResizeBuffersProc resizeBuffers;
- GLFreeBuffersProc freeBuffers;
- ScreenPtr pScreen;
- DrawablePtr pDrawable;
- xglVisualPtr pVisual;
- glitz_drawable_t *drawable;
- glitz_surface_t *backSurface;
- PixmapPtr pPixmap;
- GCPtr pGC;
- RegionRec damage;
- void *private;
- int screenX, screenY;
- int xOff, yOff;
- int yFlip;
-} xglGLBufferRec, *xglGLBufferPtr;
-
-typedef int xglGLXVisualConfigRec, *xglGLXVisualConfigPtr;
-typedef struct _xglDisplayList *xglDisplayListPtr;
-
-#define XGL_LIST_OP_CALLS 0
-#define XGL_LIST_OP_DRAW 1
-#define XGL_LIST_OP_GL 2
-#define XGL_LIST_OP_LIST 3
-
-typedef struct _xglGLOp {
- void (*glProc) (struct _xglGLOp *pOp);
- union {
- GLenum enumeration;
- GLbitfield bitfield;
- GLsizei size;
- struct {
- GLint x;
- GLint y;
- GLsizei width;
- GLsizei height;
- } rect;
- struct {
- GLenum target;
- GLuint texture;
- } bind_texture;
- struct {
- GLenum target;
- GLenum pname;
- GLfloat params[4];
- } tex_parameter_fv;
- struct {
- GLint x;
- GLint y;
- GLsizei width;
- GLsizei height;
- GLenum type;
- } copy_pixels;
- struct {
- GLenum target;
- GLint level;
- GLenum internalformat;
- GLint x;
- GLint y;
- GLsizei width;
- GLint border;
- } copy_tex_image_1d;
- struct {
- GLenum target;
- GLint level;
- GLenum internalformat;
- GLint x;
- GLint y;
- GLsizei width;
- GLsizei height;
- GLint border;
- } copy_tex_image_2d;
- struct {
- GLenum target;
- GLint level;
- GLint xoffset;
- GLint x;
- GLint y;
- GLsizei width;
- } copy_tex_sub_image_1d;
- struct {
- GLenum target;
- GLint level;
- GLint xoffset;
- GLint yoffset;
- GLint x;
- GLint y;
- GLsizei width;
- GLsizei height;
- } copy_tex_sub_image_2d;
- struct {
- GLenum target;
- GLenum internalformat;
- GLint x;
- GLint y;
- GLsizei width;
- } copy_color_table;
- struct {
- GLenum target;
- GLsizei start;
- GLint x;
- GLint y;
- GLsizei width;
- } copy_color_sub_table;
- struct {
- GLenum target;
- GLenum internalformat;
- GLint x;
- GLint y;
- GLsizei width;
- } copy_convolution_filter_1d;
- struct {
- GLenum target;
- GLenum internalformat;
- GLint x;
- GLint y;
- GLsizei width;
- GLsizei height;
- } copy_convolution_filter_2d;
- struct {
- GLenum target;
- GLint level;
- GLint xoffset;
- GLint yoffset;
- GLint zoffset;
- GLint x;
- GLint y;
- GLsizei width;
- GLsizei height;
- } copy_tex_sub_image_3d;
- struct {
- GLfloat x;
- GLfloat y;
- GLfloat z;
- } window_pos_3f;
- } u;
-} xglGLOpRec, *xglGLOpPtr;
-
-typedef struct _xglListOp {
- int type;
- union {
- GLuint list;
- xglGLOpPtr gl;
- } u;
-} xglListOpRec, *xglListOpPtr;
-
-typedef struct _xglDisplayList {
- xglListOpPtr pOp;
- int nOp;
- int size;
-} xglDisplayListRec;
-
-typedef struct _xglTexObj {
- GLuint key;
- GLuint name;
- PixmapPtr pPixmap;
- glitz_texture_object_t *object;
- int refcnt;
-} xglTexObjRec, *xglTexObjPtr;
-
-typedef struct _xglTexUnit {
- GLbitfield enabled;
- xglTexObjPtr p1D;
- xglTexObjPtr p2D;
- xglTexObjPtr p3D;
- xglTexObjPtr pRect;
- xglTexObjPtr pCubeMap;
-} xglTexUnitRec, *xglTexUnitPtr;
-
-typedef struct _xglGLAttributes {
- GLbitfield mask;
- GLenum drawBuffer;
- GLenum readBuffer;
- xRectangle viewport;
- xRectangle scissor;
- GLboolean scissorTest;
- xglTexUnitRec texUnits[XGL_MAX_TEXTURE_UNITS];
-} xglGLAttributesRec, *xglGLAttributesPtr;
-
-typedef struct _xglGLContext {
- __GLinterface iface;
- __GLinterface *mIface;
- int refcnt;
- struct _xglGLContext *shared;
- glitz_context_t *context;
- struct _glapi_table glRenderTable;
- PFNGLACTIVETEXTUREARBPROC ActiveTextureARB;
- PFNGLWINDOWPOS3FMESAPROC WindowPos3fMESA;
- Bool needInit;
- xglGLBufferPtr pDrawBuffer;
- xglGLBufferPtr pReadBuffer;
- int drawXoff, drawYoff;
- __GLdrawablePrivate *readPriv;
- __GLdrawablePrivate *drawPriv;
- char *versionString;
- GLenum errorValue;
- GLboolean doubleBuffer;
- GLint depthBits;
- GLint stencilBits;
- xglHashTablePtr texObjects;
- xglHashTablePtr displayLists;
- GLuint list;
- GLenum listMode;
- GLuint beginCnt;
- xglDisplayListPtr pList;
- GLuint groupList;
- xglGLAttributesRec attrib;
- xglGLAttributesRec attribStack[XGL_MAX_ATTRIB_STACK_DEPTH];
- int nAttribStack;
- int activeTexUnit;
- GLint maxTexUnits;
- GLint maxListNesting;
- GLint maxAttribStackDepth;
-} xglGLContextRec, *xglGLContextPtr;
-
-static xglGLContextPtr cctx = NULL;
-
-static void
-xglSetCurrentContext (xglGLContextPtr pContext);
-
-#define XGL_GLX_DRAW_PROLOGUE_WITHOUT_TEXTURES(pBox, nBox, pScissorBox) \
- (pBox) = REGION_RECTS (cctx->pDrawBuffer->pGC->pCompositeClip); \
- (nBox) = REGION_NUM_RECTS (cctx->pDrawBuffer->pGC->pCompositeClip); \
- (pScissorBox)->x1 = cctx->attrib.scissor.x + cctx->pDrawBuffer->xOff; \
- (pScissorBox)->x2 = (pScissorBox)->x1 + cctx->attrib.scissor.width; \
- (pScissorBox)->y2 = cctx->attrib.scissor.y + cctx->pDrawBuffer->yOff; \
- (pScissorBox)->y2 = cctx->pDrawBuffer->yFlip - (pScissorBox)->y2; \
- (pScissorBox)->y1 = (pScissorBox)->y2 - cctx->attrib.scissor.height
-
-#define XGL_GLX_DRAW_PROLOGUE(pBox, nBox, pScissorBox) \
- XGL_GLX_DRAW_PROLOGUE_WITHOUT_TEXTURES (pBox, nBox, pScissorBox); \
- xglSetupTextures ()
-
-#define XGL_GLX_DRAW_BOX(pBox1, pBox2) \
- (pBox1)->x1 = cctx->pDrawBuffer->screenX + (pBox2)->x1; \
- (pBox1)->y1 = cctx->pDrawBuffer->screenY + (pBox2)->y1; \
- (pBox1)->x2 = cctx->pDrawBuffer->screenX + (pBox2)->x2; \
- (pBox1)->y2 = cctx->pDrawBuffer->screenY + (pBox2)->y2
-
-#define XGL_GLX_INTERSECT_BOX(pBox1, pBox2) \
- { \
- if ((pBox1)->x1 < (pBox2)->x1) \
- (pBox1)->x1 = (pBox2)->x1; \
- if ((pBox1)->y1 < (pBox2)->y1) \
- (pBox1)->y1 = (pBox2)->y1; \
- if ((pBox1)->x2 > (pBox2)->x2) \
- (pBox1)->x2 = (pBox2)->x2; \
- if ((pBox1)->y2 > (pBox2)->y2) \
- (pBox1)->y2 = (pBox2)->y2; \
- }
-
-#define XGL_GLX_SET_SCISSOR_BOX(pBox) \
- glScissor ((pBox)->x1, \
- cctx->pDrawBuffer->yFlip - (pBox)->y2, \
- (pBox)->x2 - (pBox)->x1, \
- (pBox)->y2 - (pBox)->y1)
-
-#define XGL_GLX_DRAW_DAMAGE(pBox, pRegion) \
- if (cctx->attrib.drawBuffer != GL_BACK) \
- { \
- (pRegion)->extents.x1 = (pBox)->x1 - cctx->pDrawBuffer->screenX; \
- (pRegion)->extents.y1 = (pBox)->y1 - cctx->pDrawBuffer->screenY; \
- (pRegion)->extents.x2 = (pBox)->x2 - cctx->pDrawBuffer->screenX; \
- (pRegion)->extents.y2 = (pBox)->y2 - cctx->pDrawBuffer->screenY; \
- (pRegion)->data = (RegDataPtr) NULL; \
- REGION_UNION (cctx->pDrawBuffer->pGC->pScreen, \
- &cctx->pDrawBuffer->damage, \
- &cctx->pDrawBuffer->damage, \
- pRegion); \
- xglAddBitDamage (cctx->pDrawBuffer->pDrawable, pRegion); \
- }
-
-static void
-xglRecordError (GLenum error)
-{
- if (cctx->errorValue == GL_NO_ERROR)
- cctx->errorValue = error;
-}
-
-static xglDisplayListPtr
-xglCreateList (void)
-{
- xglDisplayListPtr pDisplayList;
-
- pDisplayList = xalloc (sizeof (xglDisplayListRec));
- if (!pDisplayList)
- return NULL;
-
- pDisplayList->pOp = NULL;
- pDisplayList->nOp = 0;
- pDisplayList->size = 0;
-
- return pDisplayList;
-}
-
-static void
-xglDestroyList (xglDisplayListPtr pDisplayList)
-{
- xglListOpPtr pOp = pDisplayList->pOp;
- int nOp = pDisplayList->nOp;
-
- while (nOp--)
- {
- switch (pOp->type) {
- case XGL_LIST_OP_CALLS:
- case XGL_LIST_OP_DRAW:
- glDeleteLists (pOp->u.list, 1);
- break;
- case XGL_LIST_OP_GL:
- xfree (pOp->u.gl);
- break;
- case XGL_LIST_OP_LIST:
- break;
- }
-
- pOp++;
- }
-
- if (pDisplayList->pOp)
- xfree (pDisplayList->pOp);
-
- xfree (pDisplayList);
-}
-
-static Bool
-xglResizeList (xglDisplayListPtr pDisplayList,
- int nOp)
-{
- if (pDisplayList->size < nOp)
- {
- int size = pDisplayList->nOp ? pDisplayList->nOp : 4;
-
- while (size < nOp)
- size <<= 1;
-
- pDisplayList->pOp = xrealloc (pDisplayList->pOp,
- sizeof (xglListOpRec) * size);
- if (!pDisplayList->pOp)
- return FALSE;
-
- pDisplayList->size = size;
- }
-
- return TRUE;
-}
-
-static void
-xglStartList (int type,
- GLenum mode)
-{
- if (!xglResizeList (cctx->pList, cctx->pList->nOp + 1))
- {
- xglRecordError (GL_OUT_OF_MEMORY);
- return;
- }
-
- cctx->pList->pOp[cctx->pList->nOp].type = type;
- cctx->pList->pOp[cctx->pList->nOp].u.list = glGenLists (1);
-
- glNewList (cctx->pList->pOp[cctx->pList->nOp].u.list, mode);
-
- cctx->pList->nOp++;
-}
-
-static void
-xglGLOp (xglGLOpPtr pOp)
-{
- if (cctx->list)
- {
- xglGLOpPtr pGLOp;
-
- pGLOp = xalloc (sizeof (xglGLOpRec));
- if (!pGLOp)
- {
- xglRecordError (GL_OUT_OF_MEMORY);
- return;
- }
-
- if (!xglResizeList (cctx->pList, cctx->pList->nOp + 1))
- {
- xfree (pGLOp);
- xglRecordError (GL_OUT_OF_MEMORY);
- return;
- }
-
- glEndList ();
-
- *pGLOp = *pOp;
-
- cctx->pList->pOp[cctx->pList->nOp].type = XGL_LIST_OP_GL;
- cctx->pList->pOp[cctx->pList->nOp].u.gl = pGLOp;
- cctx->pList->nOp++;
-
- if (cctx->listMode == GL_COMPILE_AND_EXECUTE)
- (*pOp->glProc) (pOp);
-
- xglStartList (XGL_LIST_OP_CALLS, cctx->listMode);
- }
- else
- (*pOp->glProc) (pOp);
-}
-
-static void
-xglViewportProc (xglGLOpPtr pOp)
-{
- cctx->attrib.viewport.x = pOp->u.rect.x;
- cctx->attrib.viewport.y = pOp->u.rect.y;
- cctx->attrib.viewport.width = pOp->u.rect.width;
- cctx->attrib.viewport.height = pOp->u.rect.height;
-
- glViewport (pOp->u.rect.x + cctx->pDrawBuffer->xOff,
- pOp->u.rect.y + cctx->pDrawBuffer->yOff,
- pOp->u.rect.width,
- pOp->u.rect.height);
-}
-
-static void
-xglViewport (GLint x,
- GLint y,
- GLsizei width,
- GLsizei height)
-{
- xglGLOpRec gl;
-
- gl.glProc = xglViewportProc;
-
- gl.u.rect.x = x;
- gl.u.rect.y = y;
- gl.u.rect.width = width;
- gl.u.rect.height = height;
-
- xglGLOp (&gl);
-}
-
-static void
-xglScissorProc (xglGLOpPtr pOp)
-{
- cctx->attrib.scissor.x = pOp->u.rect.x;
- cctx->attrib.scissor.y = pOp->u.rect.y;
- cctx->attrib.scissor.width = pOp->u.rect.width;
- cctx->attrib.scissor.height = pOp->u.rect.height;
-}
-
-static void
-xglScissor (GLint x,
- GLint y,
- GLsizei width,
- GLsizei height)
-{
- xglGLOpRec gl;
-
- gl.glProc = xglScissorProc;
-
- gl.u.rect.x = x;
- gl.u.rect.y = y;
- gl.u.rect.width = width;
- gl.u.rect.height = height;
-
- xglGLOp (&gl);
-}
-
-static void
-xglDrawBufferProc (xglGLOpPtr pOp)
-{
- glitz_drawable_buffer_t buffers[2];
-
- switch (pOp->u.enumeration) {
- case GL_FRONT:
- buffers[0] = GLITZ_DRAWABLE_BUFFER_FRONT_COLOR;
- glitz_context_draw_buffers (cctx->context, buffers, 1);
- break;
- case GL_FRONT_AND_BACK:
- buffers[0] = GLITZ_DRAWABLE_BUFFER_FRONT_COLOR;
- if (cctx->doubleBuffer)
- {
- buffers[1] = GLITZ_DRAWABLE_BUFFER_BACK_COLOR;
- glitz_context_draw_buffers (cctx->context, buffers, 2);
- }
- else
- glitz_context_draw_buffers (cctx->context, buffers, 1);
- break;
- case GL_BACK:
- if (!cctx->doubleBuffer)
- {
- xglRecordError (GL_INVALID_OPERATION);
- return;
- }
- buffers[0] = GLITZ_DRAWABLE_BUFFER_BACK_COLOR;
- glitz_context_draw_buffers (cctx->context, buffers, 1);
- break;
- default:
- xglRecordError (GL_INVALID_ENUM);
- return;
- }
-
- cctx->attrib.drawBuffer = pOp->u.enumeration;
-}
-
-static void
-xglDrawBuffer (GLenum mode)
-{
- xglGLOpRec gl;
-
- gl.glProc = xglDrawBufferProc;
-
- gl.u.enumeration = mode;
-
- xglGLOp (&gl);
-}
-
-static void
-xglReadBufferProc (xglGLOpPtr pOp)
-{
- switch (pOp->u.enumeration) {
- case GL_FRONT:
- glitz_context_read_buffer (cctx->context,
- GLITZ_DRAWABLE_BUFFER_FRONT_COLOR);
- break;
- case GL_BACK:
- if (!cctx->doubleBuffer)
- {
- xglRecordError (GL_INVALID_OPERATION);
- return;
- }
- glitz_context_read_buffer (cctx->context,
- GLITZ_DRAWABLE_BUFFER_BACK_COLOR);
- break;
- default:
- xglRecordError (GL_INVALID_ENUM);
- return;
- }
-
- cctx->attrib.readBuffer = pOp->u.enumeration;
-}
-
-static void
-xglReadBuffer (GLenum mode)
-{
- xglGLOpRec gl;
-
- gl.glProc = xglReadBufferProc;
-
- gl.u.enumeration = mode;
-
- xglGLOp (&gl);
-}
-
-static void
-xglDisableProc (xglGLOpPtr pOp)
-{
- xglTexUnitPtr pTexUnit = &cctx->attrib.texUnits[cctx->activeTexUnit];
-
- switch (pOp->u.enumeration) {
- case GL_SCISSOR_TEST:
- cctx->attrib.scissorTest = GL_FALSE;
- return;
- case GL_TEXTURE_1D:
- pTexUnit->enabled &= ~XGL_TEXTURE_1D_BIT;
- break;
- case GL_TEXTURE_2D:
- pTexUnit->enabled &= ~XGL_TEXTURE_2D_BIT;
- break;
- case GL_TEXTURE_3D:
- pTexUnit->enabled &= ~XGL_TEXTURE_3D_BIT;
- break;
- case GL_TEXTURE_RECTANGLE_NV:
- pTexUnit->enabled &= ~XGL_TEXTURE_RECTANGLE_BIT;
- break;
- case GL_TEXTURE_CUBE_MAP_ARB:
- pTexUnit->enabled &= ~XGL_TEXTURE_CUBE_MAP_BIT;
- break;
- default:
- break;
- }
-
- glDisable (pOp->u.enumeration);
-}
-
-static void
-xglDisable (GLenum cap)
-{
- xglGLOpRec gl;
-
- gl.glProc = xglDisableProc;
-
- gl.u.enumeration = cap;
-
- xglGLOp (&gl);
-}
-
-static void
-xglEnableProc (xglGLOpPtr pOp)
-{
- xglTexUnitPtr pTexUnit = &cctx->attrib.texUnits[cctx->activeTexUnit];
-
- switch (pOp->u.enumeration) {
- case GL_SCISSOR_TEST:
- cctx->attrib.scissorTest = GL_TRUE;
- return;
- case GL_DEPTH_TEST:
- if (!cctx->depthBits)
- return;
- case GL_STENCIL_TEST:
- if (!cctx->stencilBits)
- return;
- case GL_TEXTURE_1D:
- pTexUnit->enabled |= XGL_TEXTURE_1D_BIT;
- break;
- case GL_TEXTURE_2D:
- pTexUnit->enabled |= XGL_TEXTURE_2D_BIT;
- break;
- case GL_TEXTURE_3D:
- pTexUnit->enabled |= XGL_TEXTURE_3D_BIT;
- break;
- case GL_TEXTURE_RECTANGLE_NV:
- pTexUnit->enabled |= XGL_TEXTURE_RECTANGLE_BIT;
- break;
- case GL_TEXTURE_CUBE_MAP_ARB:
- pTexUnit->enabled |= XGL_TEXTURE_CUBE_MAP_BIT;
- break;
- default:
- break;
- }
-
- glEnable (pOp->u.enumeration);
-}
-
-static void
-xglEnable (GLenum cap)
-{
- xglGLOpRec gl;
-
- gl.glProc = xglEnableProc;
-
- gl.u.enumeration = cap;
-
- xglGLOp (&gl);
-}
-
-static void
-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)
- {
- glDeleteTextures (1, &pTexObj->name);
- }
-
- pTexObj->key = 0;
- pTexObj->name = 0;
- pTexObj->pPixmap = NULL;
- pTexObj->object = NULL;
-}
-
-static void
-xglRefTexObj (xglTexObjPtr pTexObj)
-{
- if (!pTexObj)
- return;
-
- pTexObj->refcnt++;
-}
-
-static void
-xglUnrefTexObj (xglTexObjPtr pTexObj)
-{
- if (!pTexObj)
- return;
-
- pTexObj->refcnt--;
- if (pTexObj->refcnt)
- return;
-
- xglDeleteTexObj (pTexObj);
-
- xfree (pTexObj);
-}
-
-static void
-xglPushAttribProc (xglGLOpPtr pOp)
-{
- xglGLAttributesPtr pAttrib;
-
- if (cctx->nAttribStack == cctx->maxAttribStackDepth)
- {
- xglRecordError (GL_STACK_OVERFLOW);
- return;
- }
-
- pAttrib = &cctx->attribStack[cctx->nAttribStack];
-
- *pAttrib = cctx->attrib;
- pAttrib->mask = pOp->u.bitfield;
-
- if (pOp->u.bitfield & GL_TEXTURE_BIT)
- {
- int i;
-
- for (i = 0; i < cctx->maxTexUnits; i++)
- {
- xglRefTexObj (pAttrib->texUnits[i].p1D);
- xglRefTexObj (pAttrib->texUnits[i].p2D);
- xglRefTexObj (pAttrib->texUnits[i].p3D);
- xglRefTexObj (pAttrib->texUnits[i].pRect);
- xglRefTexObj (pAttrib->texUnits[i].pCubeMap);
- }
- }
-
- cctx->nAttribStack++;
-
- glPushAttrib (pOp->u.bitfield);
-}
-
-static void
-xglPushAttrib (GLbitfield mask)
-{
- xglGLOpRec gl;
-
- gl.glProc = xglPushAttribProc;
-
- gl.u.bitfield = mask;
-
- xglGLOp (&gl);
-}
-
-static void
-xglPopAttribProc (xglGLOpPtr pOp)
-{
- xglGLAttributesPtr pAttrib;
- GLbitfield mask;
-
- if (!cctx->nAttribStack)
- {
- xglRecordError (GL_STACK_UNDERFLOW);
- return;
- }
-
- cctx->nAttribStack--;
-
- pAttrib = &cctx->attribStack[cctx->nAttribStack];
- mask = pAttrib->mask;
-
- if (mask & GL_COLOR_BUFFER_BIT)
- xglDrawBuffer (pAttrib->drawBuffer);
-
- if (mask & GL_PIXEL_MODE_BIT)
- xglReadBuffer (pAttrib->readBuffer);
-
- if (mask & GL_SCISSOR_BIT)
- {
- xglScissor (pAttrib->scissor.x,
- pAttrib->scissor.y,
- pAttrib->scissor.width,
- pAttrib->scissor.height);
-
- if (pAttrib->scissorTest)
- xglEnable (GL_SCISSOR_TEST);
- else
- xglDisable (GL_SCISSOR_TEST);
- }
- else if (mask & GL_ENABLE_BIT)
- {
- if (pAttrib->scissorTest)
- xglEnable (GL_SCISSOR_TEST);
- else
- xglDisable (GL_SCISSOR_TEST);
- }
-
- if (mask & GL_VIEWPORT_BIT)
- xglViewport (pAttrib->viewport.x,
- pAttrib->viewport.y,
- pAttrib->viewport.width,
- pAttrib->viewport.height);
-
- if (mask & GL_TEXTURE_BIT)
- {
- int i;
-
- for (i = 0; i < cctx->maxTexUnits; i++)
- {
- xglUnrefTexObj (cctx->attrib.texUnits[i].p1D);
- xglUnrefTexObj (cctx->attrib.texUnits[i].p2D);
- xglUnrefTexObj (cctx->attrib.texUnits[i].p3D);
- xglUnrefTexObj (cctx->attrib.texUnits[i].pRect);
- xglUnrefTexObj (cctx->attrib.texUnits[i].pCubeMap);
-
- cctx->attrib.texUnits[i] = pAttrib->texUnits[i];
- }
- }
- else if (mask & GL_ENABLE_BIT)
- {
- int i;
-
- for (i = 0; i < cctx->maxTexUnits; i++)
- cctx->attrib.texUnits[i].enabled = pAttrib->texUnits[i].enabled;
- }
-
- glPopAttrib ();
-}
-
-static void
-xglPopAttrib (void)
-{
- xglGLOpRec gl;
-
- gl.glProc = xglPopAttribProc;
-
- xglGLOp (&gl);
-}
-
-static GLuint
-xglActiveTextureBinding (GLenum target)
-{
- xglTexObjPtr pTexObj;
-
- switch (target) {
- case GL_TEXTURE_BINDING_1D:
- pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].p1D;
- break;
- case GL_TEXTURE_BINDING_2D:
- pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].p2D;
- break;
- case GL_TEXTURE_BINDING_3D:
- pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].p3D;
- break;
- case GL_TEXTURE_BINDING_RECTANGLE_NV:
- pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].pRect;
- break;
- case GL_TEXTURE_BINDING_CUBE_MAP_ARB:
- pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].pCubeMap;
- break;
- default:
- return 0;
- }
-
- if (pTexObj)
- return pTexObj->key;
-
- return 0;
-}
-
-#define DOUBLE_TO_BOOLEAN(X) ((X) ? GL_TRUE : GL_FALSE)
-#define INT_TO_BOOLEAN(I) ((I) ? GL_TRUE : GL_FALSE)
-#define ENUM_TO_BOOLEAN(E) ((E) ? GL_TRUE : GL_FALSE)
-
-static void
-xglGetBooleanv (GLenum pname,
- GLboolean *params)
-{
- switch (pname) {
- case GL_CURRENT_RASTER_POSITION:
- {
- GLdouble v[4];
-
- glGetDoublev (GL_CURRENT_RASTER_POSITION, v);
-
- params[0] = DOUBLE_TO_BOOLEAN (v[0] - (GLdouble) cctx->drawXoff);
- params[1] = DOUBLE_TO_BOOLEAN (v[1] - (GLdouble) cctx->drawYoff);
- params[2] = DOUBLE_TO_BOOLEAN (v[2]);
- params[3] = DOUBLE_TO_BOOLEAN (v[3]);
- } break;
- case GL_DOUBLEBUFFER:
- params[0] = cctx->doubleBuffer;
- break;
- case GL_DEPTH_BITS:
- params[0] = INT_TO_BOOLEAN (cctx->depthBits);
- break;
- case GL_STENCIL_BITS:
- params[0] = INT_TO_BOOLEAN (cctx->stencilBits);
- break;
- case GL_DRAW_BUFFER:
- params[0] = ENUM_TO_BOOLEAN (cctx->attrib.drawBuffer);
- break;
- case GL_READ_BUFFER:
- params[0] = ENUM_TO_BOOLEAN (cctx->attrib.readBuffer);
- break;
- case GL_SCISSOR_BOX:
- params[0] = INT_TO_BOOLEAN (cctx->attrib.scissor.x);
- params[1] = INT_TO_BOOLEAN (cctx->attrib.scissor.y);
- params[2] = INT_TO_BOOLEAN (cctx->attrib.scissor.width);
- params[3] = INT_TO_BOOLEAN (cctx->attrib.scissor.height);
- break;
- case GL_SCISSOR_TEST:
- params[0] = cctx->attrib.scissorTest;
- break;
- case GL_VIEWPORT:
- params[0] = INT_TO_BOOLEAN (cctx->attrib.viewport.x);
- params[1] = INT_TO_BOOLEAN (cctx->attrib.viewport.y);
- params[2] = INT_TO_BOOLEAN (cctx->attrib.viewport.width);
- params[3] = INT_TO_BOOLEAN (cctx->attrib.viewport.height);
- break;
- case GL_TEXTURE_BINDING_1D:
- case GL_TEXTURE_BINDING_2D:
- case GL_TEXTURE_BINDING_3D:
- case GL_TEXTURE_BINDING_RECTANGLE_NV:
- case GL_TEXTURE_BINDING_CUBE_MAP_ARB:
- /* should be safe to fall-through here */
- default:
- glGetBooleanv (pname, params);
- }
-}
-
-#define INT_TO_DOUBLE(I) ((GLdouble) (I))
-#define ENUM_TO_DOUBLE(E) ((GLdouble) (E))
-#define BOOLEAN_TO_DOUBLE(B) ((B) ? 1.0F : 0.0F)
-
-static void
-xglGetDoublev (GLenum pname,
- GLdouble *params)
-{
- switch (pname) {
- case GL_CURRENT_RASTER_POSITION:
- glGetDoublev (GL_CURRENT_RASTER_POSITION, params);
-
- params[0] -= (GLdouble) cctx->drawXoff;
- params[1] -= (GLdouble) cctx->drawYoff;
- break;
- case GL_DOUBLEBUFFER:
- params[0] = BOOLEAN_TO_DOUBLE (cctx->doubleBuffer);
- break;
- case GL_DEPTH_BITS:
- params[0] = INT_TO_DOUBLE (cctx->depthBits);
- break;
- case GL_STENCIL_BITS:
- params[0] = INT_TO_DOUBLE (cctx->stencilBits);
- break;
- case GL_DRAW_BUFFER:
- params[0] = ENUM_TO_DOUBLE (cctx->attrib.drawBuffer);
- break;
- case GL_READ_BUFFER:
- params[0] = ENUM_TO_DOUBLE (cctx->attrib.readBuffer);
- break;
- case GL_SCISSOR_BOX:
- params[0] = cctx->attrib.scissor.x;
- params[1] = cctx->attrib.scissor.y;
- params[2] = cctx->attrib.scissor.width;
- params[3] = cctx->attrib.scissor.height;
- break;
- case GL_SCISSOR_TEST:
- params[0] = BOOLEAN_TO_DOUBLE (cctx->attrib.scissorTest);
- break;
- case GL_VIEWPORT:
- params[0] = cctx->attrib.viewport.x;
- params[1] = cctx->attrib.viewport.y;
- params[2] = cctx->attrib.viewport.width;
- params[3] = cctx->attrib.viewport.height;
- break;
- case GL_TEXTURE_BINDING_1D:
- case GL_TEXTURE_BINDING_2D:
- case GL_TEXTURE_BINDING_3D:
- case GL_TEXTURE_BINDING_RECTANGLE_NV:
- case GL_TEXTURE_BINDING_CUBE_MAP_ARB:
- params[0] = xglActiveTextureBinding (pname);
- break;
- case GL_MAX_TEXTURE_UNITS_ARB:
- params[0] = cctx->maxTexUnits;
- break;
- case GL_MAX_ATTRIB_STACK_DEPTH:
- params[0] = cctx->maxAttribStackDepth;
- break;
- default:
- glGetDoublev (pname, params);
- }
-}
-
-#define INT_TO_FLOAT(I) ((GLfloat) (I))
-#define ENUM_TO_FLOAT(E) ((GLfloat) (E))
-#define BOOLEAN_TO_FLOAT(B) ((B) ? 1.0F : 0.0F)
-
-static void
-xglGetFloatv (GLenum pname,
- GLfloat *params)
-{
- switch (pname) {
- case GL_CURRENT_RASTER_POSITION:
- glGetFloatv (GL_CURRENT_RASTER_POSITION, params);
-
- params[0] -= (GLfloat) cctx->drawXoff;
- params[1] -= (GLfloat) cctx->drawYoff;
- break;
- case GL_DOUBLEBUFFER:
- params[0] = BOOLEAN_TO_FLOAT (cctx->doubleBuffer);
- break;
- case GL_DEPTH_BITS:
- params[0] = INT_TO_FLOAT (cctx->depthBits);
- break;
- case GL_STENCIL_BITS:
- params[0] = INT_TO_FLOAT (cctx->stencilBits);
- break;
- case GL_DRAW_BUFFER:
- params[0] = ENUM_TO_FLOAT (cctx->attrib.drawBuffer);
- break;
- case GL_READ_BUFFER:
- params[0] = ENUM_TO_FLOAT (cctx->attrib.readBuffer);
- break;
- case GL_SCISSOR_BOX:
- params[0] = cctx->attrib.scissor.x;
- params[1] = cctx->attrib.scissor.y;
- params[2] = cctx->attrib.scissor.width;
- params[3] = cctx->attrib.scissor.height;
- break;
- case GL_SCISSOR_TEST:
- params[0] = BOOLEAN_TO_FLOAT (cctx->attrib.scissorTest);
- break;
- case GL_VIEWPORT:
- params[0] = cctx->attrib.viewport.x;
- params[1] = cctx->attrib.viewport.y;
- params[2] = cctx->attrib.viewport.width;
- params[3] = cctx->attrib.viewport.height;
- break;
- case GL_TEXTURE_BINDING_1D:
- case GL_TEXTURE_BINDING_2D:
- case GL_TEXTURE_BINDING_3D:
- case GL_TEXTURE_BINDING_RECTANGLE_NV:
- case GL_TEXTURE_BINDING_CUBE_MAP_ARB:
- params[0] = xglActiveTextureBinding (pname);
- break;
- case GL_MAX_TEXTURE_UNITS_ARB:
- params[0] = cctx->maxTexUnits;
- break;
- case GL_MAX_ATTRIB_STACK_DEPTH:
- params[0] = cctx->maxAttribStackDepth;
- break;
- default:
- glGetFloatv (pname, params);
- }
-}
-
-#define ENUM_TO_INT(E) ((GLint) (E))
-#define BOOLEAN_TO_INT(B) ((GLint) (B))
-
-static void
-xglGetIntegerv (GLenum pname,
- GLint *params)
-{
- switch (pname) {
- case GL_CURRENT_RASTER_POSITION:
- glGetIntegerv (GL_CURRENT_RASTER_POSITION, params);
-
- params[0] -= (GLint) cctx->drawXoff;
- params[1] -= (GLint) cctx->drawYoff;
- break;
- case GL_DOUBLEBUFFER:
- params[0] = BOOLEAN_TO_INT (cctx->doubleBuffer);
- break;
- case GL_DEPTH_BITS:
- params[0] = cctx->depthBits;
- break;
- case GL_STENCIL_BITS:
- params[0] = cctx->stencilBits;
- break;
- case GL_DRAW_BUFFER:
- params[0] = ENUM_TO_INT (cctx->attrib.drawBuffer);
- break;
- case GL_READ_BUFFER:
- params[0] = ENUM_TO_INT (cctx->attrib.readBuffer);
- break;
- case GL_SCISSOR_BOX:
- params[0] = cctx->attrib.scissor.x;
- params[1] = cctx->attrib.scissor.y;
- params[2] = cctx->attrib.scissor.width;
- params[3] = cctx->attrib.scissor.height;
- break;
- case GL_SCISSOR_TEST:
- params[0] = BOOLEAN_TO_INT (cctx->attrib.scissorTest);
- break;
- case GL_VIEWPORT:
- params[0] = cctx->attrib.viewport.x;
- params[1] = cctx->attrib.viewport.y;
- params[2] = cctx->attrib.viewport.width;
- params[3] = cctx->attrib.viewport.height;
- break;
- case GL_TEXTURE_BINDING_1D:
- case GL_TEXTURE_BINDING_2D:
- case GL_TEXTURE_BINDING_3D:
- case GL_TEXTURE_BINDING_RECTANGLE_NV:
- case GL_TEXTURE_BINDING_CUBE_MAP_ARB:
- params[0] = xglActiveTextureBinding (pname);
- break;
- case GL_MAX_TEXTURE_UNITS_ARB:
- params[0] = cctx->maxTexUnits;
- break;
- case GL_MAX_ATTRIB_STACK_DEPTH:
- params[0] = cctx->maxAttribStackDepth;
- break;
- default:
- glGetIntegerv (pname, params);
- }
-}
-
-static GLboolean
-xglIsEnabled (GLenum cap)
-{
- switch (cap) {
- case GL_SCISSOR_TEST:
- return cctx->attrib.scissorTest;
- default:
- return glIsEnabled (cap);
- }
-}
-
-static GLenum
-xglGetError (void)
-{
- GLenum error = cctx->errorValue;
-
- if (error != GL_NO_ERROR)
- {
- cctx->errorValue = GL_NO_ERROR;
- return error;
- }
-
- return glGetError ();
-}
-
-static const GLubyte *
-xglGetString (GLenum name)
-{
- switch (name) {
- case GL_VERSION:
- if (!cctx->versionString)
- {
- static char *version = "1.2 (%s)";
- char *nativeVersion = (char *) glGetString (GL_VERSION);
-
- cctx->versionString = xalloc (strlen (version) +
- strlen (nativeVersion));
- if (cctx->versionString)
- sprintf (cctx->versionString, version, nativeVersion);
- }
- return (GLubyte *) cctx->versionString;
- default:
- return glGetString (name);
- }
-}
-
-static void
-xglGenTextures (GLsizei n,
- GLuint *textures)
-{
- xglTexObjPtr pTexObj;
- GLuint name;
-
- name = xglHashFindFreeKeyBlock (cctx->shared->texObjects, n);
-
- glGenTextures (n, textures);
-
- while (n--)
- {
- pTexObj = xalloc (sizeof (xglTexObjRec));
- if (pTexObj)
- {
- pTexObj->key = name;
- pTexObj->name = *textures;
- pTexObj->pPixmap = NULL;
- pTexObj->object = NULL;
- pTexObj->refcnt = 1;
-
- xglHashInsert (cctx->shared->texObjects, name, pTexObj);
- }
- else
- {
- xglRecordError (GL_OUT_OF_MEMORY);
- }
-
- *textures++ = name++;
- }
-}
-
-static void
-xglBindTextureProc (xglGLOpPtr pOp)
-{
- xglTexObjPtr *ppTexObj;
-
- switch (pOp->u.bind_texture.target) {
- case GL_TEXTURE_1D:
- ppTexObj = &cctx->attrib.texUnits[cctx->activeTexUnit].p1D;
- break;
- case GL_TEXTURE_2D:
- ppTexObj = &cctx->attrib.texUnits[cctx->activeTexUnit].p2D;
- break;
- case GL_TEXTURE_3D:
- ppTexObj = &cctx->attrib.texUnits[cctx->activeTexUnit].p3D;
- break;
- case GL_TEXTURE_RECTANGLE_NV:
- ppTexObj = &cctx->attrib.texUnits[cctx->activeTexUnit].pRect;
- break;
- case GL_TEXTURE_CUBE_MAP_ARB:
- ppTexObj = &cctx->attrib.texUnits[cctx->activeTexUnit].pCubeMap;
- break;
- default:
- xglRecordError (GL_INVALID_ENUM);
- return;
- }
-
- if (pOp->u.bind_texture.texture)
- {
- if (!*ppTexObj || pOp->u.bind_texture.texture != (*ppTexObj)->key)
- {
- xglTexObjPtr pTexObj;
-
- pTexObj = (xglTexObjPtr)
- xglHashLookup (cctx->shared->texObjects,
- pOp->u.bind_texture.texture);
- if (!pTexObj)
- {
- pTexObj = xalloc (sizeof (xglTexObjRec));
- if (!pTexObj)
- {
- xglRecordError (GL_OUT_OF_MEMORY);
- return;
- }
-
- pTexObj->key = pOp->u.bind_texture.texture;
- pTexObj->pPixmap = NULL;
- pTexObj->object = NULL;
- pTexObj->refcnt = 1;
-
- glGenTextures (1, &pTexObj->name);
-
- xglHashInsert (cctx->shared->texObjects,
- pOp->u.bind_texture.texture,
- pTexObj);
- }
-
- xglRefTexObj (pTexObj);
- xglUnrefTexObj (*ppTexObj);
- *ppTexObj = pTexObj;
-
- glBindTexture (pOp->u.bind_texture.target, pTexObj->name);
- }
- }
- else
- {
- xglUnrefTexObj (*ppTexObj);
- *ppTexObj = NULL;
-
- glBindTexture (pOp->u.bind_texture.target, 0);
- }
-}
-
-static void
-xglBindTexture (GLenum target,
- GLuint texture)
-{
- xglGLOpRec gl;
-
- gl.glProc = xglBindTextureProc;
-
- gl.u.bind_texture.target = target;
- gl.u.bind_texture.texture = texture;
-
- xglGLOp (&gl);
-}
-
-static void
-xglSetupTextures (void)
-{
- xglGLContextPtr pContext = cctx;
- xglTexUnitPtr pTexUnit;
- xglTexObjPtr pTexObj[XGL_MAX_TEXTURE_UNITS];
- int i, activeTexUnit;
-
- for (i = 0; i < pContext->maxTexUnits; i++)
- {
- pTexObj[i] = NULL;
-
- pTexUnit = &pContext->attrib.texUnits[i];
- if (pTexUnit->enabled)
- {
- if (pTexUnit->enabled & XGL_TEXTURE_RECTANGLE_BIT)
- 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))
- pTexObj[i] = NULL;
- }
- else
- pTexObj[i] = NULL;
- }
- }
-
- 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])
- {
- if (i != activeTexUnit)
- {
- cctx->ActiveTextureARB (GL_TEXTURE0_ARB + i);
- activeTexUnit = i;
- }
- glitz_context_bind_texture (cctx->context, pTexObj[i]->object);
- }
- }
-
- if (activeTexUnit != cctx->activeTexUnit)
- cctx->ActiveTextureARB (cctx->activeTexUnit);
-}
-
-static GLboolean
-xglAreTexturesResident (GLsizei n,
- const GLuint *textures,
- GLboolean *residences)
-{
- GLboolean allResident = GL_TRUE;
- int i, j;
-
- if (n < 0)
- {
- xglRecordError (GL_INVALID_VALUE);
- return GL_FALSE;
- }
-
- if (!textures || !residences)
- return GL_FALSE;
-
- for (i = 0; i < n; i++)
- {
- xglTexObjPtr pTexObj;
- GLboolean resident;
-
- if (!textures[i])
- {
- xglRecordError (GL_INVALID_VALUE);
- return GL_FALSE;
- }
-
- pTexObj = (xglTexObjPtr) xglHashLookup (cctx->shared->texObjects,
- textures[i]);
- if (!pTexObj)
- {
- xglRecordError (GL_INVALID_VALUE);
- return GL_FALSE;
- }
-
- if (pTexObj->name == 0 ||
- glAreTexturesResident (1, &pTexObj->name, &resident))
- {
- if (!allResident)
- residences[i] = GL_TRUE;
- }
- else
- {
- if (allResident)
- {
- allResident = GL_FALSE;
-
- for (j = 0; j < i; j++)
- residences[j] = GL_TRUE;
- }
- residences[i] = GL_FALSE;
- }
- }
-
- return allResident;
-}
-
-static void
-xglDeleteTextures (GLsizei n,
- const GLuint *textures)
-{
- xglTexObjPtr pTexObj;
-
- while (n--)
- {
- if (!*textures)
- continue;
-
- pTexObj = (xglTexObjPtr) xglHashLookup (cctx->shared->texObjects,
- *textures);
- if (pTexObj)
- {
- xglDeleteTexObj (pTexObj);
- xglUnrefTexObj (pTexObj);
- xglHashRemove (cctx->shared->texObjects, *textures);
- }
- textures++;
- }
-}
-
-static GLboolean
-xglIsTexture (GLuint texture)
-{
- xglTexObjPtr pTexObj;
-
- if (!texture)
- return GL_FALSE;
-
- pTexObj = (xglTexObjPtr) xglHashLookup (cctx->shared->texObjects, texture);
- if (pTexObj)
- return GL_TRUE;
-
- return GL_FALSE;
-}
-
-static void
-xglPrioritizeTextures (GLsizei n,
- const GLuint *textures,
- const GLclampf *priorities)
-{
- xglTexObjPtr pTexObj;
- int i;
-
- if (n < 0)
- {
- xglRecordError (GL_INVALID_VALUE);
- return;
- }
-
- if (!priorities)
- return;
-
- for (i = 0; i < n; i++)
- {
- if (!textures[i])
- continue;
-
- pTexObj = (xglTexObjPtr) xglHashLookup (cctx->shared->texObjects,
- textures[i]);
- if (pTexObj && pTexObj->name)
- glPrioritizeTextures (1, &pTexObj->name, &priorities[i]);
- }
-}
-
-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)
-{
- xglTexObjPtr pTexObj;
-
- glTexParameterfv (pOp->u.tex_parameter_fv.target,
- pOp->u.tex_parameter_fv.pname,
- pOp->u.tex_parameter_fv.params);
-
- switch (pOp->u.tex_parameter_fv.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)
- {
- GLfloat *params = pOp->u.tex_parameter_fv.params;
-
- 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;
-
- 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;
- }
- }
-}
-
-static void
-xglTexParameterfv (GLenum target,
- GLenum pname,
- const GLfloat *params)
-{
- xglGLOpRec gl;
-
- 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_fv.params[3] = params[3];
- gl.u.tex_parameter_fv.params[2] = params[2];
- gl.u.tex_parameter_fv.params[1] = params[1];
- /* fall-through */
- default:
- gl.u.tex_parameter_fv.params[0] = params[0];
- break;
- }
-
- xglGLOp (&gl);
-}
-
-static void
-xglTexParameteriv (GLenum target,
- GLenum pname,
- const GLint *params)
-{
- xglGLOpRec gl;
-
- 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_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_fv.params[0] = params[0];
- break;
- }
-
- xglGLOp (&gl);
-}
-
-static void
-xglTexParameterf (GLenum target,
- GLenum pname,
- GLfloat param)
-{
- xglTexParameterfv (target, pname, (const GLfloat *) &param);
-}
-
-static void
-xglTexParameteri (GLenum target,
- GLenum pname,
- GLint param)
-{
- xglTexParameteriv (target, pname, (const GLint *) &param);
-}
-
-static void
-xglGetTexLevelParameterfv (GLenum target,
- GLint level,
- GLenum pname,
- GLfloat *params)
-{
- xglTexObjPtr pTexObj;
-
- switch (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)
- {
- glitz_context_bind_texture (cctx->context, pTexObj->object);
-
- glGetTexLevelParameterfv (target, level, pname, params);
- glBindTexture (target, pTexObj->name);
- }
- else
- glGetTexLevelParameterfv (target, level, pname, params);
-}
-
-static void
-xglGetTexLevelParameteriv (GLenum target,
- GLint level,
- GLenum pname,
- GLint *params)
-{
- xglTexObjPtr pTexObj;
-
- switch (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)
- {
- glitz_context_bind_texture (cctx->context, pTexObj->object);
-
- glGetTexLevelParameteriv (target, level, pname, params);
- glBindTexture (target, pTexObj->name);
- }
- else
- glGetTexLevelParameteriv (target, level, pname, params);
-}
-
-static GLuint
-xglGenLists (GLsizei range)
-{
- xglDisplayListPtr pDisplayList;
- GLuint first, name;
-
- first = xglHashFindFreeKeyBlock (cctx->shared->displayLists, range);
-
- name = first;
- for (name = first; range--; name++)
- {
- pDisplayList = xglCreateList ();
- if (pDisplayList)
- {
- xglHashInsert (cctx->shared->displayLists, name, pDisplayList);
- }
- else
- {
- xglRecordError (GL_OUT_OF_MEMORY);
- }
- }
-
- return first;
-}
-
-static void
-xglNewList (GLuint list,
- GLenum mode)
-{
- if (!list)
- {
- xglRecordError (GL_INVALID_VALUE);
- return;
- }
-
- if (cctx->list)
- {
- xglRecordError (GL_INVALID_OPERATION);
- return;
- }
-
- cctx->pList = xglCreateList ();
- if (!cctx->pList)
- {
- xglRecordError (GL_OUT_OF_MEMORY);
- return;
- }
-
- cctx->list = list;
- cctx->listMode = mode;
-
- xglStartList (XGL_LIST_OP_CALLS, mode);
-}
-
-static void
-xglEndList (void)
-{
- xglDisplayListPtr pDisplayList;
-
- if (!cctx->list)
- {
- xglRecordError (GL_INVALID_OPERATION);
- return;
- }
-
- glEndList ();
-
- pDisplayList = (xglDisplayListPtr)
- xglHashLookup (cctx->shared->displayLists, cctx->list);
- if (pDisplayList)
- {
- xglHashRemove (cctx->shared->displayLists, cctx->list);
- xglDestroyList (pDisplayList);
- }
-
- xglHashInsert (cctx->shared->displayLists, cctx->list, cctx->pList);
-
- cctx->list = 0;
-}
-
-static void
-xglDrawList (GLuint list)
-{
- RegionRec region;
- BoxRec scissor, box;
- BoxPtr pBox;
- int nBox;
-
- XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor);
-
- while (nBox--)
- {
- XGL_GLX_DRAW_BOX (&box, pBox);
-
- pBox++;
-
- if (cctx->attrib.scissorTest)
- XGL_GLX_INTERSECT_BOX (&box, &scissor);
-
- if (box.x1 < box.x2 && box.y1 < box.y2)
- {
- XGL_GLX_SET_SCISSOR_BOX (&box);
-
- glCallList (list);
-
- XGL_GLX_DRAW_DAMAGE (&box, &region);
- }
- }
-}
-
-static void
-xglCallDisplayList (GLuint list,
- int nesting)
-{
- if (nesting > cctx->maxListNesting)
- return;
-
- if (!list)
- {
- xglRecordError (GL_INVALID_VALUE);
- return;
- }
-
- if (cctx->list)
- {
- if (!xglResizeList (cctx->pList, cctx->pList->nOp + 1))
- {
- xglRecordError (GL_OUT_OF_MEMORY);
- return;
- }
-
- cctx->pList->pOp[cctx->pList->nOp].type = XGL_LIST_OP_LIST;
- cctx->pList->pOp[cctx->pList->nOp].u.list = list;
- cctx->pList->nOp++;
- }
- else
- {
- xglDisplayListPtr pDisplayList;
-
- pDisplayList = (xglDisplayListPtr)
- xglHashLookup (cctx->shared->displayLists, list);
- if (pDisplayList)
- {
- xglListOpPtr pOp = pDisplayList->pOp;
- int nOp = pDisplayList->nOp;
-
- while (nOp--)
- {
- switch (pOp->type) {
- case XGL_LIST_OP_CALLS:
- glCallList (pOp->u.list);
- break;
- case XGL_LIST_OP_DRAW:
- xglDrawList (pOp->u.list);
- break;
- case XGL_LIST_OP_GL:
- (*pOp->u.gl->glProc) (pOp->u.gl);
- break;
- case XGL_LIST_OP_LIST:
- xglCallDisplayList (pOp->u.list, nesting + 1);
- break;
- }
-
- pOp++;
- }
- }
- }
-}
-
-static void
-xglCallList (GLuint list)
-{
- xglCallDisplayList (list, 1);
-}
-
-static void
-xglCallLists (GLsizei n,
- GLenum type,
- const GLvoid *lists)
-{
- GLuint list;
- GLint base, i;
-
- glGetIntegerv (GL_LIST_BASE, &base);
-
- for (i = 0; i < n; i++)
- {
- switch (type) {
- case GL_BYTE:
- list = (GLuint) *(((GLbyte *) lists) + n);
- break;
- case GL_UNSIGNED_BYTE:
- list = (GLuint) *(((GLubyte *) lists) + n);
- break;
- case GL_SHORT:
- list = (GLuint) *(((GLshort *) lists) + n);
- break;
- case GL_UNSIGNED_SHORT:
- list = (GLuint) *(((GLushort *) lists) + n);
- break;
- case GL_INT:
- list = (GLuint) *(((GLint *) lists) + n);
- break;
- case GL_UNSIGNED_INT:
- list = (GLuint) *(((GLuint *) lists) + n);
- break;
- case GL_FLOAT:
- list = (GLuint) *(((GLfloat *) lists) + n);
- break;
- case GL_2_BYTES:
- {
- GLubyte *ubptr = ((GLubyte *) lists) + 2 * n;
- list = (GLuint) *ubptr * 256 + (GLuint) *(ubptr + 1);
- } break;
- case GL_3_BYTES:
- {
- GLubyte *ubptr = ((GLubyte *) lists) + 3 * n;
- list = (GLuint) * ubptr * 65536
- + (GLuint) * (ubptr + 1) * 256
- + (GLuint) * (ubptr + 2);
- } break;
- case GL_4_BYTES:
- {
- GLubyte *ubptr = ((GLubyte *) lists) + 4 * n;
- list = (GLuint) * ubptr * 16777216
- + (GLuint) * (ubptr + 1) * 65536
- + (GLuint) * (ubptr + 2) * 256
- + (GLuint) * (ubptr + 3);
- } break;
- default:
- xglRecordError (GL_INVALID_ENUM);
- return;
- }
-
- xglCallDisplayList (base + list, 1);
- }
-}
-
-static void
-xglDeleteLists (GLuint list,
- GLsizei range)
-{
- xglDisplayListPtr pDisplayList;
- GLint i;
-
- if (range < 0)
- {
- xglRecordError (GL_INVALID_VALUE);
- return;
- }
-
- for (i = list; i < list + range; i++)
- {
- if (!i)
- continue;
-
- pDisplayList = (xglDisplayListPtr)
- xglHashLookup (cctx->shared->displayLists, i);
- if (pDisplayList)
- {
- xglHashRemove (cctx->shared->displayLists, i);
- xglDestroyList (pDisplayList);
- }
- }
-}
-
-static GLboolean
-xglIsList (GLuint list)
-{
- xglDisplayListPtr pDisplayList;
-
- if (!list)
- return GL_FALSE;
-
- pDisplayList = (xglDisplayListPtr)
- xglHashLookup (cctx->shared->displayLists, list);
- if (pDisplayList)
- return GL_TRUE;
-
- return GL_FALSE;
-}
-
-static void
-xglFlush (void)
-{
- glFlush ();
-
- if (cctx && cctx->pDrawBuffer->pDrawable)
- {
- xglGLBufferPtr pBuffer = cctx->pDrawBuffer;
-
- if (REGION_NOTEMPTY (pBuffer->pDrawable->pScreen, &pBuffer->damage))
- {
- XGL_DRAWABLE_PIXMAP_PRIV (pBuffer->pDrawable);
-
- DamageDamageRegion (pBuffer->pDrawable, &pBuffer->damage);
- REGION_EMPTY (pBuffer->pDrawable->pScreen, &pBuffer->damage);
-
- pPixmapPriv->damageBox = miEmptyBox;
- }
- }
-}
-
-static void
-xglFinish (void)
-{
- glFinish ();
-
- if (cctx && cctx->pDrawBuffer->pDrawable)
- {
- xglGLBufferPtr pBuffer = cctx->pDrawBuffer;
-
- if (REGION_NOTEMPTY (pBuffer->pDrawable->pScreen, &pBuffer->damage))
- {
- XGL_DRAWABLE_PIXMAP_PRIV (pBuffer->pDrawable);
-
- DamageDamageRegion (pBuffer->pDrawable, &pBuffer->damage);
- REGION_EMPTY (pBuffer->pDrawable->pScreen, &pBuffer->damage);
-
- pPixmapPriv->damageBox = miEmptyBox;
- }
- }
-}
-
-static void
-xglClear (GLbitfield mask)
-{
- GLenum mode;
-
- if (cctx->list)
- {
- glEndList ();
- xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE);
- glClear (mask);
- glEndList ();
-
- mode = cctx->listMode;
- }
- else
- mode = GL_COMPILE_AND_EXECUTE;
-
- if (mode == GL_COMPILE_AND_EXECUTE)
- {
- RegionRec region;
- BoxRec scissor, box;
- BoxPtr pBox;
- int nBox;
-
- XGL_GLX_DRAW_PROLOGUE_WITHOUT_TEXTURES (pBox, nBox, &scissor);
-
- while (nBox--)
- {
- XGL_GLX_DRAW_BOX (&box, pBox);
-
- pBox++;
-
- if (cctx->attrib.scissorTest)
- XGL_GLX_INTERSECT_BOX (&box, &scissor);
-
- if (box.x1 < box.x2 && box.y1 < box.y2)
- {
- XGL_GLX_SET_SCISSOR_BOX (&box);
-
- glClear (mask);
-
- if (mask & GL_COLOR_BUFFER_BIT)
- XGL_GLX_DRAW_DAMAGE (&box, &region);
- }
- }
- }
-
- if (cctx->list)
- xglStartList (XGL_LIST_OP_CALLS, cctx->listMode);
-}
-
-static void
-xglAccum (GLenum op,
- GLfloat value)
-{
- if (op == GL_RETURN)
- {
- GLenum listMode;
-
- if (cctx->list)
- {
- glEndList ();
- xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE);
- glAccum (GL_RETURN, value);
- glEndList ();
-
- listMode = cctx->listMode;
- }
- else
- listMode = GL_COMPILE_AND_EXECUTE;
-
- if (listMode == GL_COMPILE_AND_EXECUTE)
- {
- RegionRec region;
- BoxRec scissor, box;
- BoxPtr pBox;
- int nBox;
-
- XGL_GLX_DRAW_PROLOGUE_WITHOUT_TEXTURES (pBox, nBox, &scissor);
-
- while (nBox--)
- {
- XGL_GLX_DRAW_BOX (&box, pBox);
-
- pBox++;
-
- if (cctx->attrib.scissorTest)
- XGL_GLX_INTERSECT_BOX (&box, &scissor);
-
- if (box.x1 < box.x2 && box.y1 < box.y2)
- {
- XGL_GLX_SET_SCISSOR_BOX (&box);
-
- glAccum (GL_RETURN, value);
-
- XGL_GLX_DRAW_DAMAGE (&box, &region);
- }
- }
- }
-
- if (cctx->list)
- xglStartList (XGL_LIST_OP_CALLS, cctx->listMode);
- }
- else
- glAccum (op, value);
-}
-
-static void
-xglDrawArrays (GLenum mode,
- GLint first,
- GLsizei count)
-{
- GLenum listMode;
-
- if (cctx->list)
- {
- glEndList ();
- xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE);
- glDrawArrays (mode, first, count);
- glEndList ();
-
- listMode = cctx->listMode;
- }
- else
- listMode = GL_COMPILE_AND_EXECUTE;
-
- if (listMode == GL_COMPILE_AND_EXECUTE)
- {
- RegionRec region;
- BoxRec scissor, box;
- BoxPtr pBox;
- int nBox;
-
- XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor);
-
- while (nBox--)
- {
- XGL_GLX_DRAW_BOX (&box, pBox);
-
- pBox++;
-
- if (cctx->attrib.scissorTest)
- XGL_GLX_INTERSECT_BOX (&box, &scissor);
-
- if (box.x1 < box.x2 && box.y1 < box.y2)
- {
- XGL_GLX_SET_SCISSOR_BOX (&box);
-
- glDrawArrays (mode, first, count);
-
- XGL_GLX_DRAW_DAMAGE (&box, &region);
- }
- }
- }
-
- if (cctx->list)
- xglStartList (XGL_LIST_OP_CALLS, cctx->listMode);
-}
-
-static void
-xglDrawElements (GLenum mode,
- GLsizei count,
- GLenum type,
- const GLvoid *indices)
-{
- GLenum listMode;
-
- if (cctx->list)
- {
- glEndList ();
- xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE);
- glDrawElements (mode, count, type, indices);
- glEndList ();
-
- listMode = cctx->listMode;
- }
- else
- listMode = GL_COMPILE_AND_EXECUTE;
-
- if (listMode == GL_COMPILE_AND_EXECUTE)
- {
- RegionRec region;
- BoxRec scissor, box;
- BoxPtr pBox;
- int nBox;
-
- XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor);
-
- while (nBox--)
- {
- XGL_GLX_DRAW_BOX (&box, pBox);
-
- pBox++;
-
- if (cctx->attrib.scissorTest)
- XGL_GLX_INTERSECT_BOX (&box, &scissor);
-
- if (box.x1 < box.x2 && box.y1 < box.y2)
- {
- XGL_GLX_SET_SCISSOR_BOX (&box);
-
- glDrawElements (mode, count, type, indices);
-
- XGL_GLX_DRAW_DAMAGE (&box, &region);
- }
- }
- }
-
- if (cctx->list)
- xglStartList (XGL_LIST_OP_CALLS, cctx->listMode);
-}
-
-static void
-xglDrawPixels (GLsizei width,
- GLsizei height,
- GLenum format,
- GLenum type,
- const GLvoid *pixels)
-{
- GLenum listMode;
-
- if (cctx->list)
- {
- glEndList ();
- xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE);
- glDrawPixels (width, height, format, type, pixels);
- glEndList ();
-
- listMode = cctx->listMode;
- }
- else
- listMode = GL_COMPILE_AND_EXECUTE;
-
- if (listMode == GL_COMPILE_AND_EXECUTE)
- {
- RegionRec region;
- BoxRec scissor, box;
- BoxPtr pBox;
- int nBox;
-
- XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor);
-
- while (nBox--)
- {
- XGL_GLX_DRAW_BOX (&box, pBox);
-
- pBox++;
-
- if (cctx->attrib.scissorTest)
- XGL_GLX_INTERSECT_BOX (&box, &scissor);
-
- if (box.x1 < box.x2 && box.y1 < box.y2)
- {
- XGL_GLX_SET_SCISSOR_BOX (&box);
-
- glDrawPixels (width, height, format, type, pixels);
-
- if (format != GL_STENCIL_INDEX)
- XGL_GLX_DRAW_DAMAGE (&box, &region);
- }
- }
- }
-
- if (cctx->list)
- xglStartList (XGL_LIST_OP_CALLS, cctx->listMode);
-}
-
-static void
-xglBitmap (GLsizei width,
- GLsizei height,
- GLfloat xorig,
- GLfloat yorig,
- GLfloat xmove,
- GLfloat ymove,
- const GLubyte *bitmap)
-{
- GLenum listMode;
-
- if (cctx->list)
- {
- glEndList ();
- xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE);
- glBitmap (width, height, xorig, yorig, 0, 0, bitmap);
- glEndList ();
-
- listMode = cctx->listMode;
- }
- else
- listMode = GL_COMPILE_AND_EXECUTE;
-
- if (listMode == GL_COMPILE_AND_EXECUTE && width && height)
- {
- RegionRec region;
- BoxRec scissor, box;
- BoxPtr pBox;
- int nBox;
-
- XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor);
-
- while (nBox--)
- {
- XGL_GLX_DRAW_BOX (&box, pBox);
-
- pBox++;
-
- if (cctx->attrib.scissorTest)
- XGL_GLX_INTERSECT_BOX (&box, &scissor);
-
- if (box.x1 < box.x2 && box.y1 < box.y2)
- {
- XGL_GLX_SET_SCISSOR_BOX (&box);
-
- glBitmap (width, height, xorig, yorig, 0, 0, bitmap);
-
- XGL_GLX_DRAW_DAMAGE (&box, &region);
- }
- }
- }
-
- if (cctx->list)
- xglStartList (XGL_LIST_OP_CALLS, cctx->listMode);
-
- glBitmap (0, 0, 0, 0, xmove, ymove, NULL);
-}
-
-static void
-xglRectdv (const GLdouble *v1,
- const GLdouble *v2)
-{
- GLenum listMode;
-
- if (cctx->list)
- {
- glEndList ();
- xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE);
- glRectdv (v1, v2);
- glEndList ();
-
- listMode = cctx->listMode;
- }
- else
- listMode = GL_COMPILE_AND_EXECUTE;
-
- if (listMode == GL_COMPILE_AND_EXECUTE)
- {
- RegionRec region;
- BoxRec scissor, box;
- BoxPtr pBox;
- int nBox;
-
- XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor);
-
- while (nBox--)
- {
- XGL_GLX_DRAW_BOX (&box, pBox);
-
- pBox++;
-
- if (cctx->attrib.scissorTest)
- XGL_GLX_INTERSECT_BOX (&box, &scissor);
-
- if (box.x1 < box.x2 && box.y1 < box.y2)
- {
- XGL_GLX_SET_SCISSOR_BOX (&box);
-
- glRectdv (v1, v2);
-
- XGL_GLX_DRAW_DAMAGE (&box, &region);
- }
- }
- }
-
- if (cctx->list)
- xglStartList (XGL_LIST_OP_CALLS, cctx->listMode);
-}
-
-static void
-xglRectfv (const GLfloat *v1,
- const GLfloat *v2)
-{
- GLdouble dv1[2];
- GLdouble dv2[2];
-
- dv1[0] = (GLdouble) v1[0];
- dv1[1] = (GLdouble) v1[1];
- dv2[0] = (GLdouble) v2[0];
- dv2[1] = (GLdouble) v2[1];
-
- xglRectdv (dv1, dv2);
-}
-
-static void
-xglRectiv (const GLint *v1,
- const GLint *v2)
-{
- GLdouble dv1[2];
- GLdouble dv2[2];
-
- dv1[0] = (GLdouble) v1[0];
- dv1[1] = (GLdouble) v1[1];
- dv2[0] = (GLdouble) v2[0];
- dv2[1] = (GLdouble) v2[1];
-
- xglRectdv (dv1, dv2);
-}
-
-static void
-xglRectsv (const GLshort *v1,
- const GLshort *v2)
-{
- GLdouble dv1[2];
- GLdouble dv2[2];
-
- dv1[0] = (GLdouble) v1[0];
- dv1[1] = (GLdouble) v1[1];
- dv2[0] = (GLdouble) v2[0];
- dv2[1] = (GLdouble) v2[1];
-
- xglRectdv (dv1, dv2);
-}
-
-static void
-xglBegin (GLenum mode)
-{
- if (mode > GL_POLYGON)
- {
- xglRecordError (GL_INVALID_ENUM);
- return;
- }
-
- if (cctx->beginCnt)
- {
- xglRecordError (GL_INVALID_OPERATION);
- return;
- }
-
- cctx->beginCnt++;
-
- if (cctx->list)
- {
- glEndList ();
- xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE);
- }
- else
- {
- if (REGION_NUM_RECTS (cctx->pDrawBuffer->pGC->pCompositeClip) == 1)
- {
- BoxRec scissor, box;
- BoxPtr pBox;
- int nBox;
-
- XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor);
-
- XGL_GLX_DRAW_BOX (&box, pBox);
-
- if (cctx->attrib.scissorTest)
- XGL_GLX_INTERSECT_BOX (&box, &scissor);
-
- XGL_GLX_SET_SCISSOR_BOX (&box);
- }
- else
- {
- if (!cctx->groupList)
- cctx->groupList = glGenLists (1);
-
- glNewList (cctx->groupList, GL_COMPILE);
- }
- }
-
- glBegin (mode);
-}
-
-static void
-xglEnd (void)
-{
- if (!cctx->beginCnt)
- {
- xglRecordError (GL_INVALID_OPERATION);
- return;
- }
-
- cctx->beginCnt--;
-
- glEnd ();
-
- if (!cctx->list || cctx->listMode == GL_COMPILE_AND_EXECUTE)
- {
- RegionRec region;
- BoxRec scissor, box;
- BoxPtr pBox;
- int nBox;
- GLuint list = 0;
-
- if (cctx->list)
- {
- XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor);
-
- list = cctx->pList->pOp[cctx->pList->nOp - 1].u.list;
- }
- else
- {
- if (REGION_NUM_RECTS (cctx->pDrawBuffer->pGC->pCompositeClip) == 1)
- {
- XGL_GLX_DRAW_PROLOGUE_WITHOUT_TEXTURES (pBox, nBox, &scissor);
- }
- else
- {
- XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor);
-
- list = cctx->groupList;
- }
- }
-
- if (list)
- glEndList ();
-
- while (nBox--)
- {
- XGL_GLX_DRAW_BOX (&box, pBox);
-
- pBox++;
-
- if (cctx->attrib.scissorTest)
- XGL_GLX_INTERSECT_BOX (&box, &scissor);
-
- if (box.x1 < box.x2 && box.y1 < box.y2)
- {
- if (list)
- {
- XGL_GLX_SET_SCISSOR_BOX (&box);
-
- glCallList (list);
- }
-
- XGL_GLX_DRAW_DAMAGE (&box, &region);
- }
- }
- }
- else
- {
- glEndList ();
- }
-
- if (cctx->list)
- xglStartList (XGL_LIST_OP_CALLS, cctx->listMode);
-}
-
-static void
-xglCopyPixelsProc (xglGLOpPtr pOp)
-{
- RegionRec region;
- BoxRec scissor, box;
- BoxPtr pBox;
- int nBox;
-
- XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor);
-
- while (nBox--)
- {
- XGL_GLX_DRAW_BOX (&box, pBox);
-
- pBox++;
-
- if (cctx->attrib.scissorTest)
- XGL_GLX_INTERSECT_BOX (&box, &scissor);
-
- if (box.x1 < box.x2 && box.y1 < box.y2)
- {
- XGL_GLX_SET_SCISSOR_BOX (&box);
-
- glCopyPixels (pOp->u.copy_pixels.x + cctx->pReadBuffer->xOff,
- pOp->u.copy_pixels.y + cctx->pReadBuffer->yOff,
- pOp->u.copy_pixels.width,
- pOp->u.copy_pixels.height,
- pOp->u.copy_pixels.type);
-
- if (pOp->u.copy_pixels.type == GL_COLOR)
- XGL_GLX_DRAW_DAMAGE (&box, &region);
- }
- }
-}
-
-static void
-xglCopyPixels (GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- GLenum type)
-{
- xglGLOpRec gl;
-
- gl.glProc = xglCopyPixelsProc;
-
- gl.u.copy_pixels.x = x;
- gl.u.copy_pixels.y = y;
- gl.u.copy_pixels.width = width;
- gl.u.copy_pixels.height = height;
- gl.u.copy_pixels.type = type;
-
- xglGLOp (&gl);
-}
-
-static void
-xglReadPixels (GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- GLenum format,
- GLenum type,
- GLvoid *pixels)
-{
- glReadPixels (x + cctx->pReadBuffer->xOff,
- y + cctx->pReadBuffer->yOff,
- width, height, format, type, pixels);
-}
-
-static void
-xglCopyTexImage1DProc (xglGLOpPtr pOp)
-{
- glCopyTexImage1D (pOp->u.copy_tex_image_1d.target,
- pOp->u.copy_tex_image_1d.level,
- pOp->u.copy_tex_image_1d.internalformat,
- pOp->u.copy_tex_image_1d.x + cctx->pReadBuffer->xOff,
- pOp->u.copy_tex_image_1d.y + cctx->pReadBuffer->yOff,
- pOp->u.copy_tex_image_1d.width,
- pOp->u.copy_tex_image_1d.border);
-}
-
-static void
-xglCopyTexImage1D (GLenum target,
- GLint level,
- GLenum internalformat,
- GLint x,
- GLint y,
- GLsizei width,
- GLint border)
-{
- xglGLOpRec gl;
-
- gl.glProc = xglCopyTexImage1DProc;
-
- gl.u.copy_tex_image_1d.target = target;
- gl.u.copy_tex_image_1d.level = level;
- gl.u.copy_tex_image_1d.internalformat = internalformat;
- gl.u.copy_tex_image_1d.x = x;
- gl.u.copy_tex_image_1d.y = y;
- gl.u.copy_tex_image_1d.width = width;
- gl.u.copy_tex_image_1d.border = border;
-
- xglGLOp (&gl);
-}
-
-static void
-xglCopyTexImage2DProc (xglGLOpPtr pOp)
-{
- glCopyTexImage2D (pOp->u.copy_tex_image_2d.target,
- pOp->u.copy_tex_image_2d.level,
- pOp->u.copy_tex_image_2d.internalformat,
- pOp->u.copy_tex_image_2d.x + cctx->pReadBuffer->xOff,
- pOp->u.copy_tex_image_2d.y + cctx->pReadBuffer->yOff,
- pOp->u.copy_tex_image_2d.width,
- pOp->u.copy_tex_image_2d.height,
- pOp->u.copy_tex_image_2d.border);
-}
-
-static void
-xglCopyTexImage2D (GLenum target,
- GLint level,
- GLenum internalformat,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- GLint border)
-{
- xglGLOpRec gl;
-
- gl.glProc = xglCopyTexImage2DProc;
-
- gl.u.copy_tex_image_2d.target = target;
- gl.u.copy_tex_image_2d.level = level;
- gl.u.copy_tex_image_2d.internalformat = internalformat;
- gl.u.copy_tex_image_2d.x = x;
- gl.u.copy_tex_image_2d.y = y;
- gl.u.copy_tex_image_2d.width = width;
- gl.u.copy_tex_image_2d.height = height;
- gl.u.copy_tex_image_2d.border = border;
-
- xglGLOp (&gl);
-}
-
-static void
-xglCopyTexSubImage1DProc (xglGLOpPtr pOp)
-{
- glCopyTexSubImage1D (pOp->u.copy_tex_sub_image_1d.target,
- pOp->u.copy_tex_sub_image_1d.level,
- pOp->u.copy_tex_sub_image_1d.xoffset,
- pOp->u.copy_tex_sub_image_1d.x +
- cctx->pReadBuffer->xOff,
- pOp->u.copy_tex_sub_image_1d.y +
- cctx->pReadBuffer->yOff,
- pOp->u.copy_tex_sub_image_1d.width);
-}
-
-static void
-xglCopyTexSubImage1D (GLenum target,
- GLint level,
- GLint xoffset,
- GLint x,
- GLint y,
- GLsizei width)
-{
- xglGLOpRec gl;
-
- gl.glProc = xglCopyTexSubImage1DProc;
-
- gl.u.copy_tex_sub_image_1d.target = target;
- gl.u.copy_tex_sub_image_1d.level = level;
- gl.u.copy_tex_sub_image_1d.xoffset = xoffset;
- gl.u.copy_tex_sub_image_1d.x = x;
- gl.u.copy_tex_sub_image_1d.y = y;
- gl.u.copy_tex_sub_image_1d.width = width;
-
- xglGLOp (&gl);
-}
-
-static void
-xglCopyTexSubImage2DProc (xglGLOpPtr pOp)
-{
- glCopyTexSubImage2D (pOp->u.copy_tex_sub_image_2d.target,
- pOp->u.copy_tex_sub_image_2d.level,
- pOp->u.copy_tex_sub_image_2d.xoffset,
- pOp->u.copy_tex_sub_image_2d.yoffset,
- pOp->u.copy_tex_sub_image_2d.x +
- cctx->pReadBuffer->xOff,
- pOp->u.copy_tex_sub_image_2d.y +
- cctx->pReadBuffer->yOff,
- pOp->u.copy_tex_sub_image_2d.width,
- pOp->u.copy_tex_sub_image_2d.height);
-}
-
-static void
-xglCopyTexSubImage2D (GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height)
-{
- xglGLOpRec gl;
-
- gl.glProc = xglCopyTexSubImage2DProc;
-
- gl.u.copy_tex_sub_image_2d.target = target;
- gl.u.copy_tex_sub_image_2d.level = level;
- gl.u.copy_tex_sub_image_2d.xoffset = xoffset;
- gl.u.copy_tex_sub_image_2d.yoffset = yoffset;
- gl.u.copy_tex_sub_image_2d.x = x;
- gl.u.copy_tex_sub_image_2d.y = y;
- gl.u.copy_tex_sub_image_2d.width = width;
- gl.u.copy_tex_sub_image_2d.height = height;
-
- xglGLOp (&gl);
-}
-
-static void
-xglCopyColorTableProc (xglGLOpPtr pOp)
-{
- glCopyColorTable (pOp->u.copy_color_table.target,
- pOp->u.copy_color_table.internalformat,
- pOp->u.copy_color_table.x + cctx->pReadBuffer->xOff,
- pOp->u.copy_color_table.y + cctx->pReadBuffer->yOff,
- pOp->u.copy_color_table.width);
-}
-
-static void
-xglCopyColorTable (GLenum target,
- GLenum internalformat,
- GLint x,
- GLint y,
- GLsizei width)
-{
- xglGLOpRec gl;
-
- gl.glProc = xglCopyColorTableProc;
-
- gl.u.copy_color_table.target = target;
- gl.u.copy_color_table.internalformat = internalformat;
- gl.u.copy_color_table.x = x;
- gl.u.copy_color_table.y = y;
- gl.u.copy_color_table.width = width;
-
- xglGLOp (&gl);
-}
-
-static void
-xglCopyColorSubTableProc (xglGLOpPtr pOp)
-{
- glCopyColorTable (pOp->u.copy_color_sub_table.target,
- pOp->u.copy_color_sub_table.start,
- pOp->u.copy_color_sub_table.x + cctx->pReadBuffer->xOff,
- pOp->u.copy_color_sub_table.y + cctx->pReadBuffer->yOff,
- pOp->u.copy_color_sub_table.width);
-}
-
-static void
-xglCopyColorSubTable (GLenum target,
- GLsizei start,
- GLint x,
- GLint y,
- GLsizei width)
-{
- xglGLOpRec gl;
-
- gl.glProc = xglCopyColorSubTableProc;
-
- gl.u.copy_color_sub_table.target = target;
- gl.u.copy_color_sub_table.start = start;
- gl.u.copy_color_sub_table.x = x;
- gl.u.copy_color_sub_table.y = y;
- gl.u.copy_color_sub_table.width = width;
-
- xglGLOp (&gl);
-}
-
-static void
-xglCopyConvolutionFilter1DProc (xglGLOpPtr pOp)
-{
- GLenum internalformat = pOp->u.copy_convolution_filter_1d.internalformat;
-
- glCopyConvolutionFilter1D (pOp->u.copy_convolution_filter_1d.target,
- internalformat,
- pOp->u.copy_convolution_filter_1d.x +
- cctx->pReadBuffer->xOff,
- pOp->u.copy_convolution_filter_1d.y +
- cctx->pReadBuffer->yOff,
- pOp->u.copy_convolution_filter_1d.width);
-}
-
-static void
-xglCopyConvolutionFilter1D (GLenum target,
- GLenum internalformat,
- GLint x,
- GLint y,
- GLsizei width)
-{
- xglGLOpRec gl;
-
- gl.glProc = xglCopyConvolutionFilter1DProc;
-
- gl.u.copy_convolution_filter_1d.target = target;
- gl.u.copy_convolution_filter_1d.internalformat = internalformat;
- gl.u.copy_convolution_filter_1d.x = x;
- gl.u.copy_convolution_filter_1d.y = y;
- gl.u.copy_convolution_filter_1d.width = width;
-
- xglGLOp (&gl);
-}
-
-static void
-xglCopyConvolutionFilter2DProc (xglGLOpPtr pOp)
-{
- GLenum internalformat = pOp->u.copy_convolution_filter_2d.internalformat;
-
- glCopyConvolutionFilter2D (pOp->u.copy_convolution_filter_2d.target,
- internalformat,
- pOp->u.copy_convolution_filter_2d.x +
- cctx->pReadBuffer->xOff,
- pOp->u.copy_convolution_filter_2d.y +
- cctx->pReadBuffer->yOff,
- pOp->u.copy_convolution_filter_2d.width,
- pOp->u.copy_convolution_filter_2d.height);
-}
-
-static void
-xglCopyConvolutionFilter2D (GLenum target,
- GLenum internalformat,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height)
-{
- xglGLOpRec gl;
-
- gl.glProc = xglCopyConvolutionFilter2DProc;
-
- gl.u.copy_convolution_filter_2d.target = target;
- gl.u.copy_convolution_filter_2d.internalformat = internalformat;
- gl.u.copy_convolution_filter_2d.x = x;
- gl.u.copy_convolution_filter_2d.y = y;
- gl.u.copy_convolution_filter_2d.width = width;
- gl.u.copy_convolution_filter_2d.height = height;
-
- xglGLOp (&gl);
-}
-
-static void
-xglCopyTexSubImage3DProc (xglGLOpPtr pOp)
-{
- glCopyTexSubImage3D (pOp->u.copy_tex_sub_image_3d.target,
- pOp->u.copy_tex_sub_image_3d.level,
- pOp->u.copy_tex_sub_image_3d.xoffset,
- pOp->u.copy_tex_sub_image_3d.yoffset,
- pOp->u.copy_tex_sub_image_3d.zoffset,
- pOp->u.copy_tex_sub_image_3d.x +
- cctx->pReadBuffer->xOff,
- pOp->u.copy_tex_sub_image_3d.y +
- cctx->pReadBuffer->yOff,
- pOp->u.copy_tex_sub_image_3d.width,
- pOp->u.copy_tex_sub_image_3d.height);
-}
-
-static void
-xglCopyTexSubImage3D (GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLint zoffset,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height)
-{
- xglGLOpRec gl;
-
- gl.glProc = xglCopyTexSubImage3DProc;
-
- gl.u.copy_tex_sub_image_3d.target = target;
- gl.u.copy_tex_sub_image_3d.level = level;
- gl.u.copy_tex_sub_image_3d.xoffset = xoffset;
- gl.u.copy_tex_sub_image_3d.yoffset = yoffset;
- gl.u.copy_tex_sub_image_3d.zoffset = zoffset;
- gl.u.copy_tex_sub_image_3d.x = x;
- gl.u.copy_tex_sub_image_3d.y = y;
- gl.u.copy_tex_sub_image_3d.width = width;
- gl.u.copy_tex_sub_image_3d.height = height;
-
- xglGLOp (&gl);
-}
-
-/* GL_ARB_multitexture */
-static void
-xglNoOpActiveTextureARB (GLenum texture) {}
-static void
-xglActiveTextureARBProc (xglGLOpPtr pOp)
-{
- GLenum texUnit;
-
- texUnit = pOp->u.enumeration - GL_TEXTURE0;
- if (texUnit < 0 || texUnit >= cctx->maxTexUnits)
- {
- xglRecordError (GL_INVALID_ENUM);
- }
- else
- {
- cctx->activeTexUnit = texUnit;
- (*cctx->ActiveTextureARB) (pOp->u.enumeration);
- }
-}
-static void
-xglActiveTextureARB (GLenum texture)
-{
- xglGLOpRec gl;
-
- gl.glProc = xglActiveTextureARBProc;
-
- gl.u.enumeration = texture;
-
- xglGLOp (&gl);
-}
-static void
-xglNoOpClientActiveTextureARB (GLenum texture) {}
-static void
-xglNoOpMultiTexCoord1dvARB (GLenum target, const GLdouble *v) {}
-static void
-xglNoOpMultiTexCoord1fvARB (GLenum target, const GLfloat *v) {}
-static void
-xglNoOpMultiTexCoord1ivARB (GLenum target, const GLint *v) {}
-static void
-xglNoOpMultiTexCoord1svARB (GLenum target, const GLshort *v) {}
-static void
-xglNoOpMultiTexCoord2dvARB (GLenum target, const GLdouble *v) {}
-static void
-xglNoOpMultiTexCoord2fvARB (GLenum target, const GLfloat *v) {}
-static void
-xglNoOpMultiTexCoord2ivARB (GLenum target, const GLint *v) {}
-static void
-xglNoOpMultiTexCoord2svARB (GLenum target, const GLshort *v) {}
-static void
-xglNoOpMultiTexCoord3dvARB (GLenum target, const GLdouble *v) {}
-static void
-xglNoOpMultiTexCoord3fvARB (GLenum target, const GLfloat *v) {}
-static void
-xglNoOpMultiTexCoord3ivARB (GLenum target, const GLint *v) {}
-static void
-xglNoOpMultiTexCoord3svARB (GLenum target, const GLshort *v) {}
-static void
-xglNoOpMultiTexCoord4dvARB (GLenum target, const GLdouble *v) {}
-static void
-xglNoOpMultiTexCoord4fvARB (GLenum target, const GLfloat *v) {}
-static void
-xglNoOpMultiTexCoord4ivARB (GLenum target, const GLint *v) {}
-static void
-xglNoOpMultiTexCoord4svARB (GLenum target, const GLshort *v) {}
-
-/* GL_ARB_multisample */
-static void
-xglNoOpSampleCoverageARB (GLclampf value, GLboolean invert) {}
-
-/* GL_EXT_texture_object */
-static GLboolean
-xglNoOpAreTexturesResidentEXT (GLsizei n,
- const GLuint *textures,
- GLboolean *residences)
-{
- return GL_FALSE;
-}
-static void
-xglNoOpGenTexturesEXT (GLsizei n, GLuint *textures) {}
-static GLboolean
-xglNoOpIsTextureEXT (GLuint texture)
-{
- return GL_FALSE;
-}
-
-/* GL_SGIS_multisample */
-static void
-xglNoOpSampleMaskSGIS (GLclampf value, GLboolean invert) {}
-static void
-xglNoOpSamplePatternSGIS (GLenum pattern) {}
-
-/* GL_EXT_point_parameters */
-static void
-xglNoOpPointParameterfEXT (GLenum pname, GLfloat param) {}
-static void
-xglNoOpPointParameterfvEXT (GLenum pname, const GLfloat *params) {}
-
-/* GL_MESA_window_pos */
-static void
-xglNoOpWindowPos3fMESA (GLfloat x, GLfloat y, GLfloat z) {}
-static void
-xglWindowPos3fMESAProc (xglGLOpPtr pOp)
-{
- (*cctx->WindowPos3fMESA) (pOp->u.window_pos_3f.x + cctx->pDrawBuffer->xOff,
- pOp->u.window_pos_3f.y + cctx->pDrawBuffer->yOff,
- pOp->u.window_pos_3f.z);
-}
-static void
-xglWindowPos3fMESA (GLfloat x, GLfloat y, GLfloat z)
-{
- xglGLOpRec gl;
-
- gl.glProc = xglWindowPos3fMESAProc;
-
- gl.u.window_pos_3f.x = x;
- gl.u.window_pos_3f.y = y;
- gl.u.window_pos_3f.z = z;
-
- xglGLOp (&gl);
-}
-
-/* GL_EXT_blend_func_separate */
-static void
-xglNoOpBlendFuncSeparateEXT (GLenum sfactorRGB, GLenum dfactorRGB,
- GLenum sfactorAlpha, GLenum dfactorAlpha) {}
-
-/* GL_EXT_fog_coord */
-static void
-xglNoOpFogCoordfvEXT (const GLfloat *coord) {}
-static void
-xglNoOpFogCoorddvEXT (const GLdouble *coord) {}
-static void
-xglNoOpFogCoordPointerEXT (GLenum type, GLsizei stride,
- const GLvoid *pointer) {}
-
-/* GL_EXT_secondary_color */
-static void
-xglNoOpSecondaryColor3bvEXT (const GLbyte *v) {}
-static void
-xglNoOpSecondaryColor3dvEXT (const GLdouble *v) {}
-static void
-xglNoOpSecondaryColor3fvEXT (const GLfloat *v) {}
-static void
-xglNoOpSecondaryColor3ivEXT (const GLint *v) {}
-static void
-xglNoOpSecondaryColor3svEXT (const GLshort *v) {}
-static void
-xglNoOpSecondaryColor3ubvEXT (const GLubyte *v) {}
-static void
-xglNoOpSecondaryColor3uivEXT (const GLuint *v) {}
-static void
-xglNoOpSecondaryColor3usvEXT (const GLushort *v) {}
-static void
-xglNoOpSecondaryColorPointerEXT (GLint size, GLenum type, GLsizei stride,
- const GLvoid *pointer) {}
-
-/* GL_NV_point_sprite */
-static void
-xglNoOpPointParameteriNV (GLenum pname, GLint params) {}
-static void
-xglNoOpPointParameterivNV (GLenum pname, const GLint *params) {}
-
-/* GL_EXT_stencil_two_side */
-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) {}
-
-static struct _glapi_table __glNativeRenderTable = {
- xglNewList,
- xglEndList,
- xglCallList,
- xglCallLists,
- xglDeleteLists,
- xglGenLists,
- glListBase,
- xglBegin,
- xglBitmap,
- 0, /* glColor3b */
- glColor3bv,
- 0, /* glColor3d */
- glColor3dv,
- 0, /* glColor3f */
- glColor3fv,
- 0, /* glColor3i */
- glColor3iv,
- 0, /* glColor3s */
- glColor3sv,
- 0, /* glColor3ub */
- glColor3ubv,
- 0, /* glColor3ui */
- glColor3uiv,
- 0, /* glColor3us */
- glColor3usv,
- 0, /* glColor4b */
- glColor4bv,
- 0, /* glColor4d */
- glColor4dv,
- 0, /* glColor4f */
- glColor4fv,
- 0, /* glColor4i */
- glColor4iv,
- 0, /* glColor4s */
- glColor4sv,
- 0, /* glColor4ub */
- glColor4ubv,
- 0, /* glColor4ui */
- glColor4uiv,
- 0, /* glColor4us */
- glColor4usv,
- 0, /* glEdgeFlag */
- glEdgeFlagv,
- xglEnd,
- 0, /* glIndexd */
- glIndexdv,
- 0, /* glIndexf */
- glIndexfv,
- 0, /* glIndexi */
- glIndexiv,
- 0, /* glIndexs */
- glIndexsv,
- 0, /* glNormal3b */
- glNormal3bv,
- 0, /* glNormal3d */
- glNormal3dv,
- 0, /* glNormal3f */
- glNormal3fv,
- 0, /* glNormal3i */
- glNormal3iv,
- 0, /* glNormal3s */
- glNormal3sv,
- 0, /* glRasterPos2d */
- glRasterPos2dv,
- 0, /* glRasterPos2f */
- glRasterPos2fv,
- 0, /* glRasterPos2i */
- glRasterPos2iv,
- 0, /* glRasterPos2s */
- glRasterPos2sv,
- 0, /* glRasterPos3d */
- glRasterPos3dv,
- 0, /* glRasterPos3f */
- glRasterPos3fv,
- 0, /* glRasterPos3i */
- glRasterPos3iv,
- 0, /* glRasterPos3s */
- glRasterPos3sv,
- 0, /* glRasterPos4d */
- glRasterPos4dv,
- 0, /* glRasterPos4f */
- glRasterPos4fv,
- 0, /* glRasterPos4i */
- glRasterPos4iv,
- 0, /* glRasterPos4s */
- glRasterPos4sv,
- 0, /* glRectd */
- xglRectdv,
- 0, /* glRectf */
- xglRectfv,
- 0, /* glRecti */
- xglRectiv,
- 0, /* glRects */
- xglRectsv,
- 0, /* glTexCoord1d */
- glTexCoord1dv,
- 0, /* glTexCoord1f */
- glTexCoord1fv,
- 0, /* glTexCoord1i */
- glTexCoord1iv,
- 0, /* glTexCoord1s */
- glTexCoord1sv,
- 0, /* glTexCoord2d */
- glTexCoord2dv,
- 0, /* glTexCoord2f */
- glTexCoord2fv,
- 0, /* glTexCoord2i */
- glTexCoord2iv,
- 0, /* glTexCoord2s */
- glTexCoord2sv,
- 0, /* glTexCoord3d */
- glTexCoord3dv,
- 0, /* glTexCoord3f */
- glTexCoord3fv,
- 0, /* glTexCoord3i */
- glTexCoord3iv,
- 0, /* glTexCoord3s */
- glTexCoord3sv,
- 0, /* glTexCoord4d */
- glTexCoord4dv,
- 0, /* glTexCoord4f */
- glTexCoord4fv,
- 0, /* glTexCoord4i */
- glTexCoord4iv,
- 0, /* glTexCoord4s */
- glTexCoord4sv,
- 0, /* glVertex2d */
- glVertex2dv,
- 0, /* glVertex2f */
- glVertex2fv,
- 0, /* glVertex2i */
- glVertex2iv,
- 0, /* glVertex2s */
- glVertex2sv,
- 0, /* glVertex3d */
- glVertex3dv,
- 0, /* glVertex3f */
- glVertex3fv,
- 0, /* glVertex3i */
- glVertex3iv,
- 0, /* glVertex3s */
- glVertex3sv,
- 0, /* glVertex4d */
- glVertex4dv,
- 0, /* glVertex4f */
- glVertex4fv,
- 0, /* glVertex4i */
- glVertex4iv,
- 0, /* glVertex4s */
- glVertex4sv,
- glClipPlane,
- glColorMaterial,
- glCullFace,
- glFogf,
- glFogfv,
- glFogi,
- glFogiv,
- glFrontFace,
- glHint,
- glLightf,
- glLightfv,
- glLighti,
- glLightiv,
- glLightModelf,
- glLightModelfv,
- glLightModeli,
- glLightModeliv,
- glLineStipple,
- glLineWidth,
- glMaterialf,
- glMaterialfv,
- glMateriali,
- glMaterialiv,
- glPointSize,
- glPolygonMode,
- glPolygonStipple,
- xglScissor,
- glShadeModel,
- xglTexParameterf,
- xglTexParameterfv,
- xglTexParameteri,
- xglTexParameteriv,
- glTexImage1D,
- glTexImage2D,
- glTexEnvf,
- glTexEnvfv,
- glTexEnvi,
- glTexEnviv,
- glTexGend,
- glTexGendv,
- glTexGenf,
- glTexGenfv,
- glTexGeni,
- glTexGeniv,
- glFeedbackBuffer,
- glSelectBuffer,
- glRenderMode,
- glInitNames,
- glLoadName,
- glPassThrough,
- glPopName,
- glPushName,
- xglDrawBuffer,
- xglClear,
- glClearAccum,
- glClearIndex,
- glClearColor,
- glClearStencil,
- glClearDepth,
- glStencilMask,
- glColorMask,
- glDepthMask,
- glIndexMask,
- xglAccum,
- xglDisable,
- xglEnable,
- xglFinish,
- xglFlush,
- xglPopAttrib,
- xglPushAttrib,
- glMap1d,
- glMap1f,
- glMap2d,
- glMap2f,
- glMapGrid1d,
- glMapGrid1f,
- glMapGrid2d,
- glMapGrid2f,
- 0, /* glEvalCoord1d */
- glEvalCoord1dv,
- 0, /* glEvalCoord1f */
- glEvalCoord1fv,
- 0, /* glEvalCoord2d */
- glEvalCoord2dv,
- 0, /* glEvalCoord2f */
- glEvalCoord2fv,
- glEvalMesh1,
- glEvalPoint1,
- glEvalMesh2,
- glEvalPoint2,
- glAlphaFunc,
- glBlendFunc,
- glLogicOp,
- glStencilFunc,
- glStencilOp,
- glDepthFunc,
- glPixelZoom,
- glPixelTransferf,
- glPixelTransferi,
- glPixelStoref,
- glPixelStorei,
- glPixelMapfv,
- glPixelMapuiv,
- glPixelMapusv,
- xglReadBuffer,
- xglCopyPixels,
- xglReadPixels,
- xglDrawPixels,
- xglGetBooleanv,
- glGetClipPlane,
- xglGetDoublev,
- xglGetError,
- xglGetFloatv,
- xglGetIntegerv,
- glGetLightfv,
- glGetLightiv,
- glGetMapdv,
- glGetMapfv,
- glGetMapiv,
- glGetMaterialfv,
- glGetMaterialiv,
- glGetPixelMapfv,
- glGetPixelMapuiv,
- glGetPixelMapusv,
- glGetPolygonStipple,
- xglGetString,
- glGetTexEnvfv,
- glGetTexEnviv,
- glGetTexGendv,
- glGetTexGenfv,
- glGetTexGeniv,
- glGetTexImage,
- glGetTexParameterfv,
- glGetTexParameteriv,
- xglGetTexLevelParameterfv,
- xglGetTexLevelParameteriv,
- xglIsEnabled,
- xglIsList,
- glDepthRange,
- glFrustum,
- glLoadIdentity,
- glLoadMatrixf,
- glLoadMatrixd,
- glMatrixMode,
- glMultMatrixf,
- glMultMatrixd,
- glOrtho,
- glPopMatrix,
- glPushMatrix,
- glRotated,
- glRotatef,
- glScaled,
- glScalef,
- glTranslated,
- glTranslatef,
- xglViewport,
- glArrayElement,
- xglBindTexture,
- glColorPointer,
- glDisableClientState,
- xglDrawArrays,
- xglDrawElements,
- glEdgeFlagPointer,
- glEnableClientState,
- glIndexPointer,
- 0, /* glIndexub */
- glIndexubv,
- glInterleavedArrays,
- glNormalPointer,
- glPolygonOffset,
- glTexCoordPointer,
- glVertexPointer,
- xglAreTexturesResident,
- xglCopyTexImage1D,
- xglCopyTexImage2D,
- xglCopyTexSubImage1D,
- xglCopyTexSubImage2D,
- xglDeleteTextures,
- xglGenTextures,
- glGetPointerv,
- xglIsTexture,
- xglPrioritizeTextures,
- glTexSubImage1D,
- glTexSubImage2D,
- glPopClientAttrib,
- glPushClientAttrib,
- glBlendColor,
- glBlendEquation,
- 0, /* glDrawRangeElements */
- glColorTable,
- glColorTableParameterfv,
- glColorTableParameteriv,
- xglCopyColorTable,
- glGetColorTable,
- glGetColorTableParameterfv,
- glGetColorTableParameteriv,
- glColorSubTable,
- xglCopyColorSubTable,
- glConvolutionFilter1D,
- glConvolutionFilter2D,
- glConvolutionParameterf,
- glConvolutionParameterfv,
- glConvolutionParameteri,
- glConvolutionParameteriv,
- xglCopyConvolutionFilter1D,
- xglCopyConvolutionFilter2D,
- glGetConvolutionFilter,
- glGetConvolutionParameterfv,
- glGetConvolutionParameteriv,
- glGetSeparableFilter,
- glSeparableFilter2D,
- glGetHistogram,
- glGetHistogramParameterfv,
- glGetHistogramParameteriv,
- glGetMinmax,
- glGetMinmaxParameterfv,
- glGetMinmaxParameteriv,
- glHistogram,
- glMinmax,
- glResetHistogram,
- glResetMinmax,
- glTexImage3D,
- glTexSubImage3D,
- xglCopyTexSubImage3D,
- xglNoOpActiveTextureARB,
- xglNoOpClientActiveTextureARB,
- 0, /* glMultiTexCoord1dARB */
- xglNoOpMultiTexCoord1dvARB,
- 0, /* glMultiTexCoord1fARB */
- xglNoOpMultiTexCoord1fvARB,
- 0, /* glMultiTexCoord1iARB */
- xglNoOpMultiTexCoord1ivARB,
- 0, /* glMultiTexCoord1sARB */
- xglNoOpMultiTexCoord1svARB,
- 0, /* glMultiTexCoord2dARB */
- xglNoOpMultiTexCoord2dvARB,
- 0, /* glMultiTexCoord2fARB */
- xglNoOpMultiTexCoord2fvARB,
- 0, /* glMultiTexCoord2iARB */
- xglNoOpMultiTexCoord2ivARB,
- 0, /* glMultiTexCoord2sARB */
- xglNoOpMultiTexCoord2svARB,
- 0, /* glMultiTexCoord3dARB */
- xglNoOpMultiTexCoord3dvARB,
- 0, /* glMultiTexCoord3fARB */
- xglNoOpMultiTexCoord3fvARB,
- 0, /* glMultiTexCoord3iARB */
- xglNoOpMultiTexCoord3ivARB,
- 0, /* glMultiTexCoord3sARB */
- xglNoOpMultiTexCoord3svARB,
- 0, /* glMultiTexCoord4dARB */
- xglNoOpMultiTexCoord4dvARB,
- 0, /* glMultiTexCoord4fARB */
- xglNoOpMultiTexCoord4fvARB,
- 0, /* glMultiTexCoord4iARB */
- xglNoOpMultiTexCoord4ivARB,
- 0, /* glMultiTexCoord4sARB */
- xglNoOpMultiTexCoord4svARB,
- 0, /* glLoadTransposeMatrixfARB */
- 0, /* glLoadTransposeMatrixdARB */
- 0, /* glMultTransposeMatrixfARB */
- 0, /* glMultTransposeMatrixdARB */
- xglNoOpSampleCoverageARB,
- 0, /* glDrawBuffersARB */
- 0, /* glPolygonOffsetEXT */
- 0, /* glGetTexFilterFuncSGIS */
- 0, /* glTexFilterFuncSGIS */
- 0, /* glGetHistogramEXT */
- 0, /* glGetHistogramParameterfvEXT */
- 0, /* glGetHistogramParameterivEXT */
- 0, /* glGetMinmaxEXT */
- 0, /* glGetMinmaxParameterfvEXT */
- 0, /* glGetMinmaxParameterivEXT */
- 0, /* glGetConvolutionFilterEXT */
- 0, /* glGetConvolutionParameterfvEXT */
- 0, /* glGetConvolutionParameterivEXT */
- 0, /* glGetSeparableFilterEXT */
- 0, /* glGetColorTableSGI */
- 0, /* glGetColorTableParameterfvSGI */
- 0, /* glGetColorTableParameterivSGI */
- 0, /* glPixelTexGenSGIX */
- 0, /* glPixelTexGenParameteriSGIS */
- 0, /* glPixelTexGenParameterivSGIS */
- 0, /* glPixelTexGenParameterfSGIS */
- 0, /* glPixelTexGenParameterfvSGIS */
- 0, /* glGetPixelTexGenParameterivSGIS */
- 0, /* glGetPixelTexGenParameterfvSGIS */
- 0, /* glTexImage4DSGIS */
- 0, /* glTexSubImage4DSGIS */
- xglNoOpAreTexturesResidentEXT,
- xglNoOpGenTexturesEXT,
- xglNoOpIsTextureEXT,
- 0, /* glDetailTexFuncSGIS */
- 0, /* glGetDetailTexFuncSGIS */
- 0, /* glSharpenTexFuncSGIS */
- 0, /* glGetSharpenTexFuncSGIS */
- xglNoOpSampleMaskSGIS,
- xglNoOpSamplePatternSGIS,
- 0, /* glColorPointerEXT */
- 0, /* glEdgeFlagPointerEXT */
- 0, /* glIndexPointerEXT */
- 0, /* glNormalPointerEXT */
- 0, /* glTexCoordPointerEXT */
- 0, /* glVertexPointerEXT */
- 0, /* glSpriteParameterfSGIX */
- 0, /* glSpriteParameterfvSGIX */
- 0, /* glSpriteParameteriSGIX */
- 0, /* glSpriteParameterivSGIX */
- xglNoOpPointParameterfEXT,
- xglNoOpPointParameterfvEXT,
- 0, /* glGetInstrumentsSGIX */
- 0, /* glInstrumentsBufferSGIX */
- 0, /* glPollInstrumentsSGIX */
- 0, /* glReadInstrumentsSGIX */
- 0, /* glStartInstrumentsSGIX */
- 0, /* glStopInstrumentsSGIX */
- 0, /* glFrameZoomSGIX */
- 0, /* glTagSampleBufferSGIX */
- 0, /* glReferencePlaneSGIX */
- 0, /* glFlushRasterSGIX */
- 0, /* glGetListParameterfvSGIX */
- 0, /* glGetListParameterivSGIX */
- 0, /* glListParameterfSGIX */
- 0, /* glListParameterfvSGIX */
- 0, /* glListParameteriSGIX */
- 0, /* glListParameterivSGIX */
- 0, /* glFragmentColorMaterialSGIX */
- 0, /* glFragmentLightfSGIX */
- 0, /* glFragmentLightfvSGIX */
- 0, /* glFragmentLightiSGIX */
- 0, /* glFragmentLightivSGIX */
- 0, /* glFragmentLightModelfSGIX */
- 0, /* glFragmentLightModelfvSGIX */
- 0, /* glFragmentLightModeliSGIX */
- 0, /* glFragmentLightModelivSGIX */
- 0, /* glFragmentMaterialfSGIX */
- 0, /* glFragmentMaterialfvSGIX */
- 0, /* glFragmentMaterialiSGIX */
- 0, /* glFragmentMaterialivSGIX */
- 0, /* glGetFragmentLightfvSGIX */
- 0, /* glGetFragmentLightivSGIX */
- 0, /* glGetFragmentMaterialfvSGIX */
- 0, /* glGetFragmentMaterialivSGIX */
- 0, /* glLightEnviSGIX */
- 0, /* glVertexWeightfEXT */
- 0, /* glVertexWeightfvEXT */
- 0, /* glVertexWeightPointerEXT */
- 0, /* glFlushVertexArrayRangeNV */
- 0, /* glVertexArrayRangeNV */
- 0, /* glCombinerParameterfvNV */
- 0, /* glCombinerParameterfNV */
- 0, /* glCombinerParameterivNV */
- 0, /* glCombinerParameteriNV */
- 0, /* glCombinerInputNV */
- 0, /* glCombinerOutputNV */
- 0, /* glFinalCombinerInputNV */
- 0, /* glGetCombinerInputParameterfvNV */
- 0, /* glGetCombinerInputParameterivNV */
- 0, /* glGetCombinerOutputParameterfvNV */
- 0, /* glGetCombinerOutputParameterivNV */
- 0, /* glGetFinalCombinerInputParameterfvNV */
- 0, /* glGetFinalCombinerInputParameterivNV */
- 0, /* glResizeBuffersMESA */
- 0, /* glWindowPos2dMESA */
- 0, /* glWindowPos2dvMESA */
- 0, /* glWindowPos2fMESA */
- 0, /* glWindowPos2fvMESA */
- 0, /* glWindowPos2iMESA */
- 0, /* glWindowPos2ivMESA */
- 0, /* glWindowPos2sMESA */
- 0, /* glWindowPos2svMESA */
- 0, /* glWindowPos3dMESA */
- 0, /* glWindowPos3dvMESA */
- xglNoOpWindowPos3fMESA,
- 0, /* glWindowPos3fvMESA */
- 0, /* glWindowPos3iMESA */
- 0, /* glWindowPos3ivMESA */
- 0, /* glWindowPos3sMESA */
- 0, /* glWindowPos3svMESA */
- 0, /* glWindowPos4dMESA */
- 0, /* glWindowPos4dvMESA */
- 0, /* glWindowPos4fMESA */
- 0, /* glWindowPos4fvMESA */
- 0, /* glWindowPos4iMESA */
- 0, /* glWindowPos4ivMESA */
- 0, /* glWindowPos4sMESA */
- 0, /* glWindowPos4svMESA */
- xglNoOpBlendFuncSeparateEXT,
- 0, /* glIndexMaterialEXT */
- 0, /* glIndexFuncEXT */
- 0, /* glLockArraysEXT */
- 0, /* glUnlockArraysEXT */
- 0, /* glCullParameterdvEXT */
- 0, /* glCullParameterfvEXT */
- 0, /* glHintPGI */
- 0, /* glFogCoordfEXT */
- xglNoOpFogCoordfvEXT,
- 0, /* glFogCoorddEXT */
- xglNoOpFogCoorddvEXT,
- xglNoOpFogCoordPointerEXT,
- 0, /* glGetColorTableEXT */
- 0, /* glGetColorTableParameterivEXT */
- 0, /* glGetColorTableParameterfvEXT */
- 0, /* glTbufferMask3DFX */
- 0, /* glCompressedTexImage3DARB */
- 0, /* glCompressedTexImage2DARB */
- 0, /* glCompressedTexImage1DARB */
- 0, /* glCompressedTexSubImage3DARB */
- 0, /* glCompressedTexSubImage2DARB */
- 0, /* glCompressedTexSubImage1DARB */
- 0, /* glGetCompressedTexImageARB */
- 0, /* glSecondaryColor3bEXT */
- xglNoOpSecondaryColor3bvEXT,
- 0, /* glSecondaryColor3dEXT */
- xglNoOpSecondaryColor3dvEXT,
- 0, /* glSecondaryColor3fEXT */
- xglNoOpSecondaryColor3fvEXT,
- 0, /* glSecondaryColor3iEXT */
- xglNoOpSecondaryColor3ivEXT,
- 0, /* glSecondaryColor3sEXT */
- xglNoOpSecondaryColor3svEXT,
- 0, /* glSecondaryColor3ubEXT */
- xglNoOpSecondaryColor3ubvEXT,
- 0, /* glSecondaryColor3uiEXT */
- xglNoOpSecondaryColor3uivEXT,
- 0, /* glSecondaryColor3usEXT */
- xglNoOpSecondaryColor3usvEXT,
- xglNoOpSecondaryColorPointerEXT,
- 0, /* glAreProgramsResidentNV */
- 0, /* glBindProgramNV */
- 0, /* glDeleteProgramsNV */
- 0, /* glExecuteProgramNV */
- 0, /* glGenProgramsNV */
- 0, /* glGetProgramParameterdvNV */
- 0, /* glGetProgramParameterfvNV */
- 0, /* glGetProgramivNV */
- 0, /* glGetProgramStringNV */
- 0, /* glGetTrackMatrixivNV */
- 0, /* glGetVertexAttribdvARB */
- 0, /* glGetVertexAttribfvARB */
- 0, /* glGetVertexAttribivARB */
- 0, /* glGetVertexAttribPointervNV */
- 0, /* glIsProgramNV */
- 0, /* glLoadProgramNV */
- 0, /* glProgramParameter4dNV */
- 0, /* glProgramParameter4dvNV */
- 0, /* glProgramParameter4fNV */
- 0, /* glProgramParameter4fvNV */
- 0, /* glProgramParameters4dvNV */
- 0, /* glProgramParameters4fvNV */
- 0, /* glRequestResidentProgramsNV */
- 0, /* glTrackMatrixNV */
- 0, /* glVertexAttribPointerNV */
- 0, /* glVertexAttrib1dARB */
- 0, /* glVertexAttrib1dvARB */
- 0, /* glVertexAttrib1fARB */
- 0, /* glVertexAttrib1fvARB */
- 0, /* glVertexAttrib1sARB */
- 0, /* glVertexAttrib1svARB */
- 0, /* glVertexAttrib2dARB */
- 0, /* glVertexAttrib2dvARB */
- 0, /* glVertexAttrib2fARB */
- 0, /* glVertexAttrib2fvARB */
- 0, /* glVertexAttrib2sARB */
- 0, /* glVertexAttrib2svARB */
- 0, /* glVertexAttrib3dARB */
- 0, /* glVertexAttrib3dvARB */
- 0, /* glVertexAttrib3fARB */
- 0, /* glVertexAttrib3fvARB */
- 0, /* glVertexAttrib3sARB */
- 0, /* glVertexAttrib3svARB */
- 0, /* glVertexAttrib4dARB */
- 0, /* glVertexAttrib4dvARB */
- 0, /* glVertexAttrib4fARB */
- 0, /* glVertexAttrib4fvARB */
- 0, /* glVertexAttrib4sARB */
- 0, /* glVertexAttrib4svARB */
- 0, /* glVertexAttrib4NubARB */
- 0, /* glVertexAttrib4NubvARB */
- 0, /* glVertexAttribs1dvNV */
- 0, /* glVertexAttribs1fvNV */
- 0, /* glVertexAttribs1svNV */
- 0, /* glVertexAttribs2dvNV */
- 0, /* glVertexAttribs2fvNV */
- 0, /* glVertexAttribs2svNV */
- 0, /* glVertexAttribs3dvNV */
- 0, /* glVertexAttribs3fvNV */
- 0, /* glVertexAttribs3svNV */
- 0, /* glVertexAttribs4dvNV */
- 0, /* glVertexAttribs4fvNV */
- 0, /* glVertexAttribs4svNV */
- 0, /* glVertexAttribs4ubvNV */
- xglNoOpPointParameteriNV,
- xglNoOpPointParameterivNV,
- 0, /* glMultiDrawArraysEXT */
- 0, /* glMultiDrawElementsEXT */
- xglNoOpActiveStencilFaceEXT,
- 0, /* glDeleteFencesNV */
- 0, /* glGenFencesNV */
- 0, /* glIsFenceNV */
- 0, /* glTestFenceNV */
- 0, /* glGetFenceivNV */
- 0, /* glFinishFenceNV */
- 0, /* glSetFenceNV */
- 0, /* glVertexAttrib4bvARB */
- 0, /* glVertexAttrib4ivARB */
- 0, /* glVertexAttrib4ubvARB */
- 0, /* glVertexAttrib4usvARB */
- 0, /* glVertexAttrib4uivARB */
- 0, /* glVertexAttrib4NbvARB */
- 0, /* glVertexAttrib4NsvARB */
- 0, /* glVertexAttrib4NivARB */
- 0, /* glVertexAttrib4NusvARB */
- 0, /* glVertexAttrib4NuivARB */
- 0, /* glVertexAttribPointerARB */
- 0, /* glEnableVertexAttribArrayARB */
- 0, /* glDisableVertexAttribArrayARB */
- 0, /* glProgramStringARB */
- 0, /* glProgramEnvParameter4dARB */
- 0, /* glProgramEnvParameter4dvARB */
- 0, /* glProgramEnvParameter4fARB */
- 0, /* glProgramEnvParameter4fvARB */
- 0, /* glProgramLocalParameter4dARB */
- 0, /* glProgramLocalParameter4dvARB */
- 0, /* glProgramLocalParameter4fARB */
- 0, /* glProgramLocalParameter4fvARB */
- 0, /* glGetProgramEnvParameterdvARB */
- 0, /* glGetProgramEnvParameterfvARB */
- 0, /* glGetProgramLocalParameterdvARB */
- 0, /* glGetProgramLocalParameterfvARB */
- 0, /* glGetProgramivARB */
- 0, /* glGetProgramStringARB */
- 0, /* glProgramNamedParameter4fNV */
- 0, /* glProgramNamedParameter4dNV */
- 0, /* glProgramNamedParameter4fvNV */
- 0, /* glProgramNamedParameter4dvNV */
- 0, /* glGetProgramNamedParameterfvNV */
- 0, /* glGetProgramNamedParameterdvNV */
- 0, /* glBindBufferARB */
- 0, /* glBufferDataARB */
- 0, /* glBufferSubDataARB */
- 0, /* glDeleteBuffersARB */
- 0, /* glGenBuffersARB */
- 0, /* glGetBufferParameterivARB */
- 0, /* glGetBufferPointervARB */
- 0, /* glGetBufferSubDataARB */
- 0, /* glIsBufferARB */
- 0, /* glMapBufferARB */
- 0, /* glUnmapBufferARB */
- 0, /* glDepthBoundsEXT */
- 0, /* glGenQueriesARB */
- 0, /* glDeleteQueriesARB */
- 0, /* glIsQueryARB */
- 0, /* glBeginQueryARB */
- 0, /* glEndQueryARB */
- 0, /* glGetQueryivARB */
- 0, /* glGetQueryObjectivARB */
- 0, /* glGetQueryObjectuivARB */
- 0, /* glMultiModeDrawArraysIBM */
- 0, /* glMultiModeDrawElementsIBM */
- 0, /* glBlendEquationSeparateEXT */
- 0, /* glDeleteObjectARB */
- 0, /* glGetHandleARB */
- 0, /* glDetachObjectARB */
- 0, /* glCreateShaderObjectARB */
- 0, /* glShaderSourceARB */
- 0, /* glCompileShaderARB */
- 0, /* glCreateProgramObjectARB */
- 0, /* glAttachObjectARB */
- 0, /* glLinkProgramARB */
- 0, /* glUseProgramObjectARB */
- 0, /* glValidateProgramARB */
- 0, /* glUniform1fARB */
- 0, /* glUniform2fARB */
- 0, /* glUniform3fARB */
- 0, /* glUniform4fARB */
- 0, /* glUniform1iARB */
- 0, /* glUniform2iARB */
- 0, /* glUniform3iARB */
- 0, /* glUniform4iARB */
- 0, /* glUniform1fvARB */
- 0, /* glUniform2fvARB */
- 0, /* glUniform3fvARB */
- 0, /* glUniform4fvARB */
- 0, /* glUniform1ivARB */
- 0, /* glUniform2ivARB */
- 0, /* glUniform3ivARB */
- 0, /* glUniform4ivARB */
- 0, /* glUniformMatrix2fvARB */
- 0, /* glUniformMatrix3fvARB */
- 0, /* glUniformMatrix4fvARB */
- 0, /* glGetObjectParameterfvARB */
- 0, /* glGetObjectParameterivARB */
- 0, /* glGetInfoLogARB */
- 0, /* glGetAttachedObjectsARB */
- 0, /* glGetUniformLocationARB */
- 0, /* glGetActiveUniformARB */
- 0, /* glGetUniformfvARB */
- 0, /* glGetUniformivARB */
- 0, /* glGetShaderSourceARB */
- 0, /* glBindAttribLocationARB */
- 0, /* glGetActiveAttribARB */
- 0, /* glGetAttribLocationARB */
- 0, /* glGetVertexAttribdvNV */
- 0, /* glGetVertexAttribfvNV */
- 0, /* glGetVertexAttribivNV */
- 0, /* glVertexAttrib1dNV */
- 0, /* glVertexAttrib1dvNV */
- 0, /* glVertexAttrib1fNV */
- 0, /* glVertexAttrib1fvNV */
- 0, /* glVertexAttrib1sNV */
- 0, /* glVertexAttrib1svNV */
- 0, /* glVertexAttrib2dNV */
- 0, /* glVertexAttrib2dvNV */
- 0, /* glVertexAttrib2fNV */
- 0, /* glVertexAttrib2fvNV */
- 0, /* glVertexAttrib2sNV */
- 0, /* glVertexAttrib2svNV */
- 0, /* glVertexAttrib3dNV */
- 0, /* glVertexAttrib3dvNV */
- 0, /* glVertexAttrib3fNV */
- 0, /* glVertexAttrib3fvNV */
- 0, /* glVertexAttrib3sNV */
- 0, /* glVertexAttrib3svNV */
- 0, /* glVertexAttrib4dNV */
- 0, /* glVertexAttrib4dvNV */
- 0, /* glVertexAttrib4fNV */
- 0, /* glVertexAttrib4fvNV */
- 0, /* glVertexAttrib4sNV */
- 0, /* glVertexAttrib4svNV */
- 0, /* glVertexAttrib4ubNV */
- 0, /* glVertexAttrib4ubvNV */
- 0, /* glGenFragmentShadersATI */
- 0, /* glBindFragmentShaderATI */
- 0, /* glDeleteFragmentShaderATI */
- 0, /* glBeginFragmentShaderATI */
- 0, /* glEndFragmentShaderATI */
- 0, /* glPassTexCoordATI */
- 0, /* glSampleMapATI */
- 0, /* glColorFragmentOp1ATI */
- 0, /* glColorFragmentOp2ATI */
- 0, /* glColorFragmentOp3ATI */
- 0, /* glAlphaFragmentOp1ATI */
- 0, /* glAlphaFragmentOp2ATI */
- 0, /* glAlphaFragmentOp3ATI */
- 0, /* glSetFragmentShaderConstantATI */
- xglNoOpIsRenderbufferEXT,
- xglNoOpBindRenderbufferEXT,
- xglNoOpDeleteRenderbuffersEXT,
- xglNoOpGenRenderbuffersEXT,
- xglNoOpRenderbufferStorageEXT,
- xglNoOpGetRenderbufferParameterivEXT,
- xglNoOpIsFramebufferEXT,
- xglNoOpBindFramebufferEXT,
- xglNoOpDeleteFramebuffersEXT,
- xglNoOpGenFramebuffersEXT,
- xglNoOpCheckFramebufferStatusEXT,
- xglNoOpFramebufferTexture1DEXT,
- xglNoOpFramebufferTexture2DEXT,
- xglNoOpFramebufferTexture3DEXT,
- xglNoOpFramebufferRenderbufferEXT,
- xglNoOpGetFramebufferAttachmentParameterivEXT,
- xglNoOpGenerateMipmapEXT,
- 0, /* glStencilFuncSeparate */
- 0, /* glStencilOpSeparate */
- 0, /* glStencilMaskSeparate */
- 0, /* glGetQueryObjecti64vEXT */
- 0 /* glGetQueryObjectui64vEXT */
-};
-
-static void
-xglInitExtensions (xglGLContextPtr pContext)
-{
- const char *extensions;
-
- extensions = (const char *) glGetString (GL_EXTENSIONS);
-
- if (strstr (extensions, "GL_ARB_multitexture"))
- {
- pContext->ActiveTextureARB =
- (PFNGLACTIVETEXTUREARBPROC)
- glitz_context_get_proc_address (pContext->context,
- "glActiveTextureARB");
- pContext->glRenderTable.ClientActiveTextureARB =
- (PFNGLCLIENTACTIVETEXTUREARBPROC)
- glitz_context_get_proc_address (pContext->context,
- "glClientActiveTextureARB");
- pContext->glRenderTable.MultiTexCoord1dvARB =
- (PFNGLMULTITEXCOORD1DVARBPROC)
- glitz_context_get_proc_address (pContext->context,
- "glMultiTexCoord1dvARB");
- pContext->glRenderTable.MultiTexCoord1fvARB =
- (PFNGLMULTITEXCOORD1FVARBPROC)
- glitz_context_get_proc_address (pContext->context,
- "glMultiTexCoord1fvARB");
- pContext->glRenderTable.MultiTexCoord1ivARB =
- (PFNGLMULTITEXCOORD1IVARBPROC)
- glitz_context_get_proc_address (pContext->context,
- "glMultiTexCoord1ivARB");
- pContext->glRenderTable.MultiTexCoord1svARB =
- (PFNGLMULTITEXCOORD1SVARBPROC)
- glitz_context_get_proc_address (pContext->context,
- "glMultiTexCoord1svARB");
- pContext->glRenderTable.MultiTexCoord2dvARB =
- (PFNGLMULTITEXCOORD2DVARBPROC)
- glitz_context_get_proc_address (pContext->context,
- "glMultiTexCoord2dvARB");
- pContext->glRenderTable.MultiTexCoord2fvARB =
- (PFNGLMULTITEXCOORD2FVARBPROC)
- glitz_context_get_proc_address (pContext->context,
- "glMultiTexCoord2fvARB");
- pContext->glRenderTable.MultiTexCoord2ivARB =
- (PFNGLMULTITEXCOORD2IVARBPROC)
- glitz_context_get_proc_address (pContext->context,
- "glMultiTexCoord2ivARB");
- pContext->glRenderTable.MultiTexCoord2svARB =
- (PFNGLMULTITEXCOORD2SVARBPROC)
- glitz_context_get_proc_address (pContext->context,
- "glMultiTexCoord2svARB");
- pContext->glRenderTable.MultiTexCoord3dvARB =
- (PFNGLMULTITEXCOORD3DVARBPROC)
- glitz_context_get_proc_address (pContext->context,
- "glMultiTexCoord3dvARB");
- pContext->glRenderTable.MultiTexCoord3fvARB =
- (PFNGLMULTITEXCOORD3FVARBPROC)
- glitz_context_get_proc_address (pContext->context,
- "glMultiTexCoord3fvARB");
- pContext->glRenderTable.MultiTexCoord3ivARB =
- (PFNGLMULTITEXCOORD3IVARBPROC)
- glitz_context_get_proc_address (pContext->context,
- "glMultiTexCoord3ivARB");
- pContext->glRenderTable.MultiTexCoord3svARB =
- (PFNGLMULTITEXCOORD3SVARBPROC)
- glitz_context_get_proc_address (pContext->context,
- "glMultiTexCoord3svARB");
- pContext->glRenderTable.MultiTexCoord4dvARB =
- (PFNGLMULTITEXCOORD4DVARBPROC)
- glitz_context_get_proc_address (pContext->context,
- "glMultiTexCoord4dvARB");
- pContext->glRenderTable.MultiTexCoord4fvARB =
- (PFNGLMULTITEXCOORD4FVARBPROC)
- glitz_context_get_proc_address (pContext->context,
- "glMultiTexCoord4fvARB");
- pContext->glRenderTable.MultiTexCoord4ivARB =
- (PFNGLMULTITEXCOORD4IVARBPROC)
- glitz_context_get_proc_address (pContext->context,
- "glMultiTexCoord4ivARB");
- pContext->glRenderTable.MultiTexCoord4svARB =
- (PFNGLMULTITEXCOORD4SVARBPROC)
- glitz_context_get_proc_address (pContext->context,
- "glMultiTexCoord4svARB");
-
- glGetIntegerv (GL_MAX_TEXTURE_UNITS_ARB, &pContext->maxTexUnits);
- if (pContext->maxTexUnits > XGL_MAX_TEXTURE_UNITS)
- pContext->maxTexUnits = XGL_MAX_TEXTURE_UNITS;
-
- pContext->glRenderTable.ActiveTextureARB = xglActiveTextureARB;
- }
- else
- pContext->maxTexUnits = 1;
-
- if (strstr (extensions, "GL_ARB_multisample"))
- {
- pContext->glRenderTable.SampleCoverageARB =
- (PFNGLSAMPLECOVERAGEARBPROC)
- glitz_context_get_proc_address (pContext->context,
- "glSampleCoverageARB");
- }
-
- if (strstr (extensions, "GL_EXT_texture_object"))
- {
- pContext->glRenderTable.AreTexturesResidentEXT =
- xglAreTexturesResident;
- pContext->glRenderTable.GenTexturesEXT = xglGenTextures;
- pContext->glRenderTable.IsTextureEXT = xglIsTexture;
- }
-
- if (strstr (extensions, "GL_SGIS_multisample"))
- {
- pContext->glRenderTable.SampleMaskSGIS =
- (PFNGLSAMPLEMASKSGISPROC)
- glitz_context_get_proc_address (pContext->context,
- "glSampleMaskSGIS");
- pContext->glRenderTable.SamplePatternSGIS =
- (PFNGLSAMPLEPATTERNSGISPROC)
- glitz_context_get_proc_address (pContext->context,
- "glSamplePatternSGIS");
- }
-
- if (strstr (extensions, "GL_EXT_point_parameters"))
- {
- pContext->glRenderTable.PointParameterfEXT =
- (PFNGLPOINTPARAMETERFEXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glPointParameterfEXT");
- pContext->glRenderTable.PointParameterfvEXT =
- (PFNGLPOINTPARAMETERFVEXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glPointParameterfvEXT");
- }
-
- if (strstr (extensions, "GL_MESA_window_pos"))
- {
- pContext->WindowPos3fMESA =
- (PFNGLWINDOWPOS3FMESAPROC)
- glitz_context_get_proc_address (pContext->context,
- "glWindowPos3fMESA");
-
- pContext->glRenderTable.WindowPos3fMESA = xglWindowPos3fMESA;
- }
-
- if (strstr (extensions, "GL_EXT_blend_func_separate"))
- {
- pContext->glRenderTable.BlendFuncSeparateEXT =
- (PFNGLBLENDFUNCSEPARATEEXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glBlendFuncSeparateEXT");
- }
-
- if (strstr (extensions, "GL_EXT_fog_coord"))
- {
- pContext->glRenderTable.FogCoordfvEXT =
- (PFNGLFOGCOORDFVEXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glFogCoordfvEXT");
- pContext->glRenderTable.FogCoorddvEXT =
- (PFNGLFOGCOORDDVEXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glFogCoorddvEXT");
- pContext->glRenderTable.FogCoordPointerEXT =
- (PFNGLFOGCOORDPOINTEREXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glFogCoordPointerEXT");
- }
-
- if (strstr (extensions, "GL_EXT_secondary_color"))
- {
- pContext->glRenderTable.SecondaryColor3bvEXT =
- (PFNGLSECONDARYCOLOR3BVEXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glSecondaryColor3bvEXT");
- pContext->glRenderTable.SecondaryColor3dvEXT =
- (PFNGLSECONDARYCOLOR3DVEXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glSecondaryColor3dvEXT");
- pContext->glRenderTable.SecondaryColor3fvEXT =
- (PFNGLSECONDARYCOLOR3FVEXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glSecondaryColor3fvEXT");
- pContext->glRenderTable.SecondaryColor3ivEXT =
- (PFNGLSECONDARYCOLOR3IVEXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glSecondaryColor3ivEXT");
- pContext->glRenderTable.SecondaryColor3svEXT =
- (PFNGLSECONDARYCOLOR3SVEXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glSecondaryColor3svEXT");
- pContext->glRenderTable.SecondaryColor3ubvEXT =
- (PFNGLSECONDARYCOLOR3UBVEXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glSecondaryColor3ubvEXT");
- pContext->glRenderTable.SecondaryColor3uivEXT =
- (PFNGLSECONDARYCOLOR3UIVEXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glSecondaryColor3uivEXT");
- pContext->glRenderTable.SecondaryColor3usvEXT =
- (PFNGLSECONDARYCOLOR3USVEXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glSecondaryColor3usvEXT");
- pContext->glRenderTable.SecondaryColorPointerEXT =
- (PFNGLSECONDARYCOLORPOINTEREXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glSecondaryColorPointerEXT");
- }
-
- if (strstr (extensions, "GL_NV_point_sprite"))
- {
- pContext->glRenderTable.PointParameteriNV =
- (PFNGLPOINTPARAMETERINVPROC)
- glitz_context_get_proc_address (pContext->context,
- "glPointParameteriNV");
- pContext->glRenderTable.PointParameterivNV =
- (PFNGLPOINTPARAMETERIVNVPROC)
- glitz_context_get_proc_address (pContext->context,
- "glPointParameterivNV");
- }
-
- if (strstr (extensions, "GL_EXT_stencil_two_side"))
- {
- pContext->glRenderTable.ActiveStencilFaceEXT =
- (PFNGLACTIVESTENCILFACEEXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glActiveStencilFaceEXT");
- }
-
- if (strstr (extensions, "GL_EXT_framebuffer_object"))
- {
- pContext->glRenderTable.IsRenderbufferEXT =
- (PFNGLISRENDERBUFFEREXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glIsRenderbufferEXT");
- pContext->glRenderTable.BindRenderbufferEXT =
- (PFNGLBINDRENDERBUFFEREXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glBindRenderbufferEXT");
- pContext->glRenderTable.DeleteRenderbuffersEXT =
- (PFNGLDELETERENDERBUFFERSEXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glDeleteRenderbuffersEXT");
- pContext->glRenderTable.GenRenderbuffersEXT =
- (PFNGLGENRENDERBUFFERSEXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glGenRenderbuffersEXT");
- pContext->glRenderTable.RenderbufferStorageEXT =
- (PFNGLRENDERBUFFERSTORAGEEXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glRenderbufferStorageEXT");
- pContext->glRenderTable.GetRenderbufferParameterivEXT =
- (PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glGetRenderbufferParameterivEXT");
- pContext->glRenderTable.IsFramebufferEXT =
- (PFNGLISFRAMEBUFFEREXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glIsFramebufferEXT");
- pContext->glRenderTable.BindFramebufferEXT =
- (PFNGLBINDFRAMEBUFFEREXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glBindFramebufferEXT");
- pContext->glRenderTable.DeleteFramebuffersEXT =
- (PFNGLDELETEFRAMEBUFFERSEXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glDeleteFramebuffersEXT");
- pContext->glRenderTable.GenFramebuffersEXT =
- (PFNGLGENFRAMEBUFFERSEXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glGenFramebuffersEXT");
- pContext->glRenderTable.CheckFramebufferStatusEXT =
- (PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glCheckFramebufferStatusEXT");
- pContext->glRenderTable.FramebufferTexture1DEXT =
- (PFNGLFRAMEBUFFERTEXTURE1DEXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glFramebufferTexture1DEXT");
- pContext->glRenderTable.FramebufferTexture2DEXT =
- (PFNGLFRAMEBUFFERTEXTURE2DEXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glFramebufferTexture2DEXT");
- pContext->glRenderTable.FramebufferTexture3DEXT =
- (PFNGLFRAMEBUFFERTEXTURE3DEXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glFramebufferTexture3DEXT");
- pContext->glRenderTable.FramebufferRenderbufferEXT =
- (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glFramebufferRenderbufferEXT");
- pContext->glRenderTable.GetFramebufferAttachmentParameterivEXT =
- (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glGetFramebufferAttachment"
- "ParameterivEXT");
- pContext->glRenderTable.GenerateMipmapEXT =
- (PFNGLGENERATEMIPMAPEXTPROC)
- glitz_context_get_proc_address (pContext->context,
- "glGenerateMipmapEXT");
- }
-}
-
-static void
-xglSetCurrentContext (xglGLContextPtr pContext)
-{
- cctx = pContext;
-
- glitz_context_make_current (cctx->context, cctx->pDrawBuffer->drawable);
-
- GlxSetRenderTables (&cctx->glRenderTable);
-}
-
-static void
-xglFreeContext (xglGLContextPtr pContext)
-{
- int i;
-
- pContext->refcnt--;
- if (pContext->shared == pContext)
- pContext->refcnt--;
-
- if (pContext->refcnt)
- return;
-
- if (pContext->shared != pContext)
- xglFreeContext (pContext->shared);
-
- if (pContext->texObjects)
- {
- xglTexObjPtr pTexObj;
- GLuint key;
-
- do {
- key = xglHashFirstEntry (pContext->texObjects);
- if (key)
- {
- pTexObj = (xglTexObjPtr) xglHashLookup (pContext->texObjects,
- key);
- if (pTexObj)
- xglUnrefTexObj (pTexObj);
-
- xglHashRemove (pContext->texObjects, key);
- }
- } while (key);
-
- xglDeleteHashTable (pContext->texObjects);
- }
-
- if (pContext->displayLists)
- {
- xglDisplayListPtr pDisplayList;
- GLuint key;
-
- do {
- key = xglHashFirstEntry (pContext->displayLists);
- if (key)
- {
- pDisplayList = (xglDisplayListPtr)
- xglHashLookup (pContext->displayLists, key);
- if (pDisplayList)
- xglDestroyList (pDisplayList);
-
- xglHashRemove (pContext->displayLists, key);
- }
- } while (key);
-
- xglDeleteHashTable (pContext->displayLists);
- }
-
- for (i = 0; i < pContext->maxTexUnits; i++)
- {
- xglUnrefTexObj (pContext->attrib.texUnits[i].p1D);
- xglUnrefTexObj (pContext->attrib.texUnits[i].p2D);
- xglUnrefTexObj (pContext->attrib.texUnits[i].p3D);
- xglUnrefTexObj (pContext->attrib.texUnits[i].pRect);
- xglUnrefTexObj (pContext->attrib.texUnits[i].pCubeMap);
- }
-
- if (pContext->groupList)
- glDeleteLists (pContext->groupList, 1);
-
- if (pContext->context)
- glitz_context_destroy (pContext->context);
-
- if (pContext->versionString)
- xfree (pContext->versionString);
-
- xfree (pContext);
-}
-
-static GLboolean
-xglDestroyContext (__GLcontext *gc)
-{
- xglGLContextPtr pContext = (xglGLContextPtr) gc;
- __GLinterface *iface = pContext->mIface;
-
- xglFreeContext (pContext);
-
- if (!iface)
- return GL_TRUE;
-
- return (*iface->exports.destroyContext) ((__GLcontext *) iface);
-}
-
-static GLboolean
-xglLoseCurrent (__GLcontext *gc)
-{
- xglGLContextPtr pContext = (xglGLContextPtr) gc;
- __GLinterface *iface = pContext->mIface;
-
- GlxFlushContextCache ();
- GlxSetRenderTables (0);
-
- if (!iface)
- return GL_TRUE;
-
- return (*iface->exports.loseCurrent) ((__GLcontext *) iface);
-}
-
-static GLboolean
-xglMakeCurrent (__GLcontext *gc)
-{
- xglGLContextPtr pContext = (xglGLContextPtr) gc;
- __GLinterface *iface = &pContext->iface;
- __GLinterface *mIface = pContext->mIface;
- __GLdrawablePrivate *drawPriv = iface->imports.getDrawablePrivate (gc);
- __GLdrawablePrivate *readPriv = iface->imports.getReadablePrivate (gc);
- xglGLBufferPtr pDrawBufferPriv = drawPriv->private;
- xglGLBufferPtr pReadBufferPriv = readPriv->private;
- GLboolean status = GL_TRUE;
-
- if (pReadBufferPriv->pDrawable && pDrawBufferPriv->pDrawable)
- {
- XID values[2] = { ClipByChildren, 0 };
- int status;
-
-#ifdef COMPOSITE
- /* XXX: temporary hack for root window drawing using
- IncludeInferiors */
- if (pDrawBufferPriv->pDrawable->type == DRAWABLE_WINDOW &&
- (!((WindowPtr) (pDrawBufferPriv->pDrawable))->parent))
- values[0] = IncludeInferiors;
-#endif
-
- /* this happens if client previously used this context with a buffer
- not supported by the native GL stack */
- if (!pContext->context)
- return GL_FALSE;
-
- /* XXX: GLX_SGI_make_current_read disabled for now */
- if (pDrawBufferPriv != pReadBufferPriv)
- return GL_FALSE;
-
- if (!pReadBufferPriv->pGC)
- pReadBufferPriv->pGC =
- CreateGC (pReadBufferPriv->pDrawable,
- GCSubwindowMode | GCGraphicsExposures, values,
- &status);
-
- ValidateGC (pReadBufferPriv->pDrawable, pReadBufferPriv->pGC);
-
- if (!pDrawBufferPriv->pGC)
- pDrawBufferPriv->pGC =
- CreateGC (pDrawBufferPriv->pDrawable,
- GCSubwindowMode | GCGraphicsExposures, values,
- &status);
-
- ValidateGC (pDrawBufferPriv->pDrawable, pDrawBufferPriv->pGC);
-
- pReadBufferPriv->pPixmap = (PixmapPtr) 0;
- pDrawBufferPriv->pPixmap = (PixmapPtr) 0;
-
- pContext->pReadBuffer = pReadBufferPriv;
- pContext->pDrawBuffer = pDrawBufferPriv;
-
- pContext->readPriv = readPriv;
- pContext->drawPriv = drawPriv;
-
- /* from now on this context can only be used with native GL stack */
- if (mIface)
- {
- (*mIface->exports.destroyContext) ((__GLcontext *) mIface);
- pContext->mIface = NULL;
- }
- }
- else
- {
- /* this happens if client previously used this context with a buffer
- supported by the native GL stack */
- if (!mIface)
- return GL_FALSE;
-
- drawPriv->private = pDrawBufferPriv->private;
- readPriv->private = pReadBufferPriv->private;
-
- status = (*mIface->exports.makeCurrent) ((__GLcontext *) mIface);
-
- drawPriv->private = pDrawBufferPriv;
- readPriv->private = pReadBufferPriv;
-
- /* from now on this context can not be used with native GL stack */
- if (status == GL_TRUE && pContext->context)
- {
- glitz_context_destroy (pContext->context);
- pContext->context = NULL;
- }
- }
-
- return status;
-}
-
-static GLboolean
-xglShareContext (__GLcontext *gc,
- __GLcontext *gcShare)
-{
- xglGLContextPtr pContext = (xglGLContextPtr) gc;
- xglGLContextPtr pContextShare = (xglGLContextPtr) gcShare;
- __GLinterface *iface = pContext->mIface;
- __GLinterface *ifaceShare = pContextShare->mIface;
-
- if (!iface || !ifaceShare)
- return GL_TRUE;
-
- return (*iface->exports.shareContext) ((__GLcontext *) iface,
- (__GLcontext *) ifaceShare);
-}
-
-static GLboolean
-xglCopyContext (__GLcontext *dst,
- const __GLcontext *src,
- GLuint mask)
-{
- xglGLContextPtr pDst = (xglGLContextPtr) dst;
- xglGLContextPtr pSrc = (xglGLContextPtr) src;
- const __GLcontext *srcCtx = (const __GLcontext *) pSrc->mIface;
- __GLinterface *dstIface = (__GLinterface *) pDst->mIface;
- GLboolean status = GL_TRUE;
-
- if (pSrc->context && pDst->context)
- glitz_context_copy (pSrc->context, pDst->context, mask);
- else
- status = GL_FALSE;
-
- if (dstIface && srcCtx)
- status = (*dstIface->exports.copyContext) ((__GLcontext *) dstIface,
- srcCtx,
- mask);
-
- 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 (!xglCreatePixmapSurface (pPixmap))
- return FALSE;
-
- if (pBufferPriv->drawable == pScreenPriv->drawable)
- {
- if (pBufferPriv->backSurface)
- glitz_surface_destroy (pBufferPriv->backSurface);
-
- glitz_drawable_destroy (pBufferPriv->drawable);
-
- pBufferPriv->drawable = NULL;
- pBufferPriv->backSurface = NULL;
- }
-
- if (pBufferPriv->drawable)
- {
- glitz_drawable_update_size (pBufferPriv->drawable,
- pPixmap->drawable.width,
- pPixmap->drawable.height);
- }
- else
- {
- glitz_drawable_format_t *format;
-
- format = pBufferPriv->pVisual->format.drawable;
- if (pBufferPriv->pVisual->pbuffer)
- {
- pBufferPriv->drawable =
- glitz_create_pbuffer_drawable (pScreenPriv->drawable,
- format,
- pPixmap->drawable.width,
- pPixmap->drawable.height);
- }
- else
- {
- pBufferPriv->drawable =
- glitz_create_drawable (pScreenPriv->drawable, format,
- pPixmap->drawable.width,
- pPixmap->drawable.height);
-
- if (!pBufferPriv->drawable)
- return FALSE;
-
- if (format->doublebuffer)
- {
- glitz_format_t *backFormat;
-
- backFormat = pBufferPriv->pVisual->format.surface;
-
- pBufferPriv->backSurface =
- glitz_surface_create (pScreenPriv->drawable, backFormat,
- pPixmap->drawable.width,
- pPixmap->drawable.height,
- 0, NULL);
- if (pBufferPriv->backSurface)
- glitz_surface_attach (pBufferPriv->backSurface,
- pBufferPriv->drawable,
- GLITZ_DRAWABLE_BUFFER_BACK_COLOR);
- }
- }
- }
- }
- else
- {
- glitz_drawable_reference (pScreenPriv->drawable);
-
- if (pBufferPriv->backSurface)
- glitz_surface_destroy (pBufferPriv->backSurface);
-
- if (pBufferPriv->drawable)
- glitz_drawable_destroy (pBufferPriv->drawable);
-
- pBufferPriv->drawable = pScreenPriv->drawable;
- pBufferPriv->backSurface = NULL;
- }
-
- ValidateGC (pDrawable, pBufferPriv->pGC);
-
- return TRUE;
-}
-
-static GLboolean
-xglForceCurrent (__GLcontext *gc)
-{
- xglGLContextPtr pContext = (xglGLContextPtr) gc;
- __GLinterface *iface = pContext->mIface;
- GLboolean status = GL_TRUE;
-
- if (pContext && pContext->context)
- {
- __GLdrawablePrivate *readPriv, *drawPriv;
-
- readPriv = pContext->readPriv;
- drawPriv = pContext->drawPriv;
-
- drawPriv->lockDP (drawPriv, gc);
- if (readPriv != drawPriv)
- readPriv->lockDP (readPriv, gc);
-
- cctx = pContext;
-
- if (cctx->pReadBuffer->pDrawable && cctx->pDrawBuffer->pDrawable)
- {
- DrawablePtr pDrawable = cctx->pReadBuffer->pDrawable;
- PixmapPtr pReadPixmap, pDrawPixmap;
-
- XGL_SCREEN_PRIV (pDrawable->pScreen);
-
- if (pDrawable->type != DRAWABLE_PIXMAP)
- {
- pReadPixmap = XGL_GET_WINDOW_PIXMAP (pDrawable);
- cctx->pReadBuffer->screenX = __XGL_OFF_X_WIN (pReadPixmap);
- cctx->pReadBuffer->screenY = __XGL_OFF_Y_WIN (pReadPixmap);
- cctx->pReadBuffer->xOff = pDrawable->x +
- __XGL_OFF_X_WIN (pReadPixmap);
- cctx->pReadBuffer->yOff = pReadPixmap->drawable.height -
- ((pDrawable->y + __XGL_OFF_Y_WIN (pReadPixmap)) +
- pDrawable->height);
- cctx->pReadBuffer->yFlip = pReadPixmap->drawable.height;
- }
- else
- {
- pReadPixmap = (PixmapPtr) pDrawable;
- cctx->pReadBuffer->screenX = cctx->pReadBuffer->screenY = 0;
- cctx->pReadBuffer->xOff = cctx->pReadBuffer->yOff = 0;
- cctx->pReadBuffer->yFlip = pDrawable->height;
- }
-
- pDrawable = cctx->pDrawBuffer->pDrawable;
- if (pDrawable->type != DRAWABLE_PIXMAP)
- {
- pDrawPixmap = XGL_GET_WINDOW_PIXMAP (pDrawable);
- cctx->pDrawBuffer->screenX = __XGL_OFF_X_WIN (pDrawPixmap);
- cctx->pDrawBuffer->screenY = __XGL_OFF_Y_WIN (pDrawPixmap);
- cctx->pDrawBuffer->xOff = pDrawable->x +
- __XGL_OFF_X_WIN (pDrawPixmap);
- cctx->pDrawBuffer->yOff = pDrawPixmap->drawable.height -
- ((pDrawable->y + __XGL_OFF_Y_WIN (pDrawPixmap)) +
- pDrawable->height);
- cctx->pDrawBuffer->yFlip = pDrawPixmap->drawable.height;
- }
- else
- {
- pDrawPixmap = (PixmapPtr) pDrawable;
- cctx->pDrawBuffer->screenX = cctx->pDrawBuffer->screenY = 0;
- cctx->pDrawBuffer->xOff = cctx->pDrawBuffer->yOff = 0;
- cctx->pDrawBuffer->yFlip = pDrawable->height;
- }
-
- /* buffer changed */
- if (cctx->pDrawBuffer->pPixmap != pDrawPixmap ||
- cctx->pReadBuffer->pPixmap != pReadPixmap)
- {
- if (!xglResizeBuffer (drawPriv,
- pDrawable->x,
- pDrawable->y,
- pDrawable->width,
- pDrawable->height))
- {
- drawPriv->unlockDP (drawPriv);
- if (readPriv != drawPriv)
- readPriv->unlockDP (readPriv);
-
- return FALSE;
- }
-
- if (!xglResizeBuffer (readPriv,
- cctx->pReadBuffer->pDrawable->x,
- cctx->pReadBuffer->pDrawable->y,
- cctx->pReadBuffer->pDrawable->width,
- cctx->pReadBuffer->pDrawable->height))
- {
- drawPriv->unlockDP (drawPriv);
- if (readPriv != drawPriv)
- readPriv->unlockDP (readPriv);
-
- return FALSE;
- }
-
- cctx->pReadBuffer->pPixmap = pReadPixmap;
- cctx->pDrawBuffer->pPixmap = pDrawPixmap;
- }
-
- if (!xglSyncSurface (pContext->pDrawBuffer->pDrawable))
- {
- drawPriv->unlockDP (drawPriv);
- if (readPriv != drawPriv)
- readPriv->unlockDP (readPriv);
-
- return FALSE;
- }
-
- if (pDrawPixmap != pScreenPriv->pScreenPixmap)
- {
- XGL_PIXMAP_PRIV (pDrawPixmap);
-
- glitz_surface_attach (pPixmapPriv->surface,
- pContext->pDrawBuffer->drawable,
- GLITZ_DRAWABLE_BUFFER_FRONT_COLOR);
-
- if (pPixmapPriv->target)
- pPixmapPriv->target = xglPixmapTargetOut;
- }
-
- xglSetCurrentContext (pContext);
-
- if (cctx->needInit)
- {
- int i;
-
- xglInitExtensions (cctx);
-
- glGetIntegerv (GL_MAX_LIST_NESTING, &cctx->maxListNesting);
- glGetIntegerv (GL_MAX_ATTRIB_STACK_DEPTH,
- &cctx->maxAttribStackDepth);
- if (cctx->maxAttribStackDepth > XGL_MAX_ATTRIB_STACK_DEPTH)
- cctx->maxAttribStackDepth = XGL_MAX_ATTRIB_STACK_DEPTH;
-
- cctx->attrib.scissorTest = GL_FALSE;
- cctx->attrib.scissor.x = cctx->attrib.scissor.y = 0;
- cctx->attrib.scissor.width =
- cctx->pDrawBuffer->pDrawable->width;
- cctx->attrib.scissor.height =
- cctx->pDrawBuffer->pDrawable->height;
- cctx->attrib.viewport = cctx->attrib.scissor;
-
- cctx->activeTexUnit = 0;
-
- for (i = 0; i < cctx->maxTexUnits; i++)
- {
- cctx->attrib.texUnits[i].enabled = 0;
-
- cctx->attrib.texUnits[i].p1D = NULL;
- cctx->attrib.texUnits[i].p2D = NULL;
- cctx->attrib.texUnits[i].p3D = NULL;
- cctx->attrib.texUnits[i].pRect = NULL;
- cctx->attrib.texUnits[i].pCubeMap = NULL;
- }
-
- glEnable (GL_SCISSOR_TEST);
-
- cctx->needInit = FALSE;
- }
-
- /* update viewport and raster position */
- if (cctx->pDrawBuffer->xOff != cctx->drawXoff ||
- cctx->pDrawBuffer->yOff != cctx->drawYoff)
- {
- glViewport (cctx->attrib.viewport.x + cctx->pDrawBuffer->xOff,
- cctx->attrib.viewport.y + cctx->pDrawBuffer->yOff,
- cctx->attrib.viewport.width,
- cctx->attrib.viewport.height);
-
- glBitmap (0, 0, 0, 0,
- cctx->pDrawBuffer->xOff - cctx->drawXoff,
- cctx->pDrawBuffer->yOff - cctx->drawYoff,
- NULL);
-
- cctx->drawXoff = cctx->pDrawBuffer->xOff;
- cctx->drawYoff = cctx->pDrawBuffer->yOff;
- }
-
- xglDrawBuffer (cctx->attrib.drawBuffer);
- xglReadBuffer (cctx->attrib.readBuffer);
- }
- else
- {
- xglSetCurrentContext (pContext);
- }
-
- drawPriv->unlockDP (drawPriv);
- if (readPriv != drawPriv)
- readPriv->unlockDP (readPriv);
- }
- else
- {
- cctx = NULL;
- status = (*iface->exports.forceCurrent) ((__GLcontext *) iface);
- }
-
- return status;
-}
-
-static GLboolean
-xglNotifyResize (__GLcontext *gc)
-{
- xglGLContextPtr pContext = (xglGLContextPtr) gc;
- __GLinterface *iface = pContext->mIface;
-
- if (!iface)
- return GL_TRUE;
-
- return (*iface->exports.notifyResize) ((__GLcontext *) iface);
-}
-
-static void
-xglNotifyDestroy (__GLcontext *gc)
-{
- xglGLContextPtr pContext = (xglGLContextPtr) gc;
- __GLinterface *iface = pContext->mIface;
-
- pContext->pReadBuffer->pDrawable = 0;
- pContext->pDrawBuffer->pDrawable = 0;
-
- if (iface)
- (*iface->exports.notifyDestroy) ((__GLcontext *) iface);
-}
-
-static void
-xglNotifySwapBuffers (__GLcontext *gc)
-{
- xglGLContextPtr pContext = (xglGLContextPtr) gc;
- __GLinterface *iface = pContext->mIface;
-
- if (iface)
- (*iface->exports.notifySwapBuffers) ((__GLcontext *) iface);
-}
-
-static struct __GLdispatchStateRec *
-xglDispatchExec (__GLcontext *gc)
-{
- xglGLContextPtr pContext = (xglGLContextPtr) gc;
- __GLinterface *iface = pContext->mIface;
-
- if (!iface)
- return NULL;
-
- return (*iface->exports.dispatchExec) ((__GLcontext *) iface);
-}
-
-static void
-xglBeginDispatchOverride (__GLcontext *gc)
-{
- xglGLContextPtr pContext = (xglGLContextPtr) gc;
- __GLinterface *iface = pContext->mIface;
-
- if (iface)
- (*iface->exports.beginDispatchOverride) ((__GLcontext *) iface);
-}
-
-static void
-xglEndDispatchOverride (__GLcontext *gc)
-{
- xglGLContextPtr pContext = (xglGLContextPtr) gc;
- __GLinterface *iface = pContext->mIface;
-
- if (iface)
- (*iface->exports.endDispatchOverride) ((__GLcontext *) iface);
-}
-
-static void
-xglLoseCurrentContext (void *closure)
-{
- if (closure == cctx)
- {
- cctx = NULL;
-
- GlxFlushContextCache ();
- GlxSetRenderTables (0);
- }
-}
-
-static __GLinterface *
-xglCreateContext (__GLimports *imports,
- __GLcontextModes *modes,
- __GLinterface *shareGC)
-{
- glitz_drawable_format_t *format;
- xglGLContextPtr pShareContext = (xglGLContextPtr) shareGC;
- xglGLContextPtr pContext;
- __GLinterface *shareIface = NULL;
- __GLinterface *iface;
- __GLXcontext *glxCtx = (__GLXcontext *) imports->other;
-
- XGL_SCREEN_PRIV (glxCtx->pScreen);
-
- pContext = xalloc (sizeof (xglGLContextRec));
- if (!pContext)
- return NULL;
-
- format = glitz_drawable_get_format (pScreenPriv->drawable);
- pContext->context = glitz_context_create (pScreenPriv->drawable, format);
- glitz_context_set_user_data (pContext->context, pContext,
- xglLoseCurrentContext);
-
- pContext->glRenderTable = __glNativeRenderTable;
- pContext->needInit = TRUE;
- pContext->versionString = NULL;
- pContext->errorValue = GL_NO_ERROR;
- pContext->shared = NULL;
- pContext->list = 0;
- pContext->groupList = 0;
- pContext->beginCnt = 0;
- pContext->nAttribStack = 0;
- pContext->refcnt = 1;
- pContext->doubleBuffer = glxCtx->modes->doubleBufferMode;
- pContext->depthBits = glxCtx->modes->depthBits;
- pContext->stencilBits = glxCtx->modes->stencilBits;
- pContext->drawXoff = 0;
- pContext->drawYoff = 0;
- pContext->maxTexUnits = 0;
-
- if (pContext->doubleBuffer)
- {
- pContext->attrib.drawBuffer = GL_BACK;
- pContext->attrib.readBuffer = GL_BACK;
- }
- else
- {
- pContext->attrib.drawBuffer = GL_FRONT;
- pContext->attrib.readBuffer = GL_FRONT;
- }
-
- pContext->attrib.scissorTest = GL_FALSE;
-
- if (shareGC)
- {
- pContext->texObjects = NULL;
- pContext->displayLists = NULL;
-
- pContext->shared = pShareContext->shared;
- shareIface = pShareContext->mIface;
- }
- else
- {
- pContext->texObjects = xglNewHashTable ();
- if (!pContext->texObjects)
- {
- xglFreeContext (pContext);
- return NULL;
- }
-
- pContext->displayLists = xglNewHashTable ();
- if (!pContext->displayLists)
- {
- xglFreeContext (pContext);
- return NULL;
- }
-
- pContext->shared = pContext;
- }
-
- pContext->shared->refcnt++;
-
- iface = (*screenInfoPriv.createContext) (imports, modes, shareIface);
- if (!iface)
- {
- xglFreeContext (pContext);
- return NULL;
- }
-
- pContext->mIface = iface;
- pContext->iface.imports = *imports;
-
- pContext->iface.exports.destroyContext = xglDestroyContext;
- pContext->iface.exports.loseCurrent = xglLoseCurrent;
- pContext->iface.exports.makeCurrent = xglMakeCurrent;
- pContext->iface.exports.shareContext = xglShareContext;
- pContext->iface.exports.copyContext = xglCopyContext;
- pContext->iface.exports.forceCurrent = xglForceCurrent;
- pContext->iface.exports.notifyResize = xglNotifyResize;
- pContext->iface.exports.notifyDestroy = xglNotifyDestroy;
- pContext->iface.exports.notifySwapBuffers = xglNotifySwapBuffers;
- pContext->iface.exports.dispatchExec = xglDispatchExec;
- pContext->iface.exports.beginDispatchOverride = xglBeginDispatchOverride;
- pContext->iface.exports.endDispatchOverride = xglEndDispatchOverride;
-
- return (__GLinterface *) pContext;
-}
-
-static GLboolean
-xglSwapBuffers (__GLXdrawablePrivate *glxPriv)
-{
- __GLdrawablePrivate *glPriv = &glxPriv->glPriv;
- xglGLBufferPtr pBufferPriv = glPriv->private;
- DrawablePtr pDrawable = pBufferPriv->pDrawable;
- GLboolean status = GL_TRUE;
-
- if (pDrawable)
- {
- if (glPriv->modes->doubleBufferMode)
- {
- glitz_surface_t *surface;
- int xOff, yOff;
- GCPtr pGC = pBufferPriv->pGC;
- BoxPtr pBox = REGION_RECTS (pGC->pCompositeClip);
- int nBox = REGION_NUM_RECTS (pGC->pCompositeClip);
-
- XGL_GET_DRAWABLE (pDrawable, surface, xOff, yOff);
-
- glitz_drawable_swap_buffer_region (pBufferPriv->drawable,
- xOff, yOff,
- (glitz_box_t *) pBox, nBox);
-
- xglAddBitDamage (pDrawable, pGC->pCompositeClip);
- DamageDamageRegion (pDrawable, pGC->pCompositeClip);
- REGION_EMPTY (pGC->pScreen, &pBufferPriv->damage);
- }
- }
- else if (pBufferPriv->private)
- {
- glPriv->private = pBufferPriv->private;
- status = (*pBufferPriv->swapBuffers) (glxPriv);
- glPriv->private = pBufferPriv;
- }
-
- return status;
-}
-
-static GLboolean
-xglResizeBuffers (__GLdrawableBuffer *buffer,
- GLint x,
- GLint y,
- GLuint width,
- GLuint height,
- __GLdrawablePrivate *glPriv,
- GLuint bufferMask)
-{
- xglGLBufferPtr pBufferPriv = glPriv->private;
- DrawablePtr pDrawable = pBufferPriv->pDrawable;
- GLboolean status = GL_TRUE;
-
- if (pDrawable)
- {
- if (!xglResizeBuffer (glPriv, x, y, width, height))
- return GL_FALSE;
- }
- else if (pBufferPriv->private)
- {
- glPriv->private = pBufferPriv->private;
- status = (*pBufferPriv->resizeBuffers) (buffer,
- x, y, width, height,
- glPriv,
- bufferMask);
- glPriv->private = pBufferPriv;
- }
-
- return status;
-}
-
-static int
-xglBindBuffers (__GLXdrawablePrivate *glxPriv,
- int buffer)
-{
- __GLdrawablePrivate *glPriv = &glxPriv->glPriv;
- xglGLBufferPtr pBufferPriv = glPriv->private;
-
- if (cctx)
- {
- xglTexUnitPtr pTexUnit = &cctx->attrib.texUnits[cctx->activeTexUnit];
- xglTexObjPtr pTexObj = NULL;
- DrawablePtr pDrawable;
-
- /* XXX: front left buffer is only supported so far */
- if (buffer != GLX_FRONT_LEFT_EXT)
- return BadMatch;
-
- /* Must be a GLXpixmap */
- if (!glxPriv->pGlxPixmap)
- return BadDrawable;
-
- pDrawable = glxPriv->pGlxPixmap->pDraw;
-
- switch (glxPriv->texTarget) {
- case GLX_TEXTURE_RECTANGLE_EXT:
- pTexObj = pTexUnit->pRect;
- break;
- case GLX_TEXTURE_2D_EXT:
- pTexObj = pTexUnit->p2D;
- break;
- default:
- break;
- }
-
- if (pTexObj)
- {
- glitz_texture_object_t *object;
-
- XGL_SCREEN_PRIV (pDrawable->pScreen);
- XGL_DRAWABLE_PIXMAP (pDrawable);
- XGL_PIXMAP_PRIV (pPixmap);
-
- if (pPixmap == pScreenPriv->pScreenPixmap)
- return BadDrawable;
-
- 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;
- }
- }
- }
- else if (pBufferPriv->private)
- {
- int status;
-
- glPriv->private = pBufferPriv->private;
- status = (*pBufferPriv->bindBuffers) (glxPriv, buffer);
- glPriv->private = pBufferPriv;
-
- return status;
- }
-
- return BadDrawable;
-}
-
-static int
-xglReleaseBuffers (__GLXdrawablePrivate *glxPriv,
- int buffer)
-{
- __GLdrawablePrivate *glPriv = &glxPriv->glPriv;
- xglGLBufferPtr pBufferPriv = glPriv->private;
-
- if (cctx)
- {
- xglTexObjPtr pTexObj;
-
- /* XXX: front left buffer is only supported so far */
- if (buffer != GLX_FRONT_LEFT_EXT)
- return BadMatch;
-
- /* Must be a GLXpixmap */
- if (glxPriv->pGlxPixmap)
- {
- DrawablePtr pDrawable = glxPriv->pGlxPixmap->pDraw;
-
- XGL_DRAWABLE_PIXMAP (pDrawable);
-
- pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].p2D;
- if (pTexObj && pTexObj->pPixmap == pPixmap)
- {
- (*pDrawable->pScreen->DestroyPixmap) (pTexObj->pPixmap);
- pTexObj->pPixmap = NULL;
- glitz_texture_object_destroy (pTexObj->object);
- pTexObj->object = NULL;
-
- return Success;
- }
- else
- {
- pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].pRect;
- if (pTexObj && pTexObj->pPixmap == pPixmap)
- {
- (*pDrawable->pScreen->DestroyPixmap) (pTexObj->pPixmap);
- pTexObj->pPixmap = NULL;
- glitz_texture_object_destroy (pTexObj->object);
- pTexObj->object = NULL;
-
- return Success;
- }
- }
- }
- }
- else if (pBufferPriv->private)
- {
- int status;
-
- glPriv->private = pBufferPriv->private;
- status = (*pBufferPriv->releaseBuffers) (glxPriv, buffer);
- glPriv->private = pBufferPriv;
-
- return status;
- }
-
- return BadDrawable;
-}
-static void
-xglFreeBuffers (__GLdrawablePrivate *glPriv)
-{
- xglGLBufferPtr pBufferPriv = glPriv->private;
-
- glPriv->private = pBufferPriv->private;
-
- if (pBufferPriv->freeBuffers)
- (*pBufferPriv->freeBuffers) (glPriv);
-
- if (pBufferPriv->pGC)
- FreeGC (pBufferPriv->pGC, (GContext) 0);
-
- if (pBufferPriv->backSurface)
- glitz_surface_destroy (pBufferPriv->backSurface);
-
- if (pBufferPriv->drawable)
- glitz_drawable_destroy (pBufferPriv->drawable);
-
- xfree (pBufferPriv);
-}
-
-static void
-xglCreateBuffer (__GLXdrawablePrivate *glxPriv)
-{
- __GLdrawablePrivate *glPriv = &glxPriv->glPriv;
- DrawablePtr pDrawable = glxPriv->pDraw;
- ScreenPtr pScreen = pDrawable->pScreen;
- xglGLBufferPtr pBufferPriv;
- xglVisualPtr v;
-
- XGL_SCREEN_PRIV (pScreen);
- XGL_DRAWABLE_PIXMAP (pDrawable);
-
- pBufferPriv = xalloc (sizeof (xglGLBufferRec));
- if (!pBufferPriv)
- FatalError ("xglCreateBuffer: No memory\n");
-
- pBufferPriv->pScreen = pScreen;
- pBufferPriv->pDrawable = NULL;
- pBufferPriv->pPixmap = NULL;
- pBufferPriv->pGC = NULL;
-
- pBufferPriv->swapBuffers = NULL;
-
- pBufferPriv->bindBuffers = NULL;
- pBufferPriv->releaseBuffers = NULL;
-
- pBufferPriv->resizeBuffers = NULL;
- pBufferPriv->private = NULL;
- pBufferPriv->freeBuffers = NULL;
-
- pBufferPriv->drawable = NULL;
- pBufferPriv->backSurface = NULL;
-
- REGION_INIT (pScreen, &pBufferPriv->damage, NullBox, 0);
-
- pBufferPriv->pVisual = 0;
-
- /* glx acceleration */
- if (pScreenPriv->accel.glx.enabled &&
- xglCheckPixmapSize (pPixmap, &pScreenPriv->accel.glx.size))
- {
- for (v = pScreenPriv->pGlxVisual; v; v = v->next)
- {
- glitz_drawable_format_t *format;
-
- if (pScreenPriv->accel.glx.pbuffer != v->pbuffer)
- continue;
-
- format = v->format.drawable;
- if (!format)
- continue;
-
- if (format->color.red_size != glxPriv->modes->redBits ||
- format->color.green_size != glxPriv->modes->greenBits ||
- format->color.blue_size != glxPriv->modes->blueBits)
- continue;
-
- if (format->color.alpha_size < glxPriv->modes->alphaBits ||
- format->depth_size < glxPriv->modes->depthBits ||
- format->stencil_size < glxPriv->modes->stencilBits ||
- format->doublebuffer < glxPriv->modes->doubleBufferMode)
- continue;
-
- /* this is good enought for pbuffers */
- if (v->pbuffer)
- break;
-
- /* we want an exact match for non-pbuffer formats */
- if (format->color.alpha_size == glxPriv->modes->alphaBits &&
- format->depth_size == glxPriv->modes->depthBits &&
- format->stencil_size == glxPriv->modes->stencilBits &&
- format->doublebuffer == glxPriv->modes->doubleBufferMode)
- break;
- }
-
- pBufferPriv->pVisual = v;
- }
-
- if ((pDrawable->type == DRAWABLE_WINDOW)
-
-#ifdef COMPOSITE
- && (pBufferPriv->pVisual
-
- /* this is a root window, can't be redirected */
- || (!((WindowPtr) pDrawable)->parent))
-#endif
-
- )
- {
- pBufferPriv->pDrawable = pDrawable;
- }
- else
- {
- (*screenInfoPriv.createBuffer) (glxPriv);
-
- /* Wrap the swap buffers routine */
- pBufferPriv->swapBuffers = glxPriv->swapBuffers;
-
- /* Wrap the render texture routines */
- pBufferPriv->bindBuffers = glxPriv->bindBuffers;
- pBufferPriv->releaseBuffers = glxPriv->releaseBuffers;
-
- /* Wrap the front buffer's resize routine */
- pBufferPriv->resizeBuffers = glPriv->frontBuffer.resize;
-
- /* Save Xgl's private buffer structure */
- pBufferPriv->freeBuffers = glPriv->freePrivate;
- pBufferPriv->private = glPriv->private;
- }
-
- glxPriv->texTarget = GLX_NO_TEXTURE_EXT;
-
- /* We enable render texture for all GLXPixmaps right now. Eventually, this
- should only be enabled when fbconfig attribute GLX_RENDER_TEXTURE_RGB or
- GLX_RENDER_TEXTURE_RGBA is set to TRUE. */
- if (pDrawable->type != DRAWABLE_WINDOW)
- {
- 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)
- {
- 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);
- }
- }
- }
-
- glxPriv->swapBuffers = xglSwapBuffers;
-
- glxPriv->bindBuffers = xglBindBuffers;
- glxPriv->releaseBuffers = xglReleaseBuffers;
- glPriv->frontBuffer.resize = xglResizeBuffers;
-
- glPriv->private = (void *) pBufferPriv;
- glPriv->freePrivate = xglFreeBuffers;
-}
-
-static Bool
-xglScreenProbe (int screen)
-{
- ScreenPtr pScreen = screenInfo.screens[screen];
- xglVisualPtr pVisual;
- Bool status;
- int i;
-
- XGL_SCREEN_PRIV (pScreen);
-
- status = (*screenInfoPriv.screenProbe) (screen);
-
- /* Create Xgl GLX visuals */
- for (i = 0; i < __xglScreenInfoPtr->numVisuals; i++)
- {
- pVisual = xglFindVisualWithId (pScreen, pScreen->visuals[i].vid);
- if (pVisual)
- {
- glitz_drawable_format_t templ, *format, *screenFormat;
- unsigned long mask;
-
- templ.color = pVisual->format.surface->color;
- templ.depth_size = __xglScreenInfoPtr->modes[i].depthBits;
- templ.stencil_size = __xglScreenInfoPtr->modes[i].stencilBits;
- templ.doublebuffer = __xglScreenInfoPtr->modes[i].doubleBufferMode;
- templ.samples = 1;
-
- mask =
- GLITZ_FORMAT_FOURCC_MASK |
- GLITZ_FORMAT_RED_SIZE_MASK |
- GLITZ_FORMAT_GREEN_SIZE_MASK |
- GLITZ_FORMAT_BLUE_SIZE_MASK |
- GLITZ_FORMAT_ALPHA_SIZE_MASK |
- GLITZ_FORMAT_DEPTH_SIZE_MASK |
- GLITZ_FORMAT_STENCIL_SIZE_MASK |
- GLITZ_FORMAT_DOUBLEBUFFER_MASK |
- GLITZ_FORMAT_SAMPLES_MASK;
-
- format = glitz_find_drawable_format (pScreenPriv->drawable,
- mask, &templ, 0);
- if (format)
- {
- xglVisualPtr v, new, *prev;
-
- new = xalloc (sizeof (xglVisualRec));
- if (new)
- {
- new->next = 0;
- new->vid = pVisual->vid;
- new->pPixel = pVisual->pPixel;
- new->pbuffer = FALSE;
-
- new->format.surface = pVisual->format.surface;
- new->format.drawable = format;
-
- prev = &pScreenPriv->pGlxVisual;
- while ((v = *prev))
- prev = &v->next;
-
- *prev = new;
- }
- }
-
- /* use same drawable format as screen for pbuffers */
- screenFormat = glitz_drawable_get_format (pScreenPriv->drawable);
- templ.id = screenFormat->id;
-
- mask =
- GLITZ_FORMAT_ID_MASK |
- GLITZ_FORMAT_FOURCC_MASK |
- GLITZ_FORMAT_RED_SIZE_MASK |
- GLITZ_FORMAT_GREEN_SIZE_MASK |
- GLITZ_FORMAT_BLUE_SIZE_MASK |
- GLITZ_FORMAT_SAMPLES_MASK;
-
- format = glitz_find_pbuffer_format (pScreenPriv->drawable,
- mask, &templ, 0);
- if (format)
- {
- xglVisualPtr v, new, *prev;
-
- new = xalloc (sizeof (xglVisualRec));
- if (new)
- {
- new->next = 0;
- new->vid = pVisual->vid;
- new->pPixel = pVisual->pPixel;
- new->pbuffer = TRUE;
-
- new->format.surface = pVisual->format.surface;
- new->format.drawable = format;
-
- prev = &pScreenPriv->pGlxVisual;
- while ((v = *prev))
- prev = &v->next;
-
- *prev = new;
- }
- }
- }
- }
-
- /* Wrap createBuffer */
- if (__xglScreenInfoPtr->createBuffer != xglCreateBuffer)
- {
- screenInfoPriv.createBuffer = __xglScreenInfoPtr->createBuffer;
- __xglScreenInfoPtr->createBuffer = xglCreateBuffer;
- }
-
- /* Wrap createContext */
- if (__xglScreenInfoPtr->createContext != xglCreateContext)
- {
- screenInfoPriv.createContext = __xglScreenInfoPtr->createContext;
- __xglScreenInfoPtr->createContext = xglCreateContext;
- }
-
- return status;
-}
-
-Bool
-xglInitVisualConfigs (ScreenPtr pScreen)
-{
- miInitVisualsProcPtr initVisualsProc = NULL;
- VisualPtr visuals;
- int nvisuals;
- DepthPtr depths;
- int ndepths;
- int rootDepth;
- VisualID defaultVis;
- glitz_drawable_format_t *format;
- xglVisualPtr pVisual;
- __GLXvisualConfig *pConfig;
- xglGLXVisualConfigPtr pConfigPriv, *ppConfigPriv;
- XID *installedCmaps;
- ColormapPtr installedCmap;
- int numInstalledCmaps;
- int numConfig = 1;
- int bpp, i;
-
- XGL_SCREEN_PRIV (pScreen);
-
- if (xglScreenInfo.depth != 16 && xglScreenInfo.depth != 24)
- return FALSE;
-
- for (pVisual = xglVisuals; pVisual; pVisual = pVisual->next)
- {
- if (pVisual->pPixel->depth == xglScreenInfo.depth)
- break;
- }
-
- if (!pVisual)
- return FALSE;
-
- bpp = pVisual->pPixel->masks.bpp;
-
- format = glitz_drawable_get_format (pScreenPriv->drawable);
- if (format->doublebuffer)
- numConfig *= 2;
-
- pConfig = xcalloc (sizeof (__GLXvisualConfig), numConfig);
- if (!pConfig)
- return FALSE;
-
- pConfigPriv = xcalloc (sizeof (xglGLXVisualConfigRec), numConfig);
- if (!pConfigPriv)
- {
- xfree (pConfig);
- return FALSE;
- }
-
- ppConfigPriv = xcalloc (sizeof (xglGLXVisualConfigPtr), numConfig);
- if (!ppConfigPriv)
- {
- xfree (pConfigPriv);
- xfree (pConfig);
- return FALSE;
- }
-
- installedCmaps = xalloc (pScreen->maxInstalledCmaps * sizeof (XID));
- if (!installedCmaps)
- {
- xfree (ppConfigPriv);
- xfree (pConfigPriv);
- xfree (pConfig);
- return FALSE;
- }
-
- for (i = 0; i < numConfig; i++)
- {
- ppConfigPriv[i] = &pConfigPriv[i];
-
- pConfig[i].vid = (VisualID) (-1);
- pConfig[i].class = -1;
- pConfig[i].rgba = TRUE;
-
- pConfig[i].redSize = format->color.red_size;
- pConfig[i].greenSize = format->color.green_size;
- pConfig[i].blueSize = format->color.blue_size;
- pConfig[i].alphaSize = format->color.alpha_size;
-
- pConfig[i].redMask = pVisual->pPixel->masks.red_mask;
- pConfig[i].greenMask = pVisual->pPixel->masks.green_mask;
- pConfig[i].blueMask = pVisual->pPixel->masks.blue_mask;
- pConfig[i].alphaMask = pVisual->pPixel->masks.alpha_mask;
-
- if (i == 1)
- {
- pConfig[i].doubleBuffer = FALSE;
- pConfig[i].depthSize = 0;
- pConfig[i].stencilSize = 0;
- }
- else
- {
- pConfig[i].doubleBuffer = TRUE;
- pConfig[i].depthSize = format->depth_size;
- pConfig[i].stencilSize = format->stencil_size;
- }
-
- pConfig[i].stereo = FALSE;
-
- if (pScreen->rootDepth == 16)
- pConfig[i].bufferSize = 16;
- else
- pConfig[i].bufferSize = 32;
-
- pConfig[i].auxBuffers = 0;
- pConfig[i].level = 0;
-
- pConfig[i].visualRating = GLX_NONE;
-
- pConfig[i].transparentPixel = GLX_NONE;
- pConfig[i].transparentRed = 0;
- pConfig[i].transparentGreen = 0;
- pConfig[i].transparentBlue = 0;
- pConfig[i].transparentAlpha = 0;
- pConfig[i].transparentIndex = 0;
- }
-
- GlxSetVisualConfigs (numConfig, pConfig, (void **) ppConfigPriv);
-
- /* Wrap screenProbe */
- if (__xglScreenInfoPtr->screenProbe != xglScreenProbe)
- {
- screenInfoPriv.screenProbe = __xglScreenInfoPtr->screenProbe;
- __xglScreenInfoPtr->screenProbe = xglScreenProbe;
- }
-
- visuals = pScreen->visuals;
- nvisuals = pScreen->numVisuals;
- depths = pScreen->allowedDepths;
- ndepths = pScreen->numDepths;
- rootDepth = pScreen->rootDepth;
- defaultVis = pScreen->rootVisual;
-
- /* Find installed colormaps */
- numInstalledCmaps = (*pScreen->ListInstalledColormaps) (pScreen,
- installedCmaps);
-
- GlxWrapInitVisuals (&initVisualsProc);
- GlxInitVisuals (&visuals, &depths, &nvisuals, &ndepths, &rootDepth,
- &defaultVis, ((unsigned long) 1 << (bpp - 1)), 8, -1);
-
- /* Fix up any existing installed colormaps. */
- 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;
- pScreen->numDepths = ndepths;
- pScreen->rootDepth = rootDepth;
- pScreen->rootVisual = defaultVis;
-
-#ifndef NGLXLOG
- xglInitGlxLog ();
-#endif
-
- xfree (installedCmaps);
- xfree (pConfigPriv);
- xfree (pConfig);
-
- return TRUE;
-}
diff --git a/hw/xgl/glxext/xglglxext.h b/hw/xgl/glxext/xglglxext.h
deleted file mode 100644
index c353783..0000000
--- a/hw/xgl/glxext/xglglxext.h
+++ b/dev/null
@@ -1,41 +0,0 @@
-/*
- * 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_
-
-#include "scrnintstr.h"
-
-Bool
-xglInitVisualConfigs (ScreenPtr pScreen);
-
-#ifndef NGLXEXTLOG
-
-void
-xglInitGlxLog (void);
-
-#endif
-
-#endif /* _XGL_GLXEXT_H_ */
diff --git a/hw/xgl/glxext/xglglxlog.c b/hw/xgl/glxext/xglglxlog.c
deleted file mode 100644
index 0f194c9..0000000
--- a/hw/xgl/glxext/xglglxlog.c
+++ b/dev/null
@@ -1,4519 +0,0 @@
-/*
- * 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 "xglglx.h"
-#include "xglglxext.h"
-#include "glapitable.h"
-
-#ifndef NGLXEXTLOG
-
-static struct _glapi_table *nativeRenderTable = 0;
-
-static FILE *logFp = 0;
-
-static Bool logVertexAttribs = FALSE;
-
-static struct VertexAttribCount {
- int n;
- char *name;
-} vCnt[] = {
- { 0, "glArrayElement" },
- { 0, "glCallList" },
- { 0, "glCallLists" },
- { 0, "glColor3bv" },
- { 0, "glColor3dv" },
- { 0, "glColor3fv" },
- { 0, "glColor3iv" },
- { 0, "glColor3sv" },
- { 0, "glColor3ubv" },
- { 0, "glColor3uiv" },
- { 0, "glColor3usv" },
- { 0, "glColor4bv" },
- { 0, "glColor4dv" },
- { 0, "glColor4fv" },
- { 0, "glColor4iv" },
- { 0, "glColor4sv" },
- { 0, "glColor4ubv" },
- { 0, "glColor4uiv" },
- { 0, "glColor4usv" },
- { 0, "glEdgeFlagv" },
- { 0, "glEvalCoord1dv" },
- { 0, "glEvalCoord1fv" },
- { 0, "glEvalCoord2dv" },
- { 0, "glEvalCoord2fv" },
- { 0, "glEvalPoint1" },
- { 0, "glEvalPoint2" },
- { 0, "glIndexdv" },
- { 0, "glIndexfv" },
- { 0, "glIndexiv" },
- { 0, "glIndexsv" },
- { 0, "glIndexubv" },
- { 0, "glMaterialf" },
- { 0, "glMaterialfv" },
- { 0, "glMateriali" },
- { 0, "glMaterialiv" },
- { 0, "glNormal3bv" },
- { 0, "glNormal3dv" },
- { 0, "glNormal3fv" },
- { 0, "glNormal3iv" },
- { 0, "glNormal3sv" },
- { 0, "glTexCoord1dv" },
- { 0, "glTexCoord1fv" },
- { 0, "glTexCoord1iv" },
- { 0, "glTexCoord1sv" },
- { 0, "glTexCoord2dv" },
- { 0, "glTexCoord2fv" },
- { 0, "glTexCoord2iv" },
- { 0, "glTexCoord2sv" },
- { 0, "glTexCoord3dv" },
- { 0, "glTexCoord3fv" },
- { 0, "glTexCoord3iv" },
- { 0, "glTexCoord3sv" },
- { 0, "glTexCoord4dv" },
- { 0, "glTexCoord4fv" },
- { 0, "glTexCoord4iv" },
- { 0, "glTexCoord4sv" },
- { 0, "glVertex2dv" },
- { 0, "glVertex2fv" },
- { 0, "glVertex2iv" },
- { 0, "glVertex2sv" },
- { 0, "glVertex3dv" },
- { 0, "glVertex3fv" },
- { 0, "glVertex3iv" },
- { 0, "glVertex3sv" },
- { 0, "glVertex4dv" },
- { 0, "glVertex4fv" },
- { 0, "glVertex4iv" },
- { 0, "glVertex4sv" },
- { 0, "glMultiTexCoord1dv" },
- { 0, "glMultiTexCoord1fv" },
- { 0, "glMultiTexCoord1iv" },
- { 0, "glMultiTexCoord1sv" },
- { 0, "glMultiTexCoord2dv" },
- { 0, "glMultiTexCoord2fv" },
- { 0, "glMultiTexCoord2iv" },
- { 0, "glMultiTexCoord2sv" },
- { 0, "glMultiTexCoord3dv" },
- { 0, "glMultiTexCoord3fv" },
- { 0, "glMultiTexCoord3iv" },
- { 0, "glMultiTexCoord3sv" },
- { 0, "glMultiTexCoord4dv" },
- { 0, "glMultiTexCoord4fv" },
- { 0, "glMultiTexCoord4iv" },
- { 0, "glMultiTexCoord4sv" },
- { 0, "glFogCoordfv" },
- { 0, "glFogCoorddv" },
- { 0, "glSecondaryColor3bv" },
- { 0, "glSecondaryColor3dv" },
- { 0, "glSecondaryColor3fv" },
- { 0, "glSecondaryColor3iv" },
- { 0, "glSecondaryColor3sv" },
- { 0, "glSecondaryColor3ubv" },
- { 0, "glSecondaryColor3uiv" },
- { 0, "glSecondaryColor3usv" }
-};
-
-#define arrayElementIndex 0
-#define callListIndex 1
-#define callListsIndex 2
-#define color3bvIndex 3
-#define color3dvIndex 4
-#define color3fvIndex 5
-#define color3ivIndex 6
-#define color3svIndex 7
-#define color3ubvIndex 8
-#define color3uivIndex 9
-#define color3usvIndex 10
-#define color4bvIndex 11
-#define color4dvIndex 12
-#define color4fvIndex 13
-#define color4ivIndex 14
-#define color4svIndex 15
-#define color4ubvIndex 16
-#define color4uivIndex 17
-#define color4usvIndex 18
-#define edgeFlagvIndex 19
-#define evalCoord1dvIndex 20
-#define evalCoord1fvIndex 21
-#define evalCoord2dvIndex 22
-#define evalCoord2fvIndex 23
-#define evalPoint1Index 24
-#define evalPoint2Index 25
-#define indexdvIndex 26
-#define indexfvIndex 27
-#define indexivIndex 28
-#define indexsvIndex 29
-#define indexubvIndex 30
-#define materialfIndex 31
-#define materialfvIndex 32
-#define materialiIndex 33
-#define materialivIndex 34
-#define normal3bvIndex 35
-#define normal3dvIndex 36
-#define normal3fvIndex 37
-#define normal3ivIndex 38
-#define normal3svIndex 39
-#define texCoord1dvIndex 40
-#define texCoord1fvIndex 41
-#define texCoord1ivIndex 42
-#define texCoord1svIndex 43
-#define texCoord2dvIndex 44
-#define texCoord2fvIndex 45
-#define texCoord2ivIndex 46
-#define texCoord2svIndex 47
-#define texCoord3dvIndex 48
-#define texCoord3fvIndex 49
-#define texCoord3ivIndex 50
-#define texCoord3svIndex 51
-#define texCoord4dvIndex 52
-#define texCoord4fvIndex 53
-#define texCoord4ivIndex 54
-#define texCoord4svIndex 55
-#define vertex2dvIndex 56
-#define vertex2fvIndex 57
-#define vertex2ivIndex 58
-#define vertex2svIndex 59
-#define vertex3dvIndex 60
-#define vertex3fvIndex 61
-#define vertex3ivIndex 62
-#define vertex3svIndex 63
-#define vertex4dvIndex 64
-#define vertex4fvIndex 65
-#define vertex4ivIndex 66
-#define vertex4svIndex 67
-#define multiTexCoord1dvIndex 68
-#define multiTexCoord1fvIndex 69
-#define multiTexCoord1ivIndex 70
-#define multiTexCoord1svIndex 71
-#define multiTexCoord2dvIndex 72
-#define multiTexCoord2fvIndex 73
-#define multiTexCoord2ivIndex 74
-#define multiTexCoord2svIndex 75
-#define multiTexCoord3dvIndex 76
-#define multiTexCoord3fvIndex 77
-#define multiTexCoord3ivIndex 78
-#define multiTexCoord3svIndex 79
-#define multiTexCoord4dvIndex 80
-#define multiTexCoord4fvIndex 81
-#define multiTexCoord4ivIndex 82
-#define multiTexCoord4svIndex 83
-#define fogCoordfvIndex 84
-#define fogCoorddvIndex 85
-#define secondaryColor3bvIndex 86
-#define secondaryColor3dvIndex 87
-#define secondaryColor3fvIndex 88
-#define secondaryColor3ivIndex 89
-#define secondaryColor3svIndex 90
-#define secondaryColor3ubvIndex 91
-#define secondaryColor3uivIndex 92
-#define secondaryColor3usvIndex 93
-
-static void
-logAccum (GLenum op,
- GLfloat value)
-{
- fprintf (logFp, "glAccum (0x%x, %f)\n", op, value);
- (*nativeRenderTable->Accum) (op, value);
-}
-
-static void
-logAlphaFunc (GLenum func,
- GLclampf ref)
-{
- fprintf (logFp, "glAlphaFunc (0x%x, %f)\n", func, ref);
- (*nativeRenderTable->AlphaFunc) (func, ref);
-}
-
-static GLboolean
-logAreTexturesResident (GLsizei n,
- const GLuint *textures,
- GLboolean *residences)
-{
- fprintf (logFp, "glAreTexturesResident (%d, %p, %p)\n", n, textures,
- residences);
- return (*nativeRenderTable->AreTexturesResident) (n, textures,
- residences);
-}
-
-static void
-logArrayElement (GLint i)
-{
- vCnt[arrayElementIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glArrayElement (%d)\n", i);
- (*nativeRenderTable->ArrayElement) (i);
-}
-
-static void
-logBegin (GLenum mode)
-{
- fprintf (logFp, "glBegin (0x%x)\n", mode);
- (*nativeRenderTable->Begin) (mode);
-}
-
-static void
-logBindTexture (GLenum target,
- GLuint texture)
-{
- fprintf (logFp, "glBindTexture (0x%x, %u)\n", target, texture);
- (*nativeRenderTable->BindTexture) (target, texture);
-}
-
-static void
-logBitmap (GLsizei width,
- GLsizei height,
- GLfloat xorig,
- GLfloat yorig,
- GLfloat xmove,
- GLfloat ymove,
- const GLubyte *bitmap)
-{
- fprintf (logFp, "glBitmap (%d, %d, %f, %f, %f, %f, %p)\n",
- width, height, xorig, yorig, xmove, ymove, bitmap);
- (*nativeRenderTable->Bitmap) (width, height, xorig, yorig,
- xmove, ymove, bitmap);
-}
-
-static void
-logBlendFunc (GLenum sfactor,
- GLenum dfactor)
-{
- fprintf (logFp, "glBlendFunc (0x%x, 0x%x)\n", sfactor, dfactor);
- (*nativeRenderTable->BlendFunc) (sfactor, dfactor);
-}
-
-static void
-logCallList (GLuint list)
-{
- vCnt[callListIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glCallList (%u)\n", list);
- (*nativeRenderTable->CallList) (list);
-}
-
-static void
-logCallLists (GLsizei n,
- GLenum type,
- const void *lists)
-{
- vCnt[callListsIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glCallLists (%d, 0x%x, %p)\n", n, type, lists);
- (*nativeRenderTable->CallLists) (n, type, lists);
-}
-
-static void
-logClear (GLbitfield mask)
-{
- fprintf (logFp, "glClear (0x%x)\n", mask);
- (*nativeRenderTable->Clear) (mask);
-}
-
-static void
-logClearAccum (GLfloat red,
- GLfloat green,
- GLfloat blue,
- GLfloat alpha)
-{
- fprintf (logFp, "glClearAccum (%f, %f, %f, %f)\n",
- red, green, blue, alpha);
- (*nativeRenderTable->ClearAccum) (red, green, blue, alpha);
-}
-
-static void
-logClearColor (GLclampf red,
- GLclampf green,
- GLclampf blue,
- GLclampf alpha)
-{
- fprintf (logFp, "glClearColor (%f, %f, %f, %f)\n",
- red, green, blue, alpha);
- (*nativeRenderTable->ClearColor) (red, green, blue, alpha);
-}
-
-static void
-logClearDepth (GLclampd depth)
-{
- fprintf (logFp, "glClearDepth (%f)\n", depth);
- (*nativeRenderTable->ClearDepth) (depth);
-}
-
-static void
-logClearIndex (GLfloat c)
-{
- fprintf (logFp, "glClearIndex (%f)\n", c);
- (*nativeRenderTable->ClearIndex) (c);
-}
-
-static void
-logClearStencil (GLint s)
-{
- fprintf (logFp, "glClearStencil (%d)\n", s);
- (*nativeRenderTable->ClearStencil) (s);
-}
-
-static void
-logClipPlane (GLenum plane,
- const GLdouble *equation)
-{
- fprintf (logFp, "glClipPlane (0x%x, %p)\n", plane, equation);
- (*nativeRenderTable->ClipPlane) (plane, equation);
-}
-
-static void
-logColor3bv (const GLbyte *v)
-{
- vCnt[color3bvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glColor3bv (%p)\n", v);
- (*nativeRenderTable->Color3bv) (v);
-}
-
-static void
-logColor3dv (const GLdouble *v)
-{
- vCnt[color3dvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glColor3dv (%p)\n", v);
- (*nativeRenderTable->Color3dv) (v);
-}
-
-static void
-logColor3fv (const GLfloat *v)
-{
- vCnt[color3fvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glColor3fv (%p)\n", v);
- (*nativeRenderTable->Color3fv) (v);
-}
-
-static void
-logColor3iv (const GLint *v)
-{
- vCnt[color3ivIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glColor3iv (%p)\n", v);
- (*nativeRenderTable->Color3iv) (v);
-}
-
-static void
-logColor3sv (const GLshort *v)
-{
- vCnt[color3svIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glColor3sv (%p)\n", v);
- (*nativeRenderTable->Color3sv) (v);
-}
-
-static void
-logColor3ubv (const GLubyte *v)
-{
- vCnt[color3ubvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glColor3ubv (%p)\n", v);
- (*nativeRenderTable->Color3ubv) (v);
-}
-
-static void
-logColor3uiv (const GLuint *v)
-{
- vCnt[color3uivIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glColor3uiv (%p)\n", v);
- (*nativeRenderTable->Color3uiv) (v);
-}
-
-static void
-logColor3usv (const GLushort *v)
-{
- vCnt[color3usvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glColor3usv (%p)\n", v);
- (*nativeRenderTable->Color3usv) (v);
-}
-
-static void
-logColor4bv (const GLbyte *v)
-{
- vCnt[color4bvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glColor4bv (%p)\n", v);
- (*nativeRenderTable->Color4bv) (v);
-}
-
-static void
-logColor4dv (const GLdouble *v)
-{
- vCnt[color4dvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glColor4dv (%p)\n", v);
- (*nativeRenderTable->Color4dv) (v);
-}
-
-static void
-logColor4fv (const GLfloat *v)
-{
- vCnt[color4fvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glColor4fv (%p)\n", v);
- (*nativeRenderTable->Color4fv) (v);
-}
-
-static void
-logColor4iv (const GLint *v)
-{
- vCnt[color4ivIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glColor4iv (%p)\n", v);
- (*nativeRenderTable->Color4iv) (v);
-}
-
-static void
-logColor4sv (const GLshort *v)
-{
- vCnt[color4svIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glColor4sv (%p)\n", v);
- (*nativeRenderTable->Color4sv) (v);
-}
-
-static void
-logColor4ubv (const GLubyte *v)
-{
- vCnt[color4ubvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glColor4ubv (%p)\n", v);
- (*nativeRenderTable->Color4ubv) (v);
-}
-
-static void
-logColor4uiv(const GLuint *v)
-{
- vCnt[color4uivIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glColor4uiv (%p)\n", v);
- (*nativeRenderTable->Color4uiv) (v);
-}
-
-static void
-logColor4usv (const GLushort *v)
-{
- vCnt[color4usvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glColor4usv (%p)\n", v);
- (*nativeRenderTable->Color4usv) (v);
-}
-
-static void
-logColorMask (GLboolean red,
- GLboolean green,
- GLboolean blue,
- GLboolean alpha)
-{
- fprintf (logFp, "glColorMask (%d, %d, %d, %d)\n", red, green, blue, alpha);
- (*nativeRenderTable->ColorMask) (red, green, blue, alpha);
-}
-
-static void
-logColorMaterial (GLenum face,
- GLenum mode)
-{
- fprintf (logFp, "glColorMaterial (0x%x, 0x%x)\n", face, mode);
- (*nativeRenderTable->ColorMaterial) (face, mode);
-}
-
-static void
-logColorPointer (GLint size,
- GLenum type,
- GLsizei stride,
- const void *pointer)
-{
- fprintf (logFp, "glColorPointer (%d, 0x%x, %d, %p)\n",
- size, type, stride, pointer);
- (*nativeRenderTable->ColorPointer) (size, type, stride, pointer);
-}
-
-static void
-logCopyPixels (GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- GLenum type)
-{
- fprintf (logFp, "glCopyPixels (%d, %d, %d, %d, 0x%x)\n",
- x, y, width, height, type);
- (*nativeRenderTable->CopyPixels) (x, y, width, height, type);
-}
-
-static void
-logCopyTexImage1D (GLenum target,
- GLint level,
- GLenum internalFormat,
- GLint x,
- GLint y,
- GLsizei width,
- GLint border)
-{
- fprintf (logFp, "glCopyTexImage1D (0x%x, %d, 0x%x, %d, %d, %d, %d)\n",
- target, level, internalFormat, x, y, width, border);
- (*nativeRenderTable->CopyTexImage1D) (target, level, internalFormat,
- x, y, width, border);
-}
-
-static void
-logCopyTexImage2D (GLenum target,
- GLint level,
- GLenum internalFormat,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- GLint border)
-{
- fprintf (logFp, "glCopyTexImage2D (0x%x, %d, 0x%x, %d, %d, %d, %d, %d)\n",
- target, level, internalFormat, x, y, width, height, border);
- (*nativeRenderTable->CopyTexImage2D) (target, level, internalFormat,
- x, y, width, height, border);
-}
-
-static void
-logCopyTexSubImage1D (GLenum target,
- GLint level,
- GLint xoffset,
- GLint x,
- GLint y,
- GLsizei width)
-{
- fprintf (logFp, "glCopyTexSubImage1D (0x%x, %d, %d, %d, %d, %d)\n",
- target, level, xoffset, x, y, width);
- (*nativeRenderTable->CopyTexSubImage1D) (target, level, xoffset, x, y,
- width);
-}
-
-static void
-logCopyTexSubImage2D (GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height)
-{
- fprintf (logFp, "glCopyTexSubImage2D (0x%x, %d, %d, %d, %d, %d, %d, %d)\n",
- target, level, xoffset, yoffset, x, y, width, height);
- (*nativeRenderTable->CopyTexSubImage2D) (target, level,
- xoffset, yoffset, x, y,
- width, height);
-}
-
-static void
-logCullFace (GLenum mode)
-{
- fprintf (logFp, "glCullFace (0x%x)\n", mode);
- (*nativeRenderTable->CullFace) (mode);
-}
-
-static void
-logDeleteLists (GLuint list,
- GLsizei range)
-{
- fprintf (logFp, "glDeleteLists (%d, %d)\n", list, range);
- (*nativeRenderTable->DeleteLists) (list, range);
-}
-
-static void
-logDeleteTextures (GLsizei n, const GLuint *textures)
-{
- fprintf (logFp, "glDeleteTextures (%d, %p)\n", n, textures);
- (*nativeRenderTable->DeleteTextures) (n, textures);
-}
-
-static void
-logDepthFunc (GLenum func)
-{
- fprintf (logFp, "glDepthFunc (0x%x)\n", func);
- (*nativeRenderTable->DepthFunc) (func);
-}
-
-static void
-logDepthMask (GLboolean flag)
-{
- fprintf (logFp, "glDepthMask (%d)\n", flag);
- (*nativeRenderTable->DepthMask) (flag);
-}
-
-static void
-logDepthRange (GLclampd zNear,
- GLclampd zFar)
-{
- fprintf (logFp, "glDepthRange (%f, %f)\n", zNear, zFar);
- (*nativeRenderTable->DepthRange) (zNear, zFar);
-}
-
-static void
-logDisable (GLenum cap)
-{
- fprintf (logFp, "glDisable (0x%x)\n", cap);
- (*nativeRenderTable->Disable) (cap);
-}
-
-static void
-logDisableClientState (GLenum array)
-{
- fprintf (logFp, "glDisableClientState (0x%x)\n", array);
- (*nativeRenderTable->DisableClientState) (array);
-}
-
-static void
-logDrawArrays (GLenum mode,
- GLint first,
- GLsizei count)
-{
- fprintf (logFp, "glDrawArrays (0x%x, %d, %d)\n", mode, first, count);
- (*nativeRenderTable->DrawArrays) (mode, first, count);
-}
-
-static void
-logDrawBuffer (GLenum mode)
-{
- fprintf (logFp, "glDrawBuffer (0x%x)\n", mode);
- (*nativeRenderTable->DrawBuffer) (mode);
-}
-
-static void
-logDrawElements (GLenum mode,
- GLsizei count,
- GLenum type,
- const void *indices)
-{
- fprintf (logFp, "glDrawElements (0x%x, %d, 0x%x, %p)\n",
- mode, count, type, indices);
- (*nativeRenderTable->DrawElements) (mode, count, type, indices);
-}
-
-static void
-logDrawPixels (GLsizei width,
- GLsizei height,
- GLenum format,
- GLenum type,
- const void *pixels)
-{
- fprintf (logFp, "glDrawPixels (%d, %d, 0x%x, 0x%x, %p)\n",
- width, height, format, type, pixels);
- (*nativeRenderTable->DrawPixels) (width, height, format, type, pixels);
-}
-
-static void
-logEdgeFlagPointer (GLsizei stride,
- const void *pointer)
-{
- fprintf (logFp, "glEdgeFlagPointer (%d, %p)", stride, pointer);
- (*nativeRenderTable->EdgeFlagPointer) (stride, pointer);
-}
-
-static void
-logEdgeFlagv (const GLboolean *flag)
-{
- vCnt[edgeFlagvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glEdgeFlagv (%p)\n", flag);
- (*nativeRenderTable->EdgeFlagv) (flag);
-}
-
-static void
-logEnable (GLenum cap)
-{
- fprintf (logFp, "glEnable (0x%x)\n", cap);
- (*nativeRenderTable->Enable) (cap);
-}
-
-static void
-logEnableClientState (GLenum array)
-{
- fprintf (logFp, "glEnableClientState (0x%x)\n", array);
- (*nativeRenderTable->EnableClientState) (array);
-}
-
-static void
-logEnd (void)
-{
- int i;
-
- for (i = 0; i < sizeof (vCnt) / sizeof (vCnt[0]); i++)
- {
- if (vCnt[i].n)
- {
- fprintf (logFp, " %s: %d\n", vCnt[i].name, vCnt[i].n);
- vCnt[i].n = 0;
- }
- }
-
- fprintf (logFp, "glEnd ()\n" );
- (*nativeRenderTable->End) ();
-}
-
-static void
-logEndList (void)
-{
- fprintf (logFp, "glEndList ()\n" );
- (*nativeRenderTable->EndList) ();
-}
-
-static void
-logEvalCoord1dv (const GLdouble *u)
-{
- vCnt[evalCoord1dvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glEvalCoord1dv (%p)\n", u);
- (*nativeRenderTable->EvalCoord1dv) (u);
-}
-
-static void
-logEvalCoord1fv (const GLfloat *u)
-{
- vCnt[evalCoord1fvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glEvalCoord1fv (%p)\n", u);
- (*nativeRenderTable->EvalCoord1fv) (u);
-}
-
-static void
-logEvalCoord2dv (const GLdouble *u)
-{
- vCnt[evalCoord2dvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glEvalCoord2dv (%p)\n", u);
- (*nativeRenderTable->EvalCoord2dv) (u);
-}
-
-static void
-logEvalCoord2fv (const GLfloat *u)
-{
- vCnt[evalCoord1fvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glEvalCoord2fv (%p)\n", u);
- (*nativeRenderTable->EvalCoord2fv) (u);
-}
-
-static void
-logEvalMesh1 (GLenum mode,
- GLint i1,
- GLint i2)
-{
- fprintf (logFp, "glEvalMesh1 (0x%x, %d, %d)\n", mode, i1, i2);
- (*nativeRenderTable->EvalMesh1) (mode, i1, i2 );
-}
-
-static void
-logEvalMesh2 (GLenum mode,
- GLint i1,
- GLint i2,
- GLint j1,
- GLint j2)
-{
- fprintf (logFp, "glEvalMesh2 (0x%x, %d, %d, %d, %d)\n",
- mode, i1, i2, j1, j2);
- (*nativeRenderTable->EvalMesh2) (mode, i1, i2, j1, j2);
-}
-
-static void
-logEvalPoint1 (GLint i)
-{
- vCnt[evalPoint1Index].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glEvalPoint1 (%d)\n", i);
- (*nativeRenderTable->EvalPoint1) (i);
-}
-
-static void
-logEvalPoint2 (GLint i, GLint j)
-{
- vCnt[evalPoint2Index].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glEvalPoint2 (%d, %d)\n", i, j);
- (*nativeRenderTable->EvalPoint2) (i, j);
-}
-
-static void
-logFeedbackBuffer (GLsizei size,
- GLenum type,
- GLfloat *buffer)
-{
- fprintf (logFp, "glFeedbackBuffer (%d, 0x%x, %p)\n", size, type, buffer);
- (*nativeRenderTable->FeedbackBuffer) (size, type, buffer);
-}
-
-static void
-logFinish (void)
-{
- fprintf (logFp, "glFinish ()\n");
- (*nativeRenderTable->Finish) ();
-}
-
-static void
-logFlush (void)
-{
- fprintf (logFp, "glFlush ()\n");
- (*nativeRenderTable->Flush) ();
-}
-
-static void
-logFogf (GLenum pname,
- GLfloat param)
-{
- fprintf (logFp, "glFogf (0x%x, %f)\n", pname, param);
- (*nativeRenderTable->Fogf) (pname, param);
-}
-
-static void
-logFogfv (GLenum pname,
- const GLfloat *params)
-{
- fprintf (logFp, "glFogfv (0x%x, %p)\n", pname, params);
- (*nativeRenderTable->Fogfv) (pname, params);
-}
-
-static void
-logFogi (GLenum pname,
- GLint param)
-{
- fprintf (logFp, "glFogi (0x%x, %d)\n", pname, param);
- (*nativeRenderTable->Fogi) (pname, param);
-}
-
-static void
-logFogiv (GLenum pname,
- const GLint *params)
-{
- fprintf (logFp, "glFogiv (0x%x, %p)\n", pname, params);
- (*nativeRenderTable->Fogiv) (pname, params);
-}
-
-static void
-logFrontFace (GLenum mode)
-{
- fprintf (logFp, "glFrontFace (0x%x)\n", mode);
- (*nativeRenderTable->FrontFace) (mode);
-}
-
-static void
-logFrustum (GLdouble left,
- GLdouble right,
- GLdouble bottom,
- GLdouble top,
- GLdouble zNear,
- GLdouble zFar)
-{
- fprintf (logFp, "glFrustum (%f, %f, %f, %f, %f, %f)\n",
- left, right, bottom, top, zNear, zFar);
- (*nativeRenderTable->Frustum) (left, right, bottom, top, zNear, zFar);
-}
-
-static GLuint
-logGenLists (GLsizei range)
-{
- fprintf (logFp, "glGenLists (%d)\n", range);
- return (*nativeRenderTable->GenLists) (range);
-}
-
-static void
-logGenTextures (GLsizei n,
- GLuint *textures)
-{
- fprintf (logFp, "glGenTextures (%d, %p)\n", n, textures);
- (*nativeRenderTable->GenTextures) (n, textures);
-}
-static void
-logGetBooleanv (GLenum pname,
- GLboolean *params)
-{
- fprintf (logFp, "glGetBooleanv (0x%x, %p)\n", pname, params);
- (*nativeRenderTable->GetBooleanv) (pname, params);
-}
-
-static void
-logGetClipPlane (GLenum plane,
- GLdouble *equation)
-{
- fprintf (logFp, "glGetClipPlane (0x%x, %p)\n", plane, equation);
- (*nativeRenderTable->GetClipPlane) (plane, equation);
-}
-
-static void
-logGetDoublev (GLenum pname,
- GLdouble *params)
-{
- fprintf (logFp, "glGetDoublev (0x%x, %p)\n", pname, params);
- (*nativeRenderTable->GetDoublev) (pname, params);
-}
-
-static GLenum
-logGetError (void)
-{
- fprintf (logFp, "glGetError ()\n");
- return (*nativeRenderTable->GetError) ();
-}
-
-static void
-logGetFloatv (GLenum pname,
- GLfloat *params)
-{
- fprintf (logFp, "glGetFloatv (0x%x, %p)\n", pname, params);
- (*nativeRenderTable->GetFloatv) (pname, params);
-}
-
-static void
-logGetIntegerv (GLenum pname,
- GLint *params)
-{
- fprintf (logFp, "glGetIntegerv (0x%x, %p)\n", pname, params);
- (*nativeRenderTable->GetIntegerv) (pname, params);
-}
-
-static void
-logGetLightfv (GLenum light,
- GLenum pname,
- GLfloat *params)
-{
- fprintf (logFp, "glGetLightfv (0x%x, 0x%x, %p)\n", light, pname, params);
- (*nativeRenderTable->GetLightfv) (light, pname, params);
-}
-
-static void
-logGetLightiv (GLenum light,
- GLenum pname,
- GLint *params)
-{
- fprintf (logFp, "glGetLightiv (0x%x, 0x%x, %p)\n",
- light, pname, params);
- (*nativeRenderTable->GetLightiv) (light, pname, params);
-}
-
-static void
-logGetMapdv (GLenum target,
- GLenum query,
- GLdouble *v)
-{
- fprintf (logFp, "glGetMapdv (0x%x, 0x%x, %p)\n", target, query, v);
- (*nativeRenderTable->GetMapdv) (target, query, v);
-}
-
-static void
-logGetMapfv (GLenum target,
- GLenum query,
- GLfloat *v)
-{
- fprintf (logFp, "glGetMapfv (0x%x, 0x%x, %p)\n", target, query, v);
- (*nativeRenderTable->GetMapfv) (target, query, v);
-}
-
-static void
-logGetMapiv (GLenum target,
- GLenum query,
- GLint *v)
-{
- fprintf (logFp, "glGetMapiv (0x%x, 0x%x, %p)\n", target, query, v);
- (*nativeRenderTable->GetMapiv) (target, query, v);
-}
-
-static void
-logGetMaterialfv (GLenum face,
- GLenum pname,
- GLfloat *params)
-{
- fprintf (logFp, "glGetMaterialfv (0x%x, 0x%x, %p)\n", face, pname, params);
- (*nativeRenderTable->GetMaterialfv) (face, pname, params);
-}
-
-static void
-logGetMaterialiv (GLenum face,
- GLenum pname,
- GLint *params)
-{
- fprintf (logFp, "glGetMaterialiv (0x%x, 0x%x, %p)\n", face, pname, params);
- (*nativeRenderTable->GetMaterialiv) (face, pname, params);
-}
-
-static void
-logGetPixelMapfv (GLenum map,
- GLfloat *values)
-{
- fprintf (logFp, "glGetPixelMapfv (0x%x, %p)\n", map, values);
- (*nativeRenderTable->GetPixelMapfv) (map, values);
-}
-
-static void
-logGetPixelMapuiv (GLenum map,
- GLuint *values)
-{
- fprintf (logFp, "glGetPixelMapuiv (0x%x, %p)\n", map, values);
- (*nativeRenderTable->GetPixelMapuiv) (map, values);
-}
-
-static void
-logGetPixelMapusv (GLenum map,
- GLushort *values)
-{
- fprintf (logFp, "glGetPixelMapusv (0x%x, %p)\n", map, values);
- (*nativeRenderTable->GetPixelMapusv) (map, values);
-}
-
-static void
-logGetPointerv (GLenum pname,
- GLvoid **params)
-{
- fprintf (logFp, "glGetPointerv (0x%x, %p)\n", pname, params);
- (*nativeRenderTable->GetPointerv) (pname, params);
-}
-
-static void
-logGetPolygonStipple (GLubyte *mask)
-{
- fprintf (logFp, "glGetPolygonStipple (%p)\n", mask);
- (*nativeRenderTable->GetPolygonStipple) (mask);
-}
-
-static const GLubyte *
-logGetString (GLenum name)
-{
- fprintf (logFp, "glGetString (0x%x)\n", name);
- return (*nativeRenderTable->GetString) (name);
-}
-
-static void
-logGetTexEnvfv (GLenum target,
- GLenum pname,
- GLfloat *params)
-{
- fprintf (logFp, "glGetTexEnvfv (0x%x, 0x%x, %p)\n", target, pname, params);
- (*nativeRenderTable->GetTexEnvfv) (target, pname, params);
-}
-
-static void
-logGetTexEnviv (GLenum target,
- GLenum pname,
- GLint *params)
-{
- fprintf (logFp, "glGetTexEnviv (0x%x, 0x%x, %p)\n", target, pname, params);
- (*nativeRenderTable->GetTexEnviv) (target, pname, params);
-}
-
-static void
-logGetTexGendv (GLenum coord,
- GLenum pname,
- GLdouble *params)
-{
- fprintf (logFp, "glGetTexGendv (0x%x, 0x%x, %p)\n", coord, pname, params);
- (*nativeRenderTable->GetTexGendv) (coord, pname, params);
-}
-
-static void
-logGetTexGenfv (GLenum coord,
- GLenum pname,
- GLfloat *params)
-{
- fprintf (logFp, "glGetTexGenfv (0x%x, 0x%x, %p)\n", coord, pname, params);
- (*nativeRenderTable->GetTexGenfv) (coord, pname, params);
-}
-
-static void
-logGetTexGeniv (GLenum coord,
- GLenum pname,
- GLint *params)
-{
- fprintf (logFp, "glGetTexGeniv (0x%x, 0x%x, %p)\n", coord, pname, params);
- (*nativeRenderTable->GetTexGeniv) (coord, pname, params);
-}
-
-static void
-logGetTexImage (GLenum target,
- GLint level,
- GLenum format,
- GLenum type,
- void *pixels)
-{
- fprintf (logFp, "glGetTexImage (0x%x, %d, 0x%x, 0x%x, %p)\n",
- target, level, format, type, pixels);
- (*nativeRenderTable->GetTexImage) (target, level, format, type,
- pixels);
-}
-static void
-logGetTexLevelParameterfv (GLenum target,
- GLint level,
- GLenum pname,
- GLfloat *params)
-{
- fprintf (logFp, "glGetTexLevelParameterfv (0x%x, %d, 0x%x, %p)\n",
- target, level, pname, params);
- (*nativeRenderTable->GetTexLevelParameterfv) (target, level,
- pname, params);
-}
-
-static void
-logGetTexLevelParameteriv (GLenum target,
- GLint level,
- GLenum pname,
- GLint *params)
-{
- fprintf (logFp, "glGetTexLevelParameteriv (0x%x, %d, 0x%x, %p)\n",
- target, level, pname, params);
- (*nativeRenderTable->GetTexLevelParameteriv) (target, level,
- pname, params);
-}
-
-static void
-logGetTexParameterfv (GLenum target,
- GLenum pname,
- GLfloat *params)
-{
- fprintf (logFp, "glGetTexParameterfv (0x%x, 0x%x, %p)\n",
- target, pname, params);
- (*nativeRenderTable->GetTexParameterfv) (target, pname, params);
-}
-
-static void
-logGetTexParameteriv (GLenum target,
- GLenum pname,
- GLint *params)
-{
- fprintf (logFp, "glGetTexParameteriv (0x%x, 0x%x, %p)\n",
- target, pname, params);
- (*nativeRenderTable->GetTexParameteriv) (target, pname, params);
-}
-
-static void
-logHint (GLenum target,
- GLenum mode)
-{
- fprintf (logFp, "glHint (0x%x, 0x%x)\n", target, mode);
- (*nativeRenderTable->Hint) (target, mode);
-}
-
-static void
-logIndexMask (GLuint mask)
-{
- fprintf (logFp, "glIndexMask (%d)\n", mask);
- (*nativeRenderTable->IndexMask) (mask);
-}
-
-static void
-logIndexPointer (GLenum type,
- GLsizei stride,
- const void *pointer)
-{
- fprintf (logFp, "glIndexPointer (0x%x, %d, %p)\n", type, stride, pointer);
- (*nativeRenderTable->IndexPointer) (type, stride, pointer);
-}
-
-static void
-logIndexdv (const GLdouble *c)
-{
- vCnt[indexdvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glIndexdv (%p)\n", c);
- (*nativeRenderTable->Indexdv) (c);
-}
-
-static void
-logIndexfv (const GLfloat *c)
-{
- vCnt[indexfvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glIndexfv (%p)\n", c);
- (*nativeRenderTable->Indexfv) (c);
-}
-
-static void
-logIndexiv (const GLint *c)
-{
- vCnt[indexivIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glIndexiv (%p)\n", c);
- (*nativeRenderTable->Indexiv) (c);
-}
-
-static void
-logIndexsv (const GLshort *c)
-{
- vCnt[indexsvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glIndexsv (%p)\n", c);
- (*nativeRenderTable->Indexsv) (c);
-}
-
-static void
-logIndexubv (const GLubyte *c)
-{
- vCnt[indexubvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glIndexubv (%p)\n", c);
- (*nativeRenderTable->Indexubv) (c);
-}
-
-static void
-logInitNames (void)
-{
- fprintf (logFp, "glInitNames ()\n" );
- (*nativeRenderTable->InitNames) ();
-}
-
-static void
-logInterleavedArrays (GLenum format,
- GLsizei stride,
- const void *pointer)
-{
- fprintf (logFp, "glInterleavedArrays (0x%x, %d, %p)\n",
- format, stride, pointer);
- (*nativeRenderTable->InterleavedArrays) (format, stride, pointer);
-}
-
-static GLboolean
-logIsEnabled (GLenum cap)
-{
- fprintf (logFp, "glIsEnabled (0x%x)\n", cap);
- return (*nativeRenderTable->IsEnabled) (cap);
-}
-
-static GLboolean
-logIsList (GLuint list)
-{
- fprintf (logFp, "glIsList (%d)\n", list);
- return (*nativeRenderTable->IsList) (list);
-}
-
-static GLboolean
-logIsTexture (GLuint texture)
-{
- fprintf (logFp, "glIsTexture (%d)\n", texture);
- return (*nativeRenderTable->IsTexture) (texture);
-}
-
-static void
-logLightModelf (GLenum pname,
- GLfloat param)
-{
- fprintf (logFp, "glLightModelf (0x%x, %f)\n", pname, param);
- (*nativeRenderTable->LightModelf) (pname, param);
-}
-
-static void
-logLightModelfv (GLenum pname,
- const GLfloat *params)
-{
- fprintf (logFp, "glLightModelfv (0x%x, %p)\n", pname, params);
- (*nativeRenderTable->LightModelfv) (pname, params);
-}
-
-static void
-logLightModeli (GLenum pname,
- GLint param)
-{
- fprintf (logFp, "glLightModeli (0x%x, %d)\n", pname, param);
- (*nativeRenderTable->LightModeli) (pname, param);
-}
-
-static void
-logLightModeliv (GLenum pname,
- const GLint *params)
-{
- fprintf (logFp, "glLightModeliv (0x%x, %p)\n", pname, params);
- (*nativeRenderTable->LightModeliv) (pname, params);
-}
-
-static void
-logLightf (GLenum light,
- GLenum pname,
- GLfloat param)
-{
- fprintf (logFp, "glLightf (0x%x, 0x%x, %f)\n", light, pname, param);
- (*nativeRenderTable->Lightf) (light, pname, param);
-}
-
-static void
-logLightfv (GLenum light,
- GLenum pname,
- const GLfloat *params)
-{
- fprintf (logFp, "glLightfv (0x%x, 0x%x, %p)\n", light, pname, params);
- (*nativeRenderTable->Lightfv) (light, pname, params);
-}
-
-static void
-logLighti (GLenum light,
- GLenum pname,
- GLint param)
-{
- fprintf (logFp, "glLighti (0x%x, 0x%x, %d)\n", light, pname, param);
- (*nativeRenderTable->Lighti) (light, pname, param);
-}
-
-static void
-logLightiv (GLenum light,
- GLenum pname,
- const GLint *params)
-{
- fprintf (logFp, "glLightiv (0x%x, 0x%x, %p)\n", light, pname, params);
- (*nativeRenderTable->Lightiv) (light, pname, params);
-}
-
-static void
-logLineStipple (GLint factor,
- GLushort pattern)
-{
- fprintf (logFp, "glLineStipple (%d, %d)\n", factor, pattern);
- (*nativeRenderTable->LineStipple) (factor, pattern);
-}
-
-static void
-logLineWidth (GLfloat width)
-{
- fprintf (logFp, "glLineWidth (%f)\n", width);
- (*nativeRenderTable->LineWidth) (width);
-}
-
-static void
-logListBase (GLuint base)
-{
- fprintf (logFp, "glListBase (%d)\n", base);
- (*nativeRenderTable->ListBase) (base);
-}
-
-static void
-logLoadIdentity (void)
-{
- fprintf (logFp, "glLoadIdentity ()\n");
- (*nativeRenderTable->LoadIdentity) ();
-}
-
-static void
-logLoadMatrixd (const GLdouble *m)
-{
- fprintf (logFp, "glLoadMatrixd (%p)\n", m);
- (*nativeRenderTable->LoadMatrixd) (m);
-}
-
-static void
-logLoadMatrixf (const GLfloat *m)
-{
- fprintf (logFp, "glLoadMatrixf (%p)\n", m);
- (*nativeRenderTable->LoadMatrixf) (m);
-}
-
-static void
-logLoadName (GLuint name)
-{
- fprintf (logFp, "glLoadName (%d)\n", name);
- (*nativeRenderTable->LoadName) (name);
-}
-
-static void
-logLogicOp (GLenum opcode)
-{
- fprintf (logFp, "glLogicOp(0x%x)\n", opcode);
- (*nativeRenderTable->LogicOp) (opcode);
-}
-
-static void
-logMap1d (GLenum target,
- GLdouble u1,
- GLdouble u2,
- GLint stride,
- GLint order,
- const GLdouble *points)
-{
- fprintf (logFp, "glMap1d (0x%x, %f, %f, %d, %d, %p)\n",
- target, u1, u2, stride, order, points);
- (*nativeRenderTable->Map1d) (target, u1, u2, stride, order, points);
-}
-
-static void
-logMap1f (GLenum target,
- GLfloat u1,
- GLfloat u2,
- GLint stride,
- GLint order,
- const GLfloat *points)
-{
- fprintf (logFp, "glMap1f (0x%x, %f, %f, %d, %d, %p)\n",
- target, u1, u2, stride, order, points);
- (*nativeRenderTable->Map1f) (target, u1, u2, stride, order, points);
-}
-
-static void
-logMap2d (GLenum target,
- GLdouble u1,
- GLdouble u2,
- GLint ustride,
- GLint uorder,
- GLdouble v1,
- GLdouble v2,
- GLint vstride,
- GLint vorder,
- const GLdouble *points)
-{
- fprintf (logFp, "glMap2d (0x%x, %f, %f, %d, %d, %f, %f, %d, %d, %p)\n",
- target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
- (*nativeRenderTable->Map2d) (target, u1, u2, ustride, uorder, v1, v2,
- vstride, vorder, points);
-}
-
-static void
-logMap2f (GLenum target,
- GLfloat u1,
- GLfloat u2,
- GLint ustride,
- GLint uorder,
- GLfloat v1,
- GLfloat v2,
- GLint vstride,
- GLint vorder,
- const GLfloat *points)
-{
- fprintf (logFp, "glMap2f (0x%x, %f, %f, %d, %d, %f, %f, %d, %d, %p)\n",
- target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
- (*nativeRenderTable->Map2f) (target, u1, u2, ustride, uorder, v1, v2,
- vstride, vorder, points);
-}
-
-static void
-logMapGrid1d (GLint un,
- GLdouble u1,
- GLdouble u2)
-{
- fprintf (logFp, "glMapGrid1d (%d, %f, %f)\n", un, u1, u2);
- (*nativeRenderTable->MapGrid1d) (un, u1, u2);
-}
-
-static void
-logMapGrid1f (GLint un,
- GLfloat u1,
- GLfloat u2)
-{
- fprintf (logFp, "glMapGrid1f (%d, %f, %f)\n", un, u1, u2);
- (*nativeRenderTable->MapGrid1f) (un, u1, u2);
-}
-
-static void
-logMapGrid2d (GLint un,
- GLdouble u1,
- GLdouble u2,
- GLint vn,
- GLdouble v1,
- GLdouble v2)
-{
- fprintf (logFp, "glMapGrid2d (%d, %f, %f, %d, %f, %f)\n",
- un, u1, u2, vn, v1, v2);
- (*nativeRenderTable->MapGrid2d) (un, u1, u2, vn, v1, v2);
-}
-
-static void
-logMapGrid2f (GLint un,
- GLfloat u1,
- GLfloat u2,
- GLint vn,
- GLfloat v1,
- GLfloat v2)
-{
- fprintf (logFp, "glMapGrid2f (%d, %f, %f, %d, %f, %f)\n",
- un, u1, u2, vn, v1, v2);
- (*nativeRenderTable->MapGrid2f) (un, u1, u2, vn, v1, v2);
-}
-
-static void
-logMaterialf (GLenum face,
- GLenum pname,
- GLfloat param)
-{
- vCnt[materialfIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glMaterialf (0x%x, 0x%x, %f)\n", face, pname, param);
- (*nativeRenderTable->Materialf) (face, pname, param);
-}
-
-static void
-logMaterialfv (GLenum face,
- GLenum pname,
- const GLfloat *params)
-{
- vCnt[materialfvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glMaterialfv (0x%x, 0x%x, %p)\n",
- face, pname, params);
- (*nativeRenderTable->Materialfv) (face, pname, params);
-}
-
-static void
-logMateriali (GLenum face,
- GLenum pname,
- GLint param)
-{
- vCnt[materialiIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glMateriali (0x%x, 0x%x, %d)\n", face, pname, param);
- (*nativeRenderTable->Materiali) (face, pname, param);
-}
-
-static void
-logMaterialiv (GLenum face,
- GLenum pname,
- const GLint *params)
-{
- vCnt[materialivIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glMaterialiv (0x%x, 0x%x, %p)\n",
- face, pname, params);
- (*nativeRenderTable->Materialiv) (face, pname, params);
-}
-
-static void
-logMatrixMode (GLenum mode)
-{
- fprintf (logFp, "glMatrixMode (0x%x)\n", mode);
- (*nativeRenderTable->MatrixMode) (mode);
-}
-
-static void
-logMultMatrixd (const GLdouble *m)
-{
- fprintf (logFp, "glMultMatrixd (%p)\n", m);
- (*nativeRenderTable->MultMatrixd) (m);
-}
-
-static void
-logMultMatrixf (const GLfloat *m)
-{
- fprintf (logFp, "glMultMatrixf (%p)\n", m);
- (*nativeRenderTable->MultMatrixf) (m);
-}
-
-static void
-logNewList (GLuint list,
- GLenum mode)
-{
- fprintf (logFp, "glNewList (%d, 0x%x)\n", list, mode);
- (*nativeRenderTable->NewList) (list, mode);
-}
-
-static void
-logNormal3bv (const GLbyte *v)
-{
- vCnt[normal3bvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glNormal3bv (%p)\n", v);
- (*nativeRenderTable->Normal3bv) (v);
-}
-
-static void
-logNormal3dv (const GLdouble *v)
-{
- vCnt[normal3dvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glNormal3dv (%p)\n", v);
- (*nativeRenderTable->Normal3dv) (v);
-}
-
-static void
-logNormal3fv (const GLfloat *v)
-{
- vCnt[normal3fvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glNormal3fv (%p)\n", v);
- (*nativeRenderTable->Normal3fv) (v);
-}
-
-static void
-logNormal3iv (const GLint *v)
-{
- vCnt[normal3ivIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glNormal3iv (%p)\n", v);
- (*nativeRenderTable->Normal3iv) (v);
-}
-
-static void
-logNormal3sv (const GLshort *v)
-{
- vCnt[normal3svIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glNormal3sv (%p)\n", v);
- (*nativeRenderTable->Normal3sv) (v);
-}
-
-static void
-logNormalPointer (GLenum type,
- GLsizei stride,
- const void *pointer)
-{
- fprintf (logFp, "glNormalPointer (0x%x, %d, %p)\n", type, stride, pointer);
- (*nativeRenderTable->NormalPointer) (type, stride, pointer);
-}
-
-static void
-logOrtho (GLdouble left,
- GLdouble right,
- GLdouble bottom,
- GLdouble top,
- GLdouble zNear,
- GLdouble zFar)
-{
- fprintf (logFp, "glOrtho (%f, %f, %f, %f, %f, %f)\n",
- left, right, bottom, top, zNear, zFar);
- (*nativeRenderTable->Ortho) (left, right, bottom, top, zNear, zFar);
-}
-
-static void
-logPassThrough (GLfloat token)
-{
- fprintf (logFp, "glPassThrough (%f)\n", token);
- (*nativeRenderTable->PassThrough) (token);
-}
-
-static void
-logPixelMapfv (GLenum map,
- GLsizei mapsize,
- const GLfloat *values)
-{
- fprintf (logFp, "glPixelMapfv (0x%x, %d, %p)\n", map, mapsize, values);
- (*nativeRenderTable->PixelMapfv) (map, mapsize, values);
-}
-
-static void
-logPixelMapuiv (GLenum map,
- GLsizei mapsize,
- const GLuint *values)
-{
- fprintf (logFp, "glPixelMapuiv (0x%x, %d, %p)\n", map, mapsize, values);
- (*nativeRenderTable->PixelMapuiv) (map, mapsize, values);
-}
-
-static void
-logPixelMapusv (GLenum map,
- GLsizei mapsize,
- const GLushort *values)
-{
- fprintf (logFp, "glPixelMapusv (0x%x, %d, %p)\n", map, mapsize, values);
- (*nativeRenderTable->PixelMapusv) (map, mapsize, values);
-}
-
-static void
-logPixelStoref (GLenum pname,
- GLfloat param)
-{
- fprintf (logFp, "glPixelStoref (0x%x, %f)\n", pname, param);
- (*nativeRenderTable->PixelStoref) (pname, param);
-}
-
-static void
-logPixelStorei (GLenum pname,
- GLint param)
-{
- fprintf (logFp, "glPixelStorei (0x%x, %d)\n", pname, param);
- (*nativeRenderTable->PixelStorei) (pname, param);
-}
-
-static void
-logPixelTransferf (GLenum pname, GLfloat param)
-{
- fprintf (logFp, "glPixelTransferf (0x%x, %f)\n", pname, param);
- (*nativeRenderTable->PixelTransferf) (pname, param);
-}
-
-static void
-logPixelTransferi (GLenum pname,
- GLint param)
-{
- fprintf (logFp, "glPixelTransferi (0x%x, %d)\n", pname, param);
- (*nativeRenderTable->PixelTransferi) (pname, param);
-}
-
-static void
-logPixelZoom (GLfloat xfactor,
- GLfloat yfactor)
-{
- fprintf (logFp, "glPixelZoom (%f, %f)\n", xfactor, yfactor);
- (*nativeRenderTable->PixelZoom) (xfactor, yfactor);
-}
-
-static void
-logPointSize (GLfloat size)
-{
- fprintf (logFp, "glPointSize" );
- (*nativeRenderTable->PointSize) (size);
-}
-
-static void
-logPolygonMode (GLenum face,
- GLenum mode)
-{
- fprintf (logFp, "glPolygonMode (0x%x, 0x%x)\n", face, mode );
- (*nativeRenderTable->PolygonMode) (face, mode);
-}
-
-static void
-logPolygonOffset (GLfloat factor,
- GLfloat units)
-{
- fprintf (logFp, "glPolygonOffset (%f, %f)\n", factor, units);
- (*nativeRenderTable->PolygonOffset) (factor, units);
-}
-
-static void
-logPolygonStipple (const GLubyte *mask)
-{
- fprintf (logFp, "glPolygonStipple (%p)\n", mask);
- (*nativeRenderTable->PolygonStipple) (mask);
-}
-
-static void
-logPopAttrib (void)
-{
- fprintf (logFp, "glPopAttrib ()\n");
- (*nativeRenderTable->PopAttrib) ();
-}
-
-static void
-logPopClientAttrib (void)
-{
- fprintf (logFp, "glPopClientAttrib ()\n" );
- (*nativeRenderTable->PopClientAttrib) ();
-}
-
-static void
-logPopMatrix (void)
-{
- fprintf (logFp, "glPopMatrix ()\n" );
- (*nativeRenderTable->PopMatrix) ();
-}
-
-static void
-logPopName (void)
-{
- fprintf (logFp, "glPopName ()\n");
- (*nativeRenderTable->PopName) ();
-}
-
-static void
-logPrioritizeTextures (GLsizei n,
- const GLuint *textures,
- const GLclampf *priorities)
-{
- fprintf (logFp, "glPrioritizeTextures (%d, %p, %p)\n",
- n, textures, priorities);
- (*nativeRenderTable->PrioritizeTextures) (n, textures, priorities);
-}
-
-static void
-logPushAttrib (GLbitfield mask)
-{
- fprintf (logFp, "glPushAttrib (0x%x)\n", mask);
- (*nativeRenderTable->PushAttrib) (mask);
-}
-
-static void
-logPushClientAttrib (GLbitfield mask)
-{
- fprintf (logFp, "glPushClientAttrib (0x%x)\n", mask);
- (*nativeRenderTable->PushClientAttrib) (mask);
-}
-
-static void
-logPushMatrix (void)
-{
- fprintf (logFp, "glPushMatrix ()\n" );
- (*nativeRenderTable->PushMatrix) ();
-}
-
-static void
-logPushName (GLuint name)
-{
- fprintf (logFp, "glPushName (%d)\n", name);
- (*nativeRenderTable->PushName) (name);
-}
-
-static void
-logRasterPos2dv (const GLdouble *v)
-{
- fprintf (logFp, "glRasterPos2dv (%p)\n", v);
- (*nativeRenderTable->RasterPos2dv) (v);
-}
-
-static void
-logRasterPos2fv (const GLfloat *v)
-{
- fprintf (logFp, "glRasterPos2dv (%p)\n", v);
- (*nativeRenderTable->RasterPos2fv) (v);
-}
-
-static void
-logRasterPos2iv (const GLint *v)
-{
- fprintf (logFp, "glRasterPos2iv (%p)\n", v);
- (*nativeRenderTable->RasterPos2iv) (v);
-}
-
-static void
-logRasterPos2sv (const GLshort *v)
-{
- fprintf (logFp, "glRasterPos2sv (%p)\n", v);
- (*nativeRenderTable->RasterPos2sv) (v);
-}
-
-static void
-logRasterPos3dv (const GLdouble *v)
-{
- fprintf (logFp, "glRasterPos3dv (%p)\n", v);
- (*nativeRenderTable->RasterPos3dv) (v);
-}
-
-static void
-logRasterPos3fv (const GLfloat *v)
-{
- fprintf (logFp, "glRasterPos3fv (%p)\n", v);
- (*nativeRenderTable->RasterPos3fv) (v);
-}
-
-static void
-logRasterPos3iv (const GLint *v)
-{
- fprintf (logFp, "glRasterPos3iv (%p)\n", v);
- (*nativeRenderTable->RasterPos3iv) (v);
-}
-
-static void
-logRasterPos3sv (const GLshort *v)
-{
- fprintf (logFp, "glRasterPos3sv (%p)\n", v);
- (*nativeRenderTable->RasterPos3sv) (v);
-}
-
-static void
-logRasterPos4dv (const GLdouble *v)
-{
- fprintf (logFp, "glRasterPos4dv (%p)\n", v);
- (*nativeRenderTable->RasterPos4dv) (v);
-}
-
-static void
-logRasterPos4fv (const GLfloat *v)
-{
- fprintf (logFp, "glRasterPos4fv (%p)\n", v);
- (*nativeRenderTable->RasterPos4fv) (v);
-}
-
-static void
-logRasterPos4iv (const GLint *v)
-{
- fprintf (logFp, "glRasterPos4iv (%p)\n", v);
- (*nativeRenderTable->RasterPos4iv) (v);
-}
-
-static void
-logRasterPos4sv (const GLshort *v)
-{
- fprintf (logFp, "glRasterPos4sv (%p)\n", v);
- (*nativeRenderTable->RasterPos4sv) (v);
-}
-
-static void
-logReadBuffer (GLenum mode)
-{
- fprintf (logFp, "glReadBuffer (0x%x)\n", mode);
- (*nativeRenderTable->ReadBuffer) (mode);
-}
-
-static void
-logReadPixels (GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- GLenum format,
- GLenum type,
- void *pixels)
-{
- fprintf (logFp, "glReadPixels (%d, %d, %d, %d, 0x%x, 0x%x, %p)\n",
- x, y, width, height, format, type, pixels);
- (*nativeRenderTable->ReadPixels) (x, y, width, height, format, type,
- pixels);
-}
-
-static void
-logRectdv (const GLdouble *v1,
- const GLdouble *v2)
-{
- fprintf (logFp, "glRectdv (%p, %p)\n", v1, v2);
- (*nativeRenderTable->Rectdv) (v1, v2);
-}
-
-static void
-logRectfv (const GLfloat *v1,
- const GLfloat *v2)
-{
- fprintf (logFp, "glRectfv (%p, %p)\n", v1, v2);
- (*nativeRenderTable->Rectfv) (v1, v2);
-}
-
-static void
-logRectiv (const GLint *v1,
- const GLint *v2)
-{
- fprintf (logFp, "glRectiv (%p, %p)\n", v1, v2);
- (*nativeRenderTable->Rectiv) (v1, v2);
-}
-
-static void
-logRectsv (const GLshort *v1,
- const GLshort *v2)
-{
- fprintf (logFp, "glRectsv (%p, %p)\n", v1, v2);
- (*nativeRenderTable->Rectsv) (v1, v2);
-}
-
-static GLint
-logRenderMode (GLenum mode)
-{
- fprintf (logFp, "glRenderMode (0x%x)\n", mode);
- return (*nativeRenderTable->RenderMode) (mode);
-}
-
-static void
-logRotated (GLdouble angle,
- GLdouble x,
- GLdouble y,
- GLdouble z)
-{
- fprintf (logFp, "glRotated (%f, %f, %f, %f)\n", angle, x, y, z);
- (*nativeRenderTable->Rotated) (angle, x, y, z);
-}
-
-static void
-logRotatef (GLfloat angle,
- GLfloat x,
- GLfloat y,
- GLfloat z)
-{
- fprintf (logFp, "glRotatef (%f, %f, %f, %f)\n", angle, x, y, z);
- (*nativeRenderTable->Rotatef) (angle, x, y, z);
-}
-
-static void
-logScaled (GLdouble x,
- GLdouble y,
- GLdouble z)
-{
- fprintf (logFp, "glScaled (%f, %f, %f)\n", x, y, z);
- (*nativeRenderTable->Scaled) (x, y, z);
-}
-
-static void
-logScalef (GLfloat x,
- GLfloat y,
- GLfloat z)
-{
- fprintf (logFp, "glScalef (%f, %f, %f)\n", x, y, z);
- (*nativeRenderTable->Scalef) (x, y, z);
-}
-
-static void
-logScissor (GLint x,
- GLint y,
- GLsizei width,
- GLsizei height)
-{
- fprintf (logFp, "glScissor (%d, %d, %d, %d)\n", x, y, width, height);
- (*nativeRenderTable->Scissor) (x, y, width, height);
-}
-
-static void
-logSelectBuffer (GLsizei size,
- GLuint *buffer)
-{
- fprintf (logFp, "glSelectBuffer (%d, %p)\n", size, buffer);
- (*nativeRenderTable->SelectBuffer) (size, buffer);
-}
-
-static void
-logShadeModel (GLenum mode)
-{
- fprintf (logFp, "glShadeModel (0x%x)\n", mode);
- (*nativeRenderTable->ShadeModel) (mode);
-}
-
-static void
-logStencilFunc (GLenum func,
- GLint ref,
- GLuint mask)
-{
- fprintf (logFp, "glStencilFunc (0x%x, %d, %d)\n", func, ref, mask);
- (*nativeRenderTable->StencilFunc) (func, ref, mask);
-}
-
-static void
-logStencilMask (GLuint mask)
-{
- fprintf (logFp, "glStencilMask (0x%x)\n", mask);
- (*nativeRenderTable->StencilMask) (mask);
-}
-
-static void
-logStencilOp (GLenum fail,
- GLenum zfail,
- GLenum zpass)
-{
- fprintf (logFp, "glStencilOp (0x%x, 0x%x, 0x%x)\n", fail, zfail, zpass);
- (*nativeRenderTable->StencilOp) (fail, zfail, zpass);
-}
-
-static void
-logTexCoord1dv (const GLdouble *v)
-{
- vCnt[texCoord1dvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glTexCoord1dv (%p)\n", v);
- (*nativeRenderTable->TexCoord1dv) (v);
-}
-
-static void
-logTexCoord1fv (const GLfloat *v)
-{
- vCnt[texCoord1fvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glTexCoord1fv (%p)\n", v);
- (*nativeRenderTable->TexCoord1fv) (v);
-}
-
-static void
-logTexCoord1iv (const GLint *v)
-{
- vCnt[texCoord1ivIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glTexCoord1iv (%p)\n", v);
- (*nativeRenderTable->TexCoord1iv) (v);
-}
-
-static void
-logTexCoord1sv (const GLshort *v)
-{
- vCnt[texCoord1svIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glTexCoord1sv (%p)\n", v);
- (*nativeRenderTable->TexCoord1sv) (v);
-}
-
-static void
-logTexCoord2dv (const GLdouble *v)
-{
- vCnt[texCoord2dvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glTexCoord2dv (%p)\n", v);
- (*nativeRenderTable->TexCoord2dv) (v);
-}
-
-static void
-logTexCoord2fv (const GLfloat *v)
-{
- vCnt[texCoord2fvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glTexCoord2fv (%p)\n", v);
- (*nativeRenderTable->TexCoord2fv) (v);
-}
-
-static void
-logTexCoord2iv (const GLint *v)
-{
- vCnt[texCoord2ivIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glTexCoord2iv (%p)\n", v);
- (*nativeRenderTable->TexCoord2iv) (v);
-}
-
-static void
-logTexCoord2sv (const GLshort *v)
-{
- vCnt[texCoord2svIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glTexCoord2sv (%p)\n", v);
- (*nativeRenderTable->TexCoord2sv) (v);
-}
-
-
-static void
-logTexCoord3dv (const GLdouble *v)
-{
- vCnt[texCoord3dvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glTexCoord3dv (%p)\n", v);
- (*nativeRenderTable->TexCoord3dv) (v);
-}
-
-static void
-logTexCoord3fv (const GLfloat *v)
-{
- vCnt[texCoord3fvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glTexCoord3fv (%p)\n", v);
- (*nativeRenderTable->TexCoord3fv) (v);
-}
-
-static void
-logTexCoord3iv (const GLint *v)
-{
- vCnt[texCoord3ivIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glTexCoord3iv (%p)\n", v);
- (*nativeRenderTable->TexCoord3iv) (v);
-}
-
-static void
-logTexCoord3sv (const GLshort *v)
-{
- vCnt[texCoord3svIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glTexCoord3sv (%p)\n", v);
- (*nativeRenderTable->TexCoord3sv) (v);
-}
-
-static void
-logTexCoord4dv (const GLdouble *v)
-{
- vCnt[texCoord4dvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glTexCoord4dv (%p)\n", v);
- (*nativeRenderTable->TexCoord4dv) (v);
-}
-
-static void
-logTexCoord4fv (const GLfloat *v)
-{
- vCnt[texCoord4fvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glTexCoord4fv (%p)\n", v);
- (*nativeRenderTable->TexCoord4fv) (v);
-}
-
-static void
-logTexCoord4iv (const GLint *v)
-{
- vCnt[texCoord4ivIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glTexCoord4iv (%p)\n", v);
- (*nativeRenderTable->TexCoord4iv) (v);
-}
-
-static void
-logTexCoord4sv (const GLshort *v)
-{
- vCnt[texCoord4svIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glTexCoord4sv (%p)\n", v);
- (*nativeRenderTable->TexCoord4sv) (v);
-}
-
-static void
-logTexCoordPointer (GLint size,
- GLenum type,
- GLsizei stride,
- const void *pointer)
-{
- fprintf (logFp, "glTexCoordPointer (%d, 0x%x, %d, %p)\n",
- size, type, stride, pointer);
- (*nativeRenderTable->TexCoordPointer) (size, type, stride, pointer);
-}
-
-static void
-logTexEnvf (GLenum target,
- GLenum pname,
- GLfloat param)
-{
- fprintf (logFp, "glTexEnvf (0x%x, 0x%x, %f)\n", target, pname, param);
- (*nativeRenderTable->TexEnvf) (target, pname, param);
-}
-
-static void
-logTexEnvfv (GLenum target,
- GLenum pname,
- const GLfloat *params)
-{
- fprintf (logFp, "glTexEnvfv (0x%x, 0x%x, %p)\n", target, pname, params);
- (*nativeRenderTable->TexEnvfv) (target, pname, params);
-}
-
-static void
-logTexEnvi (GLenum target,
- GLenum pname,
- GLint param)
-{
- fprintf (logFp, "glTexEnvi (0x%x, 0x%x, %d)\n", target, pname, param);
- (*nativeRenderTable->TexEnvi) (target, pname, param);
-}
-
-static void
-logTexEnviv (GLenum target,
- GLenum pname,
- const GLint *params)
-{
- fprintf (logFp, "glTexEnviv (0x%x, 0x%x, %p)\n", target, pname, params);
- (*nativeRenderTable->TexEnviv) (target, pname, params);
-}
-
-static void
-logTexGend (GLenum coord,
- GLenum pname,
- GLdouble param)
-{
- fprintf (logFp, "glTexGend (0x%x, 0x%x, %f)\n", coord, pname, param);
- (*nativeRenderTable->TexGend) (coord, pname, param);
-}
-
-static void
-logTexGendv (GLenum coord,
- GLenum pname,
- const GLdouble *params)
-{
- fprintf (logFp, "glTexGendv (0x%x, 0x%x, %p)\n", coord, pname, params);
- (*nativeRenderTable->TexGendv) (coord, pname, params);
-}
-
-static void
-logTexGenf (GLenum coord,
- GLenum pname,
- GLfloat param)
-{
- fprintf (logFp, "glTexGenf (0x%x, 0x%x, %f)\n", coord, pname, param);
- (*nativeRenderTable->TexGenf) (coord, pname, param);
-}
-
-static void
-logTexGenfv (GLenum coord,
- GLenum pname,
- const GLfloat *params)
-{
- fprintf (logFp, "glTexGenfv (0x%x, 0x%x, %p)\n", coord, pname, params);
- (*nativeRenderTable->TexGenfv) (coord, pname, params);
-}
-
-static void
-logTexGeni (GLenum coord,
- GLenum pname,
- GLint param)
-{
- fprintf (logFp, "glTexGeni (0x%x, 0x%x, %d)\n", coord, pname, param);
- (*nativeRenderTable->TexGeni) (coord, pname, param);
-}
-
-static void
-logTexGeniv (GLenum coord,
- GLenum pname,
- const GLint *params)
-{
- fprintf (logFp, "glTexGeniv (0x%x, 0x%x, %p)\n", coord, pname, params);
- (*nativeRenderTable->TexGeniv) (coord, pname, params);
-}
-
-static void
-logTexImage1D (GLenum target,
- GLint level,
- GLint internalformat,
- GLsizei width,
- GLint border,
- GLenum format,
- GLenum type,
- const void *pixels)
-{
- fprintf (logFp, "glTexImage1D (0x%x, %d, %d, %d, %d, 0x%x, 0x%x, %p)\n",
- target, level, internalformat, width, border, format, type,
- pixels);
- (*nativeRenderTable->TexImage1D) (target, level, internalformat,
- width, border, format, type,
- pixels);
-}
-
-static void
-logTexImage2D (GLenum target,
- GLint level,
- GLint internalformat,
- GLsizei width,
- GLsizei height,
- GLint border,
- GLenum format,
- GLenum type,
- const void *pixels)
-{
- fprintf (logFp, "glTexImage2D (0x%x, %d, %d, %d, %d, %d, "
- "0x%x, 0x%x, %p)\n", target, level, internalformat,
- width, height, border, format, type, pixels);
- (*nativeRenderTable->TexImage2D) (target, level, internalformat,
- width, height, border, format, type,
- pixels);
-}
-
-static void
-logTexParameterf (GLenum target,
- GLenum pname,
- GLfloat param)
-{
- fprintf (logFp, "glTexParameterf (0x%x, 0x%x, %f)\n",
- target, pname, param);
- (*nativeRenderTable->TexParameterf) (target, pname, param);
-}
-
-static void
-logTexParameterfv (GLenum target,
- GLenum pname,
- const GLfloat *params)
-{
- fprintf (logFp, "glTexParameterfv (0x%x, 0x%x, %p)\n",
- target, pname, params);
- (*nativeRenderTable->TexParameterfv) (target, pname, params);
-}
-
-static void
-logTexParameteri (GLenum target,
- GLenum pname,
- GLint param)
-{
- fprintf (logFp, "glTexParameteri (0x%x, 0x%x, 0x%x)\n",
- target, pname, param);
- (*nativeRenderTable->TexParameteri) (target, pname, param);
-}
-
-static void
-logTexParameteriv (GLenum target,
- GLenum pname,
- const GLint *params)
-{
- fprintf (logFp, "glTexParameteriv (0x%x, 0x%x, %p)\n",
- target, pname, params);
- (*nativeRenderTable->TexParameteriv) (target, pname, params);
-}
-
-static void
-logTexSubImage1D (GLenum target,
- GLint level,
- GLint xoffset,
- GLsizei width,
- GLenum format,
- GLenum type,
- const void *pixels)
-{
- fprintf (logFp, "glTexSubImage1D (0x%x, %d, %d, %d, 0x%x, 0x%x, %p)\n",
- target, level, xoffset, width, format, type, pixels);
- (*nativeRenderTable->TexSubImage1D) (target, level, xoffset, width,
- format, type, pixels);
-}
-
-static void
-logTexSubImage2D (GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLsizei width,
- GLsizei height,
- GLenum format,
- GLenum type,
- const void *pixels)
-{
- fprintf (logFp, "glTexSubImage2D (0x%x, %d, %d, %d, %d, %d, "
- "0x%x, 0x%x, %p)\n", target, level, xoffset, yoffset,
- width, height, format, type, pixels);
- (*nativeRenderTable->TexSubImage2D) (target, level, xoffset, yoffset,
- width, height, format, type,
- pixels);
-}
-
-static void
-logTranslated (GLdouble x,
- GLdouble y,
- GLdouble z)
-{
- fprintf (logFp, "glTranslated (%f, %f, %f)\n", x, y, z);
- (*nativeRenderTable->Translated) (x, y, z);
-}
-
-static void
-logTranslatef (GLfloat x,
- GLfloat y,
- GLfloat z)
-{
- fprintf (logFp, "glTranslatef (%f, %f, %f)\n", x, y, z);
- (*nativeRenderTable->Translatef) (x, y, z);
-}
-
-static void
-logVertex2dv (const GLdouble *v)
-{
- vCnt[vertex2dvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glVertex2dv (%p)\n", v);
- (*nativeRenderTable->Vertex2dv) (v);
-}
-
-static void
-logVertex2fv (const GLfloat *v)
-{
- vCnt[vertex2fvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glVertex2dv (%p)\n", v);
- (*nativeRenderTable->Vertex2fv) (v);
-}
-
-static void
-logVertex2iv (const GLint *v)
-{
- vCnt[vertex2ivIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glVertex2iv (%p)\n", v);
- (*nativeRenderTable->Vertex2iv) (v);
-}
-
-static void
-logVertex2sv (const GLshort *v)
-{
- vCnt[vertex2svIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glVertex2sv (%p)\n", v);
- (*nativeRenderTable->Vertex2sv) (v);
-}
-
-static void
-logVertex3dv (const GLdouble *v)
-{
- vCnt[vertex3dvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glVertex3dv (%p)\n", v);
- (*nativeRenderTable->Vertex3dv) (v);
-}
-
-static void
-logVertex3fv (const GLfloat *v)
-{
- vCnt[vertex3fvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glVertex3fv (%p)\n", v);
- (*nativeRenderTable->Vertex3fv) (v);
-}
-
-static void
-logVertex3iv (const GLint *v)
-{
- vCnt[vertex3ivIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glVertex3iv (%p)\n", v);
- (*nativeRenderTable->Vertex3iv) (v);
-}
-
-static void
-logVertex3sv (const GLshort *v)
-{
- vCnt[vertex3svIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glVertex3sv (%p)\n", v);
- (*nativeRenderTable->Vertex3sv) (v);
-}
-
-static void
-logVertex4dv (const GLdouble *v)
-{
- vCnt[vertex4dvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glVertex4dv (%p)\n", v);
- (*nativeRenderTable->Vertex4dv) (v);
-}
-
-static void
-logVertex4fv (const GLfloat *v)
-{
- vCnt[vertex4fvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glVertex4fv (%p)\n", v);
- (*nativeRenderTable->Vertex4fv) (v);
-}
-
-static void
-logVertex4iv (const GLint *v)
-{
- vCnt[vertex4ivIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glVertex4iv (%p)\n", v);
- (*nativeRenderTable->Vertex4iv) (v);
-}
-
-static void
-logVertex4sv (const GLshort *v)
-{
- vCnt[vertex4svIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glVertex4sv (%p)\n", v);
- (*nativeRenderTable->Vertex4sv) (v);
-}
-
-static void
-logVertexPointer (GLint size,
- GLenum type,
- GLsizei stride,
- const void *pointer)
-{
- fprintf (logFp, "glVertexPointer (%d, 0x%x, %d, %p)\n",
- size, type, stride, pointer);
- (*nativeRenderTable->VertexPointer) (size, type, stride, pointer);
-}
-
-static void
-logViewport (GLint x,
- GLint y,
- GLsizei width,
- GLsizei height)
-{
- fprintf (logFp, "glViewport (%d %d %d %d)\n", x, y, width, height);
- (*nativeRenderTable->Viewport) (x, y, width, height);
-}
-
-static void
-logBlendColor (GLclampf red,
- GLclampf green,
- GLclampf blue,
- GLclampf alpha)
-{
- fprintf (logFp, "glBlendColor (%f, %f, %f, %f)\n",
- red, green, blue, alpha);
- (*nativeRenderTable->BlendColor) (red, green, blue, alpha);
-}
-
-static void
-logBlendEquation (GLenum mode)
-{
- fprintf (logFp, "glBlendEquation (0x%x)\n", mode);
- (*nativeRenderTable->BlendEquation) (mode);
-}
-
-static void
-logColorTable (GLenum target,
- GLenum internalformat,
- GLsizei width,
- GLenum format,
- GLenum type,
- const GLvoid *table)
-{
- fprintf (logFp, "glColorTable (0x%x, 0x%x, %d, 0x%x, 0x%x, %p)\n",
- target, internalformat, width, format, type, table);
- (*nativeRenderTable->ColorTable) (target, internalformat, width,
- format, type, table);
-}
-
-static void
-logColorTableParameterfv (GLenum target,
- GLenum pname,
- const GLfloat *params)
-{
- fprintf (logFp, "glColorTableParameterfv (0x%x, 0x%x, %p)\n",
- target, pname, params);
- (*nativeRenderTable->ColorTableParameterfv) (target, pname, params);
-}
-
-static void
-logColorTableParameteriv (GLenum target,
- GLenum pname,
- const GLint *params)
-{
- fprintf (logFp, "glColorTableParameterfv (0x%x, 0x%x, %p)\n",
- target, pname, params);
- (*nativeRenderTable->ColorTableParameteriv) (target, pname, params);
-}
-
-static void
-logCopyColorTable (GLenum target,
- GLenum internalformat,
- GLint x,
- GLint y,
- GLsizei width)
-{
- fprintf (logFp, "glCopyColorTable (0x%x, 0x%x, %d, %d, %d)\n",
- target, internalformat, x, y, width);
- (*nativeRenderTable->CopyColorTable) (target, internalformat,
- x, y, width);
-}
-
-static void
-logGetColorTable (GLenum target,
- GLenum format,
- GLenum type,
- GLvoid *table)
-{
- fprintf (logFp, "glGetColorTable (0x%x, 0x%x, 0x%x, %p)\n",
- target, format, type, table);
- (*nativeRenderTable->GetColorTable) (target, format, type, table);
-}
-
-static void
-logGetColorTableParameterfv (GLenum target,
- GLenum pname,
- GLfloat *params)
-{
- fprintf (logFp, "glGetColorTableParameterfv (0x%x, 0x%x, %p)\n",
- target, pname, params);
- (*nativeRenderTable->GetColorTableParameterfv) (target, pname, params);
-}
-
-static void
-logGetColorTableParameteriv (GLenum target,
- GLenum pname,
- GLint *params)
-{
- fprintf (logFp, "glGetColorTableParameteriv (0x%x, 0x%x, %p)\n",
- target, pname, params);
- (*nativeRenderTable->GetColorTableParameteriv) (target, pname, params);
-}
-
-static void
-logColorSubTable (GLenum target,
- GLsizei start,
- GLsizei count,
- GLenum format,
- GLenum type,
- const GLvoid *data)
-{
- fprintf (logFp, "glColorSubTable (0x%x, %d, %d, 0x%x, 0x%x, %p)\n",
- target, start, count, format, type, data);
- (*nativeRenderTable->ColorSubTable) (target, start, count,
- format, type, data);
-}
-
-static void
-logCopyColorSubTable (GLenum target,
- GLsizei start,
- GLint x,
- GLint y,
- GLsizei width)
-{
- fprintf (logFp, "glCopyColorSubTable (0x%x, %d, %d, %d, %d)\n",
- target, start, x, y, width);
- (*nativeRenderTable->CopyColorSubTable) (target, start, x, y, width);
-}
-
-static void
-logConvolutionFilter1D (GLenum target,
- GLenum internalformat,
- GLsizei width,
- GLenum format,
- GLenum type,
- const GLvoid *image)
-{
- fprintf (logFp, "glConvolutionFilter1D (0x%x, 0x%x, %d, 0x%x, 0x%x, %p)\n",
- target, internalformat, width, format, type, image);
- (*nativeRenderTable->ConvolutionFilter1D) (target, internalformat,
- width, format, type, image);
-}
-
-static void
-logConvolutionFilter2D (GLenum target,
- GLenum internalformat,
- GLsizei width,
- GLsizei height,
- GLenum format,
- GLenum type,
- const GLvoid *image)
-{
- fprintf (logFp, "glConvolutionFilter2D (0x%x, 0x%x, %d, %d, "
- "0x%x, 0x%x, %p)\n", target, internalformat, width, height,
- format, type, image);
- (*nativeRenderTable->ConvolutionFilter2D) (target, internalformat,
- width, height, format,
- type, image);
-}
-
-static void
-logConvolutionParameterf (GLenum target,
- GLenum pname,
- GLfloat param)
-{
- fprintf (logFp, "glConvolutionParameterf (0x%x, 0x%x, %f)\n",
- target, pname, param);
- (*nativeRenderTable->ConvolutionParameterf) (target, pname, param);
-}
-
-static void
-logConvolutionParameterfv (GLenum target,
- GLenum pname,
- const GLfloat *params)
-{
- fprintf (logFp, "glConvolutionParameterfv (0x%x, 0x%x, %p)\n",
- target, pname, params);
- (*nativeRenderTable->ConvolutionParameterfv) (target, pname, params);
-}
-
-static void
-logConvolutionParameteri (GLenum target,
- GLenum pname,
- GLint param)
-{
- fprintf (logFp, "glConvolutionParameterf (0x%x, 0x%x, %d)\n",
- target, pname, param);
- (*nativeRenderTable->ConvolutionParameteri) (target, pname, param);
-}
-
-static void
-logConvolutionParameteriv (GLenum target,
- GLenum pname,
- const GLint *params)
-{
- fprintf (logFp, "glConvolutionParameteriv (0x%x, 0x%x, %p)\n",
- target, pname, params);
- (*nativeRenderTable->ConvolutionParameteriv) (target, pname, params);
-}
-
-static void
-logCopyConvolutionFilter1D (GLenum target,
- GLenum internalformat,
- GLint x,
- GLint y,
- GLsizei width)
-{
- fprintf (logFp, "glCopyConvolutionFilter1D (0x%x, 0x%x, %d, %d, %d)\n",
- target, internalformat, x, y, width);
- (*nativeRenderTable->CopyConvolutionFilter1D) (target, internalformat,
- x, y, width);
-}
-
-static void
-logCopyConvolutionFilter2D (GLenum target,
- GLenum internalformat,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height)
-{
- fprintf (logFp, "glCopyConvolutionFilter2D (0x%x, 0x%x, %d, %d, %d, %d)\n",
- target, internalformat, x, y, width, height);
- (*nativeRenderTable->CopyConvolutionFilter2D) (target, internalformat,
- x, y, width, height);
-}
-
-static void
-logGetConvolutionFilter (GLenum target,
- GLenum format,
- GLenum type,
- GLvoid *image)
-{
- fprintf (logFp, "glGetConvolutionFilter (0x%x, 0x%x, 0x%x, %p)\n",
- target, format, type, image);
- (*nativeRenderTable->GetConvolutionFilter) (target, format, type,
- image);
-}
-
-static void
-logGetConvolutionParameterfv (GLenum target,
- GLenum pname,
- GLfloat *params)
-{
- fprintf (logFp, "glGetConvolutionParameterfv (0x%x, 0x%x, %p)\n",
- target, pname, params);
- (*nativeRenderTable->GetConvolutionParameterfv) (target, pname,
- params);
-}
-
-static void
-logGetConvolutionParameteriv (GLenum target,
- GLenum pname,
- GLint *params)
-{
- fprintf (logFp, "glGetConvolutionParameteriv (0x%x, 0x%x, %p)\n",
- target, pname, params);
- (*nativeRenderTable->GetConvolutionParameteriv) (target, pname,
- params);
-}
-
-static void
-logGetSeparableFilter (GLenum target,
- GLenum format,
- GLenum type,
- GLvoid *row,
- GLvoid *column,
- GLvoid *span)
-{
- fprintf (logFp, "glGetSeparableFilter (0x%x, 0x%x, 0x%x, %p, %p, %p)\n",
- target, format, type, row, column, span);
- (*nativeRenderTable->GetSeparableFilter) (target, format, type,
- row, column, span);
-}
-
-static void
-logSeparableFilter2D (GLenum target,
- GLenum internalformat,
- GLsizei width,
- GLsizei height,
- GLenum format,
- GLenum type,
- const GLvoid *row,
- const GLvoid *column)
-{
- fprintf (logFp, "glSeparableFilter2D (0x%x, 0x%x, %d, %d, "
- "0x%x, 0x%x, %p, %p)\n", target, internalformat, width, height,
- format, type, row, column);
- (*nativeRenderTable->SeparableFilter2D) (target, internalformat,
- width, height, format,
- type, row, column);
-}
-
-static void
-logGetHistogram (GLenum target,
- GLboolean reset,
- GLenum format,
- GLenum type,
- GLvoid *values)
-{
- fprintf (logFp, "glGetHistogram (0x%x, %d, 0x%x, 0x%x, %p)\n",
- target, reset, format, type, values);
- (*nativeRenderTable->GetHistogram) (target, reset, format, type,
- values);
-}
-
-static void
-logGetHistogramParameterfv (GLenum target,
- GLenum pname,
- GLfloat *params)
-{
- fprintf (logFp, "glGetHistogramParameterfv (0x%x, 0x%x, %p)\n",
- target, pname, params);
- (*nativeRenderTable->GetHistogramParameterfv) (target, pname, params);
-}
-
-static void
-logGetHistogramParameteriv (GLenum target,
- GLenum pname,
- GLint *params)
-{
- fprintf (logFp, "glGetHistogramParameteriv (0x%x, 0x%x, %p)\n",
- target, pname, params);
- (*nativeRenderTable->GetHistogramParameteriv) (target, pname, params);
-}
-
-static void
-logGetMinmax (GLenum target,
- GLboolean reset,
- GLenum format,
- GLenum type,
- GLvoid *values)
-{
- fprintf (logFp, "glGetMinmax (0x%x, %d, 0x%x, 0x%x, %p)\n",
- target, reset, format, type, values);
- (*nativeRenderTable->GetMinmax) (target, reset, format, type, values);
-}
-
-static void
-logGetMinmaxParameterfv (GLenum target,
- GLenum pname,
- GLfloat *params)
-{
- fprintf (logFp, "GetMinmaxParameterfv (0x%x, 0x%x, %p)\n",
- target, pname, params);
- (*nativeRenderTable->GetMinmaxParameterfv) (target, pname, params);
-}
-
-static void
-logGetMinmaxParameteriv (GLenum target,
- GLenum pname,
- GLint *params)
-{
- fprintf (logFp, "GetMinmaxParameteriv (0x%x, 0x%x, %p)\n",
- target, pname, params);
- (*nativeRenderTable->GetMinmaxParameteriv) (target, pname, params);
-}
-
-static void
-logHistogram (GLenum target,
- GLsizei width,
- GLenum internalformat,
- GLboolean sink)
-{
- fprintf (logFp, "glHistogram (0x%x, %d, 0x%x, %d)\n",
- target, width, internalformat, sink);
- (*nativeRenderTable->Histogram) (target, width, internalformat, sink);
-}
-
-static void
-logMinmax (GLenum target,
- GLenum internalformat,
- GLboolean sink)
-{
- fprintf (logFp, "glMinmax (0x%x, 0x%x, %d)\n",
- target, internalformat, sink);
- (*nativeRenderTable->Minmax) (target, internalformat, sink);
-}
-
-static void
-logResetHistogram (GLenum target)
-{
- fprintf (logFp, "glResetHistogram (0x%x)\n", target);
- (*nativeRenderTable->ResetHistogram) (target);
-}
-
-static void
-logResetMinmax (GLenum target)
-{
- fprintf (logFp, "glResetMinmax (0x%x)\n", target);
- (*nativeRenderTable->ResetMinmax) (target);
-}
-
-static void
-logCopyTexSubImage3D (GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLint zoffset,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height)
-{
- fprintf (logFp, "glCopyTexSubImage3D (0x%x, %d, %d, %d, %d, %d, %d, "
- "%d, %d)\n", target, level, xoffset, yoffset, zoffset,
- x, y, width, height);
- (*nativeRenderTable->CopyTexSubImage3D) (target, level,
- xoffset, yoffset, zoffset,
- x, y, width, height);
-}
-
-static void
-logTexImage3D (GLenum target,
- GLint level,
- GLint internalformat,
- GLsizei width,
- GLsizei height,
- GLsizei depth,
- GLint border,
- GLenum format,
- GLenum type,
- const GLvoid *pixels)
-{
- fprintf (logFp, "glTexImage3D (0x%x, %d, %d, %d, %d, %d, %d, "
- "0x%x, 0x%x, %p)\n", target, level, internalformat,
- width, height, depth, border, format, type, pixels);
- (*nativeRenderTable->TexImage3D) (target, level, internalformat,
- width, height, depth, border,
- format, type, pixels);
-}
-
-static void
-logTexSubImage3D (GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLint zoffset,
- GLsizei width,
- GLsizei height,
- GLsizei depth,
- GLenum format,
- GLenum type,
- const GLvoid *pixels)
-{
- fprintf (logFp, "glTexSubImage3D (0x%x, %d, %d, %d, %d, %d, %d, %d, "
- "0x%x, 0x%x, %p)\n", target, level, xoffset, yoffset, zoffset,
- width, height, depth, format, type, pixels);
- (*nativeRenderTable->TexSubImage3D) (target, level,
- xoffset, yoffset, zoffset,
- width, height, depth,
- format, type, pixels);
-}
-
-/* GL_ARB_multitexture */
-
-static void
-logActiveTextureARB (GLenum texture)
-{
- fprintf (logFp, "glActiveTextureARB (0x%x)\n", texture);
- (*nativeRenderTable->ActiveTextureARB) (texture);
-}
-
-static void
-logClientActiveTextureARB (GLenum texture)
-{
- fprintf (logFp, "glClientActiveTextureARB (0x%x)\n", texture);
- (*nativeRenderTable->ClientActiveTextureARB) (texture);
-}
-
-static void
-logMultiTexCoord1dvARB (GLenum target,
- const GLdouble *v)
-{
- vCnt[multiTexCoord1dvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glMultiTexCoord1dvARB (0x%x, %p)\n", target, v);
- (*nativeRenderTable->MultiTexCoord1dvARB) (target, v);
-}
-
-static void
-logMultiTexCoord1fvARB (GLenum target,
- const GLfloat *v)
-{
- vCnt[multiTexCoord1fvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glMultiTexCoord1fvARB (0x%x, %p)\n", target, v);
- (*nativeRenderTable->MultiTexCoord1fvARB) (target, v);
-}
-
-static void
-logMultiTexCoord1ivARB (GLenum target,
- const GLint *v)
-{
- vCnt[multiTexCoord1ivIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glMultiTexCoord1ivARB (0x%x, %p)\n", target, v);
- (*nativeRenderTable->MultiTexCoord1ivARB) (target, v);
-}
-
-static void
-logMultiTexCoord1svARB (GLenum target,
- const GLshort *v)
-{
- vCnt[multiTexCoord1svIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glMultiTexCoord1svARB (0x%x, %p)\n", target, v);
- (*nativeRenderTable->MultiTexCoord1svARB) (target, v);
-}
-
-static void
-logMultiTexCoord2dvARB (GLenum target,
- const GLdouble *v)
-{
- vCnt[multiTexCoord2dvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glMultiTexCoord2dvARB (0x%x, %p)\n", target, v);
- (*nativeRenderTable->MultiTexCoord2dvARB) (target, v);
-}
-
-static void
-logMultiTexCoord2fvARB (GLenum target,
- const GLfloat *v)
-{
- vCnt[multiTexCoord2fvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glMultiTexCoord2fvARB (0x%x, %p)\n", target, v);
- (*nativeRenderTable->MultiTexCoord2fvARB) (target, v);
-}
-
-static void
-logMultiTexCoord2ivARB (GLenum target,
- const GLint *v)
-{
- vCnt[multiTexCoord2ivIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glMultiTexCoord2ivARB (0x%x, %p)\n", target, v);
- (*nativeRenderTable->MultiTexCoord2ivARB) (target, v);
-}
-
-static void
-logMultiTexCoord2svARB (GLenum target,
- const GLshort *v)
-{
- vCnt[multiTexCoord2svIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glMultiTexCoord2svARB (0x%x, %p)\n", target, v);
- (*nativeRenderTable->MultiTexCoord2svARB) (target, v);
-}
-
-static void
-logMultiTexCoord3dvARB (GLenum target,
- const GLdouble *v)
-{
- vCnt[multiTexCoord3dvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glMultiTexCoord3dvARB (0x%x, %p)\n", target, v);
- (*nativeRenderTable->MultiTexCoord3dvARB) (target, v);
-}
-
-static void
-logMultiTexCoord3fvARB (GLenum target,
- const GLfloat *v)
-{
- vCnt[multiTexCoord3fvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glMultiTexCoord3fvARB (0x%x, %p)\n", target, v);
- (*nativeRenderTable->MultiTexCoord3fvARB) (target, v);
-}
-
-static void
-logMultiTexCoord3ivARB (GLenum target,
- const GLint *v)
-{
- vCnt[multiTexCoord3ivIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glMultiTexCoord3ivARB (0x%x, %p)\n", target, v);
- (*nativeRenderTable->MultiTexCoord3ivARB) (target, v);
-}
-
-static void
-logMultiTexCoord3svARB (GLenum target,
- const GLshort *v)
-{
- vCnt[multiTexCoord3svIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glMultiTexCoord3svARB (0x%x, %p)\n", target, v);
- (*nativeRenderTable->MultiTexCoord3svARB) (target, v);
-}
-
-static void
-logMultiTexCoord4dvARB (GLenum target,
- const GLdouble *v)
-{
- vCnt[multiTexCoord4dvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glMultiTexCoord4dvARB (0x%x, %p)\n", target, v);
- (*nativeRenderTable->MultiTexCoord4dvARB) (target, v);
-}
-
-static void
-logMultiTexCoord4fvARB (GLenum target,
- const GLfloat *v)
-{
- vCnt[multiTexCoord4fvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glMultiTexCoord4fvARB (0x%x, %p)\n", target, v);
- (*nativeRenderTable->MultiTexCoord4fvARB) (target, v);
-}
-
-static void
-logMultiTexCoord4ivARB (GLenum target,
- const GLint *v)
-{
- vCnt[multiTexCoord4ivIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glMultiTexCoord4ivARB (0x%x, %p)\n", target, v);
- (*nativeRenderTable->MultiTexCoord4ivARB) (target, v);
-}
-
-static void
-logMultiTexCoord4svARB (GLenum target,
- const GLshort *v)
-{
- vCnt[multiTexCoord4svIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glMultiTexCoord4svARB (0x%x, %p)\n", target, v);
- (*nativeRenderTable->MultiTexCoord4svARB) (target, v);
-}
-
-
-/* GL_ARB_multisample */
-
-static void
-logSampleCoverageARB (GLclampf value,
- GLboolean invert)
-{
- fprintf (logFp, "glSampleCoverageARB (%f, %d)\n", value, invert);
- (*nativeRenderTable->SampleCoverageARB) (value, invert);
-}
-
-
-/* GL_EXT_texture_object */
-
-static GLboolean
-logAreTexturesResidentEXT (GLsizei n,
- const GLuint *textures,
- GLboolean *residences)
-{
- fprintf (logFp, "glAreTexturesResidentEXT (%d, %p, %p)\n",
- n, textures, residences);
- return (*nativeRenderTable->AreTexturesResidentEXT) (n, textures,
- residences);
-}
-static void
-logGenTexturesEXT (GLsizei n,
- GLuint *textures)
-{
- fprintf (logFp, "glGenTexturesEXT (%d, %p)\n", n, textures);
- (*nativeRenderTable->GenTexturesEXT) (n, textures);
-}
-
-static GLboolean
-logIsTextureEXT (GLuint texture)
-{
- fprintf (logFp, "glIsTextureEXT (%d)\n", texture);
- return (*nativeRenderTable->IsTextureEXT) (texture);
-}
-
-
-/* GL_SGIS_multisample */
-
-static void
-logSampleMaskSGIS (GLclampf value,
- GLboolean invert)
-{
- fprintf (logFp, "glSampleMaskSGIS (%f, %d)\n", value, invert);
- (*nativeRenderTable->SampleMaskSGIS) (value, invert);
-}
-
-static void
-logSamplePatternSGIS (GLenum pattern)
-{
- fprintf (logFp, "glSamplePatternSGIS (0x%x)\n", pattern);
- (*nativeRenderTable->SamplePatternSGIS) (pattern);
-}
-
-
-/* GL_EXT_point_parameters */
-
-static void
-logPointParameterfEXT (GLenum pname,
- GLfloat param)
-{
- fprintf (logFp, "glPointParameterfEXT (0x%x, %f)\n", pname, param);
- (*nativeRenderTable->PointParameterfEXT) (pname, param);
-}
-
-static void
-logPointParameterfvEXT (GLenum pname,
- const GLfloat *params)
-{
- fprintf (logFp, "glPointParameterfvEXT (0x%x, %p)\n", pname, params);
- (*nativeRenderTable->PointParameterfvEXT) (pname, params);
-}
-
-
-/* GL_MESA_window_pos */
-
-static void
-logWindowPos3fMESA (GLfloat x,
- GLfloat y,
- GLfloat z)
-{
- fprintf (logFp, "glWindowPos3fMESA (%f, %f, %f)\n", x, y, z);
- (*nativeRenderTable->WindowPos3fMESA) (x, y, z);
-}
-
-
-/* GL_EXT_blend_func_separate */
-
-static void
-logBlendFuncSeparateEXT (GLenum sfactorRGB,
- GLenum dfactorRGB,
- GLenum sfactorAlpha,
- GLenum dfactorAlpha)
-{
- fprintf (logFp, "glBlendFuncSeparateEXT (0x%x, 0x%x, 0x%x, 0x%x)\n",
- sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
- (*nativeRenderTable->BlendFuncSeparateEXT) (sfactorRGB,
- dfactorRGB,
- sfactorAlpha,
- dfactorAlpha);
-}
-
-
-/* GL_EXT_fog_coord */
-
-static void
-logFogCoordfvEXT (const GLfloat *coord)
-{
- vCnt[fogCoordfvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glFogCoordfvEXT (%p)\n", coord);
- (*nativeRenderTable->FogCoordfvEXT) (coord);
-}
-
-static void
-logFogCoorddvEXT (const GLdouble *coord)
-{
- vCnt[fogCoorddvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glFogCoorddvEXT (%p)\n", coord);
- (*nativeRenderTable->FogCoorddvEXT) (coord);
-}
-
-static void
-logFogCoordPointerEXT (GLenum type,
- GLsizei stride,
- const GLvoid *pointer)
-{
- fprintf (logFp, "glFogCoordPointerEXT (0x%x, %d, %p)\n",
- type, stride, pointer);
- (*nativeRenderTable->FogCoordPointerEXT) (type, stride, pointer);
-}
-
-
-/* GL_EXT_secondary_color */
-
-static void
-logSecondaryColor3bvEXT (const GLbyte *v)
-{
- vCnt[secondaryColor3bvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glSecondaryColor3bvEXT (%p)\n", v);
- (*nativeRenderTable->SecondaryColor3bvEXT) (v);
-}
-
-static void
-logSecondaryColor3dvEXT (const GLdouble *v)
-{
- vCnt[secondaryColor3dvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glSecondaryColor3dvEXT (%p)\n", v);
- (*nativeRenderTable->SecondaryColor3dvEXT) (v);
-}
-
-static void
-logSecondaryColor3fvEXT (const GLfloat *v)
-{
- vCnt[secondaryColor3fvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glSecondaryColor3fvEXT (%p)\n", v);
- (*nativeRenderTable->SecondaryColor3fvEXT) (v);
-}
-
-static void
-logSecondaryColor3ivEXT (const GLint *v)
-{
- vCnt[secondaryColor3ivIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glSecondaryColor3ivEXT (%p)\n", v);
- (*nativeRenderTable->SecondaryColor3ivEXT) (v);
-}
-
-static void
-logSecondaryColor3svEXT (const GLshort *v)
-{
- vCnt[secondaryColor3svIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glSecondaryColor3svEXT (%p)\n", v);
- (*nativeRenderTable->SecondaryColor3svEXT) (v);
-}
-
-static void
-logSecondaryColor3ubvEXT (const GLubyte *v)
-{
- vCnt[secondaryColor3ubvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glSecondaryColor3ubvEXT (%p)\n", v);
- (*nativeRenderTable->SecondaryColor3ubvEXT) (v);
-}
-
-static void
-logSecondaryColor3uivEXT (const GLuint *v)
-{
- vCnt[secondaryColor3uivIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glSecondaryColor3uivEXT (%p)\n", v);
- (*nativeRenderTable->SecondaryColor3uivEXT) (v);
-}
-
-static void
-logSecondaryColor3usvEXT (const GLushort *v)
-{
- vCnt[secondaryColor3usvIndex].n++;
- if (logVertexAttribs)
- fprintf (logFp, "glSecondaryColor3usvEXT (%p)\n", v);
- (*nativeRenderTable->SecondaryColor3usvEXT) (v);
-}
-
-static void
-logSecondaryColorPointerEXT (GLint size,
- GLenum type,
- GLsizei stride,
- const GLvoid *pointer)
-{
- fprintf (logFp, "glSecondaryColorPointerEXT (%d, 0x%x, %d, %p)\n",
- size, type, stride, pointer);
- (*nativeRenderTable->SecondaryColorPointerEXT) (size, type,
- stride, pointer);
-}
-
-
-/* GL_NV_point_sprite */
-
-static void
-logPointParameteriNV (GLenum pname,
- GLint param)
-{
- fprintf (logFp, "glPointParameteriNV (0x%x, %d)\n", pname, param);
- (*nativeRenderTable->PointParameteriNV) (pname, param);
-}
-
-static void
-logPointParameterivNV (GLenum pname,
- const GLint *params)
-{
- fprintf (logFp, "glPointParameterivNV (0x%x, %p)\n", pname, params);
- (*nativeRenderTable->PointParameterivNV) (pname, params);
-}
-
-
-/* GL_EXT_stencil_two_side */
-
-static void
-logActiveStencilFaceEXT (GLenum face)
-{
- fprintf (logFp, "glActiveStencilFaceEXT (0x%x)\n", face);
- (*nativeRenderTable->ActiveStencilFaceEXT) (face);
-}
-
-
-/* GL_EXT_framebuffer_object */
-
-static GLboolean
-logIsRenderbufferEXT (GLuint renderbuffer)
-{
- fprintf (logFp, "glIsRenderbufferEXT (%d)\n", renderbuffer);
- return (*nativeRenderTable->IsRenderbufferEXT) (renderbuffer);
-}
-
-static void
-logBindRenderbufferEXT (GLenum target,
- GLuint renderbuffer)
-{
- fprintf (logFp, "glBindRenderbufferEXT (0x%x, %d)\n",
- target, renderbuffer);
- (*nativeRenderTable->BindRenderbufferEXT) (target, renderbuffer);
-}
-
-static void
-logDeleteRenderbuffersEXT (GLsizei n,
- const GLuint *renderbuffers)
-{
- fprintf (logFp, "glDeleteRenderbuffersEXT (%d, %p)\n", n, renderbuffers);
- (*nativeRenderTable->DeleteRenderbuffersEXT) (n, renderbuffers);
-}
-
-static void
-logGenRenderbuffersEXT (GLsizei n,
- GLuint *renderbuffers)
-{
- fprintf (logFp, "glGenRenderbuffersEXT (%d, %p)\n", n, renderbuffers);
- (*nativeRenderTable->GenRenderbuffersEXT) (n, renderbuffers);
-}
-
-static void
-logRenderbufferStorageEXT (GLenum target,
- GLenum internalformat,
- GLsizei width,
- GLsizei height)
-{
- fprintf (logFp, "glRenderbufferStorageEXT (0x%x, 0x%x, %d, %d)\n",
- target, internalformat, width, height);
- (*nativeRenderTable->RenderbufferStorageEXT) (target,
- internalformat,
- width, height);
-}
-
-static void
-logGetRenderbufferParameterivEXT (GLenum target,
- GLenum pname,
- GLint *params)
-{
- fprintf (logFp, "glGetRenderbufferParameterivEXT (0x%x, 0x%x, %p)\n",
- target, pname, params);
- (*nativeRenderTable->GetRenderbufferParameterivEXT) (target,
- pname,
- params);
-}
-
-static GLboolean
-logIsFramebufferEXT (GLuint framebuffer)
-{
- fprintf (logFp, "glIsFramebufferEXT (%d)\n", framebuffer);
- return (*nativeRenderTable->IsFramebufferEXT) (framebuffer);
-}
-
-static void
-logBindFramebufferEXT (GLenum target,
- GLuint framebuffer)
-{
- fprintf (logFp, "glBindFramebufferEXT (0x%x, %d)\n", target, framebuffer);
- (*nativeRenderTable->BindFramebufferEXT) (target, framebuffer);
-}
-
-static void
-logDeleteFramebuffersEXT (GLsizei n,
- const GLuint *framebuffers)
-{
- fprintf (logFp, "glDeleteFramebuffersEXT (%d, %p)\n", n, framebuffers);
- (*nativeRenderTable->DeleteFramebuffersEXT) (n, framebuffers);
-}
-
-static void
-logGenFramebuffersEXT (GLsizei n,
- GLuint *framebuffers)
-{
- fprintf (logFp, "glGenFramebuffersEXT (%d, %p)\n", n, framebuffers);
- (*nativeRenderTable->GenFramebuffersEXT) (n, framebuffers);
-}
-
-static GLenum
-logCheckFramebufferStatusEXT (GLenum target)
-{
- fprintf (logFp, "glCheckFramebufferStatusEXT (0x%x)\n", target);
- return (*nativeRenderTable->CheckFramebufferStatusEXT) (target);
-}
-
-static void
-logFramebufferTexture1DEXT (GLenum target,
- GLenum attachment,
- GLenum textarget,
- GLuint texture,
- GLint level)
-{
- fprintf (logFp, "glFramebufferTexture1DEXT (0x%x, 0x%x, 0x%x, %d, %d)\n",
- target, attachment, textarget, texture, level);
- (*nativeRenderTable->FramebufferTexture1DEXT) (target, attachment,
- textarget, texture,
- level);
-}
-
-static void
-logFramebufferTexture2DEXT (GLenum target,
- GLenum attachment,
- GLenum textarget,
- GLuint texture,
- GLint level)
-{
- fprintf (logFp, "glFramebufferTexture2DEXT (0x%x, 0x%x, 0x%x, %d, %d)\n",
- target, attachment, textarget, texture, level);
- (*nativeRenderTable->FramebufferTexture2DEXT) (target, attachment,
- textarget, texture,
- level);
-}
-
-static void
-logFramebufferTexture3DEXT (GLenum target,
- GLenum attachment,
- GLenum textarget,
- GLuint texture,
- GLint level,
- GLint zoffset)
-{
- fprintf (logFp, "glFramebufferTexture3DEXT (0x%x, 0x%x, 0x%x, "
- "%d, %d, %d)\n", target, attachment, textarget, texture,
- level, zoffset);
- (*nativeRenderTable->FramebufferTexture3DEXT) (target, attachment,
- textarget, texture,
- level, zoffset);
-}
-
-static void
-logFramebufferRenderbufferEXT (GLenum target,
- GLenum attachment,
- GLenum buffertarget,
- GLuint renderbuffer)
-{
- fprintf (logFp, "glFramebufferRenderbufferEXT (0x%x, 0x%x, 0x%x, %d)\n",
- target, attachment, buffertarget, renderbuffer);
- (*nativeRenderTable->FramebufferRenderbufferEXT) (target,
- attachment,
- buffertarget,
- renderbuffer);
-}
-
-static void
-logGetFramebufferAttachmentParameterivEXT (GLenum target,
- GLenum attach,
- GLenum pname,
- GLint *params)
-{
- fprintf (logFp, "glGetFramebufferAttachmentParameterivEXT (0x%x, "
- "0x%x, 0x%x, %p)\n", target, attach, pname, params);
- (*nativeRenderTable->GetFramebufferAttachmentParameterivEXT) (target,
- attach,
- pname,
- params);
-}
-
-static void
-logGenerateMipmapEXT (GLenum target)
-{
- fprintf (logFp, "glGenerateMipmapEXT (0x%x)\n", target);
- (*nativeRenderTable->GenerateMipmapEXT) (target);
-}
-
-static struct _glapi_table __logRenderTable = {
- logNewList,
- logEndList,
- logCallList,
- logCallLists,
- logDeleteLists,
- logGenLists,
- logListBase,
- logBegin,
- logBitmap,
- 0, /* glColor3b */
- logColor3bv,
- 0, /* glColor3d */
- logColor3dv,
- 0, /* glColor3f */
- logColor3fv,
- 0, /* glColor3i */
- logColor3iv,
- 0, /* glColor3s */
- logColor3sv,
- 0, /* glColor3ub */
- logColor3ubv,
- 0, /* glColor3ui */
- logColor3uiv,
- 0, /* glColor3us */
- logColor3usv,
- 0, /* glColor4b */
- logColor4bv,
- 0, /* glColor4d */
- logColor4dv,
- 0, /* glColor4f */
- logColor4fv,
- 0, /* glColor4i */
- logColor4iv,
- 0, /* glColor4s */
- logColor4sv,
- 0, /* glColor4ub */
- logColor4ubv,
- 0, /* glColor4ui */
- logColor4uiv,
- 0, /* glColor4us */
- logColor4usv,
- 0, /* glEdgeFlag */
- logEdgeFlagv,
- logEnd,
- 0, /* glIndexd */
- logIndexdv,
- 0, /* glIndexf */
- logIndexfv,
- 0, /* glIndexi */
- logIndexiv,
- 0, /* glIndexs */
- logIndexsv,
- 0, /* glNormal3b */
- logNormal3bv,
- 0, /* glNormal3d */
- logNormal3dv,
- 0, /* glNormal3f */
- logNormal3fv,
- 0, /* glNormal3i */
- logNormal3iv,
- 0, /* glNormal3s */
- logNormal3sv,
- 0, /* glRasterPos2d */
- logRasterPos2dv,
- 0, /* glRasterPos2f */
- logRasterPos2fv,
- 0, /* glRasterPos2i */
- logRasterPos2iv,
- 0, /* glRasterPos2s */
- logRasterPos2sv,
- 0, /* glRasterPos3d */
- logRasterPos3dv,
- 0, /* glRasterPos3f */
- logRasterPos3fv,
- 0, /* glRasterPos3i */
- logRasterPos3iv,
- 0, /* glRasterPos3s */
- logRasterPos3sv,
- 0, /* glRasterPos4d */
- logRasterPos4dv,
- 0, /* glRasterPos4f */
- logRasterPos4fv,
- 0, /* glRasterPos4i */
- logRasterPos4iv,
- 0, /* glRasterPos4s */
- logRasterPos4sv,
- 0, /* glRectd */
- logRectdv,
- 0, /* glRectf */
- logRectfv,
- 0, /* glRecti */
- logRectiv,
- 0, /* glRects */
- logRectsv,
- 0, /* glTexCoord1d */
- logTexCoord1dv,
- 0, /* glTexCoord1f */
- logTexCoord1fv,
- 0, /* glTexCoord1i */
- logTexCoord1iv,
- 0, /* glTexCoord1s */
- logTexCoord1sv,
- 0, /* glTexCoord2d */
- logTexCoord2dv,
- 0, /* glTexCoord2f */
- logTexCoord2fv,
- 0, /* glTexCoord2i */
- logTexCoord2iv,
- 0, /* glTexCoord2s */
- logTexCoord2sv,
- 0, /* glTexCoord3d */
- logTexCoord3dv,
- 0, /* glTexCoord3f */
- logTexCoord3fv,
- 0, /* glTexCoord3i */
- logTexCoord3iv,
- 0, /* glTexCoord3s */
- logTexCoord3sv,
- 0, /* glTexCoord4d */
- logTexCoord4dv,
- 0, /* glTexCoord4f */
- logTexCoord4fv,
- 0, /* glTexCoord4i */
- logTexCoord4iv,
- 0, /* glTexCoord4s */
- logTexCoord4sv,
- 0, /* glVertex2d */
- logVertex2dv,
- 0, /* glVertex2f */
- logVertex2fv,
- 0, /* glVertex2i */
- logVertex2iv,
- 0, /* glVertex2s */
- logVertex2sv,
- 0, /* glVertex3d */
- logVertex3dv,
- 0, /* glVertex3f */
- logVertex3fv,
- 0, /* glVertex3i */
- logVertex3iv,
- 0, /* glVertex3s */
- logVertex3sv,
- 0, /* glVertex4d */
- logVertex4dv,
- 0, /* glVertex4f */
- logVertex4fv,
- 0, /* glVertex4i */
- logVertex4iv,
- 0, /* glVertex4s */
- logVertex4sv,
- logClipPlane,
- logColorMaterial,
- logCullFace,
- logFogf,
- logFogfv,
- logFogi,
- logFogiv,
- logFrontFace,
- logHint,
- logLightf,
- logLightfv,
- logLighti,
- logLightiv,
- logLightModelf,
- logLightModelfv,
- logLightModeli,
- logLightModeliv,
- logLineStipple,
- logLineWidth,
- logMaterialf,
- logMaterialfv,
- logMateriali,
- logMaterialiv,
- logPointSize,
- logPolygonMode,
- logPolygonStipple,
- logScissor,
- logShadeModel,
- logTexParameterf,
- logTexParameterfv,
- logTexParameteri,
- logTexParameteriv,
- logTexImage1D,
- logTexImage2D,
- logTexEnvf,
- logTexEnvfv,
- logTexEnvi,
- logTexEnviv,
- logTexGend,
- logTexGendv,
- logTexGenf,
- logTexGenfv,
- logTexGeni,
- logTexGeniv,
- logFeedbackBuffer,
- logSelectBuffer,
- logRenderMode,
- logInitNames,
- logLoadName,
- logPassThrough,
- logPopName,
- logPushName,
- logDrawBuffer,
- logClear,
- logClearAccum,
- logClearIndex,
- logClearColor,
- logClearStencil,
- logClearDepth,
- logStencilMask,
- logColorMask,
- logDepthMask,
- logIndexMask,
- logAccum,
- logDisable,
- logEnable,
- logFinish,
- logFlush,
- logPopAttrib,
- logPushAttrib,
- logMap1d,
- logMap1f,
- logMap2d,
- logMap2f,
- logMapGrid1d,
- logMapGrid1f,
- logMapGrid2d,
- logMapGrid2f,
- 0, /* glEvalCoord1d */
- logEvalCoord1dv,
- 0, /* glEvalCoord1f */
- logEvalCoord1fv,
- 0, /* glEvalCoord2d */
- logEvalCoord2dv,
- 0, /* glEvalCoord2f */
- logEvalCoord2fv,
- logEvalMesh1,
- logEvalPoint1,
- logEvalMesh2,
- logEvalPoint2,
- logAlphaFunc,
- logBlendFunc,
- logLogicOp,
- logStencilFunc,
- logStencilOp,
- logDepthFunc,
- logPixelZoom,
- logPixelTransferf,
- logPixelTransferi,
- logPixelStoref,
- logPixelStorei,
- logPixelMapfv,
- logPixelMapuiv,
- logPixelMapusv,
- logReadBuffer,
- logCopyPixels,
- logReadPixels,
- logDrawPixels,
- logGetBooleanv,
- logGetClipPlane,
- logGetDoublev,
- logGetError,
- logGetFloatv,
- logGetIntegerv,
- logGetLightfv,
- logGetLightiv,
- logGetMapdv,
- logGetMapfv,
- logGetMapiv,
- logGetMaterialfv,
- logGetMaterialiv,
- logGetPixelMapfv,
- logGetPixelMapuiv,
- logGetPixelMapusv,
- logGetPolygonStipple,
- logGetString,
- logGetTexEnvfv,
- logGetTexEnviv,
- logGetTexGendv,
- logGetTexGenfv,
- logGetTexGeniv,
- logGetTexImage,
- logGetTexParameterfv,
- logGetTexParameteriv,
- logGetTexLevelParameterfv,
- logGetTexLevelParameteriv,
- logIsEnabled,
- logIsList,
- logDepthRange,
- logFrustum,
- logLoadIdentity,
- logLoadMatrixf,
- logLoadMatrixd,
- logMatrixMode,
- logMultMatrixf,
- logMultMatrixd,
- logOrtho,
- logPopMatrix,
- logPushMatrix,
- logRotated,
- logRotatef,
- logScaled,
- logScalef,
- logTranslated,
- logTranslatef,
- logViewport,
- logArrayElement,
- logBindTexture,
- logColorPointer,
- logDisableClientState,
- logDrawArrays,
- logDrawElements,
- logEdgeFlagPointer,
- logEnableClientState,
- logIndexPointer,
- 0, /* glIndexub */
- logIndexubv,
- logInterleavedArrays,
- logNormalPointer,
- logPolygonOffset,
- logTexCoordPointer,
- logVertexPointer,
- logAreTexturesResident,
- logCopyTexImage1D,
- logCopyTexImage2D,
- logCopyTexSubImage1D,
- logCopyTexSubImage2D,
- logDeleteTextures,
- logGenTextures,
- logGetPointerv,
- logIsTexture,
- logPrioritizeTextures,
- logTexSubImage1D,
- logTexSubImage2D,
- logPopClientAttrib,
- logPushClientAttrib,
- logBlendColor,
- logBlendEquation,
- 0, /* glDrawRangeElements */
- logColorTable,
- logColorTableParameterfv,
- logColorTableParameteriv,
- logCopyColorTable,
- logGetColorTable,
- logGetColorTableParameterfv,
- logGetColorTableParameteriv,
- logColorSubTable,
- logCopyColorSubTable,
- logConvolutionFilter1D,
- logConvolutionFilter2D,
- logConvolutionParameterf,
- logConvolutionParameterfv,
- logConvolutionParameteri,
- logConvolutionParameteriv,
- logCopyConvolutionFilter1D,
- logCopyConvolutionFilter2D,
- logGetConvolutionFilter,
- logGetConvolutionParameterfv,
- logGetConvolutionParameteriv,
- logGetSeparableFilter,
- logSeparableFilter2D,
- logGetHistogram,
- logGetHistogramParameterfv,
- logGetHistogramParameteriv,
- logGetMinmax,
- logGetMinmaxParameterfv,
- logGetMinmaxParameteriv,
- logHistogram,
- logMinmax,
- logResetHistogram,
- logResetMinmax,
- logTexImage3D,
- logTexSubImage3D,
- logCopyTexSubImage3D,
- logActiveTextureARB,
- logClientActiveTextureARB,
- 0, /* glMultiTexCoord1dARB */
- logMultiTexCoord1dvARB,
- 0, /* glMultiTexCoord1fARB */
- logMultiTexCoord1fvARB,
- 0, /* glMultiTexCoord1iARB */
- logMultiTexCoord1ivARB,
- 0, /* glMultiTexCoord1sARB */
- logMultiTexCoord1svARB,
- 0, /* glMultiTexCoord2dARB */
- logMultiTexCoord2dvARB,
- 0, /* glMultiTexCoord2fARB */
- logMultiTexCoord2fvARB,
- 0, /* glMultiTexCoord2iARB */
- logMultiTexCoord2ivARB,
- 0, /* glMultiTexCoord2sARB */
- logMultiTexCoord2svARB,
- 0, /* glMultiTexCoord3dARB */
- logMultiTexCoord3dvARB,
- 0, /* glMultiTexCoord3fARB */
- logMultiTexCoord3fvARB,
- 0, /* glMultiTexCoord3iARB */
- logMultiTexCoord3ivARB,
- 0, /* glMultiTexCoord3sARB */
- logMultiTexCoord3svARB,
- 0, /* glMultiTexCoord4dARB */
- logMultiTexCoord4dvARB,
- 0, /* glMultiTexCoord4fARB */
- logMultiTexCoord4fvARB,
- 0, /* glMultiTexCoord4iARB */
- logMultiTexCoord4ivARB,
- 0, /* glMultiTexCoord4sARB */
- logMultiTexCoord4svARB,
- 0, /* glLoadTransposeMatrixfARB */
- 0, /* glLoadTransposeMatrixdARB */
- 0, /* glMultTransposeMatrixfARB */
- 0, /* glMultTransposeMatrixdARB */
- logSampleCoverageARB,
- 0, /* glDrawBuffersARB */
- 0, /* glPolygonOffsetEXT */
- 0, /* glGetTexFilterFuncSGIS */
- 0, /* glTexFilterFuncSGIS */
- 0, /* glGetHistogramEXT */
- 0, /* glGetHistogramParameterfvEXT */
- 0, /* glGetHistogramParameterivEXT */
- 0, /* glGetMinmaxEXT */
- 0, /* glGetMinmaxParameterfvEXT */
- 0, /* glGetMinmaxParameterivEXT */
- 0, /* glGetConvolutionFilterEXT */
- 0, /* glGetConvolutionParameterfvEXT */
- 0, /* glGetConvolutionParameterivEXT */
- 0, /* glGetSeparableFilterEXT */
- 0, /* glGetColorTableSGI */
- 0, /* glGetColorTableParameterfvSGI */
- 0, /* glGetColorTableParameterivSGI */
- 0, /* glPixelTexGenSGIX */
- 0, /* glPixelTexGenParameteriSGIS */
- 0, /* glPixelTexGenParameterivSGIS */
- 0, /* glPixelTexGenParameterfSGIS */
- 0, /* glPixelTexGenParameterfvSGIS */
- 0, /* glGetPixelTexGenParameterivSGIS */
- 0, /* glGetPixelTexGenParameterfvSGIS */
- 0, /* glTexImage4DSGIS */
- 0, /* glTexSubImage4DSGIS */
- logAreTexturesResidentEXT,
- logGenTexturesEXT,
- logIsTextureEXT,
- 0, /* glDetailTexFuncSGIS */
- 0, /* glGetDetailTexFuncSGIS */
- 0, /* glSharpenTexFuncSGIS */
- 0, /* glGetSharpenTexFuncSGIS */
- logSampleMaskSGIS,
- logSamplePatternSGIS,
- 0, /* glColorPointerEXT */
- 0, /* glEdgeFlagPointerEXT */
- 0, /* glIndexPointerEXT */
- 0, /* glNormalPointerEXT */
- 0, /* glTexCoordPointerEXT */
- 0, /* glVertexPointerEXT */
- 0, /* glSpriteParameterfSGIX */
- 0, /* glSpriteParameterfvSGIX */
- 0, /* glSpriteParameteriSGIX */
- 0, /* glSpriteParameterivSGIX */
- logPointParameterfEXT,
- logPointParameterfvEXT,
- 0, /* glGetInstrumentsSGIX */
- 0, /* glInstrumentsBufferSGIX */
- 0, /* glPollInstrumentsSGIX */
- 0, /* glReadInstrumentsSGIX */
- 0, /* glStartInstrumentsSGIX */
- 0, /* glStopInstrumentsSGIX */
- 0, /* glFrameZoomSGIX */
- 0, /* glTagSampleBufferSGIX */
- 0, /* glReferencePlaneSGIX */
- 0, /* glFlushRasterSGIX */
- 0, /* glGetListParameterfvSGIX */
- 0, /* glGetListParameterivSGIX */
- 0, /* glListParameterfSGIX */
- 0, /* glListParameterfvSGIX */
- 0, /* glListParameteriSGIX */
- 0, /* glListParameterivSGIX */
- 0, /* glFragmentColorMaterialSGIX */
- 0, /* glFragmentLightfSGIX */
- 0, /* glFragmentLightfvSGIX */
- 0, /* glFragmentLightiSGIX */
- 0, /* glFragmentLightivSGIX */
- 0, /* glFragmentLightModelfSGIX */
- 0, /* glFragmentLightModelfvSGIX */
- 0, /* glFragmentLightModeliSGIX */
- 0, /* glFragmentLightModelivSGIX */
- 0, /* glFragmentMaterialfSGIX */
- 0, /* glFragmentMaterialfvSGIX */
- 0, /* glFragmentMaterialiSGIX */
- 0, /* glFragmentMaterialivSGIX */
- 0, /* glGetFragmentLightfvSGIX */
- 0, /* glGetFragmentLightivSGIX */
- 0, /* glGetFragmentMaterialfvSGIX */
- 0, /* glGetFragmentMaterialivSGIX */
- 0, /* glLightEnviSGIX */
- 0, /* glVertexWeightfEXT */
- 0, /* glVertexWeightfvEXT */
- 0, /* glVertexWeightPointerEXT */
- 0, /* glFlushVertexArrayRangeNV */
- 0, /* glVertexArrayRangeNV */
- 0, /* glCombinerParameterfvNV */
- 0, /* glCombinerParameterfNV */
- 0, /* glCombinerParameterivNV */
- 0, /* glCombinerParameteriNV */
- 0, /* glCombinerInputNV */
- 0, /* glCombinerOutputNV */
- 0, /* glFinalCombinerInputNV */
- 0, /* glGetCombinerInputParameterfvNV */
- 0, /* glGetCombinerInputParameterivNV */
- 0, /* glGetCombinerOutputParameterfvNV */
- 0, /* glGetCombinerOutputParameterivNV */
- 0, /* glGetFinalCombinerInputParameterfvNV */
- 0, /* glGetFinalCombinerInputParameterivNV */
- 0, /* glResizeBuffersMESA */
- 0, /* glWindowPos2dMESA */
- 0, /* glWindowPos2dvMESA */
- 0, /* glWindowPos2fMESA */
- 0, /* glWindowPos2fvMESA */
- 0, /* glWindowPos2iMESA */
- 0, /* glWindowPos2ivMESA */
- 0, /* glWindowPos2sMESA */
- 0, /* glWindowPos2svMESA */
- 0, /* glWindowPos3dMESA */
- 0, /* glWindowPos3dvMESA */
- logWindowPos3fMESA,
- 0, /* glWindowPos3fvMESA */
- 0, /* glWindowPos3iMESA */
- 0, /* glWindowPos3ivMESA */
- 0, /* glWindowPos3sMESA */
- 0, /* glWindowPos3svMESA */
- 0, /* glWindowPos4dMESA */
- 0, /* glWindowPos4dvMESA */
- 0, /* glWindowPos4fMESA */
- 0, /* glWindowPos4fvMESA */
- 0, /* glWindowPos4iMESA */
- 0, /* glWindowPos4ivMESA */
- 0, /* glWindowPos4sMESA */
- 0, /* glWindowPos4svMESA */
- logBlendFuncSeparateEXT,
- 0, /* glIndexMaterialEXT */
- 0, /* glIndexFuncEXT */
- 0, /* glLockArraysEXT */
- 0, /* glUnlockArraysEXT */
- 0, /* glCullParameterdvEXT */
- 0, /* glCullParameterfvEXT */
- 0, /* glHintPGI */
- 0, /* glFogCoordfEXT */
- logFogCoordfvEXT,
- 0, /* glFogCoorddEXT */
- logFogCoorddvEXT,
- logFogCoordPointerEXT,
- 0, /* glGetColorTableEXT */
- 0, /* glGetColorTableParameterivEXT */
- 0, /* glGetColorTableParameterfvEXT */
- 0, /* glTbufferMask3DFX */
- 0, /* glCompressedTexImage3DARB */
- 0, /* glCompressedTexImage2DARB */
- 0, /* glCompressedTexImage1DARB */
- 0, /* glCompressedTexSubImage3DARB */
- 0, /* glCompressedTexSubImage2DARB */
- 0, /* glCompressedTexSubImage1DARB */
- 0, /* glGetCompressedTexImageARB */
- 0, /* glSecondaryColor3bEXT */
- logSecondaryColor3bvEXT,
- 0, /* glSecondaryColor3dEXT */
- logSecondaryColor3dvEXT,
- 0, /* glSecondaryColor3fEXT */
- logSecondaryColor3fvEXT,
- 0, /* glSecondaryColor3iEXT */
- logSecondaryColor3ivEXT,
- 0, /* glSecondaryColor3sEXT */
- logSecondaryColor3svEXT,
- 0, /* glSecondaryColor3ubEXT */
- logSecondaryColor3ubvEXT,
- 0, /* glSecondaryColor3uiEXT */
- logSecondaryColor3uivEXT,
- 0, /* glSecondaryColor3usEXT */
- logSecondaryColor3usvEXT,
- logSecondaryColorPointerEXT,
- 0, /* glAreProgramsResidentNV */
- 0, /* glBindProgramNV */
- 0, /* glDeleteProgramsNV */
- 0, /* glExecuteProgramNV */
- 0, /* glGenProgramsNV */
- 0, /* glGetProgramParameterdvNV */
- 0, /* glGetProgramParameterfvNV */
- 0, /* glGetProgramivNV */
- 0, /* glGetProgramStringNV */
- 0, /* glGetTrackMatrixivNV */
- 0, /* glGetVertexAttribdvARB */
- 0, /* glGetVertexAttribfvARB */
- 0, /* glGetVertexAttribivARB */
- 0, /* glGetVertexAttribPointervNV */
- 0, /* glIsProgramNV */
- 0, /* glLoadProgramNV */
- 0, /* glProgramParameter4dNV */
- 0, /* glProgramParameter4dvNV */
- 0, /* glProgramParameter4fNV */
- 0, /* glProgramParameter4fvNV */
- 0, /* glProgramParameters4dvNV */
- 0, /* glProgramParameters4fvNV */
- 0, /* glRequestResidentProgramsNV */
- 0, /* glTrackMatrixNV */
- 0, /* glVertexAttribPointerNV */
- 0, /* glVertexAttrib1dARB */
- 0, /* glVertexAttrib1dvARB */
- 0, /* glVertexAttrib1fARB */
- 0, /* glVertexAttrib1fvARB */
- 0, /* glVertexAttrib1sARB */
- 0, /* glVertexAttrib1svARB */
- 0, /* glVertexAttrib2dARB */
- 0, /* glVertexAttrib2dvARB */
- 0, /* glVertexAttrib2fARB */
- 0, /* glVertexAttrib2fvARB */
- 0, /* glVertexAttrib2sARB */
- 0, /* glVertexAttrib2svARB */
- 0, /* glVertexAttrib3dARB */
- 0, /* glVertexAttrib3dvARB */
- 0, /* glVertexAttrib3fARB */
- 0, /* glVertexAttrib3fvARB */
- 0, /* glVertexAttrib3sARB */
- 0, /* glVertexAttrib3svARB */
- 0, /* glVertexAttrib4dARB */
- 0, /* glVertexAttrib4dvARB */
- 0, /* glVertexAttrib4fARB */
- 0, /* glVertexAttrib4fvARB */
- 0, /* glVertexAttrib4sARB */
- 0, /* glVertexAttrib4svARB */
- 0, /* glVertexAttrib4NubARB */
- 0, /* glVertexAttrib4NubvARB */
- 0, /* glVertexAttribs1dvNV */
- 0, /* glVertexAttribs1fvNV */
- 0, /* glVertexAttribs1svNV */
- 0, /* glVertexAttribs2dvNV */
- 0, /* glVertexAttribs2fvNV */
- 0, /* glVertexAttribs2svNV */
- 0, /* glVertexAttribs3dvNV */
- 0, /* glVertexAttribs3fvNV */
- 0, /* glVertexAttribs3svNV */
- 0, /* glVertexAttribs4dvNV */
- 0, /* glVertexAttribs4fvNV */
- 0, /* glVertexAttribs4svNV */
- 0, /* glVertexAttribs4ubvNV */
- logPointParameteriNV,
- logPointParameterivNV,
- 0, /* glMultiDrawArraysEXT */
- 0, /* glMultiDrawElementsEXT */
- logActiveStencilFaceEXT,
- 0, /* glDeleteFencesNV */
- 0, /* glGenFencesNV */
- 0, /* glIsFenceNV */
- 0, /* glTestFenceNV */
- 0, /* glGetFenceivNV */
- 0, /* glFinishFenceNV */
- 0, /* glSetFenceNV */
- 0, /* glVertexAttrib4bvARB */
- 0, /* glVertexAttrib4ivARB */
- 0, /* glVertexAttrib4ubvARB */
- 0, /* glVertexAttrib4usvARB */
- 0, /* glVertexAttrib4uivARB */
- 0, /* glVertexAttrib4NbvARB */
- 0, /* glVertexAttrib4NsvARB */
- 0, /* glVertexAttrib4NivARB */
- 0, /* glVertexAttrib4NusvARB */
- 0, /* glVertexAttrib4NuivARB */
- 0, /* glVertexAttribPointerARB */
- 0, /* glEnableVertexAttribArrayARB */
- 0, /* glDisableVertexAttribArrayARB */
- 0, /* glProgramStringARB */
- 0, /* glProgramEnvParameter4dARB */
- 0, /* glProgramEnvParameter4dvARB */
- 0, /* glProgramEnvParameter4fARB */
- 0, /* glProgramEnvParameter4fvARB */
- 0, /* glProgramLocalParameter4dARB */
- 0, /* glProgramLocalParameter4dvARB */
- 0, /* glProgramLocalParameter4fARB */
- 0, /* glProgramLocalParameter4fvARB */
- 0, /* glGetProgramEnvParameterdvARB */
- 0, /* glGetProgramEnvParameterfvARB */
- 0, /* glGetProgramLocalParameterdvARB */
- 0, /* glGetProgramLocalParameterfvARB */
- 0, /* glGetProgramivARB */
- 0, /* glGetProgramStringARB */
- 0, /* glProgramNamedParameter4fNV */
- 0, /* glProgramNamedParameter4dNV */
- 0, /* glProgramNamedParameter4fvNV */
- 0, /* glProgramNamedParameter4dvNV */
- 0, /* glGetProgramNamedParameterfvNV */
- 0, /* glGetProgramNamedParameterdvNV */
- 0, /* glBindBufferARB */
- 0, /* glBufferDataARB */
- 0, /* glBufferSubDataARB */
- 0, /* glDeleteBuffersARB */
- 0, /* glGenBuffersARB */
- 0, /* glGetBufferParameterivARB */
- 0, /* glGetBufferPointervARB */
- 0, /* glGetBufferSubDataARB */
- 0, /* glIsBufferARB */
- 0, /* glMapBufferARB */
- 0, /* glUnmapBufferARB */
- 0, /* glDepthBoundsEXT */
- 0, /* glGenQueriesARB */
- 0, /* glDeleteQueriesARB */
- 0, /* glIsQueryARB */
- 0, /* glBeginQueryARB */
- 0, /* glEndQueryARB */
- 0, /* glGetQueryivARB */
- 0, /* glGetQueryObjectivARB */
- 0, /* glGetQueryObjectuivARB */
- 0, /* glMultiModeDrawArraysIBM */
- 0, /* glMultiModeDrawElementsIBM */
- 0, /* glBlendEquationSeparateEXT */
- 0, /* glDeleteObjectARB */
- 0, /* glGetHandleARB */
- 0, /* glDetachObjectARB */
- 0, /* glCreateShaderObjectARB */
- 0, /* glShaderSourceARB */
- 0, /* glCompileShaderARB */
- 0, /* glCreateProgramObjectARB */
- 0, /* glAttachObjectARB */
- 0, /* glLinkProgramARB */
- 0, /* glUseProgramObjectARB */
- 0, /* glValidateProgramARB */
- 0, /* glUniform1fARB */
- 0, /* glUniform2fARB */
- 0, /* glUniform3fARB */
- 0, /* glUniform4fARB */
- 0, /* glUniform1iARB */
- 0, /* glUniform2iARB */
- 0, /* glUniform3iARB */
- 0, /* glUniform4iARB */
- 0, /* glUniform1fvARB */
- 0, /* glUniform2fvARB */
- 0, /* glUniform3fvARB */
- 0, /* glUniform4fvARB */
- 0, /* glUniform1ivARB */
- 0, /* glUniform2ivARB */
- 0, /* glUniform3ivARB */
- 0, /* glUniform4ivARB */
- 0, /* glUniformMatrix2fvARB */
- 0, /* glUniformMatrix3fvARB */
- 0, /* glUniformMatrix4fvARB */
- 0, /* glGetObjectParameterfvARB */
- 0, /* glGetObjectParameterivARB */
- 0, /* glGetInfoLogARB */
- 0, /* glGetAttachedObjectsARB */
- 0, /* glGetUniformLocationARB */
- 0, /* glGetActiveUniformARB */
- 0, /* glGetUniformfvARB */
- 0, /* glGetUniformivARB */
- 0, /* glGetShaderSourceARB */
- 0, /* glBindAttribLocationARB */
- 0, /* glGetActiveAttribARB */
- 0, /* glGetAttribLocationARB */
- 0, /* glGetVertexAttribdvNV */
- 0, /* glGetVertexAttribfvNV */
- 0, /* glGetVertexAttribivNV */
- 0, /* glVertexAttrib1dNV */
- 0, /* glVertexAttrib1dvNV */
- 0, /* glVertexAttrib1fNV */
- 0, /* glVertexAttrib1fvNV */
- 0, /* glVertexAttrib1sNV */
- 0, /* glVertexAttrib1svNV */
- 0, /* glVertexAttrib2dNV */
- 0, /* glVertexAttrib2dvNV */
- 0, /* glVertexAttrib2fNV */
- 0, /* glVertexAttrib2fvNV */
- 0, /* glVertexAttrib2sNV */
- 0, /* glVertexAttrib2svNV */
- 0, /* glVertexAttrib3dNV */
- 0, /* glVertexAttrib3dvNV */
- 0, /* glVertexAttrib3fNV */
- 0, /* glVertexAttrib3fvNV */
- 0, /* glVertexAttrib3sNV */
- 0, /* glVertexAttrib3svNV */
- 0, /* glVertexAttrib4dNV */
- 0, /* glVertexAttrib4dvNV */
- 0, /* glVertexAttrib4fNV */
- 0, /* glVertexAttrib4fvNV */
- 0, /* glVertexAttrib4sNV */
- 0, /* glVertexAttrib4svNV */
- 0, /* glVertexAttrib4ubNV */
- 0, /* glVertexAttrib4ubvNV */
- 0, /* glGenFragmentShadersATI */
- 0, /* glBindFragmentShaderATI */
- 0, /* glDeleteFragmentShaderATI */
- 0, /* glBeginFragmentShaderATI */
- 0, /* glEndFragmentShaderATI */
- 0, /* glPassTexCoordATI */
- 0, /* glSampleMapATI */
- 0, /* glColorFragmentOp1ATI */
- 0, /* glColorFragmentOp2ATI */
- 0, /* glColorFragmentOp3ATI */
- 0, /* glAlphaFragmentOp1ATI */
- 0, /* glAlphaFragmentOp2ATI */
- 0, /* glAlphaFragmentOp3ATI */
- 0, /* glSetFragmentShaderConstantATI */
- logIsRenderbufferEXT,
- logBindRenderbufferEXT,
- logDeleteRenderbuffersEXT,
- logGenRenderbuffersEXT,
- logRenderbufferStorageEXT,
- logGetRenderbufferParameterivEXT,
- logIsFramebufferEXT,
- logBindFramebufferEXT,
- logDeleteFramebuffersEXT,
- logGenFramebuffersEXT,
- logCheckFramebufferStatusEXT,
- logFramebufferTexture1DEXT,
- logFramebufferTexture2DEXT,
- logFramebufferTexture3DEXT,
- logFramebufferRenderbufferEXT,
- logGetFramebufferAttachmentParameterivEXT,
- logGenerateMipmapEXT,
- 0, /* glStencilFuncSeparate */
- 0, /* glStencilOpSeparate */
- 0, /* glStencilMaskSeparate */
- 0, /* glGetQueryObjecti64vEXT */
- 0 /* glGetQueryObjectui64vEXT */
-};
-
-static Bool isCurrent = FALSE;
-
-static void (*flushContextCache) (void);
-static void (*setRenderTables) (struct _glapi_table *table);
-
-static void
-GlxLogFlushContextCache (void)
-{
- if (isCurrent)
- {
- fprintf (logFp, "LOSE CURRENT\n");
- isCurrent = FALSE;
- }
-
- (*flushContextCache) ();
-}
-
-static void
-GlxLogSetRenderTables (struct _glapi_table *table)
-{
- nativeRenderTable = table;
-
- if (table)
- {
- fprintf (logFp, "FORCE CURRENT\n");
- isCurrent = TRUE;
-
- (*setRenderTables) (&__logRenderTable);
- }
- else
- {
- (*setRenderTables) (0);
- }
-}
-
-void
-xglInitGlxLog (void)
-{
- if (logFp)
- return;
-
- if (__xglGLXLogFp)
- {
- logFp = __xglGLXLogFp;
-
- flushContextCache = __xglGLXFunc.flushContextCache;
- setRenderTables = __xglGLXFunc.setRenderTables;
-
- __xglGLXFunc.flushContextCache = GlxLogFlushContextCache;
- __xglGLXFunc.setRenderTables = GlxLogSetRenderTables;
- }
-}
-
-#endif
diff --git a/hw/xgl/xgl.h b/hw/xgl/xgl.h
deleted file mode 100644
index 03dc90c..0000000
--- a/hw/xgl/xgl.h
+++ b/dev/null
@@ -1,1474 +0,0 @@
-/*
- * 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>
- */
-
-#ifndef _XGL_H_
-#define _XGL_H_
-
-#include <xgl-config.h>
-
-#include <X11/X.h>
-#define NEED_EVENTS
-#include <X11/Xproto.h>
-#include <X11/Xos.h>
-#include <glitz.h>
-
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "windowstr.h"
-#include "servermd.h"
-#include "mi.h"
-#include "dix.h"
-#include "damage.h"
-#include "gc.h"
-#include "micmap.h"
-/* I'd like gc.h to provide this */
-typedef struct _GCFuncs *GCFuncsPtr;
-
-#ifdef RENDER
-#include "mipict.h"
-#else
-#ifdef XV
-#undef XV /* Xv implementation require RENDER */
-#endif
-#endif
-
-#ifdef XV
-#define XGL_XV_FORMAT_YUY2 0
-#define XGL_XV_FORMAT_YV12 1
-#define XGL_XV_FORMAT_RGB 2
-#define XGL_XV_FORMAT_NUM 3
-#endif
-
-/* For the modules. We should decide what the actual version numbering should
- * be.
- */
-#define VERSION "0.0.1"
-
-extern WindowPtr *WindowTable;
-
-#define XGL_DEFAULT_PBO_MASK 0
-
-typedef struct _xglSizeConstraint {
- int minWidth;
- int minHeight;
- int aboveWidth;
- int aboveHeight;
-} xglSizeConstraintRec, *xglSizeConstraintPtr;
-
-typedef struct _xglAccelInfo {
- Bool enabled;
- Bool pbuffer;
- xglSizeConstraintRec size;
-} xglAccelInfoRec, *xglAccelInfoPtr;
-
-typedef struct _xglScreenAccelInfo {
- xglAccelInfoRec pixmap;
- xglAccelInfoRec window;
- xglAccelInfoRec glx;
- xglAccelInfoRec xv;
-} xglScreenAccelInfoRec, *xglScreenAccelInfoPtr;
-
-typedef struct _xglScreenInfo {
- glitz_drawable_t *drawable;
- unsigned int depth;
- unsigned int width;
- unsigned int height;
- unsigned int widthMm;
- unsigned int heightMm;
- int geometryDataType;
- int geometryUsage;
- Bool yInverted;
- int pboMask;
- Bool lines;
- xglScreenAccelInfoRec accel;
-} xglScreenInfoRec, *xglScreenInfoPtr;
-
-extern xglScreenInfoRec xglScreenInfo;
-
-typedef struct _xglPixelFormat {
- CARD8 depth, bitsPerRGB;
- glitz_pixel_masks_t masks;
-} xglPixelFormatRec, *xglPixelFormatPtr;
-
-typedef struct _xglVisual {
- struct _xglVisual *next;
- VisualID vid;
- xglPixelFormatPtr pPixel;
- Bool pbuffer;
- struct {
- glitz_drawable_format_t *drawable;
- glitz_format_t *surface;
- } format;
-} xglVisualRec, *xglVisualPtr;
-
-extern xglVisualPtr xglVisuals;
-
-#define xglAreaAvailable 0
-#define xglAreaDivided 1
-#define xglAreaOccupied 2
-
-typedef struct _xglRootArea *xglRootAreaPtr;
-
-typedef struct _xglArea {
- int state;
- int level;
- int x, y;
- int width, height;
- struct _xglArea *pArea[4];
- xglRootAreaPtr pRoot;
- pointer closure;
- DevUnion devPrivate;
-} xglAreaRec, *xglAreaPtr;
-
-typedef struct _xglAreaFuncs {
- Bool (*Create) (xglAreaPtr pArea);
-
- Bool (*MoveIn) (xglAreaPtr pArea,
- pointer closure);
-
- void (*MoveOut) (xglAreaPtr pArea,
- pointer closure);
-
- int (*CompareScore) (xglAreaPtr pArea,
- pointer closure1,
- pointer closure2);
-
-} xglAreaFuncsRec, *xglAreaFuncsPtr;
-
-typedef struct _xglRootArea {
- int maxLevel;
- int width, height;
- xglAreaPtr pArea;
- xglAreaFuncsPtr funcs;
- int devPrivateSize;
- pointer closure;
-} xglRootAreaRec;
-
-typedef struct xglGeometry {
- glitz_buffer_t *buffer;
- pointer *data;
- Bool broken;
- glitz_fixed16_16_t xOff, yOff;
- int dataType;
- int usage;
- int size, endOffset;
- glitz_geometry_type_t type;
- glitz_geometry_format_t f;
- int first, width, count;
- glitz_multi_array_t *array;
-} xglGeometryRec, *xglGeometryPtr;
-
-#ifdef RENDER
-typedef struct _xglFBox {
- glitz_float_t x1, y1, x2, y2;
-} xglFBoxRec;
-
-typedef union _xglBox {
- BoxRec sBox;
- xglFBoxRec fBox;
-} xglBoxRec, *xglBoxPtr;
-
-typedef struct _xglRange {
- int first;
- unsigned int count;
-} xglRangeRec, *xglRangePtr;
-
-typedef struct _xglGlyphTexture {
- PicturePtr pMask;
- glitz_pixel_format_t pixel;
- glitz_geometry_format_t format;
- int geometryDataType;
-} xglGlyphTextureRec, *xglGlyphTexturePtr;
-
-typedef struct _xglGlyphArea {
- unsigned long serial;
- union {
- xglBoxRec box;
- xglRangeRec range;
- } u;
-} xglGlyphAreaRec, *xglGlyphAreaPtr;
-
-typedef struct _xglGlyphCache {
- ScreenPtr pScreen;
- int depth;
- xglRootAreaRec rootArea;
- union {
- xglGlyphTextureRec texture;
- xglGeometryRec geometry;
- } u;
-} xglGlyphCacheRec, *xglGlyphCachePtr;
-
-typedef struct _xglGlyph {
- xglAreaPtr pArea;
-} xglGlyphRec, *xglGlyphPtr;
-
-extern DevPrivateKey xglGlyphPrivateKey;
-
-#define XGL_GET_GLYPH_PRIV(pScreen, pGlyph) ((xglGlyphPtr) \
- dixLookupPrivate(GetGlyphPrivatesForScreen (pGlyph, pScreen), \
- xglGlyphPrivateKey))
-
-#define XGL_GLYPH_PRIV(pScreen, pGlyph) \
- xglGlyphPtr pGlyphPriv = XGL_GET_GLYPH_PRIV (pScreen, pGlyph)
-
-#endif
-
-typedef struct _xglScreen {
- xglVisualPtr pVisual;
-
-#ifdef GLXEXT
- xglVisualPtr pGlxVisual;
-#endif
-
-#ifdef XV
- xglVisualRec pXvVisual[XGL_XV_FORMAT_NUM];
-#endif
-
- xglVisualPtr rootVisual;
- glitz_drawable_t *drawable;
- glitz_surface_t *surface;
- PixmapPtr pScreenPixmap;
- unsigned long features;
- int geometryUsage;
- int geometryDataType;
- Bool yInverted;
- int pboMask;
- Bool lines;
- xglGeometryRec scratchGeometry;
- xglScreenAccelInfoRec accel;
-
-#ifdef RENDER
- xglGlyphCacheRec glyphCache[33];
- PicturePtr pSolidAlpha;
- struct _trapInfo {
- PicturePtr pMask;
- glitz_geometry_format_t format;
- } trapInfo;
-#endif
-
- GetImageProcPtr GetImage;
- GetSpansProcPtr GetSpans;
- CreateWindowProcPtr CreateWindow;
- DestroyWindowProcPtr DestroyWindow;
- ChangeWindowAttributesProcPtr ChangeWindowAttributes;
- CopyWindowProcPtr CopyWindow;
- CreateGCProcPtr CreateGC;
- CloseScreenProcPtr CloseScreen;
- SetWindowPixmapProcPtr SetWindowPixmap;
- BitmapToRegionProcPtr BitmapToRegion;
-
-#ifdef RENDER
- CompositeProcPtr Composite;
- GlyphsProcPtr Glyphs;
- TrapezoidsProcPtr Trapezoids;
- AddTrapsProcPtr AddTraps;
- AddTrianglesProcPtr AddTriangles;
- ChangePictureProcPtr ChangePicture;
- ChangePictureTransformProcPtr ChangePictureTransform;
- ChangePictureFilterProcPtr ChangePictureFilter;
-
- RealizeGlyphProcPtr RealizeGlyph;
- UnrealizeGlyphProcPtr UnrealizeGlyph;
-#endif
-} xglScreenRec, *xglScreenPtr;
-
-extern DevPrivateKey xglScreenPrivateKey;
-
-#define XGL_GET_SCREEN_PRIV(pScreen) ((xglScreenPtr) \
- dixLookupPrivate(&(pScreen)->devPrivates, xglScreenPrivateKey))
-
-#define XGL_SET_SCREEN_PRIV(pScreen, v) \
- dixSetPrivate(&(pScreen)->devPrivates, xglScreenPrivateKey, v)
-
-#define XGL_SCREEN_PRIV(pScreen) \
- xglScreenPtr pScreenPriv = XGL_GET_SCREEN_PRIV (pScreen)
-
-#define XGL_SCREEN_WRAP(field, wrapper) \
- pScreenPriv->field = pScreen->field; \
- pScreen->field = wrapper
-
-#define XGL_SCREEN_UNWRAP(field) \
- pScreen->field = pScreenPriv->field
-
-#ifdef RENDER
-#define XGL_PICTURE_SCREEN_WRAP(field, wrapper) \
- pScreenPriv->field = pPictureScreen->field; \
- pPictureScreen->field = wrapper
-
-#define XGL_PICTURE_SCREEN_UNWRAP(field) \
- pPictureScreen->field = pScreenPriv->field
-#endif
-
-#define xglGCSoftwareDrawableFlag (1L << 0)
-#define xglGCBadFunctionFlag (1L << 1)
-#define xglGCPlaneMaskFlag (1L << 2)
-
-typedef struct _xglGC {
- glitz_surface_t *fg;
- glitz_surface_t *bg;
- glitz_format_id_t id;
- glitz_operator_t op;
- unsigned long flags;
- GCFuncsPtr funcs;
- GCOpsPtr ops;
-} xglGCRec, *xglGCPtr;
-
-extern DevPrivateKey xglGCPrivateKey;
-
-#define XGL_GET_GC_PRIV(pGC) ((xglGCPtr) \
- dixLookupPrivate(&(pGC)->devPrivates, xglGCPrivateKey))
-
-#define XGL_GC_PRIV(pGC) \
- xglGCPtr pGCPriv = XGL_GET_GC_PRIV (pGC)
-
-#define XGL_GC_WRAP(field, wrapper) \
- pGCPriv->field = pGC->field; \
- pGC->field = wrapper
-
-#define XGL_GC_UNWRAP(field) \
- pGC->field = pGCPriv->field
-
-
-#define xglPCFillMask (1L << 0)
-#define xglPCFilterMask (1L << 1)
-#define xglPCTransformMask (1L << 2)
-#define xglPCComponentAlphaMask (1L << 3)
-#define xglPCDitherMask (1L << 4)
-
-#define xglPFFilterMask (1L << 8)
-
-#define xglPixmapTargetNo 0
-#define xglPixmapTargetOut 1
-#define xglPixmapTargetIn 2
-
-#ifdef XV
-
-typedef struct _xglXvPort {
- PixmapPtr pPixmap;
- PicturePtr pSrc;
- PicturePtr pDst;
-} xglXvPortRec, *xglXvPortPtr;
-
-#endif
-
-typedef struct _xglPixmap {
- xglVisualPtr pVisual;
- glitz_surface_t *surface;
- glitz_drawable_t *drawable;
- glitz_buffer_t *buffer;
- int target;
- Bool acceleratedTile;
- pointer bits;
- int stride;
- DamagePtr pDamage;
- BoxRec damageBox;
- RegionRec bitRegion;
- Bool allBits;
- unsigned long pictureMask;
- xglGeometryPtr pGeometry;
-
-#ifdef XV
- xglXvPortPtr pPortPriv;
-#endif
-
-} xglPixmapRec, *xglPixmapPtr;
-
-extern DevPrivateKey xglPixmapPrivateKey;
-
-#define XGL_GET_PIXMAP_PRIV(pPixmap) ((xglPixmapPtr) \
- dixLookupPrivate(&(pPixmap)->devPrivates, xglPixmapPrivateKey))
-
-#define XGL_PIXMAP_PRIV(pPixmap) \
- xglPixmapPtr pPixmapPriv = XGL_GET_PIXMAP_PRIV (pPixmap)
-
-#define XGL_PICTURE_CHANGES(pictureMask) (pictureMask & 0x0000ffff)
-#define XGL_PICTURE_FAILURES(pictureMask) (pictureMask & 0xffff0000)
-
-typedef struct _xglWin {
- PixmapPtr pPixmap;
-} xglWinRec, *xglWinPtr;
-
-extern DevPrivateKey xglWinPrivateKey;
-
-#define XGL_GET_WINDOW_PRIV(pWin) ((xglWinPtr) \
- dixLookupPrivate(&(pWin)->devPrivates, xglWinPrivateKey))
-
-#define XGL_WINDOW_PRIV(pWin) \
- xglWinPtr pWinPriv = XGL_GET_WINDOW_PRIV (pWin)
-
-#define XGL_GET_WINDOW_PIXMAP(pWin) \
- (XGL_GET_WINDOW_PRIV((WindowPtr) (pWin))->pPixmap)
-
-
-#define XGL_GET_DRAWABLE_PIXMAP(pDrawable) \
- (((pDrawable)->type == DRAWABLE_WINDOW)? \
- XGL_GET_WINDOW_PIXMAP (pDrawable): \
- (PixmapPtr) (pDrawable))
-
-#define XGL_DRAWABLE_PIXMAP(pDrawable) \
- PixmapPtr pPixmap = XGL_GET_DRAWABLE_PIXMAP (pDrawable)
-
-#define XGL_GET_DRAWABLE_PIXMAP_PRIV(pDrawable) \
- XGL_GET_PIXMAP_PRIV (XGL_GET_DRAWABLE_PIXMAP (pDrawable))
-
-#define XGL_DRAWABLE_PIXMAP_PRIV(pDrawable) \
- xglPixmapPtr pPixmapPriv = XGL_GET_DRAWABLE_PIXMAP_PRIV (pDrawable)
-
-#ifdef COMPOSITE
-#define __XGL_OFF_X_WIN(pPix) (-(pPix)->screen_x)
-#define __XGL_OFF_Y_WIN(pPix) (-(pPix)->screen_y)
-#else
-#define __XGL_OFF_X_WIN(pPix) (0)
-#define __XGL_OFF_Y_WIN(pPix) (0)
-#endif
-
-#define XGL_GET_DRAWABLE(pDrawable, pSurface, xOff, yOff) \
- { \
- PixmapPtr _pPix; \
- if ((pDrawable)->type != DRAWABLE_PIXMAP) { \
- _pPix = XGL_GET_WINDOW_PIXMAP (pDrawable); \
- (xOff) = __XGL_OFF_X_WIN (_pPix); \
- (yOff) = __XGL_OFF_Y_WIN (_pPix); \
- } else { \
- _pPix = (PixmapPtr) (pDrawable); \
- (yOff) = (xOff) = 0; \
- } \
- (pSurface) = XGL_GET_PIXMAP_PRIV (_pPix)->surface; \
- }
-
-#define XGL_DEFAULT_DPI 96
-
-#define XGL_SW_FAILURE_STRING "software fall-back failure"
-
-#define MIN(a,b) ((a) < (b) ? (a) : (b))
-#define MAX(a,b) ((a) > (b) ? (a) : (b))
-
-#define POWER_OF_TWO(v) ((v & (v - 1)) == 0)
-
-#define MOD(a,b) ((a) < 0 ? ((b) - ((-(a) - 1) % (b))) - 1 : (a) % (b))
-
-#define FIXED_TO_FLOAT(f) (((glitz_float_t) (f)) / 65536)
-#define FLOAT_TO_FIXED(f) ((int) ((f) * 65536))
-
-#define BOX_NOTEMPTY(pBox) \
- (((pBox)->x2 - (pBox)->x1) > 0 && \
- ((pBox)->y2 - (pBox)->y1) > 0)
-
-
-/* xglinput.c */
-
-int
-xglMouseProc (DeviceIntPtr pDevice,
- int onoff);
-
-int
-xglKeybdProc (DeviceIntPtr pDevice,
- int onoff);
-
-void
-xglBell (int volume,
- DeviceIntPtr pDev,
- pointer ctrl,
- int something);
-
-void
-xglKbdCtrl (DeviceIntPtr pDevice,
- KeybdCtrl *ctrl);
-
-void
-xglInitInput (int argc, char **argv);
-
-
-/* xgloutput.c */
-
-void
-xglSetPixmapFormats (ScreenInfo *pScreenInfo);
-
-void
-xglSetRootClip (ScreenPtr pScreen,
- Bool enable);
-
-
-/* xglcmap.c */
-
-void
-xglSetVisualTypes (int depth,
- int visuals,
- int redSize,
- int greenSize,
- int blueSize);
-
-Bool
-xglHasVisualTypes (xglVisualPtr pVisual,
- int depth);
-
-glitz_format_t *
-xglFindBestSurfaceFormat (ScreenPtr pScreen,
- xglPixelFormatPtr pPixel);
-
-void
-xglInitVisuals (ScreenPtr pScreen);
-
-xglVisualPtr
-xglFindVisualWithDepth (ScreenPtr pScreen,
- int depth);
-
-xglVisualPtr
-xglFindVisualWithId (ScreenPtr pScreen,
- int vid);
-
-void
-xglClearVisualTypes (void);
-
-
-/* xglparse.c */
-
-char *
-xglParseFindNext (char *cur,
- char *delim,
- char *save,
- char *last);
-
-void
-xglParseScreen (char *arg);
-
-void
-xglUseMsg (void);
-
-int
-xglProcessArgument (int argc,
- char **argv,
- int i);
-
-
-/* xglscreen.c */
-
-Bool
-xglScreenInit (ScreenPtr pScreen);
-
-Bool
-xglFinishScreenInit (ScreenPtr pScreen);
-
-Bool
-xglCloseScreen (int index,
- ScreenPtr pScreen);
-
-void
-xglCreateSolidAlphaPicture (ScreenPtr pScreen);
-
-
-/* xglarea.c */
-
-Bool
-xglRootAreaInit (xglRootAreaPtr pRoot,
- int maxLevel,
- int width,
- int height,
- int devPrivateSize,
- xglAreaFuncsPtr funcs,
- pointer closure);
-
-void
-xglRootAreaFini (xglRootAreaPtr pRoot);
-
-void
-xglLeaveArea (xglAreaPtr pArea);
-
-void
-xglWithdrawArea (xglAreaPtr pArea);
-
-Bool
-xglFindArea (xglAreaPtr pArea,
- int width,
- int height,
- Bool kickOut,
- pointer closure);
-
-
-/* xglgeometry.c */
-
-#define GEOMETRY_DATA_TYPE_SHORT 0
-#define GEOMETRY_DATA_TYPE_FLOAT 1
-
-typedef struct _xglDataTypeInfo {
- glitz_data_type_t type;
- int size;
-} xglDataTypeInfoRec, *xglDataTypeInfoPtr;
-
-extern xglDataTypeInfoRec xglGeometryDataTypes[2];
-
-#define DEFAULT_GEOMETRY_DATA_TYPE GEOMETRY_DATA_TYPE_FLOAT
-
-#define GEOMETRY_USAGE_STREAM 0
-#define GEOMETRY_USAGE_STATIC 1
-#define GEOMETRY_USAGE_DYNAMIC 2
-#define GEOMETRY_USAGE_SYSMEM 3
-
-#define DEFAULT_GEOMETRY_USAGE GEOMETRY_USAGE_SYSMEM
-
-#define GEOMETRY_INIT(pScreen, pGeometry, _type, _usage, _size) \
- { \
- (pGeometry)->type = _type; \
- (pGeometry)->usage = _usage; \
- (pGeometry)->dataType = DEFAULT_GEOMETRY_DATA_TYPE; \
- (pGeometry)->usage = _usage; \
- (pGeometry)->size = 0; \
- (pGeometry)->endOffset = 0; \
- (pGeometry)->data = (pointer) 0; \
- (pGeometry)->buffer = NULL; \
- (pGeometry)->broken = FALSE; \
- (pGeometry)->xOff = 0; \
- (pGeometry)->yOff = 0; \
- (pGeometry)->array = NULL; \
- (pGeometry)->first = 0; \
- (pGeometry)->count = 0; \
- if (_type == GLITZ_GEOMETRY_TYPE_VERTEX) \
- { \
- (pGeometry)->width = 2; \
- (pGeometry)->f.vertex.type = \
- xglGeometryDataTypes[(pGeometry)->dataType].type; \
- (pGeometry)->f.vertex.bytes_per_vertex = (pGeometry)->width * \
- xglGeometryDataTypes[(pGeometry)->dataType].size; \
- (pGeometry)->f.vertex.primitive = GLITZ_PRIMITIVE_QUADS; \
- (pGeometry)->f.vertex.attributes = 0; \
- (pGeometry)->f.vertex.src.type = GLITZ_DATA_TYPE_FLOAT; \
- (pGeometry)->f.vertex.src.size = GLITZ_COORDINATE_SIZE_X; \
- (pGeometry)->f.vertex.src.offset = 0; \
- (pGeometry)->f.vertex.mask.type = GLITZ_DATA_TYPE_FLOAT; \
- (pGeometry)->f.vertex.mask.size = GLITZ_COORDINATE_SIZE_X; \
- (pGeometry)->f.vertex.mask.offset = 0; \
- } \
- else \
- { \
- (pGeometry)->width = 0; \
- (pGeometry)->f.bitmap.scanline_order = \
- GLITZ_PIXEL_SCANLINE_ORDER_TOP_DOWN; \
- (pGeometry)->f.bitmap.bytes_per_line = 0; \
- (pGeometry)->f.bitmap.pad = GLYPHPADBYTES; \
- } \
- if (_size) \
- xglGeometryResize (pScreen, pGeometry, _size); \
- }
-
-#define GEOMETRY_UNINIT(pGeometry) \
- { \
- if ((pGeometry)->array) \
- glitz_multi_array_destroy ((pGeometry)->array); \
- if ((pGeometry)->buffer) \
- glitz_buffer_destroy ((pGeometry)->buffer); \
- if ((pGeometry)->data) \
- xfree ((pGeometry)->data); \
- }
-
-#define GEOMETRY_SET_BUFFER(pGeometry, _buffer) \
- { \
- glitz_buffer_reference (_buffer); \
- if ((pGeometry)->buffer) \
- glitz_buffer_destroy ((pGeometry)->buffer); \
- (pGeometry)->buffer = _buffer; \
- }
-
-#define GEOMETRY_SET_MULTI_ARRAY(pGeometry, _array) \
- { \
- glitz_multi_array_reference (_array); \
- if ((pGeometry)->array) \
- glitz_multi_array_destroy ((pGeometry)->array); \
- (pGeometry)->array = _array; \
- }
-
-#define GEOMETRY_RESIZE(pScreen, pGeometry, size) \
- xglGeometryResize (pScreen, pGeometry, size)
-
-#define GEOMETRY_SET_TRANSLATE(pGeometry, _x, _y) \
- { \
- (pGeometry)->xOff = (_x) << 16; \
- (pGeometry)->yOff = (_y) << 16; \
- }
-
-#define GEOMETRY_TRANSLATE(pGeometry, tx, ty) \
- { \
- (pGeometry)->xOff += (tx) << 16; \
- (pGeometry)->yOff += (ty) << 16; \
- }
-
-#define GEOMETRY_TRANSLATE_FIXED(pGeometry, ftx, fty) \
- { \
- (pGeometry)->xOff += (ftx); \
- (pGeometry)->yOff += (fty); \
- }
-
-#define GEOMETRY_SET_VERTEX_PRIMITIVE(pGeometry, _primitive) \
- (pGeometry)->f.vertex.primitive = _primitive
-
-#define GEOMETRY_SET_VERTEX_DATA_TYPE(pGeometry, _type) \
- { \
- (pGeometry)->dataType = _type; \
- (pGeometry)->f.vertex.type = xglGeometryDataTypes[_type].type; \
- (pGeometry)->f.vertex.bytes_per_vertex = (pGeometry)->width * \
- xglGeometryDataTypes[_type].size; \
- }
-
-#define GEOMETRY_ADD_BOX(pScreen, pGeometry, pBox, nBox) \
- xglGeometryAddBox (pScreen, pGeometry, pBox, nBox, \
- (pGeometry)->endOffset)
-
-#define GEOMETRY_ADD_REGION_AT(pScreen, pGeometry, pRegion, offset) \
- xglGeometryAddBox (pScreen, pGeometry, \
- REGION_RECTS (pRegion), \
- REGION_NUM_RECTS (pRegion), \
- offset)
-
-#define GEOMETRY_ADD_REGION(pScreen, pGeometry, pRegion) \
- xglGeometryAddBox (pScreen, pGeometry, \
- REGION_RECTS (pRegion), \
- REGION_NUM_RECTS (pRegion), \
- (pGeometry)->endOffset)
-
-#define GEOMETRY_ADD_SPAN(pScreen, pGeometry, ppt, pwidth, n) \
- xglGeometryAddSpan (pScreen, pGeometry, ppt, pwidth, n, \
- (pGeometry)->endOffset)
-
-#define GEOMETRY_ADD_LINE(pScreen, pGeometry, loop, mode, npt, ppt) \
- xglGeometryAddLine (pScreen, pGeometry, loop, mode, npt, ppt, \
- (pGeometry)->endOffset)
-
-#define GEOMETRY_ADD_SEGMENT(pScreen, pGeometry, nsegInit, pSegInit) \
- xglGeometryAddSegment (pScreen, pGeometry, nsegInit, pSegInit, \
- (pGeometry)->endOffset)
-
-#define GEOMETRY_FOR_GLYPH(pScreen, pGeometry, nGlyph, ppciInit, pglyphBase) \
- xglGeometryForGlyph (pScreen, pGeometry, nGlyph, ppciInit, pglyphBase);
-
-#define GEOMETRY_ADD_TRAPEZOID(pScreen, pGeometry, pTrap, nTrap) \
- xglGeometryAddTrapezoid (pScreen, pGeometry, pTrap, nTrap, \
- (pGeometry)->endOffset)
-
-#define GEOMETRY_ADD_TRAP(pScreen, pGeometry, pTrap, nTrap) \
- xglGeometryAddTrap (pScreen, pGeometry, pTrap, nTrap, \
- (pGeometry)->endOffset)
-
-#define GEOMETRY_GET_FORMAT(pGeometry, format) \
- xglGeometryGetFormat (pGeometry, format)
-
-#define GEOMETRY_ENABLE(pGeometry, surface) \
- xglSetGeometry (pGeometry, surface)
-
-#define GEOMETRY_DISABLE(surface) \
- glitz_set_geometry (surface, GLITZ_GEOMETRY_TYPE_NONE, NULL, NULL)
-
-void
-xglGeometryResize (ScreenPtr pScreen,
- xglGeometryPtr pGeometry,
- int size);
-
-void
-xglGeometryAddBox (ScreenPtr pScreen,
- xglGeometryPtr pGeometry,
- BoxPtr pBox,
- int nBox,
- int offset);
-
-void
-xglGeometryAddSpan (ScreenPtr pScreen,
- xglGeometryPtr pGeometry,
- DDXPointPtr ppt,
- int *pwidth,
- int n,
- int offset);
-
-void
-xglGeometryAddLine (ScreenPtr pScreen,
- xglGeometryPtr pGeometry,
- int loop,
- int mode,
- int npt,
- DDXPointPtr ppt,
- int offset);
-
-void
-xglGeometryAddSegment (ScreenPtr pScreen,
- xglGeometryPtr pGeometry,
- int nsegInit,
- xSegment *pSegInit,
- int offset);
-
-void
-xglGeometryForGlyph (ScreenPtr pScreen,
- xglGeometryPtr pGeometry,
- unsigned int nGlyph,
- CharInfoPtr *ppciInit,
- pointer pglyphBase);
-
-void
-xglGeometryAddTrapezoid (ScreenPtr pScreen,
- xglGeometryPtr pGeometry,
- xTrapezoid *pTrap,
- int nTrap,
- int offset);
-
-void
-xglGeometryAddTrap (ScreenPtr pScreen,
- xglGeometryPtr pGeometry,
- xTrap *pTrap,
- int nTrap,
- int offset);
-
-xglGeometryPtr
-xglGetScratchGeometryWithSize (ScreenPtr pScreen,
- int size);
-
-xglGeometryPtr
-xglGetScratchVertexGeometryWithType (ScreenPtr pScreen,
- int type,
- int count);
-
-xglGeometryPtr
-xglGetScratchVertexGeometry (ScreenPtr pScreen,
- int count);
-
-Bool
-xglSetGeometry (xglGeometryPtr pGeometry,
- glitz_surface_t *surface);
-
-
-/* xglpixmap.c */
-
-#define XGL_PIXMAP_USAGE_HINT_STREAM_DRAW 1
-#define XGL_PIXMAP_USAGE_HINT_STREAM_READ 2
-#define XGL_PIXMAP_USAGE_HINT_STREAM_COPY 3
-#define XGL_PIXMAP_USAGE_HINT_STATIC_DRAW 4
-#define XGL_PIXMAP_USAGE_HINT_STATIC_READ 5
-#define XGL_PIXMAP_USAGE_HINT_STATIC_COPY 6
-#define XGL_PIXMAP_USAGE_HINT_DYNAMIC_DRAW 7
-#define XGL_PIXMAP_USAGE_HINT_DYNAMIC_READ 8
-#define XGL_PIXMAP_USAGE_HINT_DYNAMIC_COPY 9
-
-#define XGL_PIXMAP_USAGE_HINT_DEFAULT XGL_PIXMAP_USAGE_HINT_STREAM_DRAW
-
-PixmapPtr
-xglCreatePixmap (ScreenPtr pScreen,
- int width,
- int height,
- int depth,
- unsigned usage_hint);
-
-void
-xglFiniPixmap (PixmapPtr pPixmap);
-
-Bool
-xglDestroyPixmap (PixmapPtr pPixmap);
-
-Bool
-xglModifyPixmapHeader (PixmapPtr pPixmap,
- int width,
- int height,
- int depth,
- int bitsPerPixel,
- int devKind,
- pointer pPixData);
-
-void
-xglSetPixmapVisual (PixmapPtr pPixmap,
- xglVisualPtr pVisual);
-
-RegionPtr
-xglPixmapToRegion (PixmapPtr pPixmap);
-
-xglGeometryPtr
-xglPixmapToGeometry (PixmapPtr pPixmap,
- int xOff,
- int yOff);
-
-Bool
-xglCreatePixmapSurface (PixmapPtr pPixmap);
-
-Bool
-xglAllocatePixmapBits (PixmapPtr pPixmap, int hint);
-
-Bool
-xglMapPixmapBits (PixmapPtr pPixmap);
-
-Bool
-xglUnmapPixmapBits (PixmapPtr pPixmap);
-
-Bool
-xglCheckPixmapSize (PixmapPtr pPixmap,
- xglSizeConstraintPtr pSize);
-
-void
-xglEnablePixmapAccel (PixmapPtr pPixmap,
- xglAccelInfoPtr pAccel);
-
-
-/* xglsync.c */
-
-Bool
-xglSyncBits (DrawablePtr pDrawable,
- BoxPtr pExtents);
-
-void
-xglSyncDamageBoxBits (DrawablePtr pDrawable);
-
-Bool
-xglSyncSurface (DrawablePtr pDrawable);
-
-Bool
-xglPrepareTarget (DrawablePtr pDrawable);
-
-void
-xglAddSurfaceDamage (DrawablePtr pDrawable,
- RegionPtr pRegion);
-
-void
-xglAddCurrentSurfaceDamage (DrawablePtr pDrawable);
-
-void
-xglAddBitDamage (DrawablePtr pDrawable,
- RegionPtr pRegion);
-
-void
-xglAddCurrentBitDamage (DrawablePtr pDrawable);
-
-
-/* xglsolid.c */
-
-Bool
-xglSolid (DrawablePtr pDrawable,
- glitz_operator_t op,
- glitz_surface_t *solid,
- xglGeometryPtr pGeometry,
- int x,
- int y,
- int width,
- int height,
- BoxPtr pBox,
- int nBox);
-
-Bool
-xglSolidGlyph (DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- unsigned int nGlyph,
- CharInfoPtr *ppci,
- pointer pglyphBase);
-
-
-/* xgltile.c */
-
-xglGeometryPtr
-xglTiledBoxGeometry (PixmapPtr pTile,
- int tileX,
- int tileY,
- BoxPtr pBox,
- int nBox);
-
-Bool
-xglTile (DrawablePtr pDrawable,
- glitz_operator_t op,
- PixmapPtr pTile,
- int tileX,
- int tileY,
- xglGeometryPtr pGeometry,
- int x,
- int y,
- int width,
- int height,
- BoxPtr pBox,
- int nBox);
-
-
-/* xglcopy.c */
-
-Bool
-xglCopy (DrawablePtr pSrc,
- DrawablePtr pDst,
- int dx,
- int dy,
- BoxPtr pBox,
- int nBox);
-
-void
-xglCopyProc (DrawablePtr pSrc,
- DrawablePtr pDst,
- GCPtr pGC,
- BoxPtr pBox,
- int nBox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown,
- Pixel bitplane,
- void *closure);
-
-
-/* xglfill.c */
-
-Bool
-xglFill (DrawablePtr pDrawable,
- GCPtr pGC,
- xglGeometryPtr pGeometry,
- int x,
- int y,
- int width,
- int height,
- BoxPtr pBox,
- int nBox);
-
-void
-xglFillSpan (DrawablePtr pDrawable,
- GCPtr pGC,
- int n,
- DDXPointPtr ppt,
- int *pwidth);
-
-void
-xglFillRect (DrawablePtr pDrawable,
- GCPtr pGC,
- int nrect,
- xRectangle *prect);
-
-Bool
-xglFillLine (DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr ppt);
-
-Bool
-xglFillSegment (DrawablePtr pDrawable,
- GCPtr pGC,
- int nsegInit,
- xSegment *pSegInit);
-
-Bool
-xglFillGlyph (DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- unsigned int nglyph,
- CharInfoPtr *ppciInit,
- pointer pglyphBase);
-
-
-/* xglwindow.c */
-
-Bool
-xglCreateWindow (WindowPtr pWin);
-
-Bool
-xglDestroyWindow (WindowPtr pWin);
-
-Bool
-xglChangeWindowAttributes (WindowPtr pWin,
- unsigned long mask);
-
-void
-xglCopyWindow (WindowPtr pWin,
- DDXPointRec ptOldOrg,
- RegionPtr prgnSrc);
-
-PixmapPtr
-xglGetWindowPixmap (WindowPtr pWin);
-
-void
-xglSetWindowPixmap (WindowPtr pWin,
- PixmapPtr pPixmap);
-
-
-/* xglget.c */
-
-void
-xglGetImage (DrawablePtr pDrawable,
- int x,
- int y,
- int w,
- int h,
- unsigned int format,
- unsigned long planeMask,
- char *d);
-
-void
-xglGetSpans (DrawablePtr pDrawable,
- int wMax,
- DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- char *pchardstStart);
-
-
-/* xglgc.c */
-
-Bool
-xglCreateGC (GCPtr pGC);
-
-void
-xglDestroyGC (GCPtr pGC);
-
-void
-xglValidateGC (GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDrawable);
-
-void
-xglFillSpans (DrawablePtr pDrawable,
- GCPtr pGC,
- int nspans,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted);
-
-void
-xglSetSpans (DrawablePtr pDrawable,
- GCPtr pGC,
- char *psrc,
- DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- int fSorted);
-
-void
-xglPutImage (DrawablePtr pDrawable,
- GCPtr pGC,
- int depth,
- int x,
- int y,
- int w,
- int h,
- int leftPad,
- int format,
- char *bits);
-
-RegionPtr
-xglCopyArea (DrawablePtr pSrc,
- DrawablePtr pDst,
- GCPtr pGC,
- int srcX,
- int srcY,
- int w,
- int h,
- int dstX,
- int dstY);
-
-RegionPtr
-xglCopyPlane (DrawablePtr pSrc,
- DrawablePtr pDst,
- GCPtr pGC,
- int srcX,
- int srcY,
- int w,
- int h,
- int dstX,
- int dstY,
- unsigned long bitPlane);
-
-void
-xglPolyPoint (DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr pptInit);
-
-void
-xglPolylines (DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr ppt);
-
-void
-xglPolySegment (DrawablePtr pDrawable,
- GCPtr pGC,
- int nsegInit,
- xSegment *pSegInit);
-
-void
-xglPolyArc (DrawablePtr pDrawable,
- GCPtr pGC,
- int narcs,
- xArc *pArcs);
-
-void
-xglPolyFillRect (DrawablePtr pDrawable,
- GCPtr pGC,
- int nrect,
- xRectangle *prect);
-
-void
-xglPolyFillArc (DrawablePtr pDrawable,
- GCPtr pGC,
- int narcs,
- xArc *pArcs);
-
-void
-xglImageGlyphBlt (DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase);
-
-void
-xglPolyGlyphBlt (DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase);
-void
-xglPushPixels (GCPtr pGC,
- PixmapPtr pBitmap,
- DrawablePtr pDrawable,
- int w,
- int h,
- int x,
- int y);
-
-
-#ifdef MITSHM
-
-/* xglshm.c */
-
-void
-xglShmPutImage (DrawablePtr pDrawable,
- GCPtr pGC,
- int depth,
- unsigned int format,
- int w,
- int h,
- int sx,
- int sy,
- int sw,
- int sh,
- int dx,
- int dy,
- char *data);
-
-#endif
-
-
-#ifdef RENDER
-
-/* xglpict.c */
-
-void
-xglComposite (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height);
-
-void
-xglAddTriangles (PicturePtr pDst,
- INT16 xOff,
- INT16 yOff,
- int ntri,
- xTriangle *tris);
-
-void
-xglChangePicture (PicturePtr pPicture,
- Mask mask);
-
-int
-xglChangePictureTransform (PicturePtr pPicture,
- PictTransform *transform);
-
-int
-xglChangePictureFilter (PicturePtr pPicture,
- int filter,
- xFixed *params,
- int nparams);
-
-PicturePtr
-xglCreateDevicePicture (pointer data);
-
-Bool
-xglSyncPicture (ScreenPtr pScreen,
- PicturePtr pPicture,
- INT16 x,
- INT16 y,
- CARD16 width,
- CARD16 height,
- INT16 *xOff,
- INT16 *yOff);
-
-Bool
-xglPictureInit (ScreenPtr pScreen);
-
-void
-xglPictureClipExtents (PicturePtr pPicture,
- BoxPtr extents);
-
-
-/* xglcompose.c */
-
-Bool
-xglCompositeGeneral (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- xglGeometryPtr pGeometry,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height);
-
-
-/* xglglyph.c */
-
-Bool
-xglRealizeGlyph (ScreenPtr pScreen,
- GlyphPtr pGlyph);
-
-void
-xglUnrealizeGlyph (ScreenPtr pScreen,
- GlyphPtr pGlyph);
-
-Bool
-xglInitGlyphCache (xglGlyphCachePtr pCache,
- ScreenPtr pScreen,
- PictFormatPtr format);
-
-void
-xglFiniGlyphCache (xglGlyphCachePtr pCache);
-
-void
-xglGlyphs (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int nlist,
- GlyphListPtr list,
- GlyphPtr *glyphs);
-
-
-/* xgltrap.c */
-
-void
-xglTrapezoids (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int nTrap,
- xTrapezoid *traps);
-
-void
-xglAddTraps (PicturePtr pDst,
- INT16 xOff,
- INT16 yOff,
- int nTrap,
- xTrap *traps);
-
-#endif
-
-#ifdef XGL_MODULAR
-
-/* xglloader.c */
-
-typedef struct _xglSymbol {
- void **ptr;
- const char *name;
-} xglSymbolRec, *xglSymbolPtr;
-
-void *
-xglLoadModule (const char *name,
- int flag);
-
-void
-xglUnloadModule (void *handle);
-
-Bool
-xglLookupSymbols (void *handle,
- xglSymbolPtr sym,
- int nSym);
-
-#endif
-
-
-/* xglxv.c */
-
-#ifdef XV
-
-Bool
-xglXvScreenInit (ScreenPtr pScreen);
-
-#endif
-
-
-/* xglhash.c */
-
-typedef struct _xglHashTable *xglHashTablePtr;
-
-Bool
-xglLoadHashFuncs (void *handle);
-
-xglHashTablePtr
-xglNewHashTable (void);
-
-void
-xglDeleteHashTable (xglHashTablePtr pTable);
-
-void *
-xglHashLookup (const xglHashTablePtr pTable,
- unsigned int key);
-
-void
-xglHashInsert (xglHashTablePtr pTable,
- unsigned int key,
- void *data);
-
-void
-xglHashRemove (xglHashTablePtr pTable,
- unsigned int key);
-
-unsigned int
-xglHashFirstEntry (xglHashTablePtr pTable);
-
-unsigned int
-xglHashNextEntry (const xglHashTablePtr pTable,
- unsigned int key);
-
-unsigned int
-xglHashFindFreeKeyBlock (xglHashTablePtr pTable,
- unsigned int numKeys);
-
-#endif /* _XGL_H_ */
diff --git a/hw/xgl/xglarea.c b/hw/xgl/xglarea.c
deleted file mode 100644
index cdf652d..0000000
--- a/hw/xgl/xglarea.c
+++ b/dev/null
@@ -1,323 +0,0 @@
-/*
- * 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"
-
-static Bool
-xglAreaMoveIn (xglAreaPtr pArea,
- pointer closure)
-{
- pArea->closure = closure;
- pArea->state = xglAreaOccupied;
-
- return (*pArea->pRoot->funcs->MoveIn) (pArea, closure);
-}
-
-static void
-xglAreaMoveOut (xglAreaPtr pArea)
-{
- (*pArea->pRoot->funcs->MoveOut) (pArea, pArea->closure);
-
- pArea->closure = (pointer) 0;
- pArea->state = xglAreaAvailable;
-}
-
-static xglAreaPtr
-xglAreaCreate (xglRootAreaPtr pRoot,
- int level,
- int x,
- int y,
- int width,
- int height)
-{
- xglAreaPtr pArea;
- int n = 4;
-
- pArea = xalloc (sizeof (xglAreaRec) + pRoot->devPrivateSize);
- if (!pArea)
- return NULL;
-
- pArea->level = level;
- pArea->x = x;
- pArea->y = y;
- pArea->width = width;
- pArea->height = height;
- pArea->pRoot = pRoot;
- pArea->closure = (pointer) 0;
- pArea->state = xglAreaAvailable;
-
- while (n--)
- pArea->pArea[n] = NULL;
-
- if (pRoot->devPrivateSize)
- pArea->devPrivate.ptr = pArea + 1;
- else
- pArea->devPrivate.ptr = (pointer) 0;
-
- if (!(*pArea->pRoot->funcs->Create) (pArea))
- {
- free (pArea);
- return NULL;
- }
-
- return pArea;
-}
-
-static void
-xglAreaDestroy (xglAreaPtr pArea)
-{
- if (!pArea)
- return;
-
- if (pArea->state == xglAreaOccupied)
- {
- xglAreaMoveOut (pArea);
- }
- else
- {
- int n = 4;
-
- while (n--)
- xglAreaDestroy (pArea->pArea[n]);
- }
-
- xfree (pArea);
-}
-
-static xglAreaPtr
-xglAreaGetTopScoredSubArea (xglAreaPtr pArea)
-{
- if (!pArea)
- return NULL;
-
- switch (pArea->state) {
- case xglAreaOccupied:
- return pArea;
- case xglAreaAvailable:
- break;
- case xglAreaDivided: {
- xglAreaPtr tmp, top = NULL;
- int i;
-
- for (i = 0; i < 4; i++)
- {
- tmp = xglAreaGetTopScoredSubArea (pArea->pArea[i]);
- if (tmp && top)
- {
- if ((*pArea->pRoot->funcs->CompareScore) (tmp,
- tmp->closure,
- top->closure) > 0)
- top = tmp;
- }
- else if (tmp)
- {
- top = tmp;
- }
- }
- return top;
- }
- }
-
- return NULL;
-}
-
-static Bool
-xglAreaFind (xglAreaPtr pArea,
- int width,
- int height,
- Bool kickOut,
- pointer closure)
-{
- if (pArea->width < width || pArea->height < height)
- return FALSE;
-
- switch (pArea->state) {
- case xglAreaOccupied:
- if (kickOut)
- {
- if ((*pArea->pRoot->funcs->CompareScore) (pArea,
- pArea->closure,
- closure) >= 0)
- return FALSE;
-
- xglAreaMoveOut (pArea);
- } else
- return FALSE;
-
- /* fall-through */
- case xglAreaAvailable:
- {
- if (pArea->level == pArea->pRoot->maxLevel ||
- (pArea->width == width && pArea->height == height))
- {
- if (xglAreaMoveIn (pArea, closure))
- return TRUE;
- }
- else
- {
- int dx[4], dy[4], w[4], h[4], i;
-
- dx[0] = dx[2] = dy[0] = dy[1] = 0;
-
- w[0] = w[2] = dx[1] = dx[3] = width;
- h[0] = h[1] = dy[2] = dy[3] = height;
-
- w[1] = w[3] = pArea->width - width;
- h[2] = h[3] = pArea->height - height;
-
- for (i = 0; i < 2; i++)
- {
- if (w[i])
- pArea->pArea[i] =
- xglAreaCreate (pArea->pRoot,
- pArea->level + 1,
- pArea->x + dx[i],
- pArea->y + dy[i],
- w[i], h[i]);
- }
-
- for (; i < 4; i++)
- {
- if (w[i] && h[i])
- pArea->pArea[i] =
- xglAreaCreate (pArea->pRoot,
- pArea->level + 1,
- pArea->x + dx[i],
- pArea->y + dy[i],
- w[i], h[i]);
- }
-
- pArea->state = xglAreaDivided;
-
- if (xglAreaFind (pArea->pArea[0], width, height, kickOut, closure))
- return TRUE;
- }
- } break;
- case xglAreaDivided:
- {
- xglAreaPtr topArea;
- int i, rejected = FALSE;
-
- for (i = 0; i < 4; i++)
- {
- if (pArea->pArea[i])
- {
- if (pArea->pArea[i]->width >= width &&
- pArea->pArea[i]->height >= height)
- {
- if (xglFindArea (pArea->pArea[i], width, height, kickOut,
- closure))
- return TRUE;
-
- rejected = TRUE;
- }
- }
- }
-
- if (rejected)
- return FALSE;
-
- topArea = xglAreaGetTopScoredSubArea (pArea);
- if (topArea)
- {
- if (kickOut)
- {
- if ((*pArea->pRoot->funcs->CompareScore) (topArea,
- topArea->closure,
- closure) >= 0)
- return FALSE;
- } else
- return FALSE;
- }
-
- for (i = 0; i < 4; i++)
- {
- xglAreaDestroy (pArea->pArea[i]);
- pArea->pArea[i] = NULL;
- }
-
- pArea->closure = (pointer) 0;
- pArea->state = xglAreaAvailable;
- if (xglFindArea (pArea, width, height, TRUE, closure))
- return TRUE;
-
- } break;
- }
-
- return FALSE;
-}
-
-Bool
-xglRootAreaInit (xglRootAreaPtr pRoot,
- int maxLevel,
- int width,
- int height,
- int devPrivateSize,
- xglAreaFuncsPtr funcs,
- pointer closure)
-{
- pRoot->maxLevel = maxLevel;
- pRoot->funcs = funcs;
- pRoot->devPrivateSize = devPrivateSize;
- pRoot->closure = closure;
-
- pRoot->pArea = xglAreaCreate (pRoot, 0, 0, 0, width, height);
- if (!pRoot->pArea)
- return FALSE;
-
- return TRUE;
-}
-
-void
-xglRootAreaFini (xglRootAreaPtr pRoot)
-{
- xglAreaDestroy (pRoot->pArea);
-}
-
-void
-xglLeaveArea (xglAreaPtr pArea)
-{
- xglAreaMoveOut (pArea);
-}
-
-void
-xglWithdrawArea (xglAreaPtr pArea)
-{
- pArea->closure = NULL;
- pArea->state = xglAreaAvailable;
-}
-
-Bool
-xglFindArea (xglAreaPtr pArea,
- int width,
- int height,
- Bool kickOut,
- pointer closure)
-{
- if (width < 1 || height < 0)
- return FALSE;
-
- return xglAreaFind (pArea, width, height, kickOut, closure);
-}
diff --git a/hw/xgl/xglcmap.c b/hw/xgl/xglcmap.c
deleted file mode 100644
index b96308d..0000000
--- a/hw/xgl/xglcmap.c
+++ b/dev/null
@@ -1,466 +0,0 @@
-/*
- * 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 "xgl.h"
-#include "colormapst.h"
-#include "micmap.h"
-#include "fb.h"
-
-static xglPixelFormatRec xglPixelFormats[] = {
- {
- 8, 8,
- {
- 8,
- 0x000000ff,
- 0x00000000,
- 0x00000000,
- 0x00000000
- }
- }, {
- 15, 5,
- {
- 16,
- 0x00000000,
- 0x00007c00,
- 0x000003e0,
- 0x0000001f
- }
- }, {
- 16, 6,
- {
- 16,
- 0x00000000,
- 0x0000f800,
- 0x000007e0,
- 0x0000001f
- }
- }, {
- 24, 8,
- {
- 32,
- 0x00000000,
- 0x00ff0000,
- 0x0000ff00,
- 0x000000ff
- }
- }, {
- 32, 8,
- {
- 32,
- 0xff000000,
- 0x00ff0000,
- 0x0000ff00,
- 0x000000ff
- }
- }
-};
-
-#define NUM_XGL_PIXEL_FORMATS \
- (sizeof (xglPixelFormats) / sizeof (xglPixelFormats[0]))
-
-xglVisualPtr xglVisuals = NULL;
-
-void
-xglSetVisualTypes (int depth,
- int visuals,
- int redSize,
- int greenSize,
- int blueSize)
-{
- xglPixelFormatPtr pBestFormat = 0;
- int i, rs, gs, bs, diff, bestDiff = 0;
-
- for (i = 0; i < NUM_XGL_PIXEL_FORMATS; i++)
- {
- if (xglPixelFormats[i].depth == depth)
- {
- if (visuals)
- {
- rs = Ones (xglPixelFormats[i].masks.red_mask);
- gs = Ones (xglPixelFormats[i].masks.green_mask);
- bs = Ones (xglPixelFormats[i].masks.blue_mask);
-
- if (redSize >= rs &&
- greenSize >= gs &&
- blueSize >= bs)
- {
- diff = (redSize - rs) + (greenSize - gs) + (blueSize - bs);
- if (pBestFormat)
- {
- if (diff < bestDiff)
- {
- pBestFormat = &xglPixelFormats[i];
- bestDiff = diff;
- }
- }
- else
- {
- pBestFormat = &xglPixelFormats[i];
- bestDiff = diff;
- }
- }
- }
- else
- {
- pBestFormat = &xglPixelFormats[i];
- break;
- }
- }
- }
-
- if (pBestFormat)
- {
- xglVisualPtr new, *prev, v;
- unsigned int bitsPerRGB;
- Pixel rm, gm, bm;
-
- new = xalloc (sizeof (xglVisualRec));
- if (!new)
- return;
-
- new->next = 0;
-
- new->format.surface = 0;
- new->format.drawable = 0;
- new->pPixel = pBestFormat;
- new->vid = 0;
-
- bitsPerRGB = pBestFormat->bitsPerRGB;
-
- rm = pBestFormat->masks.red_mask;
- gm = pBestFormat->masks.green_mask;
- bm = pBestFormat->masks.blue_mask;
-
- fbSetVisualTypesAndMasks (depth, visuals, bitsPerRGB, rm, gm, bm);
-
- for (prev = &xglVisuals; (v = *prev); prev = &v->next);
- *prev = new;
- }
- else
- {
- fbSetVisualTypesAndMasks (depth, 0, 0, 0, 0, 0);
- }
-}
-
-Bool
-xglHasVisualTypes (xglVisualPtr pVisual,
- int depth)
-{
- xglVisualPtr v;
-
- for (v = pVisual; v; v = v->next)
- if (v->pPixel->depth == depth)
- return TRUE;
-
- return FALSE;
-}
-
-glitz_format_t *
-xglFindBestSurfaceFormat (ScreenPtr pScreen,
- xglPixelFormatPtr pPixel)
-{
- glitz_format_t templ, *format, *best = 0;
- unsigned int mask;
- unsigned short rs, gs, bs, as;
- int i = 0;
-
- XGL_SCREEN_PRIV (pScreen);
-
- rs = Ones (pPixel->masks.red_mask);
- gs = Ones (pPixel->masks.green_mask);
- bs = Ones (pPixel->masks.blue_mask);
- as = Ones (pPixel->masks.alpha_mask);
-
- templ.color.fourcc = GLITZ_FOURCC_RGB;
- mask = GLITZ_FORMAT_FOURCC_MASK;
-
- do {
- format = glitz_find_format (pScreenPriv->drawable, mask, &templ, i++);
- if (format)
- {
- if (format->color.red_size >= rs &&
- format->color.green_size >= gs &&
- format->color.blue_size >= bs &&
- format->color.alpha_size >= as)
- {
- if (best)
- {
- if (((format->color.red_size - rs) +
- (format->color.green_size - gs) +
- (format->color.blue_size - bs)) <
- ((best->color.red_size - rs) +
- (best->color.green_size - gs) +
- (best->color.blue_size - bs)))
- best = format;
- }
- else
- {
- best = format;
- }
- }
- }
- } while (format);
-
- return best;
-}
-
-static Bool
-xglInitVisual (ScreenPtr pScreen,
- xglVisualPtr pVisual,
- xglPixelFormatPtr pPixel,
- VisualID vid)
-{
- glitz_format_t *format;
-
- XGL_SCREEN_PRIV (pScreen);
-
- format = xglFindBestSurfaceFormat (pScreen, pPixel);
- if (format)
- {
- glitz_drawable_format_t templ;
- unsigned long mask;
-
- templ.color = format->color;
- templ.depth_size = 0;
- templ.stencil_size = 0;
- templ.doublebuffer = 0;
- templ.samples = 1;
-
- mask =
- GLITZ_FORMAT_FOURCC_MASK |
- GLITZ_FORMAT_RED_SIZE_MASK |
- GLITZ_FORMAT_GREEN_SIZE_MASK |
- GLITZ_FORMAT_BLUE_SIZE_MASK |
- GLITZ_FORMAT_ALPHA_SIZE_MASK |
- GLITZ_FORMAT_DEPTH_SIZE_MASK |
- GLITZ_FORMAT_STENCIL_SIZE_MASK |
- GLITZ_FORMAT_DOUBLEBUFFER_MASK |
- GLITZ_FORMAT_SAMPLES_MASK;
-
- pVisual->next = 0;
- pVisual->vid = vid;
- pVisual->pPixel = pPixel;
- pVisual->pbuffer = FALSE;
-
- pVisual->format.surface = format;
- pVisual->format.drawable =
- glitz_find_drawable_format (pScreenPriv->drawable,
- mask, &templ, 0);
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-static Bool
-xglInitPbufferVisual (ScreenPtr pScreen,
- xglVisualPtr pVisual,
- xglPixelFormatPtr pPixel,
- VisualID vid)
-{
- glitz_format_t *format;
-
- XGL_SCREEN_PRIV (pScreen);
-
- format = xglFindBestSurfaceFormat (pScreen, pPixel);
- if (format)
- {
- glitz_drawable_format_t templ, *screenFormat;
- unsigned long mask;
-
- /* use same drawable format as screen for pbuffers */
- screenFormat = glitz_drawable_get_format (pScreenPriv->drawable);
- templ.id = screenFormat->id;
-
- templ.color = format->color;
- templ.samples = 1;
-
- mask =
- GLITZ_FORMAT_ID_MASK |
- GLITZ_FORMAT_FOURCC_MASK |
- GLITZ_FORMAT_RED_SIZE_MASK |
- GLITZ_FORMAT_GREEN_SIZE_MASK |
- GLITZ_FORMAT_BLUE_SIZE_MASK |
- GLITZ_FORMAT_SAMPLES_MASK;
-
- pVisual->next = 0;
- pVisual->vid = vid;
- pVisual->pPixel = pPixel;
- pVisual->pbuffer = TRUE;
-
- pVisual->format.surface = format;
- pVisual->format.drawable =
- glitz_find_pbuffer_format (pScreenPriv->drawable,
- mask, &templ, 0);
-
- if (pVisual->format.drawable)
- return TRUE;
- }
-
- return FALSE;
-}
-
-void
-xglInitVisuals (ScreenPtr pScreen)
-{
- xglVisualPtr pVisual, v, new, *prev;
- int i;
-
- XGL_SCREEN_PRIV (pScreen);
-
- for (i = 0; i < pScreen->numVisuals; i++)
- {
- for (pVisual = xglVisuals; pVisual; pVisual = pVisual->next)
- if (pVisual->pPixel->depth == pScreen->visuals[i].nplanes)
- break;
-
- if (pVisual)
- {
- new = xalloc (sizeof (xglVisualRec));
- if (new)
- {
- if (xglInitVisual (pScreen, new, pVisual->pPixel,
- pScreen->visuals[i].vid))
- {
- new->next = 0;
-
- prev = &pScreenPriv->pVisual;
- while ((v = *prev))
- prev = &v->next;
-
- *prev = new;
- }
- else
- {
- xfree (new);
- }
- }
-
- new = xalloc (sizeof (xglVisualRec));
- if (new)
- {
- if (xglInitPbufferVisual (pScreen, new, pVisual->pPixel,
- pScreen->visuals[i].vid))
- {
- new->next = 0;
-
- prev = &pScreenPriv->pVisual;
- while ((v = *prev))
- prev = &v->next;
-
- *prev = new;
- }
- else
- {
- xfree (new);
- }
- }
- }
- }
-
- /* Add additional Xgl visuals for pixmap formats */
- for (i = 0; i < screenInfo.numPixmapFormats; i++)
- {
- if (!xglHasVisualTypes (pScreenPriv->pVisual,
- screenInfo.formats[i].depth))
- {
- for (v = xglVisuals; v; v = v->next)
- if (v->pPixel->depth == screenInfo.formats[i].depth)
- break;
-
- if (v)
- {
- new = xalloc (sizeof (xglVisualRec));
- if (new)
- {
- if (xglInitVisual (pScreen, new, v->pPixel, 0))
- {
- new->next = 0;
-
- prev = &pScreenPriv->pVisual;
- while ((v = *prev))
- prev = &v->next;
-
- *prev = new;
- }
- else
- {
- xfree (new);
- }
- }
- }
- }
- }
-}
-
-xglVisualPtr
-xglFindVisualWithDepth (ScreenPtr pScreen,
- int depth)
-{
- xglVisualPtr v;
-
- XGL_SCREEN_PRIV (pScreen);
-
- for (v = pScreenPriv->pVisual; v; v = v->next)
- {
- if (v->pPixel->depth == depth)
- return v;
- }
-
- return 0;
-}
-
-xglVisualPtr
-xglFindVisualWithId (ScreenPtr pScreen,
- int vid)
-{
- xglVisualPtr v;
-
- XGL_SCREEN_PRIV (pScreen);
-
- for (v = pScreenPriv->pVisual; v; v = v->next)
- {
- if (v->vid == vid)
- return v;
- }
-
- return 0;
-}
-
-void
-xglClearVisualTypes (void)
-{
- xglVisualPtr v;
-
- while (xglVisuals)
- {
- v = xglVisuals;
- xglVisuals = v->next;
- xfree (v);
- }
-
- miClearVisualTypes ();
-}
diff --git a/hw/xgl/xglcompose.c b/hw/xgl/xglcompose.c
deleted file mode 100644
index 34f7a0c..0000000
--- a/hw/xgl/xglcompose.c
+++ b/dev/null
@@ -1,281 +0,0 @@
-/*
- * 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 "xgl.h"
-
-#ifdef RENDER
-
-static glitz_operator_t xglOperators[] = {
- GLITZ_OPERATOR_CLEAR,
- GLITZ_OPERATOR_SRC,
- GLITZ_OPERATOR_DST,
- GLITZ_OPERATOR_OVER,
- GLITZ_OPERATOR_OVER_REVERSE,
- GLITZ_OPERATOR_IN,
- GLITZ_OPERATOR_IN_REVERSE,
- GLITZ_OPERATOR_OUT,
- GLITZ_OPERATOR_OUT_REVERSE,
- GLITZ_OPERATOR_ATOP,
- GLITZ_OPERATOR_ATOP_REVERSE,
- GLITZ_OPERATOR_XOR,
- GLITZ_OPERATOR_ADD
-};
-
-#define NUM_XGL_OPERATORS \
- (sizeof (xglOperators) / sizeof (xglOperators[0]))
-
-#define XGL_OPERATOR(op) (xglOperators[op])
-
-#define XGL_GET_SOURCE_PICTURE(pPicture, outSurface) \
- (outSurface) = ((pPicture)->pDrawable) ? \
- XGL_GET_PIXMAP_PRIV ((PixmapPtr) (pPicture)->pDrawable)->surface : \
- (glitz_surface_t *) (pPicture)->pSourcePict->source.devPrivate.ptr
-
-Bool
-xglCompositeGeneral (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- xglGeometryPtr pGeometry,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
-{
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- INT16 xOff, yOff;
- glitz_surface_t *src, *mask = NULL, *dst;
- int dstXoff, dstYoff;
- RegionRec region;
- BoxPtr pBox, pExt;
- int nBox;
-
- if (pDst->alphaMap)
- return FALSE;
-
- if (op >= NUM_XGL_OPERATORS)
- return FALSE;
-
- if (pSrc->pDrawable)
- {
- if (pSrc->pDrawable->type != DRAWABLE_PIXMAP)
- return FALSE;
-
- if (pSrc->pDrawable->bitsPerPixel == 1)
- return FALSE;
- }
-
- if (pMask)
- {
- if (pMask->pDrawable)
- {
- if (pMask->pDrawable->type != DRAWABLE_PIXMAP)
- return FALSE;
-
- if (pSrc->pDrawable == pMask->pDrawable && pSrc != pMask)
- return FALSE;
- }
- }
-
- if (!xglPrepareTarget (pDst->pDrawable))
- return FALSE;
-
- if (!miComputeCompositeRegion (&region, pSrc, pMask, pDst,
- xSrc, ySrc, xMask, yMask,
- xDst, yDst, width, height))
- return TRUE;
-
- pBox = REGION_RECTS (&region);
- nBox = REGION_NUM_RECTS (&region);
- pExt = REGION_EXTENTS (pScreen, &region);
-
- XGL_GET_DRAWABLE (pDst->pDrawable, dst, dstXoff, dstYoff);
-
- if (!xglSyncPicture (pScreen, pSrc,
- pExt->x1 + xSrc - xDst,
- pExt->y1 + ySrc - yDst,
- pExt->x2 - pExt->x1,
- pExt->y2 - pExt->y1,
- &xOff, &yOff))
- {
- REGION_UNINIT (pScreen, &region);
- return FALSE;
- }
-
- xSrc -= xOff;
- ySrc -= yOff;
-
- XGL_GET_SOURCE_PICTURE (pSrc, src);
-
- if (pMask)
- {
- /* bitmap as mask */
- if (pMask->pDrawable && pMask->pDrawable->bitsPerPixel == 1)
- {
- if (pGeometry)
- {
- REGION_UNINIT (pScreen, &region);
- return FALSE;
- }
-
- pGeometry = xglPixmapToGeometry ((PixmapPtr) pMask->pDrawable,
- xDst - xMask,
- yDst - yMask);
- if (!pGeometry)
- {
- REGION_UNINIT (pScreen, &region);
- return FALSE;
- }
- }
- else
- {
- if (!xglSyncPicture (pScreen, pMask,
- pExt->x1 + xMask - xDst,
- pExt->y1 + yMask - yDst,
- pExt->x2 - pExt->x1,
- pExt->y2 - pExt->y1,
- &xOff, &yOff))
- {
- REGION_UNINIT (pScreen, &region);
- return FALSE;
- }
-
- xMask -= xOff;
- yMask -= yOff;
-
- XGL_GET_SOURCE_PICTURE (pMask, mask);
- }
- }
-
- if (!pGeometry)
- {
- if (!pSrc->transform && pSrc->filter != PictFilterConvolution)
- {
- if (pSrc->pDrawable && pSrc->repeatType == RepeatNormal)
- {
- XGL_PIXMAP_PRIV ((PixmapPtr) pSrc->pDrawable);
-
- /* tile */
- if (!pPixmapPriv->acceleratedTile)
- {
- pGeometry =
- xglTiledBoxGeometry ((PixmapPtr) pSrc->pDrawable,
- xSrc - xDst, ySrc - yDst,
- pBox, nBox);
- if (!pGeometry)
- {
- REGION_UNINIT (pScreen, &region);
- return FALSE;
- }
-
- pBox = pExt;
- nBox = 1;
- }
- }
- else
- {
- /* copy */
- if (op == PictOpSrc && !mask)
- {
- if (xglCopy (pSrc->pDrawable,
- pDst->pDrawable,
- xSrc - xDst,
- ySrc - yDst,
- pBox,
- nBox))
- {
- REGION_UNINIT (pScreen, &region);
- return TRUE;
- }
- }
- }
- }
-
- if (nBox > 1)
- {
- pGeometry = xglGetScratchVertexGeometry (pScreen, 4 * nBox);
-
- GEOMETRY_ADD_BOX (pScreen, pGeometry, pBox, nBox);
-
- pBox = pExt;
- }
-
- xSrc += pBox->x1 - xDst;
- ySrc += pBox->y1 - yDst;
-
- if (pMask)
- {
- xMask += pBox->x1 - xDst;
- yMask += pBox->y1 - yDst;
- }
-
- xDst = pBox->x1;
- yDst = pBox->y1;
-
- width = pBox->x2 - pBox->x1;
- height = pBox->y2 - pBox->y1;
- }
- else
- {
- glitz_surface_set_clip_region (dst,
- dstXoff, dstYoff,
- (glitz_box_t *) pBox, nBox);
- }
-
- if (pGeometry)
- {
- GEOMETRY_TRANSLATE (pGeometry, dstXoff, dstYoff);
-
- if (!GEOMETRY_ENABLE (pGeometry, dst))
- {
- REGION_UNINIT (pScreen, &region);
- return FALSE;
- }
- }
- else
- GEOMETRY_DISABLE (dst);
-
- glitz_composite (XGL_OPERATOR (op),
- src, mask, dst,
- xSrc, ySrc,
- xMask, yMask,
- xDst + dstXoff, yDst + dstYoff,
- width, height);
-
- glitz_surface_set_clip_region (dst, 0, 0, NULL, 0);
-
- REGION_UNINIT (pScreen, &region);
-
- if (glitz_surface_get_status (dst))
- return FALSE;
-
- return TRUE;
-}
-
-#endif
diff --git a/hw/xgl/xglcopy.c b/hw/xgl/xglcopy.c
deleted file mode 100644
index d612b33..0000000
--- a/hw/xgl/xglcopy.c
+++ b/dev/null
@@ -1,130 +0,0 @@
-/*
- * 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 "xgl.h"
-#include "fb.h"
-
-Bool
-xglCopy (DrawablePtr pSrc,
- DrawablePtr pDst,
- int dx,
- int dy,
- BoxPtr pBox,
- int nBox)
-{
- glitz_surface_t *src, *dst;
- int srcXoff, srcYoff;
- int dstXoff, dstYoff;
-
- XGL_DRAWABLE_PIXMAP (pDst);
-
- if (!nBox)
- return TRUE;
-
- if (xglPrepareTarget (pDst))
- {
- if (!xglSyncSurface (pSrc))
- return FALSE;
- }
- else
- {
- if (!xglPrepareTarget (pSrc))
- return FALSE;
-
- if (!xglSyncSurface (pDst))
- return FALSE;
- }
-
- XGL_GET_DRAWABLE (pSrc, src, srcXoff, srcYoff);
- XGL_GET_DRAWABLE (pDst, dst, dstXoff, dstYoff);
-
- glitz_surface_set_clip_region (dst,
- dstXoff, dstYoff,
- (glitz_box_t *) pBox, nBox);
-
- glitz_copy_area (src,
- dst,
- srcXoff + dx,
- srcYoff + dy,
- pPixmap->drawable.width - dstXoff,
- pPixmap->drawable.height - dstYoff,
- dstXoff,
- dstYoff);
-
- glitz_surface_set_clip_region (dst, 0, 0, NULL, 0);
-
- if (glitz_surface_get_status (dst))
- return FALSE;
-
- return TRUE;
-}
-
-void
-xglCopyProc (DrawablePtr pSrc,
- DrawablePtr pDst,
- GCPtr pGC,
- BoxPtr pBox,
- int nBox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown,
- Pixel bitplane,
- void *closure)
-{
- BoxPtr pSrcBox = (BoxPtr) closure;
-
- if (!xglCopy (pSrc, pDst, dx, dy, pBox, nBox))
- {
- RegionRec region;
-
- XGL_DRAWABLE_PIXMAP (pDst);
- XGL_PIXMAP_PRIV (pPixmap);
-
- if (!xglSyncBits (pSrc, pSrcBox))
- FatalError (XGL_SW_FAILURE_STRING);
-
- if (!xglMapPixmapBits (pPixmap))
- FatalError (XGL_SW_FAILURE_STRING);
-
- fbCopyNtoN (pSrc, pDst, pGC,
- pBox, nBox,
- dx, dy,
- reverse, upsidedown, bitplane,
- (void *) 0);
-
- pPixmapPriv->damageBox = miEmptyBox;
-
- while (nBox--)
- {
- REGION_INIT (pDst->pScreen, &region, pBox, 1);
- xglAddSurfaceDamage (pDst, &region);
- REGION_UNINIT (pDst->pScreen, &region);
-
- pBox++;
- }
- } else
- xglAddCurrentBitDamage (pDst);
-}
diff --git a/hw/xgl/xglfill.c b/hw/xgl/xglfill.c
deleted file mode 100644
index 64759ab..0000000
--- a/hw/xgl/xglfill.c
+++ b/dev/null
@@ -1,742 +0,0 @@
-/*
- * 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 "xgl.h"
-#include "gcstruct.h"
-#include "fb.h"
-
-Bool
-xglFill (DrawablePtr pDrawable,
- GCPtr pGC,
- xglGeometryPtr pGeometry,
- int x,
- int y,
- int width,
- int height,
- BoxPtr pBox,
- int nBox)
-{
- XGL_GC_PRIV (pGC);
-
- switch (pGC->fillStyle) {
- case FillSolid:
- if (xglSolid (pDrawable,
- pGCPriv->op, pGCPriv->fg,
- pGeometry,
- x, y,
- width, height,
- pBox, nBox))
- return TRUE;
- break;
- case FillStippled:
- case FillOpaqueStippled:
- break;
- case FillTiled:
- if (xglTile (pDrawable,
- pGCPriv->op, pGC->tile.pixmap,
- -(pGC->patOrg.x + pDrawable->x),
- -(pGC->patOrg.y + pDrawable->y),
- pGeometry,
- x, y,
- width, height,
- pBox, nBox))
- return TRUE;
- break;
- }
-
- return FALSE;
-}
-
-static void
-xglFillBox (DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- int width,
- int height,
- BoxPtr pBox,
- int nBox)
-{
- if (!nBox)
- return;
-
- if (!xglFill (pDrawable, pGC, NULL, x, y, width, height, pBox, nBox))
- {
- RegionRec region;
-
- XGL_DRAWABLE_PIXMAP (pDrawable);
- XGL_PIXMAP_PRIV (pPixmap);
-
- if (!xglMapPixmapBits (pPixmap))
- FatalError (XGL_SW_FAILURE_STRING);
-
- switch (pGC->fillStyle) {
- case FillSolid:
- break;
- case FillStippled:
- case FillOpaqueStippled:
- if (!xglSyncBits (&pGC->stipple->drawable, NullBox))
- FatalError (XGL_SW_FAILURE_STRING);
- break;
- case FillTiled:
- if (!xglSyncBits (&pGC->tile.pixmap->drawable, NullBox))
- FatalError (XGL_SW_FAILURE_STRING);
- break;
- }
-
- pPixmapPriv->damageBox = miEmptyBox;
-
- while (nBox--)
- {
- fbFill (pDrawable, pGC,
- pBox->x1, pBox->y1,
- pBox->x2 - pBox->x1, pBox->y2 - pBox->y1);
-
- REGION_INIT (pDrawable->pScreen, &region, pBox, 1);
- xglAddSurfaceDamage (pDrawable, &region);
- REGION_UNINIT (pDrawable->pScreen, &region);
-
- pBox++;
- }
- } else
- xglAddCurrentBitDamage (pDrawable);
-}
-
-#define N_STACK_BOX 1024
-
-static BoxPtr
-xglMoreBoxes (BoxPtr stackBox,
- BoxPtr heapBox,
- int nBoxes)
-{
- Bool stack = !heapBox;
-
- heapBox = xrealloc (heapBox, sizeof (BoxRec) * nBoxes);
- if (!heapBox)
- return NULL;
-
- if (stack)
- memcpy (heapBox, stackBox, sizeof (BoxRec) * N_STACK_BOX);
-
- return heapBox;
-}
-
-#define ADD_BOX(pBox, nBox, stackBox, heapBox, size, box) \
- { \
- if ((nBox) == (size)) \
- { \
- (size) *= 2; \
- (heapBox) = xglMoreBoxes (stackBox, heapBox, size); \
- if (heapBox) \
- { \
- (pBox) = (heapBox) + (nBox); \
- *(pBox)++ = (box); \
- (nBox)++; \
- } \
- } \
- else \
- { \
- *(pBox)++ = (box); \
- (nBox)++; \
- } \
- }
-
-void
-xglFillRect (DrawablePtr pDrawable,
- GCPtr pGC,
- int nrect,
- xRectangle *prect)
-{
- RegionPtr pClip = pGC->pCompositeClip;
- BoxPtr pClipBox;
- BoxPtr pExtent = REGION_EXTENTS (pGC->pScreen, pClip);
- BoxRec part, full;
- BoxPtr heapBox = NULL;
- BoxRec stackBox[N_STACK_BOX];
- int size = N_STACK_BOX;
- BoxPtr pBox = stackBox;
- int nClip, nBox = 0;
-
- while (nrect--)
- {
- full.x1 = prect->x + pDrawable->x;
- full.y1 = prect->y + pDrawable->y;
- full.x2 = full.x1 + (int) prect->width;
- full.y2 = full.y1 + (int) prect->height;
-
- prect++;
-
- if (full.x1 < pExtent->x1)
- full.x1 = pExtent->x1;
- if (full.y1 < pExtent->y1)
- full.y1 = pExtent->y1;
- if (full.x2 > pExtent->x2)
- full.x2 = pExtent->x2;
- if (full.y2 > pExtent->y2)
- full.y2 = pExtent->y2;
-
- if (full.x1 >= full.x2 || full.y1 >= full.y2)
- continue;
-
- nClip = REGION_NUM_RECTS (pClip);
- if (nClip == 1)
- {
- ADD_BOX (pBox, nBox, stackBox, heapBox, size, full);
- }
- else
- {
- pClipBox = REGION_RECTS (pClip);
- while (nClip--)
- {
- part = *pClipBox++;
-
- if (part.x1 < full.x1)
- part.x1 = full.x1;
- if (part.y1 < full.y1)
- part.y1 = full.y1;
- if (part.x2 > full.x2)
- part.x2 = full.x2;
- if (part.y2 > full.y2)
- part.y2 = full.y2;
-
- if (part.x1 < part.x2 && part.y1 < part.y2)
- ADD_BOX (pBox, nBox, stackBox, heapBox, size, part);
- }
- }
- }
-
- xglFillBox (pDrawable, pGC,
- pExtent->x1, pExtent->y1,
- pExtent->x2 - pExtent->x1, pExtent->y2 - pExtent->y1,
- (heapBox) ? heapBox : stackBox, nBox);
-
- if (heapBox)
- xfree (heapBox);
-}
-
-void
-xglFillSpan (DrawablePtr pDrawable,
- GCPtr pGC,
- int n,
- DDXPointPtr ppt,
- int *pwidth)
-{
- RegionPtr pClip = pGC->pCompositeClip;
- BoxPtr pClipBox;
- BoxPtr pExtent = REGION_EXTENTS (pGC->pScreen, pClip);
- BoxRec part, full;
- BoxPtr heapBox = NULL;
- BoxRec stackBox[N_STACK_BOX];
- int size = N_STACK_BOX;
- BoxPtr pBox = stackBox;
- int nClip, nBox = 0;
-
- while (n--)
- {
- full.x1 = ppt->x;
- full.y1 = ppt->y;
- full.x2 = full.x1 + *pwidth;
- full.y2 = full.y1 + 1;
-
- pwidth++;
- ppt++;
-
- if (full.x1 < pExtent->x1)
- full.x1 = pExtent->x1;
- if (full.y1 < pExtent->y1)
- full.y1 = pExtent->y1;
- if (full.x2 > pExtent->x2)
- full.x2 = pExtent->x2;
- if (full.y2 > pExtent->y2)
- full.y2 = pExtent->y2;
-
- if (full.x1 >= full.x2 || full.y1 >= full.y2)
- continue;
-
- nClip = REGION_NUM_RECTS (pClip);
- if (nClip == 1)
- {
- ADD_BOX (pBox, nBox, stackBox, heapBox, size, full);
- }
- else
- {
- pClipBox = REGION_RECTS (pClip);
- while (nClip--)
- {
- part = *pClipBox++;
-
- if (part.x1 < full.x1)
- part.x1 = full.x1;
- if (part.y1 < full.y1)
- part.y1 = full.y1;
- if (part.x2 > full.x2)
- part.x2 = full.x2;
- if (part.y2 > full.y2)
- part.y2 = full.y2;
-
- if (part.x1 < part.x2 && part.y1 < part.y2)
- ADD_BOX (pBox, nBox, stackBox, heapBox, size, part);
- }
- }
- }
-
- xglFillBox (pDrawable, pGC,
- pExtent->x1, pExtent->y1,
- pExtent->x2 - pExtent->x1, pExtent->y2 - pExtent->y1,
- (heapBox) ? heapBox : stackBox, nBox);
-
- if (heapBox)
- xfree (heapBox);
-}
-
-Bool
-xglFillLine (DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr ppt)
-{
- RegionPtr pClip = pGC->pCompositeClip;
- BoxPtr pExtent = REGION_EXTENTS (pGC->pScreen, pClip);
- Bool coincidentEndpoints = FALSE;
- Bool horizontalAndVertical = TRUE;
- DDXPointPtr pptTmp;
- int nptTmp;
- DDXPointRec pt;
- xglGeometryPtr pGeometry;
-
- XGL_SCREEN_PRIV (pGC->pScreen);
-
- if (npt < 2)
- return TRUE;
-
- pt = *ppt;
-
- nptTmp = npt - 1;
- pptTmp = ppt + 1;
-
- if (mode == CoordModePrevious)
- {
- while (nptTmp--)
- {
- if (pptTmp->x && pptTmp->y)
- horizontalAndVertical = FALSE;
-
- pt.x += pptTmp->x;
- pt.y += pptTmp->y;
-
- pptTmp++;
- }
-
- if (pt.x == ppt->x && pt.y == ppt->y)
- coincidentEndpoints = TRUE;
- }
- else
- {
- while (nptTmp--)
- {
- if (pptTmp->x != pt.x && pptTmp->y != pt.y)
- {
- horizontalAndVertical = FALSE;
- break;
- }
-
- pt = *pptTmp++;
- }
-
- if (ppt[npt - 1].x == ppt->x && ppt[npt - 1].y == ppt->y)
- coincidentEndpoints = TRUE;
- }
-
- if (horizontalAndVertical)
- {
- BoxPtr pClipBox;
- BoxRec part, full;
- BoxPtr heapBox = NULL;
- BoxRec stackBox[N_STACK_BOX];
- int size = N_STACK_BOX;
- BoxPtr pBox = stackBox;
- int nClip, nBox = 0;
- int dx, dy;
-
- pt = *ppt;
-
- ppt++;
- npt--;
-
- while (npt--)
- {
- if (mode == CoordModePrevious)
- {
- dx = ppt->x;
- dy = ppt->y;
- }
- else
- {
- dx = ppt->x - pt.x;
- dy = ppt->y - pt.y;
- }
-
- if (dx)
- {
- if (dx > 0)
- {
- full.x1 = pt.x + pDrawable->x;
-
- if (npt || coincidentEndpoints)
- full.x2 = full.x1 + dx;
- else
- full.x2 = full.x1 + dx + 1;
- }
- else
- {
- full.x2 = pt.x + pDrawable->x + 1;
-
- if (npt || coincidentEndpoints)
- full.x1 = full.x2 + dx;
- else
- full.x1 = full.x2 + dx - 1;
- }
-
- full.y1 = pt.y + pDrawable->y;
- full.y2 = full.y1 + 1;
- }
- else
- {
- if (dy > 0)
- {
- full.y1 = pt.y + pDrawable->y;
-
- if (npt || coincidentEndpoints)
- full.y2 = full.y1 + dy;
- else
- full.y2 = full.y1 + dy + 1;
- }
- else
- {
- full.y2 = pt.y + pDrawable->y + 1;
-
- if (npt || coincidentEndpoints)
- full.y1 = full.y2 + dy;
- else
- full.y1 = full.y2 + dy - 1;
- }
-
- full.x1 = pt.x + pDrawable->x;
- full.x2 = full.x1 + 1;
- }
-
- pt.x += dx;
- pt.y += dy;
-
- ppt++;
-
- if (full.x1 < pExtent->x1)
- full.x1 = pExtent->x1;
- if (full.y1 < pExtent->y1)
- full.y1 = pExtent->y1;
- if (full.x2 > pExtent->x2)
- full.x2 = pExtent->x2;
- if (full.y2 > pExtent->y2)
- full.y2 = pExtent->y2;
-
- if (full.x1 >= full.x2 || full.y1 >= full.y2)
- continue;
-
- nClip = REGION_NUM_RECTS (pClip);
- if (nClip == 1)
- {
- ADD_BOX (pBox, nBox, stackBox, heapBox, size, full);
- }
- else
- {
- pClipBox = REGION_RECTS (pClip);
- while (nClip--)
- {
- part = *pClipBox++;
-
- if (part.x1 < full.x1)
- part.x1 = full.x1;
- if (part.y1 < full.y1)
- part.y1 = full.y1;
- if (part.x2 > full.x2)
- part.x2 = full.x2;
- if (part.y2 > full.y2)
- part.y2 = full.y2;
-
- if (part.x1 < part.x2 && part.y1 < part.y2)
- ADD_BOX (pBox, nBox, stackBox, heapBox, size, part);
- }
- }
- }
-
- xglFillBox (pDrawable, pGC,
- pExtent->x1, pExtent->y1,
- pExtent->x2 - pExtent->x1, pExtent->y2 - pExtent->y1,
- (heapBox) ? heapBox : stackBox, nBox);
-
- if (heapBox)
- xfree (heapBox);
-
- return TRUE;
- }
-
- if (!pScreenPriv->lines)
- return FALSE;
-
- if (coincidentEndpoints)
- npt--;
-
- pGeometry = xglGetScratchVertexGeometry (pGC->pScreen, npt);
-
- GEOMETRY_ADD_LINE (pGC->pScreen, pGeometry,
- coincidentEndpoints, mode, npt, ppt);
-
- if (coincidentEndpoints)
- GEOMETRY_SET_VERTEX_PRIMITIVE (pGeometry, GLITZ_PRIMITIVE_LINE_LOOP);
- else
- GEOMETRY_SET_VERTEX_PRIMITIVE (pGeometry, GLITZ_PRIMITIVE_LINE_STRIP);
-
- /* Lines need a 0.5 translate */
- GEOMETRY_TRANSLATE_FIXED (pGeometry, 1 << 15, 1 << 15);
-
- GEOMETRY_TRANSLATE (pGeometry, pDrawable->x, pDrawable->y);
-
- pExtent = REGION_EXTENTS (pDrawable->pScreen, pGC->pCompositeClip);
-
- if (xglFill (pDrawable, pGC, pGeometry,
- pExtent->x1, pExtent->y1,
- pExtent->x2 - pExtent->x1, pExtent->y2 - pExtent->y1,
- REGION_RECTS (pGC->pCompositeClip),
- REGION_NUM_RECTS (pGC->pCompositeClip)))
- {
- xglAddCurrentBitDamage (pDrawable);
- return TRUE;
- }
-
- return FALSE;
-}
-
-Bool
-xglFillSegment (DrawablePtr pDrawable,
- GCPtr pGC,
- int nSegInit,
- xSegment *pSegInit)
-{
- RegionPtr pClip = pGC->pCompositeClip;
- BoxPtr pExtent = REGION_EXTENTS (pGC->pScreen, pClip);
- Bool horizontalAndVertical = TRUE;
- xglGeometryPtr pGeometry;
- xSegment *pSeg;
- int nSeg;
-
- XGL_SCREEN_PRIV (pGC->pScreen);
-
- if (nSegInit < 1)
- return TRUE;
-
- pSeg = pSegInit;
- nSeg = nSegInit;
- while (nSeg--)
- {
- if (pSeg->x1 != pSeg->x2 && pSeg->y1 != pSeg->y2)
- horizontalAndVertical = FALSE;
-
- pSeg++;
- }
-
- if (horizontalAndVertical)
- {
- BoxPtr pClipBox;
- BoxRec part, full;
- BoxPtr heapBox = NULL;
- BoxRec stackBox[N_STACK_BOX];
- int size = N_STACK_BOX;
- BoxPtr pBox = stackBox;
- int nClip, nBox = 0;
-
- while (nSegInit--)
- {
- if (pSegInit->x1 != pSegInit->x2)
- {
- if (pSegInit->x1 < pSegInit->x2)
- {
- full.x1 = pSegInit->x1;
- full.x2 = pSegInit->x2;
- }
- else
- {
- full.x1 = pSegInit->x2;
- full.x2 = pSegInit->x1;
- }
-
- full.x1 += pDrawable->x;
- full.x2 += pDrawable->x + 1;
- full.y1 = pSegInit->y1 + pDrawable->y;
- full.y2 = full.y1 + 1;
- }
- else
- {
- if (pSegInit->y1 < pSegInit->y2)
- {
- full.y1 = pSegInit->y1;
- full.y2 = pSegInit->y2;
- }
- else
- {
- full.y1 = pSegInit->y2;
- full.y2 = pSegInit->y1;
- }
-
- full.y1 += pDrawable->y;
- full.y2 += pDrawable->y + 1;
- full.x1 = pSegInit->x1 + pDrawable->x;
- full.x2 = full.x1 + 1;
- }
-
- pSegInit++;
-
- if (full.x1 < pExtent->x1)
- full.x1 = pExtent->x1;
- if (full.y1 < pExtent->y1)
- full.y1 = pExtent->y1;
- if (full.x2 > pExtent->x2)
- full.x2 = pExtent->x2;
- if (full.y2 > pExtent->y2)
- full.y2 = pExtent->y2;
-
- if (full.x1 >= full.x2 || full.y1 >= full.y2)
- continue;
-
- nClip = REGION_NUM_RECTS (pClip);
- if (nClip == 1)
- {
- ADD_BOX (pBox, nBox, stackBox, heapBox, size, full);
- }
- else
- {
- pClipBox = REGION_RECTS (pClip);
- while (nClip--)
- {
- part = *pClipBox++;
-
- if (part.x1 < full.x1)
- part.x1 = full.x1;
- if (part.y1 < full.y1)
- part.y1 = full.y1;
- if (part.x2 > full.x2)
- part.x2 = full.x2;
- if (part.y2 > full.y2)
- part.y2 = full.y2;
-
- if (part.x1 < part.x2 && part.y1 < part.y2)
- ADD_BOX (pBox, nBox, stackBox, heapBox, size, part);
- }
- }
- }
-
- xglFillBox (pDrawable, pGC,
- pExtent->x1, pExtent->y1,
- pExtent->x2 - pExtent->x1, pExtent->y2 - pExtent->y1,
- (heapBox) ? heapBox : stackBox, nBox);
-
- if (heapBox)
- xfree (heapBox);
-
- return TRUE;
- }
-
- if (!pScreenPriv->lines)
- return FALSE;
-
- pGeometry = xglGetScratchVertexGeometry (pGC->pScreen, 2 * nSegInit);
-
- GEOMETRY_ADD_SEGMENT (pGC->pScreen, pGeometry, nSegInit, pSegInit);
-
- /* Line segments need 0.5 translate */
- GEOMETRY_TRANSLATE_FIXED (pGeometry, 1 << 15, 1 << 15);
- GEOMETRY_SET_VERTEX_PRIMITIVE (pGeometry, GLITZ_PRIMITIVE_LINES);
-
- GEOMETRY_TRANSLATE (pGeometry, pDrawable->x, pDrawable->y);
-
- if (xglFill (pDrawable, pGC, pGeometry,
- pExtent->x1, pExtent->y1,
- pExtent->x2 - pExtent->x1, pExtent->y2 - pExtent->y1,
- REGION_RECTS (pGC->pCompositeClip),
- REGION_NUM_RECTS (pGC->pCompositeClip)))
- {
- xglAddCurrentBitDamage (pDrawable);
- return TRUE;
- }
-
- return FALSE;
-}
-
-Bool
-xglFillGlyph (DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- unsigned int nGlyph,
- CharInfoPtr *ppci,
- pointer pglyphBase)
-{
- BoxPtr pExtent;
- xglGeometryRec geometry;
-
- if (nGlyph < 1)
- return TRUE;
-
- pExtent = REGION_EXTENTS (pDrawable->pScreen, pGC->pCompositeClip);
-
- x += pDrawable->x;
- y += pDrawable->y;
-
- GEOMETRY_INIT (pDrawable->pScreen, &geometry,
- GLITZ_GEOMETRY_TYPE_BITMAP,
- GEOMETRY_USAGE_SYSMEM, 0);
-
- GEOMETRY_FOR_GLYPH (pDrawable->pScreen,
- &geometry,
- nGlyph,
- ppci,
- pglyphBase);
-
- GEOMETRY_TRANSLATE (&geometry, x, y);
-
- if (xglFill (pDrawable, pGC, &geometry,
- pExtent->x1, pExtent->y1,
- pExtent->x2 - pExtent->x1, pExtent->y2 - pExtent->y1,
- REGION_RECTS (pGC->pCompositeClip),
- REGION_NUM_RECTS (pGC->pCompositeClip)))
- {
- GEOMETRY_UNINIT (&geometry);
- xglAddCurrentBitDamage (pDrawable);
- return TRUE;
- }
-
- GEOMETRY_UNINIT (&geometry);
- return FALSE;
-}
diff --git a/hw/xgl/xglgc.c b/hw/xgl/xglgc.c
deleted file mode 100644
index 7e7e751..0000000
--- a/hw/xgl/xglgc.c
+++ b/dev/null
@@ -1,645 +0,0 @@
-/*
- * 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 "xgl.h"
-#include "fb.h"
-#include "gcstruct.h"
-#include "migc.h"
-
-#define XGL_GC_OP_FALLBACK_PROLOGUE(pDrawable) \
- xglSyncDamageBoxBits (pDrawable); \
- XGL_GC_UNWRAP (funcs); \
- XGL_GC_UNWRAP (ops)
-
-#define XGL_GC_OP_FALLBACK_EPILOGUE(pDrawable) \
- XGL_GC_WRAP (funcs, (GCFuncs *) &xglGCFuncs); \
- XGL_GC_WRAP (ops, (GCOps *) &xglGCOps); \
- xglAddCurrentSurfaceDamage (pDrawable)
-
-#define XGL_GC_FILL_OP_FALLBACK_PROLOGUE(pDrawable) \
- switch (pGC->fillStyle) { \
- case FillSolid: \
- break; \
- case FillStippled: \
- case FillOpaqueStippled: \
- if (!xglSyncBits (&pGC->stipple->drawable, NullBox)) \
- FatalError (XGL_SW_FAILURE_STRING); \
- break; \
- case FillTiled: \
- if (!xglSyncBits (&pGC->tile.pixmap->drawable, NullBox)) \
- FatalError (XGL_SW_FAILURE_STRING); \
- break; \
- } \
- XGL_GC_OP_FALLBACK_PROLOGUE (pDrawable)
-
-static const GCFuncs xglGCFuncs = {
- xglValidateGC,
- miChangeGC,
- miCopyGC,
- xglDestroyGC,
- miChangeClip,
- miDestroyClip,
- miCopyClip
-};
-
-static const GCOps xglGCOps = {
- xglFillSpans,
- xglSetSpans,
- xglPutImage,
- xglCopyArea,
- xglCopyPlane,
- xglPolyPoint,
- xglPolylines,
- xglPolySegment,
- miPolyRectangle,
- xglPolyArc,
- miFillPolygon,
- xglPolyFillRect,
- xglPolyFillArc,
- miPolyText8,
- miPolyText16,
- miImageText8,
- miImageText16,
- xglImageGlyphBlt,
- xglPolyGlyphBlt,
- xglPushPixels
-};
-
-void
-xglFillSpans (DrawablePtr pDrawable,
- GCPtr pGC,
- int nspans,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted)
-{
- XGL_GC_PRIV (pGC);
-
- if (pGCPriv->flags || pGC->fillStyle == FillStippled)
- {
- XGL_GC_FILL_OP_FALLBACK_PROLOGUE (pDrawable);
- (*pGC->ops->FillSpans) (pDrawable, pGC, nspans, ppt, pwidth, fSorted);
- XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
- }
- else
- {
- /* xglFillSpan handles fall-back */
- xglFillSpan (pDrawable, pGC, nspans, ppt, pwidth);
- }
-}
-
-void
-xglSetSpans (DrawablePtr pDrawable,
- GCPtr pGC,
- char *psrc,
- DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- int fSorted)
-{
- XGL_GC_PRIV (pGC);
-
- XGL_GC_OP_FALLBACK_PROLOGUE (pDrawable);
- (*pGC->ops->SetSpans) (pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted);
- XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
-}
-
-void
-xglPutImage (DrawablePtr pDrawable,
- GCPtr pGC,
- int depth,
- int x,
- int y,
- int w,
- int h,
- int leftPad,
- int format,
- char *bits)
-{
- XGL_GC_PRIV (pGC);
-
- if (pGC->alu != GXcopy || (pGCPriv->flags & xglGCPlaneMaskFlag))
- {
- XGL_GC_OP_FALLBACK_PROLOGUE (pDrawable);
- (*pGC->ops->PutImage) (pDrawable, pGC, depth,
- x, y, w, h, leftPad, format, bits);
- XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
- }
- else
- {
- RegionPtr pClip = pGC->pCompositeClip;
- RegionRec region;
- BoxRec box;
-
- XGL_DRAWABLE_PIXMAP (pDrawable);
-
- if (!xglMapPixmapBits (pPixmap))
- FatalError (XGL_SW_FAILURE_STRING);
-
- XGL_GC_UNWRAP (funcs);
- XGL_GC_UNWRAP (ops);
-
- (*pGC->ops->PutImage) (pDrawable, pGC, depth,
- x, y, w, h, leftPad, format, bits);
-
- XGL_GC_WRAP (funcs, (GCFuncs *) &xglGCFuncs);
- XGL_GC_WRAP (ops, (GCOps *) &xglGCOps);
-
- box.x1 = pDrawable->x + x;
- box.y1 = pDrawable->y + y;
- box.x2 = box.x1 + w;
- box.y2 = box.y1 + h;
-
- REGION_INIT (pDrawable->pScreen, &region, &box, 1);
- REGION_INTERSECT (pDrawable->pScreen, &region, pClip, &region);
-
- xglAddSurfaceDamage (pDrawable, &region);
-
- REGION_UNINIT (pDrawable->pScreen, &region);
- }
-}
-
-RegionPtr
-xglCopyArea (DrawablePtr pSrc,
- DrawablePtr pDst,
- GCPtr pGC,
- int srcX,
- int srcY,
- int w,
- int h,
- int dstX,
- int dstY)
-{
- RegionPtr pRegion;
- BoxRec box;
-
- XGL_GC_PRIV (pGC);
-
- box.x1 = pSrc->x + srcX;
- box.y1 = pSrc->y + srcY;
- box.x2 = box.x1 + w;
- box.y2 = box.y1 + h;
-
- if (pGC->alu != GXcopy || pGCPriv->flags)
- {
- if (!xglSyncBits (pSrc, &box))
- FatalError (XGL_SW_FAILURE_STRING);
-
- XGL_GC_OP_FALLBACK_PROLOGUE (pDst);
- pRegion = (*pGC->ops->CopyArea) (pSrc, pDst, pGC,
- srcX, srcY, w, h, dstX, dstY);
- XGL_GC_OP_FALLBACK_EPILOGUE (pDst);
- }
- else
- {
- /* xglCopyProc handles fall-back */
- pRegion = fbDoCopy (pSrc, pDst, pGC,
- srcX, srcY,
- w, h,
- dstX, dstY,
- xglCopyProc, 0,
- (void *) &box);
- }
-
- return pRegion;
-}
-
-RegionPtr
-xglCopyPlane (DrawablePtr pSrc,
- DrawablePtr pDst,
- GCPtr pGC,
- int srcX,
- int srcY,
- int w,
- int h,
- int dstX,
- int dstY,
- unsigned long bitPlane)
-{
- RegionPtr pRegion;
- BoxRec box;
-
- XGL_GC_PRIV (pGC);
-
- box.x1 = pSrc->x + srcX;
- box.y1 = pSrc->y + srcY;
- box.x2 = box.x1 + w;
- box.y2 = box.y1 + h;
-
- if (!xglSyncBits (pSrc, &box))
- FatalError (XGL_SW_FAILURE_STRING);
-
- XGL_GC_OP_FALLBACK_PROLOGUE (pDst);
- pRegion = (*pGC->ops->CopyPlane) (pSrc, pDst, pGC,
- srcX, srcY, w, h, dstX, dstY,
- bitPlane);
- XGL_GC_OP_FALLBACK_EPILOGUE (pDst);
-
- return pRegion;
-}
-
-void
-xglPolyPoint (DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr pptInit)
-{
- XGL_GC_PRIV (pGC);
-
- XGL_GC_OP_FALLBACK_PROLOGUE (pDrawable);
- (*pGC->ops->PolyPoint) (pDrawable, pGC, mode, npt, pptInit);
- XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
-}
-
-void
-xglPolylines (DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr ppt)
-{
- if (pGC->lineWidth == 0)
- {
- XGL_GC_PRIV (pGC);
-
- if (!pGCPriv->flags)
- {
- if (pGC->lineStyle == LineSolid)
- {
- if (xglFillLine (pDrawable, pGC, mode, npt, ppt))
- return;
- }
- }
-
- XGL_GC_FILL_OP_FALLBACK_PROLOGUE (pDrawable);
- (*pGC->ops->Polylines) (pDrawable, pGC, mode, npt, ppt);
- XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
- }
- else
- {
- if (pGC->lineStyle != LineSolid)
- miWideDash (pDrawable, pGC, mode, npt, ppt);
- else
- miWideLine (pDrawable, pGC, mode, npt, ppt);
- }
-}
-
-void
-xglPolySegment (DrawablePtr pDrawable,
- GCPtr pGC,
- int nsegInit,
- xSegment *pSegInit)
-{
- if (pGC->lineWidth == 0)
- {
- XGL_GC_PRIV (pGC);
-
- if (!pGCPriv->flags)
- {
- if (pGC->lineStyle == LineSolid)
- {
- if (xglFillSegment (pDrawable, pGC, nsegInit, pSegInit))
- return;
- }
- }
-
- XGL_GC_FILL_OP_FALLBACK_PROLOGUE (pDrawable);
- (*pGC->ops->PolySegment) (pDrawable, pGC, nsegInit, pSegInit);
- XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
- } else
- miPolySegment (pDrawable, pGC, nsegInit, pSegInit);
-}
-
-void
-xglPolyArc (DrawablePtr pDrawable,
- GCPtr pGC,
- int narcs,
- xArc *pArcs)
-{
- if (pGC->lineWidth == 0)
- {
- XGL_GC_PRIV (pGC);
-
- XGL_GC_FILL_OP_FALLBACK_PROLOGUE (pDrawable);
- (*pGC->ops->PolyArc) (pDrawable, pGC, narcs, pArcs);
- XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
- } else
- miPolyArc (pDrawable, pGC, narcs, pArcs);
-}
-
-void
-xglPolyFillRect (DrawablePtr pDrawable,
- GCPtr pGC,
- int nrect,
- xRectangle *prect)
-{
- XGL_GC_PRIV (pGC);
-
- if (pGC->fillStyle == FillStippled || pGCPriv->flags)
- {
- XGL_GC_FILL_OP_FALLBACK_PROLOGUE (pDrawable);
- (*pGC->ops->PolyFillRect) (pDrawable, pGC, nrect, prect);
- XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
- }
- else
- {
- /* xglFillRect handles fall-back */
- xglFillRect (pDrawable, pGC, nrect, prect);
- }
-}
-
-void
-xglPolyFillArc (DrawablePtr pDrawable,
- GCPtr pGC,
- int narcs,
- xArc *pArcs)
-{
- XGL_GC_PRIV (pGC);
-
- XGL_GC_FILL_OP_FALLBACK_PROLOGUE (pDrawable);
- (*pGC->ops->PolyFillArc) (pDrawable, pGC, narcs, pArcs);
- XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
-}
-
-void
-xglImageGlyphBlt (DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase)
-{
- XGL_GC_PRIV (pGC);
-
- if (!pGCPriv->flags)
- {
- if (xglSolidGlyph (pDrawable,
- pGC,
- x,
- y,
- nglyph,
- ppci,
- pglyphBase))
- return;
- }
-
- XGL_GC_OP_FALLBACK_PROLOGUE (pDrawable);
- (*pGC->ops->ImageGlyphBlt) (pDrawable, pGC, x, y, nglyph, ppci,
- pglyphBase);
- XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
-}
-
-void
-xglPolyGlyphBlt (DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase)
-{
- XGL_GC_PRIV (pGC);
-
- if (!pGCPriv->flags)
- {
- if (xglFillGlyph (pDrawable,
- pGC,
- x,
- y,
- nglyph,
- ppci,
- pglyphBase))
- return;
- }
-
- XGL_GC_FILL_OP_FALLBACK_PROLOGUE (pDrawable);
- (*pGC->ops->PolyGlyphBlt) (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
- XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
-}
-
-void
-xglPushPixels (GCPtr pGC,
- PixmapPtr pBitmap,
- DrawablePtr pDrawable,
- int w,
- int h,
- int x,
- int y)
-{
- XGL_GC_PRIV (pGC);
-
- if (!xglSyncBits (&pBitmap->drawable, NullBox))
- FatalError (XGL_SW_FAILURE_STRING);
-
- XGL_GC_OP_FALLBACK_PROLOGUE (pDrawable);
- (*pGC->ops->PushPixels) (pGC, pBitmap, pDrawable, w, h, x, y);
- XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
-}
-
-Bool
-xglCreateGC (GCPtr pGC)
-{
- ScreenPtr pScreen = pGC->pScreen;
- Bool ret;
-
- XGL_SCREEN_PRIV (pScreen);
- XGL_GC_PRIV (pGC);
-
- XGL_SCREEN_UNWRAP (CreateGC);
- ret = (*pScreen->CreateGC) (pGC);
- XGL_SCREEN_WRAP (CreateGC, xglCreateGC);
-
- XGL_GC_WRAP (funcs, (GCFuncs *) &xglGCFuncs);
- XGL_GC_WRAP (ops, (GCOps *) &xglGCOps);
-
- pGCPriv->flags = 0;
- pGCPriv->op = GLITZ_OPERATOR_SRC;
-
- pGCPriv->fg = NULL;
- pGCPriv->bg = NULL;
- pGCPriv->id = ~0;
-
- return ret;
-}
-
-void
-xglDestroyGC (GCPtr pGC)
-{
- XGL_GC_PRIV (pGC);
-
- if (pGCPriv->fg)
- glitz_surface_destroy (pGCPriv->fg);
-
- if (pGCPriv->bg)
- glitz_surface_destroy (pGCPriv->bg);
-
- XGL_GC_UNWRAP (funcs);
- XGL_GC_UNWRAP (ops);
- (*pGC->funcs->DestroyGC) (pGC);
- XGL_GC_WRAP (funcs, (GCFuncs *) &xglGCFuncs);
- XGL_GC_WRAP (ops, (GCOps *) &xglGCOps);
-}
-
-void
-xglValidateGC (GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDrawable)
-{
- XGL_GC_PRIV (pGC);
-
- if (changes & GCTile)
- {
- if (!pGC->tileIsPixel &&
- FbEvenTile (pGC->tile.pixmap->drawable.width *
- pDrawable->bitsPerPixel))
- xglSyncBits (&pGC->tile.pixmap->drawable, NULL);
- }
-
- if (changes & GCStipple)
- {
- if (pGC->stipple)
- xglSyncBits (&pGC->stipple->drawable, NULL);
- }
-
- XGL_GC_UNWRAP (funcs);
- XGL_GC_UNWRAP (ops);
- (*pGC->funcs->ValidateGC) (pGC, changes, pDrawable);
- XGL_GC_WRAP (funcs, (GCFuncs *) &xglGCFuncs);
- XGL_GC_WRAP (ops, (GCOps *) &xglGCOps);
-
- if (pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS))
- {
- XGL_DRAWABLE_PIXMAP_PRIV (pDrawable);
-
- if (pPixmapPriv->pVisual && pPixmapPriv->pVisual->format.surface)
- {
- glitz_format_t *format;
-
- format = pPixmapPriv->pVisual->format.surface;
- if (format->id != pGCPriv->id)
- {
- XGL_SCREEN_PRIV (pDrawable->pScreen);
-
- pGCPriv->flags |= xglGCSoftwareDrawableFlag;
-
- if (pGCPriv->fg)
- glitz_surface_destroy (pGCPriv->fg);
-
- pGCPriv->fg = glitz_surface_create (pScreenPriv->drawable,
- format, 1, 1, 0, NULL);
- if (pGCPriv->fg)
- glitz_surface_set_fill (pGCPriv->fg, GLITZ_FILL_REPEAT);
-
- if (pGCPriv->bg)
- glitz_surface_destroy (pGCPriv->bg);
-
- pGCPriv->bg = glitz_surface_create (pScreenPriv->drawable,
- format, 1, 1, 0, NULL);
- if (pGCPriv->bg)
- glitz_surface_set_fill (pGCPriv->bg, GLITZ_FILL_REPEAT);
-
- pGCPriv->id = format->id;
-
- if (pGCPriv->fg && pGCPriv->bg)
- {
- changes |= (GCForeground | GCBackground);
- pGCPriv->flags &= ~xglGCSoftwareDrawableFlag;
- }
- }
- }
- else
- pGCPriv->flags |= xglGCSoftwareDrawableFlag;
- }
-
- if (changes & GCFunction)
- {
- switch (pGC->alu) {
- case GXclear:
- pGCPriv->op = GLITZ_OPERATOR_CLEAR;
- pGCPriv->flags &= ~xglGCBadFunctionFlag;
- break;
- case GXcopy:
- pGCPriv->op = GLITZ_OPERATOR_SRC;
- pGCPriv->flags &= ~xglGCBadFunctionFlag;
- break;
- case GXnoop:
- pGCPriv->op = GLITZ_OPERATOR_DST;
- pGCPriv->flags &= ~xglGCBadFunctionFlag;
- break;
- default:
- pGCPriv->flags |= xglGCBadFunctionFlag;
- break;
- }
- }
-
- if (changes & GCPlaneMask)
- {
- FbBits mask;
-
- mask = FbFullMask (pDrawable->depth);
-
- if ((pGC->planemask & mask) != mask)
- pGCPriv->flags |= xglGCPlaneMaskFlag;
- else
- pGCPriv->flags &= ~xglGCPlaneMaskFlag;
- }
-
- if (!(pGCPriv->flags & xglGCSoftwareDrawableFlag))
- {
- if (changes & (GCForeground | GCBackground))
- {
- glitz_pixel_format_t format;
- glitz_buffer_t *buffer;
- CARD32 pixel;
-
- XGL_DRAWABLE_PIXMAP_PRIV (pDrawable);
-
- format.fourcc = GLITZ_FOURCC_RGB;
- format.masks = pPixmapPriv->pVisual->pPixel->masks;
- format.xoffset = 0;
- format.skip_lines = 0;
- format.bytes_per_line = sizeof (CARD32);
- format.scanline_order = GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP;
-
- buffer = glitz_buffer_create_for_data (&pixel);
-
- if (changes & GCForeground)
- {
- pixel = pGC->fgPixel;
- glitz_set_pixels (pGCPriv->fg, 0, 0, 1, 1, &format, buffer);
- }
-
- if (changes & GCBackground)
- {
- pixel = pGC->bgPixel;
- glitz_set_pixels (pGCPriv->bg, 0, 0, 1, 1, &format, buffer);
- }
-
- glitz_buffer_destroy (buffer);
- }
- }
-}
diff --git a/hw/xgl/xglgeometry.c b/hw/xgl/xglgeometry.c
deleted file mode 100644
index 7ab1ba4..0000000
--- a/hw/xgl/xglgeometry.c
+++ b/dev/null
@@ -1,724 +0,0 @@
-/*
- * 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 "xgl.h"
-#include <X11/fonts/fontstruct.h>
-#include "dixfontstr.h"
-
-xglDataTypeInfoRec xglGeometryDataTypes[2] = {
- { GLITZ_DATA_TYPE_SHORT, sizeof (glitz_short_t) },
- { GLITZ_DATA_TYPE_FLOAT, sizeof (glitz_float_t) }
-};
-
-glitz_buffer_hint_t usageTypes[] = {
- GLITZ_BUFFER_HINT_STREAM_DRAW,
- GLITZ_BUFFER_HINT_STATIC_DRAW,
- GLITZ_BUFFER_HINT_DYNAMIC_DRAW
-};
-
-void
-xglGeometryResize (ScreenPtr pScreen,
- xglGeometryPtr pGeometry,
- int size)
-{
- XGL_SCREEN_PRIV (pScreen);
-
- if (size == pGeometry->size)
- return;
-
- if (pGeometry->broken)
- return;
-
- if (pGeometry->usage == GEOMETRY_USAGE_SYSMEM)
- {
- pGeometry->data = xrealloc (pGeometry->data, size);
-
- if (pGeometry->buffer)
- glitz_buffer_destroy (pGeometry->buffer);
-
- pGeometry->buffer = NULL;
-
- if (pGeometry->data)
- {
- pGeometry->buffer = glitz_buffer_create_for_data (pGeometry->data);
- if (!pGeometry->buffer)
- {
- pGeometry->broken = TRUE;
- return;
- }
- }
- else if (size)
- {
- pGeometry->broken = TRUE;
- return;
- }
- }
- else
- {
- glitz_buffer_t *newBuffer;
-
- if (size)
- {
- newBuffer =
- glitz_vertex_buffer_create (pScreenPriv->drawable, NULL, size,
- usageTypes[pGeometry->usage]);
- if (!newBuffer)
- {
- pGeometry->broken = TRUE;
- return;
- }
- } else
- newBuffer = NULL;
-
- if (pGeometry->buffer && newBuffer)
- {
- void *oldData, *newData;
-
- oldData = glitz_buffer_map (pGeometry->buffer,
- GLITZ_BUFFER_ACCESS_READ_ONLY);
- newData = glitz_buffer_map (newBuffer,
- GLITZ_BUFFER_ACCESS_WRITE_ONLY);
-
- if (oldData && newData)
- memcpy (newData, oldData, MIN (size, pGeometry->size));
-
- glitz_buffer_unmap (pGeometry->buffer);
- glitz_buffer_unmap (newBuffer);
-
- glitz_buffer_destroy (pGeometry->buffer);
- }
- pGeometry->buffer = newBuffer;
- }
-
- pGeometry->size = size;
-
- if (pGeometry->endOffset > size)
- pGeometry->endOffset = size;
-}
-
-#define MAP_GEOMETRY(pScreen, pGeometry, offset, units, ptr, _size) \
- if ((pGeometry)->broken) \
- return; \
- (_size) = (units) * xglGeometryDataTypes[(pGeometry)->dataType].size; \
- if (((pGeometry)->size - (offset)) < (_size)) \
- { \
- xglGeometryResize (pScreen, pGeometry, \
- (pGeometry)->endOffset + (_size) + 500); \
- if ((pGeometry)->broken) \
- return; \
- } \
- (ptr) = glitz_buffer_map ((pGeometry)->buffer, \
- GLITZ_BUFFER_ACCESS_WRITE_ONLY); \
- if (!(ptr)) \
- { \
- (pGeometry)->broken = TRUE; \
- return; \
- } \
- (ptr) += (offset)
-
-#define UNMAP_GEOMETRY(pGeometry, offset, _size) \
- if (glitz_buffer_unmap ((pGeometry)->buffer)) \
- { \
- (pGeometry)->broken = TRUE; \
- return; \
- } \
- if (((offset) + (_size)) > (pGeometry)->endOffset) \
- { \
- (pGeometry)->endOffset = (offset) + (_size); \
- (pGeometry)->count = (pGeometry)->endOffset / \
- (2 * xglGeometryDataTypes[(pGeometry)->dataType].size); \
- }
-
-/*
- * Adds a number of boxes as GL_QUAD primitives
- */
-void
-xglGeometryAddBox (ScreenPtr pScreen,
- xglGeometryPtr pGeometry,
- BoxPtr pBox,
- int nBox,
- int offset)
-{
- int size;
- char *ptr;
-
- if (nBox < 1)
- return;
-
- MAP_GEOMETRY (pScreen, pGeometry, offset, nBox * 8, ptr, size);
-
- switch (pGeometry->dataType) {
- case GEOMETRY_DATA_TYPE_SHORT:
- {
- glitz_short_t *data = (glitz_short_t *) ptr;
-
- while (nBox--)
- {
- *data++ = (glitz_short_t) pBox->x1;
- *data++ = (glitz_short_t) pBox->y1;
- *data++ = (glitz_short_t) pBox->x2;
- *data++ = (glitz_short_t) pBox->y1;
- *data++ = (glitz_short_t) pBox->x2;
- *data++ = (glitz_short_t) pBox->y2;
- *data++ = (glitz_short_t) pBox->x1;
- *data++ = (glitz_short_t) pBox->y2;
-
- pBox++;
- }
- } break;
- case GEOMETRY_DATA_TYPE_FLOAT:
- {
- glitz_float_t *data = (glitz_float_t *) ptr;
-
- while (nBox--)
- {
- *data++ = (glitz_float_t) pBox->x1;
- *data++ = (glitz_float_t) pBox->y1;
- *data++ = (glitz_float_t) pBox->x2;
- *data++ = (glitz_float_t) pBox->y1;
- *data++ = (glitz_float_t) pBox->x2;
- *data++ = (glitz_float_t) pBox->y2;
- *data++ = (glitz_float_t) pBox->x1;
- *data++ = (glitz_float_t) pBox->y2;
-
- pBox++;
- }
- } break;
- }
-
- UNMAP_GEOMETRY (pGeometry, offset, size);
-}
-
-/*
- * Adds a number of spans as GL_LINE primitives
- */
-void
-xglGeometryAddSpan (ScreenPtr pScreen,
- xglGeometryPtr pGeometry,
- DDXPointPtr ppt,
- int *pwidth,
- int n,
- int offset)
-{
- int size;
- char *ptr;
-
- if (n < 1)
- return;
-
- MAP_GEOMETRY (pScreen, pGeometry, offset, n * 4, ptr, size);
-
- switch (pGeometry->dataType) {
- case GEOMETRY_DATA_TYPE_SHORT:
- {
- glitz_short_t *data = (glitz_short_t *) ptr;
-
- while (n--)
- {
- *data++ = (glitz_short_t) ppt->x;
- *data++ = (glitz_short_t) ppt->y;
- *data++ = (glitz_short_t) (ppt->x + *pwidth);
- *data++ = (glitz_short_t) ppt->y;
-
- ppt++;
- pwidth++;
- }
- } break;
- case GEOMETRY_DATA_TYPE_FLOAT:
- {
- glitz_float_t *data = (glitz_float_t *) ptr;
-
- while (n--)
- {
- *data++ = (glitz_float_t) ppt->x;
- *data++ = (glitz_float_t) ppt->y;
- *data++ = (glitz_float_t) (ppt->x + *pwidth);
- *data++ = (glitz_float_t) ppt->y;
-
- ppt++;
- pwidth++;
- }
- } break;
- }
-
- UNMAP_GEOMETRY (pGeometry, offset, size);
-}
-
-/*
- * This macro is needed for end pixels to be rasterized correctly using
- * OpenGL as OpenGL line segments are half-opened.
- */
-#define ADJUST_END_POINT(start, end, isPoint) \
- (((end) > (start)) ? (end) + 1: \
- ((end) < (start)) ? (end) - 1: \
- (isPoint) ? (end) + 1: \
- (end))
-
-/*
- * Adds a number of connected lines as GL_LINE_STRIP primitives
- */
-void
-xglGeometryAddLine (ScreenPtr pScreen,
- xglGeometryPtr pGeometry,
- int loop,
- int mode,
- int npt,
- DDXPointPtr ppt,
- int offset)
-{
- DDXPointRec pt;
- int size;
- char *ptr;
-
- if (npt < 2)
- return;
-
- MAP_GEOMETRY (pScreen, pGeometry, offset, npt * 2, ptr, size);
-
- pt.x = 0;
- pt.y = 0;
-
- switch (pGeometry->dataType) {
- case GEOMETRY_DATA_TYPE_SHORT:
- {
- glitz_short_t *data = (glitz_short_t *) ptr;
-
- while (npt--)
- {
- if (mode == CoordModePrevious)
- {
- pt.x += ppt->x;
- pt.y += ppt->y;
- }
- else
- {
- pt.x = ppt->x;
- pt.y = ppt->y;
- }
-
- if (npt || loop)
- {
- *data++ = (glitz_short_t) pt.x;
- *data++ = (glitz_short_t) pt.y;
- }
- else
- {
- ppt--;
- *data++ = (glitz_short_t)
- ADJUST_END_POINT (ppt->x, pt.x, ppt->y == pt.y);
- *data++ = (glitz_short_t) ADJUST_END_POINT (ppt->y, pt.y, 0);
- }
-
- ppt++;
- }
- } break;
- case GEOMETRY_DATA_TYPE_FLOAT:
- {
- glitz_float_t *data = (glitz_float_t *) ptr;
-
- while (npt--)
- {
- if (mode == CoordModePrevious)
- {
- pt.x += ppt->x;
- pt.y += ppt->y;
- }
- else
- {
- pt.x = ppt->x;
- pt.y = ppt->y;
- }
-
- if (npt || loop)
- {
- *data++ = (glitz_float_t) pt.x;
- *data++ = (glitz_float_t) pt.y;
- }
- else
- {
- ppt--;
- *data++ = (glitz_float_t)
- ADJUST_END_POINT (ppt->x, pt.x, ppt->y == pt.y);
- *data++ = (glitz_float_t) ADJUST_END_POINT (ppt->y, pt.y, 0);
- }
-
- ppt++;
- }
- } break;
- }
-
- UNMAP_GEOMETRY (pGeometry, offset, size);
-}
-
-/*
- * Adds a number of line segments as GL_LINE primitives
- */
-void
-xglGeometryAddSegment (ScreenPtr pScreen,