From 3562e78743202e43aec8727005182a2558117eca Mon Sep 17 00:00:00 2001 From: marha Date: Sun, 28 Jun 2009 22:07:26 +0000 Subject: Checked in the following released items: xkeyboard-config-1.4.tar.gz ttf-bitstream-vera-1.10.tar.gz font-alias-1.0.1.tar.gz font-sun-misc-1.0.0.tar.gz font-sun-misc-1.0.0.tar.gz font-sony-misc-1.0.0.tar.gz font-schumacher-misc-1.0.0.tar.gz font-mutt-misc-1.0.0.tar.gz font-misc-misc-1.0.0.tar.gz font-misc-meltho-1.0.0.tar.gz font-micro-misc-1.0.0.tar.gz font-jis-misc-1.0.0.tar.gz font-isas-misc-1.0.0.tar.gz font-dec-misc-1.0.0.tar.gz font-daewoo-misc-1.0.0.tar.gz font-cursor-misc-1.0.0.tar.gz font-arabic-misc-1.0.0.tar.gz font-winitzki-cyrillic-1.0.0.tar.gz font-misc-cyrillic-1.0.0.tar.gz font-cronyx-cyrillic-1.0.0.tar.gz font-screen-cyrillic-1.0.1.tar.gz font-xfree86-type1-1.0.1.tar.gz font-adobe-utopia-type1-1.0.1.tar.gz font-ibm-type1-1.0.0.tar.gz font-bitstream-type1-1.0.0.tar.gz font-bitstream-speedo-1.0.0.tar.gz font-bh-ttf-1.0.0.tar.gz font-bh-type1-1.0.0.tar.gz font-bitstream-100dpi-1.0.0.tar.gz font-bh-lucidatypewriter-100dpi-1.0.0.tar.gz font-bh-100dpi-1.0.0.tar.gz font-adobe-utopia-100dpi-1.0.1.tar.gz font-adobe-100dpi-1.0.0.tar.gz font-util-1.0.1.tar.gz font-bitstream-75dpi-1.0.0.tar.gz font-bh-lucidatypewriter-75dpi-1.0.0.tar.gz font-adobe-utopia-75dpi-1.0.1.tar.gz font-bh-75dpi-1.0.0.tar.gz bdftopcf-1.0.1.tar.gz font-adobe-75dpi-1.0.0.tar.gz mkfontscale-1.0.6.tar.gz openssl-0.9.8k.tar.gz bigreqsproto-1.0.2.tar.gz xtrans-1.2.2.tar.gz resourceproto-1.0.2.tar.gz inputproto-1.4.4.tar.gz compositeproto-0.4.tar.gz damageproto-1.1.0.tar.gz zlib-1.2.3.tar.gz xkbcomp-1.0.5.tar.gz freetype-2.3.9.tar.gz pthreads-w32-2-8-0-release.tar.gz pixman-0.12.0.tar.gz kbproto-1.0.3.tar.gz evieext-1.0.2.tar.gz fixesproto-4.0.tar.gz recordproto-1.13.2.tar.gz randrproto-1.2.2.tar.gz scrnsaverproto-1.1.0.tar.gz renderproto-0.9.3.tar.gz xcmiscproto-1.1.2.tar.gz fontsproto-2.0.2.tar.gz xextproto-7.0.3.tar.gz xproto-7.0.14.tar.gz libXdmcp-1.0.2.tar.gz libxkbfile-1.0.5.tar.gz libfontenc-1.0.4.tar.gz libXfont-1.3.4.tar.gz libX11-1.1.5.tar.gz libXau-1.0.4.tar.gz libxcb-1.1.tar.gz xorg-server-1.5.3.tar.gz --- xorg-server/hw/dmx/glxProxy/Makefile.am | 44 + xorg-server/hw/dmx/glxProxy/Makefile.in | 702 ++++++ xorg-server/hw/dmx/glxProxy/compsize.c | 563 +++++ xorg-server/hw/dmx/glxProxy/g_disptab.c | 611 +++++ xorg-server/hw/dmx/glxProxy/g_disptab.h | 675 +++++ xorg-server/hw/dmx/glxProxy/g_renderswap.c | 2360 +++++++++++++++++ xorg-server/hw/dmx/glxProxy/global.c | 76 + xorg-server/hw/dmx/glxProxy/glxcmds.c | 3618 +++++++++++++++++++++++++++ xorg-server/hw/dmx/glxProxy/glxcmdsswap.c | 1057 ++++++++ xorg-server/hw/dmx/glxProxy/glxcontext.h | 116 + xorg-server/hw/dmx/glxProxy/glxdrawable.h | 71 + xorg-server/hw/dmx/glxProxy/glxerror.h | 57 + xorg-server/hw/dmx/glxProxy/glxext.c | 519 ++++ xorg-server/hw/dmx/glxProxy/glxext.h | 97 + xorg-server/hw/dmx/glxProxy/glxfbconfig.c | 111 + xorg-server/hw/dmx/glxProxy/glxfbconfig.h | 43 + xorg-server/hw/dmx/glxProxy/glxscreens.c | 382 +++ xorg-server/hw/dmx/glxProxy/glxscreens.h | 62 + xorg-server/hw/dmx/glxProxy/glxserver.h | 322 +++ xorg-server/hw/dmx/glxProxy/glxsingle.c | 1012 ++++++++ xorg-server/hw/dmx/glxProxy/glxsingle.h | 59 + xorg-server/hw/dmx/glxProxy/glxswap.c | 538 ++++ xorg-server/hw/dmx/glxProxy/glxswap.h | 46 + xorg-server/hw/dmx/glxProxy/glxutil.c | 119 + xorg-server/hw/dmx/glxProxy/glxutil.h | 53 + xorg-server/hw/dmx/glxProxy/glxvendor.c | 582 +++++ xorg-server/hw/dmx/glxProxy/glxvendor.h | 55 + xorg-server/hw/dmx/glxProxy/glxvisuals.c | 543 ++++ xorg-server/hw/dmx/glxProxy/glxvisuals.h | 55 + xorg-server/hw/dmx/glxProxy/render2swap.c | 347 +++ xorg-server/hw/dmx/glxProxy/renderpixswap.c | 389 +++ xorg-server/hw/dmx/glxProxy/unpack.h | 233 ++ 32 files changed, 15517 insertions(+) create mode 100644 xorg-server/hw/dmx/glxProxy/Makefile.am create mode 100644 xorg-server/hw/dmx/glxProxy/Makefile.in create mode 100644 xorg-server/hw/dmx/glxProxy/compsize.c create mode 100644 xorg-server/hw/dmx/glxProxy/g_disptab.c create mode 100644 xorg-server/hw/dmx/glxProxy/g_disptab.h create mode 100644 xorg-server/hw/dmx/glxProxy/g_renderswap.c create mode 100644 xorg-server/hw/dmx/glxProxy/global.c create mode 100644 xorg-server/hw/dmx/glxProxy/glxcmds.c create mode 100644 xorg-server/hw/dmx/glxProxy/glxcmdsswap.c create mode 100644 xorg-server/hw/dmx/glxProxy/glxcontext.h create mode 100644 xorg-server/hw/dmx/glxProxy/glxdrawable.h create mode 100644 xorg-server/hw/dmx/glxProxy/glxerror.h create mode 100644 xorg-server/hw/dmx/glxProxy/glxext.c create mode 100644 xorg-server/hw/dmx/glxProxy/glxext.h create mode 100644 xorg-server/hw/dmx/glxProxy/glxfbconfig.c create mode 100644 xorg-server/hw/dmx/glxProxy/glxfbconfig.h create mode 100644 xorg-server/hw/dmx/glxProxy/glxscreens.c create mode 100644 xorg-server/hw/dmx/glxProxy/glxscreens.h create mode 100644 xorg-server/hw/dmx/glxProxy/glxserver.h create mode 100644 xorg-server/hw/dmx/glxProxy/glxsingle.c create mode 100644 xorg-server/hw/dmx/glxProxy/glxsingle.h create mode 100644 xorg-server/hw/dmx/glxProxy/glxswap.c create mode 100644 xorg-server/hw/dmx/glxProxy/glxswap.h create mode 100644 xorg-server/hw/dmx/glxProxy/glxutil.c create mode 100644 xorg-server/hw/dmx/glxProxy/glxutil.h create mode 100644 xorg-server/hw/dmx/glxProxy/glxvendor.c create mode 100644 xorg-server/hw/dmx/glxProxy/glxvendor.h create mode 100644 xorg-server/hw/dmx/glxProxy/glxvisuals.c create mode 100644 xorg-server/hw/dmx/glxProxy/glxvisuals.h create mode 100644 xorg-server/hw/dmx/glxProxy/render2swap.c create mode 100644 xorg-server/hw/dmx/glxProxy/renderpixswap.c create mode 100644 xorg-server/hw/dmx/glxProxy/unpack.h (limited to 'xorg-server/hw/dmx/glxProxy') diff --git a/xorg-server/hw/dmx/glxProxy/Makefile.am b/xorg-server/hw/dmx/glxProxy/Makefile.am new file mode 100644 index 000000000..f99549817 --- /dev/null +++ b/xorg-server/hw/dmx/glxProxy/Makefile.am @@ -0,0 +1,44 @@ +noinst_LIBRARIES = libglxproxy.a + +libglxproxy_a_SOURCES = compsize.c \ + g_disptab.c \ + g_disptab.h \ + global.c \ + glxcmds.c \ + glxcmdsswap.c \ + glxcontext.h \ + glxdrawable.h \ + glxerror.h \ + glxext.c \ + glxext.h \ + glxfbconfig.c \ + glxfbconfig.h \ + glxscreens.c \ + glxscreens.h \ + glxserver.h \ + glxsingle.c \ + glxsingle.h \ + glxswap.c \ + glxswap.h \ + glxutil.c \ + glxutil.h \ + glxvendor.c \ + glxvendor.h \ + glxvisuals.c \ + glxvisuals.h \ + g_renderswap.c \ + render2swap.c \ + renderpixswap.c \ + unpack.h + +AM_CFLAGS = \ + @GLX_ARCH_DEFINES@ \ + $(DIX_CFLAGS) \ + -I$(top_srcdir)/hw/dmx \ + -I$(top_srcdir)/include \ + -I$(top_srcdir)/GL/include \ + -I$(top_builddir)/GL/include \ + -I@MESA_SOURCE@/include \ + -DHAVE_DMX_CONFIG_H \ + @DMXMODULES_CFLAGS@ \ + -I$(top_srcdir)/hw/xfree86/os-support diff --git a/xorg-server/hw/dmx/glxProxy/Makefile.in b/xorg-server/hw/dmx/glxProxy/Makefile.in new file mode 100644 index 000000000..5f1b1a6ac --- /dev/null +++ b/xorg-server/hw/dmx/glxProxy/Makefile.in @@ -0,0 +1,702 @@ +# Makefile.in generated by automake 1.10.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = hw/dmx/glxProxy +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ + $(top_builddir)/include/xorg-server.h \ + $(top_builddir)/include/dix-config.h \ + $(top_builddir)/include/xgl-config.h \ + $(top_builddir)/include/xorg-config.h \ + $(top_builddir)/include/xkb-config.h \ + $(top_builddir)/include/xwin-config.h \ + $(top_builddir)/include/kdrive-config.h +CONFIG_CLEAN_FILES = +LIBRARIES = $(noinst_LIBRARIES) +ARFLAGS = cru +libglxproxy_a_AR = $(AR) $(ARFLAGS) +libglxproxy_a_LIBADD = +am_libglxproxy_a_OBJECTS = compsize.$(OBJEXT) g_disptab.$(OBJEXT) \ + global.$(OBJEXT) glxcmds.$(OBJEXT) glxcmdsswap.$(OBJEXT) \ + glxext.$(OBJEXT) glxfbconfig.$(OBJEXT) glxscreens.$(OBJEXT) \ + glxsingle.$(OBJEXT) glxswap.$(OBJEXT) glxutil.$(OBJEXT) \ + glxvendor.$(OBJEXT) glxvisuals.$(OBJEXT) \ + g_renderswap.$(OBJEXT) render2swap.$(OBJEXT) \ + renderpixswap.$(OBJEXT) +libglxproxy_a_OBJECTS = $(am_libglxproxy_a_OBJECTS) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(libglxproxy_a_SOURCES) +DIST_SOURCES = $(libglxproxy_a_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ +ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +APPDEFAULTDIR = @APPDEFAULTDIR@ +APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ +APP_MAN_DIR = @APP_MAN_DIR@ +APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASE_FONT_PATH = @BASE_FONT_PATH@ +BUILD_DATE = @BUILD_DATE@ +BUILD_TIME = @BUILD_TIME@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DARWIN_LIBS = @DARWIN_LIBS@ +DBUS_CFLAGS = @DBUS_CFLAGS@ +DBUS_LIBS = @DBUS_LIBS@ +DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ +DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ +DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DGA_CFLAGS = @DGA_CFLAGS@ +DGA_LIBS = @DGA_LIBS@ +DIX_CFLAGS = @DIX_CFLAGS@ +DLLTOOL = @DLLTOOL@ +DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ +DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ +DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ +DMXMODULES_LIBS = @DMXMODULES_LIBS@ +DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ +DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ +DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ +DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ +DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ +DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ +DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ +DRIPROTO_LIBS = @DRIPROTO_LIBS@ +DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ +DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ +DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ +DSYMUTIL = @DSYMUTIL@ +DTRACE = @DTRACE@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +FILE_MAN_DIR = @FILE_MAN_DIR@ +FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ +FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ +FREETYPE_LIBS = @FREETYPE_LIBS@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ +GLX_DEFINES = @GLX_DEFINES@ +GL_CFLAGS = @GL_CFLAGS@ +GL_LIBS = @GL_LIBS@ +GREP = @GREP@ +HAL_CFLAGS = @HAL_CFLAGS@ +HAL_LIBS = @HAL_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ +KDRIVE_INCS = @KDRIVE_INCS@ +KDRIVE_LIBS = @KDRIVE_LIBS@ +KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ +KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ +KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ +LAUNCHD = @LAUNCHD@ +LDFLAGS = @LDFLAGS@ +LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ +LIBDRM_LIBS = @LIBDRM_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_MAN_DIR = @LIB_MAN_DIR@ +LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ +LINUXDOC = @LINUXDOC@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MAKE_HTML = @MAKE_HTML@ +MAKE_PDF = @MAKE_PDF@ +MAKE_PS = @MAKE_PS@ +MAKE_TEXT = @MAKE_TEXT@ +MESA_SOURCE = @MESA_SOURCE@ +MISC_MAN_DIR = @MISC_MAN_DIR@ +MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ +MKDIR_P = @MKDIR_P@ +MKFONTDIR = @MKFONTDIR@ +MKFONTSCALE = @MKFONTSCALE@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCCLD = @OBJCCLD@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJCLINK = @OBJCLINK@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ +OPENSSL_LIBS = @OPENSSL_LIBS@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ +PCIACCESS_LIBS = @PCIACCESS_LIBS@ +PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ +PERL = @PERL@ +PKG_CONFIG = @PKG_CONFIG@ +PROJECTROOT = @PROJECTROOT@ +PS2PDF = @PS2PDF@ +RANLIB = @RANLIB@ +RAWCPP = @RAWCPP@ +RAWCPPFLAGS = @RAWCPPFLAGS@ +SED = @SED@ +SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@ +SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ +STRIP = @STRIP@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ +VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@ +VENDOR_NAME = @VENDOR_NAME@ +VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ +VENDOR_RELEASE = @VENDOR_RELEASE@ +VERSION = @VERSION@ +X11APP_ARCHS = @X11APP_ARCHS@ +X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ +X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ +XDMCP_CFLAGS = @XDMCP_CFLAGS@ +XDMCP_LIBS = @XDMCP_LIBS@ +XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ +XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ +XDMX_CFLAGS = @XDMX_CFLAGS@ +XDMX_LIBS = @XDMX_LIBS@ +XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ +XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@ +XEGL_LIBS = @XEGL_LIBS@ +XEGL_SYS_LIBS = @XEGL_SYS_LIBS@ +XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ +XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@ +XEPHYR_INCS = @XEPHYR_INCS@ +XEPHYR_LIBS = @XEPHYR_LIBS@ +XF86CONFIGFILE = @XF86CONFIGFILE@ +XF86MISC_CFLAGS = @XF86MISC_CFLAGS@ +XF86MISC_LIBS = @XF86MISC_LIBS@ +XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@ +XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@ +XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@ +XGLMODULES_LIBS = @XGLMODULES_LIBS@ +XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@ +XGLXMODULES_LIBS = @XGLXMODULES_LIBS@ +XGLX_LIBS = @XGLX_LIBS@ +XGLX_SYS_LIBS = @XGLX_SYS_LIBS@ +XGL_LIBS = @XGL_LIBS@ +XGL_MODULE_PATH = @XGL_MODULE_PATH@ +XGL_SYS_LIBS = @XGL_SYS_LIBS@ +XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ +XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ +XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ +XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ +XLIB_CFLAGS = @XLIB_CFLAGS@ +XLIB_LIBS = @XLIB_LIBS@ +XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ +XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ +XNEST_LIBS = @XNEST_LIBS@ +XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ +XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@ +XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@ +XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@ +XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@ +XORG_CFLAGS = @XORG_CFLAGS@ +XORG_INCS = @XORG_INCS@ +XORG_LIBS = @XORG_LIBS@ +XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ +XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ +XORG_OS = @XORG_OS@ +XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XORG_SYS_LIBS = @XORG_SYS_LIBS@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ +XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ +XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ +XPRINT_CFLAGS = @XPRINT_CFLAGS@ +XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ +XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ +XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ +XSDL_INCS = @XSDL_INCS@ +XSDL_LIBS = @XSDL_LIBS@ +XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ +XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ +XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ +XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ +XSERVER_LIBS = @XSERVER_LIBS@ +XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ +XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ +XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ +XVFB_LIBS = @XVFB_LIBS@ +XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ +XWINMODULES_LIBS = @XWINMODULES_LIBS@ +XWIN_LIBS = @XWIN_LIBS@ +XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ +XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ +YACC = @YACC@ +YFLAGS = @YFLAGS@ +__XCONFIGFILE__ = @__XCONFIGFILE__@ +abi_ansic = @abi_ansic@ +abi_extension = @abi_extension@ +abi_font = @abi_font@ +abi_videodrv = @abi_videodrv@ +abi_xinput = @abi_xinput@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +driverdir = @driverdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +extdir = @extdir@ +ft_config = @ft_config@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +launchagentsdir = @launchagentsdir@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +logdir = @logdir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +moduledir = @moduledir@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sdkdir = @sdkdir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +xglmoduledir = @xglmoduledir@ +xpconfigdir = @xpconfigdir@ +noinst_LIBRARIES = libglxproxy.a +libglxproxy_a_SOURCES = compsize.c \ + g_disptab.c \ + g_disptab.h \ + global.c \ + glxcmds.c \ + glxcmdsswap.c \ + glxcontext.h \ + glxdrawable.h \ + glxerror.h \ + glxext.c \ + glxext.h \ + glxfbconfig.c \ + glxfbconfig.h \ + glxscreens.c \ + glxscreens.h \ + glxserver.h \ + glxsingle.c \ + glxsingle.h \ + glxswap.c \ + glxswap.h \ + glxutil.c \ + glxutil.h \ + glxvendor.c \ + glxvendor.h \ + glxvisuals.c \ + glxvisuals.h \ + g_renderswap.c \ + render2swap.c \ + renderpixswap.c \ + unpack.h + +AM_CFLAGS = \ + @GLX_ARCH_DEFINES@ \ + $(DIX_CFLAGS) \ + -I$(top_srcdir)/hw/dmx \ + -I$(top_srcdir)/include \ + -I$(top_srcdir)/GL/include \ + -I$(top_builddir)/GL/include \ + -I@MESA_SOURCE@/include \ + -DHAVE_DMX_CONFIG_H \ + @DMXMODULES_CFLAGS@ \ + -I$(top_srcdir)/hw/xfree86/os-support + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/dmx/glxProxy/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign hw/dmx/glxProxy/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +libglxproxy.a: $(libglxproxy_a_OBJECTS) $(libglxproxy_a_DEPENDENCIES) + -rm -f libglxproxy.a + $(libglxproxy_a_AR) libglxproxy.a $(libglxproxy_a_OBJECTS) $(libglxproxy_a_LIBADD) + $(RANLIB) libglxproxy.a + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compsize.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g_disptab.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g_renderswap.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/global.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glxcmds.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glxcmdsswap.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glxext.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glxfbconfig.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glxscreens.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glxsingle.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glxswap.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glxutil.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glxvendor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glxvisuals.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/render2swap.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/renderpixswap.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LIBRARIES) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/xorg-server/hw/dmx/glxProxy/compsize.c b/xorg-server/hw/dmx/glxProxy/compsize.c new file mode 100644 index 000000000..29669e318 --- /dev/null +++ b/xorg-server/hw/dmx/glxProxy/compsize.c @@ -0,0 +1,563 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ + +#include + +GLint __glFogiv_size(GLenum pname) +{ + switch (pname) { + case GL_FOG_COLOR: return 4; + case GL_FOG_DENSITY: return 1; + case GL_FOG_END: return 1; + case GL_FOG_MODE: return 1; + case GL_FOG_INDEX: return 1; + case GL_FOG_START: return 1; + default: + return 0; + } +} + +GLint __glFogfv_size(GLenum pname) +{ + return __glFogiv_size(pname); +} + +GLint __glCallLists_size(GLsizei n, GLenum type) +{ + GLint size; + + if (n < 0) return 0; + switch (type) { + case GL_BYTE: size = 1; break; + case GL_UNSIGNED_BYTE: size = 1; break; + case GL_SHORT: size = 2; break; + case GL_UNSIGNED_SHORT: size = 2; break; + case GL_INT: size = 4; break; + case GL_UNSIGNED_INT: size = 4; break; + case GL_FLOAT: size = 4; break; + case GL_2_BYTES: size = 2; break; + case GL_3_BYTES: size = 3; break; + case GL_4_BYTES: size = 4; break; + default: + return 0; + } + return n * size; +} + +GLint __glDrawPixels_size(GLenum format, GLenum type, GLsizei w, GLsizei h) +{ + GLint elements, esize; + + switch (format) { + case GL_COLOR_INDEX: + case GL_STENCIL_INDEX: + case GL_DEPTH_COMPONENT: + elements = 1; + break; + case GL_RED: + case GL_GREEN: + case GL_BLUE: + case GL_ALPHA: + case GL_LUMINANCE: + elements = 1; + break; + case GL_LUMINANCE_ALPHA: + elements = 2; + break; + case GL_RGB: + elements = 3; + break; + case GL_RGBA: + case GL_ABGR_EXT: + elements = 4; + break; + default: + return 0; + } + switch (type) { + case GL_BITMAP: + if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX) { + return (h * ((w+7)/8)); + } else { + return 0; + } + case GL_BYTE: + case GL_UNSIGNED_BYTE: + esize = 1; + break; + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + esize = 1; + elements = 1; + break; + case GL_SHORT: + case GL_UNSIGNED_SHORT: + esize = 2; + break; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + esize = 2; + elements = 1; + break; + case GL_INT: + case GL_UNSIGNED_INT: + case GL_FLOAT: + esize = 4; + break; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + esize = 4; + elements = 1; + break; + default: + return 0; + } + return (elements * esize * w * h); +} + +GLint __glBitmap_size(GLsizei w, GLsizei h) +{ + return __glDrawPixels_size(GL_COLOR_INDEX, GL_BITMAP, w, h); +} + +GLint __glTexGendv_size(GLenum e) +{ + switch (e) { + case GL_TEXTURE_GEN_MODE: + return 1; + case GL_OBJECT_PLANE: + case GL_EYE_PLANE: + return 4; + default: + return 0; + } +} + +GLint __glTexGenfv_size(GLenum e) +{ + return __glTexGendv_size(e); +} + +GLint __glTexGeniv_size(GLenum e) +{ + return __glTexGendv_size(e); +} + +GLint __glTexParameterfv_size(GLenum e) +{ + switch (e) { + case GL_TEXTURE_WRAP_S: + case GL_TEXTURE_WRAP_T: + case GL_TEXTURE_WRAP_R: + case GL_TEXTURE_MIN_FILTER: + case GL_TEXTURE_MAG_FILTER: + return 1; + case GL_TEXTURE_BORDER_COLOR: + return 4; + case GL_TEXTURE_PRIORITY: + return 1; + case GL_TEXTURE_MIN_LOD: + case GL_TEXTURE_MAX_LOD: + case GL_TEXTURE_BASE_LEVEL: + case GL_TEXTURE_MAX_LEVEL: + return 1; + default: + return 0; + } +} + +GLint __glTexParameteriv_size(GLenum e) +{ + return __glTexParameterfv_size(e); +} + +GLint __glTexEnvfv_size(GLenum e) +{ + switch (e) { + case GL_TEXTURE_ENV_MODE: + return 1; + case GL_TEXTURE_ENV_COLOR: + return 4; + default: + return 0; + } +} + +GLint __glTexEnviv_size(GLenum e) +{ + return __glTexEnvfv_size(e); +} + +GLint __glTexImage1D_size(GLenum format, GLenum type, GLsizei w) +{ + GLint elements, esize; + + if (w < 0) return 0; + switch (format) { + case GL_COLOR_INDEX: + elements = 1; + break; + case GL_RED: + case GL_GREEN: + case GL_BLUE: + case GL_ALPHA: + case GL_LUMINANCE: + elements = 1; + break; + case GL_LUMINANCE_ALPHA: + elements = 2; + break; + case GL_RGB: + elements = 3; + break; + case GL_RGBA: + case GL_ABGR_EXT: + elements = 4; + break; + default: + return 0; + } + switch (type) { + case GL_BITMAP: + if (format == GL_COLOR_INDEX) { + return (w+7)/8; + } else { + return 0; + } + case GL_BYTE: + case GL_UNSIGNED_BYTE: + esize = 1; + break; + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + esize = 1; + elements = 1; + break; + case GL_SHORT: + case GL_UNSIGNED_SHORT: + esize = 2; + break; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + esize = 2; + elements = 1; + break; + case GL_INT: + case GL_UNSIGNED_INT: + case GL_FLOAT: + esize = 4; + break; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + esize = 4; + elements = 1; + break; + default: + return 0; + } + return (elements * esize * w); +} + +GLint __glTexImage2D_size(GLenum format, GLenum type, GLsizei w, GLsizei h) +{ + GLint elements, esize; + + if (w < 0) return 0; + if (h < 0) return 0; + switch (format) { + case GL_COLOR_INDEX: + elements = 1; + break; + case GL_RED: + case GL_GREEN: + case GL_BLUE: + case GL_ALPHA: + case GL_LUMINANCE: + elements = 1; + break; + case GL_LUMINANCE_ALPHA: + elements = 2; + break; + case GL_RGB: + elements = 3; + break; + case GL_RGBA: + case GL_ABGR_EXT: + elements = 4; + break; + default: + return 0; + } + switch (type) { + case GL_BITMAP: + if (format == GL_COLOR_INDEX) { + return (h * ((w+7)/8)); + } else { + return 0; + } + case GL_BYTE: + case GL_UNSIGNED_BYTE: + esize = 1; + break; + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + esize = 1; + elements = 1; + break; + case GL_SHORT: + case GL_UNSIGNED_SHORT: + esize = 2; + break; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + esize = 2; + elements = 1; + break; + case GL_INT: + case GL_UNSIGNED_INT: + case GL_FLOAT: + esize = 4; + break; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + esize = 4; + elements = 1; + break; + default: + return 0; + } + return (elements * esize * w * h); +} + +GLint __glTexImage3D_size(GLenum format, GLenum type, GLsizei w, GLsizei h, + GLsizei d) +{ + GLint elements, esize; + + if (w < 0) return 0; + if (h < 0) return 0; + if (d < 0) return 0; + switch (format) { + case GL_COLOR_INDEX: + elements = 1; + break; + case GL_RED: + case GL_GREEN: + case GL_BLUE: + case GL_ALPHA: + case GL_LUMINANCE: + elements = 1; + break; + case GL_LUMINANCE_ALPHA: + elements = 2; + break; + case GL_RGB: + elements = 3; + break; + case GL_RGBA: + case GL_ABGR_EXT: + elements = 4; + break; + default: + return 0; + } + switch (type) { + case GL_BITMAP: + if (format == GL_COLOR_INDEX) { + return (d * (h * ((w+7)/8))); + } else { + return 0; + } + case GL_BYTE: + case GL_UNSIGNED_BYTE: + esize = 1; + break; + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + esize = 1; + elements = 1; + break; + case GL_SHORT: + case GL_UNSIGNED_SHORT: + esize = 2; + break; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + esize = 2; + elements = 1; + break; + case GL_INT: + case GL_UNSIGNED_INT: + case GL_FLOAT: + esize = 4; + break; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + esize = 4; + elements = 1; + break; + default: + return 0; + } + return (elements * esize * w * h * d); +} + +GLint __glLightfv_size(GLenum pname) +{ + switch (pname) { + case GL_SPOT_EXPONENT: return 1; + case GL_SPOT_CUTOFF: return 1; + case GL_AMBIENT: return 4; + case GL_DIFFUSE: return 4; + case GL_SPECULAR: return 4; + case GL_POSITION: return 4; + case GL_SPOT_DIRECTION: return 3; + case GL_CONSTANT_ATTENUATION: return 1; + case GL_LINEAR_ATTENUATION: return 1; + case GL_QUADRATIC_ATTENUATION: return 1; + default: + return 0; + } +} + +GLint __glLightiv_size(GLenum pname) +{ + return __glLightfv_size(pname); +} + +GLint __glLightModelfv_size(GLenum pname) +{ + switch (pname) { + case GL_LIGHT_MODEL_AMBIENT: return 4; + case GL_LIGHT_MODEL_LOCAL_VIEWER: return 1; + case GL_LIGHT_MODEL_TWO_SIDE: return 1; + case GL_LIGHT_MODEL_COLOR_CONTROL: return 1; + default: + return 0; + } +} + +GLint __glLightModeliv_size(GLenum pname) +{ + return __glLightModelfv_size(pname); +} + +GLint __glMaterialfv_size(GLenum pname) +{ + switch (pname) { + case GL_SHININESS: return 1; + case GL_EMISSION: return 4; + case GL_AMBIENT: return 4; + case GL_DIFFUSE: return 4; + case GL_SPECULAR: return 4; + case GL_AMBIENT_AND_DIFFUSE: return 4; + case GL_COLOR_INDEXES: return 3; + default: + return 0; + } +} + +GLint __glMaterialiv_size(GLenum pname) +{ + return __glMaterialfv_size(pname); +} + +GLint __glColorTableParameterfv_size(GLenum pname) +{ + switch (pname) { + case GL_COLOR_TABLE_FORMAT: + case GL_COLOR_TABLE_WIDTH: + case GL_COLOR_TABLE_RED_SIZE: + case GL_COLOR_TABLE_GREEN_SIZE: + case GL_COLOR_TABLE_BLUE_SIZE: + case GL_COLOR_TABLE_ALPHA_SIZE: + case GL_COLOR_TABLE_LUMINANCE_SIZE: + case GL_COLOR_TABLE_INTENSITY_SIZE: + return 1; + case GL_COLOR_TABLE_SCALE: + case GL_COLOR_TABLE_BIAS: + return 4; + default: + return -1; + } +} + +GLint __glColorTableParameteriv_size(GLenum pname) +{ + return __glColorTableParameterfv_size(pname); +} + +GLint __glConvolutionParameterfv_size(GLenum pname) +{ + switch(pname) { + case GL_CONVOLUTION_BORDER_MODE: + return 1; + case GL_CONVOLUTION_BORDER_COLOR: + case GL_CONVOLUTION_FILTER_SCALE: + case GL_CONVOLUTION_FILTER_BIAS: + return 4; + default: /* error: bad enum value */ + return -1; + } +} + +GLint __glConvolutionParameteriv_size(GLenum pname) +{ + return __glConvolutionParameterfv_size(pname); +} diff --git a/xorg-server/hw/dmx/glxProxy/g_disptab.c b/xorg-server/hw/dmx/glxProxy/g_disptab.c new file mode 100644 index 000000000..124a65511 --- /dev/null +++ b/xorg-server/hw/dmx/glxProxy/g_disptab.c @@ -0,0 +1,611 @@ +/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. +*/ + +#include "glxserver.h" +#include "glxext.h" +#include "g_disptab.h" +#include "glxsingle.h" + +__GLXdispatchSingleProcPtr __glXSingleTable[] = { + __glXNoSuchSingleOpcode, + __glXRender, + __glXRenderLarge, + __glXCreateContext, + __glXDestroyContext, + __glXMakeCurrent, + __glXIsDirect, + __glXQueryVersion, + __glXWaitGL, + __glXWaitX, + __glXCopyContext, + __glXSwapBuffers, + __glXUseXFont, + __glXCreateGLXPixmap, + __glXGetVisualConfigs, + __glXDestroyGLXPixmap, + __glXVendorPrivate, + __glXVendorPrivateWithReply, + __glXQueryExtensionsString, + __glXQueryServerString, + __glXClientInfo, + __glXGetFBConfigs, /* __glXGetFBConfigs */ + __glXCreatePixmap, /* __glXCreatePixmap,*/ + __glXDestroyGLXPixmap, /* __glXDestroyPixmap,*/ + __glXCreateNewContext, /* __glXCreateNewContext,*/ + __glXQueryContext, /* __glXQueryContext,*/ + __glXMakeContextCurrent, /* __glXMakeContextCurrent,*/ + __glXCreatePbuffer, /* __glXCreatePbuffer,*/ + __glXDestroyPbuffer, /* __glXDestroyPbuffer,*/ + __glXGetDrawableAttributes, /* __glXGetDrawableAttributes,*/ + __glXChangeDrawableAttributes, /* __glXChangeDrawableAttributes,*/ + __glXCreateWindow, /* __glXCreateWindow,*/ + __glXDestroyWindow, /* __glXDestroyWindow,*/ + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXForwardSingleReq, /* __glXDisp_NewList, */ + __glXForwardSingleReq, /* __glXDisp_EndList, */ + __glXForwardSingleReq, /* __glXDisp_DeleteLists, */ + __glXForwardPipe0WithReply, /* __glXDisp_GenLists, */ + __glXForwardSingleReq, /* __glXDisp_FeedbackBuffer, */ + __glXForwardSingleReq, /* __glXDisp_SelectBuffer, */ + __glXForwardAllWithReply, /* __glXDisp_RenderMode, */ + __glXForwardAllWithReply, /* __glXDisp_Finish, */ + __glXForwardSingleReq, /* __glXDisp_PixelStoref, */ + __glXForwardSingleReq, /* __glXDisp_PixelStorei, */ + __glXDisp_ReadPixels, /* __glXDisp_ReadPixels, */ + __glXForwardPipe0WithReply, /* __glXDisp_GetBooleanv, */ + __glXForwardPipe0WithReply, /* __glXDisp_GetClipPlane, */ + __glXForwardPipe0WithReply, /* __glXDisp_GetDoublev, */ + __glXForwardPipe0WithReply, /* __glXDisp_GetError, */ + __glXForwardPipe0WithReply, /* __glXDisp_GetFloatv, */ + __glXForwardPipe0WithReply, /* __glXDisp_GetIntegerv, */ + __glXForwardPipe0WithReply, /* __glXDisp_GetLightfv, */ + __glXForwardPipe0WithReply, /* __glXDisp_GetLightiv, */ + __glXForwardPipe0WithReply, /* __glXDisp_GetMapdv, */ + __glXForwardPipe0WithReply, /* __glXDisp_GetMapfv, */ + __glXForwardPipe0WithReply, /* __glXDisp_GetMapiv, */ + __glXForwardPipe0WithReply, /* __glXDisp_GetMaterialfv, */ + __glXForwardPipe0WithReply, /* __glXDisp_GetMaterialiv, */ + __glXForwardPipe0WithReply, /* __glXDisp_GetPixelMapfv, */ + __glXForwardPipe0WithReply, /* __glXDisp_GetPixelMapuiv, */ + __glXForwardPipe0WithReply, /* __glXDisp_GetPixelMapusv, */ + __glXForwardPipe0WithReply, /* __glXDisp_GetPolygonStipple, */ + __glXForwardPipe0WithReply, /* __glXDisp_GetString, */ + __glXForwardPipe0WithReply, /* __glXDisp_GetTexEnvfv, */ + __glXForwardPipe0WithReply, /* __glXDisp_GetTexEnviv, */ + __glXForwardPipe0WithReply, /* __glXDisp_GetTexGendv, */ + __glXForwardPipe0WithReply, /* __glXDisp_GetTexGenfv, */ + __glXForwardPipe0WithReply, /* __glXDisp_GetTexGeniv, */ + __glXForwardPipe0WithReply, /* __glXDisp_GetTexImage, */ + __glXForwardPipe0WithReply, /* __glXDisp_GetTexParameterfv, */ + __glXForwardPipe0WithReply, /* __glXDisp_GetTexParameteriv, */ + __glXForwardPipe0WithReply, /* __glXDisp_GetTexLevelParameterfv, */ + __glXForwardPipe0WithReply, /* __glXDisp_GetTexLevelParameteriv, */ + __glXForwardPipe0WithReply, /* __glXDisp_IsEnabled, */ + __glXForwardPipe0WithReply, /* __glXDisp_IsList, */ + __glXForwardSingleReq, /* __glXDisp_Flush, */ + __glXForwardPipe0WithReply, /* __glXDisp_AreTexturesResident, */ + __glXForwardSingleReq, /* __glXDisp_DeleteTextures, */ + __glXForwardAllWithReply, /* __glXDisp_GenTextures, */ + __glXForwardPipe0WithReply, /* __glXDisp_IsTexture, */ + __glXForwardPipe0WithReply, /* __glXDisp_GetColorTable, */ + __glXForwardPipe0WithReply, /* __glXDisp_GetColorTableParameterfv, */ + __glXForwardPipe0WithReply, /* __glXDisp_GetColorTableParameteriv, */ + __glXForwardPipe0WithReply, /* __glXDisp_GetConvolutionFilter, */ + __glXForwardPipe0WithReply, /* __glXDisp_GetConvolutionParameterfv, */ + __glXForwardPipe0WithReply, /* __glXDisp_GetConvolutionParameteriv, */ + __glXForwardPipe0WithReply, /* __glXDisp_GetSeparableFilter, */ + __glXForwardPipe0WithReply, /* __glXDisp_GetHistogram, */ + __glXForwardPipe0WithReply, /* __glXDisp_GetHistogramParameterfv, */ + __glXForwardPipe0WithReply, /* __glXDisp_GetHistogramParameteriv, */ + __glXForwardPipe0WithReply, /* __glXDisp_GetMinmax, */ + __glXForwardPipe0WithReply, /* __glXDisp_GetMinmaxParameterfv, */ + __glXForwardPipe0WithReply, /* __glXDisp_GetMinmaxParameteriv, */ +}; + +__GLXdispatchSingleProcPtr __glXSwapSingleTable[] = { + __glXNoSuchSingleOpcode, + __glXSwapRender, + __glXSwapRenderLarge, + __glXSwapCreateContext, + __glXSwapDestroyContext, + __glXSwapMakeCurrent, + __glXSwapIsDirect, + __glXSwapQueryVersion, + __glXSwapWaitGL, + __glXSwapWaitX, + __glXSwapCopyContext, + __glXSwapSwapBuffers, + __glXSwapUseXFont, + __glXSwapCreateGLXPixmap, + __glXSwapGetVisualConfigs, + __glXSwapDestroyGLXPixmap, + __glXSwapVendorPrivate, + __glXSwapVendorPrivateWithReply, + __glXSwapQueryExtensionsString, + __glXSwapQueryServerString, + __glXSwapClientInfo, + __glXSwapGetFBConfigs, + __glXSwapCreatePixmap, + __glXSwapDestroyGLXPixmap, + __glXSwapCreateNewContext, + __glXSwapQueryContext, + __glXSwapMakeContextCurrent, + __glXSwapCreatePbuffer, + __glXSwapDestroyPbuffer, + __glXSwapGetDrawableAttributes, + __glXSwapChangeDrawableAttributes, + __glXSwapCreateWindow, + __glXSwapDestroyWindow, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, + __glXForwardSingleReqSwap, /* __glXDisp_NewList, */ + __glXForwardSingleReqSwap, /* __glXDisp_EndList, */ + __glXForwardSingleReqSwap, /* __glXDisp_DeleteLists, */ + __glXForwardPipe0WithReplySwap, /* __glXDisp_GenLists, */ + __glXForwardSingleReqSwap, /* __glXDisp_FeedbackBuffer, */ + __glXForwardSingleReqSwap, /* __glXDisp_SelectBuffer, */ + __glXForwardAllWithReplySwapiv, /* __glXDisp_RenderMode, */ + __glXForwardAllWithReplySwap, /* __glXDisp_Finish, */ + __glXForwardSingleReqSwap, /* __glXDisp_PixelStoref, */ + __glXForwardSingleReqSwap, /* __glXDisp_PixelStorei, */ + __glXDisp_ReadPixels, /* __glXDisp_ReadPixels, */ + __glXForwardPipe0WithReplySwap, /* __glXDisp_GetBooleanv, */ + __glXForwardPipe0WithReplySwapdv, /* __glXDisp_GetClipPlane, */ + __glXForwardPipe0WithReplySwapdv, /* __glXDisp_GetDoublev, */ + __glXForwardPipe0WithReplySwap, /* __glXDisp_GetError, */ + __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetFloatv, */ + __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetIntegerv, */ + __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetLightfv, */ + __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetLightiv, */ + __glXForwardPipe0WithReplySwapdv, /* __glXDisp_GetMapdv, */ + __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetMapfv, */ + __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetMapiv, */ + __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetMaterialfv, */ + __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetMaterialiv, */ + __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetPixelMapfv, */ + __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetPixelMapuiv, */ + __glXForwardPipe0WithReplySwapsv, /* __glXDisp_GetPixelMapusv, */ + __glXForwardPipe0WithReplySwap, /* __glXDisp_GetPolygonStipple, */ + __glXForwardPipe0WithReplySwap, /* __glXDisp_GetString, */ + __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexEnvfv, */ + __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexEnviv, */ + __glXForwardPipe0WithReplySwapdv, /* __glXDisp_GetTexGendv, */ + __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexGenfv, */ + __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexGeniv, */ + __glXDispSwap_GetTexImage, /* __glXDisp_GetTexImage, */ + __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexParameterfv, */ + __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexParameteriv, */ + __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexLevelParameterfv, */ + __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexLevelParameteriv, */ + __glXForwardPipe0WithReplySwap, /* __glXDisp_IsEnabled, */ + __glXForwardPipe0WithReplySwap, /* __glXDisp_IsList, */ + __glXForwardSingleReqSwap, /* __glXDisp_Flush, */ + __glXForwardPipe0WithReplySwap, /* __glXDisp_AreTexturesResident, */ + __glXForwardSingleReqSwap, /* __glXDisp_DeleteTextures, */ + __glXForwardAllWithReplySwapiv, /* __glXDisp_GenTextures, */ + __glXForwardPipe0WithReplySwap, /* __glXDisp_IsTexture, */ + __glXDispSwap_GetColorTable, /* __glXDisp_GetColorTable, */ + __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetColorTableParameterfv, */ + __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetColorTableParameteriv, */ + __glXDispSwap_GetColorTable, /* __glXDisp_GetConvolutionFilter, */ + __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetConvolutionParameterfv, */ + __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetConvolutionParameteriv, */ + __glXDispSwap_GetColorTable, /* __glXDisp_GetSeparableFilter, */ + __glXDispSwap_GetColorTable, /* __glXDisp_GetHistogram, */ + __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetHistogramParameterfv, */ + __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetHistogramParameteriv, */ + __glXDispSwap_GetColorTable, /* __glXDisp_GetMinmax, */ + __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetMinmaxParameterfv, */ + __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetMinmaxParameteriv, */ +}; + +__GLXdispatchRenderProcPtr __glXSwapRenderTable[] = { + __glXNoSuchRenderOpcode, + __glXDispSwap_CallList, + __glXDispSwap_CallLists, + __glXDispSwap_ListBase, + __glXDispSwap_Begin, + __glXDispSwap_Bitmap, + __glXDispSwap_Color3bv, + __glXDispSwap_Color3dv, + __glXDispSwap_Color3fv, + __glXDispSwap_Color3iv, + __glXDispSwap_Color3sv, + __glXDispSwap_Color3ubv, + __glXDispSwap_Color3uiv, + __glXDispSwap_Color3usv, + __glXDispSwap_Color4bv, + __glXDispSwap_Color4dv, + __glXDispSwap_Color4fv, + __glXDispSwap_Color4iv, + __glXDispSwap_Color4sv, + __glXDispSwap_Color4ubv, + __glXDispSwap_Color4uiv, + __glXDispSwap_Color4usv, + __glXDispSwap_EdgeFlagv, + __glXDispSwap_End, + __glXDispSwap_Indexdv, + __glXDispSwap_Indexfv, + __glXDispSwap_Indexiv, + __glXDispSwap_Indexsv, + __glXDispSwap_Normal3bv, + __glXDispSwap_Normal3dv, + __glXDispSwap_Normal3fv, + __glXDispSwap_Normal3iv, + __glXDispSwap_Normal3sv, + __glXDispSwap_RasterPos2dv, + __glXDispSwap_RasterPos2fv, + __glXDispSwap_RasterPos2iv, + __glXDispSwap_RasterPos2sv, + __glXDispSwap_RasterPos3dv, + __glXDispSwap_RasterPos3fv, + __glXDispSwap_RasterPos3iv, + __glXDispSwap_RasterPos3sv, + __glXDispSwap_RasterPos4dv, + __glXDispSwap_RasterPos4fv, + __glXDispSwap_RasterPos4iv, + __glXDispSwap_RasterPos4sv, + __glXDispSwap_Rectdv, + __glXDispSwap_Rectfv, + __glXDispSwap_Rectiv, + __glXDispSwap_Rectsv, + __glXDispSwap_TexCoord1dv, + __glXDispSwap_TexCoord1fv, + __glXDispSwap_TexCoord1iv, + __glXDispSwap_TexCoord1sv, + __glXDispSwap_TexCoord2dv, + __glXDispSwap_TexCoord2fv, + __glXDispSwap_TexCoord2iv, + __glXDispSwap_TexCoord2sv, + __glXDispSwap_TexCoord3dv, + __glXDispSwap_TexCoord3fv, + __glXDispSwap_TexCoord3iv, + __glXDispSwap_TexCoord3sv, + __glXDispSwap_TexCoord4dv, + __glXDispSwap_TexCoord4fv, + __glXDispSwap_TexCoord4iv, + __glXDispSwap_TexCoord4sv, + __glXDispSwap_Vertex2dv, + __glXDispSwap_Vertex2fv, + __glXDispSwap_Vertex2iv, + __glXDispSwap_Vertex2sv, + __glXDispSwap_Vertex3dv, + __glXDispSwap_Vertex3fv, + __glXDispSwap_Vertex3iv, + __glXDispSwap_Vertex3sv, + __glXDispSwap_Vertex4dv, + __glXDispSwap_Vertex4fv, + __glXDispSwap_Vertex4iv, + __glXDispSwap_Vertex4sv, + __glXDispSwap_ClipPlane, + __glXDispSwap_ColorMaterial, + __glXDispSwap_CullFace, + __glXDispSwap_Fogf, + __glXDispSwap_Fogfv, + __glXDispSwap_Fogi, + __glXDispSwap_Fogiv, + __glXDispSwap_FrontFace, + __glXDispSwap_Hint, + __glXDispSwap_Lightf, + __glXDispSwap_Lightfv, + __glXDispSwap_Lighti, + __glXDispSwap_Lightiv, + __glXDispSwap_LightModelf, + __glXDispSwap_LightModelfv, + __glXDispSwap_LightModeli, + __glXDispSwap_LightModeliv, + __glXDispSwap_LineStipple, + __glXDispSwap_LineWidth, + __glXDispSwap_Materialf, + __glXDispSwap_Materialfv, + __glXDispSwap_Materiali, + __glXDispSwap_Materialiv, + __glXDispSwap_PointSize, + __glXDispSwap_PolygonMode, + __glXDispSwap_PolygonStipple, + __glXDispSwap_Scissor, + __glXDispSwap_ShadeModel, + __glXDispSwap_TexParameterf, + __glXDispSwap_TexParameterfv, + __glXDispSwap_TexParameteri, + __glXDispSwap_TexParameteriv, + __glXDispSwap_TexImage1D, + __glXDispSwap_TexImage2D, + __glXDispSwap_TexEnvf, + __glXDispSwap_TexEnvfv, + __glXDispSwap_TexEnvi, + __glXDispSwap_TexEnviv, + __glXDispSwap_TexGend, + __glXDispSwap_TexGendv, + __glXDispSwap_TexGenf, + __glXDispSwap_TexGenfv, + __glXDispSwap_TexGeni, + __glXDispSwap_TexGeniv, + __glXDispSwap_InitNames, + __glXDispSwap_LoadName, + __glXDispSwap_PassThrough, + __glXDispSwap_PopName, + __glXDispSwap_PushName, + __glXDispSwap_DrawBuffer, + __glXDispSwap_Clear, + __glXDispSwap_ClearAccum, + __glXDispSwap_ClearIndex, + __glXDispSwap_ClearColor, + __glXDispSwap_ClearStencil, + __glXDispSwap_ClearDepth, + __glXDispSwap_StencilMask, + __glXDispSwap_ColorMask, + __glXDispSwap_DepthMask, + __glXDispSwap_IndexMask, + __glXDispSwap_Accum, + __glXDispSwap_Disable, + __glXDispSwap_Enable, + __glXNoSuchRenderOpcode, + __glXDispSwap_PopAttrib, + __glXDispSwap_PushAttrib, + __glXDispSwap_Map1d, + __glXDispSwap_Map1f, + __glXDispSwap_Map2d, + __glXDispSwap_Map2f, + __glXDispSwap_MapGrid1d, + __glXDispSwap_MapGrid1f, + __glXDispSwap_MapGrid2d, + __glXDispSwap_MapGrid2f, + __glXDispSwap_EvalCoord1dv, + __glXDispSwap_EvalCoord1fv, + __glXDispSwap_EvalCoord2dv, + __glXDispSwap_EvalCoord2fv, + __glXDispSwap_EvalMesh1, + __glXDispSwap_EvalPoint1, + __glXDispSwap_EvalMesh2, + __glXDispSwap_EvalPoint2, + __glXDispSwap_AlphaFunc, + __glXDispSwap_BlendFunc, + __glXDispSwap_LogicOp, + __glXDispSwap_StencilFunc, + __glXDispSwap_StencilOp, + __glXDispSwap_DepthFunc, + __glXDispSwap_PixelZoom, + __glXDispSwap_PixelTransferf, + __glXDispSwap_PixelTransferi, + __glXDispSwap_PixelMapfv, + __glXDispSwap_PixelMapuiv, + __glXDispSwap_PixelMapusv, + __glXDispSwap_ReadBuffer, + __glXDispSwap_CopyPixels, + __glXDispSwap_DrawPixels, + __glXDispSwap_DepthRange, + __glXDispSwap_Frustum, + __glXDispSwap_LoadIdentity, + __glXDispSwap_LoadMatrixf, + __glXDispSwap_LoadMatrixd, + __glXDispSwap_MatrixMode, + __glXDispSwap_MultMatrixf, + __glXDispSwap_MultMatrixd, + __glXDispSwap_Ortho, + __glXDispSwap_PopMatrix, + __glXDispSwap_PushMatrix, + __glXDispSwap_Rotated, + __glXDispSwap_Rotatef, + __glXDispSwap_Scaled, + __glXDispSwap_Scalef, + __glXDispSwap_Translated, + __glXDispSwap_Translatef, + __glXDispSwap_Viewport, + __glXDispSwap_PolygonOffset, + __glXDispSwap_DrawArrays, + __glXDispSwap_Indexubv, + __glXDispSwap_ColorSubTable, + __glXDispSwap_CopyColorSubTable, + __glXDispSwap_ActiveTextureARB, + __glXDispSwap_MultiTexCoord1dvARB, + __glXDispSwap_MultiTexCoord1fvARB, + __glXDispSwap_MultiTexCoord1ivARB, + __glXDispSwap_MultiTexCoord1svARB, + __glXDispSwap_MultiTexCoord2dvARB, + __glXDispSwap_MultiTexCoord2fvARB, + __glXDispSwap_MultiTexCoord2ivARB, + __glXDispSwap_MultiTexCoord2svARB, + __glXDispSwap_MultiTexCoord3dvARB, + __glXDispSwap_MultiTexCoord3fvARB, + __glXDispSwap_MultiTexCoord3ivARB, + __glXDispSwap_MultiTexCoord3svARB, + __glXDispSwap_MultiTexCoord4dvARB, + __glXDispSwap_MultiTexCoord4fvARB, + __glXDispSwap_MultiTexCoord4ivARB, + __glXDispSwap_MultiTexCoord4svARB, +}; + +__GLXRenderSwapInfo __glXSwapRenderTable_EXT[] = +{ + {4, 4, NULL}, /* X_GLrop_BlendColorEXT */ + {4, 1, NULL}, /* X_GLrop_BlendEquationEXT */ + {4, 2, NULL}, /* X_GLrop_PolygonOffsetEXT */ + {4, 0, __glXDispSwap_TexSubImage1D}, /* X_GLrop_TexSubImage1DEXT */ + {4, 0, __glXDispSwap_TexSubImage2D}, /* X_GLrop_TexSubImage2DEXT */ + {4, 0, __glXDispSwap_ConvolutionFilter1D}, /* X_GLrop_ConvolutionFilter1DEXT */ + {4, 0, __glXDispSwap_ConvolutionFilter2D}, /* X_GLrop_ConvolutionFilter2DEXT */ + {4, 3, NULL}, /* X_GLrop_ConvolutionParameterfEXT */ + {4, 0, __glXDispSwap_ConvolutionParameterfv}, /* X_GLrop_ConvolutionParameterfvEXT */ + {4, 3, NULL}, /* X_GLrop_ConvolutionParameteriEXT */ + {4, 0, __glXDispSwap_ConvolutionParameteriv}, /* X_GLrop_ConvolutionParameterivEXT */ + {4, 0, __glXDispSwap_CopyConvolutionFilter1D}, /* X_GLrop_CopyConvolutionFilter1DEXT */ + {4, 0, __glXDispSwap_CopyConvolutionFilter2D}, /* X_GLrop_CopyConvolutionFilter2DEXT */ + {4, 0, __glXDispSwap_SeparableFilter2D}, /* X_GLrop_SeparableFilter2DEXT */ + {4, 3, NULL}, /* X_GLrop_HistogramEXT */ + {4, 2, NULL}, /* X_GLrop_MinmaxEXT */ + {4, 1, NULL}, /* X_GLrop_ResetHistogramEXT */ + {4, 1, NULL}, /* X_GLrop_ResetMinmaxEXT */ + {4, 0, __glXDispSwap_TexImage3D}, /* X_GLrop_TexImage3DEXT */ + {4, 0, __glXDispSwap_TexSubImage3D}, /* X_GLrop_TexSubImage3DEXT */ + {4, 0, __glXDispSwap_DrawArrays}, /* X_GLrop_DrawArraysEXT */ + {4, 2, NULL}, /* X_GLrop_BindTextureEXT */ + {4, 0, __glXDispSwap_PrioritizeTextures}, /* X_GLrop_PrioritizeTexturesEXT */ + {4, 0, __glXDispSwap_CopyTexImage1D}, /* X_GLrop_CopyTexImage1DEXT */ + {4, 0, __glXDispSwap_CopyTexImage2D}, /* X_GLrop_CopyTexImage2DEXT */ + {4, 0, __glXDispSwap_CopyTexSubImage1D}, /* X_GLrop_CopyTexSubImage1DEXT */ + {4, 0, __glXDispSwap_CopyTexSubImage2D}, /* X_GLrop_CopyTexSubImage2DEXT */ + {4, 0, __glXDispSwap_CopyTexSubImage3D}, /* X_GLrop_CopyTexSubImage3DEXT */ + +}; + diff --git a/xorg-server/hw/dmx/glxProxy/g_disptab.h b/xorg-server/hw/dmx/glxProxy/g_disptab.h new file mode 100644 index 000000000..f02e4f59c --- /dev/null +++ b/xorg-server/hw/dmx/glxProxy/g_disptab.h @@ -0,0 +1,675 @@ +/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ +#ifndef _GLX_g_disptab_h_ +#define _GLX_g_disptab_h_ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. +*/ + +extern int __glXRender(__GLXclientState*, GLbyte*); +extern int __glXRenderLarge(__GLXclientState*, GLbyte*); +extern int __glXSendLargeCommand(__GLXclientState *cl, GLXContextTag contextTag); +extern int __glXCreateContext(__GLXclientState*, GLbyte*); +extern int __glXCreateNewContext(__GLXclientState *cl, GLbyte *pc); +extern int __glXDestroyContext(__GLXclientState*, GLbyte*); +extern int __glXMakeCurrent(__GLXclientState*, GLbyte*); +extern int __glXMakeContextCurrent(__GLXclientState*, GLbyte*); +extern int __glXCreatePbuffer(__GLXclientState *cl, GLbyte *pc); +extern int __glXDestroyPbuffer(__GLXclientState *cl, GLbyte *pc); +extern int __glXGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc); +extern int __glXChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc); +extern int __glXIsDirect(__GLXclientState*, GLbyte*); +extern int __glXQueryVersion(__GLXclientState*, GLbyte*); +extern int __glXWaitGL(__GLXclientState*, GLbyte*); +extern int __glXWaitX(__GLXclientState*, GLbyte*); +extern int __glXCopyContext(__GLXclientState*, GLbyte*); +extern int __glXSwapBuffers(__GLXclientState*, GLbyte*); +extern int __glXUseXFont(__GLXclientState*, GLbyte*); +extern int __glXCreateGLXPixmap(__GLXclientState*, GLbyte*); +extern int __glXCreatePixmap(__GLXclientState *cl, GLbyte *pc); +extern int __glXGetVisualConfigs(__GLXclientState*, GLbyte*); +extern int __glXDestroyGLXPixmap(__GLXclientState*, GLbyte*); +extern int __glXVendorPrivate(__GLXclientState*, GLbyte*); +extern int __glXVendorPrivateWithReply(__GLXclientState*, GLbyte*); +extern int __glXQueryExtensionsString(__GLXclientState*, GLbyte*); +extern int __glXQueryServerString(__GLXclientState*, GLbyte*); +extern int __glXClientInfo(__GLXclientState*, GLbyte*); +extern int __glXGetFBConfigs(__GLXclientState*, GLbyte*); +extern int __glXCreateWindow(__GLXclientState *cl, GLbyte *pc); +extern int __glXDestroyWindow(__GLXclientState *cl, GLbyte *pc); +extern int __glXQueryContext(__GLXclientState *cl, GLbyte *pc); +extern int __glXDisp_NewList(__GLXclientState*, GLbyte*); +extern int __glXDisp_EndList(__GLXclientState*, GLbyte*); +extern int __glXDisp_DeleteLists(__GLXclientState*, GLbyte*); +extern int __glXDisp_GenLists(__GLXclientState*, GLbyte*); +extern int __glXDisp_FeedbackBuffer(__GLXclientState*, GLbyte*); +extern int __glXDisp_SelectBuffer(__GLXclientState*, GLbyte*); +extern int __glXDisp_RenderMode(__GLXclientState*, GLbyte*); +extern int __glXDisp_Finish(__GLXclientState*, GLbyte*); +extern int __glXDisp_PixelStoref(__GLXclientState*, GLbyte*); +extern int __glXDisp_PixelStorei(__GLXclientState*, GLbyte*); +extern int __glXDisp_ReadPixels(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetBooleanv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetClipPlane(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetDoublev(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetError(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetFloatv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetIntegerv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetLightfv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetLightiv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetMapdv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetMapfv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetMapiv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetMaterialfv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetMaterialiv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetPixelMapfv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetPixelMapuiv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetPixelMapusv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetPolygonStipple(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetString(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetTexEnvfv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetTexEnviv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetTexGendv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetTexGenfv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetTexGeniv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetTexImage(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetTexParameterfv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetTexParameteriv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetTexLevelParameterfv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetTexLevelParameteriv(__GLXclientState*, GLbyte*); +extern int __glXDisp_IsEnabled(__GLXclientState*, GLbyte*); +extern int __glXDisp_IsList(__GLXclientState*, GLbyte*); +extern int __glXDisp_Flush(__GLXclientState*, GLbyte*); +extern int __glXDisp_AreTexturesResident(__GLXclientState*, GLbyte*); +extern int __glXDisp_DeleteTextures(__GLXclientState*, GLbyte*); +extern int __glXDisp_GenTextures(__GLXclientState*, GLbyte*); +extern int __glXDisp_IsTexture(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetColorTable(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetColorTableParameterfv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetColorTableParameteriv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetConvolutionFilter(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetConvolutionParameterfv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetConvolutionParameteriv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetSeparableFilter(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetHistogram(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetHistogramParameterfv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetHistogramParameteriv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetMinmax(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetMinmaxParameterfv(__GLXclientState*, GLbyte*); +extern int __glXDisp_GetMinmaxParameteriv(__GLXclientState*, GLbyte*); + +extern void __glXDisp_CallList(GLbyte*); +extern void __glXDisp_CallLists(GLbyte*); +extern void __glXDisp_ListBase(GLbyte*); +extern void __glXDisp_Begin(GLbyte*); +extern void __glXDisp_Bitmap(GLbyte*); +extern void __glXDisp_Color3bv(GLbyte*); +extern void __glXDisp_Color3dv(GLbyte*); +extern void __glXDisp_Color3fv(GLbyte*); +extern void __glXDisp_Color3iv(GLbyte*); +extern void __glXDisp_Color3sv(GLbyte*); +extern void __glXDisp_Color3ubv(GLbyte*); +extern void __glXDisp_Color3uiv(GLbyte*); +extern void __glXDisp_Color3usv(GLbyte*); +extern void __glXDisp_Color4bv(GLbyte*); +extern void __glXDisp_Color4dv(GLbyte*); +extern void __glXDisp_Color4fv(GLbyte*); +extern void __glXDisp_Color4iv(GLbyte*); +extern void __glXDisp_Color4sv(GLbyte*); +extern void __glXDisp_Color4ubv(GLbyte*); +extern void __glXDisp_Color4uiv(GLbyte*); +extern void __glXDisp_Color4usv(GLbyte*); +extern void __glXDisp_EdgeFlagv(GLbyte*); +extern void __glXDisp_End(GLbyte*); +extern void __glXDisp_Indexdv(GLbyte*); +extern void __glXDisp_Indexfv(GLbyte*); +extern void __glXDisp_Indexiv(GLbyte*); +extern void __glXDisp_Indexsv(GLbyte*); +extern void __glXDisp_Normal3bv(GLbyte*); +extern void __glXDisp_Normal3dv(GLbyte*); +extern void __glXDisp_Normal3fv(GLbyte*); +extern void __glXDisp_Normal3iv(GLbyte*); +extern void __glXDisp_Normal3sv(GLbyte*); +extern void __glXDisp_RasterPos2dv(GLbyte*); +extern void __glXDisp_RasterPos2fv(GLbyte*); +extern void __glXDisp_RasterPos2iv(GLbyte*); +extern void __glXDisp_RasterPos2sv(GLbyte*); +extern void __glXDisp_RasterPos3dv(GLbyte*); +extern void __glXDisp_RasterPos3fv(GLbyte*); +extern void __glXDisp_RasterPos3iv(GLbyte*); +extern void __glXDisp_RasterPos3sv(GLbyte*); +extern void __glXDisp_RasterPos4dv(GLbyte*); +extern void __glXDisp_RasterPos4fv(GLbyte*); +extern void __glXDisp_RasterPos4iv(GLbyte*); +extern void __glXDisp_RasterPos4sv(GLbyte*); +extern void __glXDisp_Rectdv(GLbyte*); +extern void __glXDisp_Rectfv(GLbyte*); +extern void __glXDisp_Rectiv(GLbyte*); +extern void __glXDisp_Rectsv(GLbyte*); +extern void __glXDisp_TexCoord1dv(GLbyte*); +extern void __glXDisp_TexCoord1fv(GLbyte*); +extern void __glXDisp_TexCoord1iv(GLbyte*); +extern void __glXDisp_TexCoord1sv(GLbyte*); +extern void __glXDisp_TexCoord2dv(GLbyte*); +extern void __glXDisp_TexCoord2fv(GLbyte*); +extern void __glXDisp_TexCoord2iv(GLbyte*); +extern void __glXDisp_TexCoord2sv(GLbyte*); +extern void __glXDisp_TexCoord3dv(GLbyte*); +extern void __glXDisp_TexCoord3fv(GLbyte*); +extern void __glXDisp_TexCoord3iv(GLbyte*); +extern void __glXDisp_TexCoord3sv(GLbyte*); +extern void __glXDisp_TexCoord4dv(GLbyte*); +extern void __glXDisp_TexCoord4fv(GLbyte*); +extern void __glXDisp_TexCoord4iv(GLbyte*); +extern void __glXDisp_TexCoord4sv(GLbyte*); +extern void __glXDisp_Vertex2dv(GLbyte*); +extern void __glXDisp_Vertex2fv(GLbyte*); +extern void __glXDisp_Vertex2iv(GLbyte*); +extern void __glXDisp_Vertex2sv(GLbyte*); +extern void __glXDisp_Vertex3dv(GLbyte*); +extern void __glXDisp_Vertex3fv(GLbyte*); +extern void __glXDisp_Vertex3iv(GLbyte*); +extern void __glXDisp_Vertex3sv(GLbyte*); +extern void __glXDisp_Vertex4dv(GLbyte*); +extern void __glXDisp_Vertex4fv(GLbyte*); +extern void __glXDisp_Vertex4iv(GLbyte*); +extern void __glXDisp_Vertex4sv(GLbyte*); +extern void __glXDisp_ClipPlane(GLbyte*); +extern void __glXDisp_ColorMaterial(GLbyte*); +extern void __glXDisp_CullFace(GLbyte*); +extern void __glXDisp_Fogf(GLbyte*); +extern void __glXDisp_Fogfv(GLbyte*); +extern void __glXDisp_Fogi(GLbyte*); +extern void __glXDisp_Fogiv(GLbyte*); +extern void __glXDisp_FrontFace(GLbyte*); +extern void __glXDisp_Hint(GLbyte*); +extern void __glXDisp_Lightf(GLbyte*); +extern void __glXDisp_Lightfv(GLbyte*); +extern void __glXDisp_Lighti(GLbyte*); +extern void __glXDisp_Lightiv(GLbyte*); +extern void __glXDisp_LightModelf(GLbyte*); +extern void __glXDisp_LightModelfv(GLbyte*); +extern void __glXDisp_LightModeli(GLbyte*); +extern void __glXDisp_LightModeliv(GLbyte*); +extern void __glXDisp_LineStipple(GLbyte*); +extern void __glXDisp_LineWidth(GLbyte*); +extern void __glXDisp_Materialf(GLbyte*); +extern void __glXDisp_Materialfv(GLbyte*); +extern void __glXDisp_Materiali(GLbyte*); +extern void __glXDisp_Materialiv(GLbyte*); +extern void __glXDisp_PointSize(GLbyte*); +extern void __glXDisp_PolygonMode(GLbyte*); +extern void __glXDisp_PolygonStipple(GLbyte*); +extern void __glXDisp_Scissor(GLbyte*); +extern void __glXDisp_ShadeModel(GLbyte*); +extern void __glXDisp_TexParameterf(GLbyte*); +extern void __glXDisp_TexParameterfv(GLbyte*); +extern void __glXDisp_TexParameteri(GLbyte*); +extern void __glXDisp_TexParameteriv(GLbyte*); +extern void __glXDisp_TexImage1D(GLbyte*); +extern void __glXDisp_TexImage2D(GLbyte*); +extern void __glXDisp_TexEnvf(GLbyte*); +extern void __glXDisp_TexEnvfv(GLbyte*); +extern void __glXDisp_TexEnvi(GLbyte*); +extern void __glXDisp_TexEnviv(GLbyte*); +extern void __glXDisp_TexGend(GLbyte*); +extern void __glXDisp_TexGendv(GLbyte*); +extern void __glXDisp_TexGenf(GLbyte*); +extern void __glXDisp_TexGenfv(GLbyte*); +extern void __glXDisp_TexGeni(GLbyte*); +extern void __glXDisp_TexGeniv(GLbyte*); +extern void __glXDisp_InitNames(GLbyte*); +extern void __glXDisp_LoadName(GLbyte*); +extern void __glXDisp_PassThrough(GLbyte*); +extern void __glXDisp_PopName(GLbyte*); +extern void __glXDisp_PushName(GLbyte*); +extern void __glXDisp_DrawBuffer(GLbyte*); +extern void __glXDisp_Clear(GLbyte*); +extern void __glXDisp_ClearAccum(GLbyte*); +extern void __glXDisp_ClearIndex(GLbyte*); +extern void __glXDisp_ClearColor(GLbyte*); +extern void __glXDisp_ClearStencil(GLbyte*); +extern void __glXDisp_ClearDepth(GLbyte*); +extern void __glXDisp_StencilMask(GLbyte*); +extern void __glXDisp_ColorMask(GLbyte*); +extern void __glXDisp_DepthMask(GLbyte*); +extern void __glXDisp_IndexMask(GLbyte*); +extern void __glXDisp_Accum(GLbyte*); +extern void __glXDisp_Disable(GLbyte*); +extern void __glXDisp_Enable(GLbyte*); +extern void __glXDisp_PopAttrib(GLbyte*); +extern void __glXDisp_PushAttrib(GLbyte*); +extern void __glXDisp_Map1d(GLbyte*); +extern void __glXDisp_Map1f(GLbyte*); +extern void __glXDisp_Map2d(GLbyte*); +extern void __glXDisp_Map2f(GLbyte*); +extern void __glXDisp_MapGrid1d(GLbyte*); +extern void __glXDisp_MapGrid1f(GLbyte*); +extern void __glXDisp_MapGrid2d(GLbyte*); +extern void __glXDisp_MapGrid2f(GLbyte*); +extern void __glXDisp_EvalCoord1dv(GLbyte*); +extern void __glXDisp_EvalCoord1fv(GLbyte*); +extern void __glXDisp_EvalCoord2dv(GLbyte*); +extern void __glXDisp_EvalCoord2fv(GLbyte*); +extern void __glXDisp_EvalMesh1(GLbyte*); +extern void __glXDisp_EvalPoint1(GLbyte*); +extern void __glXDisp_EvalMesh2(GLbyte*); +extern void __glXDisp_EvalPoint2(GLbyte*); +extern void __glXDisp_AlphaFunc(GLbyte*); +extern void __glXDisp_BlendFunc(GLbyte*); +extern void __glXDisp_LogicOp(GLbyte*); +extern void __glXDisp_StencilFunc(GLbyte*); +extern void __glXDisp_StencilOp(GLbyte*); +extern void __glXDisp_DepthFunc(GLbyte*); +extern void __glXDisp_PixelZoom(GLbyte*); +extern void __glXDisp_PixelTransferf(GLbyte*); +extern void __glXDisp_PixelTransferi(GLbyte*); +extern void __glXDisp_PixelMapfv(GLbyte*); +extern void __glXDisp_PixelMapuiv(GLbyte*); +extern void __glXDisp_PixelMapusv(GLbyte*); +extern void __glXDisp_ReadBuffer(GLbyte*); +extern void __glXDisp_CopyPixels(GLbyte*); +extern void __glXDisp_DrawPixels(GLbyte*); +extern void __glXDisp_DepthRange(GLbyte*); +extern void __glXDisp_Frustum(GLbyte*); +extern void __glXDisp_LoadIdentity(GLbyte*); +extern void __glXDisp_LoadMatrixf(GLbyte*); +extern void __glXDisp_LoadMatrixd(GLbyte*); +extern void __glXDisp_MatrixMode(GLbyte*); +extern void __glXDisp_MultMatrixf(GLbyte*); +extern void __glXDisp_MultMatrixd(GLbyte*); +extern void __glXDisp_Ortho(GLbyte*); +extern void __glXDisp_PopMatrix(GLbyte*); +extern void __glXDisp_PushMatrix(GLbyte*); +extern void __glXDisp_Rotated(GLbyte*); +extern void __glXDisp_Rotatef(GLbyte*); +extern void __glXDisp_Scaled(GLbyte*); +extern void __glXDisp_Scalef(GLbyte*); +extern void __glXDisp_Translated(GLbyte*); +extern void __glXDisp_Translatef(GLbyte*); +extern void __glXDisp_Viewport(GLbyte*); +extern void __glXDisp_PolygonOffset(GLbyte*); +extern void __glXDisp_DrawArrays(GLbyte*); +extern void __glXDisp_Indexubv(GLbyte*); +extern void __glXDisp_ColorSubTable(GLbyte*); +extern void __glXDisp_CopyColorSubTable(GLbyte*); +extern void __glXDisp_ActiveTextureARB(GLbyte*); +extern void __glXDisp_MultiTexCoord1dvARB(GLbyte*); +extern void __glXDisp_MultiTexCoord1fvARB(GLbyte*); +extern void __glXDisp_MultiTexCoord1ivARB(GLbyte*); +extern void __glXDisp_MultiTexCoord1svARB(GLbyte*); +extern void __glXDisp_MultiTexCoord2dvARB(GLbyte*); +extern void __glXDisp_MultiTexCoord2fvARB(GLbyte*); +extern void __glXDisp_MultiTexCoord2ivARB(GLbyte*); +extern void __glXDisp_MultiTexCoord2svARB(GLbyte*); +extern void __glXDisp_MultiTexCoord3dvARB(GLbyte*); +extern void __glXDisp_MultiTexCoord3fvARB(GLbyte*); +extern void __glXDisp_MultiTexCoord3ivARB(GLbyte*); +extern void __glXDisp_MultiTexCoord3svARB(GLbyte*); +extern void __glXDisp_MultiTexCoord4dvARB(GLbyte*); +extern void __glXDisp_MultiTexCoord4fvARB(GLbyte*); +extern void __glXDisp_MultiTexCoord4ivARB(GLbyte*); +extern void __glXDisp_MultiTexCoord4svARB(GLbyte*); + +extern int __glXSwapRender(__GLXclientState*, GLbyte*); +extern int __glXSwapRenderLarge(__GLXclientState*, GLbyte*); +extern int __glXSwapCreateContext(__GLXclientState*, GLbyte*); +extern int __glXSwapCreateNewContext(__GLXclientState *cl, GLbyte *pc); +extern int __glXSwapDestroyContext(__GLXclientState*, GLbyte*); +extern int __glXSwapMakeCurrent(__GLXclientState*, GLbyte*); +extern int __glXSwapMakeContextCurrent(__GLXclientState*, GLbyte*); +extern int __glXSwapCreatePbuffer(__GLXclientState *cl, GLbyte *pc); +extern int __glXSwapDestroyPbuffer(__GLXclientState *cl, GLbyte *pc); +extern int __glXSwapGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc); +extern int __glXSwapChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc); +extern int __glXSwapIsDirect(__GLXclientState*, GLbyte*); +extern int __glXSwapQueryVersion(__GLXclientState*, GLbyte*); +extern int __glXSwapWaitGL(__GLXclientState*, GLbyte*); +extern int __glXSwapWaitX(__GLXclientState*, GLbyte*); +extern int __glXSwapCopyContext(__GLXclientState*, GLbyte*); +extern int __glXSwapSwapBuffers(__GLXclientState*, GLbyte*); +extern int __glXSwapUseXFont(__GLXclientState*, GLbyte*); +extern int __glXSwapCreateGLXPixmap(__GLXclientState*, GLbyte*); +extern int __glXSwapCreatePixmap(__GLXclientState *cl, GLbyte *pc); +extern int __glXSwapGetVisualConfigs(__GLXclientState*, GLbyte*); +extern int __glXSwapDestroyGLXPixmap(__GLXclientState*, GLbyte*); +extern int __glXSwapVendorPrivate(__GLXclientState*, GLbyte*); +extern int __glXSwapVendorPrivateWithReply(__GLXclientState*, GLbyte*); +extern int __glXSwapQueryExtensionsString(__GLXclientState*, GLbyte*); +extern int __glXSwapQueryServerString(__GLXclientState*, GLbyte*); +extern int __glXSwapClientInfo(__GLXclientState*, GLbyte*); +extern int __glXSwapGetFBConfigs(__GLXclientState*, GLbyte*); +extern int __glXSwapCreateWindow(__GLXclientState *cl, GLbyte *pc); +extern int __glXSwapDestroyWindow(__GLXclientState *cl, GLbyte *pc); +extern int __glXSwapQueryContext(__GLXclientState *cl, GLbyte *pc); +extern int __glXDispSwap_NewList(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_EndList(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_DeleteLists(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GenLists(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_FeedbackBuffer(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_SelectBuffer(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_RenderMode(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_Finish(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_PixelStoref(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_PixelStorei(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_ReadPixels(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetBooleanv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetClipPlane(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetDoublev(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetError(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetFloatv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetIntegerv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetLightfv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetLightiv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetMapdv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetMapfv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetMapiv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetMaterialfv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetMaterialiv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetPixelMapfv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetPixelMapuiv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetPixelMapusv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetPolygonStipple(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetString(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetTexEnvfv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetTexEnviv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetTexGendv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetTexGenfv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetTexGeniv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetTexImage(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetTexParameterfv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetTexParameteriv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetTexLevelParameterfv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetTexLevelParameteriv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_IsEnabled(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_IsList(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_Flush(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_AreTexturesResident(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_DeleteTextures(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GenTextures(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_IsTexture(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetColorTable(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetColorTableParameterfv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetColorTableParameteriv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetConvolutionFilter(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetConvolutionParameterfv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetConvolutionParameteriv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetSeparableFilter(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetHistogram(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetHistogramParameterfv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetHistogramParameteriv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetMinmax(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetMinmaxParameterfv(__GLXclientState*, GLbyte*); +extern int __glXDispSwap_GetMinmaxParameteriv(__GLXclientState*, GLbyte*); + +extern void __glXDispSwap_CallList(GLbyte*); +extern void __glXDispSwap_CallLists(GLbyte*); +extern void __glXDispSwap_ListBase(GLbyte*); +extern void __glXDispSwap_Begin(GLbyte*); +extern void __glXDispSwap_Bitmap(GLbyte*); +extern void __glXDispSwap_Color3bv(GLbyte*); +extern void __glXDispSwap_Color3dv(GLbyte*); +extern void __glXDispSwap_Color3fv(GLbyte*); +extern void __glXDispSwap_Color3iv(GLbyte*); +extern void __glXDispSwap_Color3sv(GLbyte*); +extern void __glXDispSwap_Color3ubv(GLbyte*); +extern void __glXDispSwap_Color3uiv(GLbyte*); +extern void __glXDispSwap_Color3usv(GLbyte*); +extern void __glXDispSwap_Color4bv(GLbyte*); +extern void __glXDispSwap_Color4dv(GLbyte*); +extern void __glXDispSwap_Color4fv(GLbyte*); +extern void __glXDispSwap_Color4iv(GLbyte*); +extern void __glXDispSwap_Color4sv(GLbyte*); +extern void __glXDispSwap_Color4ubv(GLbyte*); +extern void __glXDispSwap_Color4uiv(GLbyte*); +extern void __glXDispSwap_Color4usv(GLbyte*); +extern void __glXDispSwap_EdgeFlagv(GLbyte*); +extern void __glXDispSwap_End(GLbyte*); +extern void __glXDispSwap_Indexdv(GLbyte*); +extern void __glXDispSwap_Indexfv(GLbyte*); +extern void __glXDispSwap_Indexiv(GLbyte*); +extern void __glXDispSwap_Indexsv(GLbyte*); +extern void __glXDispSwap_Normal3bv(GLbyte*); +extern void __glXDispSwap_Normal3dv(GLbyte*); +extern void __glXDispSwap_Normal3fv(GLbyte*); +extern void __glXDispSwap_Normal3iv(GLbyte*); +extern void __glXDispSwap_Normal3sv(GLbyte*); +extern void __glXDispSwap_RasterPos2dv(GLbyte*); +extern void __glXDispSwap_RasterPos2fv(GLbyte*); +extern void __glXDispSwap_RasterPos2iv(GLbyte*); +extern void __glXDispSwap_RasterPos2sv(GLbyte*); +extern void __glXDispSwap_RasterPos3dv(GLbyte*); +extern void __glXDispSwap_RasterPos3fv(GLbyte*); +extern void __glXDispSwap_RasterPos3iv(GLbyte*); +extern void __glXDispSwap_RasterPos3sv(GLbyte*); +extern void __glXDispSwap_RasterPos4dv(GLbyte*); +extern void __glXDispSwap_RasterPos4fv(GLbyte*); +extern void __glXDispSwap_RasterPos4iv(GLbyte*); +extern void __glXDispSwap_RasterPos4sv(GLbyte*); +extern void __glXDispSwap_Rectdv(GLbyte*); +extern void __glXDispSwap_Rectfv(GLbyte*); +extern void __glXDispSwap_Rectiv(GLbyte*); +extern void __glXDispSwap_Rectsv(GLbyte*); +extern void __glXDispSwap_TexCoord1dv(GLbyte*); +extern void __glXDispSwap_TexCoord1fv(GLbyte*); +extern void __glXDispSwap_TexCoord1iv(GLbyte*); +extern void __glXDispSwap_TexCoord1sv(GLbyte*); +extern void __glXDispSwap_TexCoord2dv(GLbyte*); +extern void __glXDispSwap_TexCoord2fv(GLbyte*); +extern void __glXDispSwap_TexCoord2iv(GLbyte*); +extern void __glXDispSwap_TexCoord2sv(GLbyte*); +extern void __glXDispSwap_TexCoord3dv(GLbyte*); +extern void __glXDispSwap_TexCoord3fv(GLbyte*); +extern void __glXDispSwap_TexCoord3iv(GLbyte*); +extern void __glXDispSwap_TexCoord3sv(GLbyte*); +extern void __glXDispSwap_TexCoord4dv(GLbyte*); +extern void __glXDispSwap_TexCoord4fv(GLbyte*); +extern void __glXDispSwap_TexCoord4iv(GLbyte*); +extern void __glXDispSwap_TexCoord4sv(GLbyte*); +extern void __glXDispSwap_Vertex2dv(GLbyte*); +extern void __glXDispSwap_Vertex2fv(GLbyte*); +extern void __glXDispSwap_Vertex2iv(GLbyte*); +extern void __glXDispSwap_Vertex2sv(GLbyte*); +extern void __glXDispSwap_Vertex3dv(GLbyte*); +extern void __glXDispSwap_Vertex3fv(GLbyte*); +extern void __glXDispSwap_Vertex3iv(GLbyte*); +extern void __glXDispSwap_Vertex3sv(GLbyte*); +extern void __glXDispSwap_Vertex4dv(GLbyte*); +extern void __glXDispSwap_Vertex4fv(GLbyte*); +extern void __glXDispSwap_Vertex4iv(GLbyte*); +extern void __glXDispSwap_Vertex4sv(GLbyte*); +extern void __glXDispSwap_ClipPlane(GLbyte*); +extern void __glXDispSwap_ColorMaterial(GLbyte*); +extern void __glXDispSwap_CullFace(GLbyte*); +extern void __glXDispSwap_Fogf(GLbyte*); +extern void __glXDispSwap_Fogfv(GLbyte*); +extern void __glXDispSwap_Fogi(GLbyte*); +extern void __glXDispSwap_Fogiv(GLbyte*); +extern void __glXDispSwap_FrontFace(GLbyte*); +extern void __glXDispSwap_Hint(GLbyte*); +extern void __glXDispSwap_Lightf(GLbyte*); +extern void __glXDispSwap_Lightfv(GLbyte*); +extern void __glXDispSwap_Lighti(GLbyte*); +extern void __glXDispSwap_Lightiv(GLbyte*); +extern void __glXDispSwap_LightModelf(GLbyte*); +extern void __glXDispSwap_LightModelfv(GLbyte*); +extern void __glXDispSwap_LightModeli(GLbyte*); +extern void __glXDispSwap_LightModeliv(GLbyte*); +extern void __glXDispSwap_LineStipple(GLbyte*); +extern void __glXDispSwap_LineWidth(GLbyte*); +extern void __glXDispSwap_Materialf(GLbyte*); +extern void __glXDispSwap_Materialfv(GLbyte*); +extern void __glXDispSwap_Materiali(GLbyte*); +extern void __glXDispSwap_Materialiv(GLbyte*); +extern void __glXDispSwap_PointSize(GLbyte*); +extern void __glXDispSwap_PolygonMode(GLbyte*); +extern void __glXDispSwap_PolygonStipple(GLbyte*); +extern void __glXDispSwap_Scissor(GLbyte*); +extern void __glXDispSwap_ShadeModel(GLbyte*); +extern void __glXDispSwap_TexParameterf(GLbyte*); +extern void __glXDispSwap_TexParameterfv(GLbyte*); +extern void __glXDispSwap_TexParameteri(GLbyte*); +extern void __glXDispSwap_TexParameteriv(GLbyte*); +extern void __glXDispSwap_TexImage1D(GLbyte*); +extern void __glXDispSwap_TexImage2D(GLbyte*); +extern void __glXDispSwap_TexEnvf(GLbyte*); +extern void __glXDispSwap_TexEnvfv(GLbyte*); +extern void __glXDispSwap_TexEnvi(GLbyte*); +extern void __glXDispSwap_TexEnviv(GLbyte*); +extern void __glXDispSwap_TexGend(GLbyte*); +extern void __glXDispSwap_TexGendv(GLbyte*); +extern void __glXDispSwap_TexGenf(GLbyte*); +extern void __glXDispSwap_TexGenfv(GLbyte*); +extern void __glXDispSwap_TexGeni(GLbyte*); +extern void __glXDispSwap_TexGeniv(GLbyte*); +extern void __glXDispSwap_InitNames(GLbyte*); +extern void __glXDispSwap_LoadName(GLbyte*); +extern void __glXDispSwap_PassThrough(GLbyte*); +extern void __glXDispSwap_PopName(GLbyte*); +extern void __glXDispSwap_PushName(GLbyte*); +extern void __glXDispSwap_DrawBuffer(GLbyte*); +extern void __glXDispSwap_Clear(GLbyte*); +extern void __glXDispSwap_ClearAccum(GLbyte*); +extern void __glXDispSwap_ClearIndex(GLbyte*); +extern void __glXDispSwap_ClearColor(GLbyte*); +extern void __glXDispSwap_ClearStencil(GLbyte*); +extern void __glXDispSwap_ClearDepth(GLbyte*); +extern void __glXDispSwap_StencilMask(GLbyte*); +extern void __glXDispSwap_ColorMask(GLbyte*); +extern void __glXDispSwap_DepthMask(GLbyte*); +extern void __glXDispSwap_IndexMask(GLbyte*); +extern void __glXDispSwap_Accum(GLbyte*); +extern void __glXDispSwap_Disable(GLbyte*); +extern void __glXDispSwap_Enable(GLbyte*); +extern void __glXDispSwap_PopAttrib(GLbyte*); +extern void __glXDispSwap_PushAttrib(GLbyte*); +extern void __glXDispSwap_Map1d(GLbyte*); +extern void __glXDispSwap_Map1f(GLbyte*); +extern void __glXDispSwap_Map2d(GLbyte*); +extern void __glXDispSwap_Map2f(GLbyte*); +extern void __glXDispSwap_MapGrid1d(GLbyte*); +extern void __glXDispSwap_MapGrid1f(GLbyte*); +extern void __glXDispSwap_MapGrid2d(GLbyte*); +extern void __glXDispSwap_MapGrid2f(GLbyte*); +extern void __glXDispSwap_EvalCoord1dv(GLbyte*); +extern void __glXDispSwap_EvalCoord1fv(GLbyte*); +extern void __glXDispSwap_EvalCoord2dv(GLbyte*); +extern void __glXDispSwap_EvalCoord2fv(GLbyte*); +extern void __glXDispSwap_EvalMesh1(GLbyte*); +extern void __glXDispSwap_EvalPoint1(GLbyte*); +extern void __glXDispSwap_EvalMesh2(GLbyte*); +extern void __glXDispSwap_EvalPoint2(GLbyte*); +extern void __glXDispSwap_AlphaFunc(GLbyte*); +extern void __glXDispSwap_BlendFunc(GLbyte*); +extern void __glXDispSwap_LogicOp(GLbyte*); +extern void __glXDispSwap_StencilFunc(GLbyte*); +extern void __glXDispSwap_StencilOp(GLbyte*); +extern void __glXDispSwap_DepthFunc(GLbyte*); +extern void __glXDispSwap_PixelZoom(GLbyte*); +extern void __glXDispSwap_PixelTransferf(GLbyte*); +extern void __glXDispSwap_PixelTransferi(GLbyte*); +extern void __glXDispSwap_PixelMapfv(GLbyte*); +extern void __glXDispSwap_PixelMapuiv(GLbyte*); +extern void __glXDispSwap_PixelMapusv(GLbyte*); +extern void __glXDispSwap_ReadBuffer(GLbyte*); +extern void __glXDispSwap_CopyPixels(GLbyte*); +extern void __glXDispSwap_DrawPixels(GLbyte*); +extern void __glXDispSwap_DepthRange(GLbyte*); +extern void __glXDispSwap_Frustum(GLbyte*); +extern void __glXDispSwap_LoadIdentity(GLbyte*); +extern void __glXDispSwap_LoadMatrixf(GLbyte*); +extern void __glXDispSwap_LoadMatrixd(GLbyte*); +extern void __glXDispSwap_MatrixMode(GLbyte*); +extern void __glXDispSwap_MultMatrixf(GLbyte*); +extern void __glXDispSwap_MultMatrixd(GLbyte*); +extern void __glXDispSwap_Ortho(GLbyte*); +extern void __glXDispSwap_PopMatrix(GLbyte*); +extern void __glXDispSwap_PushMatrix(GLbyte*); +extern void __glXDispSwap_Rotated(GLbyte*); +extern void __glXDispSwap_Rotatef(GLbyte*); +extern void __glXDispSwap_Scaled(GLbyte*); +extern void __glXDispSwap_Scalef(GLbyte*); +extern void __glXDispSwap_Translated(GLbyte*); +extern void __glXDispSwap_Translatef(GLbyte*); +extern void __glXDispSwap_Viewport(GLbyte*); +extern void __glXDispSwap_PolygonOffset(GLbyte*); +extern void __glXDispSwap_DrawArrays(GLbyte*); +extern void __glXDispSwap_Indexubv(GLbyte*); +extern void __glXDispSwap_ColorSubTable(GLbyte*); +extern void __glXDispSwap_CopyColorSubTable(GLbyte*); +extern void __glXDispSwap_ActiveTextureARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord1dvARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord1fvARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord1ivARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord1svARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord2dvARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord2fvARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord2ivARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord2svARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord3dvARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord3fvARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord3ivARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord3svARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord4dvARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord4fvARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord4ivARB(GLbyte*); +extern void __glXDispSwap_MultiTexCoord4svARB(GLbyte*); + +extern void __glXDispSwap_TexSubImage1D(GLbyte*); +extern void __glXDispSwap_TexSubImage2D(GLbyte*); +extern void __glXDispSwap_ConvolutionFilter1D(GLbyte*); +extern void __glXDispSwap_ConvolutionFilter2D(GLbyte*); +extern void __glXDispSwap_ConvolutionParameterfv(GLbyte*); +extern void __glXDispSwap_ConvolutionParameteriv(GLbyte*); +extern void __glXDispSwap_CopyConvolutionFilter1D(GLbyte*); +extern void __glXDispSwap_CopyConvolutionFilter2D(GLbyte*); +extern void __glXDispSwap_SeparableFilter2D(GLbyte*); +extern void __glXDispSwap_TexImage3D(GLbyte*); +extern void __glXDispSwap_TexSubImage3D(GLbyte*); +extern void __glXDispSwap_DrawArrays(GLbyte*); +extern void __glXDispSwap_PrioritizeTextures(GLbyte*); +extern void __glXDispSwap_CopyTexImage1D(GLbyte*); +extern void __glXDispSwap_CopyTexImage2D(GLbyte*); +extern void __glXDispSwap_CopyTexSubImage1D(GLbyte*); +extern void __glXDispSwap_CopyTexSubImage2D(GLbyte*); +extern void __glXDispSwap_CopyTexSubImage3D(GLbyte*); + +#define __GLX_MIN_GLXCMD_OPCODE 1 +#define __GLX_MAX_GLXCMD_OPCODE 20 +#define __GLX_MIN_RENDER_OPCODE 1 +#define __GLX_MAX_RENDER_OPCODE 213 +#define __GLX_MIN_SINGLE_OPCODE 1 +#define __GLX_MAX_SINGLE_OPCODE 159 +#define __GLX_SINGLE_TABLE_SIZE 160 +#define __GLX_RENDER_TABLE_SIZE 214 + +#define __GLX_MIN_RENDER_OPCODE_EXT 4096 +#define __GLX_MAX_RENDER_OPCODE_EXT 4123 + +extern __GLXdispatchSingleProcPtr __glXSingleTable[__GLX_SINGLE_TABLE_SIZE]; +extern __GLXdispatchSingleProcPtr __glXSwapSingleTable[__GLX_SINGLE_TABLE_SIZE]; +#endif /* _GLX_g_disptab_h_ */ diff --git a/xorg-server/hw/dmx/glxProxy/g_renderswap.c b/xorg-server/hw/dmx/glxProxy/g_renderswap.c new file mode 100644 index 000000000..4f40dfd01 --- /dev/null +++ b/xorg-server/hw/dmx/glxProxy/g_renderswap.c @@ -0,0 +1,2360 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. +*/ + +#define NEED_REPLIES +#include "glxserver.h" +#include "glxext.h" +#include "g_disptab.h" +#include "unpack.h" + +void __glXDispSwap_CallList(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + +} + +void __glXDispSwap_ListBase(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + +} + +void __glXDispSwap_Begin(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + +} + +void __glXDispSwap_Color3bv(GLbyte *pc) +{ +} + +void __glXDispSwap_Color3dv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 24); + pc -= 4; + } +#endif + __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3); + +} + +void __glXDispSwap_Color3fv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3); +} + +void __glXDispSwap_Color3iv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT_ARRAY(pc + 0, 3); + +} + +void __glXDispSwap_Color3sv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT_ARRAY(pc + 0, 3); + +} + +void __glXDispSwap_Color3ubv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; +} + +void __glXDispSwap_Color3uiv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT_ARRAY(pc + 0, 3); +} + +void __glXDispSwap_Color3usv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT_ARRAY(pc + 0, 3); +} + +void __glXDispSwap_Color4bv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; +} + +void __glXDispSwap_Color4dv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 32); + pc -= 4; + } +#endif + __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4); +} + +void __glXDispSwap_Color4fv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_FLOAT_ARRAY(pc + 0, 4); + +} + +void __glXDispSwap_Color4iv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT_ARRAY(pc + 0, 4); + +} + +void __glXDispSwap_Color4sv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT_ARRAY(pc + 0, 4); + +} + +void __glXDispSwap_Color4ubv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + +} + +void __glXDispSwap_Color4uiv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT_ARRAY(pc + 0, 4); + +} + +void __glXDispSwap_Color4usv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT_ARRAY(pc + 0, 4); + +} + +void __glXDispSwap_EdgeFlagv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +} + +void __glXDispSwap_End(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +} + +void __glXDispSwap_Indexdv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 8); + pc -= 4; + } +#endif + __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 1); + +} + +void __glXDispSwap_Indexfv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_FLOAT_ARRAY(pc + 0, 1); + +} + +void __glXDispSwap_Indexiv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT_ARRAY(pc + 0, 1); + +} + +void __glXDispSwap_Indexsv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT_ARRAY(pc + 0, 1); + +} + +void __glXDispSwap_Normal3bv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +} + +void __glXDispSwap_Normal3dv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 24); + pc -= 4; + } +#endif + __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3); + +} + +void __glXDispSwap_Normal3fv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3); + +} + +void __glXDispSwap_Normal3iv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT_ARRAY(pc + 0, 3); + +} + +void __glXDispSwap_Normal3sv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT_ARRAY(pc + 0, 3); + +} + +void __glXDispSwap_RasterPos2dv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 16); + pc -= 4; + } +#endif + __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2); + +} + +void __glXDispSwap_RasterPos2fv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2); + +} + +void __glXDispSwap_RasterPos2iv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT_ARRAY(pc + 0, 2); + +} + +void __glXDispSwap_RasterPos2sv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT_ARRAY(pc + 0, 2); + +} + +void __glXDispSwap_RasterPos3dv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 24); + pc -= 4; + } +#endif + __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3); + +} + +void __glXDispSwap_RasterPos3fv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3); + +} + +void __glXDispSwap_RasterPos3iv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT_ARRAY(pc + 0, 3); + +} + +void __glXDispSwap_RasterPos3sv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT_ARRAY(pc + 0, 3); + +} + +void __glXDispSwap_RasterPos4dv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 32); + pc -= 4; + } +#endif + __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4); + +} + +void __glXDispSwap_RasterPos4fv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_FLOAT_ARRAY(pc + 0, 4); + +} + +void __glXDispSwap_RasterPos4iv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT_ARRAY(pc + 0, 4); + +} + +void __glXDispSwap_RasterPos4sv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT_ARRAY(pc + 0, 4); + +} + +void __glXDispSwap_Rectdv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 32); + pc -= 4; + } +#endif + __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2); + __GLX_SWAP_DOUBLE_ARRAY(pc + 16, 2); + +} + +void __glXDispSwap_Rectfv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2); + __GLX_SWAP_FLOAT_ARRAY(pc + 8, 2); + +} + +void __glXDispSwap_Rectiv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT_ARRAY(pc + 0, 2); + __GLX_SWAP_INT_ARRAY(pc + 8, 2); + +} + +void __glXDispSwap_Rectsv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT_ARRAY(pc + 0, 2); + __GLX_SWAP_SHORT_ARRAY(pc + 4, 2); + +} + +void __glXDispSwap_TexCoord1dv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 8); + pc -= 4; + } +#endif + __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 1); + +} + +void __glXDispSwap_TexCoord1fv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_FLOAT_ARRAY(pc + 0, 1); + +} + +void __glXDispSwap_TexCoord1iv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT_ARRAY(pc + 0, 1); + +} + +void __glXDispSwap_TexCoord1sv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT_ARRAY(pc + 0, 1); + +} + +void __glXDispSwap_TexCoord2dv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 16); + pc -= 4; + } +#endif + __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2); + +} + +void __glXDispSwap_TexCoord2fv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2); + +} + +void __glXDispSwap_TexCoord2iv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT_ARRAY(pc + 0, 2); + +} + +void __glXDispSwap_TexCoord2sv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT_ARRAY(pc + 0, 2); + +} + +void __glXDispSwap_TexCoord3dv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 24); + pc -= 4; + } +#endif + __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3); + +} + +void __glXDispSwap_TexCoord3fv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3); + +} + +void __glXDispSwap_TexCoord3iv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT_ARRAY(pc + 0, 3); + +} + +void __glXDispSwap_TexCoord3sv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT_ARRAY(pc + 0, 3); + +} + +void __glXDispSwap_TexCoord4dv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 32); + pc -= 4; + } +#endif + __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4); + +} + +void __glXDispSwap_TexCoord4fv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_FLOAT_ARRAY(pc + 0, 4); + +} + +void __glXDispSwap_TexCoord4iv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT_ARRAY(pc + 0, 4); + +} + +void __glXDispSwap_TexCoord4sv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT_ARRAY(pc + 0, 4); + +} + +void __glXDispSwap_Vertex2dv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 16); + pc -= 4; + } +#endif + __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2); + +} + +void __glXDispSwap_Vertex2fv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2); + +} + +void __glXDispSwap_Vertex2iv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT_ARRAY(pc + 0, 2); + +} + +void __glXDispSwap_Vertex2sv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT_ARRAY(pc + 0, 2); + +} + +void __glXDispSwap_Vertex3dv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 24); + pc -= 4; + } +#endif + __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3); + +} + +void __glXDispSwap_Vertex3fv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3); + +} + +void __glXDispSwap_Vertex3iv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT_ARRAY(pc + 0, 3); + +} + +void __glXDispSwap_Vertex3sv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT_ARRAY(pc + 0, 3); + +} + +void __glXDispSwap_Vertex4dv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 32); + pc -= 4; + } +#endif + __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4); + +} + +void __glXDispSwap_Vertex4fv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_FLOAT_ARRAY(pc + 0, 4); + +} + +void __glXDispSwap_Vertex4iv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT_ARRAY(pc + 0, 4); + +} + +void __glXDispSwap_Vertex4sv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT_ARRAY(pc + 0, 4); + +} + +void __glXDispSwap_ClipPlane(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 36); + pc -= 4; + } +#endif + __GLX_SWAP_INT(pc + 32); + __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4); + +} + +void __glXDispSwap_ColorMaterial(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + +} + +void __glXDispSwap_CullFace(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + +} + +void __glXDispSwap_Fogf(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_FLOAT(pc + 4); + +} + +void __glXDispSwap_Fogfv(GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + pname = *(GLenum *)(pc + 0); + compsize = __glFogfv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_FLOAT_ARRAY(pc + 4, compsize); + +} + +void __glXDispSwap_Fogi(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + +} + +void __glXDispSwap_Fogiv(GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + pname = *(GLenum *)(pc + 0); + compsize = __glFogiv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT_ARRAY(pc + 4, compsize); + +} + +void __glXDispSwap_FrontFace(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + +} + +void __glXDispSwap_Hint(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + +} + +void __glXDispSwap_Lightf(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_FLOAT(pc + 8); + +} + +void __glXDispSwap_Lightfv(GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glLightfv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize); + +} + +void __glXDispSwap_Lighti(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + 8); + +} + +void __glXDispSwap_Lightiv(GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glLightiv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT_ARRAY(pc + 8, compsize); + +} + +void __glXDispSwap_LightModelf(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_FLOAT(pc + 4); + +} + +void __glXDispSwap_LightModelfv(GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + pname = *(GLenum *)(pc + 0); + compsize = __glLightModelfv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_FLOAT_ARRAY(pc + 4, compsize); + +} + +void __glXDispSwap_LightModeli(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + +} + +void __glXDispSwap_LightModeliv(GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + pname = *(GLenum *)(pc + 0); + compsize = __glLightModeliv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT_ARRAY(pc + 4, compsize); + +} + +void __glXDispSwap_LineStipple(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_SHORT(pc + 4); + +} + +void __glXDispSwap_LineWidth(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_FLOAT(pc + 0); + +} + +void __glXDispSwap_Materialf(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_FLOAT(pc + 8); + +} + +void __glXDispSwap_Materialfv(GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glMaterialfv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize); + +} + +void __glXDispSwap_Materiali(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + 8); + +} + +void __glXDispSwap_Materialiv(GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glMaterialiv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT_ARRAY(pc + 8, compsize); + +} + +void __glXDispSwap_PointSize(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_FLOAT(pc + 0); + +} + +void __glXDispSwap_PolygonMode(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + +} + +void __glXDispSwap_Scissor(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + 8); + __GLX_SWAP_INT(pc + 12); + +} + +void __glXDispSwap_ShadeModel(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + +} + +void __glXDispSwap_TexParameterf(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_FLOAT(pc + 8); + +} + +void __glXDispSwap_TexParameterfv(GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glTexParameterfv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize); + +} + +void __glXDispSwap_TexParameteri(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + 8); + +} + +void __glXDispSwap_TexParameteriv(GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glTexParameteriv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT_ARRAY(pc + 8, compsize); + +} + +void __glXDispSwap_TexEnvf(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_FLOAT(pc + 8); + +} + +void __glXDispSwap_TexEnvfv(GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glTexEnvfv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize); + +} + +void __glXDispSwap_TexEnvi(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + 8); + +} + +void __glXDispSwap_TexEnviv(GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glTexEnviv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT_ARRAY(pc + 8, compsize); + +} + +void __glXDispSwap_TexGend(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 16); + pc -= 4; + } +#endif + __GLX_SWAP_INT(pc + 8); + __GLX_SWAP_INT(pc + 12); + __GLX_SWAP_DOUBLE(pc + 0); + +} + +void __glXDispSwap_TexGendv(GLbyte *pc) +{ + GLenum pname; + GLint cmdlen; + GLint compsize; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glTexGendv_size(pname); + if (compsize < 0) compsize = 0; + cmdlen = __GLX_PAD(8+compsize*8); + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, cmdlen); + pc -= 4; + } +#endif + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_DOUBLE_ARRAY(pc + 8, compsize); + +} + +void __glXDispSwap_TexGenf(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_FLOAT(pc + 8); + +} + +void __glXDispSwap_TexGenfv(GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glTexGenfv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize); + +} + +void __glXDispSwap_TexGeni(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + 8); + +} + +void __glXDispSwap_TexGeniv(GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glTexGeniv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT_ARRAY(pc + 8, compsize); + +} + +void __glXDispSwap_InitNames(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +} + +void __glXDispSwap_LoadName(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + +} + +void __glXDispSwap_PassThrough(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_FLOAT(pc + 0); + +} + +void __glXDispSwap_PopName(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +} + +void __glXDispSwap_PushName(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + +} + +void __glXDispSwap_DrawBuffer(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + +} + +void __glXDispSwap_Clear(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + +} + +void __glXDispSwap_ClearAccum(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_FLOAT(pc + 0); + __GLX_SWAP_FLOAT(pc + 4); + __GLX_SWAP_FLOAT(pc + 8); + __GLX_SWAP_FLOAT(pc + 12); + +} + +void __glXDispSwap_ClearIndex(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_FLOAT(pc + 0); + +} + +void __glXDispSwap_ClearColor(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_FLOAT(pc + 0); + __GLX_SWAP_FLOAT(pc + 4); + __GLX_SWAP_FLOAT(pc + 8); + __GLX_SWAP_FLOAT(pc + 12); + +} + +void __glXDispSwap_ClearStencil(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + +} + +void __glXDispSwap_ClearDepth(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 8); + pc -= 4; + } +#endif + __GLX_SWAP_DOUBLE(pc + 0); + +} + +void __glXDispSwap_StencilMask(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + +} + +void __glXDispSwap_ColorMask(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +} + +void __glXDispSwap_DepthMask(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +} + +void __glXDispSwap_IndexMask(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + +} + +void __glXDispSwap_Accum(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_FLOAT(pc + 4); + +} + +void __glXDispSwap_Disable(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + +} + +void __glXDispSwap_Enable(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + +} + +void __glXDispSwap_PopAttrib(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +} + +void __glXDispSwap_PushAttrib(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + +} + +void __glXDispSwap_MapGrid1d(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 20); + pc -= 4; + } +#endif + __GLX_SWAP_INT(pc + 16); + __GLX_SWAP_DOUBLE(pc + 0); + __GLX_SWAP_DOUBLE(pc + 8); + +} + +void __glXDispSwap_MapGrid1f(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_FLOAT(pc + 4); + __GLX_SWAP_FLOAT(pc + 8); + +} + +void __glXDispSwap_MapGrid2d(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 40); + pc -= 4; + } +#endif + __GLX_SWAP_INT(pc + 32); + __GLX_SWAP_DOUBLE(pc + 0); + __GLX_SWAP_DOUBLE(pc + 8); + __GLX_SWAP_INT(pc + 36); + __GLX_SWAP_DOUBLE(pc + 16); + __GLX_SWAP_DOUBLE(pc + 24); + +} + +void __glXDispSwap_MapGrid2f(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_FLOAT(pc + 4); + __GLX_SWAP_FLOAT(pc + 8); + __GLX_SWAP_INT(pc + 12); + __GLX_SWAP_FLOAT(pc + 16); + __GLX_SWAP_FLOAT(pc + 20); + +} + +void __glXDispSwap_EvalCoord1dv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 8); + pc -= 4; + } +#endif + __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 1); + +} + +void __glXDispSwap_EvalCoord1fv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_FLOAT_ARRAY(pc + 0, 1); + +} + +void __glXDispSwap_EvalCoord2dv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 16); + pc -= 4; + } +#endif + __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2); + +} + +void __glXDispSwap_EvalCoord2fv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2); + +} + +void __glXDispSwap_EvalMesh1(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + 8); + +} + +void __glXDispSwap_EvalPoint1(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + +} + +void __glXDispSwap_EvalMesh2(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + 8); + __GLX_SWAP_INT(pc + 12); + __GLX_SWAP_INT(pc + 16); + +} + +void __glXDispSwap_EvalPoint2(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + +} + +void __glXDispSwap_AlphaFunc(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_FLOAT(pc + 4); + +} + +void __glXDispSwap_BlendFunc(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + +} + +void __glXDispSwap_LogicOp(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + +} + +void __glXDispSwap_StencilFunc(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + 8); + +} + +void __glXDispSwap_StencilOp(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + 8); + +} + +void __glXDispSwap_DepthFunc(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + +} + +void __glXDispSwap_PixelZoom(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_FLOAT(pc + 0); + __GLX_SWAP_FLOAT(pc + 4); + +} + +void __glXDispSwap_PixelTransferf(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_FLOAT(pc + 4); + +} + +void __glXDispSwap_PixelTransferi(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + +} + +void __glXDispSwap_PixelMapfv(GLbyte *pc) +{ + GLint mapsize; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 4); + mapsize = *(GLint *)(pc + 4); + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_FLOAT_ARRAY(pc + 8, mapsize); + +} + +void __glXDispSwap_PixelMapuiv(GLbyte *pc) +{ + GLint mapsize; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 4); + mapsize = *(GLint *)(pc + 4); + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT_ARRAY(pc + 8, mapsize); + +} + +void __glXDispSwap_PixelMapusv(GLbyte *pc) +{ + GLint mapsize; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 4); + mapsize = *(GLint *)(pc + 4); + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_SHORT_ARRAY(pc + 8, mapsize); + +} + +void __glXDispSwap_ReadBuffer(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + +} + +void __glXDispSwap_CopyPixels(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + 8); + __GLX_SWAP_INT(pc + 12); + __GLX_SWAP_INT(pc + 16); + +} + +void __glXDispSwap_DepthRange(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 16); + pc -= 4; + } +#endif + __GLX_SWAP_DOUBLE(pc + 0); + __GLX_SWAP_DOUBLE(pc + 8); + +} + +void __glXDispSwap_Frustum(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 48); + pc -= 4; + } +#endif + __GLX_SWAP_DOUBLE(pc + 0); + __GLX_SWAP_DOUBLE(pc + 8); + __GLX_SWAP_DOUBLE(pc + 16); + __GLX_SWAP_DOUBLE(pc + 24); + __GLX_SWAP_DOUBLE(pc + 32); + __GLX_SWAP_DOUBLE(pc + 40); + +} + +void __glXDispSwap_LoadIdentity(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +} + +void __glXDispSwap_LoadMatrixf(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_FLOAT_ARRAY(pc + 0, 16); + +} + +void __glXDispSwap_LoadMatrixd(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 128); + pc -= 4; + } +#endif + __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 16); + +} + +void __glXDispSwap_MatrixMode(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + +} + +void __glXDispSwap_MultMatrixf(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_FLOAT_ARRAY(pc + 0, 16); + +} + +void __glXDispSwap_MultMatrixd(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 128); + pc -= 4; + } +#endif + __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 16); + +} + +void __glXDispSwap_Ortho(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 48); + pc -= 4; + } +#endif + __GLX_SWAP_DOUBLE(pc + 0); + __GLX_SWAP_DOUBLE(pc + 8); + __GLX_SWAP_DOUBLE(pc + 16); + __GLX_SWAP_DOUBLE(pc + 24); + __GLX_SWAP_DOUBLE(pc + 32); + __GLX_SWAP_DOUBLE(pc + 40); + +} + +void __glXDispSwap_PopMatrix(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +} + +void __glXDispSwap_PushMatrix(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +} + +void __glXDispSwap_Rotated(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 32); + pc -= 4; + } +#endif + __GLX_SWAP_DOUBLE(pc + 0); + __GLX_SWAP_DOUBLE(pc + 8); + __GLX_SWAP_DOUBLE(pc + 16); + __GLX_SWAP_DOUBLE(pc + 24); + +} + +void __glXDispSwap_Rotatef(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_FLOAT(pc + 0); + __GLX_SWAP_FLOAT(pc + 4); + __GLX_SWAP_FLOAT(pc + 8); + __GLX_SWAP_FLOAT(pc + 12); + +} + +void __glXDispSwap_Scaled(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 24); + pc -= 4; + } +#endif + __GLX_SWAP_DOUBLE(pc + 0); + __GLX_SWAP_DOUBLE(pc + 8); + __GLX_SWAP_DOUBLE(pc + 16); + +} + +void __glXDispSwap_Scalef(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_FLOAT(pc + 0); + __GLX_SWAP_FLOAT(pc + 4); + __GLX_SWAP_FLOAT(pc + 8); + +} + +void __glXDispSwap_Translated(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 24); + pc -= 4; + } +#endif + __GLX_SWAP_DOUBLE(pc + 0); + __GLX_SWAP_DOUBLE(pc + 8); + __GLX_SWAP_DOUBLE(pc + 16); + +} + +void __glXDispSwap_Translatef(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_FLOAT(pc + 0); + __GLX_SWAP_FLOAT(pc + 4); + __GLX_SWAP_FLOAT(pc + 8); + +} + +void __glXDispSwap_Viewport(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + 8); + __GLX_SWAP_INT(pc + 12); + +} + +void __glXDispSwap_PolygonOffset(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_FLOAT(pc + 0); + __GLX_SWAP_FLOAT(pc + 4); + +} + +void __glXDispSwap_CopyTexImage1D(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + 8); + __GLX_SWAP_INT(pc + 12); + __GLX_SWAP_INT(pc + 16); + __GLX_SWAP_INT(pc + 20); + __GLX_SWAP_INT(pc + 24); + +} + +void __glXDispSwap_CopyTexImage2D(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + 8); + __GLX_SWAP_INT(pc + 12); + __GLX_SWAP_INT(pc + 16); + __GLX_SWAP_INT(pc + 20); + __GLX_SWAP_INT(pc + 24); + __GLX_SWAP_INT(pc + 28); + +} + +void __glXDispSwap_CopyTexSubImage1D(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + 8); + __GLX_SWAP_INT(pc + 12); + __GLX_SWAP_INT(pc + 16); + __GLX_SWAP_INT(pc + 20); + +} + +void __glXDispSwap_CopyTexSubImage2D(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + 8); + __GLX_SWAP_INT(pc + 12); + __GLX_SWAP_INT(pc + 16); + __GLX_SWAP_INT(pc + 20); + __GLX_SWAP_INT(pc + 24); + __GLX_SWAP_INT(pc + 28); + +} + +void __glXDispSwap_BindTexture(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + +} + +void __glXDispSwap_PrioritizeTextures(GLbyte *pc) +{ + GLsizei n; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + n = *(GLsizei *)(pc + 0); + __GLX_SWAP_INT_ARRAY(pc + 4, n); + __GLX_SWAP_FLOAT_ARRAY(pc + 4+n*4, n); + +} + +void __glXDispSwap_Indexubv(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +} + +void __glXDispSwap_BlendColor(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_FLOAT(pc + 0); + __GLX_SWAP_FLOAT(pc + 4); + __GLX_SWAP_FLOAT(pc + 8); + __GLX_SWAP_FLOAT(pc + 12); + +} + +void __glXDispSwap_BlendEquation(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + +} + +void __glXDispSwap_ColorTableParameterfv(GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glColorTableParameterfv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize); + +} + +void __glXDispSwap_ColorTableParameteriv(GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glColorTableParameteriv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT_ARRAY(pc + 8, compsize); + +} + +void __glXDispSwap_CopyColorTable(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + 8); + __GLX_SWAP_INT(pc + 12); + __GLX_SWAP_INT(pc + 16); + +} + +void __glXDispSwap_CopyColorSubTable(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + 8); + __GLX_SWAP_INT(pc + 12); + __GLX_SWAP_INT(pc + 16); + +} + +void __glXDispSwap_ConvolutionParameterf(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_FLOAT(pc + 8); + +} + +void __glXDispSwap_ConvolutionParameterfv(GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glConvolutionParameterfv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize); + +} + +void __glXDispSwap_ConvolutionParameteri(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + 8); + +} + +void __glXDispSwap_ConvolutionParameteriv(GLbyte *pc) +{ + GLenum pname; + GLint compsize; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 4); + pname = *(GLenum *)(pc + 4); + compsize = __glConvolutionParameteriv_size(pname); + if (compsize < 0) compsize = 0; + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT_ARRAY(pc + 8, compsize); + +} + +void __glXDispSwap_CopyConvolutionFilter1D(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + 8); + __GLX_SWAP_INT(pc + 12); + __GLX_SWAP_INT(pc + 16); + +} + +void __glXDispSwap_CopyConvolutionFilter2D(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + 8); + __GLX_SWAP_INT(pc + 12); + __GLX_SWAP_INT(pc + 16); + __GLX_SWAP_INT(pc + 20); + +} + +void __glXDispSwap_Histogram(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + 8); + +} + +void __glXDispSwap_Minmax(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + +} + +void __glXDispSwap_ResetHistogram(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + +} + +void __glXDispSwap_ResetMinmax(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + +} + +void __glXDispSwap_CopyTexSubImage3D(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + 8); + __GLX_SWAP_INT(pc + 12); + __GLX_SWAP_INT(pc + 16); + __GLX_SWAP_INT(pc + 20); + __GLX_SWAP_INT(pc + 24); + __GLX_SWAP_INT(pc + 28); + __GLX_SWAP_INT(pc + 32); + +} + +void __glXDispSwap_ActiveTextureARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + +} + +void __glXDispSwap_MultiTexCoord1dvARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 12); + pc -= 4; + } +#endif + __GLX_SWAP_INT(pc + 8); + __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 1); + +} + +void __glXDispSwap_MultiTexCoord1fvARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_FLOAT_ARRAY(pc + 4, 1); + +} + +void __glXDispSwap_MultiTexCoord1ivARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT_ARRAY(pc + 4, 1); + +} + +void __glXDispSwap_MultiTexCoord1svARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_SHORT_ARRAY(pc + 4, 1); + +} + +void __glXDispSwap_MultiTexCoord2dvARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 20); + pc -= 4; + } +#endif + __GLX_SWAP_INT(pc + 16); + __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2); + +} + +void __glXDispSwap_MultiTexCoord2fvARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_FLOAT_ARRAY(pc + 4, 2); + +} + +void __glXDispSwap_MultiTexCoord2ivARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT_ARRAY(pc + 4, 2); + +} + +void __glXDispSwap_MultiTexCoord2svARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_SHORT_ARRAY(pc + 4, 2); + +} + +void __glXDispSwap_MultiTexCoord3dvARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 28); + pc -= 4; + } +#endif + __GLX_SWAP_INT(pc + 24); + __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3); + +} + +void __glXDispSwap_MultiTexCoord3fvARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_FLOAT_ARRAY(pc + 4, 3); + +} + +void __glXDispSwap_MultiTexCoord3ivARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT_ARRAY(pc + 4, 3); + +} + +void __glXDispSwap_MultiTexCoord3svARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_SHORT_ARRAY(pc + 4, 3); + +} + +void __glXDispSwap_MultiTexCoord4dvARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + +#ifdef __GLX_ALIGN64 + if ((unsigned long)(pc) & 7) { + __GLX_MEM_COPY(pc-4, pc, 36); + pc -= 4; + } +#endif + __GLX_SWAP_INT(pc + 32); + __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4); + +} + +void __glXDispSwap_MultiTexCoord4fvARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_FLOAT_ARRAY(pc + 4, 4); + +} + +void __glXDispSwap_MultiTexCoord4ivARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_INT_ARRAY(pc + 4, 4); + +} + +void __glXDispSwap_MultiTexCoord4svARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(pc + 0); + __GLX_SWAP_SHORT_ARRAY(pc + 4, 4); + +} + diff --git a/xorg-server/hw/dmx/glxProxy/global.c b/xorg-server/hw/dmx/glxProxy/global.c new file mode 100644 index 000000000..0e6efeff7 --- /dev/null +++ b/xorg-server/hw/dmx/glxProxy/global.c @@ -0,0 +1,76 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ + +#define NEED_REPLIES +#include "glxserver.h" + +/* +** The last context used by the server. It is the context that is current +** from the server's perspective. +*/ +__GLXcontext *__glXLastContext; + +/* +** X resources. +*/ +RESTYPE __glXContextRes; +RESTYPE __glXClientRes; +RESTYPE __glXPixmapRes; +RESTYPE __glXWindowRes; +RESTYPE __glXPbufferRes; + +/* +** Error codes with the extension error base already added in. +*/ +int __glXerrorBase; +int __glXBadContext, __glXBadContextState, __glXBadDrawable, __glXBadPixmap; +int __glXBadContextTag, __glXBadCurrentWindow; +int __glXBadRenderRequest, __glXBadLargeRequest; +int __glXUnsupportedPrivateRequest; +int __glXBadFBConfig, __glXBadPbuffer; + +/* +** Reply for most singles. +*/ +xGLXSingleReply __glXReply; + +/* +** A set of state for each client. The 0th one is unused because client +** indices start at 1, not 0. +*/ +__GLXclientState *__glXClients[MAXCLIENTS+1]; + +int __glXVersionMajor; +int __glXVersionMinor; diff --git a/xorg-server/hw/dmx/glxProxy/glxcmds.c b/xorg-server/hw/dmx/glxProxy/glxcmds.c new file mode 100644 index 000000000..2365f829f --- /dev/null +++ b/xorg-server/hw/dmx/glxProxy/glxcmds.c @@ -0,0 +1,3618 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ + +#ifdef HAVE_DMX_CONFIG_H +#include +#endif + +#include "dmx.h" +#include "dmxwindow.h" +#include "dmxpixmap.h" +#include "dmxfont.h" +#include "dmxsync.h" + +#undef Xmalloc +#undef Xcalloc +#undef Xrealloc +#undef Xfree + +#define NEED_REPLIES +#define FONT_PCF +#include "glxserver.h" +#include +#include "g_disptab.h" +#include +#include +#include "glxutil.h" +#include "glxext.h" +#include "unpack.h" + +#include "GL/glxproto.h" +#include "glxvendor.h" +#include "glxvisuals.h" +#include "glxswap.h" + +#ifdef PANORAMIX +#include "panoramiXsrv.h" +#endif + +extern __GLXFBConfig **__glXFBConfigs; +extern int __glXNumFBConfigs; + +extern __GLXFBConfig *glxLookupFBConfig( GLXFBConfigID id ); +extern __GLXFBConfig *glxLookupFBConfigByVID( VisualID vid ); +extern __GLXFBConfig *glxLookupBackEndFBConfig( GLXFBConfigID id, int screen ); +extern int glxIsExtensionSupported( char *ext ); +extern int __glXGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc); + +#define BE_TO_CLIENT_ERROR(x) \ + ( (x) >= __glXerrorBase ? \ + (x) - dmxScreen->glxErrorBase + __glXerrorBase \ + : (x) ) + +Display *GetBackEndDisplay( __GLXclientState *cl, int s ) +{ + if (! cl->be_displays[s] ) { + cl->be_displays[s] = XOpenDisplay( DisplayString(dmxScreens[s].beDisplay) ); + } + return( cl->be_displays[s] ); +} + +/* +** Create a GL context with the given properties. +*/ +static int CreateContext(__GLXclientState *cl, + GLXContextID gcId, + VisualID vid, GLXFBConfigID fbconfigId, + int screen, + GLXContextID shareList, + int isDirect ) +{ + ClientPtr client = cl->client; + xGLXCreateContextReq *be_req; + xGLXCreateNewContextReq *be_new_req; + VisualPtr pVisual; + ScreenPtr pScreen; + __GLXcontext *glxc, *shareglxc; + __GLXvisualConfig *pGlxVisual; + __GLXscreenInfo *pGlxScreen; + VisualID visual = vid; + GLint i; + int from_screen = screen; + int to_screen = screen; + DMXScreenInfo *dmxScreen; + VisualID be_vid; + GLXFBConfigID be_fbconfigId; + int num_be_screens; + Display *dpy; + + /* + ** Check if screen exists. + */ + if (screen >= screenInfo.numScreens) { + client->errorValue = screen; + return BadValue; + } + + +#ifdef PANORAMIX + if (!noPanoramiXExtension) { + from_screen = 0; + to_screen = screenInfo.numScreens - 1; + } +#endif + + /* + ** Find the display list space that we want to share. + ** + */ + if (shareList == None) { + shareglxc = NULL; + } else { + shareglxc = (__GLXcontext *) LookupIDByType(shareList, __glXContextRes); + if (!shareglxc) { + client->errorValue = shareList; + return __glXBadContext; + } + } + + /* + ** Allocate memory for the new context + */ + glxc = (__GLXcontext *) __glXMalloc(sizeof(__GLXcontext)); + if (!glxc) { + return BadAlloc; + } + memset(glxc, 0, sizeof(__GLXcontext)); + + pScreen = screenInfo.screens[screen]; + pGlxScreen = &__glXActiveScreens[screen]; + + if (fbconfigId != None) { + glxc->pFBConfig = glxLookupFBConfig( fbconfigId ); + if (!glxc->pFBConfig) { + client->errorValue = fbconfigId; + __glXFree( glxc ); + return BadValue; + } + visual = glxc->pFBConfig->associatedVisualId; + } + else { + glxc->pFBConfig = NULL; + } + + if (visual != None) { + /* + ** Check if the visual ID is valid for this screen. + */ + pVisual = pScreen->visuals; + for (i = 0; i < pScreen->numVisuals; i++, pVisual++) { + if (pVisual->vid == visual) { + break; + } + } + if (i == pScreen->numVisuals) { + client->errorValue = visual; + __glXFree( glxc ); + return BadValue; + } + + pGlxVisual = pGlxScreen->pGlxVisual; + for (i = 0; i < pGlxScreen->numVisuals; i++, pGlxVisual++) { + if (pGlxVisual->vid == visual) { + break; + } + } + if (i == pGlxScreen->numVisuals) { + /* + ** Visual not support on this screen by this OpenGL implementation. + */ + client->errorValue = visual; + __glXFree( glxc ); + return BadValue; + } + + if ( glxc->pFBConfig == NULL ) { + glxc->pFBConfig = glxLookupFBConfigByVID( visual ); + + if ( glxc->pFBConfig == NULL ) { + /* + * visual does not have an FBConfig ??? + client->errorValue = visual; + __glXFree( glxc ); + return BadValue; + */ + } + } + } + else { + pVisual = NULL; + pGlxVisual = NULL; + } + + glxc->pScreen = pScreen; + glxc->pGlxScreen = pGlxScreen; + glxc->pVisual = pVisual; + glxc->pGlxVisual = pGlxVisual; + + /* + * allocate memory for back-end servers info + */ + num_be_screens = to_screen - from_screen + 1; + glxc->real_ids = (XID *)__glXMalloc(sizeof(XID) * num_be_screens); + if (!glxc->real_ids) { + return BadAlloc; + } + glxc->real_vids = (XID *)__glXMalloc(sizeof(XID) * num_be_screens); + if (!glxc->real_vids) { + return BadAlloc; + } + + for (screen = from_screen; screen <= to_screen; screen++) { + int sent = 0; + pScreen = screenInfo.screens[screen]; + pGlxScreen = &__glXActiveScreens[screen]; + dmxScreen = &dmxScreens[screen]; + + if (glxc->pFBConfig) { + __GLXFBConfig *beFBConfig = glxLookupBackEndFBConfig( glxc->pFBConfig->id, + screen ); + be_fbconfigId = beFBConfig->id; + } + + if (pGlxVisual) { + + be_vid = glxMatchGLXVisualInConfigList( pGlxVisual, + dmxScreen->glxVisuals, + dmxScreen->numGlxVisuals ); + + if (!be_vid) { + /* visual is not supported on the back-end server */ + __glXFree( glxc->real_ids ); + __glXFree( glxc->real_vids ); + __glXFree( glxc ); + return BadValue; + } + } + + glxc->real_ids[screen-from_screen] = XAllocID(GetBackEndDisplay(cl,screen)); + + /* send the create context request to the back-end server */ + dpy = GetBackEndDisplay(cl,screen); + if (glxc->pFBConfig) { + /*Since for a certain visual both RGB and COLOR INDEX + *can be on then the only parmeter to choose the renderType + * should be the class of the colormap since all 4 first + * classes does not support RGB mode only COLOR INDEX , + * and so TrueColor and DirectColor does not support COLOR INDEX*/ + int renderType = glxc->pFBConfig->renderType; + if ( pVisual ) { + switch ( pVisual->class ){ + case PseudoColor: + case StaticColor: + case GrayScale: + case StaticGray: + renderType = GLX_COLOR_INDEX_TYPE; + break; + case TrueColor: + case DirectColor: + default: + renderType = GLX_RGBA_TYPE; + break; + } + } + if ( __GLX_IS_VERSION_SUPPORTED(1,3) ) { + LockDisplay(dpy); + GetReq(GLXCreateNewContext,be_new_req); + be_new_req->reqType = dmxScreen->glxMajorOpcode; + be_new_req->glxCode = X_GLXCreateNewContext; + be_new_req->context = (unsigned int)glxc->real_ids[screen-from_screen]; + be_new_req->fbconfig = (unsigned int)be_fbconfigId; + be_new_req->screen = DefaultScreen(dpy); + be_new_req->renderType = renderType; + + be_new_req->shareList = (shareglxc ? shareglxc->real_ids[screen-from_screen] : 0); + be_new_req->isDirect = 0; + UnlockDisplay(dpy); + glxc->real_vids[screen-from_screen] = be_fbconfigId; + sent = 1; + } + else if (glxIsExtensionSupported("GLX_SGIX_fbconfig")) { + + xGLXCreateContextWithConfigSGIXReq *ext_req; + xGLXVendorPrivateReq *vpreq; + LockDisplay(dpy); + GetReqExtra(GLXVendorPrivate, + sz_xGLXCreateContextWithConfigSGIXReq - sz_xGLXVendorPrivateReq, + vpreq); + ext_req = (xGLXCreateContextWithConfigSGIXReq *)vpreq; + ext_req->reqType = dmxScreen->glxMajorOpcode; + ext_req->glxCode = X_GLXVendorPrivate; + ext_req->vendorCode = X_GLXvop_CreateContextWithConfigSGIX; + ext_req->context = (unsigned int)glxc->real_ids[screen-from_screen]; + ext_req->fbconfig = (unsigned int)be_fbconfigId; + ext_req->screen = DefaultScreen(dpy); + ext_req->renderType = renderType; + ext_req->shareList = (shareglxc ? shareglxc->real_ids[screen-from_screen] : 0); + ext_req->isDirect = 0; + UnlockDisplay(dpy); + glxc->real_vids[screen-from_screen] = be_fbconfigId; + sent = 1; + } + } + + if (!sent) { + LockDisplay(dpy); + GetReq(GLXCreateContext,be_req); + be_req->reqType = dmxScreen->glxMajorOpcode; + be_req->glxCode = X_GLXCreateContext; + be_req->context = (unsigned int)glxc->real_ids[screen-from_screen]; + be_req->visual = (unsigned int)be_vid; + be_req->screen = DefaultScreen(dpy); + be_req->shareList = (shareglxc ? shareglxc->real_ids[screen-from_screen] : 0); + be_req->isDirect = 0; + UnlockDisplay(dpy); + glxc->real_vids[screen-from_screen] = be_vid; + } + SyncHandle(); + + } + + /* + ** Register this context as a resource. + */ + if (!AddResource(gcId, __glXContextRes, (pointer)glxc)) { + __glXFree( glxc->real_ids ); + __glXFree( glxc->real_vids ); + __glXFree( glxc ); + client->errorValue = gcId; + return BadAlloc; + } + + /* + ** Finally, now that everything is working, setup the rest of the + ** context. + */ + glxc->id = gcId; + glxc->share_id = shareList; + glxc->idExists = GL_TRUE; + glxc->isCurrent = GL_FALSE; + + return Success; +} + +int __glXCreateContext(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc; + + return( CreateContext(cl, req->context,req->visual, None, + req->screen, req->shareList, req->isDirect) ); + +} + +int __glXCreateNewContext(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc; + + return( CreateContext(cl, req->context,None, req->fbconfig, + req->screen, req->shareList, req->isDirect) ); + +} + +int __glXCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreateContextWithConfigSGIXReq *req = (xGLXCreateContextWithConfigSGIXReq *) pc; + + return( CreateContext(cl, req->context, None, req->fbconfig, + req->screen, req->shareList, req->isDirect) ); + +} + +int __glXQueryMaxSwapBarriersSGIX(__GLXclientState *cl, GLbyte *pc) +{ + ClientPtr client = cl->client; + xGLXQueryMaxSwapBarriersSGIXReq *req = + (xGLXQueryMaxSwapBarriersSGIXReq *)pc; + xGLXQueryMaxSwapBarriersSGIXReply reply; + + reply.type = X_Reply; + reply.sequenceNumber = client->sequence; + reply.length = 0; + reply.max = QueryMaxSwapBarriersSGIX(req->screen); + + if (client->swapped) { + __glXSwapQueryMaxSwapBarriersSGIXReply(client, &reply); + } else { + WriteToClient(client, sz_xGLXQueryMaxSwapBarriersSGIXReply, + (char *)&reply); + } + + return Success; +} + +int __glXBindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc) +{ + ClientPtr client = cl->client; + xGLXBindSwapBarrierSGIXReq *req = (xGLXBindSwapBarrierSGIXReq *)pc; + DrawablePtr pDraw; + __GLXpixmap *pGlxPixmap = NULL; + __glXWindow *pGlxWindow = NULL; + int rc; + + rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixGetAttrAccess); + if (rc != Success) { + pGlxPixmap = (__GLXpixmap *) LookupIDByType(req->drawable, + __glXPixmapRes); + if (pGlxPixmap) pDraw = pGlxPixmap->pDraw; + } + + if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) { + pGlxWindow = (__glXWindow *) LookupIDByType(req->drawable, + __glXWindowRes); + if (pGlxWindow) pDraw = pGlxWindow->pDraw; + } + + if (!pDraw) { + client->errorValue = req->drawable; + return __glXBadDrawable; + } + + return BindSwapBarrierSGIX(pDraw, req->barrier); +} + +int __glXJoinSwapGroupSGIX(__GLXclientState *cl, GLbyte *pc) +{ + ClientPtr client = cl->client; + xGLXJoinSwapGroupSGIXReq *req = (xGLXJoinSwapGroupSGIXReq *)pc; + DrawablePtr pDraw, pMember = NULL; + __GLXpixmap *pGlxPixmap = NULL; + __glXWindow *pGlxWindow = NULL; + int rc; + + rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixManageAccess); + if (rc != Success) { + pGlxPixmap = (__GLXpixmap *) LookupIDByType(req->drawable, + __glXPixmapRes); + if (pGlxPixmap) pDraw = pGlxPixmap->pDraw; + } + + if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) { + pGlxWindow = (__glXWindow *) LookupIDByType(req->drawable, + __glXWindowRes); + if (pGlxWindow) pDraw = pGlxWindow->pDraw; + } + + if (!pDraw) { + client->errorValue = req->drawable; + return __glXBadDrawable; + } + + if (req->member != None) { + rc = dixLookupDrawable(&pMember, req->member, client, 0, + DixGetAttrAccess); + if (rc != Success) { + pGlxPixmap = (__GLXpixmap *) LookupIDByType(req->member, + __glXPixmapRes); + if (pGlxPixmap) pMember = pGlxPixmap->pDraw; + } + + if (!pMember && __GLX_IS_VERSION_SUPPORTED(1,3) ) { + pGlxWindow = (__glXWindow *) LookupIDByType(req->member, + __glXWindowRes); + if (pGlxWindow) pMember = pGlxWindow->pDraw; + } + + if (!pMember) { + client->errorValue = req->member; + return __glXBadDrawable; + } + } + + return JoinSwapGroupSGIX(pDraw, pMember); +} + + +/* +** Destroy a GL context as an X resource. +*/ +int __glXDestroyContext(__GLXclientState *cl, GLbyte *pc) +{ + ClientPtr client = cl->client; + xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) pc; + xGLXDestroyContextReq *be_req; + GLXContextID gcId = req->context; + __GLXcontext *glxc; + int from_screen = 0; + int to_screen = 0; + int s; + + glxc = (__GLXcontext *) LookupIDByType(gcId, __glXContextRes); + if (glxc) { + /* + ** Just free the resource; don't actually destroy the context, + ** because it might be in use. The + ** destroy method will be called by the resource destruction routine + ** if necessary. + */ + FreeResourceByType(gcId, __glXContextRes, FALSE); + + from_screen = to_screen = glxc->pScreen->myNum; + + } else { + client->errorValue = gcId; + return __glXBadContext; + } + +#ifdef PANORAMIX + if (!noPanoramiXExtension) { + from_screen = 0; + to_screen = screenInfo.numScreens - 1; + } +#endif + + /* + * send DestroyContext request to all back-end servers + */ + for (s=from_screen; s<=to_screen; s++) { + DMXScreenInfo *dmxScreen = &dmxScreens[s]; + Display *dpy = GetBackEndDisplay(cl,s); + + LockDisplay(dpy); + GetReq(GLXDestroyContext,be_req); + be_req->reqType = dmxScreen->glxMajorOpcode; + be_req->glxCode = X_GLXDestroyContext; + be_req->context = glxc->real_ids[s-from_screen]; + UnlockDisplay(dpy); + SyncHandle(); + } + + return Success; +} + +/*****************************************************************************/ + +/* +** For each client, the server keeps a table of all the contexts that are +** current for that client (each thread of a client may have its own current +** context). These routines add, change, and lookup contexts in the table. +*/ + +/* +** Add a current context, and return the tag that will be used to refer to it. +*/ +static int AddCurrentContext(__GLXclientState *cl, __GLXcontext *glxc, DrawablePtr pDraw) +{ + int i; + int num = cl->numCurrentContexts; + __GLXcontext **table = cl->currentContexts; + + if (!glxc) return -1; + + /* + ** Try to find an empty slot and use it. + */ + for (i=0; i < num; i++) { + if (!table[i]) { + table[i] = glxc; + return i+1; + } + } + /* + ** Didn't find a free slot, so we'll have to grow the table. + */ + if (!num) { + table = (__GLXcontext **) __glXMalloc(sizeof(__GLXcontext *)); + cl->currentDrawables = (DrawablePtr *) __glXMalloc(sizeof(DrawablePtr)); + cl->be_currentCTag = (GLXContextTag *) __glXMalloc(screenInfo.numScreens *sizeof(GLXContextTag)); + } else { + table = (__GLXcontext **) __glXRealloc(table, + (num+1)*sizeof(__GLXcontext *)); + cl->currentDrawables = (DrawablePtr *) __glXRealloc( + cl->currentDrawables , + (num+1)*sizeof(DrawablePtr)); + cl->be_currentCTag = (GLXContextTag *) __glXRealloc(cl->be_currentCTag, + (num+1)*screenInfo.numScreens*sizeof(GLXContextTag)); + } + table[num] = glxc; + cl->currentDrawables[num] = pDraw; + cl->currentContexts = table; + cl->numCurrentContexts++; + + memset(cl->be_currentCTag + num*screenInfo.numScreens, 0, + screenInfo.numScreens * sizeof(GLXContextTag)); + + return num+1; +} + +/* +** Given a tag, change the current context for the corresponding entry. +*/ +static void ChangeCurrentContext(__GLXclientState *cl, __GLXcontext *glxc, + GLXContextTag tag) +{ + __GLXcontext **table = cl->currentContexts; + table[tag-1] = glxc; +} + +/* +** Given a tag, and back-end screen number, retrives the current back-end +** tag. +*/ +int GetCurrentBackEndTag(__GLXclientState *cl, GLXContextTag tag, int s) +{ + if (tag >0) { + return( cl->be_currentCTag[ (tag-1)*screenInfo.numScreens + s ] ); + } + else { + return( 0 ); + } +} + +/* +** Given a tag, and back-end screen number, sets the current back-end +** tag. +*/ +static void SetCurrentBackEndTag(__GLXclientState *cl, GLXContextTag tag, int s, GLXContextTag be_tag) +{ + if (tag >0) { + cl->be_currentCTag[ (tag-1)*screenInfo.numScreens + s ] = be_tag; + } +} + +/* +** For this implementation we have chosen to simply use the index of the +** context's entry in the table as the context tag. A tag must be greater +** than 0. +*/ +__GLXcontext *__glXLookupContextByTag(__GLXclientState *cl, GLXContextTag tag) +{ + int num = cl->numCurrentContexts; + + if (tag < 1 || tag > num) { + return 0; + } else { + return cl->currentContexts[tag-1]; + } +} + +DrawablePtr __glXLookupDrawableByTag(__GLXclientState *cl, GLXContextTag tag) +{ + int num = cl->numCurrentContexts; + + if (tag < 1 || tag > num) { + return 0; + } else { + return cl->currentDrawables[tag-1]; + } +} + +/*****************************************************************************/ + +static void StopUsingContext(__GLXcontext *glxc) +{ + if (glxc) { + if (glxc == __glXLastContext) { + /* Tell server GL library */ + __glXLastContext = 0; + } + glxc->isCurrent = GL_FALSE; + if (!glxc->idExists) { + __glXFreeContext(glxc); + } + } +} + +static void StartUsingContext(__GLXclientState *cl, __GLXcontext *glxc) +{ + glxc->isCurrent = GL_TRUE; +} + +/*****************************************************************************/ +/* +** Make an OpenGL context and drawable current. +*/ +static int MakeCurrent(__GLXclientState *cl, + GLXDrawable drawable, + GLXDrawable readdrawable, + GLXContextID context, + GLXContextTag oldContextTag) +{ + ClientPtr client = cl->client; + DrawablePtr pDraw = NULL; + DrawablePtr pReadDraw = NULL; + xGLXMakeCurrentReadSGIReply new_reply; + xGLXMakeCurrentReq *be_req; + xGLXMakeCurrentReply be_reply; + xGLXMakeContextCurrentReq *be_new_req; + xGLXMakeContextCurrentReply be_new_reply; + GLXDrawable drawId = drawable; + GLXDrawable readId = readdrawable; + GLXContextID contextId = context; + __GLXpixmap *pGlxPixmap = 0; + __GLXpixmap *pReadGlxPixmap = 0; + __GLXcontext *glxc, *prevglxc; + GLXContextTag tag = oldContextTag; + WindowPtr pWin = NULL; + WindowPtr pReadWin = NULL; + __glXWindow *pGlxWindow = NULL; + __glXWindow *pGlxReadWindow = NULL; + __glXPbuffer *pGlxPbuffer = NULL; + __glXPbuffer *pGlxReadPbuffer = NULL; +#ifdef PANORAMIX + PanoramiXRes *pXinDraw = NULL; + PanoramiXRes *pXinReadDraw = NULL; +#endif + int from_screen = 0; + int to_screen = 0; + int s, rc; + + /* + ** If one is None and the other isn't, it's a bad match. + */ + if ((drawId == None && contextId != None) || + (drawId != None && contextId == None)) { + return BadMatch; + } + + /* + ** Lookup old context. If we have one, it must be in a usable state. + */ + if (tag != 0) { + prevglxc = __glXLookupContextByTag(cl, tag); + if (!prevglxc) { + /* + ** Tag for previous context is invalid. + */ + return __glXBadContextTag; + } + } else { + prevglxc = 0; + } + + /* + ** Lookup new context. It must not be current for someone else. + */ + if (contextId != None) { + glxc = (__GLXcontext *) LookupIDByType(contextId, __glXContextRes); + if (!glxc) { + client->errorValue = contextId; + return __glXBadContext; + } + if ((glxc != prevglxc) && glxc->isCurrent) { + /* Context is current to somebody else */ + return BadAccess; + } + } else { + /* Switching to no context. Ignore new drawable. */ + glxc = 0; + } + + if (drawId != None) { + rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixWriteAccess); + if (rc == Success) { + if (pDraw->type == DRAWABLE_WINDOW) { + /* + ** Drawable is an X Window. + */ + VisualID vid; + pWin = (WindowPtr)pDraw; + vid = wVisual(pWin); + + new_reply.writeVid = (glxc->pFBConfig ? glxc->pFBConfig->id : vid); + new_reply.writeType = GLX_WINDOW_TYPE; + + /* + ** Check if window and context are similar. + */ + if ((vid != glxc->pVisual->vid) || + (pWin->drawable.pScreen != glxc->pScreen)) { + client->errorValue = drawId; + return BadMatch; + } + + from_screen = to_screen = pWin->drawable.pScreen->myNum; + + } else { + /* + ** An X Pixmap is not allowed as a parameter (a GLX Pixmap + ** is, but it must first be created with glxCreateGLXPixmap). + */ + client->errorValue = drawId; + return __glXBadDrawable; + } + } + + if (!pDraw) { + pGlxPixmap = (__GLXpixmap *) LookupIDByType(drawId, + __glXPixmapRes); + if (pGlxPixmap) { + /* + ** Check if pixmap and context are similar. + */ + if (pGlxPixmap->pScreen != glxc->pScreen || + pGlxPixmap->pGlxVisual != glxc->pGlxVisual) { + client->errorValue = drawId; + return BadMatch; + } + pDraw = pGlxPixmap->pDraw; + + new_reply.writeVid = (glxc->pFBConfig ? glxc->pFBConfig->id : + pGlxPixmap->pGlxVisual->vid); + + new_reply.writeType = GLX_PIXMAP_TYPE; + + from_screen = to_screen = pGlxPixmap->pScreen->myNum; + + } + } + + if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) { + pGlxWindow = (__glXWindow *) LookupIDByType(drawId, __glXWindowRes); + if (pGlxWindow) { + /* + ** Drawable is a GLXWindow. + ** + ** Check if GLX window and context are similar. + */ + if (pGlxWindow->pScreen != glxc->pScreen || + pGlxWindow->pGlxFBConfig != glxc->pFBConfig) { + client->errorValue = drawId; + return BadMatch; + } + + pDraw = pGlxWindow->pDraw; + new_reply.writeVid = pGlxWindow->pGlxFBConfig->id; + new_reply.writeType = GLX_GLXWINDOW_TYPE; + } + + } + + if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) { + pGlxPbuffer = (__glXPbuffer *)LookupIDByType(drawId, __glXPbufferRes); + if (pGlxPbuffer) { + if (pGlxPbuffer->pScreen != glxc->pScreen || + pGlxPbuffer->pFBConfig != glxc->pFBConfig) { + client->errorValue = drawId; + return BadMatch; + } + + pDraw = (DrawablePtr)pGlxPbuffer; + new_reply.writeVid = pGlxPbuffer->pFBConfig->id; + new_reply.writeType = GLX_PBUFFER_TYPE; + } + } + + if (!pDraw) { + /* + ** Drawable is not a Window , GLXWindow or a GLXPixmap. + */ + client->errorValue = drawId; + return __glXBadDrawable; + } + + } else { + pDraw = 0; + } + + if (readId != None && readId != drawId ) { + rc = dixLookupDrawable(&pReadDraw, readId, client, 0, DixReadAccess); + if (rc == Success) { + if (pReadDraw->type == DRAWABLE_WINDOW) { + /* + ** Drawable is an X Window. + */ + VisualID vid; + pReadWin = (WindowPtr)pDraw; + vid = wVisual(pReadWin); + + new_reply.readVid = (glxc->pFBConfig ? glxc->pFBConfig->id : vid); + new_reply.readType = GLX_WINDOW_TYPE; + + /* + ** Check if window and context are similar. + */ + if ((vid != glxc->pVisual->vid) || + (pReadWin->drawable.pScreen != glxc->pScreen)) { + client->errorValue = readId; + return BadMatch; + } + + } else { + + /* + ** An X Pixmap is not allowed as a parameter (a GLX Pixmap + ** is, but it must first be created with glxCreateGLXPixmap). + */ + client->errorValue = readId; + return __glXBadDrawable; + } + } + + if (!pReadDraw) { + pReadGlxPixmap = (__GLXpixmap *) LookupIDByType(readId, + __glXPixmapRes); + if (pReadGlxPixmap) { + /* + ** Check if pixmap and context are similar. + */ + if (pReadGlxPixmap->pScreen != glxc->pScreen || + pReadGlxPixmap->pGlxVisual != glxc->pGlxVisual) { + client->errorValue = readId; + return BadMatch; + } + pReadDraw = pReadGlxPixmap->pDraw; + + new_reply.readVid = (glxc->pFBConfig ? glxc->pFBConfig->id : + pReadGlxPixmap->pGlxVisual->vid ); + new_reply.readType = GLX_PIXMAP_TYPE; + + } + } + + if (!pReadDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) { + pGlxReadWindow = (__glXWindow *) + LookupIDByType(readId, __glXWindowRes); + if (pGlxReadWindow) { + /* + ** Drawable is a GLXWindow. + ** + ** Check if GLX window and context are similar. + */ + if (pGlxReadWindow->pScreen != glxc->pScreen || + pGlxReadWindow->pGlxFBConfig != glxc->pFBConfig) { + client->errorValue = readId; + return BadMatch; + } + + pReadDraw = pGlxReadWindow->pDraw; + new_reply.readVid = pGlxReadWindow->pGlxFBConfig->id; + new_reply.readType = GLX_GLXWINDOW_TYPE; + } + } + + if (!pReadDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) { + pGlxReadPbuffer = (__glXPbuffer *)LookupIDByType(readId, __glXPbufferRes); + if (pGlxReadPbuffer) { + if (pGlxReadPbuffer->pScreen != glxc->pScreen || + pGlxReadPbuffer->pFBConfig != glxc->pFBConfig) { + client->errorValue = drawId; + return BadMatch; + } + + pReadDraw = (DrawablePtr)pGlxReadPbuffer; + new_reply.readVid = pGlxReadPbuffer->pFBConfig->id; + new_reply.readType = GLX_PBUFFER_TYPE; + } + } + + if (!pReadDraw) { + /* + ** Drawable is neither a Window nor a GLXPixmap. + */ + client->errorValue = readId; + return __glXBadDrawable; + } + + } else { + pReadDraw = pDraw; + pReadGlxPixmap = pGlxPixmap; + pReadWin = pWin; + new_reply.readVid = new_reply.writeVid; + new_reply.readType = new_reply.writeType; + } + + if (prevglxc) { + + if (prevglxc->pGlxPixmap) { + /* + ** The previous drawable was a glx pixmap, release it. + */ + prevglxc->pGlxPixmap->refcnt--; + __glXFreeGLXPixmap( prevglxc->pGlxPixmap ); + prevglxc->pGlxPixmap = 0; + } + + if (prevglxc->pGlxReadPixmap) { + /* + ** The previous drawable was a glx pixmap, release it. + */ + prevglxc->pGlxReadPixmap->refcnt--; + __glXFreeGLXPixmap( prevglxc->pGlxReadPixmap ); + prevglxc->pGlxReadPixmap = 0; + } + + if (prevglxc->pGlxWindow) { + /* + ** The previous drawable was a glx window, release it. + */ + prevglxc->pGlxWindow->refcnt--; + __glXFreeGLXWindow( prevglxc->pGlxWindow ); + prevglxc->pGlxWindow = 0; + } + + if (prevglxc->pGlxReadWindow) { + /* + ** The previous drawable was a glx window, release it. + */ + prevglxc->pGlxReadWindow->refcnt--; + __glXFreeGLXWindow( prevglxc->pGlxReadWindow ); + prevglxc->pGlxReadWindow = 0; + } + + if (prevglxc->pGlxPbuffer) { + /* + ** The previous drawable was a glx Pbuffer, release it. + */ + prevglxc->pGlxPbuffer->refcnt--; + __glXFreeGLXPbuffer( prevglxc->pGlxPbuffer ); + prevglxc->pGlxPbuffer = 0; + } + + if (prevglxc->pGlxReadPbuffer) { + /* + ** The previous drawable was a glx Pbuffer, release it. + */ + prevglxc->pGlxReadPbuffer->refcnt--; + __glXFreeGLXPbuffer( prevglxc->pGlxReadPbuffer ); + prevglxc->pGlxReadPbuffer = 0; + } + + ChangeCurrentContext(cl, glxc, tag); + ChangeCurrentContext(cl, glxc, tag); + StopUsingContext(prevglxc); + } else { + tag = AddCurrentContext(cl, glxc, pDraw); + } + if (glxc) { + + glxc->pGlxPixmap = pGlxPixmap; + glxc->pGlxReadPixmap = pReadGlxPixmap; + glxc->pGlxWindow = pGlxWindow; + glxc->pGlxReadWindow = pGlxReadWindow; + glxc->pGlxPbuffer = pGlxPbuffer; + glxc->pGlxReadPbuffer = pGlxReadPbuffer; + + if (pGlxPixmap) { + pGlxPixmap->refcnt++; + } + + if (pReadGlxPixmap) { + pReadGlxPixmap->refcnt++; + } + + if (pGlxWindow) { + pGlxWindow->refcnt++; + } + + if (pGlxReadWindow) { + pGlxReadWindow->refcnt++; + } + + if (pGlxPbuffer) { + pGlxPbuffer->refcnt++; + } + + if (pGlxReadPbuffer) { + pGlxReadPbuffer->refcnt++; + } + + StartUsingContext(cl, glxc); + new_reply.contextTag = tag; + } else { + new_reply.contextTag = 0; + } + new_reply.length = 0; + new_reply.type = X_Reply; + new_reply.sequenceNumber = client->sequence; + +#ifdef PANORAMIX + if (!noPanoramiXExtension) { + from_screen = 0; + to_screen = screenInfo.numScreens - 1; + + if (pDraw && new_reply.writeType != GLX_PBUFFER_TYPE) { + pXinDraw = (PanoramiXRes *) + SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, DixReadAccess); + } + + if (pReadDraw && pReadDraw != pDraw && + new_reply.readType != GLX_PBUFFER_TYPE) { + pXinReadDraw = (PanoramiXRes *) + SecurityLookupIDByClass(client, pReadDraw->id, XRC_DRAWABLE, DixReadAccess); + } + else { + pXinReadDraw = pXinDraw; + } + } +#endif + + + /* send the MakeCurrent request to all required + * back-end servers. + */ + for (s = from_screen; s<=to_screen; s++) { + DMXScreenInfo *dmxScreen = &dmxScreens[s]; + Display *dpy = GetBackEndDisplay(cl,s); + unsigned int be_draw = None; + unsigned int be_read_draw = None; + + if (pGlxPixmap) { + be_draw = pGlxPixmap->be_xids[s]; + } + else if (pGlxPbuffer) { + be_draw = pGlxPbuffer->be_xids[s]; + } +#ifdef PANORAMIX + else if (pXinDraw) { + dixLookupWindow(&pWin, pXinDraw->info[s].id, client, DixReadAccess); + } +#endif + else if (pGlxWindow) { + pWin = (WindowPtr)pGlxWindow->pDraw; + } + + if (pWin && be_draw == None) { + be_draw = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window; + if (!be_draw) { + /* it might be that the window did not created yet on the */ + /* back-end server (lazy window creation option), force */ + /* creation of the window */ + dmxCreateAndRealizeWindow( pWin, TRUE ); + be_draw = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window; + } + } + + /* + * Before sending the MakeCurrent request - sync the + * X11 connection to the back-end servers to make sure + * that drawable is already created + */ + dmxSync( dmxScreen, 1 ); + + if (drawId == readId) { + LockDisplay(dpy); + GetReq(GLXMakeCurrent, be_req); + be_req->reqType = dmxScreen->glxMajorOpcode; + be_req->glxCode = X_GLXMakeCurrent; + be_req->drawable = be_draw; + be_req->context = (unsigned int)(glxc ? glxc->real_ids[s-from_screen] : 0); + be_req->oldContextTag = GetCurrentBackEndTag(cl, tag, s); + if (!_XReply(dpy, (xReply *) &be_reply, 0, False)) { + + /* The make current failed */ + UnlockDisplay(dpy); + SyncHandle(); + return( BE_TO_CLIENT_ERROR(dmxLastErrorEvent.error_code) ); + } + + UnlockDisplay(dpy); + SyncHandle(); + + SetCurrentBackEndTag( cl, tag, s, be_reply.contextTag ); + } + else { + + if (pReadGlxPixmap) { + be_read_draw = pReadGlxPixmap->be_xids[s]; + } + else if (pGlxReadPbuffer) { + be_read_draw = pGlxReadPbuffer->be_xids[s]; + } +#ifdef PANORAMIX + else if (pXinReadDraw) { + dixLookupWindow(&pReadWin, pXinReadDraw->info[s].id, client, + DixReadAccess); + } +#endif + else if (pGlxReadWindow) { + pReadWin = (WindowPtr)pGlxReadWindow->pDraw; + } + + if (pReadWin && be_read_draw == None) { + be_read_draw = (unsigned int)(DMX_GET_WINDOW_PRIV(pReadWin))->window; + if (!be_read_draw) { + /* it might be that the window did not created yet on the */ + /* back-end server (lazy window creation option), force */ + /* creation of the window */ + dmxCreateAndRealizeWindow( pReadWin, TRUE ); + be_read_draw = (unsigned int)(DMX_GET_WINDOW_PRIV(pReadWin))->window; + dmxSync( dmxScreen, 1 ); + } + } + + if ( __GLX_IS_VERSION_SUPPORTED(1,3) ) { + LockDisplay(dpy); + GetReq(GLXMakeContextCurrent, be_new_req); + be_new_req->reqType = dmxScreen->glxMajorOpcode; + be_new_req->glxCode = X_GLXMakeContextCurrent; + be_new_req->drawable = be_draw; + be_new_req->readdrawable = be_read_draw; + be_new_req->context = (unsigned int)(glxc ? glxc->real_ids[s-from_screen] : 0); + be_new_req->oldContextTag = GetCurrentBackEndTag(cl, tag, s); + if (!_XReply(dpy, (xReply *) &be_new_reply, 0, False)) { + + /* The make current failed */ + UnlockDisplay(dpy); + SyncHandle(); + return( BE_TO_CLIENT_ERROR(dmxLastErrorEvent.error_code) ); + } + + UnlockDisplay(dpy); + SyncHandle(); + + SetCurrentBackEndTag( cl, tag, s, be_new_reply.contextTag ); + } + else if (glxIsExtensionSupported("GLX_SGI_make_current_read")) { + xGLXMakeCurrentReadSGIReq *ext_req; + xGLXVendorPrivateWithReplyReq *vpreq; + xGLXMakeCurrentReadSGIReply ext_reply; + + LockDisplay(dpy); + GetReqExtra(GLXVendorPrivateWithReply, + sz_xGLXMakeCurrentReadSGIReq - sz_xGLXVendorPrivateWithReplyReq, + vpreq); + ext_req = (xGLXMakeCurrentReadSGIReq *)vpreq; + ext_req->reqType = dmxScreen->glxMajorOpcode; + ext_req->glxCode = X_GLXVendorPrivateWithReply; + ext_req->vendorCode = X_GLXvop_MakeCurrentReadSGI; + ext_req->drawable = be_draw; + ext_req->readable = be_read_draw; + ext_req->context = (unsigned int)(glxc ? glxc->real_ids[s-from_screen] : 0); + ext_req->oldContextTag = GetCurrentBackEndTag(cl, tag, s); + if (!_XReply(dpy, (xReply *) &ext_reply, 0, False)) { + + /* The make current failed */ + UnlockDisplay(dpy); + SyncHandle(); + return( BE_TO_CLIENT_ERROR(dmxLastErrorEvent.error_code) ); + } + + UnlockDisplay(dpy); + SyncHandle(); + + SetCurrentBackEndTag( cl, tag, s, ext_reply.contextTag ); + + } + else { + return BadMatch; + } + } + + XFlush( dpy ); + } + + if (client->swapped) { + __glXSwapMakeCurrentReply(client, &new_reply); + } else { + WriteToClient(client, sz_xGLXMakeContextCurrentReply, (char *)&new_reply); + } + + return Success; +} + +int __glXMakeCurrent(__GLXclientState *cl, GLbyte *pc) +{ + xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) pc; + + return( MakeCurrent(cl, req->drawable, req->drawable, + req->context, req->oldContextTag ) ); +} + +int __glXMakeContextCurrent(__GLXclientState *cl, GLbyte *pc) +{ + xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) pc; + + return( MakeCurrent(cl, req->drawable, req->readdrawable, + req->context, req->oldContextTag ) ); +} + +int __glXMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc) +{ + xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) pc; + + return( MakeCurrent(cl, req->drawable, req->readable, + req->context, req->oldContextTag ) ); +} + +int __glXIsDirect(__GLXclientState *cl, GLbyte *pc) +{ + ClientPtr client = cl->client; + xGLXIsDirectReq *req = (xGLXIsDirectReq *) pc; + xGLXIsDirectReply reply; + __GLXcontext *glxc; + + /* + ** Find the GL context. + */ + glxc = (__GLXcontext *) LookupIDByType(req->context, __glXContextRes); + if (!glxc) { + client->errorValue = req->context; + return __glXBadContext; + } + + reply.isDirect = 0; + reply.length = 0; + reply.type = X_Reply; + reply.sequenceNumber = client->sequence; + + if (client->swapped) { + __glXSwapIsDirectReply(client, &reply); + } else { + WriteToClient(client, sz_xGLXIsDirectReply, (char *)&reply); + } + + return Success; +} + +int __glXQueryVersion(__GLXclientState *cl, GLbyte *pc) +{ + ClientPtr client = cl->client; +/* xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) pc; */ + xGLXQueryVersionReply reply; + + /* + ** Server should take into consideration the version numbers sent by the + ** client if it wants to work with older clients; however, in this + ** implementation the server just returns its version number. + */ + reply.majorVersion = __glXVersionMajor; + reply.minorVersion = __glXVersionMinor; + reply.length = 0; + reply.type = X_Reply; + reply.sequenceNumber = client->sequence; + + if (client->swapped) { + __glXSwapQueryVersionReply(client, &reply); + } else { + WriteToClient(client, sz_xGLXQueryVersionReply, (char *)&reply); + } + return Success; +} + +int __glXWaitGL(__GLXclientState *cl, GLbyte *pc) +{ + xGLXWaitGLReq *req = (xGLXWaitGLReq *)pc; + xGLXWaitGLReq *be_req = (xGLXWaitGLReq *)pc; + int from_screen = 0; + int to_screen = 0; + int s; + __GLXcontext *glxc = NULL; + + if (req->contextTag != 0) { + glxc = __glXLookupContextByTag(cl, req->contextTag); + if (glxc) { + from_screen = to_screen = glxc->pScreen->myNum; + } + } + +#ifdef PANORAMIX + if (!noPanoramiXExtension) { + from_screen = 0; + to_screen = screenInfo.numScreens - 1; + } +#endif + + for (s=from_screen; s<=to_screen; s++) { + DMXScreenInfo *dmxScreen = &dmxScreens[s]; + Display *dpy = GetBackEndDisplay(cl,s); + + LockDisplay(dpy); + GetReq(GLXWaitGL,be_req); + be_req->reqType = dmxScreen->glxMajorOpcode; + be_req->glxCode = X_GLXWaitGL; + be_req->contextTag = (glxc ? GetCurrentBackEndTag(cl,req->contextTag,s) : 0); + UnlockDisplay(dpy); + SyncHandle(); + + XSync(dpy, False); + } + + return Success; +} + +int __glXWaitX(__GLXclientState *cl, GLbyte *pc) +{ + xGLXWaitXReq *req = (xGLXWaitXReq *)pc; + xGLXWaitXReq *be_req; + int from_screen = 0; + int to_screen = 0; + int s; + __GLXcontext *glxc = NULL; + + if (req->contextTag != 0) { + glxc = __glXLookupContextByTag(cl, req->contextTag); + if (glxc) { + from_screen = to_screen = glxc->pScreen->myNum; + } + } + +#ifdef PANORAMIX + if (!noPanoramiXExtension) { + from_screen = 0; + to_screen = screenInfo.numScreens - 1; + } +#endif + + for (s=from_screen; s<=to_screen; s++) { + DMXScreenInfo *dmxScreen = &dmxScreens[s]; + Display *dpy = GetBackEndDisplay(cl,s); + + dmxSync( dmxScreen, 1 ); + + LockDisplay(dpy); + GetReq(GLXWaitX,be_req); + be_req->reqType = dmxScreen->glxMajorOpcode; + be_req->glxCode = X_GLXWaitX; + be_req->contextTag = (glxc ? GetCurrentBackEndTag(cl,req->contextTag,s) : 0); + UnlockDisplay(dpy); + SyncHandle(); + + XFlush( dpy ); + } + + return Success; +} + +int __glXCopyContext(__GLXclientState *cl, GLbyte *pc) +{ + ClientPtr client = cl->client; + xGLXCopyContextReq *be_req; + xGLXCopyContextReq *req = (xGLXCopyContextReq *) pc; + GLXContextID source = req->source; + GLXContextID dest = req->dest; + GLXContextTag tag = req->contextTag; + unsigned long mask = req->mask; + __GLXcontext *src, *dst; + int s; + int from_screen = 0; + int to_screen = 0; + + /* + ** Check that each context exists. + */ + src = (__GLXcontext *) LookupIDByType(source, __glXContextRes); + if (!src) { + client->errorValue = source; + return __glXBadContext; + } + dst = (__GLXcontext *) LookupIDByType(dest, __glXContextRes); + if (!dst) { + client->errorValue = dest; + return __glXBadContext; + } + + /* + ** They must be in the same address space, and same screen. + */ + if (src->pGlxScreen != dst->pGlxScreen) { + client->errorValue = source; + return BadMatch; + } + + /* + ** The destination context must not be current for any client. + */ + if (dst->isCurrent) { + client->errorValue = dest; + return BadAccess; + } + + if (tag) { + __GLXcontext *tagcx = __glXLookupContextByTag(cl, tag); + + if (!tagcx) { + return __glXBadContextTag; + } + if (tagcx != src) { + /* + ** This would be caused by a faulty implementation of the client + ** library. + */ + return BadMatch; + } + } + + from_screen = to_screen = src->pScreen->myNum; + +#ifdef PANORAMIX + if (!noPanoramiXExtension) { + from_screen = 0; + to_screen = screenInfo.numScreens - 1; + } +#endif + + for (s=from_screen; s<=to_screen; s++) { + DMXScreenInfo *dmxScreen = &dmxScreens[s]; + Display *dpy = GetBackEndDisplay(cl,s); + + LockDisplay(dpy); + GetReq(GLXCopyContext,be_req); + be_req->reqType = dmxScreen->glxMajorOpcode; + be_req->glxCode = X_GLXCopyContext; + be_req->source = (unsigned int)src->real_ids[s-from_screen]; + be_req->dest = (unsigned int)dst->real_ids[s-from_screen]; + be_req->mask = mask; + be_req->contextTag = (tag ? GetCurrentBackEndTag(cl,req->contextTag,s) : 0); + UnlockDisplay(dpy); + SyncHandle(); + } + + return Success; +} + +int __glXGetVisualConfigs(__GLXclientState *cl, GLbyte *pc) +{ + ClientPtr client = cl->client; + xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc; + xGLXGetVisualConfigsReply reply; + __GLXscreenInfo *pGlxScreen; + __GLXvisualConfig *pGlxVisual; + CARD32 buf[__GLX_TOTAL_CONFIG]; + unsigned int screen; + int i, p; + + screen = req->screen; + if (screen > screenInfo.numScreens) { + /* The client library must send a valid screen number. */ + client->errorValue = screen; + return BadValue; + } + pGlxScreen = &__glXActiveScreens[screen]; + + reply.numVisuals = pGlxScreen->numGLXVisuals; + reply.numProps = __GLX_TOTAL_CONFIG; + reply.length = (pGlxScreen->numGLXVisuals * __GLX_SIZE_CARD32 * + __GLX_TOTAL_CONFIG) >> 2; + reply.type = X_Reply; + reply.sequenceNumber = client->sequence; + + WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *)&reply); + + for (i=0; i < pGlxScreen->numVisuals; i++) { + pGlxVisual = &pGlxScreen->pGlxVisual[i]; + if (!pGlxScreen->isGLXvis[i] || pGlxVisual->vid == 0) { + /* not a usable visual */ + continue; + } + p = 0; + buf[p++] = pGlxVisual->vid; + buf[p++] = pGlxVisual->class; + buf[p++] = pGlxVisual->rgba; + + buf[p++] = pGlxVisual->redSize; + buf[p++] = pGlxVisual->greenSize; + buf[p++] = pGlxVisual->blueSize; + buf[p++] = pGlxVisual->alphaSize; + buf[p++] = pGlxVisual->accumRedSize; + buf[p++] = pGlxVisual->accumGreenSize; + buf[p++] = pGlxVisual->accumBlueSize; + buf[p++] = pGlxVisual->accumAlphaSize; + + buf[p++] = pGlxVisual->doubleBuffer; + buf[p++] = pGlxVisual->stereo; + + buf[p++] = pGlxVisual->bufferSize; + buf[p++] = pGlxVisual->depthSize; + buf[p++] = pGlxVisual->stencilSize; + buf[p++] = pGlxVisual->auxBuffers; + buf[p++] = pGlxVisual->level; + /* + ** Add token/value pairs for extensions. + */ + buf[p++] = GLX_VISUAL_CAVEAT_EXT; + buf[p++] = pGlxVisual->visualRating; + buf[p++] = GLX_TRANSPARENT_TYPE_EXT; + buf[p++] = pGlxVisual->transparentPixel; + buf[p++] = GLX_TRANSPARENT_RED_VALUE_EXT; + buf[p++] = pGlxVisual->transparentRed; + buf[p++] = GLX_TRANSPARENT_GREEN_VALUE_EXT; + buf[p++] = pGlxVisual->transparentGreen; + buf[p++] = GLX_TRANSPARENT_BLUE_VALUE_EXT; + buf[p++] = pGlxVisual->transparentBlue; + buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE_EXT; + buf[p++] = pGlxVisual->transparentAlpha; + buf[p++] = GLX_TRANSPARENT_INDEX_VALUE_EXT; + buf[p++] = pGlxVisual->transparentIndex; + buf[p++] = GLX_SAMPLES_SGIS; + buf[p++] = pGlxVisual->multiSampleSize; + buf[p++] = GLX_SAMPLE_BUFFERS_SGIS; + buf[p++] = pGlxVisual->nMultiSampleBuffers; + buf[p++] = GLX_VISUAL_SELECT_GROUP_SGIX; + buf[p++] = pGlxVisual->visualSelectGroup; + + WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_TOTAL_CONFIG, + (char *)buf); + } + return Success; +} + +/* +** Create a GLX Pixmap from an X Pixmap. +*/ +static int CreateGLXPixmap(__GLXclientState *cl, + VisualID visual, GLXFBConfigID fbconfigId, + int screenNum, XID pixmapId, XID glxpixmapId ) +{ + ClientPtr client = cl->client; + xGLXCreateGLXPixmapReq *be_req; + xGLXCreatePixmapReq *be_new_req; + DrawablePtr pDraw; + ScreenPtr pScreen; + VisualPtr pVisual; + __GLXpixmap *pGlxPixmap; + __GLXscreenInfo *pGlxScreen; + __GLXvisualConfig *pGlxVisual; + __GLXFBConfig *pFBConfig; + int i, s, rc; + int from_screen, to_screen; +#ifdef PANORAMIX + PanoramiXRes *pXinDraw = NULL; +#endif + + rc = dixLookupDrawable(&pDraw, pixmapId, client, M_DRAWABLE_PIXMAP, + DixAddAccess); + if (rc != Success) + return rc; + + /* + ** Check if screen of visual matches screen of pixmap. + */ + pScreen = pDraw->pScreen; + if (screenNum != pScreen->myNum) { + return BadMatch; + } + + if (fbconfigId == NULL && visual == NULL) { + return BadValue; + } + + if (fbconfigId != None) { + pFBConfig = glxLookupFBConfig( fbconfigId ); + if (!pFBConfig) { + client->errorValue = fbconfigId; + return BadValue; + } + visual = pFBConfig->associatedVisualId; + } + else { + pFBConfig = NULL; + } + + if (visual != None) { + /* + ** Find the VisualRec for this visual. + */ + pVisual = pScreen->visuals; + for (i=0; i < pScreen->numVisuals; i++, pVisual++) { + if (pVisual->vid == visual) { + break; + } + } + if (i == pScreen->numVisuals) { + client->errorValue = visual; + return BadValue; + } + /* + ** Check if depth of visual matches depth of pixmap. + */ + if (pVisual->nplanes != pDraw->depth) { + client->errorValue = visual; + return BadMatch; + } + + /* + ** Get configuration of the visual. + */ + pGlxScreen = &__glXActiveScreens[screenNum]; + pGlxVisual = pGlxScreen->pGlxVisual; + for (i = 0; i < pGlxScreen->numVisuals; i++, pGlxVisual++) { + if (pGlxVisual->vid == visual) { + break; + } + } + if (i == pGlxScreen->numVisuals) { + /* + ** Visual not support on this screen by this OpenGL implementation. + */ + client->errorValue = visual; + return BadValue; + } + + + /* find the FBConfig for that visual (if any) */ + if ( pFBConfig == NULL ) { + pFBConfig = glxLookupFBConfigByVID( visual ); + + if ( pFBConfig == NULL ) { + /* + * visual does not have an FBConfig ??? + client->errorValue = visual; + return BadValue; + */ + } + } + } + else { + pVisual = NULL; + pGlxVisual = NULL; + } + + pGlxPixmap = (__GLXpixmap *) __glXMalloc(sizeof(__GLXpixmap)); + if (!pGlxPixmap) { + return BadAlloc; + } + pGlxPixmap->be_xids = (XID *) __glXMalloc(sizeof(XID) * screenInfo.numScreens); + if (!pGlxPixmap->be_xids) { + __glXFree( pGlxPixmap ); + return BadAlloc; + } + + pGlxPixmap->pDraw = pDraw; + pGlxPixmap->pGlxScreen = pGlxScreen; + pGlxPixmap->pGlxVisual = pGlxVisual; + pGlxPixmap->pFBConfig = pFBConfig; + pGlxPixmap->pScreen = pScreen; + pGlxPixmap->idExists = True; + pGlxPixmap->refcnt = 0; + + /* + ** Bump the ref count on the X pixmap so it won't disappear. + */ + ((PixmapPtr) pDraw)->refcnt++; + + /* + * send the request to the back-end server(s) + */ + from_screen = to_screen = screenNum; +#ifdef PANORAMIX + if (!noPanoramiXExtension) { + from_screen = 0; + to_screen = screenInfo.numScreens - 1; + + pXinDraw = (PanoramiXRes *) + SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, DixReadAccess); + } +#endif + + for (s=from_screen; s<=to_screen; s++) { + + DMXScreenInfo *dmxScreen = &dmxScreens[s]; + Display *dpy = GetBackEndDisplay(cl,s); + Pixmap be_pixmap; + DrawablePtr pRealDraw = pDraw; + +#ifdef PANORAMIX + if (pXinDraw) { + dixLookupDrawable(&pRealDraw, pXinDraw->info[s].id, client, 0, + DixAddAccess); + } +#endif + + be_pixmap = (DMX_GET_PIXMAP_PRIV((PixmapPtr)pRealDraw))->pixmap; + + /* make sure pixmap already created on back-end */ + dmxSync( dmxScreen, 1 ); + + if ( pFBConfig && __GLX_IS_VERSION_SUPPORTED(1,3) ) { + __GLXFBConfig *be_FBConfig = glxLookupBackEndFBConfig( pFBConfig->id, s ); + + LockDisplay(dpy); + pGlxPixmap->be_xids[s] = XAllocID(dpy); + GetReq(GLXCreatePixmap,be_new_req); + be_new_req->reqType = dmxScreen->glxMajorOpcode; + be_new_req->glxCode = X_GLXCreatePixmap; + be_new_req->screen = DefaultScreen(dpy); + be_new_req->fbconfig = be_FBConfig->id; + be_new_req->pixmap = (unsigned int)be_pixmap; + be_new_req->glxpixmap = (unsigned int)pGlxPixmap->be_xids[s]; + be_new_req->numAttribs = 0; + UnlockDisplay(dpy); + SyncHandle(); + } + else if (pFBConfig && glxIsExtensionSupported("GLX_SGIX_fbconfig")) { + __GLXFBConfig *be_FBConfig = glxLookupBackEndFBConfig( pFBConfig->id, s ); + xGLXCreateGLXPixmapWithConfigSGIXReq *ext_req; + xGLXVendorPrivateReq *vpreq; + + LockDisplay(dpy); + pGlxPixmap->be_xids[s] = XAllocID(dpy); + GetReqExtra(GLXVendorPrivate, + sz_xGLXCreateGLXPixmapWithConfigSGIXReq-sz_xGLXVendorPrivateReq, + vpreq); + ext_req = (xGLXCreateGLXPixmapWithConfigSGIXReq *)vpreq; + ext_req->reqType = dmxScreen->glxMajorOpcode; + ext_req->glxCode = X_GLXVendorPrivate; + ext_req->vendorCode = X_GLXvop_CreateGLXPixmapWithConfigSGIX; + ext_req->screen = DefaultScreen(dpy); + ext_req->fbconfig = be_FBConfig->id; + ext_req->pixmap = (unsigned int)be_pixmap; + ext_req->glxpixmap = (unsigned int)pGlxPixmap->be_xids[s]; + UnlockDisplay(dpy); + SyncHandle(); + } + else if (pGlxVisual) { + LockDisplay(dpy); + pGlxPixmap->be_xids[s] = XAllocID(dpy); + GetReq(GLXCreateGLXPixmap,be_req); + be_req->reqType = dmxScreen->glxMajorOpcode; + be_req->glxCode = X_GLXCreateGLXPixmap; + be_req->screen = DefaultScreen(dpy); + be_req->visual = (unsigned int)glxMatchGLXVisualInConfigList( + pGlxVisual, + dmxScreen->glxVisuals, + dmxScreen->numGlxVisuals ); + be_req->pixmap = (unsigned int)be_pixmap; + be_req->glxpixmap = (unsigned int)pGlxPixmap->be_xids[s]; + UnlockDisplay(dpy); + SyncHandle(); + } + else { + client->errorValue = ( visual ? visual : fbconfigId ); + __glXFree( pGlxPixmap ); + return BadValue; + } + + XFlush( dpy ); + } + + if (!(AddResource(glxpixmapId, __glXPixmapRes, pGlxPixmap))) { + __glXFree( pGlxPixmap ); + return BadAlloc; + } + + return Success; +} + +int __glXCreateGLXPixmap(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc; + + return( CreateGLXPixmap(cl, req->visual, None, + req->screen, req->pixmap, req->glxpixmap) ); +} + +int __glXCreatePixmap(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc; + + return( CreateGLXPixmap(cl, None, req->fbconfig, + req->screen, req->pixmap, req->glxpixmap) ); +} + +int __glXDestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc) +{ + ClientPtr client = cl->client; + xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc; + XID glxpixmap = req->glxpixmap; + __GLXpixmap *pGlxPixmap; + int s; + int from_screen, to_screen; + + /* + ** Check if it's a valid GLX pixmap. + */ + pGlxPixmap = (__GLXpixmap *)LookupIDByType(glxpixmap, __glXPixmapRes); + if (!pGlxPixmap) { + client->errorValue = glxpixmap; + return __glXBadPixmap; + } + FreeResource(glxpixmap, FALSE); + + /* + * destroy the pixmap on the back-end server(s). + */ + from_screen = to_screen = pGlxPixmap->pDraw->pScreen->myNum; +#ifdef PANORAMIX + if (!noPanoramiXExtension) { + from_screen = 0; + to_screen = screenInfo.numScreens - 1; + } +#endif + + for (s=from_screen; s<=to_screen; s++) { + DMXScreenInfo *dmxScreen = &dmxScreens[s]; + Display *dpy = GetBackEndDisplay(cl,s); + + /* make sure pixmap exist in back-end */ + dmxSync( dmxScreen, 1 ); + + LockDisplay(dpy); + GetReq(GLXDestroyGLXPixmap,req); + req->reqType = dmxScreen->glxMajorOpcode; + req->glxCode = X_GLXDestroyGLXPixmap; + req->glxpixmap = (unsigned int)pGlxPixmap->be_xids[s]; + UnlockDisplay(dpy); + SyncHandle(); + } + + + return Success; +} + +/*****************************************************************************/ + +/* +** NOTE: There is no portable implementation for swap buffers as of +** this time that is of value. Consequently, this code must be +** implemented by somebody other than SGI. +*/ +int __glXDoSwapBuffers(__GLXclientState *cl, XID drawId, GLXContextTag tag) +{ + ClientPtr client = cl->client; + DrawablePtr pDraw; + xGLXSwapBuffersReq *be_req; + WindowPtr pWin = NULL; + __GLXpixmap *pGlxPixmap = NULL; + __GLXcontext *glxc = NULL; +#ifdef PANORAMIX + PanoramiXRes *pXinDraw = NULL; +#endif + __glXWindow *pGlxWindow = NULL; + int from_screen = 0; + int to_screen = 0; + int s, rc; + + /* + ** Check that the GLX drawable is valid. + */ + rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixWriteAccess); + if (rc == Success) { + from_screen = to_screen = pDraw->pScreen->myNum; + + if (pDraw->type == DRAWABLE_WINDOW) { + /* + ** Drawable is an X window. + */ + pWin = (WindowPtr)pDraw; + } else { + /* + ** Drawable is an X pixmap, which is not allowed. + */ + client->errorValue = drawId; + return __glXBadDrawable; + } + } + + if (!pDraw) { + pGlxPixmap = (__GLXpixmap *) LookupIDByType(drawId, + __glXPixmapRes); + if (pGlxPixmap) { + /* + ** Drawable is a GLX pixmap. + */ + pDraw = pGlxPixmap->pDraw; + from_screen = to_screen = pGlxPixmap->pScreen->myNum; + } + } + + if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) { + pGlxWindow = (__glXWindow *) LookupIDByType(drawId, __glXWindowRes); + if (pGlxWindow) { + /* + ** Drawable is a GLXWindow. + */ + pDraw = pGlxWindow->pDraw; + from_screen = to_screen = pGlxWindow->pScreen->myNum; + } + } + + if (!pDraw) { + /* + ** Drawable is neither a X window nor a GLX pixmap. + */ + client->errorValue = drawId; + return __glXBadDrawable; + } + + if (tag) { + glxc = __glXLookupContextByTag(cl, tag); + if (!glxc) { + return __glXBadContextTag; + } + } + +#ifdef PANORAMIX + if (!noPanoramiXExtension) { + from_screen = 0; + to_screen = screenInfo.numScreens - 1; + pXinDraw = (PanoramiXRes *) + SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, DixReadAccess); + } +#endif + + /* If requested, send a glFinish to all back-end servers before swapping. */ + if (dmxGLXFinishSwap) { + for (s=from_screen; s<=to_screen; s++) { + Display *dpy = GetBackEndDisplay(cl,s); + DMXScreenInfo *dmxScreen = &dmxScreens[s]; + xGLXSingleReq *finishReq; + xGLXSingleReply reply; + +#define X_GLXSingle 0 /* needed by GetReq below */ + + LockDisplay(dpy); + GetReq(GLXSingle,finishReq); + finishReq->reqType = dmxScreen->glxMajorOpcode; + finishReq->glxCode = X_GLsop_Finish; + finishReq->contextTag = (tag ? GetCurrentBackEndTag(cl,tag,s) : 0); + (void) _XReply(dpy, (xReply*) &reply, 0, False); + UnlockDisplay(dpy); + SyncHandle(); + } + } + + /* If requested, send an XSync to all back-end servers before swapping. */ + if (dmxGLXSyncSwap) { + for (s=from_screen; s<=to_screen; s++) + XSync(GetBackEndDisplay(cl,s), False); + } + + + /* send the SwapBuffers request to all back-end servers */ + + for (s=from_screen; s<=to_screen; s++) { + DMXScreenInfo *dmxScreen = &dmxScreens[s]; + Display *dpy = GetBackEndDisplay(cl,s); + unsigned int be_draw = 0; + + if (pGlxPixmap) { + be_draw = (unsigned int)pGlxPixmap->be_xids[s]; + } +#ifdef PANORAMIX + else if (pXinDraw) { + dixLookupWindow(&pWin, pXinDraw->info[s].id, client, DixReadAccess); + } +#endif + else if (pGlxWindow) { + pWin = (WindowPtr)pGlxWindow->pDraw; + } + + if (pWin && !be_draw) { + be_draw = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window; + if (!be_draw) { + /* it might be that the window did not created yet on the */ + /* back-end server (lazy window creation option), force */ + /* creation of the window */ + dmxCreateAndRealizeWindow( pWin, TRUE ); + be_draw = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window; + } + } + + dmxSync( dmxScreen, 1 ); + + LockDisplay(dpy); + GetReq(GLXSwapBuffers,be_req); + be_req->reqType = dmxScreen->glxMajorOpcode; + be_req->glxCode = X_GLXSwapBuffers; + be_req->drawable = be_draw; + be_req->contextTag = ( tag ? GetCurrentBackEndTag(cl,tag,s) : 0 ); + UnlockDisplay(dpy); + SyncHandle(); + XFlush(dpy); + } + + return Success; +} + +int __glXSwapBuffers(__GLXclientState *cl, GLbyte *pc) +{ + ClientPtr client = cl->client; + DrawablePtr pDraw; + xGLXSwapBuffersReq *req = (xGLXSwapBuffersReq *) pc; + GLXContextTag tag = req->contextTag; + XID drawId = req->drawable; + __GLXpixmap *pGlxPixmap = NULL; + __GLXcontext *glxc = NULL; + __glXWindow *pGlxWindow = NULL; + int rc; + + /* + ** Check that the GLX drawable is valid. + */ + rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixWriteAccess); + if (rc == Success) { + if (pDraw->type != DRAWABLE_WINDOW) { + /* + ** Drawable is an X pixmap, which is not allowed. + */ + client->errorValue = drawId; + return __glXBadDrawable; + } + } + + if (!pDraw) { + pGlxPixmap = (__GLXpixmap *) LookupIDByType(drawId, + __glXPixmapRes); + if (pGlxPixmap) { + /* + ** Drawable is a GLX pixmap. + */ + pDraw = pGlxPixmap->pDraw; + } + } + + if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) { + pGlxWindow = (__glXWindow *) LookupIDByType(drawId, __glXWindowRes); + if (pGlxWindow) { + /* + ** Drawable is a GLXWindow. + */ + pDraw = pGlxWindow->pDraw; + } + } + + if (!pDraw) { + /* + ** Drawable is neither a X window nor a GLX pixmap. + */ + client->errorValue = drawId; + return __glXBadDrawable; + } + + if (tag) { + glxc = __glXLookupContextByTag(cl, tag); + if (!glxc) { + return __glXBadContextTag; + } + } + + if (pDraw && + pDraw->type == DRAWABLE_WINDOW && + DMX_GET_WINDOW_PRIV((WindowPtr)pDraw)->swapGroup) { + return SGSwapBuffers(cl, drawId, tag, pDraw); + } + + return __glXDoSwapBuffers(cl, drawId, tag); +} + + +/************************************************************************/ + +/* +** Render and Renderlarge are not in the GLX API. They are used by the GLX +** client library to send batches of GL rendering commands. +*/ + +/* +** Execute all the drawing commands in a request. +*/ +int __glXRender(__GLXclientState *cl, GLbyte *pc) +{ + xGLXRenderReq *req; + xGLXRenderReq *be_req; + int size; + __GLXcontext *glxc; + int from_screen = 0; + int to_screen = 0; + int s; + + /* + ** NOTE: much of this code also appears in the byteswapping version of this + ** routine, __glXSwapRender(). Any changes made here should also be + ** duplicated there. + */ + + req = (xGLXRenderReq *) pc; + + glxc = __glXLookupContextByTag(cl, req->contextTag); + if (!glxc) { + return 0; + } + from_screen = to_screen = glxc->pScreen->myNum; + +#ifdef PANORAMIX + if (!noPanoramiXExtension) { + from_screen = 0; + to_screen = screenInfo.numScreens - 1; + } +#endif + + pc += sz_xGLXRenderReq; + size = (req->length << 2) - sz_xGLXRenderReq; + + /* + * just forward the request to back-end server(s) + */ + for (s=from_screen; s<=to_screen; s++) { + DMXScreenInfo *dmxScreen = &dmxScreens[s]; + Display *dpy = GetBackEndDisplay(cl,s); + + LockDisplay(dpy); + GetReq(GLXRender,be_req); + be_req->reqType = dmxScreen->glxMajorOpcode; + be_req->glxCode = X_GLXRender; + be_req->length = req->length; + be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,s); + _XSend(dpy, (const char *)pc, size); + UnlockDisplay(dpy); + SyncHandle(); + } + + return Success; +} + +/* +** Execute a large rendering request (one that spans multiple X requests). +*/ +int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc) +{ + xGLXRenderLargeReq *req; + xGLXRenderLargeReq *be_req; + __GLXcontext *glxc; + int from_screen = 0; + int to_screen = 0; + int s; + + /* + ** NOTE: much of this code also appears in the byteswapping version of this + ** routine, __glXSwapRenderLarge(). Any changes made here should also be + ** duplicated there. + */ + + req = (xGLXRenderLargeReq *) pc; + glxc = __glXLookupContextByTag(cl, req->contextTag); + if (!glxc) { + return 0; + } + from_screen = to_screen = glxc->pScreen->myNum; + +#ifdef PANORAMIX + if (!noPanoramiXExtension) { + from_screen = 0; + to_screen = screenInfo.numScreens - 1; + } +#endif + + pc += sz_xGLXRenderLargeReq; + + /* + * just forward the request to back-end server(s) + */ + for (s=from_screen; s<=to_screen; s++) { + DMXScreenInfo *dmxScreen = &dmxScreens[s]; + Display *dpy = GetBackEndDisplay(cl,s); + + GetReq(GLXRenderLarge,be_req); + be_req->reqType = dmxScreen->glxMajorOpcode; + be_req->glxCode = X_GLXRenderLarge; + be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,s); + be_req->length = req->length; + be_req->requestNumber = req->requestNumber; + be_req->requestTotal = req->requestTotal; + be_req->dataBytes = req->dataBytes; + Data(dpy, (const char *)pc, req->dataBytes); + UnlockDisplay(dpy); + SyncHandle(); + + } + + return Success; +} + + +/************************************************************************/ + +int __glXVendorPrivate(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq *req; + + req = (xGLXVendorPrivateReq *) pc; + + switch( req->vendorCode ) { + + case X_GLvop_DeleteTexturesEXT: + return __glXVForwardSingleReq( cl, pc ); + break; + + case X_GLXvop_SwapIntervalSGI: + if (glxIsExtensionSupported("SGI_swap_control")) { + return __glXVForwardSingleReq( cl, pc ); + } + else { + return Success; + } + break; + +#if 0 /* glx 1.3 */ + case X_GLXvop_CreateGLXVideoSourceSGIX: + break; + case X_GLXvop_DestroyGLXVideoSourceSGIX: + break; + case X_GLXvop_CreateGLXPixmapWithConfigSGIX: + break; + case X_GLXvop_DestroyGLXPbufferSGIX: + break; + case X_GLXvop_ChangeDrawableAttributesSGIX: + break; +#endif + + case X_GLXvop_BindSwapBarrierSGIX: + return __glXBindSwapBarrierSGIX( cl, pc ); + break; + + case X_GLXvop_JoinSwapGroupSGIX: + return __glXJoinSwapGroupSGIX( cl, pc ); + break; + + case X_GLXvop_CreateContextWithConfigSGIX: + return __glXCreateContextWithConfigSGIX( cl, pc ); + break; + + default: + /* + ** unsupported private request + */ + cl->client->errorValue = req->vendorCode; + return __glXUnsupportedPrivateRequest; + } + + cl->client->errorValue = req->vendorCode; + return __glXUnsupportedPrivateRequest; + +} + +int __glXVendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateWithReplyReq *req; + + req = (xGLXVendorPrivateWithReplyReq *) pc; + + switch( req->vendorCode ) { + + case X_GLvop_GetConvolutionFilterEXT: + case X_GLvop_GetConvolutionParameterfvEXT: + case X_GLvop_GetConvolutionParameterivEXT: + case X_GLvop_GetSeparableFilterEXT: + case X_GLvop_GetHistogramEXT: + case X_GLvop_GetHistogramParameterivEXT: + case X_GLvop_GetMinmaxEXT: + case X_GLvop_GetMinmaxParameterfvEXT: + case X_GLvop_GetMinmaxParameterivEXT: + case X_GLvop_AreTexturesResidentEXT: + case X_GLvop_IsTextureEXT: + return( __glXVForwardPipe0WithReply(cl, pc) ); + break; + + case X_GLvop_GenTexturesEXT: + return( __glXVForwardAllWithReply(cl, pc) ); + break; + + +#if 0 /* glx1.3 */ + case X_GLvop_GetDetailTexFuncSGIS: + case X_GLvop_GetSharpenTexFuncSGIS: + case X_GLvop_GetColorTableSGI: + case X_GLvop_GetColorTableParameterfvSGI: + case X_GLvop_GetColorTableParameterivSGI: + case X_GLvop_GetTexFilterFuncSGIS: + case X_GLvop_GetInstrumentsSGIX: + case X_GLvop_InstrumentsBufferSGIX: + case X_GLvop_PollInstrumentsSGIX: + case X_GLvop_FlushRasterSGIX: + case X_GLXvop_CreateGLXPbufferSGIX: + case X_GLXvop_GetDrawableAttributesSGIX: + case X_GLXvop_QueryHyperpipeNetworkSGIX: + case X_GLXvop_QueryHyperpipeConfigSGIX: + case X_GLXvop_HyperpipeConfigSGIX: + case X_GLXvop_DestroyHyperpipeConfigSGIX: +#endif + case X_GLXvop_QueryMaxSwapBarriersSGIX: + return( __glXQueryMaxSwapBarriersSGIX(cl, pc) ); + break; + + case X_GLXvop_GetFBConfigsSGIX: + return( __glXGetFBConfigsSGIX(cl, pc) ); + break; + + case X_GLXvop_MakeCurrentReadSGI: + return( __glXMakeCurrentReadSGI(cl, pc) ); + break; + + case X_GLXvop_QueryContextInfoEXT: + return( __glXQueryContextInfoEXT(cl,pc) ); + break; + + default: + /* + ** unsupported private request + */ + cl->client->errorValue = req->vendorCode; + return __glXUnsupportedPrivateRequest; + } + +} + +int __glXQueryExtensionsString(__GLXclientState *cl, GLbyte *pc) +{ + ClientPtr client = cl->client; + xGLXQueryExtensionsStringReq *req = (xGLXQueryExtensionsStringReq *) pc; + xGLXQueryExtensionsStringReply reply; + GLint screen; + size_t length; + int len, numbytes; + char *be_buf; + +#ifdef FWD_QUERY_REQ + xGLXQueryExtensionsStringReq *be_req; + xGLXQueryExtensionsStringReply be_reply; + DMXScreenInfo *dmxScreen; + Display *dpy; + int slop; +#endif + + screen = req->screen; + + /* + ** Check if screen exists. + */ + if ((screen < 0) || (screen >= screenInfo.numScreens)) { + client->errorValue = screen; + return BadValue; + } + +#ifdef FWD_QUERY_REQ + dmxScreen = &dmxScreens[screen]; + + /* Send the glXQueryServerString request */ + dpy = GetBackEndDisplay(cl,screen); + LockDisplay(dpy); + GetReq(GLXQueryExtensionsString,be_req); + be_req->reqType = dmxScreen->glxMajorOpcode; + be_req->glxCode = X_GLXQueryServerString; + be_req->screen = DefaultScreen(dpy); + _XReply(dpy, (xReply*) &be_reply, 0, False); + len = (int)be_reply.length; + numbytes = (int)be_reply.n; + slop = numbytes * __GLX_SIZE_INT8 & 3; + be_buf = (char *)Xalloc(numbytes); + if (!be_buf) { + /* Throw data on the floor */ + _XEatData(dpy, len); + } else { + _XRead(dpy, (char *)be_buf, numbytes); + if (slop) _XEatData(dpy,4-slop); + } + UnlockDisplay(dpy); + SyncHandle(); + +#else + + be_buf = __glXGetServerString(GLX_EXTENSIONS); + numbytes = strlen(be_buf) + 1; + len = __GLX_PAD(numbytes) >> 2; + +#endif + + length = len; + reply.type = X_Reply; + reply.sequenceNumber = client->sequence; + reply.length = len; + reply.n = numbytes; + + if (client->swapped) { + glxSwapQueryExtensionsStringReply(client, &reply, be_buf); + } else { + WriteToClient(client, sz_xGLXQueryExtensionsStringReply,(char *)&reply); + WriteToClient(client, (int)(length << 2), (char *)be_buf); + } + + return Success; +} + +int __glXQueryServerString(__GLXclientState *cl, GLbyte *pc) +{ + ClientPtr client = cl->client; + xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *) pc; + xGLXQueryServerStringReply reply; + int name; + GLint screen; + size_t length; + int len, numbytes; + char *be_buf; +#ifdef FWD_QUERY_REQ + xGLXQueryServerStringReq *be_req; + xGLXQueryServerStringReply be_reply; + DMXScreenInfo *dmxScreen; + Display *dpy; + int slop; +#endif + + name = req->name; + screen = req->screen; + /* + ** Check if screen exists. + */ + if ((screen < 0) || (screen >= screenInfo.numScreens)) { + client->errorValue = screen; + return BadValue; + } + +#ifdef FWD_QUERY_REQ + dmxScreen = &dmxScreens[screen]; + + /* Send the glXQueryServerString request */ + dpy = GetBackEndDisplay(cl,screen); + LockDisplay(dpy); + GetReq(GLXQueryServerString,be_req); + be_req->reqType = dmxScreen->glxMajorOpcode; + be_req->glxCode = X_GLXQueryServerString; + be_req->screen = DefaultScreen(dpy); + be_req->name = name; + _XReply(dpy, (xReply*) &be_reply, 0, False); + len = (int)be_reply.length; + numbytes = (int)be_reply.n; + slop = numbytes * __GLX_SIZE_INT8 & 3; + be_buf = (char *)Xalloc(numbytes); + if (!be_buf) { + /* Throw data on the floor */ + _XEatData(dpy, len); + } else { + _XRead(dpy, (char *)be_buf, numbytes); + if (slop) _XEatData(dpy,4-slop); + } + UnlockDisplay(dpy); + SyncHandle(); + +#else + be_buf = __glXGetServerString(name); + numbytes = strlen(be_buf) + 1; + len = __GLX_PAD(numbytes) >> 2; +#endif + + length = len; + reply.type = X_Reply; + reply.sequenceNumber = client->sequence; + reply.length = length; + reply.n = numbytes; + + if (client->swapped) { + glxSwapQueryServerStringReply(client, &reply, be_buf); + } else { + WriteToClient(client, sz_xGLXQueryServerStringReply, (char *)&reply); + WriteToClient(client, (int)(length << 2), be_buf); + } + + return Success; +} + +int __glXClientInfo(__GLXclientState *cl, GLbyte *pc) +{ + xGLXClientInfoReq *req = (xGLXClientInfoReq *) pc; + xGLXClientInfoReq *be_req; + const char *buf; + int from_screen = 0; + int to_screen = 0; + int s; + + cl->GLClientmajorVersion = req->major; + cl->GLClientminorVersion = req->minor; + if (cl->GLClientextensions) __glXFree(cl->GLClientextensions); + buf = (const char *)(req+1); + cl->GLClientextensions = strdup(buf); + + to_screen = screenInfo.numScreens - 1; + + for (s=from_screen; s<=to_screen; s++) + { + DMXScreenInfo *dmxScreen = &dmxScreens[s]; + Display *dpy = GetBackEndDisplay(cl,s); + + LockDisplay(dpy); + GetReq(GLXClientInfo,be_req); + be_req->reqType = dmxScreen->glxMajorOpcode; + be_req->glxCode = X_GLXClientInfo; + be_req->major = req->major; + be_req->minor = req->minor; + be_req->length = req->length; + be_req->numbytes = req->numbytes; + Data(dpy, buf, req->numbytes); + + UnlockDisplay(dpy); + SyncHandle(); + } + + return Success; +} + +int __glXUseXFont(__GLXclientState *cl, GLbyte *pc) +{ + ClientPtr client = cl->client; + xGLXUseXFontReq *req; + xGLXUseXFontReq *be_req; + FontPtr pFont; + __GLXcontext *glxc = NULL; + int from_screen = 0; + int to_screen = 0; + int s; + dmxFontPrivPtr pFontPriv; + DMXScreenInfo *dmxScreen; + Display *dpy; + + req = (xGLXUseXFontReq *) pc; + + if (req->contextTag != 0) { + glxc = __glXLookupContextByTag(cl, req->contextTag); + if (glxc) { + from_screen = to_screen = glxc->pScreen->myNum; + } + } + + /* + ** Font can actually be either the ID of a font or the ID of a GC + ** containing a font. + */ + pFont = (FontPtr)LookupIDByType(req->font, RT_FONT); + if (!pFont) { + GC *pGC = (GC *)LookupIDByType(req->font, RT_GC); + if (!pGC) { + client->errorValue = req->font; + return BadFont; + } + pFont = pGC->font; + } + + pFontPriv = FontGetPrivate(pFont, dmxFontPrivateIndex); + +#ifdef PANORAMIX + if (!noPanoramiXExtension) { + from_screen = 0; + to_screen = screenInfo.numScreens - 1; + } +#endif + + + for (s=from_screen; s<=to_screen; s++) { + dmxScreen = &dmxScreens[s]; + dpy = GetBackEndDisplay(cl,s); + + dmxSync( dmxScreen, 1 ); + + LockDisplay(dpy); + GetReq(GLXUseXFont,be_req); + be_req->reqType = dmxScreen->glxMajorOpcode; + be_req->glxCode = X_GLXUseXFont; + be_req->contextTag = (glxc ? GetCurrentBackEndTag(cl,req->contextTag,s) : 0); + be_req->font = pFontPriv->font[s]->fid; + be_req->first = req->first; + be_req->count = req->count; + be_req->listBase = req->listBase; + UnlockDisplay(dpy); + SyncHandle(); + + XSync( dpy, False ); + } + + return Success; +} + +/* + * start GLX 1.3 here + */ + +int __glXGetFBConfigs(__GLXclientState *cl, GLbyte *pc) +{ + ClientPtr client = cl->client; + xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc; + xGLXGetFBConfigsReply reply; + __GLXFBConfig *pFBConfig; + CARD32 buf[2 * __GLX_TOTAL_FBCONFIG_PROPS]; + int numAttribs = __GLX_TOTAL_FBCONFIG_PROPS; + unsigned int screen = req->screen; + int numFBConfigs, i, p; + __GLXscreenInfo *pGlxScreen; + + if (screen > screenInfo.numScreens) { + /* The client library must send a valid screen number. */ + client->errorValue = screen; + return BadValue; + } + + pGlxScreen = &__glXActiveScreens[screen]; + numFBConfigs = __glXNumFBConfigs; + + reply.numFBConfigs = numFBConfigs; + reply.numAttribs = numAttribs; + reply.length = (numFBConfigs * 2 * numAttribs * __GLX_SIZE_CARD32) >> 2; + reply.type = X_Reply; + reply.sequenceNumber = client->sequence; + + if (client->swapped) { + __GLX_DECLARE_SWAP_VARIABLES; + __GLX_SWAP_SHORT(&reply.sequenceNumber); + __GLX_SWAP_INT(&reply.length); + __GLX_SWAP_INT(&reply.numFBConfigs); + __GLX_SWAP_INT(&reply.numAttribs); + } + WriteToClient(client, sz_xGLXGetFBConfigsReply, (char *)&reply); + + for (i=0; i < numFBConfigs; i++) { + int associatedVisualId = 0; + int drawableTypeIndex; + pFBConfig = __glXFBConfigs[ i * (screenInfo.numScreens+1) ]; + + p = 0; + /* core attributes */ + buf[p++] = GLX_FBCONFIG_ID; + buf[p++] = pFBConfig->id; + buf[p++] = GLX_BUFFER_SIZE; + buf[p++] = pFBConfig->indexBits; + buf[p++] = GLX_LEVEL; + buf[p++] = pFBConfig->level; + buf[p++] = GLX_DOUBLEBUFFER; + buf[p++] = pFBConfig->doubleBufferMode; + buf[p++] = GLX_STEREO; + buf[p++] = pFBConfig->stereoMode; + buf[p++] = GLX_AUX_BUFFERS; + buf[p++] = pFBConfig->maxAuxBuffers; + buf[p++] = GLX_RED_SIZE; + buf[p++] = pFBConfig->redBits; + buf[p++] = GLX_GREEN_SIZE; + buf[p++] = pFBConfig->greenBits; + buf[p++] = GLX_BLUE_SIZE; + buf[p++] = pFBConfig->blueBits; + buf[p++] = GLX_ALPHA_SIZE; + buf[p++] = pFBConfig->alphaBits; + buf[p++] = GLX_DEPTH_SIZE; + buf[p++] = pFBConfig->depthBits; + buf[p++] = GLX_STENCIL_SIZE; + buf[p++] = pFBConfig->stencilBits; + buf[p++] = GLX_ACCUM_RED_SIZE; + buf[p++] = pFBConfig->accumRedBits; + buf[p++] = GLX_ACCUM_GREEN_SIZE; + buf[p++] = pFBConfig->accumGreenBits; + buf[p++] = GLX_ACCUM_BLUE_SIZE; + buf[p++] = pFBConfig->accumBlueBits; + buf[p++] = GLX_ACCUM_ALPHA_SIZE; + buf[p++] = pFBConfig->accumAlphaBits; + buf[p++] = GLX_RENDER_TYPE; + buf[p++] = pFBConfig->renderType; + buf[p++] = GLX_DRAWABLE_TYPE; + drawableTypeIndex = p; + buf[p++] = pFBConfig->drawableType; + buf[p++] = GLX_X_VISUAL_TYPE; + buf[p++] = pFBConfig->visualType; + buf[p++] = GLX_CONFIG_CAVEAT; + buf[p++] = pFBConfig->visualCaveat; + buf[p++] = GLX_TRANSPARENT_TYPE; + buf[p++] = pFBConfig->transparentType; + buf[p++] = GLX_TRANSPARENT_RED_VALUE; + buf[p++] = pFBConfig->transparentRed; + buf[p++] = GLX_TRANSPARENT_GREEN_VALUE; + buf[p++] = pFBConfig->transparentGreen; + buf[p++] = GLX_TRANSPARENT_BLUE_VALUE; + buf[p++] = pFBConfig->transparentBlue; + buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE; + buf[p++] = pFBConfig->transparentAlpha; + buf[p++] = GLX_TRANSPARENT_INDEX_VALUE; + buf[p++] = pFBConfig->transparentIndex; + buf[p++] = GLX_MAX_PBUFFER_WIDTH; + buf[p++] = pFBConfig->maxPbufferWidth; + buf[p++] = GLX_MAX_PBUFFER_HEIGHT; + buf[p++] = pFBConfig->maxPbufferHeight; + buf[p++] = GLX_MAX_PBUFFER_PIXELS; + buf[p++] = pFBConfig->maxPbufferPixels; + + /* + * find the visual of the back-end server and match a visual + * on the proxy. + * do only once - if a visual is not yet associated. + */ + if (pFBConfig->associatedVisualId == (unsigned int)-1) { + DMXScreenInfo *dmxScreen = &dmxScreens[screen]; + __GLXFBConfig *be_pFBConfig = __glXFBConfigs[ i * (screenInfo.numScreens+1)+screen+1 ]; + __GLXvisualConfig *pGlxVisual = NULL; + int v; + int found = 0; + for (v=0; vnumGlxVisuals; v++) { + if (dmxScreen->glxVisuals[v].vid == be_pFBConfig->associatedVisualId) { + pGlxVisual = &dmxScreen->glxVisuals[v]; + break; + } + } + + if (pGlxVisual) { + for (v=0; vnumVisuals; v++) { + if (glxVisualsMatch(&pGlxScreen->pGlxVisual[v], pGlxVisual)) { + associatedVisualId = pGlxScreen->pGlxVisual[v].vid; + found = 1; + break; + } + } + } + + if (!found) { + associatedVisualId = 0; + pFBConfig->drawableType &= ~(GLX_WINDOW_BIT); + buf[drawableTypeIndex] = pFBConfig->drawableType; + } +#ifdef PANORAMIX + else if (!noPanoramiXExtension) { + /* convert the associated visualId to the panoramix one */ + pFBConfig->associatedVisualId = + PanoramiXTranslateVisualID(screen, v); + } +#endif + } + else { + associatedVisualId = pFBConfig->associatedVisualId; + } + + buf[p++] = GLX_VISUAL_ID; + buf[p++] = associatedVisualId; + + /* SGIS_multisample attributes */ + buf[p++] = GLX_SAMPLES_SGIS; + buf[p++] = pFBConfig->multiSampleSize; + buf[p++] = GLX_SAMPLE_BUFFERS_SGIS; + buf[p++] = pFBConfig->nMultiSampleBuffers; + + /* SGIX_pbuffer specific attributes */ + buf[p++] = GLX_OPTIMAL_PBUFFER_WIDTH_SGIX; + buf[p++] = pFBConfig->optimalPbufferWidth; + buf[p++] = GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX; + buf[p++] = pFBConfig->optimalPbufferHeight; + + buf[p++] = GLX_VISUAL_SELECT_GROUP_SGIX; + buf[p++] = pFBConfig->visualSelectGroup; + + if (client->swapped) { + __GLX_DECLARE_SWAP_VARIABLES; + __GLX_SWAP_INT_ARRAY((int *)buf, 2*numAttribs); + } + WriteToClient(client, 2*numAttribs * __GLX_SIZE_CARD32, (char *)buf); + } + return Success; +} + +int __glXGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc) +{ + xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *)pc; + xGLXGetFBConfigsReq new_req; + + new_req.reqType = req->reqType; + new_req.glxCode = req->glxCode; + new_req.length = req->length; + new_req.screen = req->screen; + + return( __glXGetFBConfigs( cl, (GLbyte *)&new_req ) ); +} + + +int __glXCreateWindow(__GLXclientState *cl, GLbyte *pc) +{ + ClientPtr client = cl->client; + xGLXCreateWindowReq *req = (xGLXCreateWindowReq *) pc; + int screen = req->screen; + GLXFBConfigID fbconfigId = req->fbconfig; + XID windowId = req->window; + XID glxwindowId = req->glxwindow; + DrawablePtr pDraw; + ScreenPtr pScreen; + __glXWindow *pGlxWindow; + __GLXFBConfig *pGlxFBConfig = NULL; + VisualPtr pVisual; + VisualID visId; + int i, rc; + + /* + ** Check if windowId is valid + */ + rc = dixLookupDrawable(&pDraw, windowId, client, M_DRAWABLE_WINDOW, + DixAddAccess); + if (rc != Success) + return rc; + + /* + ** Check if screen of window matches screen of fbconfig. + */ + pScreen = pDraw->pScreen; + if (screen != pScreen->myNum) { + return BadMatch; + } + + /* + ** Find the FBConfigRec for this fbconfigid. + */ + if (!(pGlxFBConfig = glxLookupFBConfig(fbconfigId))) { + client->errorValue = fbconfigId; + return __glXBadFBConfig; + } + visId = pGlxFBConfig->associatedVisualId; + + /* + ** Check if the fbconfig supports rendering to windows + */ + if( !(pGlxFBConfig->drawableType & GLX_WINDOW_BIT) ) { + return BadMatch; + } + + if (visId != None) { + /* + ** Check if the visual ID is valid for this screen. + */ + pVisual = pScreen->visuals; + for (i = 0; i < pScreen->numVisuals; i++, pVisual++) { + if (pVisual->vid == visId) { + break; + } + } + if (i == pScreen->numVisuals) { + client->errorValue = visId; + return BadValue; + } + + /* + ** Check if color buffer depth of fbconfig matches depth + ** of window. + */ + if (pVisual->nplanes != pDraw->depth) { + return BadMatch; + } + } else + /* + ** The window was created with no visual that corresponds + ** to fbconfig + */ + return BadMatch; + + /* + ** Check if there is already a fbconfig associated with this window + */ + if ( LookupIDByType(glxwindowId, __glXWindowRes) ) { + client->errorValue = glxwindowId; + return BadAlloc; + } + + pGlxWindow = (__glXWindow *) xalloc(sizeof(__glXWindow)); + if (!pGlxWindow) { + return BadAlloc; + } + + /* + ** Register this GLX window as a resource + */ + if (!(AddResource(glxwindowId, __glXWindowRes, pGlxWindow))) { + return BadAlloc; + } + + pGlxWindow->pDraw = pDraw; + pGlxWindow->type = GLX_GLXWINDOW_TYPE; + pGlxWindow->idExists = True; + pGlxWindow->refcnt = 0; + pGlxWindow->pGlxFBConfig = pGlxFBConfig; + pGlxWindow->pScreen = pScreen; + + return Success; +} + +int __glXDestroyWindow(__GLXclientState *cl, GLbyte *pc) +{ + ClientPtr client = cl->client; + xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc; + XID glxwindow = req->glxwindow; + + /* + ** Check if it's a valid GLX window. + */ + if (!LookupIDByType(glxwindow, __glXWindowRes)) { + client->errorValue = glxwindow; + return __glXBadDrawable; + } + /* + ** The glx window destructor will check whether it's current before + ** freeing anything. + */ + FreeResource(glxwindow, RT_NONE); + + return Success; +} + +int __glXQueryContext(__GLXclientState *cl, GLbyte *pc) +{ + ClientPtr client = cl->client; + __GLXcontext *ctx; + xGLXQueryContextReq *req; + xGLXQueryContextReply reply; + int nProps; + int *sendBuf, *pSendBuf; + int nReplyBytes; + + req = (xGLXQueryContextReq *)pc; + ctx = (__GLXcontext *) LookupIDByType(req->context, __glXContextRes); + if (!ctx) { + client->errorValue = req->context; + return __glXBadContext; + } + + nProps = 3; + + reply.length = nProps << 1; + reply.type = X_Reply; + reply.sequenceNumber = client->sequence; + reply.n = nProps; + + nReplyBytes = reply.length << 2; + sendBuf = (int *)xalloc(nReplyBytes); + pSendBuf = sendBuf; + *pSendBuf++ = GLX_FBCONFIG_ID; + *pSendBuf++ = (int)(ctx->pFBConfig->id); + *pSendBuf++ = GLX_RENDER_TYPE; + *pSendBuf++ = (int)(ctx->pFBConfig->renderType); + *pSendBuf++ = GLX_SCREEN; + *pSendBuf++ = (int)(ctx->pScreen->myNum); + + if (client->swapped) { + __glXSwapQueryContextReply(client, &reply, sendBuf); + } else { + WriteToClient(client, sz_xGLXQueryContextReply, (char *)&reply); + WriteToClient(client, nReplyBytes, (char *)sendBuf); + } + xfree((char *)sendBuf); + + return Success; +} + +int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc) +{ + ClientPtr client = cl->client; + __GLXcontext *ctx; + xGLXQueryContextInfoEXTReq *req; + xGLXQueryContextInfoEXTReply reply; + int nProps; + int *sendBuf, *pSendBuf; + int nReplyBytes; + + req = (xGLXQueryContextInfoEXTReq *)pc; + ctx = (__GLXcontext *) SecurityLookupIDByType(client, req->context, __glXContextRes, DixReadAccess); + if (!ctx) { + client->errorValue = req->context; + return __glXBadContext; + } + + nProps = 4; + + reply.length = nProps << 1; + reply.type = X_Reply; + reply.sequenceNumber = client->sequence; + reply.n = nProps; + + nReplyBytes = reply.length << 2; + sendBuf = (int *)xalloc(nReplyBytes); + pSendBuf = sendBuf; + *pSendBuf++ = GLX_SHARE_CONTEXT_EXT; + *pSendBuf++ = (int)(ctx->share_id); + *pSendBuf++ = GLX_VISUAL_ID_EXT; + *pSendBuf++ = (int)(ctx->pVisual ? ctx->pVisual->vid : 0); + *pSendBuf++ = GLX_SCREEN_EXT; + *pSendBuf++ = (int)(ctx->pScreen->myNum); + *pSendBuf++ = GLX_FBCONFIG_ID; + *pSendBuf++ = (int)(ctx->pFBConfig ? ctx->pFBConfig->id : 0); + + if (client->swapped) { + __glXSwapQueryContextInfoEXTReply(client, &reply, sendBuf); + } else { + WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *)&reply); + WriteToClient(client, nReplyBytes, (char *)sendBuf); + } + xfree((char *)sendBuf); + + return Success; +} + +int __glXCreatePbuffer(__GLXclientState *cl, GLbyte *pc) +{ + ClientPtr client = cl->client; + xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *)pc; + xGLXCreatePbufferReq *be_req; + int screen = req->screen; + GLXFBConfigID fbconfigId = req->fbconfig; + GLXPbuffer pbuffer = req->pbuffer; + __glXPbuffer *pGlxPbuffer; + int numAttribs = req->numAttribs; + int *attr; + ScreenPtr pScreen; + __GLXFBConfig *pGlxFBConfig; + __GLXFBConfig *be_pGlxFBConfig; + XID be_xid; + Display *dpy; + DMXScreenInfo *dmxScreen; + int s; + int from_screen, to_screen; + + /* + ** Look up screen and FBConfig. + */ + if (screen > screenInfo.numScreens) { + /* The client library must send a valid screen number. */ + client->errorValue = screen; + return BadValue; + } + pScreen = screenInfo.screens[screen]; + + /* + ** Find the FBConfigRec for this fbconfigid. + */ + if (!(pGlxFBConfig = glxLookupFBConfig(fbconfigId))) { + client->errorValue = fbconfigId; + return __glXBadFBConfig; + } + + /* + ** Create the GLX part of the Pbuffer. + */ + pGlxPbuffer = (__glXPbuffer *) xalloc(sizeof(__glXPbuffer)); + if (!pGlxPbuffer) { + return BadAlloc; + } + + pGlxPbuffer->be_xids = (XID *) xalloc( sizeof(XID) * screenInfo.numScreens ); + if (!pGlxPbuffer->be_xids) { + xfree(pGlxPbuffer); + return BadAlloc; + } + + /* + * Allocate an XID on the back-end server(s) and send him the request + */ + from_screen = to_screen = screen; +#ifdef PANORAMIX + if (!noPanoramiXExtension) { + from_screen = 0; + to_screen = screenInfo.numScreens - 1; + } +#endif + + for (s=from_screen; s<=to_screen; s++) { + dpy = GetBackEndDisplay(cl,s); + be_xid = XAllocID(dpy); + dmxScreen = &dmxScreens[s]; + be_pGlxFBConfig = glxLookupBackEndFBConfig( pGlxFBConfig->id, s ); + + attr = (int *)( req+1 ); + + LockDisplay(dpy); + GetReqExtra(GLXCreatePbuffer, 2 * numAttribs * __GLX_SIZE_CARD32, be_req); + be_req->reqType = dmxScreen->glxMajorOpcode; + be_req->glxCode = X_GLXCreatePbuffer; + be_req->screen = be_pGlxFBConfig->screen; + be_req->fbconfig = be_pGlxFBConfig->id; + be_req->pbuffer = be_xid; + be_req->numAttribs = numAttribs; + + /* Send attributes */ + if ( attr != NULL ) { + CARD32 *pc = (CARD32 *)(be_req + 1); + + while (numAttribs-- > 0) { + *pc++ = *attr++; /* token */ + *pc++ = *attr++; /* value */ + } + } + + UnlockDisplay(dpy); + SyncHandle(); + + pGlxPbuffer->be_xids[s] = be_xid; + } + + + pGlxPbuffer->idExists = True; + pGlxPbuffer->refcnt = 0; + pGlxPbuffer->pFBConfig = pGlxFBConfig; + pGlxPbuffer->pScreen = pScreen; + + /* + ** Register the resource. + */ + if (!(AddResource(pbuffer, __glXPbufferRes, pGlxPbuffer))) { + return BadAlloc; + } + + return Success; + +} + +int __glXDestroyPbuffer(__GLXclientState *cl, GLbyte *pc) +{ + ClientPtr client = cl->client; + xGLXDestroyPbufferReq *req = (xGLXDestroyPbufferReq *) pc; + xGLXDestroyPbufferReq *be_req; + GLXPbuffer pbuffer = req->pbuffer; + Display *dpy; + int screen; + DMXScreenInfo *dmxScreen; + __glXPbuffer *pGlxPbuffer; + int s; + int from_screen, to_screen; + + /* + ** Check if it's a valid Pbuffer + */ + pGlxPbuffer = (__glXPbuffer *)LookupIDByType(pbuffer, __glXPbufferRes); + if (!pGlxPbuffer) { + client->errorValue = pbuffer; + return __glXBadPbuffer; + } + + screen = pGlxPbuffer->pScreen->myNum; + + from_screen = to_screen = screen; +#ifdef PANORAMIX + if (!noPanoramiXExtension) { + from_screen = 0; + to_screen = screenInfo.numScreens - 1; + } +#endif + + for (s=from_screen; s<=to_screen; s++) { + dpy = GetBackEndDisplay(cl,s); + dmxScreen = &dmxScreens[s]; + + /* send the destroy request to the back-end server */ + LockDisplay(dpy); + GetReq(GLXDestroyPbuffer, be_req); + be_req->reqType = dmxScreen->glxMajorOpcode; + be_req->glxCode = X_GLXDestroyPbuffer; + be_req->pbuffer = pGlxPbuffer->be_xids[s]; + UnlockDisplay(dpy); + SyncHandle(); + } + + FreeResource(pbuffer, RT_NONE); + + return Success; +} + +int __glXGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc) +{ + xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *)pc; + xGLXGetDrawableAttributesReq *be_req; + xGLXGetDrawableAttributesReply reply; + ClientPtr client = cl->client; + GLXDrawable drawId = req->drawable; + GLXDrawable be_drawable = 0; + DrawablePtr pDraw = NULL; + Display *dpy; + int screen, rc; + DMXScreenInfo *dmxScreen; + CARD32 *attribs = NULL; + int attribs_size; +#ifdef PANORAMIX + PanoramiXRes *pXinDraw = NULL; +#endif + + if (drawId != None) { + rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixGetAttrAccess); + if (rc == Success) { + if (pDraw->type == DRAWABLE_WINDOW) { + WindowPtr pWin = (WindowPtr)pDraw; + be_drawable = 0; + screen = pWin->drawable.pScreen->myNum; + + } + else { + /* + ** Drawable is not a Window , GLXWindow or a GLXPixmap. + */ + client->errorValue = drawId; + return __glXBadDrawable; + } + } + + if (!pDraw) { + __GLXpixmap *pGlxPixmap = (__GLXpixmap *) LookupIDByType(drawId, + __glXPixmapRes); + if (pGlxPixmap) { + pDraw = pGlxPixmap->pDraw; + screen = pGlxPixmap->pScreen->myNum; + be_drawable = pGlxPixmap->be_xids[screen]; + } + } + + if (!pDraw) { + __glXWindow *pGlxWindow = (__glXWindow *) LookupIDByType(drawId, __glXWindowRes); + if (pGlxWindow) { + pDraw = pGlxWindow->pDraw; + screen = pGlxWindow->pScreen->myNum; + be_drawable = 0; + } + } + + if (!pDraw) { + __glXPbuffer *pGlxPbuffer = (__glXPbuffer *)LookupIDByType(drawId, __glXPbufferRes); + if (pGlxPbuffer) { + pDraw = (DrawablePtr)pGlxPbuffer; + screen = pGlxPbuffer->pScreen->myNum; + be_drawable = pGlxPbuffer->be_xids[screen]; + } + } + + + if (!pDraw) { + /* + ** Drawable is not a Window , GLXWindow or a GLXPixmap. + */ + client->errorValue = drawId; + return __glXBadDrawable; + } + } + + + /* if the drawable is a window or GLXWindow - + * we need to find the base id on the back-end server + */ + if (!be_drawable) { + WindowPtr pWin = (WindowPtr)pDraw; + +#ifdef PANORAMIX + if (!noPanoramiXExtension) { + pXinDraw = (PanoramiXRes *) + SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, DixReadAccess); + if (!pXinDraw) { + client->errorValue = drawId; + return __glXBadDrawable; + } + + dixLookupWindow(&pWin, pXinDraw->info[screen].id, client, + DixReadAccess); + } +#endif + + if (pWin) { + be_drawable = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window; + if (!be_drawable) { + /* it might be that the window did not created yet on the */ + /* back-end server (lazy window creation option), force */ + /* creation of the window */ + dmxCreateAndRealizeWindow( pWin, TRUE ); + be_drawable = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window; + } + } + else { + client->errorValue = drawId; + return __glXBadDrawable; + } + } + + + /* send the request to the back-end server */ + dpy = GetBackEndDisplay(cl,screen); + dmxScreen = &dmxScreens[screen]; + + /* make sure drawable exists on back-end */ + dmxSync( dmxScreen, 1 ); + + LockDisplay(dpy); + GetReq(GLXGetDrawableAttributes, be_req); + be_req->reqType = dmxScreen->glxMajorOpcode; + be_req->glxCode = X_GLXGetDrawableAttributes; + be_req->drawable = be_drawable; + be_req->length = req->length; + if (!_XReply(dpy, (xReply *) &reply, 0, False)) { + UnlockDisplay(dpy); + SyncHandle(); + return( BE_TO_CLIENT_ERROR(dmxLastErrorEvent.error_code) ); + } + + if (reply.numAttribs) { + attribs_size = 2 * reply.numAttribs * __GLX_SIZE_CARD32; + attribs = (CARD32 *) Xalloc(attribs_size); + if (attribs == NULL) { + UnlockDisplay(dpy); + SyncHandle(); + return BadAlloc; + } + + _XRead(dpy, (char *) attribs, attribs_size); + } + + UnlockDisplay(dpy); + SyncHandle(); + + + /* send the reply back to the client */ + reply.sequenceNumber = client->sequence; + if (client->swapped) { + __glXSwapGetDrawableAttributesReply(client, &reply, (int *)attribs); + } + else { + WriteToClient(client, sz_xGLXGetDrawableAttributesReply, (char *)&reply); + WriteToClient(client, attribs_size, (char *)attribs); + } + + Xfree(attribs); + + return Success; +} + +int __glXChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc) +{ + xGLXChangeDrawableAttributesReq *req = (xGLXChangeDrawableAttributesReq *)pc; + xGLXChangeDrawableAttributesReq *be_req; + ClientPtr client = cl->client; + GLXDrawable drawId = req->drawable; + GLXDrawable be_drawable = 0; + DrawablePtr pDraw = NULL; + Display *dpy; + int screen, rc; + DMXScreenInfo *dmxScreen; + char *attrbuf; +#ifdef PANORAMIX + PanoramiXRes *pXinDraw = NULL; + PanoramiXRes *pXinReadDraw = NULL; +#endif + + if (drawId != None) { + rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixSetAttrAccess); + if (rc == Success) { + if (pDraw->type == DRAWABLE_WINDOW) { + WindowPtr pWin = (WindowPtr)pDraw; + be_drawable = 0; + screen = pWin->drawable.pScreen->myNum; + + } + else { + /* + ** Drawable is not a Window , GLXWindow or a GLXPixmap. + */ + client->errorValue = drawId; + return __glXBadDrawable; + } + } + + if (!pDraw) { + __GLXpixmap *pGlxPixmap = (__GLXpixmap *) LookupIDByType(drawId, + __glXPixmapRes); + if (pGlxPixmap) { + pDraw = pGlxPixmap->pDraw; + screen = pGlxPixmap->pScreen->myNum; + be_drawable = pGlxPixmap->be_xids[screen]; + } + } + + if (!pDraw) { + __glXWindow *pGlxWindow = (__glXWindow *) LookupIDByType(drawId, __glXWindowRes); + if (pGlxWindow) { + pDraw = pGlxWindow->pDraw; + screen = pGlxWindow->pScreen->myNum; + be_drawable = 0; + } + } + + if (!pDraw) { + __glXPbuffer *pGlxPbuffer = (__glXPbuffer *)LookupIDByType(drawId, __glXPbufferRes); + if (pGlxPbuffer) { + pDraw = (DrawablePtr)pGlxPbuffer; + screen = pGlxPbuffer->pScreen->myNum; + be_drawable = pGlxPbuffer->be_xids[screen]; + } + } + + + if (!pDraw) { + /* + ** Drawable is not a Window , GLXWindow or a GLXPixmap. + */ + client->errorValue = drawId; + return __glXBadDrawable; + } + } + + + /* if the drawable is a window or GLXWindow - + * we need to find the base id on the back-end server + */ + if (!be_drawable) { + WindowPtr pWin = (WindowPtr)pDraw; + +#ifdef PANORAMIX + if (!noPanoramiXExtension) { + pXinDraw = (PanoramiXRes *) + SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, DixReadAccess); + if (!pXinDraw) { + client->errorValue = drawId; + return __glXBadDrawable; + } + + dixLookupWindow(&pWin, pXinDraw->info[screen].id, client, + DixReadAccess); + } +#endif + + if (pWin) { + be_drawable = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window; + if (!be_drawable) { + /* it might be that the window did not created yet on the */ + /* back-end server (lazy window creation option), force */ + /* creation of the window */ + dmxCreateAndRealizeWindow( pWin, TRUE ); + be_drawable = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window; + } + } + else { + client->errorValue = drawId; + return __glXBadDrawable; + } + } + + + /* send the request to the back-end server */ + dpy = GetBackEndDisplay(cl,screen); + dmxScreen = &dmxScreens[screen]; + + /* make sure drawable exists on back-end */ + dmxSync( dmxScreen, 1 ); + + LockDisplay(dpy); + GetReqExtra(GLXChangeDrawableAttributes, + 2 * req->numAttribs * __GLX_SIZE_CARD32, be_req); + be_req->reqType = dmxScreen->glxMajorOpcode; + be_req->glxCode = X_GLXChangeDrawableAttributes; + be_req->drawable = be_drawable; + be_req->numAttribs = req->numAttribs; + be_req->length = req->length; + + UnlockDisplay(dpy); + SyncHandle(); + + return Success; +} + +int __glXSendLargeCommand(__GLXclientState *cl, GLXContextTag contextTag) +{ + ClientPtr client = cl->client; + xGLXRenderLargeReq *req; + GLint maxSize, amount; + GLint totalRequests, requestNumber; + GLint dataLen; + GLbyte *data; + __GLXcontext *glxc; + int s; + int from_screen, to_screen; + + maxSize = cl->largeCmdMaxReqDataSize - (GLint)sizeof(xGLXRenderLargeReq); + dataLen = cl->largeCmdBytesTotal; + totalRequests = (dataLen / maxSize); + if (dataLen % maxSize) totalRequests++; + + glxc = __glXLookupContextByTag(cl, contextTag); + if (!glxc) { + client->errorValue = contextTag; + return __glXBadContext; + } + from_screen = to_screen = glxc->pScreen->myNum; + +#ifdef PANORAMIX + if (!noPanoramiXExtension) { + from_screen = 0; + to_screen = screenInfo.numScreens - 1; + } +#endif + + /* + ** Send enough requests until the whole array is sent. + */ + requestNumber = 1; + data = cl->largeCmdBuf; + while (dataLen > 0) { + amount = dataLen; + if (amount > maxSize) { + amount = maxSize; + } + + for (s=from_screen; s<=to_screen; s++) { + + Display *dpy = GetBackEndDisplay(cl,s); + DMXScreenInfo *dmxScreen = &dmxScreens[s]; + + LockDisplay(dpy); + GetReq(GLXRenderLarge,req); + req->reqType = dmxScreen->glxMajorOpcode; + req->glxCode = X_GLXRenderLarge; + req->contextTag = GetCurrentBackEndTag(cl,contextTag,s); + req->length += (amount + 3) >> 2; + req->requestNumber = requestNumber++; + req->requestTotal = totalRequests; + req->dataBytes = amount; + Data(dpy, ((const char*)data), amount); + dataLen -= amount; + data = ((GLbyte *) data) + amount; + UnlockDisplay(dpy); + SyncHandle(); + } + } + + return Success; +} diff --git a/xorg-server/hw/dmx/glxProxy/glxcmdsswap.c b/xorg-server/hw/dmx/glxProxy/glxcmdsswap.c new file mode 100644 index 000000000..3404d557a --- /dev/null +++ b/xorg-server/hw/dmx/glxProxy/glxcmdsswap.c @@ -0,0 +1,1057 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ + +#define NEED_REPLIES +#define FONT_PCF +#include "glxserver.h" +#include "glxutil.h" +#include +#include +#include +#include +#include "unpack.h" +#include "glxext.h" +#include "glxvendor.h" + +extern int glxIsExtensionSupported( char *ext ); + +/************************************************************************/ + +/* +** Byteswapping versions of GLX commands. In most cases they just swap +** the incoming arguments and then call the unswapped routine. For commands +** that have replies, a separate swapping routine for the reply is provided; +** it is called at the end of the unswapped routine. +*/ + +int __glXSwapCreateContext(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->context); + __GLX_SWAP_INT(&req->visual); + __GLX_SWAP_INT(&req->screen); + __GLX_SWAP_INT(&req->shareList); + + return __glXCreateContext(cl, pc); +} + +int __glXSwapCreateNewContext(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->context); + __GLX_SWAP_INT(&req->fbconfig); + __GLX_SWAP_INT(&req->screen); + __GLX_SWAP_INT(&req->shareList); + + return __glXCreateNewContext(cl, pc); +} + +int __glXSwapCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreateContextWithConfigSGIXReq *req = (xGLXCreateContextWithConfigSGIXReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->context); + __GLX_SWAP_INT(&req->fbconfig); + __GLX_SWAP_INT(&req->screen); + __GLX_SWAP_INT(&req->shareList); + + return __glXCreateContextWithConfigSGIX(cl, pc); +} + +int __glXSwapQueryMaxSwapBarriersSGIX(__GLXclientState *cl, GLbyte *pc) +{ + xGLXQueryMaxSwapBarriersSGIXReq *req = + (xGLXQueryMaxSwapBarriersSGIXReq *)pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->screen); + + return __glXQueryMaxSwapBarriersSGIX(cl, pc); +} + +int __glXSwapBindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc) +{ + xGLXBindSwapBarrierSGIXReq *req = (xGLXBindSwapBarrierSGIXReq *)pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->drawable); + __GLX_SWAP_INT(&req->barrier); + + return __glXBindSwapBarrierSGIX(cl, pc); +} + +int __glXSwapJoinSwapGroupSGIX(__GLXclientState *cl, GLbyte *pc) +{ + xGLXJoinSwapGroupSGIXReq *req = (xGLXJoinSwapGroupSGIXReq *)pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->drawable); + __GLX_SWAP_INT(&req->member); + + return __glXJoinSwapGroupSGIX(cl, pc); +} + +int __glXSwapDestroyContext(__GLXclientState *cl, GLbyte *pc) +{ + xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->context); + + return __glXDestroyContext(cl, pc); +} + +int __glXSwapMakeCurrent(__GLXclientState *cl, GLbyte *pc) +{ + xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->drawable); + __GLX_SWAP_INT(&req->context); + __GLX_SWAP_INT(&req->oldContextTag); + + return __glXMakeCurrent(cl, pc); +} + +int __glXSwapMakeContextCurrent(__GLXclientState *cl, GLbyte *pc) +{ + xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->drawable); + __GLX_SWAP_INT(&req->readdrawable); + __GLX_SWAP_INT(&req->context); + __GLX_SWAP_INT(&req->oldContextTag); + + return __glXMakeContextCurrent(cl, pc); +} + +int __glXSwapMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc) +{ + xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->drawable); + __GLX_SWAP_INT(&req->readable); + __GLX_SWAP_INT(&req->context); + __GLX_SWAP_INT(&req->oldContextTag); + + return __glXMakeCurrentReadSGI(cl, pc); +} + +int __glXSwapIsDirect(__GLXclientState *cl, GLbyte *pc) +{ + xGLXIsDirectReq *req = (xGLXIsDirectReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->context); + + return __glXIsDirect(cl, pc); +} + +int __glXSwapQueryVersion(__GLXclientState *cl, GLbyte *pc) +{ + xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->majorVersion); + __GLX_SWAP_INT(&req->minorVersion); + + return __glXQueryVersion(cl, pc); +} + +int __glXSwapWaitGL(__GLXclientState *cl, GLbyte *pc) +{ + xGLXWaitGLReq *req = (xGLXWaitGLReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->contextTag); + + return __glXWaitGL(cl, pc); +} + +int __glXSwapWaitX(__GLXclientState *cl, GLbyte *pc) +{ + xGLXWaitXReq *req = (xGLXWaitXReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->contextTag); + + return __glXWaitX(cl, pc); +} + +int __glXSwapCopyContext(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCopyContextReq *req = (xGLXCopyContextReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->source); + __GLX_SWAP_INT(&req->dest); + __GLX_SWAP_INT(&req->mask); + + return __glXCopyContext(cl, pc); +} + +int __glXSwapGetVisualConfigs(__GLXclientState *cl, GLbyte *pc) +{ + ClientPtr client = cl->client; + xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc; + xGLXGetVisualConfigsReply reply; + __GLXscreenInfo *pGlxScreen; + __GLXvisualConfig *pGlxVisual; + CARD32 buf[__GLX_TOTAL_CONFIG]; + unsigned int screen; + int i, p; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(&req->screen); + screen = req->screen; + if (screen > screenInfo.numScreens) { + /* The client library must send a valid screen number. */ + client->errorValue = screen; + return BadValue; + } + pGlxScreen = &__glXActiveScreens[screen]; + + reply.numVisuals = pGlxScreen->numGLXVisuals; + reply.numProps = __GLX_TOTAL_CONFIG; + reply.length = (pGlxScreen->numGLXVisuals * __GLX_SIZE_CARD32 * + __GLX_TOTAL_CONFIG) >> 2; + reply.type = X_Reply; + reply.sequenceNumber = client->sequence; + + __GLX_SWAP_SHORT(&reply.sequenceNumber); + __GLX_SWAP_INT(&reply.length); + __GLX_SWAP_INT(&reply.numVisuals); + __GLX_SWAP_INT(&reply.numProps); + WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *)&reply); + + for (i=0; i < pGlxScreen->numVisuals; i++) { + pGlxVisual = &pGlxScreen->pGlxVisual[i]; + if (!pGlxScreen->isGLXvis[i] || pGlxVisual->vid == 0) { + /* not a usable visual */ + continue; + } + p = 0; + buf[p++] = pGlxVisual->vid; + buf[p++] = pGlxVisual->class; + buf[p++] = pGlxVisual->rgba; + + buf[p++] = pGlxVisual->redSize; + buf[p++] = pGlxVisual->greenSize; + buf[p++] = pGlxVisual->blueSize; + buf[p++] = pGlxVisual->alphaSize; + buf[p++] = pGlxVisual->accumRedSize; + buf[p++] = pGlxVisual->accumGreenSize; + buf[p++] = pGlxVisual->accumBlueSize; + buf[p++] = pGlxVisual->accumAlphaSize; + + buf[p++] = pGlxVisual->doubleBuffer; + buf[p++] = pGlxVisual->stereo; + + buf[p++] = pGlxVisual->bufferSize; + buf[p++] = pGlxVisual->depthSize; + buf[p++] = pGlxVisual->stencilSize; + buf[p++] = pGlxVisual->auxBuffers; + buf[p++] = pGlxVisual->level; + /* + ** Add token/value pairs for extensions. + */ + buf[p++] = GLX_VISUAL_CAVEAT_EXT; + buf[p++] = pGlxVisual->visualRating; + buf[p++] = GLX_TRANSPARENT_TYPE_EXT; + buf[p++] = pGlxVisual->transparentPixel; + buf[p++] = GLX_TRANSPARENT_RED_VALUE_EXT; + buf[p++] = pGlxVisual->transparentRed; + buf[p++] = GLX_TRANSPARENT_GREEN_VALUE_EXT; + buf[p++] = pGlxVisual->transparentGreen; + buf[p++] = GLX_TRANSPARENT_BLUE_VALUE_EXT; + buf[p++] = pGlxVisual->transparentBlue; + buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE_EXT; + buf[p++] = pGlxVisual->transparentAlpha; + buf[p++] = GLX_TRANSPARENT_INDEX_VALUE_EXT; + buf[p++] = pGlxVisual->transparentIndex; + + __GLX_SWAP_INT_ARRAY(buf, __GLX_TOTAL_CONFIG); + WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_TOTAL_CONFIG, + (char *)buf); + } + return Success; +} + +int __glXSwapCreateGLXPixmap(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->screen); + __GLX_SWAP_INT(&req->visual); + __GLX_SWAP_INT(&req->pixmap); + __GLX_SWAP_INT(&req->glxpixmap); + + return __glXCreateGLXPixmap(cl, pc); +} + +int __glXSwapCreatePixmap(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->screen); + __GLX_SWAP_INT(&req->fbconfig); + __GLX_SWAP_INT(&req->pixmap); + __GLX_SWAP_INT(&req->glxpixmap); + __GLX_SWAP_INT(&req->numAttribs); + + return __glXCreatePixmap(cl, pc); +} + +int __glXSwapDestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc) +{ + xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->glxpixmap); + + return __glXDestroyGLXPixmap(cl, pc); +} + +int __glXSwapSwapBuffers(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSwapBuffersReq *req = (xGLXSwapBuffersReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->contextTag); + __GLX_SWAP_INT(&req->drawable); + + return __glXSwapBuffers(cl, pc); +} + +int __glXSwapUseXFont(__GLXclientState *cl, GLbyte *pc) +{ + xGLXUseXFontReq *req = (xGLXUseXFontReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->contextTag); + __GLX_SWAP_INT(&req->font); + __GLX_SWAP_INT(&req->first); + __GLX_SWAP_INT(&req->count); + __GLX_SWAP_INT(&req->listBase); + + return __glXUseXFont(cl, pc); +} + + +int __glXSwapQueryExtensionsString(__GLXclientState *cl, GLbyte *pc) +{ + xGLXQueryExtensionsStringReq *req = NULL; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->screen); + + return __glXQueryExtensionsString(cl, pc); +} + +int __glXSwapQueryServerString(__GLXclientState *cl, GLbyte *pc) +{ + xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *)pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->screen); + __GLX_SWAP_INT(&req->name); + + return __glXQueryServerString(cl, pc); +} + +int __glXSwapClientInfo(__GLXclientState *cl, GLbyte *pc) +{ + xGLXClientInfoReq *req = (xGLXClientInfoReq *)pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->major); + __GLX_SWAP_INT(&req->minor); + __GLX_SWAP_INT(&req->numbytes); + + return __glXClientInfo(cl, pc); +} + +int __glXSwapQueryContextInfoEXT(__GLXclientState *cl, char *pc) +{ + xGLXQueryContextInfoEXTReq *req = (xGLXQueryContextInfoEXTReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->context); + + return __glXQueryContextInfoEXT(cl, (GLbyte *)pc); +} + +/************************************************************************/ + +/* +** Swap replies. +*/ + +void __glXSwapMakeCurrentReply(ClientPtr client, xGLXMakeCurrentReadSGIReply *reply) +{ + __GLX_DECLARE_SWAP_VARIABLES; + __GLX_SWAP_SHORT(&reply->sequenceNumber); + __GLX_SWAP_INT(&reply->length); + __GLX_SWAP_INT(&reply->contextTag); + __GLX_SWAP_INT(&reply->writeVid); + __GLX_SWAP_INT(&reply->writeType); + __GLX_SWAP_INT(&reply->readVid); + __GLX_SWAP_INT(&reply->readType); + WriteToClient(client, sz_xGLXMakeCurrentReadSGIReply, (char *)reply); +} + +void __glXSwapIsDirectReply(ClientPtr client, xGLXIsDirectReply *reply) +{ + __GLX_DECLARE_SWAP_VARIABLES; + __GLX_SWAP_SHORT(&reply->sequenceNumber); + __GLX_SWAP_INT(&reply->length); + WriteToClient(client, sz_xGLXIsDirectReply, (char *)reply); +} + +void __glXSwapQueryVersionReply(ClientPtr client, xGLXQueryVersionReply *reply) +{ + __GLX_DECLARE_SWAP_VARIABLES; + __GLX_SWAP_SHORT(&reply->sequenceNumber); + __GLX_SWAP_INT(&reply->length); + __GLX_SWAP_INT(&reply->majorVersion); + __GLX_SWAP_INT(&reply->minorVersion); + WriteToClient(client, sz_xGLXQueryVersionReply, (char *)reply); +} + +void glxSwapQueryExtensionsStringReply(ClientPtr client, + xGLXQueryExtensionsStringReply *reply, char *buf) +{ + int length = reply->length; + __GLX_DECLARE_SWAP_VARIABLES; + __GLX_SWAP_SHORT(&reply->sequenceNumber); + __GLX_SWAP_INT(&reply->length); + __GLX_SWAP_INT(&reply->n); + WriteToClient(client, sz_xGLXQueryExtensionsStringReply, (char *)reply); + __GLX_SWAP_INT_ARRAY((int *)buf, length); + WriteToClient(client, length << 2, buf); +} + +void glxSwapQueryServerStringReply(ClientPtr client, + xGLXQueryServerStringReply *reply, char *buf) +{ + int length = reply->length; + __GLX_DECLARE_SWAP_VARIABLES; + __GLX_SWAP_SHORT(&reply->sequenceNumber); + __GLX_SWAP_INT(&reply->length); + __GLX_SWAP_INT(&reply->n); + WriteToClient(client, sz_xGLXQueryServerStringReply, (char *)reply); + /** no swap is needed for an array of chars **/ + /* __GLX_SWAP_INT_ARRAY((int *)buf, length); */ + WriteToClient(client, length << 2, buf); +} + +void __glXSwapQueryContextInfoEXTReply(ClientPtr client, xGLXQueryContextInfoEXTReply *reply, int *buf) +{ + int length = reply->length; + __GLX_DECLARE_SWAP_VARIABLES; + __GLX_SWAP_SHORT(&reply->sequenceNumber); + __GLX_SWAP_INT(&reply->length); + __GLX_SWAP_INT(&reply->n); + WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *)reply); + __GLX_SWAP_INT_ARRAY((int *)buf, length); + WriteToClient(client, length << 2, (char *)buf); +} + + +void __glXSwapQueryContextReply(ClientPtr client, + xGLXQueryContextReply *reply, int *buf) +{ + int length = reply->length; + __GLX_DECLARE_SWAP_VARIABLES; + __GLX_SWAP_SHORT(&reply->sequenceNumber); + __GLX_SWAP_INT(&reply->length); + __GLX_SWAP_INT(&reply->n); + WriteToClient(client, sz_xGLXQueryContextReply, (char *)reply); + __GLX_SWAP_INT_ARRAY((int *)buf, length); + WriteToClient(client, length << 2, (char *)buf); +} + +void __glXSwapGetDrawableAttributesReply(ClientPtr client, + xGLXGetDrawableAttributesReply *reply, int *buf) +{ + __GLX_DECLARE_SWAP_VARIABLES; + __GLX_SWAP_SHORT(&reply->sequenceNumber); + __GLX_SWAP_INT(&reply->length); + __GLX_SWAP_INT(&reply->numAttribs); + __GLX_SWAP_INT_ARRAY( buf, reply->length ); + WriteToClient(client, sz_xGLXGetDrawableAttributesReply, (char *)reply); + WriteToClient(client, reply->length << 2, (char *)buf); +} + +void __glXSwapQueryMaxSwapBarriersSGIXReply(ClientPtr client, xGLXQueryMaxSwapBarriersSGIXReply *reply) +{ + __GLX_DECLARE_SWAP_VARIABLES; + __GLX_SWAP_SHORT(&reply->sequenceNumber); + __GLX_SWAP_INT(&reply->length); + __GLX_SWAP_INT(&reply->max); + WriteToClient(client, sz_xGLXQueryMaxSwapBarriersSGIXReply, (char *)reply); +} + +/************************************************************************/ + +/* +** Render and Renderlarge are not in the GLX API. They are used by the GLX +** client library to send batches of GL rendering commands. +*/ + +int __glXSwapRender(__GLXclientState *cl, GLbyte *pc) +{ + xGLXRenderReq *req; + int left; + __GLXrenderHeader *hdr; + ClientPtr client = cl->client; + __GLX_DECLARE_SWAP_VARIABLES; + + /* + ** NOTE: much of this code also appears in the nonswapping version of this + ** routine, __glXRender(). Any changes made here should also be + ** duplicated there. + */ + + req = (xGLXRenderReq *) pc; + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->contextTag); + + pc += sz_xGLXRenderReq; + left = (req->length << 2) - sz_xGLXRenderReq; + while (left > 0) { + void (* proc)(GLbyte *); + CARD16 opcode; + + /* + ** Verify that the header length and the overall length agree. + ** Also, each command must be word aligned. + */ + hdr = (__GLXrenderHeader *) pc; + __GLX_SWAP_SHORT(&hdr->length); + __GLX_SWAP_SHORT(&hdr->opcode); + + /* + * call the command procedure to swap any arguments + */ + opcode = hdr->opcode; + if ( (opcode >= __GLX_MIN_RENDER_OPCODE) && + (opcode <= __GLX_MAX_RENDER_OPCODE) ) { + proc = __glXSwapRenderTable[opcode]; +#if __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT + } else if ( (opcode >= __GLX_MIN_RENDER_OPCODE_EXT) && + (opcode <= __GLX_MAX_RENDER_OPCODE_EXT) ) { + int index = opcode - __GLX_MIN_RENDER_OPCODE_EXT; + __GLXRenderSwapInfo *info = &__glXSwapRenderTable_EXT[index]; + if (info->swapfunc) { + proc = info->swapfunc; + } + else { + proc = NULL; + if (info->elem_size == 4 && info->nelems > 0) { + __GLX_SWAP_INT_ARRAY( (int *)(pc + __GLX_RENDER_HDR_SIZE), + info->nelems ); + } + else if (info->elem_size == 2 && info->nelems > 0) { + __GLX_SWAP_SHORT_ARRAY( (short *)(pc + __GLX_RENDER_HDR_SIZE), + info->nelems ); + } + else if (info->elem_size == 8 && info->nelems > 0) { + __GLX_SWAP_DOUBLE_ARRAY( (double *)(pc + __GLX_RENDER_HDR_SIZE), + info->nelems ); + } + } +#endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */ + } else { + client->errorValue = 0; + return __glXBadRenderRequest; + } + + if (proc != NULL) + (*proc)(pc + __GLX_RENDER_HDR_SIZE); + + /* + * proceed to the next command + */ + pc += hdr->length; + left -= hdr->length; + } + + return __glXRender( cl, (GLbyte *)req ); +} + +/* +** Execute a large rendering request (one that spans multiple X requests). +*/ +int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc) +{ + ClientPtr client = cl->client; + xGLXRenderLargeReq *req; + __GLXrenderLargeHeader *hdr; + __GLX_DECLARE_SWAP_VARIABLES; + + req = (xGLXRenderLargeReq *) pc; + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->contextTag); + __GLX_SWAP_INT(&req->dataBytes); + __GLX_SWAP_SHORT(&req->requestNumber); + __GLX_SWAP_SHORT(&req->requestTotal); + + pc += sz_xGLXRenderLargeReq; + + if (req->requestNumber == 1) { + void (* proc)(GLbyte *) = NULL; + __GLXRenderSwapInfo *info = NULL; + CARD16 opcode; + + hdr = (__GLXrenderLargeHeader *) pc; + __GLX_SWAP_INT(&hdr->length); + __GLX_SWAP_INT(&hdr->opcode); + + /* + * call the command procedure to swap any arguments + * Note that we are assuming that all arguments that needs to be + * swaped are on the first req only ! + */ + opcode = hdr->opcode; + if ( (opcode >= __GLX_MIN_RENDER_OPCODE) && + (opcode <= __GLX_MAX_RENDER_OPCODE) ) { + proc = __glXSwapRenderTable[opcode]; +#if __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT + } else if ( (opcode >= __GLX_MIN_RENDER_OPCODE_EXT) && + (opcode <= __GLX_MAX_RENDER_OPCODE_EXT) ) { + int index = opcode - __GLX_MIN_RENDER_OPCODE_EXT; + info = &__glXSwapRenderTable_EXT[index]; + if (info->swapfunc) { + proc = info->swapfunc; + } +#endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */ + } else { + client->errorValue = 0; + cl->largeCmdRequestsTotal = 0; + return __glXBadLargeRequest; + } + + /* + ** Make enough space in the buffer, then copy the entire request. + */ + if (cl->largeCmdBufSize < hdr->length) { + if (!cl->largeCmdBuf) { + cl->largeCmdBuf = (GLbyte *) __glXMalloc(hdr->length); + } else { + cl->largeCmdBuf = (GLbyte *) __glXRealloc(cl->largeCmdBuf, hdr->length); + } + if (!cl->largeCmdBuf) { + cl->largeCmdRequestsTotal = 0; + return BadAlloc; + } + cl->largeCmdBufSize = hdr->length; + } + memcpy(cl->largeCmdBuf, pc, req->dataBytes); + + cl->largeCmdBytesSoFar = req->dataBytes; + cl->largeCmdBytesTotal = hdr->length; + cl->largeCmdRequestsSoFar = 1; + cl->largeCmdRequestsTotal = req->requestTotal; + cl->largeCmdRequestsSwapProc = proc; + cl->largeCmdMaxReqDataSize = req->dataBytes; + cl->largeCmdRequestsSwap_info = info; + + return Success; + + + } + else if (req->requestNumber < cl->largeCmdRequestsTotal) { + /* + * This is not the first nor last request - just copy the data + */ + if ( cl->largeCmdBytesSoFar + req->dataBytes > cl->largeCmdBytesTotal) { + cl->largeCmdRequestsTotal = 0; + return __glXBadLargeRequest; + } + + memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, + pc, req->dataBytes); + + cl->largeCmdBytesSoFar += req->dataBytes; + + if (req->dataBytes > cl->largeCmdMaxReqDataSize) + cl->largeCmdMaxReqDataSize = req->dataBytes; + + return Success; + } + else if (req->requestNumber == cl->largeCmdRequestsTotal) { + /* + * this is the last request + * copy the remainder bytes, call the procedure to swap any + * needed data, and then call to transfer the command to all + * back-end servers + */ + if ( cl->largeCmdBytesSoFar + req->dataBytes > cl->largeCmdBytesTotal) { + cl->largeCmdRequestsTotal = 0; + return __glXBadLargeRequest; + } + + memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, + pc, req->dataBytes); + + cl->largeCmdBytesSoFar += req->dataBytes; + + if (req->dataBytes > cl->largeCmdMaxReqDataSize) + cl->largeCmdMaxReqDataSize = req->dataBytes; + + if (cl->largeCmdRequestsSwapProc != NULL) { + (*cl->largeCmdRequestsSwapProc)(cl->largeCmdBuf + __GLX_RENDER_LARGE_HDR_SIZE); + } + else if (cl->largeCmdRequestsSwap_info && + cl->largeCmdRequestsSwap_info->nelems > 0) { + if (cl->largeCmdRequestsSwap_info->elem_size == 4) { + __GLX_SWAP_INT_ARRAY( (int *)(pc + __GLX_RENDER_LARGE_HDR_SIZE), + cl->largeCmdRequestsSwap_info->nelems ); + } + else if (cl->largeCmdRequestsSwap_info->elem_size == 2) { + __GLX_SWAP_SHORT_ARRAY( (short *)(pc + __GLX_RENDER_LARGE_HDR_SIZE), + cl->largeCmdRequestsSwap_info->nelems ); + } + else if (cl->largeCmdRequestsSwap_info->elem_size == 8) { + __GLX_SWAP_DOUBLE_ARRAY( (double *)(pc + __GLX_RENDER_LARGE_HDR_SIZE), + cl->largeCmdRequestsSwap_info->nelems ); + } + } + + cl->largeCmdRequestsTotal = 0; + return( __glXSendLargeCommand(cl, req->contextTag) ); + + } + else { + cl->largeCmdRequestsTotal = 0; + return __glXBadLargeRequest; + } + +} + +/************************************************************************/ + +/* +** No support is provided for the vendor-private requests other than +** allocating these entry points in the dispatch table. +*/ + +int __glXSwapVendorPrivate(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateReq *req; + CARD32 vendorCode; + + __GLX_DECLARE_SWAP_VARIABLES; + + req = (xGLXVendorPrivateReq *) pc; + vendorCode = req->vendorCode; + __GLX_SWAP_INT(&vendorCode); + + + switch( vendorCode ) { + + case X_GLvop_DeleteTexturesEXT: + return __glXVForwardSingleReqSwap( cl, pc ); + break; + + case X_GLXvop_SwapIntervalSGI: + if (glxIsExtensionSupported("SGI_swap_control")) { + return __glXVForwardSingleReqSwap( cl, pc ); + } + else { + return Success; + } + break; + +#if 0 /* glx 1.3 */ + case X_GLXvop_CreateGLXVideoSourceSGIX: + break; + case X_GLXvop_DestroyGLXVideoSourceSGIX: + break; + case X_GLXvop_CreateGLXPixmapWithConfigSGIX: + break; + case X_GLXvop_DestroyGLXPbufferSGIX: + break; + case X_GLXvop_ChangeDrawableAttributesSGIX: + break; +#endif + + case X_GLXvop_JoinSwapGroupSGIX: + return __glXSwapJoinSwapGroupSGIX( cl, pc ); + break; + + case X_GLXvop_BindSwapBarrierSGIX: + return __glXSwapBindSwapBarrierSGIX( cl, pc ); + break; + + case X_GLXvop_CreateContextWithConfigSGIX: + return __glXSwapCreateContextWithConfigSGIX( cl, pc ); + break; + + default: + /* + ** unsupported private request + */ + cl->client->errorValue = req->vendorCode; + return __glXUnsupportedPrivateRequest; + } + +} + +int __glXSwapVendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc) +{ + xGLXVendorPrivateWithReplyReq *req; + CARD32 vendorCode; + + __GLX_DECLARE_SWAP_VARIABLES; + + req = (xGLXVendorPrivateWithReplyReq *) pc; + vendorCode = req->vendorCode; + __GLX_SWAP_INT(&vendorCode); + + switch( vendorCode ) { + + case X_GLvop_GetConvolutionFilterEXT: + case X_GLvop_GetSeparableFilterEXT: + case X_GLvop_GetHistogramEXT: + case X_GLvop_GetMinmaxEXT: + return( __glXNoSuchSingleOpcode(cl, pc) ); + break; + + case X_GLvop_GetConvolutionParameterfvEXT: + case X_GLvop_GetConvolutionParameterivEXT: + case X_GLvop_GetHistogramParameterivEXT: + case X_GLvop_GetMinmaxParameterfvEXT: + case X_GLvop_GetMinmaxParameterivEXT: + case X_GLvop_GenTexturesEXT: + return( __glXVForwardAllWithReplySwapiv(cl, pc) ); + break; + + case X_GLvop_AreTexturesResidentEXT: + case X_GLvop_IsTextureEXT: + return( __glXVForwardPipe0WithReplySwap(cl, pc) ); + break; + +#if 0 /* glx1.3 */ + case X_GLvop_GetDetailTexFuncSGIS: + case X_GLvop_GetSharpenTexFuncSGIS: + case X_GLvop_GetColorTableSGI: + case X_GLvop_GetColorTableParameterfvSGI: + case X_GLvop_GetColorTableParameterivSGI: + case X_GLvop_GetTexFilterFuncSGIS: + case X_GLvop_GetInstrumentsSGIX: + case X_GLvop_InstrumentsBufferSGIX: + case X_GLvop_PollInstrumentsSGIX: + case X_GLvop_FlushRasterSGIX: + case X_GLXvop_CreateGLXPbufferSGIX: + case X_GLXvop_GetDrawableAttributesSGIX: + case X_GLXvop_QueryHyperpipeNetworkSGIX: + case X_GLXvop_QueryHyperpipeConfigSGIX: + case X_GLXvop_HyperpipeConfigSGIX: + case X_GLXvop_DestroyHyperpipeConfigSGIX: +#endif + case X_GLXvop_QueryMaxSwapBarriersSGIX: + return( __glXSwapQueryMaxSwapBarriersSGIX(cl, pc) ); + break; + + case X_GLXvop_GetFBConfigsSGIX: + return( __glXSwapGetFBConfigsSGIX(cl, pc) ); + break; + + case X_GLXvop_MakeCurrentReadSGI: + return( __glXSwapMakeCurrentReadSGI(cl, pc) ); + break; + + case X_GLXvop_QueryContextInfoEXT: + return( __glXSwapQueryContextInfoEXT(cl,(char *)pc) ); + break; + + default: + /* + ** unsupported private request + */ + cl->client->errorValue = req->vendorCode; + return __glXUnsupportedPrivateRequest; + } + +} + +int __glXSwapGetFBConfigs(__GLXclientState *cl, GLbyte *pc) +{ + xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->screen); + + return __glXGetFBConfigs(cl, pc); +} + +int __glXSwapGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc) +{ + xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *)pc; + xGLXGetFBConfigsReq new_req; + + new_req.reqType = req->reqType; + new_req.glxCode = req->glxCode; + new_req.length = req->length; + new_req.screen = req->screen; + + return( __glXSwapGetFBConfigs( cl, (GLbyte *)&new_req ) ); +} + +int __glXSwapCreateWindow(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreateWindowReq *req = (xGLXCreateWindowReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->screen); + __GLX_SWAP_INT(&req->fbconfig); + __GLX_SWAP_INT(&req->window); + __GLX_SWAP_INT(&req->glxwindow); + __GLX_SWAP_INT(&req->numAttribs); + + return( __glXCreateWindow( cl, (GLbyte *)pc ) ); +} + +int __glXSwapDestroyWindow(__GLXclientState *cl, GLbyte *pc) +{ + xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->glxwindow); + + return( __glXDestroyWindow( cl, (GLbyte *)pc ) ); +} + +int __glXSwapQueryContext(__GLXclientState *cl, GLbyte *pc) +{ + xGLXQueryContextReq *req = (xGLXQueryContextReq *)pc; + + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->context); + + return( __glXQueryContext(cl, (GLbyte *)pc) ); + +} + +int __glXSwapCreatePbuffer(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *)pc; + int nattr = req->numAttribs; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->screen); + __GLX_SWAP_INT(&req->fbconfig); + __GLX_SWAP_INT(&req->pbuffer); + __GLX_SWAP_INT(&req->numAttribs); + __GLX_SWAP_INT_ARRAY( (int *)(req+1), nattr*2 ); + + return( __glXCreatePbuffer( cl, pc ) ); +} + +int __glXSwapDestroyPbuffer(__GLXclientState *cl, GLbyte *pc) +{ + xGLXDestroyPbufferReq *req = (xGLXDestroyPbufferReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->pbuffer); + + return( __glXDestroyPbuffer( cl, (GLbyte *)pc ) ); +} + +int __glXSwapGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc) +{ + xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *)pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->drawable); + + return( __glXGetDrawableAttributes(cl, pc) ); +} + +int __glXSwapChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc) +{ + xGLXChangeDrawableAttributesReq *req = (xGLXChangeDrawableAttributesReq *)pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->drawable); + __GLX_SWAP_INT(&req->numAttribs); + __GLX_SWAP_INT_ARRAY( (int *)(req+1), req->numAttribs * 2 ); + + return( __glXChangeDrawableAttributes(cl, pc) ); +} diff --git a/xorg-server/hw/dmx/glxProxy/glxcontext.h b/xorg-server/hw/dmx/glxProxy/glxcontext.h new file mode 100644 index 000000000..d59df3f0c --- /dev/null +++ b/xorg-server/hw/dmx/glxProxy/glxcontext.h @@ -0,0 +1,116 @@ +#ifndef _GLX_context_h_ +#define _GLX_context_h_ + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ + +typedef struct __GLXcontextRec __GLXcontext; + +#include "GL/internal/glcore.h" + +struct __GLXcontextRec { + /* + ** list of context structs + */ + struct __GLXcontextRec *last; + struct __GLXcontextRec *next; + + /* + ** Pointer to screen info data for this context. This is set + ** when the context is created. + */ + ScreenPtr pScreen; + __GLXscreenInfo *pGlxScreen; + + /* + ** This context is created with respect to this visual. + */ + VisualRec *pVisual; + __GLXvisualConfig *pGlxVisual; + __GLXFBConfig *pFBConfig; + + /* + ** The XID of this context. + */ + XID id; + XID *real_ids; + + /* + ** The XID of the shareList context. + */ + XID share_id; + + /* + ** Visual id. + */ + VisualID vid; + VisualID *real_vids; + + /* + ** screen number. + */ + GLint screen; + + /* + ** Whether this context's ID still exists. + */ + GLboolean idExists; + + /* + ** Whether this context is current for some client. + */ + GLboolean isCurrent; + + /* + ** Buffers for feedback and selection. + */ + GLfloat *feedbackBuf; + GLint feedbackBufSize; /* number of elements allocated */ + GLuint *selectBuf; + GLint selectBufSize; /* number of elements allocated */ + + /* + ** Set only if current drawable is a glx pixmap. + */ + __GLXpixmap *pGlxPixmap; + __GLXpixmap *pGlxReadPixmap; + __glXWindow *pGlxWindow; + __glXWindow *pGlxReadWindow; + __glXPbuffer *pGlxPbuffer; + __glXPbuffer *pGlxReadPbuffer; + +}; + +#endif /* !__GLX_context_h__ */ diff --git a/xorg-server/hw/dmx/glxProxy/glxdrawable.h b/xorg-server/hw/dmx/glxProxy/glxdrawable.h new file mode 100644 index 000000000..baed68315 --- /dev/null +++ b/xorg-server/hw/dmx/glxProxy/glxdrawable.h @@ -0,0 +1,71 @@ +#ifndef _GLX_drawable_h_ +#define _GLX_drawable_h_ + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ + +typedef struct { + + DrawablePtr pDraw; + __GLXvisualConfig *pGlxVisual; + __GLXscreenInfo *pGlxScreen; + __GLXFBConfig *pFBConfig; + ScreenPtr pScreen; + Bool idExists; + int refcnt; + XID *be_xids; + +} __GLXpixmap; + +typedef struct { + DrawablePtr pDraw; + int type; + Bool idExists; + int refcnt; /* contexts bound */ + __GLXFBConfig *pGlxFBConfig; + ScreenPtr pScreen; +} __glXWindow; + + +typedef struct { + __GLXscreenInfo *pGlxScreen; + __GLXFBConfig *pFBConfig; + ScreenPtr pScreen; + Bool idExists; + int refcnt; + XID *be_xids; +} __glXPbuffer; + +#endif /* !__GLX_drawable_h__ */ diff --git a/xorg-server/hw/dmx/glxProxy/glxerror.h b/xorg-server/hw/dmx/glxProxy/glxerror.h new file mode 100644 index 000000000..f69cadbde --- /dev/null +++ b/xorg-server/hw/dmx/glxProxy/glxerror.h @@ -0,0 +1,57 @@ +#ifndef _GLX_error_h_ +#define _GLX_error_h_ + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ + +/* +** Error codes. These have the extension error base added to them +** when the extension initializes. +*/ +extern int __glXerrorBase; +extern int __glXBadContext; +extern int __glXBadContextState; +extern int __glXBadDrawable; +extern int __glXBadPixmap; +extern int __glXBadCurrentWindow; +extern int __glXBadContextTag; +extern int __glXBadRenderRequest; +extern int __glXBadLargeRequest; +extern int __glXUnsupportedPrivateRequest; +extern int __glXBadFBConfig; +extern int __glXBadPbuffer; + + +#endif diff --git a/xorg-server/hw/dmx/glxProxy/glxext.c b/xorg-server/hw/dmx/glxProxy/glxext.c new file mode 100644 index 000000000..c40150d80 --- /dev/null +++ b/xorg-server/hw/dmx/glxProxy/glxext.c @@ -0,0 +1,519 @@ +/* +** The contents of this file are subject to the GLX Public License Version 1.0 +** (the "License"). You may not use this file except in compliance with the +** License. You may obtain a copy of the License at Silicon Graphics, Inc., +** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 +** or at http://www.sgi.com/software/opensource/glx/license.html. +** +** Software distributed under the License is distributed on an "AS IS" +** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY +** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR +** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific +** language governing rights and limitations under the License. +** +** The Original Software is GLX version 1.2 source code, released February, +** 1999. The developer of the Original Software is Silicon Graphics, Inc. +** Those portions of the Subject Software created by Silicon Graphics, Inc. +** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +** +*/ + +#ifdef HAVE_DMX_CONFIG_H +#include +#endif + +#include "dmx.h" + +#define NEED_REPLIES +#include "glxserver.h" +#include +#include +#include +#include "g_disptab.h" +#include "glxutil.h" +#include "glxext.h" +#include "glxvisuals.h" +#include "micmap.h" +#include "glxswap.h" + +/* +** Stubs to satisfy miinitext.c references. +*/ +typedef int __GLXprovider; +__GLXprovider __glXDRISWRastProvider; +void GlxPushProvider(__GLXprovider *provider) { } + +/* +** Forward declarations. +*/ +static int __glXSwapDispatch(ClientPtr); +static int __glXDispatch(ClientPtr); + +/* +** Called when the extension is reset. +*/ +static void ResetExtension(ExtensionEntry* extEntry) +{ + __glXFlushContextCache(); + __glXScreenReset(); + SwapBarrierReset(); +} + +/* +** Initialize the per-client context storage. +*/ +static void ResetClientState(int clientIndex) +{ + __GLXclientState *cl = __glXClients[clientIndex]; + Display **keep_be_displays; + int i; + + if (cl->returnBuf) __glXFree(cl->returnBuf); + if (cl->currentContexts) __glXFree(cl->currentContexts); + if (cl->currentDrawables) __glXFree(cl->currentDrawables); + if (cl->largeCmdBuf) __glXFree(cl->largeCmdBuf); + + for (i=0; i< screenInfo.numScreens; i++) { + if (cl->be_displays[i]) + XCloseDisplay( cl->be_displays[i] ); + } + + keep_be_displays = cl->be_displays; + memset(cl, 0, sizeof(__GLXclientState)); + cl->be_displays = keep_be_displays; + + /* + ** By default, assume that the client supports + ** GLX major version 1 minor version 0 protocol. + */ + cl->GLClientmajorVersion = 1; + cl->GLClientminorVersion = 0; + if (cl->GLClientextensions) __glXFree(cl->GLClientextensions); + + memset(cl->be_displays, 0, screenInfo.numScreens * sizeof(Display *)); +} + + +/* +** This procedure is called when the client who created the context goes +** away OR when glXDestroyContext is called. In either case, all we do is +** flag that the ID is no longer valid, and (maybe) free the context. +** use. +*/ +static int ContextGone(__GLXcontext* cx, XID id) +{ + cx->idExists = GL_FALSE; + if (!cx->isCurrent) { + __glXFreeContext(cx); + } + + return True; +} + +/* +** Free a client's state. +*/ +static int ClientGone(int clientIndex, XID id) +{ + __GLXcontext *cx; + __GLXclientState *cl = __glXClients[clientIndex]; + int i; + + if (cl) { + /* + ** Free all the contexts that are current for this client. + */ + for (i=0; i < cl->numCurrentContexts; i++) { + cx = cl->currentContexts[i]; + if (cx) { + cx->isCurrent = GL_FALSE; + if (!cx->idExists) { + __glXFreeContext(cx); + } + } + } + /* + ** Re-initialize the client state structure. Don't free it because + ** we'll probably get another client with this index and use the struct + ** again. There is a maximum of MAXCLIENTS of these structures. + */ + ResetClientState(clientIndex); + } + + return True; +} + +/* +** Free a GLX Pixmap. +*/ +void __glXFreeGLXPixmap( __GLXpixmap *pGlxPixmap ) +{ + if (!pGlxPixmap->idExists && + !pGlxPixmap->refcnt) { + + PixmapPtr pPixmap = (PixmapPtr) pGlxPixmap->pDraw; + + /* + ** The DestroyPixmap routine should decrement the refcount and free + ** only if it's zero. + */ + (*pGlxPixmap->pScreen->DestroyPixmap)(pPixmap); + __glXFree(pGlxPixmap->be_xids); + __glXFree(pGlxPixmap); + } + +} + +static int PixmapGone(__GLXpixmap *pGlxPixmap, XID id) +{ + + pGlxPixmap->idExists = False; + __glXFreeGLXPixmap( pGlxPixmap ); + + return True; +} + +void __glXFreeGLXWindow(__glXWindow *pGlxWindow) +{ + if (!pGlxWindow->idExists && !pGlxWindow->refcnt) { + WindowPtr pWindow = (WindowPtr) pGlxWindow->pDraw; + + if (LookupIDByType(pWindow->drawable.id, RT_WINDOW) == pWindow) { + (*pGlxWindow->pScreen->DestroyWindow)(pWindow); + } + + xfree(pGlxWindow); + } +} + +static void WindowGone(__glXWindow *pGlxWindow, XID id) +{ + pGlxWindow->idExists = False; + __glXFreeGLXWindow(pGlxWindow); +} + +void __glXFreeGLXPbuffer(__glXPbuffer *pGlxPbuffer) +{ + if (!pGlxPbuffer->idExists && !pGlxPbuffer->refcnt) { + xfree(pGlxPbuffer->be_xids); + xfree(pGlxPbuffer); + } +} + +static void PbufferGone(__glXPbuffer *pGlxPbuffer, XID id) +{ + pGlxPbuffer->idExists = False; + __glXFreeGLXPbuffer(pGlxPbuffer); +} + +/* +** Free a context. +*/ +GLboolean __glXFreeContext(__GLXcontext *cx) +{ + if (cx->idExists || cx->isCurrent) return GL_FALSE; + + if (cx->feedbackBuf) __glXFree(cx->feedbackBuf); + if (cx->selectBuf) __glXFree(cx->selectBuf); + if (cx->real_ids) __glXFree(cx->real_ids); + if (cx->real_vids) __glXFree(cx->real_vids); + + if (cx->pGlxPixmap) { + /* + ** The previous drawable was a glx pixmap, release it. + */ + cx->pGlxPixmap->refcnt--; + __glXFreeGLXPixmap( cx->pGlxPixmap ); + cx->pGlxPixmap = 0; + } + + if (cx->pGlxReadPixmap) { + /* + ** The previous drawable was a glx pixmap, release it. + */ + cx->pGlxReadPixmap->refcnt--; + __glXFreeGLXPixmap( cx->pGlxReadPixmap ); + cx->pGlxReadPixmap = 0; + } + + if (cx->pGlxWindow) { + /* + ** The previous drawable was a glx window, release it. + */ + cx->pGlxWindow->refcnt--; + __glXFreeGLXWindow( cx->pGlxWindow ); + cx->pGlxWindow = 0; + } + + if (cx->pGlxReadWindow) { + /* + ** The previous drawable was a glx window, release it. + */ + cx->pGlxReadWindow->refcnt--; + __glXFreeGLXWindow( cx->pGlxReadWindow ); + cx->pGlxReadWindow = 0; + } + + __glXFree(cx); + + if (cx == __glXLastContext) { + __glXFlushContextCache(); + } + + return GL_TRUE; +} + +/* +** Initialize the GLX extension. +*/ +void GlxExtensionInit(void) +{ + ExtensionEntry *extEntry; + int i; + int glxSupported = 1; + + /* + // do not initialize GLX extension if GLX is not supported + // by ALL back-end servers. + */ + for (i=0; i 0); + } + + if (!glxSupported || !dmxGLXProxy) { + return; + } + + __glXContextRes = CreateNewResourceType((DeleteType)ContextGone); + __glXClientRes = CreateNewResourceType((DeleteType)ClientGone); + __glXPixmapRes = CreateNewResourceType((DeleteType)PixmapGone); + __glXWindowRes = CreateNewResourceType((DeleteType)WindowGone); + __glXPbufferRes = CreateNewResourceType((DeleteType)PbufferGone); + + /* + ** Add extension to server extensions. + */ + extEntry = AddExtension(GLX_EXTENSION_NAME, __GLX_NUMBER_EVENTS, + __GLX_NUMBER_ERRORS, __glXDispatch, + __glXSwapDispatch, ResetExtension, + StandardMinorOpcode); + if (!extEntry) { + FatalError("__glXExtensionInit: AddExtensions failed\n"); + return; + } + /* + if (!AddExtensionAlias(GLX_EXTENSION_ALIAS, extEntry)) { + ErrorF("__glXExtensionInit: AddExtensionAlias failed\n"); + return; + } + */ + + __glXerrorBase = extEntry->errorBase; + __glXBadContext = extEntry->errorBase + GLXBadContext; + __glXBadContextState = extEntry->errorBase + GLXBadContextState; + __glXBadDrawable = extEntry->errorBase + GLXBadDrawable; + __glXBadPixmap = extEntry->errorBase + GLXBadPixmap; + __glXBadContextTag = extEntry->errorBase + GLXBadContextTag; + __glXBadCurrentWindow = extEntry->errorBase + GLXBadCurrentWindow; + __glXBadRenderRequest = extEntry->errorBase + GLXBadRenderRequest; + __glXBadLargeRequest = extEntry->errorBase + GLXBadLargeRequest; + __glXUnsupportedPrivateRequest = extEntry->errorBase + + GLXUnsupportedPrivateRequest; + __glXBadFBConfig = extEntry->errorBase + GLXBadFBConfig; + __glXBadPbuffer = extEntry->errorBase + GLXBadPbuffer; + + /* + ** Initialize table of client state. There is never a client 0. + */ + for (i=1; i <= MAXCLIENTS; i++) { + __glXClients[i] = 0; + } + + /* + ** Initialize screen specific data. + */ + __glXScreenInit(screenInfo.numScreens); + + /* + ** Initialize swap barrier support. + */ + SwapBarrierInit(); +} + +/************************************************************************/ + +Bool __glXCoreType(void) +{ + return 0; +} + +/************************************************************************/ + +void GlxSetVisualConfigs(int nconfigs, + __GLXvisualConfig *configs, void **privates) +{ + glxSetVisualConfigs(nconfigs, configs, privates); +} + +static miInitVisualsProcPtr saveInitVisualsProc; + +Bool GlxInitVisuals(VisualPtr *visualp, DepthPtr *depthp, + int *nvisualp, int *ndepthp, + int *rootDepthp, VisualID *defaultVisp, + unsigned long sizes, int bitsPerRGB, + int preferredVis) +{ + Bool ret; + + if (saveInitVisualsProc) { + ret = saveInitVisualsProc(visualp, depthp, nvisualp, ndepthp, + rootDepthp, defaultVisp, sizes, bitsPerRGB, + preferredVis); + if (!ret) + return False; + } + + glxInitVisuals(nvisualp, visualp, defaultVisp, *ndepthp, *depthp,*rootDepthp); + + return True; +} + +void +GlxWrapInitVisuals(miInitVisualsProcPtr *initVisProc) +{ + if (dmxGLXProxy) { + saveInitVisualsProc = *initVisProc; + *initVisProc = GlxInitVisuals; + } +} + +/************************************************************************/ + +void __glXFlushContextCache(void) +{ + __glXLastContext = 0; +} + +/************************************************************************/ + +/* +** Top level dispatcher; all commands are executed from here down. +*/ +static int __glXDispatch(ClientPtr client) +{ + REQUEST(xGLXSingleReq); + CARD8 opcode; + int (*proc)(__GLXclientState *cl, GLbyte *pc); + __GLXclientState *cl; + + opcode = stuff->glxCode; + cl = __glXClients[client->index]; + if (!cl) { + cl = (__GLXclientState *) __glXMalloc(sizeof(__GLXclientState)); + __glXClients[client->index] = cl; + if (!cl) { + return BadAlloc; + } + memset(cl, 0, sizeof(__GLXclientState)); + + cl->be_displays = (Display **) __glXMalloc( screenInfo.numScreens * sizeof(Display *) ); + if (!cl->be_displays) { + __glXFree( cl ); + return BadAlloc; + } + memset(cl->be_displays, 0, screenInfo.numScreens * sizeof(Display *)); + } + + if (!cl->inUse) { + /* + ** This is first request from this client. Associate a resource + ** with the client so we will be notified when the client dies. + */ + XID xid = FakeClientID(client->index); + if (!AddResource( xid, __glXClientRes, (pointer)(long)client->index)) { + return BadAlloc; + } + ResetClientState(client->index); + cl->largeCmdRequestsTotal = 0; + cl->inUse = GL_TRUE; + cl->client = client; + } + + /* + ** Check for valid opcode. + */ + if (opcode >= __GLX_SINGLE_TABLE_SIZE) { + return BadRequest; + } + + /* + ** Use the opcode to index into the procedure table. + */ + proc = __glXSingleTable[opcode]; + return (*proc)(cl, (GLbyte *) stuff); +} + +static int __glXSwapDispatch(ClientPtr client) +{ + REQUEST(xGLXSingleReq); + CARD8 opcode; + int (*proc)(__GLXclientState *cl, GLbyte *pc); + __GLXclientState *cl; + + opcode = stuff->glxCode; + cl = __glXClients[client->index]; + if (!cl) { + cl = (__GLXclientState *) __glXMalloc(sizeof(__GLXclientState)); + __glXClients[client->index] = cl; + if (!cl) { + return BadAlloc; + } + memset(cl, 0, sizeof(__GLXclientState)); + + cl->be_displays = (Display **) __glXMalloc( screenInfo.numScreens * sizeof(Display *) ); + if (!cl->be_displays) { + __glXFree( cl ); + return BadAlloc; + } + + memset(cl->be_displays, 0, screenInfo.numScreens * sizeof(Display *)); + } + + if (!cl->inUse) { + /* + ** This is first request from this client. Associate a resource + ** with the client so we will be notified when the client dies. + */ + XID xid = FakeClientID(client->index); + if (!AddResource( xid, __glXClientRes, (pointer)(long)client->index)) { + return BadAlloc; + } + ResetClientState(client->index); + cl->inUse = GL_TRUE; + cl->client = client; + } + + /* + ** Check for valid opcode. + */ + if (opcode >= __GLX_SINGLE_TABLE_SIZE) { + return BadRequest; + } + + /* + ** Use the opcode to index into the procedure table. + */ + proc = __glXSwapSingleTable[opcode]; + return (*proc)(cl, (GLbyte *) stuff); +} + +int __glXNoSuchSingleOpcode(__GLXclientState *cl, GLbyte *pc) +{ + return BadRequest; +} + +void __glXNoSuchRenderOpcode(GLbyte *pc) +{ + return; +} + diff --git a/xorg-server/hw/dmx/glxProxy/glxext.h b/xorg-server/hw/dmx/glxProxy/glxext.h new file mode 100644 index 000000000..011393732 --- /dev/null +++ b/xorg-server/hw/dmx/glxProxy/glxext.h @@ -0,0 +1,97 @@ +#ifndef _glxext_h_ +#define _glxext_h_ + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ + +/* + * Added by VA Linux for XFree86 4.0.x + */ +typedef struct { + int type; + void (*resetExtension)(void); + Bool (*initVisuals)( + VisualPtr * visualp, + DepthPtr * depthp, + int * nvisualp, + int * ndepthp, + int * rootDepthp, + VisualID * defaultVisp, + unsigned long sizes, + int bitsPerRGB + ); + void (*setVisualConfigs)( + int nconfigs, + __GLXvisualConfig *configs, + void **privates + ); +} __GLXextensionInfo; + +extern GLboolean __glXFreeContext(__GLXcontext *glxc); +extern void __glXFlushContextCache(void); + +extern void __glXFreeGLXWindow(__glXWindow *pGlxWindow); +extern void __glXFreeGLXPixmap( __GLXpixmap *pGlxPixmap ); + +extern void __glXNoSuchRenderOpcode(GLbyte*); +extern int __glXNoSuchSingleOpcode(__GLXclientState*, GLbyte*); +extern void __glXErrorCallBack(GLenum code); +extern void __glXClearErrorOccured(void); +extern GLboolean __glXErrorOccured(void); +extern void __glXResetLargeCommandStatus(__GLXclientState*); + +extern int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc); +extern int __glXSwapQueryContextInfoEXT(__GLXclientState *cl, char *pc); + +extern void GlxExtensionInit(void); + +extern Bool __glXCoreType(void); + +extern int GlxInitVisuals( +#if NeedFunctionPrototypes + VisualPtr * visualp, + DepthPtr * depthp, + int * nvisualp, + int * ndepthp, + int * rootDepthp, + VisualID * defaultVisp, + unsigned long sizes, + int bitsPerRGB, + int preferredVis +#endif +); + +#endif /* _glxext_h_ */ + diff --git a/xorg-server/hw/dmx/glxProxy/glxfbconfig.c b/xorg-server/hw/dmx/glxProxy/glxfbconfig.c new file mode 100644 index 000000000..f2321b10c --- /dev/null +++ b/xorg-server/hw/dmx/glxProxy/glxfbconfig.c @@ -0,0 +1,111 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ + +#include "glxfbconfig.h" + +int AreFBConfigsMatch( __GLXFBConfig *c1, __GLXFBConfig *c2 ) +{ + int match; + + match = ( + (c1->visualType == c2->visualType) && + (c1->transparentType == c2->transparentType) && + (c1->transparentRed == c2->transparentRed) && + (c1->transparentGreen == c2->transparentGreen) && + (c1->transparentBlue == c2->transparentBlue) && + (c1->transparentAlpha == c2->transparentAlpha) && + (c1->transparentIndex == c2->transparentIndex) && + (c1->visualCaveat == c2->visualCaveat) && + (c1->drawableType == c2->drawableType) && + (c1->renderType == c2->renderType) && +#if 0 + (c1->maxPbufferWidth == c2->maxPbufferWidth) && + (c1->maxPbufferHeight == c2->maxPbufferHeight) && + (c1->maxPbufferPixels == c2->maxPbufferPixels) && + (c1->optimalPbufferWidth == c2->optimalPbufferWidth) && + (c1->optimalPbufferHeight == c2->optimalPbufferHeight) && +#endif + (c1->visualSelectGroup == c2->visualSelectGroup) && + (c1->rgbMode == c2->rgbMode) && + (c1->colorIndexMode == c2->colorIndexMode) && + (c1->doubleBufferMode == c2->doubleBufferMode) && + (c1->stereoMode == c2->stereoMode) && + (c1->haveAccumBuffer == c2->haveAccumBuffer) && + (c1->haveDepthBuffer == c2->haveDepthBuffer) && + (c1->haveStencilBuffer == c2->haveStencilBuffer) && + (c1->accumRedBits == c2->accumRedBits) && + (c1->accumGreenBits == c2->accumGreenBits) && + (c1->accumBlueBits == c2->accumBlueBits) && + (c1->accumAlphaBits == c2->accumAlphaBits) && + (c1->depthBits == c2->depthBits) && + (c1->stencilBits == c2->stencilBits) && + (c1->indexBits == c2->indexBits) && + (c1->redBits == c2->redBits) && + (c1->greenBits == c2->greenBits) && + (c1->blueBits == c2->blueBits) && + (c1->alphaBits == c2->alphaBits) && + (c1->redMask == c2->redMask) && + (c1->greenMask == c2->greenMask) && + (c1->blueMask == c2->blueMask) && + (c1->alphaMask == c2->alphaMask) && + (c1->multiSampleSize == c2->multiSampleSize) && + (c1->nMultiSampleBuffers == c2->nMultiSampleBuffers) && + (c1->maxAuxBuffers == c2->maxAuxBuffers) && + (c1->level == c2->level) && + (c1->extendedRange == c2->extendedRange) && + (c1->minRed == c2->minRed) && + (c1->maxRed == c2->maxRed) && + (c1->minGreen == c2->minGreen) && + (c1->maxGreen == c2->maxGreen) && + (c1->minBlue == c2->minBlue) && + (c1->maxBlue == c2->maxBlue) && + (c1->minAlpha == c2->minAlpha) && + (c1->maxAlpha == c2->maxAlpha) + ); + + return( match ); +} + +__GLXFBConfig *FindMatchingFBConfig( __GLXFBConfig *c, __GLXFBConfig *configs, int nconfigs ) +{ + int i; + + for (i=0; i + +int AreFBConfigsMatch( __GLXFBConfig *c1, __GLXFBConfig *c2 ); +__GLXFBConfig *FindMatchingFBConfig( __GLXFBConfig *c, __GLXFBConfig *configs, int nconfigs ); + +#endif diff --git a/xorg-server/hw/dmx/glxProxy/glxscreens.c b/xorg-server/hw/dmx/glxProxy/glxscreens.c new file mode 100644 index 000000000..0f9012d39 --- /dev/null +++ b/xorg-server/hw/dmx/glxProxy/glxscreens.c @@ -0,0 +1,382 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ + +#ifdef HAVE_DMX_CONFIG_H +#include +#endif + +#include "dmx.h" +#include "dmxlog.h" + +#undef Xmalloc +#undef Xcalloc +#undef Xrealloc +#undef Xfree + +#include "glxserver.h" + +#include + +#include "glxfbconfig.h" + +#ifdef PANORAMIX +#include "panoramiXsrv.h" +#endif + +__GLXscreenInfo *__glXActiveScreens; +GLint __glXNumActiveScreens; + +__GLXFBConfig **__glXFBConfigs; +int __glXNumFBConfigs; + +static char GLXServerVendorName[] = "SGI DMX/glxProxy"; +static char GLXServerVersion[64]; +static char GLXServerExtensions[] = + "GLX_EXT_visual_info " + "GLX_EXT_visual_rating " + "GLX_EXT_import_context " + "GLX_SGIX_fbconfig " + "GLX_SGI_make_current_read " + "GLX_SGI_swap_control " + ; + +static char ExtensionsString[1024]; + +static void CalcServerVersionAndExtensions( void ) +{ + int s; + xGLXQueryVersionReq *req; + xGLXQueryVersionReply reply; + char **be_extensions; + char *ext; + char *denied_extensions; + + /* + * set the server glx version to be the minimum version + * supported by all back-end servers + */ + __glXVersionMajor = 0; + __glXVersionMinor = 0; + for (s=0; s<__glXNumActiveScreens; s++) { + DMXScreenInfo *dmxScreen = &dmxScreens[s]; + Display *dpy = dmxScreen->beDisplay; + + /* Send the glXQueryVersion request */ + LockDisplay(dpy); + GetReq(GLXQueryVersion,req); + req->reqType = dmxScreen->glxMajorOpcode; + req->glxCode = X_GLXQueryVersion; + req->majorVersion = GLX_SERVER_MAJOR_VERSION; + req->minorVersion = GLX_SERVER_MINOR_VERSION; + _XReply(dpy, (xReply*) &reply, 0, False); + UnlockDisplay(dpy); + SyncHandle(); + + if (s == 0) { + __glXVersionMajor = reply.majorVersion; + __glXVersionMinor = reply.minorVersion; + } + else { + if (reply.majorVersion < __glXVersionMajor) { + __glXVersionMajor = reply.majorVersion; + __glXVersionMinor = reply.minorVersion; + } + else if ( (reply.majorVersion == __glXVersionMajor) && + (reply.minorVersion < __glXVersionMinor) ) { + __glXVersionMinor = reply.minorVersion; + } + } + + } + + if (GLX_SERVER_MAJOR_VERSION < __glXVersionMajor) { + __glXVersionMajor = GLX_SERVER_MAJOR_VERSION; + __glXVersionMinor = GLX_SERVER_MINOR_VERSION; + } + else if ( (GLX_SERVER_MAJOR_VERSION == __glXVersionMajor) && + (GLX_SERVER_MINOR_VERSION < __glXVersionMinor) ) { + __glXVersionMinor = GLX_SERVER_MINOR_VERSION; + } + + sprintf(GLXServerVersion, "%d.%d DMX %d back-end server(s)", + __glXVersionMajor, __glXVersionMinor, __glXNumActiveScreens ); + /* + * set the ExtensionsString to the minimum extensions string + */ + ExtensionsString[0] = '\0'; + + /* + * read extensions strings of all back-end servers + */ + be_extensions = (char **)Xalloc( __glXNumActiveScreens * sizeof(char *) ); + if (!be_extensions) + return; + + for (s=0; s<__glXNumActiveScreens; s++) { + DMXScreenInfo *dmxScreen = &dmxScreens[s]; + Display *dpy = dmxScreen->beDisplay; + xGLXQueryServerStringReq *req; + xGLXQueryServerStringReply reply; + int length, numbytes, slop; + + /* Send the glXQueryServerString request */ + LockDisplay(dpy); + GetReq(GLXQueryServerString,req); + req->reqType = dmxScreen->glxMajorOpcode; + req->glxCode = X_GLXQueryServerString; + req->screen = DefaultScreen(dpy); + req->name = GLX_EXTENSIONS; + _XReply(dpy, (xReply*) &reply, 0, False); + + length = (int)reply.length; + numbytes = (int)reply.n; + slop = numbytes * __GLX_SIZE_INT8 & 3; + be_extensions[s] = (char *)Xalloc(numbytes); + if (!be_extensions[s]) { + /* Throw data on the floor */ + _XEatData(dpy, length); + } else { + _XRead(dpy, (char *)be_extensions[s], numbytes); + if (slop) _XEatData(dpy,4-slop); + } + UnlockDisplay(dpy); + SyncHandle(); + } + + /* + * extensions string will include only extensions that our + * server supports as well as all back-end servers supports. + * extensions that are in the DMX_DENY_EXTENSIONS string will + * not be supported. + */ + denied_extensions = getenv("DMX_DENY_GLX_EXTENSIONS"); + ext = strtok(GLXServerExtensions, " "); + while( ext ) { + int supported = 1; + + if (denied_extensions && strstr(denied_extensions, ext)) { + supported = 0; + } + else { + for (s=0; s<__glXNumActiveScreens && supported; s++) { + if ( !strstr(be_extensions[s], ext) ) { + supported = 0; + } + } + } + + if (supported) { + strcat(ExtensionsString, ext); + strcat(ExtensionsString, " "); + } + + ext = strtok(NULL, " "); + } + + /* + * release temporary storage + */ + for (s=0; s<__glXNumActiveScreens; s++) { + if (be_extensions[s]) Xfree(be_extensions[s]); + } + Xfree( be_extensions ); + + if (dmxGLXSwapGroupSupport) { + if (!denied_extensions || + !strstr(denied_extensions, "GLX_SGIX_swap_group")) { + strcat(ExtensionsString, "GLX_SGIX_swap_group"); + if (!denied_extensions || + !strstr(denied_extensions, "GLX_SGIX_swap_barrier")) { + strcat(ExtensionsString, " GLX_SGIX_swap_barrier"); + } + } + } + +} + +void __glXScreenInit(GLint numscreens) +{ + int s; + int c; + DMXScreenInfo *dmxScreen0 = &dmxScreens[0]; + __glXNumActiveScreens = numscreens; + + + CalcServerVersionAndExtensions(); + + + __glXFBConfigs = NULL; + __glXNumFBConfigs = 0; + + if ( (__glXVersionMajor == 1 && __glXVersionMinor >= 3) || + (__glXVersionMajor > 1) || + ( strstr(ExtensionsString, "GLX_SGIX_fbconfig") ) ) { + + /* + // Initialize FBConfig info. + // find the set of FBConfigs that are present on all back-end + // servers - only those configs will be supported + */ + __glXFBConfigs = (__GLXFBConfig **)Xalloc( dmxScreen0->numFBConfigs * + (numscreens+1) * sizeof(__GLXFBConfig *) ); + __glXNumFBConfigs = 0; + + for (c=0; cnumFBConfigs; c++) { + __GLXFBConfig *cfg = NULL; + + if (numscreens > 1) { + for (s=1; sfbconfigs[c], + dmxScreen->fbconfigs, + dmxScreen->numFBConfigs ); + __glXFBConfigs[ __glXNumFBConfigs * (numscreens+1) + s + 1 ] = cfg; + if (!cfg) { + dmxLog(dmxInfo,"screen0 FBConfig 0x%x is missing on screen#%d\n", dmxScreen0->fbconfigs[c].id, s); + break; + } + else { + dmxLog(dmxInfo,"screen0 FBConfig 0x%x matched to 0x%x on screen#%d\n", dmxScreen0->fbconfigs[c].id, cfg->id, s); + } + } + } + else { + cfg = &dmxScreen0->fbconfigs[c]; + } + + if (cfg) { + + /* filter out overlay visuals */ + if (cfg->level == 0) { + __GLXFBConfig *proxy_cfg; + + __glXFBConfigs[ __glXNumFBConfigs * (numscreens+1) + 1 ] = + &dmxScreen0->fbconfigs[c]; + + proxy_cfg = Xalloc( sizeof(__GLXFBConfig) ); + memcpy( proxy_cfg, cfg, sizeof(__GLXFBConfig) ); + proxy_cfg->id = FakeClientID(0); + /* visual will be associated later in __glXGetFBConfigs */ + proxy_cfg->associatedVisualId = (unsigned int)-1; + + __glXFBConfigs[ __glXNumFBConfigs * (numscreens+1) + 0 ] = proxy_cfg; + + __glXNumFBConfigs++; + } + + } + + } + + } + +} + +void __glXScreenReset(void) +{ + __glXNumActiveScreens = 0; +} + +char *__glXGetServerString( unsigned int name ) +{ + char *ret = NULL; + + switch( name) { + + case GLX_VENDOR: + ret = GLXServerVendorName; + break; + + case GLX_VERSION: + ret = GLXServerVersion; + break; + + case GLX_EXTENSIONS: + ret = ExtensionsString; + break; + + default: + break; + } + + return( ret ); + +} + + +__GLXFBConfig *glxLookupFBConfig( GLXFBConfigID id ) +{ + int i,j; + + for (i=0, j=0; i<__glXNumFBConfigs; i++,j+=(__glXNumActiveScreens+1) ) { + if ( __glXFBConfigs[j]->id == id) + return( __glXFBConfigs[j] ); + } + + return(NULL); +} + +__GLXFBConfig *glxLookupFBConfigByVID( VisualID vid ) +{ + int i,j; + + for (i=0, j=0; i<__glXNumFBConfigs; i++,j+=(__glXNumActiveScreens+1) ) { + if ( __glXFBConfigs[j]->associatedVisualId == vid) + return( __glXFBConfigs[j] ); + } + + return(NULL); +} + +__GLXFBConfig *glxLookupBackEndFBConfig( GLXFBConfigID id, int screen ) +{ + int i; + int j; + + for (i=0, j=0; i<__glXNumFBConfigs; i++,j+=(__glXNumActiveScreens+1) ) { + if ( __glXFBConfigs[j]->id == id) + return( __glXFBConfigs[j+screen+1] ); + } + + return(NULL); + +} + +int glxIsExtensionSupported( char *ext ) +{ + return( strstr(ExtensionsString, ext) != NULL ); +} diff --git a/xorg-server/hw/dmx/glxProxy/glxscreens.h b/xorg-server/hw/dmx/glxProxy/glxscreens.h new file mode 100644 index 000000000..5f93e497b --- /dev/null +++ b/xorg-server/hw/dmx/glxProxy/glxscreens.h @@ -0,0 +1,62 @@ +#ifndef _GLX_screens_h_ +#define _GLX_screens_h_ + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ + +#include "GL/internal/glcore.h" + + + +typedef struct { + + __GLXvisualConfig *pGlxVisual; + GLint numVisuals; + GLint numGLXVisuals; + GLint *isGLXvis; + + char *GLXvendor; + char *GLXversion; + char *GLXextensions; + +} __GLXscreenInfo; + + +extern void __glXScreenInit(GLint); +extern void __glXScreenReset(void); + +extern char *__glXGetServerString( unsigned int name ); + +#endif /* !__GLX_screens_h__ */ diff --git a/xorg-server/hw/dmx/glxProxy/glxserver.h b/xorg-server/hw/dmx/glxProxy/glxserver.h new file mode 100644 index 000000000..021d4c1de --- /dev/null +++ b/xorg-server/hw/dmx/glxProxy/glxserver.h @@ -0,0 +1,322 @@ +#ifndef _GLX_server_h_ +#define _GLX_server_h_ + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ + +#include "dmx.h" + +#include +#include +#include +#include +#include +#include +#include + + +/* +** The X header misc.h defines these math functions. +*/ +#undef abs +#undef fabs + +#define GL_GLEXT_PROTOTYPES /* we want prototypes */ +#include +#include +#include + +#include "glxscreens.h" +#include "glxdrawable.h" +#include "glxcontext.h" +#include "glxerror.h" + + +#define GLX_SERVER_MAJOR_VERSION 1 +#define GLX_SERVER_MINOR_VERSION 3 + +#ifndef True +#define True 1 +#endif +#ifndef False +#define False 0 +#endif + +/* +** GLX resources. +typedef XID GLXContextID; +typedef XID GLXPixmap; +typedef XID GLXDrawable; +typedef XID GLXWindow; +typedef XID GLXPbuffer; + +typedef struct __GLXcontextRec *GLXContext; +*/ +typedef struct __GLXclientStateRec __GLXclientState; + +extern __GLXscreenInfo *__glXActiveScreens; +extern GLint __glXNumActiveScreens; + +/************************************************************************/ + +/* +** The last context used (from the server's persective) is cached. +*/ +extern __GLXcontext *__glXLastContext; +extern __GLXcontext *__glXForceCurrent(__GLXclientState*, GLXContextTag, int*); + +/* +** Macros to set, unset, and retrieve the flag that says whether a context +** has unflushed commands. +*/ +#define __GLX_NOTE_UNFLUSHED_CMDS(glxc) glxc->hasUnflushedCommands = GL_TRUE +#define __GLX_NOTE_FLUSHED_CMDS(glxc) glxc->hasUnflushedCommands = GL_FALSE +#define __GLX_HAS_UNFLUSHED_CMDS(glxc) (glxc->hasUnflushedCommands) + +/************************************************************************/ + +typedef struct { + int elem_size; /* element size in bytes */ + int nelems; /* number of elements to swap */ + void (*swapfunc)(GLbyte *pc); +} __GLXRenderSwapInfo; + +/* +** State kept per client. +*/ +struct __GLXclientStateRec { + /* + ** Whether this structure is currently being used to support a client. + */ + Bool inUse; + + /* + ** Buffer for returned data. + */ + GLbyte *returnBuf; + GLint returnBufSize; + + /* + ** Keep a list of all the contexts that are current for this client's + ** threads. + */ + __GLXcontext **currentContexts; + DrawablePtr *currentDrawables; + GLint numCurrentContexts; + + /* Back pointer to X client record */ + ClientPtr client; + + int GLClientmajorVersion; + int GLClientminorVersion; + char *GLClientextensions; + + GLXContextTag *be_currentCTag; + Display **be_displays; + + /* + ** Keep track of large rendering commands, which span multiple requests. + */ + GLint largeCmdBytesSoFar; /* bytes received so far */ + GLint largeCmdBytesTotal; /* total bytes expected */ + GLint largeCmdRequestsSoFar; /* requests received so far */ + GLint largeCmdRequestsTotal; /* total requests expected */ + void (*largeCmdRequestsSwapProc)(GLbyte *); + __GLXRenderSwapInfo *largeCmdRequestsSwap_info; + GLbyte *largeCmdBuf; + GLint largeCmdBufSize; + GLint largeCmdMaxReqDataSize; + +}; + +extern __GLXclientState *__glXClients[]; + +/************************************************************************/ + +/* +** Dispatch tables. +*/ +typedef void (*__GLXdispatchRenderProcPtr)(GLbyte *); +typedef int (*__GLXdispatchSingleProcPtr)(__GLXclientState *, GLbyte *); +typedef int (*__GLXdispatchVendorPrivProcPtr)(__GLXclientState *, GLbyte *); +extern __GLXdispatchSingleProcPtr __glXSingleTable[]; +extern __GLXdispatchVendorPrivProcPtr __glXVendorPrivTable_EXT[]; +extern __GLXdispatchSingleProcPtr __glXSwapSingleTable[]; +extern __GLXdispatchVendorPrivProcPtr __glXSwapVendorPrivTable_EXT[]; +extern __GLXdispatchRenderProcPtr __glXSwapRenderTable[]; + +extern __GLXRenderSwapInfo __glXSwapRenderTable_EXT[]; + +/* + * Dispatch for GLX commands. + */ +typedef int (*__GLXprocPtr)(__GLXclientState *, char *pc); +extern __GLXprocPtr __glXProcTable[]; + +/* + * Tables for computing the size of each rendering command. + */ +typedef struct { + int bytes; + int (*varsize)(GLbyte *pc, Bool swap); +} __GLXrenderSizeData; +extern __GLXrenderSizeData __glXRenderSizeTable[]; +extern __GLXrenderSizeData __glXRenderSizeTable_EXT[]; + +/************************************************************************/ + +/* +** X resources. +*/ +extern RESTYPE __glXContextRes; +extern RESTYPE __glXClientRes; +extern RESTYPE __glXPixmapRes; +extern RESTYPE __glXDrawableRes; +extern RESTYPE __glXWindowRes; +extern RESTYPE __glXPbufferRes; + +/************************************************************************/ + +/* +** Prototypes. +*/ + + +extern char *__glXcombine_strings(const char *, const char *); + +extern void __glXDisp_DrawArrays(GLbyte*); +extern void __glXDispSwap_DrawArrays(GLbyte*); + + +/* +** Routines for sending swapped replies. +*/ + +extern void __glXSwapMakeCurrentReply(ClientPtr client, + xGLXMakeCurrentReadSGIReply *reply); + +extern void __glXSwapIsDirectReply(ClientPtr client, + xGLXIsDirectReply *reply); +extern void __glXSwapQueryVersionReply(ClientPtr client, + xGLXQueryVersionReply *reply); +extern void __glXSwapQueryContextInfoEXTReply(ClientPtr client, + xGLXQueryContextInfoEXTReply *reply, + int *buf); +extern void glxSwapQueryExtensionsStringReply(ClientPtr client, + xGLXQueryExtensionsStringReply *reply, char *buf); +extern void glxSwapQueryServerStringReply(ClientPtr client, + xGLXQueryServerStringReply *reply, char *buf); +extern void __glXSwapQueryContextReply(ClientPtr client, + xGLXQueryContextReply *reply, int *buf); +extern void __glXSwapGetDrawableAttributesReply(ClientPtr client, + xGLXGetDrawableAttributesReply *reply, int *buf); +extern void __glXSwapQueryMaxSwapBarriersSGIXReply(ClientPtr client, + xGLXQueryMaxSwapBarriersSGIXReply *reply); + +/* + * Routines for computing the size of variably-sized rendering commands. + */ + +extern int __glXTypeSize(GLenum enm); +extern int __glXImageSize(GLenum format, GLenum type, GLsizei w, GLsizei h, + GLint rowLength, GLint skipRows, GLint alignment); +extern int __glXImage3DSize(GLenum format, GLenum type, + GLsizei w, GLsizei h, GLsizei d, + GLint imageHeight, GLint rowLength, + GLint skipImages, GLint skipRows, + GLint alignment); + +extern int __glXCallListsReqSize(GLbyte *pc, Bool swap); +extern int __glXBitmapReqSize(GLbyte *pc, Bool swap); +extern int __glXFogfvReqSize(GLbyte *pc, Bool swap); +extern int __glXFogivReqSize(GLbyte *pc, Bool swap); +extern int __glXLightfvReqSize(GLbyte *pc, Bool swap); +extern int __glXLightivReqSize(GLbyte *pc, Bool swap); +extern int __glXLightModelfvReqSize(GLbyte *pc, Bool swap); +extern int __glXLightModelivReqSize(GLbyte *pc, Bool swap); +extern int __glXMaterialfvReqSize(GLbyte *pc, Bool swap); +extern int __glXMaterialivReqSize(GLbyte *pc, Bool swap); +extern int __glXTexParameterfvReqSize(GLbyte *pc, Bool swap); +extern int __glXTexParameterivReqSize(GLbyte *pc, Bool swap); +extern int __glXTexImage1DReqSize(GLbyte *pc, Bool swap); +extern int __glXTexImage2DReqSize(GLbyte *pc, Bool swap); +extern int __glXTexEnvfvReqSize(GLbyte *pc, Bool swap); +extern int __glXTexEnvivReqSize(GLbyte *pc, Bool swap); +extern int __glXTexGendvReqSize(GLbyte *pc, Bool swap); +extern int __glXTexGenfvReqSize(GLbyte *pc, Bool swap); +extern int __glXTexGenivReqSize(GLbyte *pc, Bool swap); +extern int __glXMap1dReqSize(GLbyte *pc, Bool swap); +extern int __glXMap1fReqSize(GLbyte *pc, Bool swap); +extern int __glXMap2dReqSize(GLbyte *pc, Bool swap); +extern int __glXMap2fReqSize(GLbyte *pc, Bool swap); +extern int __glXPixelMapfvReqSize(GLbyte *pc, Bool swap); +extern int __glXPixelMapuivReqSize(GLbyte *pc, Bool swap); +extern int __glXPixelMapusvReqSize(GLbyte *pc, Bool swap); +extern int __glXDrawPixelsReqSize(GLbyte *pc, Bool swap); +extern int __glXDrawArraysSize(GLbyte *pc, Bool swap); +extern int __glXPrioritizeTexturesReqSize(GLbyte *pc, Bool swap); +extern int __glXTexSubImage1DReqSize(GLbyte *pc, Bool swap); +extern int __glXTexSubImage2DReqSize(GLbyte *pc, Bool swap); +extern int __glXTexImage3DReqSize(GLbyte *pc, Bool swap ); +extern int __glXTexSubImage3DReqSize(GLbyte *pc, Bool swap); +extern int __glXConvolutionFilter1DReqSize(GLbyte *pc, Bool swap); +extern int __glXConvolutionFilter2DReqSize(GLbyte *pc, Bool swap); +extern int __glXConvolutionParameterivReqSize(GLbyte *pc, Bool swap); +extern int __glXConvolutionParameterfvReqSize(GLbyte *pc, Bool swap); +extern int __glXSeparableFilter2DReqSize(GLbyte *pc, Bool swap); +extern int __glXColorTableReqSize(GLbyte *pc, Bool swap); +extern int __glXColorSubTableReqSize(GLbyte *pc, Bool swap); +extern int __glXColorTableParameterfvReqSize(GLbyte *pc, Bool swap); +extern int __glXColorTableParameterivReqSize(GLbyte *pc, Bool swap); + +/* + * Routines for computing the size of returned data. + */ +extern int __glXConvolutionParameterivSize(GLenum pname); +extern int __glXConvolutionParameterfvSize(GLenum pname); +extern int __glXColorTableParameterfvSize(GLenum pname); +extern int __glXColorTableParameterivSize(GLenum pname); + +extern void __glXFreeGLXWindow(__glXWindow *pGlxWindow); +extern void __glXFreeGLXPbuffer(__glXPbuffer *pGlxPbuffer); + +extern int __glXVersionMajor; +extern int __glXVersionMinor; + +#define __GLX_IS_VERSION_SUPPORTED(major,minor) \ + ( (__glXVersionMajor > (major)) || \ + ((__glXVersionMajor == (major)) && (__glXVersionMinor >= (minor))) ) + +#endif /* !__GLX_server_h__ */ diff --git a/xorg-server/hw/dmx/glxProxy/glxsingle.c b/xorg-server/hw/dmx/glxProxy/glxsingle.c new file mode 100644 index 000000000..27a27c335 --- /dev/null +++ b/xorg-server/hw/dmx/glxProxy/glxsingle.c @@ -0,0 +1,1012 @@ +/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. +*/ + +#ifdef HAVE_DMX_CONFIG_H +#include +#endif + +#include "dmx.h" +#include "dmxwindow.h" +#include "dmxpixmap.h" +#include "dmxfont.h" +#include "dmxcb.h" + +#undef Xmalloc +#undef Xcalloc +#undef Xrealloc +#undef Xfree + +#define NEED_REPLIES +#include "glxserver.h" +#include "glxext.h" +#include "g_disptab.h" +/* #include "g_disptab_EXT.h" */ +#include "unpack.h" +#include "glxutil.h" + +#include "GL/glxproto.h" + +#ifdef PANORAMIX +#include "panoramiXsrv.h" +#endif + +/* + * GetReqSingle - this is the equivalent of GetReq macro + * from Xlibint.h but it does not set the reqType field (the opcode). + * this is because the GL single opcodes has different naming convension + * the other X opcodes (ie. X_GLsop_GetFloatv). + */ +#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) +#define GetReqSingle(name, req) \ + WORD64ALIGN\ + if ((dpy->bufptr + SIZEOF(x##name##Req)) > dpy->bufmax)\ + _XFlush(dpy);\ + req = (x##name##Req *)(dpy->last_req = dpy->bufptr);\ + req->length = (SIZEOF(x##name##Req))>>2;\ + dpy->bufptr += SIZEOF(x##name##Req);\ + dpy->request++ + +#else /* non-ANSI C uses empty comment instead of "##" for token concatenation */ +#define GetReqSingle(name, req) \ + WORD64ALIGN\ + if ((dpy->bufptr + SIZEOF(x/**/name/**/Req)) > dpy->bufmax)\ + _XFlush(dpy);\ + req = (x/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\ + req->length = (SIZEOF(x/**/name/**/Req))>>2;\ + dpy->bufptr += SIZEOF(x/**/name/**/Req);\ + dpy->request++ +#endif + +#define X_GLXSingle 0 /* needed by GetReqExtra */ + +extern Display *GetBackEndDisplay( __GLXclientState *cl, int s ); +extern int GetCurrentBackEndTag(__GLXclientState *cl, GLXContextTag tag, int s); + +static int swap_vec_element_size = 0; + +static void SendSwappedReply( ClientPtr client, + xGLXSingleReply *reply, + char *buf, + int buf_size ) +{ + __GLX_DECLARE_SWAP_VARIABLES; + __GLX_SWAP_SHORT(&reply->sequenceNumber); + __GLX_SWAP_INT(&reply->length); + __GLX_SWAP_INT(&reply->retval); + __GLX_SWAP_INT(&reply->size); + + if ( (buf_size == 0) && (swap_vec_element_size > 0) ) { + /* + * the reply has single component - need to swap pad3 + */ + if (swap_vec_element_size == 2) { + __GLX_SWAP_SHORT(&reply->pad3); + } + else if (swap_vec_element_size == 4) { + __GLX_SWAP_INT(&reply->pad3); + __GLX_SWAP_INT(&reply->pad4); /* some requests use also pad4 + * i.e GetConvolutionFilter + */ + } + else if (swap_vec_element_size == 8) { + __GLX_SWAP_DOUBLE(&reply->pad3); + } + } + else if ( (buf_size > 0) && (swap_vec_element_size > 0) ) { + /* + * the reply has vector of elements which needs to be swapped + */ + int vsize = buf_size / swap_vec_element_size; + char *p = buf; + int i; + + for (i=0; ipad3); + __GLX_SWAP_INT(&reply->pad4); + __GLX_SWAP_INT(&reply->pad5); + __GLX_SWAP_INT(&reply->pad6); + + } + + WriteToClient(client, sizeof(xGLXSingleReply),(char *)reply); + if (buf_size > 0) + WriteToClient(client, buf_size, (char *)buf); + +} + +int __glXForwardSingleReq( __GLXclientState *cl, GLbyte *pc ) +{ + xGLXSingleReq *req = (xGLXSingleReq *)pc; + xGLXSingleReq *be_req; + __GLXcontext *glxc; + int from_screen = 0; + int to_screen = 0; + int buf_size; + int s; + + glxc = __glXLookupContextByTag(cl, req->contextTag); + if (!glxc) { + return 0; + } + from_screen = to_screen = glxc->pScreen->myNum; + +#ifdef PANORAMIX + if (!noPanoramiXExtension) { + from_screen = 0; + to_screen = screenInfo.numScreens - 1; + } +#endif + + pc += sz_xGLXSingleReq; + buf_size = (req->length << 2) - sz_xGLXSingleReq; + + /* + * just forward the request to back-end server(s) + */ + for (s=from_screen; s<=to_screen; s++) { + DMXScreenInfo *dmxScreen = &dmxScreens[s]; + Display *dpy = GetBackEndDisplay(cl,s); + + LockDisplay(dpy); + GetReqSingle(GLXSingle,be_req); + be_req->reqType = dmxScreen->glxMajorOpcode; + be_req->glxCode = req->glxCode; + be_req->length = req->length; + be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,s); + if (buf_size > 0) + _XSend(dpy, (const char *)pc, buf_size); + UnlockDisplay(dpy); + SyncHandle(); + + if (req->glxCode == X_GLsop_Flush) { + XFlush(dpy); + } + + } + + return Success; +} + +int __glXForwardPipe0WithReply( __GLXclientState *cl, GLbyte *pc ) +{ + ClientPtr client = cl->client; + xGLXSingleReq *req = (xGLXSingleReq *)pc; + xGLXSingleReq *be_req; + xGLXSingleReply reply; + xGLXSingleReply be_reply; + __GLXcontext *glxc; + int buf_size; + char *be_buf; + int be_buf_size; + DMXScreenInfo *dmxScreen; + Display *dpy; + + glxc = __glXLookupContextByTag(cl, req->contextTag); + if (!glxc) { + return __glXBadContext; + } + + pc += sz_xGLXSingleReq; + buf_size = (req->length << 2) - sz_xGLXSingleReq; + + dmxScreen = &dmxScreens[glxc->pScreen->myNum]; + dpy = GetBackEndDisplay(cl, glxc->pScreen->myNum); + + /* + * send the request to the first back-end server + */ + LockDisplay(dpy); + GetReqSingle(GLXSingle,be_req); + be_req->reqType = dmxScreen->glxMajorOpcode; + be_req->glxCode = req->glxCode; + be_req->length = req->length; + be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,glxc->pScreen->myNum); + if (buf_size > 0) + _XSend(dpy, (const char *)pc, buf_size); + + /* + * get the reply from the back-end server + */ + _XReply(dpy, (xReply*) &be_reply, 0, False); + be_buf_size = be_reply.length << 2; + if (be_buf_size > 0) { + be_buf = (char *)Xalloc( be_buf_size ); + if (be_buf) { + _XRead(dpy, be_buf, be_buf_size); + } + else { + /* Throw data on the floor */ + _XEatData(dpy, be_buf_size); + return BadAlloc; + } + } + + UnlockDisplay(dpy); + SyncHandle(); + + /* + * send the reply to the client + */ + reply.type = X_Reply; + reply.sequenceNumber = client->sequence; + reply.length = be_reply.length; + reply.retval = be_reply.retval; + reply.size = be_reply.size; + reply.pad3 = be_reply.pad3; + reply.pad4 = be_reply.pad4; + + if (client->swapped) { + SendSwappedReply( client, &reply, be_buf, be_buf_size ); + } + else { + WriteToClient(client, sizeof(xGLXSingleReply),(char *)&reply); + if (be_buf_size > 0) + WriteToClient(client, be_buf_size, (char *)be_buf); + } + + if (be_buf_size > 0) Xfree(be_buf); + + return Success; +} + +int __glXForwardAllWithReply( __GLXclientState *cl, GLbyte *pc ) +{ + ClientPtr client = cl->client; + xGLXSingleReq *req = (xGLXSingleReq *)pc; + xGLXSingleReq *be_req; + xGLXSingleReply reply; + xGLXSingleReply be_reply; + __GLXcontext *glxc; + int buf_size; + char *be_buf; + int be_buf_size; + int from_screen = 0; + int to_screen = 0; + int s; + + DMXScreenInfo *dmxScreen; + Display *dpy; + + glxc = __glXLookupContextByTag(cl, req->contextTag); + if (!glxc) { + return 0; + } + from_screen = to_screen = glxc->pScreen->myNum; + +#ifdef PANORAMIX + if (!noPanoramiXExtension) { + from_screen = 0; + to_screen = screenInfo.numScreens - 1; + } +#endif + + pc += sz_xGLXSingleReq; + buf_size = (req->length << 2) - sz_xGLXSingleReq; + + /* + * send the request to the first back-end server(s) + */ + for (s=to_screen; s>=from_screen; s--) { + dmxScreen = &dmxScreens[s]; + dpy = GetBackEndDisplay(cl,s); + + LockDisplay(dpy); + GetReqSingle(GLXSingle,be_req); + be_req->reqType = dmxScreen->glxMajorOpcode; + be_req->glxCode = req->glxCode; + be_req->length = req->length; + be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,s); + if (buf_size > 0) + _XSend(dpy, (const char *)pc, buf_size); + + /* + * get the reply from the back-end server + */ + _XReply(dpy, (xReply*) &be_reply, 0, False); + be_buf_size = be_reply.length << 2; + if (be_buf_size > 0) { + be_buf = (char *)Xalloc( be_buf_size ); + if (be_buf) { + _XRead(dpy, be_buf, be_buf_size); + } + else { + /* Throw data on the floor */ + _XEatData(dpy, be_buf_size); + return BadAlloc; + } + } + + UnlockDisplay(dpy); + SyncHandle(); + + if (s > from_screen && be_buf_size > 0) { + Xfree(be_buf); + } + } + + /* + * send the reply to the client + */ + reply.type = X_Reply; + reply.sequenceNumber = client->sequence; + reply.length = be_reply.length; + reply.retval = be_reply.retval; + reply.size = be_reply.size; + reply.pad3 = be_reply.pad3; + reply.pad4 = be_reply.pad4; + + if (client->swapped) { + SendSwappedReply( client, &reply, be_buf, be_buf_size ); + } + else { + WriteToClient(client, sizeof(xGLXSingleReply),(char *)&reply); + if (be_buf_size > 0) + WriteToClient(client, be_buf_size, (char *)be_buf); + } + + if (be_buf_size > 0) Xfree(be_buf); + + return Success; +} + +int __glXForwardSingleReqSwap( __GLXclientState *cl, GLbyte *pc ) +{ + xGLXSingleReq *req = (xGLXSingleReq *)pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->contextTag); + + swap_vec_element_size = 0; + + /* + * swap extra data in request - assuming all data + * (if available) are arrays of 4 bytes components ! + */ + if (req->length > sz_xGLXSingleReq/4) { + int *data = (int *)(req+1); + int count = req->length - sz_xGLXSingleReq/4; + __GLX_SWAP_INT_ARRAY(data, count ); + } + + return( __glXForwardSingleReq( cl, pc ) ); +} + +int __glXForwardPipe0WithReplySwap( __GLXclientState *cl, GLbyte *pc ) +{ + xGLXSingleReq *req = (xGLXSingleReq *)pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->contextTag); + + swap_vec_element_size = 0; + + /* + * swap extra data in request - assuming all data + * (if available) are arrays of 4 bytes components ! + */ + if (req->length > sz_xGLXSingleReq/4) { + int *data = (int *)(req+1); + int count = req->length - sz_xGLXSingleReq/4; + __GLX_SWAP_INT_ARRAY(data, count ); + } + + return( __glXForwardPipe0WithReply( cl, pc ) ); +} + +int __glXForwardPipe0WithReplySwapsv( __GLXclientState *cl, GLbyte *pc ) +{ + xGLXSingleReq *req = (xGLXSingleReq *)pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->contextTag); + + swap_vec_element_size = 2; + + /* + * swap extra data in request - assuming all data + * (if available) are arrays of 4 bytes components ! + */ + if (req->length > sz_xGLXSingleReq/4) { + int *data = (int *)(req+1); + int count = req->length - sz_xGLXSingleReq/4; + __GLX_SWAP_INT_ARRAY(data, count ); + } + + + return( __glXForwardPipe0WithReply( cl, pc ) ); +} + +int __glXForwardPipe0WithReplySwapiv( __GLXclientState *cl, GLbyte *pc ) +{ + xGLXSingleReq *req = (xGLXSingleReq *)pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->contextTag); + + swap_vec_element_size = 4; + + /* + * swap extra data in request - assuming all data + * (if available) are arrays of 4 bytes components ! + */ + if (req->length > sz_xGLXSingleReq/4) { + int *data = (int *)(req+1); + int count = req->length - sz_xGLXSingleReq/4; + __GLX_SWAP_INT_ARRAY(data, count ); + } + + + return( __glXForwardPipe0WithReply( cl, pc ) ); +} + +int __glXForwardPipe0WithReplySwapdv( __GLXclientState *cl, GLbyte *pc ) +{ + xGLXSingleReq *req = (xGLXSingleReq *)pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->contextTag); + + swap_vec_element_size = 8; + + /* + * swap extra data in request - assuming all data + * (if available) are arrays of 4 bytes components ! + */ + if (req->length > sz_xGLXSingleReq/4) { + int *data = (int *)(req+1); + int count = req->length - sz_xGLXSingleReq/4; + __GLX_SWAP_INT_ARRAY(data, count ); + } + + + return( __glXForwardPipe0WithReply( cl, pc ) ); +} + +int __glXForwardAllWithReplySwap( __GLXclientState *cl, GLbyte *pc ) +{ + xGLXSingleReq *req = (xGLXSingleReq *)pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->contextTag); + + swap_vec_element_size = 0; + + /* + * swap extra data in request - assuming all data + * (if available) are arrays of 4 bytes components ! + */ + if (req->length > sz_xGLXSingleReq/4) { + int *data = (int *)(req+1); + int count = req->length - sz_xGLXSingleReq/4; + __GLX_SWAP_INT_ARRAY(data, count ); + } + + + return( __glXForwardAllWithReply( cl, pc ) ); +} + +int __glXForwardAllWithReplySwapsv( __GLXclientState *cl, GLbyte *pc ) +{ + xGLXSingleReq *req = (xGLXSingleReq *)pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->contextTag); + + swap_vec_element_size = 2; + + /* + * swap extra data in request - assuming all data + * (if available) are arrays of 4 bytes components ! + */ + if (req->length > sz_xGLXSingleReq/4) { + int *data = (int *)(req+1); + int count = req->length - sz_xGLXSingleReq/4; + __GLX_SWAP_INT_ARRAY(data, count ); + } + + + return( __glXForwardAllWithReply( cl, pc ) ); +} + +int __glXForwardAllWithReplySwapiv( __GLXclientState *cl, GLbyte *pc ) +{ + xGLXSingleReq *req = (xGLXSingleReq *)pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->contextTag); + + swap_vec_element_size = 4; + + /* + * swap extra data in request - assuming all data + * (if available) are arrays of 4 bytes components ! + */ + if (req->length > sz_xGLXSingleReq/4) { + int *data = (int *)(req+1); + int count = req->length - sz_xGLXSingleReq/4; + __GLX_SWAP_INT_ARRAY(data, count ); + } + + + return( __glXForwardAllWithReply( cl, pc ) ); +} + +int __glXForwardAllWithReplySwapdv( __GLXclientState *cl, GLbyte *pc ) +{ + xGLXSingleReq *req = (xGLXSingleReq *)pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->contextTag); + + swap_vec_element_size = 8; + + /* + * swap extra data in request - assuming all data + * (if available) are arrays of 4 bytes components ! + */ + if (req->length > sz_xGLXSingleReq/4) { + int *data = (int *)(req+1); + int count = req->length - sz_xGLXSingleReq/4; + __GLX_SWAP_INT_ARRAY(data, count ); + } + + + return( __glXForwardAllWithReply( cl, pc ) ); +} + +static GLint __glReadPixels_size(GLenum format, GLenum type, GLint w, GLint h, + int *elementbits_return, int *rowbytes_return ) +{ + GLint elements, esize; + GLint rowsize, padding; + + if (w < 0 || h < 0) { + return -1; + } + switch (format) { + case GL_COLOR_INDEX: + case GL_STENCIL_INDEX: + case GL_DEPTH_COMPONENT: + elements = 1; + break; + case GL_RED: + case GL_GREEN: + case GL_BLUE: + case GL_ALPHA: + case GL_LUMINANCE: + elements = 1; + break; + case GL_LUMINANCE_ALPHA: + elements = 2; + break; + case GL_RGB: + case GL_BGR: + elements = 3; + break; + case GL_RGBA: + case GL_BGRA: + case GL_ABGR_EXT: + elements = 4; + break; + default: + return -1; + } + /* + ** According to the GLX protocol, each row must be padded to a multiple of + ** 4 bytes. 4 bytes also happens to be the default alignment in the pixel + ** store modes of the GL. + */ + switch (type) { + case GL_BITMAP: + if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX) { + rowsize = ((w * elements)+7)/8; + padding = rowsize % 4; + if (padding) { + rowsize += 4 - padding; + } + if (elementbits_return) *elementbits_return = elements; + if (rowbytes_return) *rowbytes_return = rowsize; + return (rowsize * h); + } else { + return -1; + } + case GL_BYTE: + case GL_UNSIGNED_BYTE: + esize = 1; + break; + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + esize = 1; + elements = 1; + break; + case GL_SHORT: + case GL_UNSIGNED_SHORT: + esize = 2; + break; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + esize = 2; + elements = 1; + break; + case GL_INT: + case GL_UNSIGNED_INT: + case GL_FLOAT: + esize = 4; + break; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + esize = 4; + elements = 1; + break; + default: + return -1; + } + rowsize = w * elements * esize; + padding = rowsize % 4; + if (padding) { + rowsize += 4 - padding; + } + + if (elementbits_return) *elementbits_return = esize*elements*8; + if (rowbytes_return) *rowbytes_return = rowsize; + + return (rowsize * h); +} + +static int intersectRect( int x1, int x2, int y1, int y2, + int X1, int X2, int Y1, int Y2, + int *ix1, int *ix2, int *iy1, int *iy2 ) +{ + int right = (x2 < X2 ? x2 : X2); + int bottom = (y2 < Y2 ? y2 : Y2); + int left = (x1 > X1 ? x1 : X1); + int top = (y1 > Y1 ? y1 : Y1); + int width = right - left + 1; + int height = bottom - top + 1; + + if ( (width <= 0) || (height <= 0) ) { + *ix1 = *ix2 = *iy1 = *iy2 = 0; + return(0); + } + else { + *ix1 = left; + *ix2 = right; + *iy1 = top; + *iy2 = bottom; + return( width * height ); + } + +} + +int __glXDisp_ReadPixels(__GLXclientState *cl, GLbyte *pc) +{ + xGLXSingleReq *req = (xGLXSingleReq *)pc; + xGLXSingleReq *be_req; + xGLXReadPixelsReply reply; + xGLXReadPixelsReply be_reply; + GLbyte *be_pc; + GLint x,y; + GLsizei width, height; + GLenum format, type; + GLboolean swapBytes, lsbFirst; + ClientPtr client = cl->client; + DrawablePtr pDraw; + int error; + __GLXcontext *glxc; + int from_screen = 0; + int to_screen = 0; + char *buf; + int buf_size; + int s; + int win_x1, win_x2; + int win_y1, win_y2; + int ebits, rowsize; + __GLX_DECLARE_SWAP_VARIABLES; + + if (client->swapped) { + __GLX_SWAP_INT(&req->contextTag); + } + + glxc = __glXLookupContextByTag(cl, req->contextTag); + if (!glxc) { + return 0; + } + from_screen = to_screen = glxc->pScreen->myNum; + +#ifdef PANORAMIX + if (!noPanoramiXExtension) { + from_screen = 0; + to_screen = screenInfo.numScreens - 1; + } +#endif + + pc += sz_xGLXSingleReq; + x = *(GLint *)(pc + 0); + y = *(GLint *)(pc + 4); + width = *(GLsizei *)(pc + 8); + height = *(GLsizei *)(pc + 12); + format = *(GLenum *)(pc + 16); + type = *(GLenum *)(pc + 20); + swapBytes = *(GLboolean *)(pc + 24); + lsbFirst = *(GLboolean *)(pc + 25); + + if (client->swapped) { + __GLX_SWAP_INT(&x); + __GLX_SWAP_INT(&y); + __GLX_SWAP_INT(&width); + __GLX_SWAP_INT(&height); + __GLX_SWAP_INT(&format); + __GLX_SWAP_INT(&type); + swapBytes = !swapBytes; + } + + buf_size = __glReadPixels_size(format,type,width,height, &ebits, &rowsize); + if (buf_size > 0) { + buf = (char *) Xalloc( buf_size ); + if ( !buf ) { + return( BadAlloc ); + } + } + else { + buf_size = 0; + } + + if (buf_size > 0) { + /* + * Get the current drawable this context is bound to + */ + pDraw = __glXLookupDrawableByTag( cl, req->contextTag ); + win_x1 = pDraw->x + x; + win_x2 = win_x1 + width - 1; + win_y1 = (dmxGlobalHeight - pDraw->y - pDraw->height) + y; + win_y2 = win_y1 + height - 1; + if (pDraw->type != DRAWABLE_WINDOW) { + from_screen = to_screen = 0; + } + + for (s=from_screen; s<=to_screen; s++) { + DMXScreenInfo *dmxScreen = &dmxScreens[s]; + Display *dpy = GetBackEndDisplay(cl,s); + int scr_x1 = dmxScreen->rootXOrigin; + int scr_x2 = dmxScreen->rootXOrigin + dmxScreen->scrnWidth - 1; + int scr_y1 = dmxScreen->rootYOrigin; + int scr_y2 = dmxScreen->rootYOrigin + dmxScreen->scrnHeight - 1; + int wx1, wx2, wy1, wy2; + int sx, sy, sw, sh; + int npixels; + + /* + * find the window portion that is on the current screen + */ + if (pDraw->type == DRAWABLE_WINDOW) { + npixels = intersectRect( scr_x1, scr_x2, scr_y1, scr_y2, + win_x1, win_x2, win_y1, win_y2, + &wx1, &wx2, &wy1, &wy2 ); + } + else { + wx1 = win_x1; + wx2 = win_x2; + wy1 = win_y1; + wy2 = win_y2; + npixels = (wx2-wx1+1) * (wy2-wy1+1); + } + + if (npixels > 0) { + + /* send the request to the back-end server */ + LockDisplay(dpy); + GetReqExtra(GLXSingle,__GLX_PAD(26),be_req); + be_req->reqType = dmxScreen->glxMajorOpcode; + be_req->glxCode = X_GLsop_ReadPixels; + be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,s); + be_pc = ((GLbyte *)(be_req) + sz_xGLXSingleReq); + + sx = wx1 - pDraw->x; + sy = wy1 - (dmxGlobalHeight - pDraw->y - pDraw->height); + sw = (wx2-wx1+1); + sh = (wy2-wy1+1); + + *(GLint *)(be_pc + 0) = sx; /* x */ + *(GLint *)(be_pc + 4) = sy; /* y */ + *(GLsizei *)(be_pc + 8) = sw; /* width */ + *(GLsizei *)(be_pc + 12) = sh; /* height */ + *(GLenum *)(be_pc + 16) = format; + *(GLenum *)(be_pc + 20) = type; + *(GLboolean *)(be_pc + 24) = swapBytes; + *(GLboolean *)(be_pc + 25) = lsbFirst; + + _XReply(dpy, (xReply*) &be_reply, 0, False); + + if (be_reply.length > 0) { + char *be_buf; + int be_buf_size = be_reply.length << 2; + + be_buf = (char *) Xalloc( be_buf_size ); + if (be_buf) { + _XRead(dpy, be_buf, be_buf_size); + + /* copy pixels data to the right location of the */ + /* reply buffer */ + if ( type != GL_BITMAP ) { + int pbytes = ebits / 8; + char *dst = buf + (sy-y)*rowsize + (sx-x)*pbytes; + char *src = be_buf; + int pad = (pbytes * sw) % 4; + int r; + + for (r=0; r> (sx % 8); + unsigned char src_mask = 0x80; + char *dst = buf + (sy-y+r)*rowsize + (sx-x)/8; + char *src = be_buf + r*src_rowsize; + int b; + + for (b=0; b 1) dst_mask >>= 1; + else { + dst_mask = 0x80; + dst++; + } + + if (src_mask > 1) src_mask >>= 1; + else { + src_mask = 0x80; + src++; + } + } + } + + } + + Xfree( be_buf ); + } + else { + /* Throw data on the floor */ + _XEatData(dpy, be_buf_size); + Xfree( buf ); + return BadAlloc; + } + } + + UnlockDisplay(dpy); + SyncHandle(); + + } /* of npixels > 0 */ + + } /* of for loop */ + + } /* of if buf_size > 0 */ + + reply.type = X_Reply; + reply.sequenceNumber = client->sequence; + reply.length = buf_size >> 2; + + if (client->swapped) { + __GLX_SWAP_SHORT(&reply.sequenceNumber); + __GLX_SWAP_INT(&reply.length); + } + + WriteToClient(client, sizeof(xGLXReadPixelsReply),(char *)&reply); + if (buf_size > 0) { + WriteToClient(client, buf_size, (char *)buf); + Xfree( buf ); + } + + return Success; +} + +int __glXDispSwap_GetTexImage(__GLXclientState *cl, GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + GLbyte *lpc = pc; + + lpc += sz_xGLXSingleReq; + __GLX_SWAP_INT(lpc+0); + __GLX_SWAP_INT(lpc+4); + __GLX_SWAP_INT(lpc+8); + __GLX_SWAP_INT(lpc+12); + + /* reverse swapBytes */ + *(GLboolean *)(lpc + 16) = ! *(GLboolean *)(lpc + 16); + + return( __glXForwardPipe0WithReplySwap( cl, pc ) ); +} + +int __glXDispSwap_GetColorTable(__GLXclientState *cl, GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + GLbyte *lpc = pc; + + lpc += sz_xGLXSingleReq; + __GLX_SWAP_INT(lpc+0); + __GLX_SWAP_INT(lpc+4); + __GLX_SWAP_INT(lpc+8); + + /* reverse swapBytes */ + *(GLboolean *)(lpc + 12) = ! *(GLboolean *)(lpc + 12); + + return( __glXForwardPipe0WithReplySwap( cl, pc ) ); +} + + diff --git a/xorg-server/hw/dmx/glxProxy/glxsingle.h b/xorg-server/hw/dmx/glxProxy/glxsingle.h new file mode 100644 index 000000000..a21d38f84 --- /dev/null +++ b/xorg-server/hw/dmx/glxProxy/glxsingle.h @@ -0,0 +1,59 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ + +#ifndef __GLXSINGLE_H +#define __GLXSINGLE_H + +extern int __glXForwardSingleReq( __GLXclientState *cl, GLbyte *pc ); +extern int __glXForwardPipe0WithReply( __GLXclientState *cl, GLbyte *pc ); +extern int __glXForwardAllWithReply( __GLXclientState *cl, GLbyte *pc ); + +extern int __glXForwardSingleReqSwap( __GLXclientState *cl, GLbyte *pc ); + +extern int __glXForwardPipe0WithReplySwap( __GLXclientState *cl, GLbyte *pc ); +extern int __glXForwardPipe0WithReplySwapsv( __GLXclientState *cl, GLbyte *pc ); +extern int __glXForwardPipe0WithReplySwapiv( __GLXclientState *cl, GLbyte *pc ); +extern int __glXForwardPipe0WithReplySwapdv( __GLXclientState *cl, GLbyte *pc ); + +extern int __glXForwardAllWithReplySwap( __GLXclientState *cl, GLbyte *pc ); +extern int __glXForwardAllWithReplySwapsv( __GLXclientState *cl, GLbyte *pc ); +extern int __glXForwardAllWithReplySwapiv( __GLXclientState *cl, GLbyte *pc ); +extern int __glXForwardAllWithReplySwapdv( __GLXclientState *cl, GLbyte *pc ); + +extern int __glXDisp_ReadPixels(__GLXclientState *cl, GLbyte *pc); +extern int __glXDispSwap_GetTexImage(__GLXclientState *cl, GLbyte *pc); +extern int __glXDispSwap_GetColorTable(__GLXclientState *cl, GLbyte *pc); + +#endif diff --git a/xorg-server/hw/dmx/glxProxy/glxswap.c b/xorg-server/hw/dmx/glxProxy/glxswap.c new file mode 100644 index 000000000..8fa04f877 --- /dev/null +++ b/xorg-server/hw/dmx/glxProxy/glxswap.c @@ -0,0 +1,538 @@ +/* + * Copyright 2003 Red Hat Inc., Raleigh, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Kevin E. Martin + * + */ + +#ifdef HAVE_DMX_CONFIG_H +#include +#endif + +#include "dmx.h" +#include "dmxwindow.h" +#include "glxserver.h" +#include "glxswap.h" + +extern int __glXDoSwapBuffers(__GLXclientState *cl, XID drawId, + GLXContextTag tag); + +typedef struct _SwapGroup *SwapGroupPtr; + +static Bool SwapBarrierIsReadyToSwap(GLuint barrier); +static void SwapSwapBarrier(GLuint barrier); +static void UpdateSwapBarrierList(GLuint barrier, + SwapGroupPtr pOldSwap, + SwapGroupPtr pNewSwap); + + +/************************************************************************ + * + * Swap Groups + * + ************************************************************************/ + +typedef struct _SwapGroup { + WindowPtr pWin; + SwapGroupPtr pNext; + + Bool swapping; + Bool sleeping; + GLuint barrier; + + XID drawable; + GLXContextTag tag; + __GLXclientState *clState; +} SwapGroupRec; + + +static void SwapSwapGroup(SwapGroupPtr pSwap) +{ + SwapGroupPtr pCur; + + /* All drawables in swap group are ready to swap, so just swap all + * drawables buffers and then wake up those clients that were + * previously sleeping */ + + for (pCur = pSwap; pCur; pCur = pCur->pNext) { + if (pCur->swapping) { + /* Swap pCur's buffers */ + __glXDoSwapBuffers(pCur->clState, pCur->drawable, pCur->tag); + pCur->swapping = FALSE; + } + + /* Wakeup client */ + if (pCur->sleeping) { + ClientWakeup(pCur->clState->client); + pCur->sleeping = FALSE; + } + } +} + +static Bool SwapGroupIsReadyToSwap(SwapGroupPtr pSwap) +{ + Bool isReady = TRUE; + + /* The swap group is ready to swap when all drawables are ready to + * swap. NOTE: A drawable is also ready to swap if it is not + * currently mapped */ + for (; pSwap; pSwap = pSwap->pNext) { + isReady &= (pSwap->swapping || !pSwap->pWin->mapped); + /* FIXME: Should we use pSwap->pWin->mapped or ...->realized ??? */ + } + + return isReady; +} + +static Bool SGSwapCleanup(ClientPtr client, pointer closure) +{ + /* SwapGroupPtr pSwap = (SwapGroupPtr)closure; */ + + /* This should not be called unless the client has died in which + * case we should remove the buffer from the swap list */ + + return TRUE; +} + +int SGSwapBuffers(__GLXclientState *cl, XID drawId, GLXContextTag tag, + DrawablePtr pDraw) +{ + WindowPtr pWin = (WindowPtr)pDraw; + dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWin); + SwapGroupPtr pSwap = pWinPriv->swapGroup; + SwapGroupPtr pCur; + + for (pCur = pSwap; pCur && pCur->pWin != pWin; pCur = pCur->pNext); + if (!pCur) + return BadDrawable; + + pCur->clState = cl; + pCur->drawable = drawId; + pCur->tag = tag; + + /* We are now in the process of swapping */ + pCur->swapping = TRUE; + + if (pSwap->barrier && SwapBarrierIsReadyToSwap(pSwap->barrier)) { + /* The swap group is bound to a barrier and the barrier is ready + * to swap, so swap all the swap groups that are bound to this + * group's swap barrier */ + SwapSwapBarrier(pSwap->barrier); + } else if (!pSwap->barrier && SwapGroupIsReadyToSwap(pSwap)) { + /* Do the swap if the entire swap group is ready to swap and the + * group is not bound to a swap barrier */ + SwapSwapGroup(pSwap); + } else { + /* The swap group/barrier is not yet ready to swap, so put + * client to sleep until the rest are ready to swap */ + ClientSleep(cl->client, SGSwapCleanup, (pointer)pWin); + pCur->sleeping = TRUE; + } + + return Success; +} + +static void SGWindowUnmapped(WindowPtr pWin) +{ + dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWin); + SwapGroupPtr pSwap = pWinPriv->swapGroup; + + /* Now that one of the windows in the swap group has been unmapped, + * see if the entire swap group/barrier is ready to swap */ + + if (pSwap->barrier && SwapBarrierIsReadyToSwap(pSwap->barrier)) { + SwapSwapBarrier(pSwap->barrier); + } else if (!pSwap->barrier && SwapGroupIsReadyToSwap(pSwap)) { + SwapSwapGroup(pSwap); + } +} + +static void SGWindowDestroyed(WindowPtr pWin) +{ + JoinSwapGroupSGIX((DrawablePtr)pWin, NULL); +} + +static SwapGroupPtr CreateSwapEntry(WindowPtr pWin) +{ + SwapGroupPtr pEntry; + + /* Allocate new swap group */ + pEntry = xalloc(sizeof(*pEntry)); + if (!pEntry) return NULL; + + /* Initialize swap group */ + pEntry->pWin = pWin; + pEntry->pNext = NULL; + pEntry->swapping = FALSE; + pEntry->sleeping = FALSE; + pEntry->barrier = 0; + /* The following are not initialized until SwapBuffers is called: + * pEntry->drawable + * pEntry->tag + * pEntry->clState + */ + + return pEntry; +} + +static void FreeSwapEntry(SwapGroupPtr pEntry) +{ + /* Since we have removed the drawable from its previous swap group + * and it won't be added to another swap group, the only thing that + * we need to do is to make sure that the drawable's client is not + * sleeping. This could happen if one thread is sleeping, while + * another thread called glxJoinSwapGroup(). Note that all sleeping + * threads should also be swapping, but there is a small window in + * the SGSwapBuffer() logic, above, where swapping can be set but + * sleeping is not. We check both independently here just to be + * pedantic. */ + + /* Handle swap buffer request */ + if (pEntry->swapping) + __glXDoSwapBuffers(pEntry->clState, pEntry->drawable, pEntry->tag); + + /* Wake up client */ + if (pEntry->sleeping) + ClientWakeup(pEntry->clState->client); + + /* We can free the pEntry entry since it has already been removed + * from the swap group list and it won't be needed any longer */ + xfree(pEntry); +} + +int JoinSwapGroupSGIX(DrawablePtr pDraw, DrawablePtr pMember) +{ + if (pDraw->type == DRAWABLE_WINDOW) { + WindowPtr pWin = (WindowPtr)pDraw; + dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWin); + SwapGroupPtr pOldSwap = NULL; + SwapGroupPtr pEntry; + + /* If pDraw and pMember are already members of the same swap + * group, just return Success since there is nothing to do */ + for (pEntry = pWinPriv->swapGroup; pEntry; pEntry = pEntry->pNext) + if (pEntry->pWin == (WindowPtr)pMember) + return Success; + + /* Remove pDraw from its current swap group */ + if (pWinPriv->swapGroup) { + SwapGroupPtr pSwapGroup = pWinPriv->swapGroup; + SwapGroupPtr pPrev; + + /* Find old swap entry in swap group and save in pOldSwap + * for later use */ + for (pOldSwap = pWinPriv->swapGroup, pPrev = NULL; + pOldSwap && pOldSwap->pWin != pWin; + pPrev = pOldSwap, pOldSwap = pOldSwap->pNext); + if (!pOldSwap) + return BadDrawable; + + /* Remove pDraw's swap group entry from swap group list */ + if (pPrev) { + pPrev->pNext = pOldSwap->pNext; + } else { + /* pWin is at the head of the swap group list, so we + * need to update all other members of this swap + * group */ + for (pEntry = pOldSwap->pNext; pEntry; pEntry = pEntry->pNext) + DMX_GET_WINDOW_PRIV(pEntry->pWin)->swapGroup + = pOldSwap->pNext; + + /* Update the barrier list as well */ + if (pOldSwap->barrier) + UpdateSwapBarrierList(pOldSwap->barrier, + pOldSwap, pOldSwap->pNext); + + /* Set pSwapGroup to point to the swap group without + * pOldSwap */ + pSwapGroup = pOldSwap->pNext; + } + + /* Check to see if current swap group can now swap since we + * know at this point that pDraw and pMember are guaranteed + * to previously be in different swap groups */ + if (pSwapGroup && SwapGroupIsReadyToSwap(pSwapGroup)) { + SwapSwapGroup(pSwapGroup); + } + + /* Make the old swap entry a standalone group */ + pOldSwap->pNext = NULL; + pOldSwap->barrier = 0; + + /* Reset pWin's swap group */ + pWinPriv->swapGroup = NULL; + pWinPriv->windowDestroyed = NULL; + pWinPriv->windowUnmapped = NULL; + } + + if (!pMember || pMember->type != DRAWABLE_WINDOW) { + /* Free old swap group since it is no longer needed */ + if (pOldSwap) FreeSwapEntry(pOldSwap); + } else if (pDraw == pMember && pOldSwap) { + /* Special case where pDraw was previously created and we + * are now just putting it to its own swap group */ + pWinPriv->swapGroup = pOldSwap; + pWinPriv->windowDestroyed = SGWindowDestroyed; + pWinPriv->windowUnmapped = SGWindowUnmapped; + + /* Check to see if pDraw is ready to swap */ + if (SwapGroupIsReadyToSwap(pOldSwap)) + SwapSwapGroup(pOldSwap); + } else if (pMember->type == DRAWABLE_WINDOW) { + WindowPtr pMemberWin = (WindowPtr)pMember; + dmxWinPrivPtr pMemberPriv = DMX_GET_WINDOW_PRIV(pMemberWin); + SwapGroupPtr pMemberSwapGroup = pMemberPriv->swapGroup; + + /* Finally, how we can add pDraw to pMember's swap group */ + + /* If pMember is not currently in a swap group, then create + * one for it since we are just about to add pDraw to it. */ + if (!pMemberSwapGroup) { + /* Create new swap group */ + pMemberSwapGroup = CreateSwapEntry(pMemberWin); + if (!pMemberSwapGroup) { + if (pOldSwap) FreeSwapEntry(pOldSwap); + return BadAlloc; + } + + /* Set pMember's swap group */ + pMemberPriv->swapGroup = pMemberSwapGroup; + pMemberPriv->windowDestroyed = SGWindowDestroyed; + pMemberPriv->windowUnmapped = SGWindowUnmapped; + } + + /* If pDraw == pMember, that means pDraw was not a member of + * a group previously (or it would have been handled by the + * special case above), so no additional work is required + * since we just created a new swap group for pMember (i.e., + * pDraw). */ + + if (pDraw != pMember) { + /* If pDraw was not previously in a swap group, then create + * an entry for it */ + if (!pOldSwap) { + /* Create new swap group */ + pOldSwap = CreateSwapEntry(pWin); + if (!pOldSwap) { + /* If we just created a swap group for pMember, we + * need to free it here */ + if (pMemberSwapGroup->pNext == NULL) { + FreeSwapEntry(pMemberSwapGroup); + pMemberPriv->swapGroup = NULL; + } + return BadAlloc; + } + } + + /* Find last entry in pMember's swap group */ + for (pEntry = pMemberSwapGroup; + pEntry->pNext; + pEntry = pEntry->pNext); + + /* Add pDraw's swap group entry to pMember's swap group list */ + pEntry->pNext = pOldSwap; + + /* Add pDraw to pMember's swap barrier */ + pOldSwap->barrier = pEntry->barrier; + + /* Set pDraw's swap group */ + pWinPriv->swapGroup = pMemberSwapGroup; + pWinPriv->windowDestroyed = SGWindowDestroyed; + pWinPriv->windowUnmapped = SGWindowUnmapped; + } + } + } + + return Success; +} + + +/************************************************************************ + * + * Swap Barriers + * + ************************************************************************/ + +#define GLX_MAX_SWAP_BARRIERS 10 + +typedef struct _SwapBarrier *SwapBarrierPtr; +typedef struct _SwapBarrier { + SwapGroupPtr pSwap; + SwapBarrierPtr pNext; +} SwapBarrierRec; + +static SwapBarrierPtr SwapBarrierList[GLX_MAX_SWAP_BARRIERS+1]; + +void SwapBarrierInit(void) +{ + int i; + + for (i = 0; i <= GLX_MAX_SWAP_BARRIERS; i++) + SwapBarrierList[i] = NULL; +} + +void SwapBarrierReset(void) +{ + int i; + + for (i = 0; i <= GLX_MAX_SWAP_BARRIERS; i++) { + SwapBarrierPtr pBarrier, pNextBarrier;; + for (pBarrier = SwapBarrierList[i]; + pBarrier; + pBarrier = pNextBarrier) { + pNextBarrier = pBarrier->pNext; + xfree(pBarrier); + } + SwapBarrierList[i] = NULL; + } +} + +int QueryMaxSwapBarriersSGIX(int screen) +{ + return GLX_MAX_SWAP_BARRIERS; +} + +static Bool BindSwapGroupToBarrier(GLuint barrier, SwapGroupPtr pSwapGroup) +{ + SwapBarrierPtr pBarrier; + + pBarrier = xalloc(sizeof(*pBarrier)); + if (!pBarrier) return FALSE; + + /* Add the swap group to barrier's list */ + pBarrier->pSwap = pSwapGroup; + pBarrier->pNext = SwapBarrierList[barrier]; + SwapBarrierList[barrier] = pBarrier; + + return TRUE; +} + +static Bool UnbindSwapGroupFromBarrier(GLuint barrier, SwapGroupPtr pSwapGroup) +{ + SwapBarrierPtr pBarrier, pPrevBarrier; + + /* Find the swap group in barrier's list */ + for (pBarrier = SwapBarrierList[barrier], pPrevBarrier = NULL; + pBarrier && pBarrier->pSwap != pSwapGroup; + pPrevBarrier = pBarrier, pBarrier = pBarrier->pNext); + if (!pBarrier) return FALSE; + + /* Remove the swap group from barrier's list */ + if (pPrevBarrier) pPrevBarrier->pNext = pBarrier->pNext; + else SwapBarrierList[barrier] = pBarrier->pNext; + + /* Free memory */ + xfree(pBarrier); + + return TRUE; +} + +static void UpdateSwapBarrierList(GLuint barrier, + SwapGroupPtr pOldSwap, + SwapGroupPtr pNewSwap) +{ + SwapBarrierPtr pBarrier; + + /* If the old swap group is being destroyed, then we need to remove + * the swap group from the list entirely */ + if (!pNewSwap) { + UnbindSwapGroupFromBarrier(barrier, pOldSwap); + return; + } + + /* Otherwise, find the old swap group in the barrier list and change + * it to the new swap group */ + for (pBarrier = SwapBarrierList[barrier]; + pBarrier; + pBarrier = pBarrier->pNext) { + if (pBarrier->pSwap == pOldSwap) { + pBarrier->pSwap = pNewSwap; + return; + } + } +} + +static Bool SwapBarrierIsReadyToSwap(GLuint barrier) +{ + SwapBarrierPtr pBarrier; + Bool isReady = TRUE; + + /* The swap barier is ready to swap when swap groups that are bound + * to barrier are ready to swap */ + for (pBarrier = SwapBarrierList[barrier]; + pBarrier; + pBarrier = pBarrier->pNext) + isReady &= SwapGroupIsReadyToSwap(pBarrier->pSwap); + + return isReady; +} + +static void SwapSwapBarrier(GLuint barrier) +{ + SwapBarrierPtr pBarrier; + + /* Swap each group that is a member of this barrier */ + for (pBarrier = SwapBarrierList[barrier]; + pBarrier; + pBarrier = pBarrier->pNext) + SwapSwapGroup(pBarrier->pSwap); +} + +int BindSwapBarrierSGIX(DrawablePtr pDraw, int barrier) +{ + /* FIXME: Check for errors when pDraw->type != DRAWABLE_WINDOW */ + + if (barrier < 0 || barrier > GLX_MAX_SWAP_BARRIERS) + return BadValue; + + if (pDraw->type == DRAWABLE_WINDOW) { + WindowPtr pWin = (WindowPtr)pDraw; + dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWin); + SwapGroupPtr pSwapGroup = pWinPriv->swapGroup; + SwapGroupPtr pCur; + + if (!pSwapGroup) return BadDrawable; + if (barrier && pSwapGroup->barrier) return BadValue; + + /* Update the swap barrier list */ + if (barrier) { + if (!BindSwapGroupToBarrier(barrier, pSwapGroup)) + return BadAlloc; + } else { + if (!UnbindSwapGroupFromBarrier(pSwapGroup->barrier, pSwapGroup)) + return BadDrawable; + } + + /* Set the barrier for each member of this swap group */ + for (pCur = pSwapGroup; pCur; pCur = pCur->pNext) + pCur->barrier = barrier; + } + + return Success; +} diff --git a/xorg-server/hw/dmx/glxProxy/glxswap.h b/xorg-server/hw/dmx/glxProxy/glxswap.h new file mode 100644 index 000000000..08e38df7b --- /dev/null +++ b/xorg-server/hw/dmx/glxProxy/glxswap.h @@ -0,0 +1,46 @@ +/* + * Copyright 2003 Red Hat Inc., Raleigh, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Kevin E. Martin + * + */ + +#ifndef __GLX_swap_h__ +#define __GLX_swap_h__ + +extern int JoinSwapGroupSGIX(DrawablePtr pDraw, DrawablePtr pMember); +extern int SGSwapBuffers(__GLXclientState *cl, XID drawId, GLXContextTag tag, + DrawablePtr pDraw); + +extern void SwapBarrierInit(void); +extern void SwapBarrierReset(void); +extern int QueryMaxSwapBarriersSGIX(int screen); +extern int BindSwapBarrierSGIX(DrawablePtr pDraw, int barrier); + +#endif /* !__GLX_swap_h__ */ diff --git a/xorg-server/hw/dmx/glxProxy/glxutil.c b/xorg-server/hw/dmx/glxProxy/glxutil.c new file mode 100644 index 000000000..f30b05fb1 --- /dev/null +++ b/xorg-server/hw/dmx/glxProxy/glxutil.c @@ -0,0 +1,119 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ + +#define NEED_REPLIES +#define FONT_PCF +#include "glxserver.h" +#include +#include +#include +#include "glxutil.h" + +/************************************************************************/ + +void __glXNop(void) {} + +/************************************************************************/ + +/* Memory Allocation for GLX */ + +void * +__glXMalloc(size_t size) +{ + void *addr; + + if (size == 0) { + return NULL; + } + addr = (void *) xalloc(size); + if (addr == NULL) { + /* XXX: handle out of memory error */ + return NULL; + } + return addr; +} + +void * +__glXCalloc(size_t numElements, size_t elementSize) +{ + void *addr; + size_t size; + + if ((numElements == 0) || (elementSize == 0)) { + return NULL; + } + size = numElements * elementSize; + addr = (void *) xalloc(size); + if (addr == NULL) { + /* XXX: handle out of memory error */ + return NULL; + } + memset(addr, 0, size); + return addr; +} + +void * +__glXRealloc(void *addr, size_t newSize) +{ + void *newAddr; + + if (addr) { + if (newSize == 0) { + xfree(addr); + return NULL; + } else { + newAddr = xrealloc(addr, newSize); + } + } else { + if (newSize == 0) { + return NULL; + } else { + newAddr = xalloc(newSize); + } + } + if (newAddr == NULL) { + return NULL; /* XXX: out of memory */ + } + + return newAddr; +} + +void +__glXFree(void *addr) +{ + if (addr) { + xfree(addr); + } +} diff --git a/xorg-server/hw/dmx/glxProxy/glxutil.h b/xorg-server/hw/dmx/glxProxy/glxutil.h new file mode 100644 index 000000000..94ca7da95 --- /dev/null +++ b/xorg-server/hw/dmx/glxProxy/glxutil.h @@ -0,0 +1,53 @@ +#ifndef _glxcmds_h_ +#define _glxcmds_h_ + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ + +extern void __glXNop(void); + +/* memory management */ +extern void *__glXMalloc(size_t size); +extern void *__glXCalloc(size_t numElements, size_t elementSize); +extern void *__glXRealloc(void *addr, size_t newSize); +extern void __glXFree(void *ptr); + +/* context helper routines */ +extern __GLXcontext *__glXLookupContextByTag(__GLXclientState*, GLXContextTag); +extern DrawablePtr __glXLookupDrawableByTag(__GLXclientState *cl, GLXContextTag tag); + + +#endif /* _glxcmds_h_ */ + diff --git a/xorg-server/hw/dmx/glxProxy/glxvendor.c b/xorg-server/hw/dmx/glxProxy/glxvendor.c new file mode 100644 index 000000000..e55f80252 --- /dev/null +++ b/xorg-server/hw/dmx/glxProxy/glxvendor.c @@ -0,0 +1,582 @@ +/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. +*/ + +#ifdef HAVE_DMX_CONFIG_H +#include +#endif + +#include "dmx.h" +#include "dmxwindow.h" +#include "dmxpixmap.h" +#include "dmxfont.h" + +#undef Xmalloc +#undef Xcalloc +#undef Xrealloc +#undef Xfree + +#define NEED_REPLIES +#include "glxserver.h" +#include "glxext.h" +#include "g_disptab.h" +/* #include "g_disptab_EXT.h" */ +#include "unpack.h" +#include "glxutil.h" + +#include "GL/glxproto.h" + +#ifdef PANORAMIX +#include "panoramiXsrv.h" +#endif + +/* + * GetReqVendorPrivate - this is the equivalent of GetReq macro + * from Xlibint.h but it does not set the reqType field (the opcode). + * this is because the GL single opcodes has different naming convension + * the other X opcodes (ie. X_GLsop_GetFloatv). + */ +#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) +#define GetReqVendorPrivate(name, req) \ + WORD64ALIGN\ + if ((dpy->bufptr + SIZEOF(x##name##Req)) > dpy->bufmax)\ + _XFlush(dpy);\ + req = (x##name##Req *)(dpy->last_req = dpy->bufptr);\ + req->length = (SIZEOF(x##name##Req))>>2;\ + dpy->bufptr += SIZEOF(x##name##Req);\ + dpy->request++ + +#else /* non-ANSI C uses empty comment instead of "##" for token concatenation */ +#define GetReqVendorPrivate(name, req) \ + WORD64ALIGN\ + if ((dpy->bufptr + SIZEOF(x/**/name/**/Req)) > dpy->bufmax)\ + _XFlush(dpy);\ + req = (x/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\ + req->length = (SIZEOF(x/**/name/**/Req))>>2;\ + dpy->bufptr += SIZEOF(x/**/name/**/Req);\ + dpy->request++ +#endif + +extern Display *GetBackEndDisplay( __GLXclientState *cl, int s ); +extern int GetCurrentBackEndTag(__GLXclientState *cl, GLXContextTag tag, int s); + +static int swap_vec_element_size = 0; + +static void SendSwappedReply( ClientPtr client, + xGLXVendorPrivReply *reply, + char *buf, + int buf_size ) +{ + __GLX_DECLARE_SWAP_VARIABLES; + __GLX_SWAP_SHORT(&reply->sequenceNumber); + __GLX_SWAP_INT(&reply->length); + __GLX_SWAP_INT(&reply->retval); + __GLX_SWAP_INT(&reply->size); + + if ( (buf_size == 0) && (swap_vec_element_size > 0) ) { + /* + * the reply has single component - need to swap pad3 + */ + if (swap_vec_element_size == 2) { + __GLX_SWAP_SHORT(&reply->pad3); + } + else if (swap_vec_element_size == 4) { + __GLX_SWAP_INT(&reply->pad3); + __GLX_SWAP_INT(&reply->pad4); + } + else if (swap_vec_element_size == 8) { + __GLX_SWAP_DOUBLE(&reply->pad3); + } + } + else if ( (buf_size > 0) && (swap_vec_element_size > 0) ) { + /* + * the reply has vector of elements which needs to be swapped + */ + int vsize = buf_size / swap_vec_element_size; + char *p = buf; + int i; + + for (i=0; ipad3); + __GLX_SWAP_INT(&reply->pad4); + __GLX_SWAP_INT(&reply->pad5); + __GLX_SWAP_INT(&reply->pad6); + + } + + WriteToClient(client, sizeof(xGLXVendorPrivReply),(char *)reply); + if (buf_size > 0) + WriteToClient(client, buf_size, (char *)buf); + +} + +int __glXVForwardSingleReq( __GLXclientState *cl, GLbyte *pc ) +{ + xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc; + xGLXVendorPrivateReq *be_req; + __GLXcontext *glxc; + int from_screen = 0; + int to_screen = 0; + int buf_size; + int s; + + glxc = __glXLookupContextByTag(cl, req->contextTag); + if (!glxc) { + return 0; + } + from_screen = to_screen = glxc->pScreen->myNum; + +#ifdef PANORAMIX + if (!noPanoramiXExtension) { + from_screen = 0; + to_screen = screenInfo.numScreens - 1; + } +#endif + + pc += sz_xGLXVendorPrivateReq; + buf_size = (req->length << 2) - sz_xGLXVendorPrivateReq; + + /* + * just forward the request to back-end server(s) + */ + for (s=from_screen; s<=to_screen; s++) { + DMXScreenInfo *dmxScreen = &dmxScreens[s]; + Display *dpy = GetBackEndDisplay(cl,s); + + LockDisplay(dpy); + GetReqVendorPrivate(GLXVendorPrivate,be_req); + be_req->reqType = dmxScreen->glxMajorOpcode; + be_req->glxCode = req->glxCode; + be_req->length = req->length; + be_req->vendorCode = req->vendorCode; + be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,s); + if (buf_size > 0) + _XSend(dpy, (const char *)pc, buf_size); + UnlockDisplay(dpy); + SyncHandle(); + } + + return Success; +} + +int __glXVForwardPipe0WithReply( __GLXclientState *cl, GLbyte *pc ) +{ + ClientPtr client = cl->client; + xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc; + xGLXVendorPrivateReq *be_req; + xGLXVendorPrivReply reply; + xGLXVendorPrivReply be_reply; + __GLXcontext *glxc; + int buf_size; + char *be_buf; + int be_buf_size; + DMXScreenInfo *dmxScreen; + Display *dpy; + + glxc = __glXLookupContextByTag(cl, req->contextTag); + if (!glxc) { + return __glXBadContext; + } + + pc += sz_xGLXVendorPrivateReq; + buf_size = (req->length << 2) - sz_xGLXVendorPrivateReq; + + dmxScreen = &dmxScreens[glxc->pScreen->myNum]; + dpy = GetBackEndDisplay(cl, glxc->pScreen->myNum); + + /* + * send the request to the first back-end server + */ + LockDisplay(dpy); + GetReqVendorPrivate(GLXVendorPrivate,be_req); + be_req->reqType = dmxScreen->glxMajorOpcode; + be_req->glxCode = req->glxCode; + be_req->length = req->length; + be_req->vendorCode = req->vendorCode; + be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag, glxc->pScreen->myNum); + if (buf_size > 0) + _XSend(dpy, (const char *)pc, buf_size); + + /* + * get the reply from the back-end server + */ + _XReply(dpy, (xReply*) &be_reply, 0, False); + be_buf_size = be_reply.length << 2; + if (be_buf_size > 0) { + be_buf = (char *)Xalloc( be_buf_size ); + if (be_buf) { + _XRead(dpy, be_buf, be_buf_size); + } + else { + /* Throw data on the floor */ + _XEatData(dpy, be_buf_size); + return BadAlloc; + } + } + + UnlockDisplay(dpy); + SyncHandle(); + + /* + * send the reply to the client + */ + memcpy( &reply, &be_reply, sz_xGLXVendorPrivReply ); + reply.type = X_Reply; + reply.sequenceNumber = client->sequence; + + if (client->swapped) { + SendSwappedReply( client, &reply, be_buf, be_buf_size ); + } + else { + WriteToClient(client, sizeof(xGLXVendorPrivReply),(char *)&reply); + if (be_buf_size > 0) + WriteToClient(client, be_buf_size, (char *)be_buf); + } + + if (be_buf_size > 0) Xfree(be_buf); + + return Success; +} + +int __glXVForwardAllWithReply( __GLXclientState *cl, GLbyte *pc ) +{ + ClientPtr client = cl->client; + xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc; + xGLXVendorPrivateReq *be_req; + xGLXVendorPrivReply reply; + xGLXVendorPrivReply be_reply; + __GLXcontext *glxc; + int buf_size; + char *be_buf; + int be_buf_size; + int from_screen = 0; + int to_screen = 0; + int s; + + DMXScreenInfo *dmxScreen; + Display *dpy; + + glxc = __glXLookupContextByTag(cl, req->contextTag); + if (!glxc) { + return 0; + } + from_screen = to_screen = glxc->pScreen->myNum; + +#ifdef PANORAMIX + if (!noPanoramiXExtension) { + from_screen = 0; + to_screen = screenInfo.numScreens - 1; + } +#endif + + pc += sz_xGLXVendorPrivateReq; + buf_size = (req->length << 2) - sz_xGLXVendorPrivateReq; + + /* + * send the request to the first back-end server(s) + */ + for (s=to_screen; s>=from_screen; s--) { + dmxScreen = &dmxScreens[s]; + dpy = GetBackEndDisplay(cl,s); + + LockDisplay(dpy); + GetReqVendorPrivate(GLXVendorPrivate,be_req); + be_req->reqType = dmxScreen->glxMajorOpcode; + be_req->glxCode = req->glxCode; + be_req->length = req->length; + be_req->vendorCode = req->vendorCode; + be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,s); + if (buf_size > 0) + _XSend(dpy, (const char *)pc, buf_size); + + /* + * get the reply from the back-end server + */ + _XReply(dpy, (xReply*) &be_reply, 0, False); + be_buf_size = be_reply.length << 2; + if (be_buf_size > 0) { + be_buf = (char *)Xalloc( be_buf_size ); + if (be_buf) { + _XRead(dpy, be_buf, be_buf_size); + } + else { + /* Throw data on the floor */ + _XEatData(dpy, be_buf_size); + return BadAlloc; + } + } + + UnlockDisplay(dpy); + SyncHandle(); + + if (s > from_screen && be_buf_size > 0) { + Xfree(be_buf); + } + } + + /* + * send the reply to the client + */ + memcpy( &reply, &be_reply, sz_xGLXVendorPrivReply ); + reply.type = X_Reply; + reply.sequenceNumber = client->sequence; + + if (client->swapped) { + SendSwappedReply( client, &reply, be_buf, be_buf_size ); + } + else { + WriteToClient(client, sizeof(xGLXVendorPrivReply),(char *)&reply); + if (be_buf_size > 0) + WriteToClient(client, be_buf_size, (char *)be_buf); + } + + if (be_buf_size > 0) Xfree(be_buf); + + return Success; +} + +int __glXVForwardSingleReqSwap( __GLXclientState *cl, GLbyte *pc ) +{ + xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->vendorCode); + __GLX_SWAP_INT(&req->contextTag); + + swap_vec_element_size = 0; + + return( __glXVForwardSingleReq( cl, pc ) ); +} + +int __glXVForwardPipe0WithReplySwap( __GLXclientState *cl, GLbyte *pc ) +{ + xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->vendorCode); + __GLX_SWAP_INT(&req->contextTag); + + swap_vec_element_size = 0; + + /* + * swap extra data in request - assuming all data + * (if available) are arrays of 4 bytes components ! + */ + if (req->length > sz_xGLXVendorPrivateReq/4) { + int *data = (int *)(req+1); + int count = req->length - sz_xGLXVendorPrivateReq/4; + __GLX_SWAP_INT_ARRAY(data, count ); + } + + return( __glXVForwardPipe0WithReply( cl, pc ) ); +} + +int __glXVForwardPipe0WithReplySwapsv( __GLXclientState *cl, GLbyte *pc ) +{ + xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->vendorCode); + __GLX_SWAP_INT(&req->contextTag); + + swap_vec_element_size = 2; + + /* + * swap extra data in request - assuming all data + * (if available) are arrays of 4 bytes components ! + */ + if (req->length > sz_xGLXVendorPrivateReq/4) { + int *data = (int *)(req+1); + int count = req->length - sz_xGLXVendorPrivateReq/4; + __GLX_SWAP_INT_ARRAY(data, count ); + } + + return( __glXVForwardPipe0WithReply( cl, pc ) ); +} + +int __glXVForwardPipe0WithReplySwapiv( __GLXclientState *cl, GLbyte *pc ) +{ + xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->vendorCode); + __GLX_SWAP_INT(&req->contextTag); + + swap_vec_element_size = 4; + + /* + * swap extra data in request - assuming all data + * (if available) are arrays of 4 bytes components ! + */ + if (req->length > sz_xGLXVendorPrivateReq/4) { + int *data = (int *)(req+1); + int count = req->length - sz_xGLXVendorPrivateReq/4; + __GLX_SWAP_INT_ARRAY(data, count ); + } + + return( __glXVForwardPipe0WithReply( cl, pc ) ); +} + +int __glXVForwardPipe0WithReplySwapdv( __GLXclientState *cl, GLbyte *pc ) +{ + xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->vendorCode); + __GLX_SWAP_INT(&req->contextTag); + + swap_vec_element_size = 8; + + /* + * swap extra data in request - assuming all data + * (if available) are arrays of 4 bytes components ! + */ + if (req->length > sz_xGLXVendorPrivateReq/4) { + int *data = (int *)(req+1); + int count = req->length - sz_xGLXVendorPrivateReq/4; + __GLX_SWAP_INT_ARRAY(data, count ); + } + + return( __glXVForwardPipe0WithReply( cl, pc ) ); +} + +int __glXVForwardAllWithReplySwap( __GLXclientState *cl, GLbyte *pc ) +{ + xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->vendorCode); + __GLX_SWAP_INT(&req->contextTag); + + swap_vec_element_size = 0; + + /* + * swap extra data in request - assuming all data + * (if available) are arrays of 4 bytes components ! + */ + if (req->length > sz_xGLXVendorPrivateReq/4) { + int *data = (int *)(req+1); + int count = req->length - sz_xGLXVendorPrivateReq/4; + __GLX_SWAP_INT_ARRAY(data, count ); + } + + return( __glXVForwardAllWithReply( cl, pc ) ); +} + +int __glXVForwardAllWithReplySwapsv( __GLXclientState *cl, GLbyte *pc ) +{ + xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->vendorCode); + __GLX_SWAP_INT(&req->contextTag); + + swap_vec_element_size = 2; + + /* + * swap extra data in request - assuming all data + * (if available) are arrays of 4 bytes components ! + */ + if (req->length > sz_xGLXVendorPrivateReq/4) { + int *data = (int *)(req+1); + int count = req->length - sz_xGLXVendorPrivateReq/4; + __GLX_SWAP_INT_ARRAY(data, count ); + } + + return( __glXVForwardAllWithReply( cl, pc ) ); +} + +int __glXVForwardAllWithReplySwapiv( __GLXclientState *cl, GLbyte *pc ) +{ + xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->vendorCode); + __GLX_SWAP_INT(&req->contextTag); + + swap_vec_element_size = 4; + + /* + * swap extra data in request - assuming all data + * (if available) are arrays of 4 bytes components ! + */ + if (req->length > sz_xGLXVendorPrivateReq/4) { + int *data = (int *)(req+1); + int count = req->length - sz_xGLXVendorPrivateReq/4; + __GLX_SWAP_INT_ARRAY(data, count ); + } + + return( __glXVForwardAllWithReply( cl, pc ) ); +} + +int __glXVForwardAllWithReplySwapdv( __GLXclientState *cl, GLbyte *pc ) +{ + xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->vendorCode); + __GLX_SWAP_INT(&req->contextTag); + + swap_vec_element_size = 8; + + /* + * swap extra data in request - assuming all data + * (if available) are arrays of 4 bytes components ! + */ + if (req->length > sz_xGLXVendorPrivateReq/4) { + int *data = (int *)(req+1); + int count = req->length - sz_xGLXVendorPrivateReq/4; + __GLX_SWAP_INT_ARRAY(data, count ); + } + + return( __glXVForwardAllWithReply( cl, pc ) ); +} + diff --git a/xorg-server/hw/dmx/glxProxy/glxvendor.h b/xorg-server/hw/dmx/glxProxy/glxvendor.h new file mode 100644 index 000000000..8245ce102 --- /dev/null +++ b/xorg-server/hw/dmx/glxProxy/glxvendor.h @@ -0,0 +1,55 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ + +#ifndef __GLXVENDOR_H +#define __GLXVENDOR_H + +extern int __glXVForwardSingleReq( __GLXclientState *cl, GLbyte *pc ); +extern int __glXVForwardPipe0WithReply( __GLXclientState *cl, GLbyte *pc ); +extern int __glXVForwardAllWithReply( __GLXclientState *cl, GLbyte *pc ); + +extern int __glXVForwardSingleReqSwap( __GLXclientState *cl, GLbyte *pc ); + +extern int __glXVForwardPipe0WithReplySwap( __GLXclientState *cl, GLbyte *pc ); +extern int __glXVForwardPipe0WithReplySwapsv( __GLXclientState *cl, GLbyte *pc ); +extern int __glXVForwardPipe0WithReplySwapiv( __GLXclientState *cl, GLbyte *pc ); +extern int __glXVForwardPipe0WithReplySwapdv( __GLXclientState *cl, GLbyte *pc ); + +extern int __glXVForwardAllWithReplySwap( __GLXclientState *cl, GLbyte *pc ); +extern int __glXVForwardAllWithReplySwapsv( __GLXclientState *cl, GLbyte *pc ); +extern int __glXVForwardAllWithReplySwapiv( __GLXclientState *cl, GLbyte *pc ); +extern int __glXVForwardAllWithReplySwapdv( __GLXclientState *cl, GLbyte *pc ); + +#endif diff --git a/xorg-server/hw/dmx/glxProxy/glxvisuals.c b/xorg-server/hw/dmx/glxProxy/glxvisuals.c new file mode 100644 index 000000000..77bb137cf --- /dev/null +++ b/xorg-server/hw/dmx/glxProxy/glxvisuals.c @@ -0,0 +1,543 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ + +#ifdef HAVE_DMX_CONFIG_H +#include +#endif + +#include +#include "dmx.h" +#include "glxserver.h" +#include "glxutil.h" +#include "dmx_glxvisuals.h" + +static int numConfigs = 0; +static __GLXvisualConfig *visualConfigs = NULL; +static void **visualPrivates = NULL; + +int glxVisualsMatch( __GLXvisualConfig *v1, __GLXvisualConfig *v2 ) +{ + if ( (v1->class == v2->class) && + (v1->rgba == v2->rgba) && + (v1->redSize == v2->redSize) && + (v1->greenSize == v2->greenSize) && + (v1->blueSize == v2->blueSize) && + (v1->alphaSize == v2->alphaSize) && + (v1->redMask == v2->redMask) && + (v1->greenMask == v2->greenMask) && + (v1->blueMask == v2->blueMask) && + (v1->alphaMask == v2->alphaMask) && + (v1->accumRedSize == v2->accumRedSize) && + (v1->accumGreenSize == v2->accumGreenSize) && + (v1->accumBlueSize == v2->accumBlueSize) && + (v1->accumAlphaSize == v2->accumAlphaSize) && + (v1->doubleBuffer == v2->doubleBuffer) && + (v1->stereo == v2->stereo) && + (v1->bufferSize == v2->bufferSize) && + (v1->depthSize == v2->depthSize) && + (v1->stencilSize == v2->stencilSize) && + (v1->auxBuffers == v2->auxBuffers) && + (v1->level == v2->level) && + (v1->visualRating == v2->visualRating) && + (v1->transparentPixel == v2->transparentPixel) && + (v1->transparentRed == v2->transparentRed) && + (v1->transparentGreen == v2->transparentGreen) && + (v1->transparentBlue == v2->transparentBlue) && + (v1->transparentAlpha == v2->transparentAlpha) && + (v1->transparentIndex == v2->transparentIndex) && + (v1->multiSampleSize == v2->multiSampleSize) && + (v1->nMultiSampleBuffers == v2->nMultiSampleBuffers) && + (v1->visualSelectGroup == v2->visualSelectGroup) ) { + + return(1); + + } + + return(0); + +} + +VisualID glxMatchGLXVisualInConfigList( __GLXvisualConfig *pGlxVisual, __GLXvisualConfig *configs, int nconfigs ) +{ + int i; + + for (i=0; imyNum]; + pGlxVisual = pGlxScreen->pGlxVisual; + + /* find the glx visual info for pVisual */ + for (i = 0; i < pGlxScreen->numVisuals; i++, pGlxVisual++) { + if (pGlxVisual->vid == pVisual->vid) { + break; + } + } + if (i == pGlxScreen->numVisuals) { + /* + * the visual is not supported by glx + */ + return(0); + } + + return( glxMatchGLXVisualInConfigList(pGlxVisual, configs, nconfigs) ); +} + +VisualPtr glxMatchVisual( ScreenPtr pScreen, VisualPtr pVisual, ScreenPtr pMatchScreen ) +{ + __GLXscreenInfo *pGlxScreen2; + int j; + VisualID vid; + + /* check that the glx extension has been initialized */ + if ( !__glXActiveScreens ) + return NULL; + + pGlxScreen2 = &__glXActiveScreens[pMatchScreen->myNum]; + + vid = glxMatchVisualInConfigList( pScreen, pVisual, + pGlxScreen2->pGlxVisual, + pGlxScreen2->numVisuals ); + if (vid) { + /* + * find the X visual of the matching glx visual + */ + for (j=0; jnumVisuals; j++) { + if (vid == pMatchScreen->visuals[j].vid) { + return( &pMatchScreen->visuals[j] ); + } + } + } + + return(0); +} + +void glxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, + void **privates) +{ + numConfigs = nconfigs; + visualConfigs = configs; + visualPrivates = privates; +} + +static int count_bits(unsigned int n) +{ + int bits = 0; + + while (n > 0) { + if (n & 1) bits++; + n >>= 1; + } + return bits; +} + +static VisualID FindClosestVisual( VisualPtr pVisual, int rootDepth, + DepthPtr pdepth, int ndepths, + VisualPtr pNewVisual, int numNewVisuals) +{ + int d, v; + VisualPtr vis; + + /* + * find the first visual with the same or deeper depth + * of the same class. + */ + for (d=0; d= rootDepth) { + for (v=0; vvid ) vis++; + + if (vis->class == pVisual->class) { + return( pdepth[d].vids[v] ); + } + } + } + } + + /* + * did not find any. + * try to look for the same class only. + */ + for (d=0; dvid ) vis++; + + if (vis->class == pVisual->class) { + return( pdepth[d].vids[v] ); + } + } + } + + /* + * if not found - just take the first visual + */ + return( pdepth[0].vids[0] ); +} + +Bool glxInitVisuals(int *nvisualp, VisualPtr *visualp, + VisualID *defaultVisp, + int ndepth, DepthPtr pdepth, + int rootDepth) +{ + int numRGBconfigs; + int numCIconfigs; + int numVisuals = *nvisualp; + int numNewVisuals; + int numNewConfigs; + VisualPtr pVisual = *visualp; + VisualPtr pVisualNew = NULL; + VisualID *orig_vid = NULL; + __GLXvisualConfig *glXVisualPtr = NULL; + __GLXvisualConfig *pNewVisualConfigs = NULL; + void **glXVisualPriv; + dmxGlxVisualPrivate **pNewVisualPriv; + int found_default; + int i, j, k; + int numGLXvis = 0; + GLint *isGLXvis; + + if (numConfigs > 0) + numNewConfigs = numConfigs; + else + return False; + + MAXSCREENSALLOC(__glXActiveScreens); + if (!__glXActiveScreens) + return False; + + /* Alloc space for the list of new GLX visuals */ + pNewVisualConfigs = (__GLXvisualConfig *) + __glXMalloc(numNewConfigs * sizeof(__GLXvisualConfig)); + if (!pNewVisualConfigs) { + return FALSE; + } + + /* Alloc space for the list of new GLX visual privates */ + pNewVisualPriv = (dmxGlxVisualPrivate **) __glXMalloc(numNewConfigs * sizeof(dmxGlxVisualPrivate *)); + if (!pNewVisualPriv) { + __glXFree(pNewVisualConfigs); + return FALSE; + } + + /* copy driver's visual config info */ + for (i = 0; i < numConfigs; i++) { + pNewVisualConfigs[i] = visualConfigs[i]; + pNewVisualPriv[i] = (dmxGlxVisualPrivate *)visualPrivates[i]; + } + +#if 1 + /* FIXME: This is a hack to workaround a hang in xtest caused by a + * mismatch between what the front end (i.e., DMX) server calculates + * for the visual configs and what the back-end servers have. + */ + { + int numTCRGBconfigs = 0; + int numDCRGBconfigs = 0; + + numRGBconfigs = 0; + numCIconfigs = 0; + + for (i = 0; i < numNewConfigs; i++) { + if (pNewVisualConfigs[i].rgba) { + if (pNewVisualConfigs[i].class == TrueColor) + numTCRGBconfigs++; + else + numDCRGBconfigs++; + numRGBconfigs++; + } else + numCIconfigs++; + } + + /* Count the total number of visuals to compute */ + numNewVisuals = 0; + for (i = 0; i < numVisuals; i++) { + numNewVisuals += + (pVisual[i].class == TrueColor) ? numTCRGBconfigs : + (pVisual[i].class == DirectColor) ? numDCRGBconfigs : + numCIconfigs; + } + } +#else + /* Count the number of RGB and CI visual configs */ + numRGBconfigs = 0; + numCIconfigs = 0; + for (i = 0; i < numNewConfigs; i++) { + if (pNewVisualConfigs[i].rgba) + numRGBconfigs++; + else + numCIconfigs++; + } + + /* Count the total number of visuals to compute */ + numNewVisuals = 0; + for (i = 0; i < numVisuals; i++) { + numNewVisuals += + (pVisual[i].class == TrueColor || pVisual[i].class == DirectColor) + ? numRGBconfigs : numCIconfigs; + } +#endif + + /* Reset variables for use with the next screen/driver's visual configs */ + visualConfigs = NULL; + numConfigs = 0; + + /* Alloc temp space for the list of orig VisualIDs for each new visual */ + orig_vid = (VisualID *)__glXMalloc(numNewVisuals * sizeof(VisualID)); + if (!orig_vid) { + __glXFree(pNewVisualPriv); + __glXFree(pNewVisualConfigs); + return FALSE; + } + + /* Alloc space for the list of glXVisuals */ + glXVisualPtr = (__GLXvisualConfig *)__glXMalloc(numNewVisuals * + sizeof(__GLXvisualConfig)); + if (!glXVisualPtr) { + __glXFree(orig_vid); + __glXFree(pNewVisualPriv); + __glXFree(pNewVisualConfigs); + return FALSE; + } + + /* Alloc space for the list of glXVisualPrivates */ + glXVisualPriv = (void **)__glXMalloc(numNewVisuals * sizeof(void *)); + if (!glXVisualPriv) { + __glXFree(glXVisualPtr); + __glXFree(orig_vid); + __glXFree(pNewVisualPriv); + __glXFree(pNewVisualConfigs); + return FALSE; + } + + /* Alloc space for the new list of the X server's visuals */ + pVisualNew = (VisualPtr)__glXMalloc(numNewVisuals * sizeof(VisualRec)); + if (!pVisualNew) { + __glXFree(glXVisualPriv); + __glXFree(glXVisualPtr); + __glXFree(orig_vid); + __glXFree(pNewVisualPriv); + __glXFree(pNewVisualConfigs); + return FALSE; + } + + isGLXvis = (GLint *) __glXMalloc(numNewVisuals * sizeof(GLint)); + if (!isGLXvis) { + __glXFree(glXVisualPriv); + __glXFree(glXVisualPtr); + __glXFree(orig_vid); + __glXFree(pNewVisualPriv); + __glXFree(pNewVisualConfigs); + __glXFree(pVisualNew); + return FALSE; + } + + /* Initialize the new visuals */ + found_default = FALSE; + for (i = j = 0; i < numVisuals; i++) { + + for (k = 0; k < numNewConfigs; k++) { + + int new_depth; + int depth; + int d,v; + + /* find the depth of the new visual config */ + new_depth = pNewVisualPriv[k]->x_visual_depth; + + /* find the depth of the original visual */ + depth = 0; + d = 0; + while( (depth==0) && (d < ndepth) ) { + v = 0; + while( (depth==0) && (v < pdepth[d].numVids) ) { + if (pdepth[d].vids[v] == pVisual[i].vid) { + depth = pdepth[d].depth; + } + v++; + } + d++; + } + + /* check that the visual has the same class and depth + * as the new config + */ + if ( pVisual[i].class != pNewVisualPriv[k]->x_visual_class || + (depth != new_depth) ) + continue; + + /* Initialize the new visual */ + pVisualNew[j] = pVisual[i]; + pVisualNew[j].vid = FakeClientID(0); + + /* Check for the default visual */ + if (!found_default && pVisual[i].vid == *defaultVisp) { + *defaultVisp = pVisualNew[j].vid; + found_default = TRUE; + } + + /* Save the old VisualID */ + orig_vid[j] = pVisual[i].vid; + + /* Initialize the glXVisual */ + glXVisualPtr[j] = pNewVisualConfigs[k]; + glXVisualPtr[j].vid = pVisualNew[j].vid; + + /* + * If the class is -1, then assume the X visual information + * is identical to what GLX needs, and take them from the X + * visual. NOTE: if class != -1, then all other fields MUST + * be initialized. + */ + if (glXVisualPtr[j].class == -1) { + glXVisualPtr[j].class = pVisual[i].class; + glXVisualPtr[j].redSize = count_bits(pVisual[i].redMask); + glXVisualPtr[j].greenSize = count_bits(pVisual[i].greenMask); + glXVisualPtr[j].blueSize = count_bits(pVisual[i].blueMask); + glXVisualPtr[j].alphaSize = glXVisualPtr[j].alphaSize; + glXVisualPtr[j].redMask = pVisual[i].redMask; + glXVisualPtr[j].greenMask = pVisual[i].greenMask; + glXVisualPtr[j].blueMask = pVisual[i].blueMask; + glXVisualPtr[j].alphaMask = glXVisualPtr[j].alphaMask; + glXVisualPtr[j].bufferSize = rootDepth; + } + + /* Save the device-dependent private for this visual */ + glXVisualPriv[j] = pNewVisualPriv[k]; + + isGLXvis[j] = glxMatchGLXVisualInConfigList( &glXVisualPtr[j], + dmxScreens[screenInfo.numScreens-1].glxVisuals, + dmxScreens[screenInfo.numScreens-1].numGlxVisuals ); + if (isGLXvis[j]) numGLXvis++; + + j++; + } + } + + assert(j <= numNewVisuals); + numNewVisuals = j; /* correct number of new visuals */ + + /* Save the GLX visuals in the screen structure */ + __glXActiveScreens[screenInfo.numScreens-1].numVisuals = numNewVisuals; + __glXActiveScreens[screenInfo.numScreens-1].numGLXVisuals = numGLXvis; + __glXActiveScreens[screenInfo.numScreens-1].isGLXvis = isGLXvis; + __glXActiveScreens[screenInfo.numScreens-1].pGlxVisual = glXVisualPtr; + + + /* Set up depth's VisualIDs */ + for (i = 0; i < ndepth; i++) { + int numVids = 0; + VisualID *pVids = NULL; + int k, n = 0; + + /* Count the new number of VisualIDs at this depth */ + for (j = 0; j < pdepth[i].numVids; j++) + for (k = 0; k < numNewVisuals; k++) + if (pdepth[i].vids[j] == orig_vid[k]) + numVids++; + + /* Allocate a new list of VisualIDs for this depth */ + pVids = (VisualID *)__glXMalloc(numVids * sizeof(VisualID)); + + /* Initialize the new list of VisualIDs for this depth */ + for (j = 0; j < pdepth[i].numVids; j++) + for (k = 0; k < numNewVisuals; k++) + if (pdepth[i].vids[j] == orig_vid[k]) + pVids[n++] = pVisualNew[k].vid; + + /* Update this depth's list of VisualIDs */ + __glXFree(pdepth[i].vids); + pdepth[i].vids = pVids; + pdepth[i].numVids = numVids; + } + + /* + * if the default visual was rejected - need to choose new + * default visual ! + */ + if ( !found_default ) { + + for (i=0; inumVertexes); + __GLX_SWAP_INT(&hdr->numComponents); + __GLX_SWAP_INT(&hdr->primType); + + pc += sizeof(__GLXdispatchDrawArraysHeader); + compHeader = (__GLXdispatchDrawArraysComponentHeader *) pc; + + /* compute stride (same for all component arrays) */ + for (i=0; inumComponents; i++) { + __GLX_SWAP_INT(&compHeader[i].datatype); + __GLX_SWAP_INT(&compHeader[i].numVals); + __GLX_SWAP_INT(&compHeader[i].component); + + } + +} + +void __glXDispSwap_DrawArraysEXT(GLbyte *pc) +{ +#ifdef XXX_STUB +#endif /*XXX_STUB*/ +} diff --git a/xorg-server/hw/dmx/glxProxy/renderpixswap.c b/xorg-server/hw/dmx/glxProxy/renderpixswap.c new file mode 100644 index 000000000..881967ccf --- /dev/null +++ b/xorg-server/hw/dmx/glxProxy/renderpixswap.c @@ -0,0 +1,389 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ + +#define NEED_REPLIES +#include "glxserver.h" +#include "unpack.h" +#include "g_disptab.h" + +void __glXDispSwap_PolygonStipple(GLbyte *pc) +{ + __GLXpixelHeader *hdr = (__GLXpixelHeader *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); + __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); + __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); + __GLX_SWAP_INT((GLbyte *)&hdr->alignment); + + hdr->swapBytes = !hdr->swapBytes; +} + +void __glXDispSwap_Bitmap(GLbyte *pc) +{ + __GLXdispatchBitmapHeader *hdr = (__GLXdispatchBitmapHeader *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); + __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); + __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); + __GLX_SWAP_INT((GLbyte *)&hdr->alignment); + + __GLX_SWAP_INT((GLbyte *)&hdr->width); + __GLX_SWAP_INT((GLbyte *)&hdr->height); + __GLX_SWAP_FLOAT((GLbyte *)&hdr->xorig); + __GLX_SWAP_FLOAT((GLbyte *)&hdr->yorig); + __GLX_SWAP_FLOAT((GLbyte *)&hdr->xmove); + __GLX_SWAP_FLOAT((GLbyte *)&hdr->ymove); + + hdr->swapBytes = !hdr->swapBytes; + +} + +void __glXDispSwap_TexImage1D(GLbyte *pc) +{ + __GLXdispatchTexImageHeader *hdr = (__GLXdispatchTexImageHeader *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); + __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); + __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); + __GLX_SWAP_INT((GLbyte *)&hdr->alignment); + + __GLX_SWAP_INT((GLbyte *)&hdr->target); + __GLX_SWAP_INT((GLbyte *)&hdr->level); + __GLX_SWAP_INT((GLbyte *)&hdr->components); + __GLX_SWAP_INT((GLbyte *)&hdr->width); + __GLX_SWAP_INT((GLbyte *)&hdr->height); + __GLX_SWAP_INT((GLbyte *)&hdr->border); + __GLX_SWAP_INT((GLbyte *)&hdr->format); + __GLX_SWAP_INT((GLbyte *)&hdr->type); + + /* + ** Just invert swapBytes flag; the GL will figure out if it needs to swap + ** the pixel data. + */ + hdr->swapBytes = !hdr->swapBytes; +} + +void __glXDispSwap_TexImage2D(GLbyte *pc) +{ + __GLXdispatchTexImageHeader *hdr = (__GLXdispatchTexImageHeader *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); + __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); + __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); + __GLX_SWAP_INT((GLbyte *)&hdr->alignment); + + __GLX_SWAP_INT((GLbyte *)&hdr->target); + __GLX_SWAP_INT((GLbyte *)&hdr->level); + __GLX_SWAP_INT((GLbyte *)&hdr->components); + __GLX_SWAP_INT((GLbyte *)&hdr->width); + __GLX_SWAP_INT((GLbyte *)&hdr->height); + __GLX_SWAP_INT((GLbyte *)&hdr->border); + __GLX_SWAP_INT((GLbyte *)&hdr->format); + __GLX_SWAP_INT((GLbyte *)&hdr->type); + + /* + ** Just invert swapBytes flag; the GL will figure out if it needs to swap + ** the pixel data. + */ + hdr->swapBytes = !hdr->swapBytes; +} + +void __glXDispSwap_TexImage3D(GLbyte *pc) +{ + __GLXdispatchTexImage3DHeader *hdr = (__GLXdispatchTexImage3DHeader *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); + __GLX_SWAP_INT((GLbyte *)&hdr->imageHeight); + __GLX_SWAP_INT((GLbyte *)&hdr->imageDepth); + __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); + __GLX_SWAP_INT((GLbyte *)&hdr->skipImages); + __GLX_SWAP_INT((GLbyte *)&hdr->skipVolumes); + __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); + __GLX_SWAP_INT((GLbyte *)&hdr->alignment); + + __GLX_SWAP_INT((GLbyte *)&hdr->target); + __GLX_SWAP_INT((GLbyte *)&hdr->level); + __GLX_SWAP_INT((GLbyte *)&hdr->internalformat); + __GLX_SWAP_INT((GLbyte *)&hdr->width); + __GLX_SWAP_INT((GLbyte *)&hdr->height); + __GLX_SWAP_INT((GLbyte *)&hdr->depth); + __GLX_SWAP_INT((GLbyte *)&hdr->size4d); + __GLX_SWAP_INT((GLbyte *)&hdr->border); + __GLX_SWAP_INT((GLbyte *)&hdr->format); + __GLX_SWAP_INT((GLbyte *)&hdr->type); + + /* + ** Just invert swapBytes flag; the GL will figure out if it needs to swap + ** the pixel data. + */ + hdr->swapBytes = !hdr->swapBytes; +} + +void __glXDispSwap_DrawPixels(GLbyte *pc) +{ + __GLXdispatchDrawPixelsHeader *hdr = (__GLXdispatchDrawPixelsHeader *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); + __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); + __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); + __GLX_SWAP_INT((GLbyte *)&hdr->alignment); + + __GLX_SWAP_INT((GLbyte *)&hdr->width); + __GLX_SWAP_INT((GLbyte *)&hdr->height); + __GLX_SWAP_INT((GLbyte *)&hdr->format); + __GLX_SWAP_INT((GLbyte *)&hdr->type); + + /* + ** Just invert swapBytes flag; the GL will figure out if it needs to swap + ** the pixel data. + */ + hdr->swapBytes = !hdr->swapBytes; +} + +void __glXDispSwap_TexSubImage1D(GLbyte *pc) +{ + __GLXdispatchTexSubImageHeader *hdr = (__GLXdispatchTexSubImageHeader *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); + __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); + __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); + __GLX_SWAP_INT((GLbyte *)&hdr->alignment); + + __GLX_SWAP_INT((GLbyte *)&hdr->target); + __GLX_SWAP_INT((GLbyte *)&hdr->level); + __GLX_SWAP_INT((GLbyte *)&hdr->xoffset); + __GLX_SWAP_INT((GLbyte *)&hdr->width); + __GLX_SWAP_INT((GLbyte *)&hdr->format); + __GLX_SWAP_INT((GLbyte *)&hdr->type); + + /* + ** Just invert swapBytes flag; the GL will figure out if it needs to swap + ** the pixel data. + */ + hdr->swapBytes = !hdr->swapBytes; +} + +void __glXDispSwap_TexSubImage2D(GLbyte *pc) +{ + __GLXdispatchTexSubImageHeader *hdr = (__GLXdispatchTexSubImageHeader *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); + __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); + __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); + __GLX_SWAP_INT((GLbyte *)&hdr->alignment); + + __GLX_SWAP_INT((GLbyte *)&hdr->target); + __GLX_SWAP_INT((GLbyte *)&hdr->level); + __GLX_SWAP_INT((GLbyte *)&hdr->xoffset); + __GLX_SWAP_INT((GLbyte *)&hdr->yoffset); + __GLX_SWAP_INT((GLbyte *)&hdr->width); + __GLX_SWAP_INT((GLbyte *)&hdr->height); + __GLX_SWAP_INT((GLbyte *)&hdr->format); + __GLX_SWAP_INT((GLbyte *)&hdr->type); + + /* + ** Just invert swapBytes flag; the GL will figure out if it needs to swap + ** the pixel data. + */ + hdr->swapBytes = !hdr->swapBytes; +} + +void __glXDispSwap_TexSubImage3D(GLbyte *pc) +{ + __GLXdispatchTexSubImage3DHeader *hdr = + (__GLXdispatchTexSubImage3DHeader *) pc; + + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); + __GLX_SWAP_INT((GLbyte *)&hdr->imageHeight); + __GLX_SWAP_INT((GLbyte *)&hdr->imageDepth); + __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); + __GLX_SWAP_INT((GLbyte *)&hdr->skipImages); + __GLX_SWAP_INT((GLbyte *)&hdr->skipVolumes); + __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); + __GLX_SWAP_INT((GLbyte *)&hdr->alignment); + + __GLX_SWAP_INT((GLbyte *)&hdr->target); + __GLX_SWAP_INT((GLbyte *)&hdr->level); + __GLX_SWAP_INT((GLbyte *)&hdr->xoffset); + __GLX_SWAP_INT((GLbyte *)&hdr->yoffset); + __GLX_SWAP_INT((GLbyte *)&hdr->zoffset); + __GLX_SWAP_INT((GLbyte *)&hdr->width); + __GLX_SWAP_INT((GLbyte *)&hdr->height); + __GLX_SWAP_INT((GLbyte *)&hdr->depth); + __GLX_SWAP_INT((GLbyte *)&hdr->size4d); + __GLX_SWAP_INT((GLbyte *)&hdr->format); + __GLX_SWAP_INT((GLbyte *)&hdr->type); + + /* + ** Just invert swapBytes flag; the GL will figure out if it needs to swap + ** the pixel data. + */ + hdr->swapBytes = !hdr->swapBytes; +} + +void __glXDispSwap_ColorTable(GLbyte *pc) +{ + __GLXdispatchColorTableHeader *hdr = + (__GLXdispatchColorTableHeader *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); + __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); + __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); + __GLX_SWAP_INT((GLbyte *)&hdr->alignment); + + __GLX_SWAP_INT((GLbyte *)&hdr->target); + __GLX_SWAP_INT((GLbyte *)&hdr->internalformat); + __GLX_SWAP_INT((GLbyte *)&hdr->width); + __GLX_SWAP_INT((GLbyte *)&hdr->format); + __GLX_SWAP_INT((GLbyte *)&hdr->type); + + /* + ** Just invert swapBytes flag; the GL will figure out if it needs to swap + ** the pixel data. + */ + hdr->swapBytes = !hdr->swapBytes; +} + +void __glXDispSwap_ColorSubTable(GLbyte *pc) +{ + __GLXdispatchColorSubTableHeader *hdr = + (__GLXdispatchColorSubTableHeader *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); + __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); + __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); + __GLX_SWAP_INT((GLbyte *)&hdr->alignment); + + __GLX_SWAP_INT((GLbyte *)&hdr->target); + __GLX_SWAP_INT((GLbyte *)&hdr->start); + __GLX_SWAP_INT((GLbyte *)&hdr->count); + __GLX_SWAP_INT((GLbyte *)&hdr->format); + __GLX_SWAP_INT((GLbyte *)&hdr->type); + + /* + ** Just invert swapBytes flag; the GL will figure out if it needs to swap + ** the pixel data. + */ + hdr->swapBytes = !hdr->swapBytes; +} + +void __glXDispSwap_ConvolutionFilter1D(GLbyte *pc) +{ + __GLXdispatchConvolutionFilterHeader *hdr = + (__GLXdispatchConvolutionFilterHeader *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); + __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); + __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); + __GLX_SWAP_INT((GLbyte *)&hdr->alignment); + + __GLX_SWAP_INT((GLbyte *)&hdr->target); + __GLX_SWAP_INT((GLbyte *)&hdr->internalformat); + __GLX_SWAP_INT((GLbyte *)&hdr->width); + __GLX_SWAP_INT((GLbyte *)&hdr->format); + __GLX_SWAP_INT((GLbyte *)&hdr->type); + + /* + ** Just invert swapBytes flag; the GL will figure out if it needs to swap + ** the pixel data. + */ + hdr->swapBytes = !hdr->swapBytes; +} + +void __glXDispSwap_ConvolutionFilter2D(GLbyte *pc) +{ + __GLXdispatchConvolutionFilterHeader *hdr = + (__GLXdispatchConvolutionFilterHeader *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); + __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); + __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); + __GLX_SWAP_INT((GLbyte *)&hdr->alignment); + + __GLX_SWAP_INT((GLbyte *)&hdr->target); + __GLX_SWAP_INT((GLbyte *)&hdr->internalformat); + __GLX_SWAP_INT((GLbyte *)&hdr->width); + __GLX_SWAP_INT((GLbyte *)&hdr->height); + __GLX_SWAP_INT((GLbyte *)&hdr->format); + __GLX_SWAP_INT((GLbyte *)&hdr->type); + + /* + ** Just invert swapBytes flag; the GL will figure out if it needs to swap + ** the pixel data. + */ + hdr->swapBytes = !hdr->swapBytes; +} + +void __glXDispSwap_SeparableFilter2D(GLbyte *pc) +{ + __GLXdispatchConvolutionFilterHeader *hdr = + (__GLXdispatchConvolutionFilterHeader *) pc; + GLint hdrlen, image1len; + __GLX_DECLARE_SWAP_VARIABLES; + + hdrlen = __GLX_PAD(__GLX_CONV_FILT_CMD_HDR_SIZE); + + __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); + __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); + __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); + __GLX_SWAP_INT((GLbyte *)&hdr->alignment); + + __GLX_SWAP_INT((GLbyte *)&hdr->target); + __GLX_SWAP_INT((GLbyte *)&hdr->internalformat); + __GLX_SWAP_INT((GLbyte *)&hdr->width); + __GLX_SWAP_INT((GLbyte *)&hdr->height); + __GLX_SWAP_INT((GLbyte *)&hdr->format); + __GLX_SWAP_INT((GLbyte *)&hdr->type); + + /* + ** Just invert swapBytes flag; the GL will figure out if it needs to swap + ** the pixel data. + */ + hdr->swapBytes = !hdr->swapBytes; +} diff --git a/xorg-server/hw/dmx/glxProxy/unpack.h b/xorg-server/hw/dmx/glxProxy/unpack.h new file mode 100644 index 000000000..713e3aaa2 --- /dev/null +++ b/xorg-server/hw/dmx/glxProxy/unpack.h @@ -0,0 +1,233 @@ +#ifndef __GLX_unpack_h__ +#define __GLX_unpack_h__ + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ + +#define __GLX_PAD(s) (((s)+3) & (GLuint)~3) + +/* +** Fetch the context-id out of a SingleReq request pointed to by pc. +*/ +#define __GLX_GET_SINGLE_CONTEXT_TAG(pc) (((xGLXSingleReq*)pc)->contextTag) +#define __GLX_GET_VENDPRIV_CONTEXT_TAG(pc) (((xGLXVendorPrivateReq*)pc)->contextTag) + +/* +** Fetch a double from potentially unaligned memory. +*/ +#ifdef __GLX_ALIGN64 +#define __GLX_MEM_COPY(dst,src,n) memcpy(dst,src,n) +#define __GLX_GET_DOUBLE(dst,src) __GLX_MEM_COPY(&dst,src,8) +#else +#define __GLX_GET_DOUBLE(dst,src) (dst) = *((GLdouble*)(src)) +#endif + +extern void __glXMemInit(void); + +extern xGLXSingleReply __glXReply; + +#define __GLX_BEGIN_REPLY(size) \ + __glXReply.length = __GLX_PAD(size) >> 2; \ + __glXReply.type = X_Reply; \ + __glXReply.sequenceNumber = client->sequence; + +#define __GLX_SEND_HEADER() \ + WriteToClient( client, sz_xGLXSingleReply, (char *)&__glXReply); + +#define __GLX_PUT_RETVAL(a) \ + __glXReply.retval = (a); + +#define __GLX_PUT_SIZE(a) \ + __glXReply.size = (a); + +#define __GLX_PUT_RENDERMODE(m) \ + __glXReply.pad3 = (m) + +/* +** Get a buffer to hold returned data, with the given alignment. If we have +** to realloc, allocate size+align, in case the pointer has to be bumped for +** alignment. The answerBuffer should already be aligned. +** +** NOTE: the cast (long)res below assumes a long is large enough to hold a +** pointer. +*/ +#define __GLX_GET_ANSWER_BUFFER(res,cl,size,align) \ + if ((size) > sizeof(answerBuffer)) { \ + int bump; \ + if ((cl)->returnBufSize < (size)+(align)) { \ + (cl)->returnBuf = (GLbyte*)Xrealloc((cl)->returnBuf, \ + (size)+(align)); \ + if (!(cl)->returnBuf) { \ + return BadAlloc; \ + } \ + (cl)->returnBufSize = (size)+(align); \ + } \ + res = (char*)cl->returnBuf; \ + bump = (long)(res) % (align); \ + if (bump) res += (align) - (bump); \ + } else { \ + res = (char *)answerBuffer; \ + } + +#define __GLX_PUT_BYTE() \ + *(GLbyte *)&__glXReply.pad3 = *(GLbyte *)answer + +#define __GLX_PUT_SHORT() \ + *(GLshort *)&__glXReply.pad3 = *(GLshort *)answer + +#define __GLX_PUT_INT() \ + *(GLint *)&__glXReply.pad3 = *(GLint *)answer + +#define __GLX_PUT_FLOAT() \ + *(GLfloat *)&__glXReply.pad3 = *(GLfloat *)answer + +#define __GLX_PUT_DOUBLE() \ + *(GLdouble *)&__glXReply.pad3 = *(GLdouble *)answer + +#define __GLX_SEND_BYTE_ARRAY(len) \ + WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT8), (char *)answer) + +#define __GLX_SEND_SHORT_ARRAY(len) \ + WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT16), (char *)answer) + +#define __GLX_SEND_INT_ARRAY(len) \ + WriteToClient(client, (len)*__GLX_SIZE_INT32, (char *)answer) + +#define __GLX_SEND_FLOAT_ARRAY(len) \ + WriteToClient(client, (len)*__GLX_SIZE_FLOAT32, (char *)answer) + +#define __GLX_SEND_DOUBLE_ARRAY(len) \ + WriteToClient(client, (len)*__GLX_SIZE_FLOAT64, (char *)answer) + + +#define __GLX_SEND_VOID_ARRAY(len) __GLX_SEND_BYTE_ARRAY(len) +#define __GLX_SEND_UBYTE_ARRAY(len) __GLX_SEND_BYTE_ARRAY(len) +#define __GLX_SEND_USHORT_ARRAY(len) __GLX_SEND_SHORT_ARRAY(len) +#define __GLX_SEND_UINT_ARRAY(len) __GLX_SEND_INT_ARRAY(len) + +/* +** PERFORMANCE NOTE: +** Machine dependent optimizations abound here; these swapping macros can +** conceivably be replaced with routines that do the job faster. +*/ +#define __GLX_DECLARE_SWAP_VARIABLES \ + GLbyte sw; \ + GLbyte *swapPC; \ + GLbyte *swapEnd + + +#define __GLX_SWAP_INT(pc) \ + sw = ((GLbyte *)(pc))[0]; \ + ((GLbyte *)(pc))[0] = ((GLbyte *)(pc))[3]; \ + ((GLbyte *)(pc))[3] = sw; \ + sw = ((GLbyte *)(pc))[1]; \ + ((GLbyte *)(pc))[1] = ((GLbyte *)(pc))[2]; \ + ((GLbyte *)(pc))[2] = sw; + +#define __GLX_SWAP_SHORT(pc) \ + sw = ((GLbyte *)(pc))[0]; \ + ((GLbyte *)(pc))[0] = ((GLbyte *)(pc))[1]; \ + ((GLbyte *)(pc))[1] = sw; + +#define __GLX_SWAP_DOUBLE(pc) \ + sw = ((GLbyte *)(pc))[0]; \ + ((GLbyte *)(pc))[0] = ((GLbyte *)(pc))[7]; \ + ((GLbyte *)(pc))[7] = sw; \ + sw = ((GLbyte *)(pc))[1]; \ + ((GLbyte *)(pc))[1] = ((GLbyte *)(pc))[6]; \ + ((GLbyte *)(pc))[6] = sw; \ + sw = ((GLbyte *)(pc))[2]; \ + ((GLbyte *)(pc))[2] = ((GLbyte *)(pc))[5]; \ + ((GLbyte *)(pc))[5] = sw; \ + sw = ((GLbyte *)(pc))[3]; \ + ((GLbyte *)(pc))[3] = ((GLbyte *)(pc))[4]; \ + ((GLbyte *)(pc))[4] = sw; + +#define __GLX_SWAP_FLOAT(pc) \ + sw = ((GLbyte *)(pc))[0]; \ + ((GLbyte *)(pc))[0] = ((GLbyte *)(pc))[3]; \ + ((GLbyte *)(pc))[3] = sw; \ + sw = ((GLbyte *)(pc))[1]; \ + ((GLbyte *)(pc))[1] = ((GLbyte *)(pc))[2]; \ + ((GLbyte *)(pc))[2] = sw; + +#define __GLX_SWAP_INT_ARRAY(pc, count) \ + swapPC = ((GLbyte *)(pc)); \ + swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_INT32;\ + while (swapPC < swapEnd) { \ + __GLX_SWAP_INT(swapPC); \ + swapPC += __GLX_SIZE_INT32; \ + } + +#define __GLX_SWAP_SHORT_ARRAY(pc, count) \ + swapPC = ((GLbyte *)(pc)); \ + swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_INT16;\ + while (swapPC < swapEnd) { \ + __GLX_SWAP_SHORT(swapPC); \ + swapPC += __GLX_SIZE_INT16; \ + } + +#define __GLX_SWAP_DOUBLE_ARRAY(pc, count) \ + swapPC = ((GLbyte *)(pc)); \ + swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_FLOAT64;\ + while (swapPC < swapEnd) { \ + __GLX_SWAP_DOUBLE(swapPC); \ + swapPC += __GLX_SIZE_FLOAT64; \ + } + +#define __GLX_SWAP_FLOAT_ARRAY(pc, count) \ + swapPC = ((GLbyte *)(pc)); \ + swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_FLOAT32;\ + while (swapPC < swapEnd) { \ + __GLX_SWAP_FLOAT(swapPC); \ + swapPC += __GLX_SIZE_FLOAT32; \ + } + +#define __GLX_SWAP_REPLY_HEADER() \ + __GLX_SWAP_SHORT(&__glXReply.sequenceNumber); \ + __GLX_SWAP_INT(&__glXReply.length); + +#define __GLX_SWAP_REPLY_RETVAL() \ + __GLX_SWAP_INT(&__glXReply.retval) + +#define __GLX_SWAP_REPLY_SIZE() \ + __GLX_SWAP_INT(&__glXReply.size) + +#endif /* !__GLX_unpack_h__ */ + + + + + -- cgit v1.2.3