diff options
Diffstat (limited to 'xorg-server/hw/xgl')
60 files changed, 33835 insertions, 0 deletions
diff --git a/xorg-server/hw/xgl/Makefile.am b/xorg-server/hw/xgl/Makefile.am new file mode 100644 index 000000000..8df8ae9af --- /dev/null +++ b/xorg-server/hw/xgl/Makefile.am @@ -0,0 +1,83 @@ +if GLX +GLX_SUBDIRS = glxext +endif + +if XGLX +XGLX_SUBDIRS = glx +endif + +if XEGL +XEGL_SUBDIRS = egl +endif + +DIST_SUBDIRS = glxext glx egl + +SUBDIRS = \ + . \ + $(GLX_SUBDIRS) \ + $(XGLX_SUBDIRS) \ + $(XEGL_SUBDIRS) + +AM_CFLAGS = \ + $(DIX_CFLAGS) \ + -DHAVE_XGL_CONFIG_H \ + -DHAVE_DIX_CONFIG_H \ + -I$(top_srcdir)/glx \ + -I$(top_srcdir)/GL/include \ + -I@MESA_SOURCE@/include \ + -I@MESA_SOURCE@/src/mesa/glapi \ + $(XGLMODULES_CFLAGS) + +noinst_LIBRARIES = libxgl.a + +libxgl_a_SOURCES = \ + xgl.h \ + xglmodule.h \ + xglglx.h \ + xglinput.c \ + xgloutput.c \ + xglcmap.c \ + xglparse.c \ + xglscreen.c \ + xglarea.c \ + xglgeometry.c \ + xglpixmap.c \ + xglsync.c \ + xglsolid.c \ + xgltile.c \ + xglcopy.c \ + xglfill.c \ + xglwindow.c \ + xglget.c \ + xglgc.c \ + xglshm.c \ + xglcompose.c \ + xglpict.c \ + xglglyph.c \ + xgltrap.c \ + xglloader.c \ + xglhash.c \ + xglglx.c \ + xglxv.c + +EXTRA_DIST = \ + xglmodule.h + +Xgl_LDFLAGS = -export-dynamic +Xgl_SOURCES = \ + xglinit.c \ + $(top_srcdir)/mi/miinitext.c \ + $(top_srcdir)/Xext/dpmsstubs.c \ + $(top_srcdir)/Xi/stubs.c \ + $(top_srcdir)/fb/fbcmap.c + +XGL_LIBS = \ + libxgl.a \ + @XGL_LIBS@ \ + $(XSERVER_LIBS) + +Xgl_DEPENDENCIES = $(XGL_LIBS) +Xgl_LDADD = $(XGL_LIBS) $(XSERVER_SYS_LIBS) $(XGL_SYS_LIBS) +Xgl_programs = Xgl + +bin_PROGRAMS = $(Xgl_programs) diff --git a/xorg-server/hw/xgl/Makefile.in b/xorg-server/hw/xgl/Makefile.in new file mode 100644 index 000000000..6e4dbd14c --- /dev/null +++ b/xorg-server/hw/xgl/Makefile.in @@ -0,0 +1,961 @@ +# 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@ +bin_PROGRAMS = $(am__EXEEXT_1) +subdir = hw/xgl +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 +libxgl_a_AR = $(AR) $(ARFLAGS) +libxgl_a_LIBADD = +am_libxgl_a_OBJECTS = xglinput.$(OBJEXT) xgloutput.$(OBJEXT) \ + xglcmap.$(OBJEXT) xglparse.$(OBJEXT) xglscreen.$(OBJEXT) \ + xglarea.$(OBJEXT) xglgeometry.$(OBJEXT) xglpixmap.$(OBJEXT) \ + xglsync.$(OBJEXT) xglsolid.$(OBJEXT) xgltile.$(OBJEXT) \ + xglcopy.$(OBJEXT) xglfill.$(OBJEXT) xglwindow.$(OBJEXT) \ + xglget.$(OBJEXT) xglgc.$(OBJEXT) xglshm.$(OBJEXT) \ + xglcompose.$(OBJEXT) xglpict.$(OBJEXT) xglglyph.$(OBJEXT) \ + xgltrap.$(OBJEXT) xglloader.$(OBJEXT) xglhash.$(OBJEXT) \ + xglglx.$(OBJEXT) xglxv.$(OBJEXT) +libxgl_a_OBJECTS = $(am_libxgl_a_OBJECTS) +am__EXEEXT_1 = Xgl$(EXEEXT) +am__installdirs = "$(DESTDIR)$(bindir)" +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(bin_PROGRAMS) +am_Xgl_OBJECTS = xglinit.$(OBJEXT) miinitext.$(OBJEXT) \ + dpmsstubs.$(OBJEXT) stubs.$(OBJEXT) fbcmap.$(OBJEXT) +Xgl_OBJECTS = $(am_Xgl_OBJECTS) +am__DEPENDENCIES_1 = +am__DEPENDENCIES_2 = libxgl.a $(am__DEPENDENCIES_1) +Xgl_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(Xgl_LDFLAGS) \ + $(LDFLAGS) -o $@ +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 = $(libxgl_a_SOURCES) $(Xgl_SOURCES) +DIST_SOURCES = $(libxgl_a_SOURCES) $(Xgl_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +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 = \ + libxgl.a \ + @XGL_LIBS@ \ + $(XSERVER_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@ +@GLX_TRUE@GLX_SUBDIRS = glxext +@XGLX_TRUE@XGLX_SUBDIRS = glx +@XEGL_TRUE@XEGL_SUBDIRS = egl +DIST_SUBDIRS = glxext glx egl +SUBDIRS = \ + . \ + $(GLX_SUBDIRS) \ + $(XGLX_SUBDIRS) \ + $(XEGL_SUBDIRS) + +AM_CFLAGS = \ + $(DIX_CFLAGS) \ + -DHAVE_XGL_CONFIG_H \ + -DHAVE_DIX_CONFIG_H \ + -I$(top_srcdir)/glx \ + -I$(top_srcdir)/GL/include \ + -I@MESA_SOURCE@/include \ + -I@MESA_SOURCE@/src/mesa/glapi \ + $(XGLMODULES_CFLAGS) + +noinst_LIBRARIES = libxgl.a +libxgl_a_SOURCES = \ + xgl.h \ + xglmodule.h \ + xglglx.h \ + xglinput.c \ + xgloutput.c \ + xglcmap.c \ + xglparse.c \ + xglscreen.c \ + xglarea.c \ + xglgeometry.c \ + xglpixmap.c \ + xglsync.c \ + xglsolid.c \ + xgltile.c \ + xglcopy.c \ + xglfill.c \ + xglwindow.c \ + xglget.c \ + xglgc.c \ + xglshm.c \ + xglcompose.c \ + xglpict.c \ + xglglyph.c \ + xgltrap.c \ + xglloader.c \ + xglhash.c \ + xglglx.c \ + xglxv.c + +EXTRA_DIST = \ + xglmodule.h + +Xgl_LDFLAGS = -export-dynamic +Xgl_SOURCES = \ + xglinit.c \ + $(top_srcdir)/mi/miinitext.c \ + $(top_srcdir)/Xext/dpmsstubs.c \ + $(top_srcdir)/Xi/stubs.c \ + $(top_srcdir)/fb/fbcmap.c + +Xgl_DEPENDENCIES = $(XGL_LIBS) +Xgl_LDADD = $(XGL_LIBS) $(XSERVER_SYS_LIBS) $(XGL_SYS_LIBS) +Xgl_programs = Xgl +all: all-recursive + +.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/xgl/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign hw/xgl/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) +libxgl.a: $(libxgl_a_OBJECTS) $(libxgl_a_DEPENDENCIES) + -rm -f libxgl.a + $(libxgl_a_AR) libxgl.a $(libxgl_a_OBJECTS) $(libxgl_a_LIBADD) + $(RANLIB) libxgl.a +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + || test -f $$p1 \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +Xgl$(EXEEXT): $(Xgl_OBJECTS) $(Xgl_DEPENDENCIES) + @rm -f Xgl$(EXEEXT) + $(Xgl_LINK) $(Xgl_OBJECTS) $(Xgl_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dpmsstubs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fbcmap.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/miinitext.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stubs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglarea.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglcmap.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglcompose.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglcopy.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglfill.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglgc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglgeometry.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglget.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglglx.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglglyph.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglhash.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglinit.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglinput.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglloader.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xgloutput.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglparse.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglpict.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglpixmap.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglscreen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglshm.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglsolid.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglsync.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xgltile.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xgltrap.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglwindow.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglxv.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 $@ $< + +miinitext.o: $(top_srcdir)/mi/miinitext.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT miinitext.o -MD -MP -MF $(DEPDIR)/miinitext.Tpo -c -o miinitext.o `test -f '$(top_srcdir)/mi/miinitext.c' || echo '$(srcdir)/'`$(top_srcdir)/mi/miinitext.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/miinitext.Tpo $(DEPDIR)/miinitext.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/mi/miinitext.c' object='miinitext.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o miinitext.o `test -f '$(top_srcdir)/mi/miinitext.c' || echo '$(srcdir)/'`$(top_srcdir)/mi/miinitext.c + +miinitext.obj: $(top_srcdir)/mi/miinitext.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT miinitext.obj -MD -MP -MF $(DEPDIR)/miinitext.Tpo -c -o miinitext.obj `if test -f '$(top_srcdir)/mi/miinitext.c'; then $(CYGPATH_W) '$(top_srcdir)/mi/miinitext.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mi/miinitext.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/miinitext.Tpo $(DEPDIR)/miinitext.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/mi/miinitext.c' object='miinitext.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o miinitext.obj `if test -f '$(top_srcdir)/mi/miinitext.c'; then $(CYGPATH_W) '$(top_srcdir)/mi/miinitext.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mi/miinitext.c'; fi` + +dpmsstubs.o: $(top_srcdir)/Xext/dpmsstubs.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dpmsstubs.o -MD -MP -MF $(DEPDIR)/dpmsstubs.Tpo -c -o dpmsstubs.o `test -f '$(top_srcdir)/Xext/dpmsstubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xext/dpmsstubs.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dpmsstubs.Tpo $(DEPDIR)/dpmsstubs.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/Xext/dpmsstubs.c' object='dpmsstubs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dpmsstubs.o `test -f '$(top_srcdir)/Xext/dpmsstubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xext/dpmsstubs.c + +dpmsstubs.obj: $(top_srcdir)/Xext/dpmsstubs.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dpmsstubs.obj -MD -MP -MF $(DEPDIR)/dpmsstubs.Tpo -c -o dpmsstubs.obj `if test -f '$(top_srcdir)/Xext/dpmsstubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xext/dpmsstubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xext/dpmsstubs.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dpmsstubs.Tpo $(DEPDIR)/dpmsstubs.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/Xext/dpmsstubs.c' object='dpmsstubs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dpmsstubs.obj `if test -f '$(top_srcdir)/Xext/dpmsstubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xext/dpmsstubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xext/dpmsstubs.c'; fi` + +stubs.o: $(top_srcdir)/Xi/stubs.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stubs.o -MD -MP -MF $(DEPDIR)/stubs.Tpo -c -o stubs.o `test -f '$(top_srcdir)/Xi/stubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xi/stubs.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/stubs.Tpo $(DEPDIR)/stubs.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/Xi/stubs.c' object='stubs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stubs.o `test -f '$(top_srcdir)/Xi/stubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xi/stubs.c + +stubs.obj: $(top_srcdir)/Xi/stubs.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stubs.obj -MD -MP -MF $(DEPDIR)/stubs.Tpo -c -o stubs.obj `if test -f '$(top_srcdir)/Xi/stubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xi/stubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xi/stubs.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/stubs.Tpo $(DEPDIR)/stubs.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/Xi/stubs.c' object='stubs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stubs.obj `if test -f '$(top_srcdir)/Xi/stubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xi/stubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xi/stubs.c'; fi` + +fbcmap.o: $(top_srcdir)/fb/fbcmap.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT fbcmap.o -MD -MP -MF $(DEPDIR)/fbcmap.Tpo -c -o fbcmap.o `test -f '$(top_srcdir)/fb/fbcmap.c' || echo '$(srcdir)/'`$(top_srcdir)/fb/fbcmap.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/fbcmap.Tpo $(DEPDIR)/fbcmap.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/fb/fbcmap.c' object='fbcmap.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o fbcmap.o `test -f '$(top_srcdir)/fb/fbcmap.c' || echo '$(srcdir)/'`$(top_srcdir)/fb/fbcmap.c + +fbcmap.obj: $(top_srcdir)/fb/fbcmap.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT fbcmap.obj -MD -MP -MF $(DEPDIR)/fbcmap.Tpo -c -o fbcmap.obj `if test -f '$(top_srcdir)/fb/fbcmap.c'; then $(CYGPATH_W) '$(top_srcdir)/fb/fbcmap.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/fb/fbcmap.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/fbcmap.Tpo $(DEPDIR)/fbcmap.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/fb/fbcmap.c' object='fbcmap.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o fbcmap.obj `if test -f '$(top_srcdir)/fb/fbcmap.c'; then $(CYGPATH_W) '$(top_srcdir)/fb/fbcmap.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/fb/fbcmap.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +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: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + 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: ctags-recursive $(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 + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile $(LIBRARIES) $(PROGRAMS) +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +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-recursive + +clean-am: clean-binPROGRAMS clean-generic clean-libtool \ + clean-noinstLIBRARIES mostlyclean-am + +distclean: distclean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-exec-am: install-binPROGRAMS + +install-html: install-html-recursive + +install-info: install-info-recursive + +install-man: + +install-pdf: install-pdf-recursive + +install-ps: install-ps-recursive + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-binPROGRAMS + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ + install-strip + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-libtool clean-noinstLIBRARIES ctags \ + ctags-recursive distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-binPROGRAMS \ + 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 installdirs-am \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ + uninstall-binPROGRAMS + +# 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/xgl/egl/Makefile.am b/xorg-server/hw/xgl/egl/Makefile.am new file mode 100644 index 000000000..8c4e9af75 --- /dev/null +++ b/xorg-server/hw/xgl/egl/Makefile.am @@ -0,0 +1,44 @@ +if XGL +XGL_MODULE_DIRS = module +endif + +DIST_SUBDIRS = module + +SUBDIRS = \ + . \ + $(XGL_MODULE_DIRS) + +AM_CFLAGS = \ + $(DIX_CFLAGS) \ + -DHAVE_XGL_CONFIG_H \ + -DHAVE_DIX_CONFIG_H \ + $(XEGLMODULES_CFLAGS) + +noinst_LTLIBRARIES = libxegl.la + +libxegl_la_SOURCES = \ + xegl.h \ + xegl.c \ + xeglinput.c \ + kkeymap.h \ + kinput.c \ + evdev.c + +XEGL_LIBS = \ + @XEGL_LIBS@ \ + libxegl.la \ + ../libxgl.a \ + $XSERVER_LIBS + +Xegl_LDFLAGS = -export-dynamic +Xegl_SOURCES = \ + xeglinit.c \ + $(top_srcdir)/mi/miinitext.c \ + $(top_srcdir)/Xext/dpmsstubs.c \ + $(top_srcdir)/Xi/stubs.c \ + $(top_srcdir)/fb/fbcmap.c + +Xegl_DEPENDENCIES = $(XEGL_LIBS) +Xegl_LDADD = $(XEGL_LIBS) $(XSERVER_SYS_LIBS) $(XEGL_SYS_LIBS) + +bin_PROGRAMS = Xegl diff --git a/xorg-server/hw/xgl/egl/Makefile.in b/xorg-server/hw/xgl/egl/Makefile.in new file mode 100644 index 000000000..85222bcb4 --- /dev/null +++ b/xorg-server/hw/xgl/egl/Makefile.in @@ -0,0 +1,900 @@ +# 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@ +bin_PROGRAMS = Xegl$(EXEEXT) +subdir = hw/xgl/egl +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 = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libxegl_la_LIBADD = +am_libxegl_la_OBJECTS = xegl.lo xeglinput.lo kinput.lo evdev.lo +libxegl_la_OBJECTS = $(am_libxegl_la_OBJECTS) +am__installdirs = "$(DESTDIR)$(bindir)" +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(bin_PROGRAMS) +am_Xegl_OBJECTS = xeglinit.$(OBJEXT) miinitext.$(OBJEXT) \ + dpmsstubs.$(OBJEXT) stubs.$(OBJEXT) fbcmap.$(OBJEXT) +Xegl_OBJECTS = $(am_Xegl_OBJECTS) +am__DEPENDENCIES_1 = libxegl.la ../libxgl.a $XSERVER_LIBS +am__DEPENDENCIES_2 = +Xegl_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(Xegl_LDFLAGS) \ + $(LDFLAGS) -o $@ +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 = $(libxegl_la_SOURCES) $(Xegl_SOURCES) +DIST_SOURCES = $(libxegl_la_SOURCES) $(Xegl_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +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@ \ + libxegl.la \ + ../libxgl.a \ + $XSERVER_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@ +@XGL_TRUE@XGL_MODULE_DIRS = module +DIST_SUBDIRS = module +SUBDIRS = \ + . \ + $(XGL_MODULE_DIRS) + +AM_CFLAGS = \ + $(DIX_CFLAGS) \ + -DHAVE_XGL_CONFIG_H \ + -DHAVE_DIX_CONFIG_H \ + $(XEGLMODULES_CFLAGS) + +noinst_LTLIBRARIES = libxegl.la +libxegl_la_SOURCES = \ + xegl.h \ + xegl.c \ + xeglinput.c \ + kkeymap.h \ + kinput.c \ + evdev.c + +Xegl_LDFLAGS = -export-dynamic +Xegl_SOURCES = \ + xeglinit.c \ + $(top_srcdir)/mi/miinitext.c \ + $(top_srcdir)/Xext/dpmsstubs.c \ + $(top_srcdir)/Xi/stubs.c \ + $(top_srcdir)/fb/fbcmap.c + +Xegl_DEPENDENCIES = $(XEGL_LIBS) +Xegl_LDADD = $(XEGL_LIBS) $(XSERVER_SYS_LIBS) $(XEGL_SYS_LIBS) +all: all-recursive + +.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/xgl/egl/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign hw/xgl/egl/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-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libxegl.la: $(libxegl_la_OBJECTS) $(libxegl_la_DEPENDENCIES) + $(LINK) $(libxegl_la_OBJECTS) $(libxegl_la_LIBADD) $(LIBS) +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + || test -f $$p1 \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +Xegl$(EXEEXT): $(Xegl_OBJECTS) $(Xegl_DEPENDENCIES) + @rm -f Xegl$(EXEEXT) + $(Xegl_LINK) $(Xegl_OBJECTS) $(Xegl_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dpmsstubs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evdev.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fbcmap.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kinput.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/miinitext.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stubs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xegl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xeglinit.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xeglinput.Plo@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 $@ $< + +miinitext.o: $(top_srcdir)/mi/miinitext.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT miinitext.o -MD -MP -MF $(DEPDIR)/miinitext.Tpo -c -o miinitext.o `test -f '$(top_srcdir)/mi/miinitext.c' || echo '$(srcdir)/'`$(top_srcdir)/mi/miinitext.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/miinitext.Tpo $(DEPDIR)/miinitext.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/mi/miinitext.c' object='miinitext.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o miinitext.o `test -f '$(top_srcdir)/mi/miinitext.c' || echo '$(srcdir)/'`$(top_srcdir)/mi/miinitext.c + +miinitext.obj: $(top_srcdir)/mi/miinitext.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT miinitext.obj -MD -MP -MF $(DEPDIR)/miinitext.Tpo -c -o miinitext.obj `if test -f '$(top_srcdir)/mi/miinitext.c'; then $(CYGPATH_W) '$(top_srcdir)/mi/miinitext.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mi/miinitext.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/miinitext.Tpo $(DEPDIR)/miinitext.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/mi/miinitext.c' object='miinitext.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o miinitext.obj `if test -f '$(top_srcdir)/mi/miinitext.c'; then $(CYGPATH_W) '$(top_srcdir)/mi/miinitext.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mi/miinitext.c'; fi` + +dpmsstubs.o: $(top_srcdir)/Xext/dpmsstubs.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dpmsstubs.o -MD -MP -MF $(DEPDIR)/dpmsstubs.Tpo -c -o dpmsstubs.o `test -f '$(top_srcdir)/Xext/dpmsstubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xext/dpmsstubs.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dpmsstubs.Tpo $(DEPDIR)/dpmsstubs.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/Xext/dpmsstubs.c' object='dpmsstubs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dpmsstubs.o `test -f '$(top_srcdir)/Xext/dpmsstubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xext/dpmsstubs.c + +dpmsstubs.obj: $(top_srcdir)/Xext/dpmsstubs.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dpmsstubs.obj -MD -MP -MF $(DEPDIR)/dpmsstubs.Tpo -c -o dpmsstubs.obj `if test -f '$(top_srcdir)/Xext/dpmsstubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xext/dpmsstubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xext/dpmsstubs.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dpmsstubs.Tpo $(DEPDIR)/dpmsstubs.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/Xext/dpmsstubs.c' object='dpmsstubs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dpmsstubs.obj `if test -f '$(top_srcdir)/Xext/dpmsstubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xext/dpmsstubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xext/dpmsstubs.c'; fi` + +stubs.o: $(top_srcdir)/Xi/stubs.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stubs.o -MD -MP -MF $(DEPDIR)/stubs.Tpo -c -o stubs.o `test -f '$(top_srcdir)/Xi/stubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xi/stubs.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/stubs.Tpo $(DEPDIR)/stubs.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/Xi/stubs.c' object='stubs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stubs.o `test -f '$(top_srcdir)/Xi/stubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xi/stubs.c + +stubs.obj: $(top_srcdir)/Xi/stubs.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stubs.obj -MD -MP -MF $(DEPDIR)/stubs.Tpo -c -o stubs.obj `if test -f '$(top_srcdir)/Xi/stubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xi/stubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xi/stubs.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/stubs.Tpo $(DEPDIR)/stubs.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/Xi/stubs.c' object='stubs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stubs.obj `if test -f '$(top_srcdir)/Xi/stubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xi/stubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xi/stubs.c'; fi` + +fbcmap.o: $(top_srcdir)/fb/fbcmap.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT fbcmap.o -MD -MP -MF $(DEPDIR)/fbcmap.Tpo -c -o fbcmap.o `test -f '$(top_srcdir)/fb/fbcmap.c' || echo '$(srcdir)/'`$(top_srcdir)/fb/fbcmap.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/fbcmap.Tpo $(DEPDIR)/fbcmap.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/fb/fbcmap.c' object='fbcmap.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o fbcmap.o `test -f '$(top_srcdir)/fb/fbcmap.c' || echo '$(srcdir)/'`$(top_srcdir)/fb/fbcmap.c + +fbcmap.obj: $(top_srcdir)/fb/fbcmap.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT fbcmap.obj -MD -MP -MF $(DEPDIR)/fbcmap.Tpo -c -o fbcmap.obj `if test -f '$(top_srcdir)/fb/fbcmap.c'; then $(CYGPATH_W) '$(top_srcdir)/fb/fbcmap.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/fb/fbcmap.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/fbcmap.Tpo $(DEPDIR)/fbcmap.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/fb/fbcmap.c' object='fbcmap.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o fbcmap.obj `if test -f '$(top_srcdir)/fb/fbcmap.c'; then $(CYGPATH_W) '$(top_srcdir)/fb/fbcmap.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/fb/fbcmap.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +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: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + 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: ctags-recursive $(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 + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +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-recursive + +clean-am: clean-binPROGRAMS clean-generic clean-libtool \ + clean-noinstLTLIBRARIES mostlyclean-am + +distclean: distclean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-exec-am: install-binPROGRAMS + +install-html: install-html-recursive + +install-info: install-info-recursive + +install-man: + +install-pdf: install-pdf-recursive + +install-ps: install-ps-recursive + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-binPROGRAMS + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ + install-strip + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-libtool clean-noinstLTLIBRARIES ctags \ + ctags-recursive distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-binPROGRAMS \ + 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 installdirs-am \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ + uninstall-binPROGRAMS + +# 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/xgl/egl/evdev.c b/xorg-server/hw/xgl/egl/evdev.c new file mode 100644 index 000000000..fff4524d1 --- /dev/null +++ b/xorg-server/hw/xgl/egl/evdev.c @@ -0,0 +1,646 @@ +/* + * Copyright © 2004 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#include <xgl-config.h> +#define NEED_EVENTS +#include <errno.h> +#include <linux/input.h> +#include <X11/X.h> +#include <X11/Xproto.h> +#include <X11/Xpoll.h> +#define XK_PUBLISHING +#include <X11/keysym.h> +#include "inputstr.h" +#include "kkeymap.h" +#include "scrnintstr.h" +#include "xegl.h" + +#define NUM_EVENTS 128 +#define ABS_UNSET -65535 + +#define BITS_PER_LONG (sizeof(long) * 8) +#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1) +#define ISBITSET(x,y) ((x)[LONG(y)] & BIT(y)) +#define OFF(x) ((x)%BITS_PER_LONG) +#define LONG(x) ((x)/BITS_PER_LONG) +#define BIT(x) (1 << OFF(x)) +#define SETBIT(x,y) ((x)[LONG(y)] |= BIT(y)) +#define CLRBIT(x,y) ((x)[LONG(y)] &= ~BIT(y)) +#define ASSIGNBIT(x,y,z) ((x)[LONG(y)] = ((x)[LONG(y)] & ~BIT(y)) | (z << OFF(y))) + +typedef struct _kevdevMouse { + /* current device state */ + int rel[REL_MAX + 1]; + int abs[ABS_MAX + 1]; + int prevabs[ABS_MAX + 1]; + long key[NBITS(KEY_MAX + 1)]; + + /* supported device info */ + long relbits[NBITS(REL_MAX + 1)]; + long absbits[NBITS(ABS_MAX + 1)]; + long keybits[NBITS(KEY_MAX + 1)]; + struct input_absinfo absinfo[ABS_MAX + 1]; + int max_rel; + int max_abs; +} Kevdev; + +static int flags = 0; + +static void +EvdevMotion (KdMouseInfo *mi) +{ + Kevdev *ke = mi->driver; + int i; + + for (i = 0; i <= ke->max_rel; i++) + if (ke->rel[i]) + { + KdEnqueueMouseEvent (mi, flags | KD_MOUSE_DELTA, ke->rel[0], ke->rel[1]); + int a; +// ErrorF ("rel"); + for (a = 0; a <= ke->max_rel; a++) + { +// if (ISBITSET (ke->relbits, a)) +// ErrorF (" %d=%d", a, ke->rel[a]); + ke->rel[a] = 0; + } +// ErrorF ("\n"); + break; + } + for (i = 0; i < ke->max_abs; i++) + if (ke->abs[i] != ke->prevabs[i]) + { + KdEnqueueMouseEvent (mi, flags, ke->abs[0], ke->abs[1]); + int a; +// ErrorF ("abs"); + for (a = 0; a <= ke->max_abs; a++) + { +// if (ISBITSET (ke->absbits, a)) +// ErrorF (" %d=%d", a, ke->abs[a]); + ke->prevabs[a] = ke->abs[a]; + } +// ErrorF ("\n"); + break; + } +} + +static void +EvdevRead (int evdevPort, void *closure) +{ + KdMouseInfo *mi = closure; + Kevdev *ke = mi->driver; + int i, n; + struct input_event events[NUM_EVENTS]; + + n = read (evdevPort, &events, NUM_EVENTS * sizeof (struct input_event)); + if (n <= 0) + return; + n /= sizeof (struct input_event); + for (i = 0; i < n; i++) + { + switch (events[i].type) { + case EV_SYN: + break; + case EV_KEY: + EvdevMotion (mi); + ASSIGNBIT(ke->key,events[i].code, events[i].value); + if (events[i].code < 0x100) + ErrorF ("key %d %d\n", events[i].code, events[i].value); + else + ErrorF ("key 0x%x %d\n", events[i].code, events[i].value); + + if (events[i].value==1) { + switch (events[i].code) { + case BTN_LEFT: + flags |= KD_BUTTON_1; + break; + case BTN_RIGHT: + flags |= KD_BUTTON_3; + break; + case BTN_MIDDLE: + flags |= KD_BUTTON_2; + break; + case BTN_FORWARD: + flags |= KD_BUTTON_4; + break; + case BTN_BACK: + flags |= KD_BUTTON_5; + break; + } + } + else if (events[i].value==0) { + switch (events[i].code) { + case BTN_LEFT: + flags &= ~KD_BUTTON_1; + break; + case BTN_RIGHT: + flags &= ~KD_BUTTON_3; + break; + case BTN_MIDDLE: + flags &= ~KD_BUTTON_2; + break; + case BTN_FORWARD: + flags &= ~KD_BUTTON_4; + break; + case BTN_BACK: + flags &= ~KD_BUTTON_5; + break; + } + } + KdEnqueueMouseEvent (mi, KD_MOUSE_DELTA | flags, 0, 0); + break; + case EV_REL: + ke->rel[events[i].code] += events[i].value; + break; + case EV_ABS: + ke->abs[events[i].code] = events[i].value; + break; + } + } + EvdevMotion (mi); +} + +int EvdevInputType; + +char *kdefaultEvdev[] = { + // "/dev/input/event0", + "/dev/input/event1", + // "/dev/input/event2", + // "/dev/input/event3", + // "/dev/input/event4", + // "/dev/input/event5", +}; + +#define NUM_DEFAULT_EVDEV (sizeof (kdefaultEvdev) / sizeof (kdefaultEvdev[0])) + +static Bool +EvdevInit (void) +{ + int i; + int fd; + KdMouseInfo *mi, *next; + int n = 0; + char *prot; + char name[100]; + + if (!EvdevInputType) + EvdevInputType = KdAllocInputType (); + + for (mi = kdMouseInfo; mi; mi = next) + { + next = mi->next; + prot = mi->prot; + if (mi->inputType) + continue; + if (!mi->name) + { + for (i = 0; i < NUM_DEFAULT_EVDEV; i++) + { + fd = open (kdefaultEvdev[i], 2); + if (fd >= 0) + { + ioctl(fd, EVIOCGRAB, 1); + + ioctl(fd, EVIOCGNAME(sizeof(name)), name); + ErrorF("Name is %s\n", name); + ioctl(fd, EVIOCGPHYS(sizeof(name)), name); + ErrorF("Phys Loc is %s\n", name); + ioctl(fd, EVIOCGUNIQ(sizeof(name)), name); + ErrorF("Unique is %s\n", name); + + mi->name = KdSaveString (kdefaultEvdev[i]); + break; + } + } + } + else + fd = open (mi->name, 2); + + if (fd >= 0) + { + unsigned long ev[NBITS(EV_MAX)]; + Kevdev *ke; + + if (ioctl (fd, EVIOCGBIT(0 /*EV*/, sizeof (ev)), ev) < 0) + { + perror ("EVIOCGBIT 0"); + close (fd); + continue; + } + ke = xalloc (sizeof (Kevdev)); + if (!ke) + { + close (fd); + continue; + } + memset (ke, '\0', sizeof (Kevdev)); + if (ISBITSET (ev, EV_KEY)) + { + if (ioctl (fd, EVIOCGBIT (EV_KEY, sizeof (ke->keybits)), + ke->keybits) < 0) + { + perror ("EVIOCGBIT EV_KEY"); + xfree (ke); + close (fd); + continue; + } + } + if (ISBITSET (ev, EV_REL)) + { + if (ioctl (fd, EVIOCGBIT (EV_REL, sizeof (ke->relbits)), + ke->relbits) < 0) + { + perror ("EVIOCGBIT EV_REL"); + xfree (ke); + close (fd); + continue; + } + for (ke->max_rel = REL_MAX; ke->max_rel >= 0; ke->max_rel--) + if (ISBITSET(ke->relbits, ke->max_rel)) + break; + } + if (ISBITSET (ev, EV_ABS)) + { + int i; + + if (ioctl (fd, EVIOCGBIT (EV_ABS, sizeof (ke->absbits)), + ke->absbits) < 0) + { + perror ("EVIOCGBIT EV_ABS"); + xfree (ke); + close (fd); + continue; + } + for (ke->max_abs = ABS_MAX; ke->max_abs >= 0; ke->max_abs--) + if (ISBITSET(ke->absbits, ke->max_abs)) + break; + for (i = 0; i <= ke->max_abs; i++) + { + if (ISBITSET (ke->absbits, i)) + if (ioctl (fd, EVIOCGABS(i), &ke->absinfo[i]) < 0) + { + perror ("EVIOCGABS"); + break; + } + ke->prevabs[i] = ABS_UNSET; + } + if (i <= ke->max_abs) + { + xfree (ke); + close (fd); + continue; + } + } + mi->driver = ke; + mi->inputType = EvdevInputType; + if (KdRegisterFd (EvdevInputType, fd, EvdevRead, (void *) mi)) + n++; + } + } + return TRUE; +} + +static void +EvdevFini (void) +{ + KdMouseInfo *mi; + + KdUnregisterFds (EvdevInputType, TRUE); + for (mi = kdMouseInfo; mi; mi = mi->next) + { + if (mi->inputType == EvdevInputType) + { + xfree (mi->driver); + mi->driver = 0; + mi->inputType = 0; + } + } +} + +KdMouseFuncs LinuxEvdevMouseFuncs = { + EvdevInit, + EvdevFini, +}; + + +KeySym evdevKeymap[(112 - 1 + 1) * 2] = { +/* These are directly mapped from DOS scanset 0 */ +/* 1 8 */ XK_Escape, NoSymbol, +/* 2 9 */ XK_1, XK_exclam, +/* 3 10 */ XK_2, XK_at, +/* 4 11 */ XK_3, XK_numbersign, +/* 5 12 */ XK_4, XK_dollar, +/* 6 13 */ XK_5, XK_percent, +/* 7 14 */ XK_6, XK_asciicircum, +/* 8 15 */ XK_7, XK_ampersand, +/* 9 16 */ XK_8, XK_asterisk, +/* 10 17 */ XK_9, XK_parenleft, +/* 11 18 */ XK_0, XK_parenright, +/* 12 19 */ XK_minus, XK_underscore, +/* 13 20 */ XK_equal, XK_plus, +/* 14 21 */ XK_BackSpace, NoSymbol, +/* 15 22 */ XK_Tab, NoSymbol, +/* 16 23 */ XK_Q, NoSymbol, +/* 17 24 */ XK_W, NoSymbol, +/* 18 25 */ XK_E, NoSymbol, +/* 19 26 */ XK_R, NoSymbol, +/* 20 27 */ XK_T, NoSymbol, +/* 21 28 */ XK_Y, NoSymbol, +/* 22 29 */ XK_U, NoSymbol, +/* 23 30 */ XK_I, NoSymbol, +/* 24 31 */ XK_O, NoSymbol, +/* 25 32 */ XK_P, NoSymbol, +/* 26 33 */ XK_bracketleft, XK_braceleft, +/* 27 34 */ XK_bracketright, XK_braceright, +/* 28 35 */ XK_Return, NoSymbol, +/* 29 36 */ XK_Control_L, NoSymbol, +/* 30 37 */ XK_A, NoSymbol, +/* 31 38 */ XK_S, NoSymbol, +/* 32 39 */ XK_D, NoSymbol, +/* 33 40 */ XK_F, NoSymbol, +/* 34 41 */ XK_G, NoSymbol, +/* 35 42 */ XK_H, NoSymbol, +/* 36 43 */ XK_J, NoSymbol, +/* 37 44 */ XK_K, NoSymbol, +/* 38 45 */ XK_L, NoSymbol, +/* 39 46 */ XK_semicolon, XK_colon, +/* 40 47 */ XK_apostrophe, XK_quotedbl, +/* 41 48 */ XK_grave, XK_asciitilde, +/* 42 49 */ XK_Shift_L, NoSymbol, +/* 43 50 */ XK_backslash, XK_bar, +/* 44 51 */ XK_Z, NoSymbol, +/* 45 52 */ XK_X, NoSymbol, +/* 46 53 */ XK_C, NoSymbol, +/* 47 54 */ XK_V, NoSymbol, +/* 48 55 */ XK_B, NoSymbol, +/* 49 56 */ XK_N, NoSymbol, +/* 50 57 */ XK_M, NoSymbol, +/* 51 58 */ XK_comma, XK_less, +/* 52 59 */ XK_period, XK_greater, +/* 53 60 */ XK_slash, XK_question, +/* 54 61 */ XK_Shift_R, NoSymbol, +/* 55 62 */ XK_KP_Multiply, NoSymbol, +/* 56 63 */ XK_Alt_L, XK_Meta_L, +/* 57 64 */ XK_space, NoSymbol, +/* 58 65 */ XK_Caps_Lock, NoSymbol, +/* 59 66 */ XK_F1, NoSymbol, +/* 60 67 */ XK_F2, NoSymbol, +/* 61 68 */ XK_F3, NoSymbol, +/* 62 69 */ XK_F4, NoSymbol, +/* 63 70 */ XK_F5, NoSymbol, +/* 64 71 */ XK_F6, NoSymbol, +/* 65 72 */ XK_F7, NoSymbol, +/* 66 73 */ XK_F8, NoSymbol, +/* 67 74 */ XK_F9, NoSymbol, +/* 68 75 */ XK_F10, NoSymbol, +/* 69 76 */ XK_Break, XK_Pause, +/* 70 77 */ XK_Scroll_Lock, NoSymbol, +/* 71 78 */ XK_KP_Home, XK_KP_7, +/* 72 79 */ XK_KP_Up, XK_KP_8, +/* 73 80 */ XK_KP_Page_Up, XK_KP_9, +/* 74 81 */ XK_KP_Subtract, NoSymbol, +/* 75 82 */ XK_KP_Left, XK_KP_4, +/* 76 83 */ XK_KP_5, NoSymbol, +/* 77 84 */ XK_KP_Right, XK_KP_6, +/* 78 85 */ XK_KP_Add, NoSymbol, +/* 79 86 */ XK_KP_End, XK_KP_1, +/* 80 87 */ XK_KP_Down, XK_KP_2, +/* 81 88 */ XK_KP_Page_Down, XK_KP_3, +/* 82 89 */ XK_KP_Insert, XK_KP_0, +/* 83 90 */ XK_KP_Delete, XK_KP_Decimal, +/* 84 91 */ NoSymbol, NoSymbol, +/* 85 92 */ NoSymbol, NoSymbol, +/* 86 93 */ NoSymbol, NoSymbol, +/* 87 94 */ XK_F11, NoSymbol, +/* 88 95 */ XK_F12, NoSymbol, + +/* These are remapped from the extended set (using ExtendMap) */ + +/* 89 96 */ XK_Control_R, NoSymbol, +/* 90 97 */ XK_KP_Enter, NoSymbol, +/* 91 98 */ XK_KP_Divide, NoSymbol, +/* 92 99 */ XK_Sys_Req, XK_Print, +/* 93 100 */ XK_Alt_R, XK_Meta_R, +/* 94 101 */ XK_Num_Lock, NoSymbol, +/* 95 102 */ XK_Home, NoSymbol, +/* 96 103 */ XK_Up, NoSymbol, +/* 97 104 */ XK_Page_Up, NoSymbol, +/* 98 105 */ XK_Left, NoSymbol, +/* 99 106 */ XK_Right, NoSymbol, +/* 100 107 */ XK_End, NoSymbol, +/* 101 108 */ XK_Down, NoSymbol, +/* 102 109 */ XK_Page_Down, NoSymbol, +/* 103 110 */ XK_Insert, NoSymbol, +/* 104 111 */ XK_Delete, NoSymbol, +/* 105 112 */ XK_Super_L, NoSymbol, +/* 106 113 */ XK_Super_R, NoSymbol, +/* 107 114 */ XK_Menu, NoSymbol, +/* 108 115 */ NoSymbol, NoSymbol, +/* 109 116 */ NoSymbol, NoSymbol, +/* 110 117 */ NoSymbol, NoSymbol, +/* 111 118 */ NoSymbol, NoSymbol, +/* 112 119 */ NoSymbol, NoSymbol, +}; + +static void +EvdevRead1 (int evdevPort, void *closure) +{ + int i, n, xk; + struct input_event events[NUM_EVENTS]; + + n = read (evdevPort, &events, NUM_EVENTS * sizeof (struct input_event)); + if (n <= 0) + return; + n /= sizeof (struct input_event); + for (i = 0; i < n; i++) + { + switch (events[i].type) { + case EV_SYN: + break; + case EV_KEY: + xk = events[i].code; + if (events[i].code < 0x100) + ErrorF ("key %d %d xk %d\n", events[i].code, events[i].value, xk); + else + ErrorF ("key 0x%x %d xk %d\n", events[i].code, events[i].value, xk); + if (events[i].value == 2) { + //KdEnqueueKeyboardEvent (xk, 0); + KdEnqueueKeyboardEvent (xk, 0); + } else + KdEnqueueKeyboardEvent (xk, !events[i].value); + break; + } + } +} + +char *kdefaultEvdev1[] = { + "/dev/input/event0", + // "/dev/input/event1", + // "/dev/input/event2", + // "/dev/input/event3", + // "/dev/input/event4", + // "/dev/input/event5", +}; + +#define NUM_DEFAULT_EVDEV1 (sizeof (kdefaultEvdev1) / sizeof (kdefaultEvdev1[0])) + +static Bool +EvdevKbdInit (void) +{ + int i; + int fd; + int n = 0; + char name[100]; + + if (!EvdevInputType) + EvdevInputType = KdAllocInputType (); + + for (i = 0; i < NUM_DEFAULT_EVDEV; i++) + { + fd = open (kdefaultEvdev1[i], 2); + if (fd >= 0) + { + ioctl(fd, EVIOCGRAB, 1); + + ioctl(fd, EVIOCGNAME(sizeof(name)), name); + ErrorF("Name is %s\n", name); + ioctl(fd, EVIOCGPHYS(sizeof(name)), name); + ErrorF("Phys Loc is %s\n", name); + ioctl(fd, EVIOCGUNIQ(sizeof(name)), name); + ErrorF("Unique is %s\n", name); + + } + + if (fd >= 0) + { + unsigned long ev[NBITS(EV_MAX)]; + Kevdev *ke; + + if (ioctl (fd, EVIOCGBIT(0 /*EV*/, sizeof (ev)), ev) < 0) + { + perror ("EVIOCGBIT 0"); + close (fd); + continue; + } + ke = xalloc (sizeof (Kevdev)); + if (!ke) + { + close (fd); + continue; + } + memset (ke, '\0', sizeof (Kevdev)); + if (ISBITSET (ev, EV_KEY)) + { + if (ioctl (fd, EVIOCGBIT (EV_KEY, sizeof (ke->keybits)), + ke->keybits) < 0) + { + perror ("EVIOCGBIT EV_KEY"); + xfree (ke); + close (fd); + continue; + } + } + if (ISBITSET (ev, EV_REL)) + { + if (ioctl (fd, EVIOCGBIT (EV_REL, sizeof (ke->relbits)), + ke->relbits) < 0) + { + perror ("EVIOCGBIT EV_REL"); + xfree (ke); + close (fd); + continue; + } + for (ke->max_rel = REL_MAX; ke->max_rel >= 0; ke->max_rel--) + if (ISBITSET(ke->relbits, ke->max_rel)) + break; + } + if (ISBITSET (ev, EV_ABS)) + { + int i; + + if (ioctl (fd, EVIOCGBIT (EV_ABS, sizeof (ke->absbits)), + ke->absbits) < 0) + { + perror ("EVIOCGBIT EV_ABS"); + xfree (ke); + close (fd); + continue; + } + for (ke->max_abs = ABS_MAX; ke->max_abs >= 0; ke->max_abs--) + if (ISBITSET(ke->absbits, ke->max_abs)) + break; + for (i = 0; i <= ke->max_abs; i++) + { + if (ISBITSET (ke->absbits, i)) + if (ioctl (fd, EVIOCGABS(i), &ke->absinfo[i]) < 0) + { + perror ("EVIOCGABS"); + break; + } + ke->prevabs[i] = ABS_UNSET; + } + if (i <= ke->max_abs) + { + xfree (ke); + close (fd); + continue; + } + } + if (KdRegisterFd (EvdevInputType, fd, EvdevRead1, NULL)) + n++; + } + } + return TRUE; +} + +static void EvdevKbdLoad(void) +{ + kdMinScanCode = 1; + kdMaxScanCode = 112; + kdKeymapWidth = 2; + memcpy (kdKeymap, evdevKeymap, sizeof (evdevKeymap)); +} + +static void +EvdevKbdFini (void) +{ +} + +static void +EvdevKbdLeds (int leds) +{ +} + + +static void EvdevKbdBell(int volume, int pitch, int duration) +{ +} + + +KdKeyboardFuncs LinuxEvdevKeyboardFuncs = { + EvdevKbdLoad, + EvdevKbdInit, + EvdevKbdLeds, + EvdevKbdBell, + EvdevKbdFini, + 0, +}; diff --git a/xorg-server/hw/xgl/egl/kinput.c b/xorg-server/hw/xgl/egl/kinput.c new file mode 100644 index 000000000..774e00eb5 --- /dev/null +++ b/xorg-server/hw/xgl/egl/kinput.c @@ -0,0 +1,1672 @@ +/* + * Copyright 1999 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#include <xgl-config.h> + +#include <signal.h> +#include <stdio.h> + +#include "xegl.h" +#include "mipointer.h" +#include "inputstr.h" + +#define XK_PUBLISHING +#include <X11/keysym.h> +#if HAVE_X11_XF86KEYSYM_H +#include <X11/XF86keysym.h> +#endif +#include "kkeymap.h" + +#ifdef XKB +#define XKB_IN_SERVER +#include <xkbsrv.h> +#endif + +static DeviceIntPtr pKdKeyboard, pKdPointer; + +#define MAX_MOUSE_DRIVERS 6 + +static KdMouseFuncs *kdMouseFuncs[MAX_MOUSE_DRIVERS]; +static int kdNMouseFuncs; +static KdKeyboardFuncs *kdKeyboardFuncs; +static int kdBellPitch; +static int kdBellDuration; +static int kdLeds; +static Bool kdInputEnabled; +static Bool kdOffScreen; +static unsigned long kdOffScreenTime; +static KdMouseMatrix kdMouseMatrix = { + { { 1, 0, 0 }, + { 0, 1, 0 } } +}; + +int kdMouseButtonCount; +int kdMinScanCode; +int kdMaxScanCode; +int kdMinKeyCode; +int kdMaxKeyCode; +int kdKeymapWidth = KD_MAX_WIDTH; +KeySym kdKeymap[KD_MAX_LENGTH * KD_MAX_WIDTH]; +CARD8 kdModMap[MAP_LENGTH]; +KeySymsRec kdKeySyms; + + +void +KdResetInputMachine (void); + +#define KD_KEY_COUNT 248 + +CARD8 kdKeyState[KD_KEY_COUNT/8]; + +#define IsKeyDown(key) ((kdKeyState[(key) >> 3] >> ((key) & 7)) & 1) + +#define KD_MAX_INPUT_FDS 8 + +typedef struct _kdInputFd { + int type; + int fd; + void (*read) (int fd, void *closure); + int (*enable) (int fd, void *closure); + void (*disable) (int fd, void *closure); + void *closure; +} KdInputFd; + +KdInputFd kdInputFds[KD_MAX_INPUT_FDS]; +int kdNumInputFds; +int kdInputTypeSequence; + +static void +KdSigio (int sig) +{ + int i; + + for (i = 0; i < kdNumInputFds; i++) + (*kdInputFds[i].read) (kdInputFds[i].fd, kdInputFds[i].closure); +} + +static void +KdBlockSigio (void) +{ + sigset_t set; + + sigemptyset (&set); + sigaddset (&set, SIGIO); + sigprocmask (SIG_BLOCK, &set, 0); +} + +static void +KdUnblockSigio (void) +{ + sigset_t set; + + sigemptyset (&set); + sigaddset (&set, SIGIO); + sigprocmask (SIG_UNBLOCK, &set, 0); +} + +#undef VERIFY_SIGIO +#ifdef VERIFY_SIGIO + +void +KdAssertSigioBlocked (char *where) +{ + sigset_t set, old; + + sigemptyset (&set); + sigprocmask (SIG_BLOCK, &set, &old); + if (!sigismember (&old, SIGIO)) + ErrorF ("SIGIO not blocked at %s\n", where); +} + +#else + +#define KdAssertSigioBlocked(s) + +#endif + +static int kdnFds; + +#ifdef FNONBLOCK +#define NOBLOCK FNONBLOCK +#else +#define NOBLOCK FNDELAY +#endif + +static void +KdNonBlockFd (int fd) +{ + int flags; + flags = fcntl (fd, F_GETFL); + flags |= FASYNC|NOBLOCK; + fcntl (fd, F_SETFL, flags); +} + +static void +KdAddFd (int fd) +{ + struct sigaction act; + sigset_t set; + + kdnFds++; + fcntl (fd, F_SETOWN, getpid()); + KdNonBlockFd (fd); + AddEnabledDevice (fd); + memset (&act, '\0', sizeof act); + act.sa_handler = KdSigio; + sigemptyset (&act.sa_mask); + sigaddset (&act.sa_mask, SIGIO); + sigaddset (&act.sa_mask, SIGALRM); + sigaddset (&act.sa_mask, SIGVTALRM); + sigaction (SIGIO, &act, 0); + sigemptyset (&set); + sigprocmask (SIG_SETMASK, &set, 0); +} + +static void +KdRemoveFd (int fd) +{ + struct sigaction act; + int flags; + + kdnFds--; + RemoveEnabledDevice (fd); + flags = fcntl (fd, F_GETFL); + flags &= ~(FASYNC|NOBLOCK); + fcntl (fd, F_SETFL, flags); + if (kdnFds == 0) + { + memset (&act, '\0', sizeof act); + act.sa_handler = SIG_IGN; + sigemptyset (&act.sa_mask); + sigaction (SIGIO, &act, 0); + } +} + +int +KdAllocInputType (void) +{ + return ++kdInputTypeSequence; +} + +Bool +KdRegisterFd (int type, int fd, void (*read) (int fd, void *closure), void *closure) +{ + if (kdNumInputFds == KD_MAX_INPUT_FDS) + return FALSE; + kdInputFds[kdNumInputFds].type = type; + kdInputFds[kdNumInputFds].fd = fd; + kdInputFds[kdNumInputFds].read = read; + kdInputFds[kdNumInputFds].enable = 0; + kdInputFds[kdNumInputFds].disable = 0; + kdInputFds[kdNumInputFds].closure = closure; + ++kdNumInputFds; + if (kdInputEnabled) + KdAddFd (fd); + return TRUE; +} + +void +KdRegisterFdEnableDisable (int fd, + int (*enable) (int fd, void *closure), + void (*disable) (int fd, void *closure)) +{ + int i; + + for (i = 0; i < kdNumInputFds; i++) + if (kdInputFds[i].fd == fd) + { + kdInputFds[i].enable = enable; + kdInputFds[i].disable = disable; + break; + } +} + +void +KdUnregisterFds (int type, Bool do_close) +{ + int i, j; + + for (i = 0; i < kdNumInputFds;) + { + if (kdInputFds[i].type == type) + { + if (kdInputEnabled) + KdRemoveFd (kdInputFds[i].fd); + if (do_close) + close (kdInputFds[i].fd); + --kdNumInputFds; + for (j = i; j < kdNumInputFds; j++) + kdInputFds[j] = kdInputFds[j+1]; + } + else + i++; + } +} + +static void +KdDisableInput (void) +{ + int i; + + KdBlockSigio (); + + for (i = 0; i < kdNumInputFds; i++) + { + KdRemoveFd (kdInputFds[i].fd); + if (kdInputFds[i].disable) + (*kdInputFds[i].disable) (kdInputFds[i].fd, kdInputFds[i].closure); + } + kdInputEnabled = FALSE; +} + +static void +KdEnableInput (void) +{ + xEvent xE; + int i; + + kdInputEnabled = TRUE; + for (i = 0; i < kdNumInputFds; i++) + { + KdNonBlockFd (kdInputFds[i].fd); + if (kdInputFds[i].enable) + kdInputFds[i].fd = (*kdInputFds[i].enable) (kdInputFds[i].fd, kdInputFds[i].closure); + KdAddFd (kdInputFds[i].fd); + } + + /* reset screen saver */ + xE.u.keyButtonPointer.time = GetTimeInMillis (); + NoticeEventTime (&xE); + + KdUnblockSigio (); +} + +static int +KdMouseProc(DeviceIntPtr pDevice, int onoff) +{ + BYTE map[KD_MAX_BUTTON]; + DevicePtr pDev = (DevicePtr)pDevice; + int i; + + if (!pDev) + return BadImplementation; + + switch (onoff) + { + case DEVICE_INIT: + for (i = 1; i <= kdMouseButtonCount; i++) + map[i] = i; + InitPointerDeviceStruct(pDev, map, kdMouseButtonCount, + miPointerGetMotionEvents, + (PtrCtrlProcPtr)NoopDDA, + miPointerGetMotionBufferSize()); + break; + + case DEVICE_ON: + pDev->on = TRUE; + pKdPointer = pDevice; + for (i = 0; i < kdNMouseFuncs; i++) + (*kdMouseFuncs[i]->Init)(); + break; + case DEVICE_OFF: + case DEVICE_CLOSE: + if (pDev->on) + { + pDev->on = FALSE; + pKdPointer = 0; + for (i = 0; i < kdNMouseFuncs; i++) + (*kdMouseFuncs[i]->Fini) (); + } + break; + } + return Success; +} + +Bool +KdLegalModifier(unsigned int key, DevicePtr pDev) +{ + return TRUE; +} + +static void +KdBell (int volume, DeviceIntPtr pDev, pointer ctrl, int something) +{ + if (kdInputEnabled) + (*kdKeyboardFuncs->Bell) (volume, kdBellPitch, kdBellDuration); +} + + +static void +KdSetLeds (void) +{ + if (kdInputEnabled) + (*kdKeyboardFuncs->Leds) (kdLeds); +} + +static void +KdSetLed (int led, Bool on) +{ + NoteLedState (pKdKeyboard, led, on); + kdLeds = pKdKeyboard->kbdfeed->ctrl.leds; + KdSetLeds (); +} + +static void +KdSetMouseMatrix (KdMouseMatrix *matrix) +{ + kdMouseMatrix = *matrix; +} + +static void +KdComputeMouseMatrix (KdMouseMatrix *m, Rotation randr, int width, int height) +{ + int x_dir = 1, y_dir = 1; + int i, j; + int size[2]; + + size[0] = width; size[1] = height; + if (randr & RR_Reflect_X) + x_dir = -1; + if (randr & RR_Reflect_Y) + y_dir = -1; + switch (randr & (RR_Rotate_All)) { + case RR_Rotate_0: + m->matrix[0][0] = x_dir; m->matrix[0][1] = 0; + m->matrix[1][0] = 0; m->matrix[1][1] = y_dir; + break; + case RR_Rotate_90: + m->matrix[0][0] = 0; m->matrix[0][1] = -x_dir; + m->matrix[1][0] = y_dir; m->matrix[1][1] = 0; + break; + case RR_Rotate_180: + m->matrix[0][0] = -x_dir; m->matrix[0][1] = 0; + m->matrix[1][0] = 0; m->matrix[1][1] = -y_dir; + break; + case RR_Rotate_270: + m->matrix[0][0] = 0; m->matrix[0][1] = x_dir; + m->matrix[1][0] = -y_dir; m->matrix[1][1] = 0; + break; + } + for (i = 0; i < 2; i++) + { + m->matrix[i][2] = 0; + for (j = 0 ; j < 2; j++) + if (m->matrix[i][j] < 0) + m->matrix[i][2] = size[j] - 1; + } +} + +static void +KdKbdCtrl (DeviceIntPtr pDevice, KeybdCtrl *ctrl) +{ + kdLeds = ctrl->leds; + kdBellPitch = ctrl->bell_pitch; + kdBellDuration = ctrl->bell_duration; + KdSetLeds (); +} + +static int +KdKeybdProc(DeviceIntPtr pDevice, int onoff) +{ + Bool ret; + DevicePtr pDev = (DevicePtr)pDevice; +#ifdef XKB + XkbComponentNamesRec names; +#endif + + if (!pDev) + return BadImplementation; + + switch (onoff) + { + case DEVICE_INIT: + if (pDev != (DevicePtr)inputInfo.keyboard) + { + return !Success; + } +#ifndef XKB + ret = InitKeyboardDeviceStruct(pDev, + &kdKeySyms, + kdModMap, + KdBell, KdKbdCtrl); +#else + memset(&names, 0, sizeof(XkbComponentNamesRec)); + + XkbSetRulesDflts ("base", "pc101", "us", NULL, NULL); + ret = XkbInitKeyboardDeviceStruct (pDev, + &names, + &kdKeySyms, + kdModMap, + KdBell, KdKbdCtrl); +#endif + if (!ret) + return BadImplementation; + break; + case DEVICE_ON: + pDev->on = TRUE; + pKdKeyboard = pDevice; + if (kdKeyboardFuncs) + (*kdKeyboardFuncs->Init) (); + break; + case DEVICE_OFF: + case DEVICE_CLOSE: + pKdKeyboard = 0; + if (pDev->on) + { + pDev->on = FALSE; + if (kdKeyboardFuncs) + (*kdKeyboardFuncs->Fini) (); + } + break; + } + return Success; +} + +extern KeybdCtrl defaultKeyboardControl; + +static void +KdInitAutoRepeats (void) +{ + int key_code; + unsigned char mask; + int i; + unsigned char *repeats; + + repeats = defaultKeyboardControl.autoRepeats; + memset (repeats, '\0', 32); + for (key_code = KD_MIN_KEYCODE; key_code <= KD_MAX_KEYCODE; key_code++) + { + if (!kdModMap[key_code]) + { + i = key_code >> 3; + mask = 1 << (key_code & 7); + repeats[i] |= mask; + } + } +} + +const KdKeySymModsRec kdKeySymMods[] = { + { XK_Control_L, ControlMask }, + { XK_Control_R, ControlMask }, + { XK_Shift_L, ShiftMask }, + { XK_Shift_R, ShiftMask }, + { XK_Caps_Lock, LockMask }, + { XK_Shift_Lock, LockMask }, + { XK_Alt_L, Mod1Mask }, + { XK_Alt_R, Mod1Mask }, + { XK_Meta_L, Mod1Mask }, + { XK_Meta_R, Mod1Mask }, + { XK_Num_Lock, Mod2Mask }, + { XK_Super_L, Mod3Mask }, + { XK_Super_R, Mod3Mask }, + { XK_Hyper_L, Mod3Mask }, + { XK_Hyper_R, Mod3Mask }, + { XK_Mode_switch, Mod4Mask }, +#ifdef TOUCHSCREEN + /* PDA specific hacks */ +#ifdef XF86XK_Start + { XF86XK_Start, ControlMask }, +#endif + { XK_Menu, ShiftMask }, + { XK_telephone, Mod1Mask }, +#ifdef XF86XK_AudioRecord + { XF86XK_AudioRecord, Mod2Mask }, +#endif +#ifdef XF86XK_Calendar + { XF86XK_Calendar, Mod3Mask } +#endif +#endif +}; + +#define NUM_SYM_MODS (sizeof(kdKeySymMods) / sizeof(kdKeySymMods[0])) + +static void +KdInitModMap (void) +{ + int key_code; + int row; + int width; + KeySym *syms; + int i; + + width = kdKeySyms.mapWidth; + for (key_code = kdMinKeyCode; key_code <= kdMaxKeyCode; key_code++) + { + kdModMap[key_code] = 0; + syms = kdKeymap + (key_code - kdMinKeyCode) * width; + for (row = 0; row < width; row++, syms++) + { + for (i = 0; i < NUM_SYM_MODS; i++) + { + if (*syms == kdKeySymMods[i].modsym) + kdModMap[key_code] |= kdKeySymMods[i].modbit; + } + } + } +} + +static void +KdAddMouseDriver(KdMouseFuncs *pMouseFuncs) +{ + if (kdNMouseFuncs < MAX_MOUSE_DRIVERS) + kdMouseFuncs[kdNMouseFuncs++] = pMouseFuncs; +} + +void +eglInitInput(KdMouseFuncs *pMouseFuncs, + KdKeyboardFuncs *pKeyboardFuncs) +{ + DeviceIntPtr pKeyboard, pPointer; + KdMouseInfo *mi; + + if (!kdMouseInfo) + KdParseMouse (0); + kdMouseButtonCount = 0; + for (mi = kdMouseInfo; mi; mi = mi->next) + { + if (mi->nbutton > kdMouseButtonCount) + kdMouseButtonCount = mi->nbutton; + } + + kdNMouseFuncs = 0; + KdAddMouseDriver (pMouseFuncs); + kdKeyboardFuncs = pKeyboardFuncs; + memset (kdKeyState, '\0', sizeof (kdKeyState)); + if (kdKeyboardFuncs) + (*kdKeyboardFuncs->Load) (); + kdMinKeyCode = kdMinScanCode + KD_KEY_OFFSET; + kdMaxKeyCode = kdMaxScanCode + KD_KEY_OFFSET; + kdKeySyms.map = kdKeymap; + kdKeySyms.minKeyCode = kdMinKeyCode; + kdKeySyms.maxKeyCode = kdMaxKeyCode; + kdKeySyms.mapWidth = kdKeymapWidth; + kdLeds = 0; + kdBellPitch = 1000; + kdBellDuration = 200; + kdInputEnabled = TRUE; + KdInitModMap (); + KdInitAutoRepeats (); + KdResetInputMachine (); + pPointer = AddInputDevice(KdMouseProc, TRUE); + pKeyboard = AddInputDevice(KdKeybdProc, TRUE); + RegisterPointerDevice(pPointer); + RegisterKeyboardDevice(pKeyboard); + miRegisterPointerDevice(screenInfo.screens[0], pPointer); + mieqInit(&pKeyboard->public, &pPointer->public); +#ifdef XINPUT + { + static long zero1, zero2; + + //SetExtInputCheck (&zero1, &zero2); + ErrorF("Extended Input Devices not yet supported. Impelement it at line %d in %s\n", + __LINE__, __FILE__); + } +#endif +} + +/* + * Middle button emulation state machine + * + * Possible transitions: + * Button 1 press v1 + * Button 1 release ^1 + * Button 2 press v2 + * Button 2 release ^2 + * Button 3 press v3 + * Button 3 release ^3 + * Button other press vo + * Button other release ^o + * Mouse motion <> + * Keyboard event k + * timeout ... + * outside box <-> + * + * States: + * start + * button_1_pend + * button_1_down + * button_2_down + * button_3_pend + * button_3_down + * synthetic_2_down_13 + * synthetic_2_down_3 + * synthetic_2_down_1 + * + * Transition diagram + * + * start + * v1 -> (hold) (settimeout) button_1_pend + * ^1 -> (deliver) start + * v2 -> (deliver) button_2_down + * ^2 -> (deliever) start + * v3 -> (hold) (settimeout) button_3_pend + * ^3 -> (deliver) start + * vo -> (deliver) start + * ^o -> (deliver) start + * <> -> (deliver) start + * k -> (deliver) start + * + * button_1_pend (button 1 is down, timeout pending) + * ^1 -> (release) (deliver) start + * v2 -> (release) (deliver) button_1_down + * ^2 -> (release) (deliver) button_1_down + * v3 -> (cleartimeout) (generate v2) synthetic_2_down_13 + * ^3 -> (release) (deliver) button_1_down + * vo -> (release) (deliver) button_1_down + * ^o -> (release) (deliver) button_1_down + * <-> -> (release) (deliver) button_1_down + * <> -> (deliver) button_1_pend + * k -> (release) (deliver) button_1_down + * ... -> (release) button_1_down + * + * button_1_down (button 1 is down) + * ^1 -> (deliver) start + * v2 -> (deliver) button_1_down + * ^2 -> (deliver) button_1_down + * v3 -> (deliver) button_1_down + * ^3 -> (deliver) button_1_down + * vo -> (deliver) button_1_down + * ^o -> (deliver) button_1_down + * <> -> (deliver) button_1_down + * k -> (deliver) button_1_down + * + * button_2_down (button 2 is down) + * v1 -> (deliver) button_2_down + * ^1 -> (deliver) button_2_down + * ^2 -> (deliver) start + * v3 -> (deliver) button_2_down + * ^3 -> (deliver) button_2_down + * vo -> (deliver) button_2_down + * ^o -> (deliver) button_2_down + * <> -> (deliver) button_2_down + * k -> (deliver) button_2_down + * + * button_3_pend (button 3 is down, timeout pending) + * v1 -> (generate v2) synthetic_2_down + * ^1 -> (release) (deliver) button_3_down + * v2 -> (release) (deliver) button_3_down + * ^2 -> (release) (deliver) button_3_down + * ^3 -> (release) (deliver) start + * vo -> (release) (deliver) button_3_down + * ^o -> (release) (deliver) button_3_down + * <-> -> (release) (deliver) button_3_down + * <> -> (deliver) button_3_pend + * k -> (release) (deliver) button_3_down + * ... -> (release) button_3_down + * + * button_3_down (button 3 is down) + * v1 -> (deliver) button_3_down + * ^1 -> (deliver) button_3_down + * v2 -> (deliver) button_3_down + * ^2 -> (deliver) button_3_down + * ^3 -> (deliver) start + * vo -> (deliver) button_3_down + * ^o -> (deliver) button_3_down + * <> -> (deliver) button_3_down + * k -> (deliver) button_3_down + * + * synthetic_2_down_13 (button 1 and 3 are down) + * ^1 -> (generate ^2) synthetic_2_down_3 + * v2 -> synthetic_2_down_13 + * ^2 -> synthetic_2_down_13 + * ^3 -> (generate ^2) synthetic_2_down_1 + * vo -> (deliver) synthetic_2_down_13 + * ^o -> (deliver) synthetic_2_down_13 + * <> -> (deliver) synthetic_2_down_13 + * k -> (deliver) synthetic_2_down_13 + * + * synthetic_2_down_3 (button 3 is down) + * v1 -> (deliver) synthetic_2_down_3 + * ^1 -> (deliver) synthetic_2_down_3 + * v2 -> synthetic_2_down_3 + * ^2 -> synthetic_2_down_3 + * ^3 -> start + * vo -> (deliver) synthetic_2_down_3 + * ^o -> (deliver) synthetic_2_down_3 + * <> -> (deliver) synthetic_2_down_3 + * k -> (deliver) synthetic_2_down_3 + * + * synthetic_2_down_1 (button 1 is down) + * ^1 -> start + * v2 -> synthetic_2_down_1 + * ^2 -> synthetic_2_down_1 + * v3 -> (deliver) synthetic_2_down_1 + * ^3 -> (deliver) synthetic_2_down_1 + * vo -> (deliver) synthetic_2_down_1 + * ^o -> (deliver) synthetic_2_down_1 + * <> -> (deliver) synthetic_2_down_1 + * k -> (deliver) synthetic_2_down_1 + */ + +typedef enum _inputClass { + down_1, up_1, + down_2, up_2, + down_3, up_3, + down_o, up_o, + motion, outside_box, + keyboard, timeout, + num_input_class +} KdInputClass; + +typedef enum _inputAction { + noop, + hold, + setto, + deliver, + release, + clearto, + gen_down_2, + gen_up_2 +} KdInputAction; + +#define MAX_ACTIONS 2 + +typedef struct _inputTransition { + KdInputAction actions[MAX_ACTIONS]; + KdMouseState nextState; +} KdInputTransition; + +KdInputTransition kdInputMachine[num_input_states][num_input_class] = { + /* start */ + { + { { hold, setto }, button_1_pend }, /* v1 */ + { { deliver, noop }, start }, /* ^1 */ + { { deliver, noop }, button_2_down }, /* v2 */ + { { deliver, noop }, start }, /* ^2 */ + { { hold, setto }, button_3_pend }, /* v3 */ + { { deliver, noop }, start }, /* ^3 */ + { { deliver, noop }, start }, /* vo */ + { { deliver, noop }, start }, /* ^o */ + { { deliver, noop }, start }, /* <> */ + { { deliver, noop }, start }, /* <-> */ + { { noop, noop }, start }, /* k */ + { { noop, noop }, start }, /* ... */ + }, + /* button_1_pend */ + { + { { noop, noop }, button_1_pend }, /* v1 */ + { { release, deliver }, start }, /* ^1 */ + { { release, deliver }, button_1_down }, /* v2 */ + { { release, deliver }, button_1_down }, /* ^2 */ + { { clearto, gen_down_2 }, synth_2_down_13 }, /* v3 */ + { { release, deliver }, button_1_down }, /* ^3 */ + { { release, deliver }, button_1_down }, /* vo */ + { { release, deliver }, button_1_down }, /* ^o */ + { { deliver, noop }, button_1_pend }, /* <> */ + { { release, deliver }, button_1_down }, /* <-> */ + { { noop, noop }, button_1_down }, /* k */ + { { release, noop }, button_1_down }, /* ... */ + }, + /* button_1_down */ + { + { { noop, noop }, button_1_down }, /* v1 */ + { { deliver, noop }, start }, /* ^1 */ + { { deliver, noop }, button_1_down }, /* v2 */ + { { deliver, noop }, button_1_down }, /* ^2 */ + { { deliver, noop }, button_1_down }, /* v3 */ + { { deliver, noop }, button_1_down }, /* ^3 */ + { { deliver, noop }, button_1_down }, /* vo */ + { { deliver, noop }, button_1_down }, /* ^o */ + { { deliver, noop }, button_1_down }, /* <> */ + { { deliver, noop }, button_1_down }, /* <-> */ + { { noop, noop }, button_1_down }, /* k */ + { { noop, noop }, button_1_down }, /* ... */ + }, + /* button_2_down */ + { + { { deliver, noop }, button_2_down }, /* v1 */ + { { deliver, noop }, button_2_down }, /* ^1 */ + { { noop, noop }, button_2_down }, /* v2 */ + { { deliver, noop }, start }, /* ^2 */ + { { deliver, noop }, button_2_down }, /* v3 */ + { { deliver, noop }, button_2_down }, /* ^3 */ + { { deliver, noop }, button_2_down }, /* vo */ + { { deliver, noop }, button_2_down }, /* ^o */ + { { deliver, noop }, button_2_down }, /* <> */ + { { deliver, noop }, button_2_down }, /* <-> */ + { { noop, noop }, button_2_down }, /* k */ + { { noop, noop }, button_2_down }, /* ... */ + }, + /* button_3_pend */ + { + { { clearto, gen_down_2 }, synth_2_down_13 }, /* v1 */ + { { release, deliver }, button_3_down }, /* ^1 */ + { { release, deliver }, button_3_down }, /* v2 */ + { { release, deliver }, button_3_down }, /* ^2 */ + { { release, deliver }, button_3_down }, /* v3 */ + { { release, deliver }, start }, /* ^3 */ + { { release, deliver }, button_3_down }, /* vo */ + { { release, deliver }, button_3_down }, /* ^o */ + { { deliver, noop }, button_3_pend }, /* <> */ + { { release, deliver }, button_3_down }, /* <-> */ + { { release, noop }, button_3_down }, /* k */ + { { release, noop }, button_3_down }, /* ... */ + }, + /* button_3_down */ + { + { { deliver, noop }, button_3_down }, /* v1 */ + { { deliver, noop }, button_3_down }, /* ^1 */ + { { deliver, noop }, button_3_down }, /* v2 */ + { { deliver, noop }, button_3_down }, /* ^2 */ + { { noop, noop }, button_3_down }, /* v3 */ + { { deliver, noop }, start }, /* ^3 */ + { { deliver, noop }, button_3_down }, /* vo */ + { { deliver, noop }, button_3_down }, /* ^o */ + { { deliver, noop }, button_3_down }, /* <> */ + { { deliver, noop }, button_3_down }, /* <-> */ + { { noop, noop }, button_3_down }, /* k */ + { { noop, noop }, button_3_down }, /* ... */ + }, + /* synthetic_2_down_13 */ + { + { { noop, noop }, synth_2_down_13 }, /* v1 */ + { { gen_up_2, noop }, synth_2_down_3 }, /* ^1 */ + { { noop, noop }, synth_2_down_13 }, /* v2 */ + { { noop, noop }, synth_2_down_13 }, /* ^2 */ + { { noop, noop }, synth_2_down_13 }, /* v3 */ + { { gen_up_2, noop }, synth_2_down_1 }, /* ^3 */ + { { deliver, noop }, synth_2_down_13 }, /* vo */ + { { deliver, noop }, synth_2_down_13 }, /* ^o */ + { { deliver, noop }, synth_2_down_13 }, /* <> */ + { { deliver, noop }, synth_2_down_13 }, /* <-> */ + { { noop, noop }, synth_2_down_13 }, /* k */ + { { noop, noop }, synth_2_down_13 }, /* ... */ + }, + /* synthetic_2_down_3 */ + { + { { deliver, noop }, synth_2_down_3 }, /* v1 */ + { { deliver, noop }, synth_2_down_3 }, /* ^1 */ + { { deliver, noop }, synth_2_down_3 }, /* v2 */ + { { deliver, noop }, synth_2_down_3 }, /* ^2 */ + { { noop, noop }, synth_2_down_3 }, /* v3 */ + { { noop, noop }, start }, /* ^3 */ + { { deliver, noop }, synth_2_down_3 }, /* vo */ + { { deliver, noop }, synth_2_down_3 }, /* ^o */ + { { deliver, noop }, synth_2_down_3 }, /* <> */ + { { deliver, noop }, synth_2_down_3 }, /* <-> */ + { { noop, noop }, synth_2_down_3 }, /* k */ + { { noop, noop }, synth_2_down_3 }, /* ... */ + }, + /* synthetic_2_down_1 */ + { + { { noop, noop }, synth_2_down_1 }, /* v1 */ + { { noop, noop }, start }, /* ^1 */ + { { deliver, noop }, synth_2_down_1 }, /* v2 */ + { { deliver, noop }, synth_2_down_1 }, /* ^2 */ + { { deliver, noop }, synth_2_down_1 }, /* v3 */ + { { deliver, noop }, synth_2_down_1 }, /* ^3 */ + { { deliver, noop }, synth_2_down_1 }, /* vo */ + { { deliver, noop }, synth_2_down_1 }, /* ^o */ + { { deliver, noop }, synth_2_down_1 }, /* <> */ + { { deliver, noop }, synth_2_down_1 }, /* <-> */ + { { noop, noop }, synth_2_down_1 }, /* k */ + { { noop, noop }, synth_2_down_1 }, /* ... */ + }, +}; + +#define EMULATION_WINDOW 10 +#define EMULATION_TIMEOUT 100 + +#define EventX(e) ((e)->u.keyButtonPointer.rootX) +#define EventY(e) ((e)->u.keyButtonPointer.rootY) + +static int +KdInsideEmulationWindow (KdMouseInfo *mi, xEvent *ev) +{ + if (ev->u.keyButtonPointer.pad1) + { + mi->emulationDx += EventX(ev); + mi->emulationDy += EventY(ev); + } + else + { + mi->emulationDx = EventX(&mi->heldEvent) - EventX(ev); + mi->emulationDy = EventY(&mi->heldEvent) - EventY(ev); + } + return (abs (mi->emulationDx) < EMULATION_WINDOW && + abs (mi->emulationDy) < EMULATION_WINDOW); +} + +static KdInputClass +KdClassifyInput (KdMouseInfo *mi, xEvent *ev) +{ + switch (ev->u.u.type) { + case ButtonPress: + switch (ev->u.u.detail) { + case 1: return down_1; + case 2: return down_2; + case 3: return down_3; + default: return down_o; + } + break; + case ButtonRelease: + switch (ev->u.u.detail) { + case 1: return up_1; + case 2: return up_2; + case 3: return up_3; + default: return up_o; + } + break; + case MotionNotify: + if (mi->eventHeld && !KdInsideEmulationWindow(mi, ev)) + return outside_box; + else + return motion; + default: + return keyboard; + } + return keyboard; +} + +#ifndef NDEBUG +char *kdStateNames[] = { + "start", + "button_1_pend", + "button_1_down", + "button_2_down", + "button_3_pend", + "button_3_down", + "synth_2_down_13", + "synth_2_down_3", + "synthetic_2_down_1", + "num_input_states" +}; + +char *kdClassNames[] = { + "down_1", "up_1", + "down_2", "up_2", + "down_3", "up_3", + "motion", "ouside_box", + "keyboard", "timeout", + "num_input_class" +}; + +char *kdActionNames[] = { + "noop", + "hold", + "setto", + "deliver", + "release", + "clearto", + "gen_down_2", + "gen_up_2", +}; +#endif + +static void +KdQueueEvent (xEvent *ev) +{ + KdAssertSigioBlocked ("KdQueueEvent"); + if (ev->u.u.type == MotionNotify) + { + if (ev->u.keyButtonPointer.pad1) + { + ev->u.keyButtonPointer.pad1 = 0; + miPointerDeltaCursor (ev->u.keyButtonPointer.rootX, + ev->u.keyButtonPointer.rootY, + ev->u.keyButtonPointer.time); + } + else + { + miPointerAbsoluteCursor(ev->u.keyButtonPointer.rootX, + ev->u.keyButtonPointer.rootY, + ev->u.keyButtonPointer.time); + } + } + else + { + mieqEnqueue (ev); + } +} + +static void +KdRunMouseMachine (KdMouseInfo *mi, KdInputClass c, xEvent *ev) +{ + KdInputTransition *t; + int a; + + t = &kdInputMachine[mi->mouseState][c]; + for (a = 0; a < MAX_ACTIONS; a++) + { + switch (t->actions[a]) { + case noop: + break; + case hold: + mi->eventHeld = TRUE; + mi->emulationDx = 0; + mi->emulationDy = 0; + mi->heldEvent = *ev; + break; + case setto: + mi->emulationTimeout = GetTimeInMillis () + EMULATION_TIMEOUT; + mi->timeoutPending = TRUE; + break; + case deliver: + KdQueueEvent (ev); + break; + case release: + mi->eventHeld = FALSE; + mi->timeoutPending = FALSE; + KdQueueEvent (&mi->heldEvent); + break; + case clearto: + mi->timeoutPending = FALSE; + break; + case gen_down_2: + ev->u.u.detail = 2; + mi->eventHeld = FALSE; + KdQueueEvent (ev); + break; + case gen_up_2: + ev->u.u.detail = 2; + KdQueueEvent (ev); + break; + } + } + mi->mouseState = t->nextState; +} + +void +KdResetInputMachine (void) +{ + KdMouseInfo *mi; + + for (mi = kdMouseInfo; mi; mi = mi->next) + { + mi->mouseState = start; + mi->eventHeld = FALSE; + } +} + +static void +KdHandleMouseEvent (KdMouseInfo *mi, xEvent *ev) +{ + if (mi->emulateMiddleButton) + KdRunMouseMachine (mi, KdClassifyInput (mi, ev), ev); + else + KdQueueEvent (ev); +} + +static void +KdReceiveTimeout (KdMouseInfo *mi) +{ + KdRunMouseMachine (mi, timeout, 0); +} + +#define KILL_SEQUENCE ((1L << KK_CONTROL)|(1L << KK_ALT)|(1L << KK_F8)|(1L << KK_F10)) +#define SPECIAL_SEQUENCE ((1L << KK_CONTROL) | (1L << KK_ALT)) +#define SETKILLKEY(b) (KdSpecialKeys |= (1L << (b))) +#define CLEARKILLKEY(b) (KdSpecialKeys &= ~(1L << (b))) +#define KEYMAP (pKdKeyboard->key->curKeySyms) +#define KEYCOL1(k) (KEYMAP.map[((k)-kdMinKeyCode)*KEYMAP.mapWidth]) + +CARD32 KdSpecialKeys = 0; + +extern char dispatchException; + +/* + * kdCheckTermination + * + * This function checks for the key sequence that terminates the server. When + * detected, it sets the dispatchException flag and returns. The key sequence + * is: + * Control-Alt + * It's assumed that the server will be waken up by the caller when this + * function returns. + */ + +extern int nClients; + +static void +KdCheckSpecialKeys(xEvent *xE) +{ + KeySym sym = KEYCOL1(xE->u.u.detail); + + if (!pKdKeyboard) return; + + /* + * Ignore key releases + */ + + if (xE->u.u.type == KeyRelease) return; + +#ifdef XIPAQ + /* + * Check for buttons 1, 2 and 3 on the iPAQ + */ + if (sym == XK_Pointer_Button1 && kdMouseInfo) { + KdEnqueueMouseEvent(kdMouseInfo, KD_MOUSE_DELTA | KD_BUTTON_1, 0, 0); + return; + } + if (sym == XK_Pointer_Button2 && kdMouseInfo) { + KdEnqueueMouseEvent(kdMouseInfo, KD_MOUSE_DELTA | KD_BUTTON_2, 0, 0); + return; + } + if (sym == XK_Pointer_Button3 && kdMouseInfo) { + KdEnqueueMouseEvent(kdMouseInfo, KD_MOUSE_DELTA | KD_BUTTON_3, 0, 0); + return; + } +#endif + + /* + * Check for control/alt pressed + */ + if ((pKdKeyboard->key->state & (ControlMask|Mod1Mask)) != + (ControlMask|Mod1Mask)) + return; + + + /* + * Let OS function see keysym first + */ + + if (kdOsFuncs->SpecialKey) + if ((*kdOsFuncs->SpecialKey) (sym)) + return; + + /* + * Now check for backspace or delete; these signal the + * X server to terminate + */ + switch (sym) { + case XK_BackSpace: + case XK_Delete: + case XK_KP_Delete: + /* + * Set the dispatch exception flag so the server will terminate the + * next time through the dispatch loop. + */ + if (kdDontZap == FALSE) + dispatchException |= DE_TERMINATE; + break; + } +} + +/* + * kdEnqueueKeyboardEvent + * + * This function converts hardware keyboard event information into an X event + * and enqueues it using MI. It wakes up the server before returning so that + * the event will be processed normally. + * + */ + +static void +KdHandleKeyboardEvent (xEvent *ev) +{ + int key = ev->u.u.detail; + int byte; + CARD8 bit; + KdMouseInfo *mi; + + byte = key >> 3; + bit = 1 << (key & 7); + switch (ev->u.u.type) { + case KeyPress: + kdKeyState[byte] |= bit; + break; + case KeyRelease: + kdKeyState[byte] &= ~bit; + break; + } + for (mi = kdMouseInfo; mi; mi = mi->next) + KdRunMouseMachine (mi, keyboard, 0); + KdQueueEvent (ev); +} + +static void +KdReleaseAllKeys (void) +{ + xEvent xE; + int key; + + KdBlockSigio (); + for (key = 0; key < KD_KEY_COUNT; key++) + if (IsKeyDown(key)) + { + xE.u.keyButtonPointer.time = GetTimeInMillis(); + xE.u.u.type = KeyRelease; + xE.u.u.detail = key; + KdHandleKeyboardEvent (&xE); + } + KdUnblockSigio (); +} + +static void +KdCheckLock (void) +{ + KeyClassPtr keyc = pKdKeyboard->key; + Bool isSet, shouldBeSet; + + if (kdKeyboardFuncs->LockLed) + { + isSet = (kdLeds & (1 << (kdKeyboardFuncs->LockLed-1))) != 0; + shouldBeSet = (keyc->state & LockMask) != 0; + if (isSet != shouldBeSet) + { + KdSetLed (kdKeyboardFuncs->LockLed, shouldBeSet); + } + } +} + +void +KdEnqueueKeyboardEvent(unsigned char scan_code, + unsigned char is_up) +{ + unsigned char key_code; + xEvent xE; + KeyClassPtr keyc; + + if (!pKdKeyboard) + return; + keyc = pKdKeyboard->key; + + xE.u.keyButtonPointer.time = GetTimeInMillis(); + + if (kdMinScanCode <= scan_code && scan_code <= kdMaxScanCode) + { + key_code = scan_code + KD_MIN_KEYCODE - kdMinScanCode; + + /* + * Set up this event -- the type may be modified below + */ + if (is_up) + xE.u.u.type = KeyRelease; + else + xE.u.u.type = KeyPress; + xE.u.u.detail = key_code; + + switch (KEYCOL1(key_code)) + { + case XK_Num_Lock: + case XK_Scroll_Lock: + case XK_Shift_Lock: + case XK_Caps_Lock: + if (xE.u.u.type == KeyRelease) + return; + if (IsKeyDown (key_code)) + xE.u.u.type = KeyRelease; + else + xE.u.u.type = KeyPress; + } + + /* + * Check pressed keys which are already down + */ + if (IsKeyDown (key_code) && xE.u.u.type == KeyPress) + { + KeybdCtrl *ctrl = &pKdKeyboard->kbdfeed->ctrl; + + /* + * Check auto repeat + */ + if (!ctrl->autoRepeat || keyc->modifierMap[key_code] || + !(ctrl->autoRepeats[key_code >> 3] & (1 << (key_code & 7)))) + { + return; + } + /* + * X delivers press/release even for autorepeat + */ + xE.u.u.type = KeyRelease; + KdHandleKeyboardEvent (&xE); + xE.u.u.type = KeyPress; + } + /* + * Check released keys which are already up + */ + else if (!IsKeyDown (key_code) && xE.u.u.type == KeyRelease) + { + return; + } + KdCheckSpecialKeys (&xE); + KdHandleKeyboardEvent (&xE); + } +} + +#define SetButton(mi, b, v, s) \ +{\ + xE.u.u.detail = mi->map[b]; \ + xE.u.u.type = v; \ + KdHandleMouseEvent (mi, &xE); \ +} + +#define Press(mi, b) SetButton(mi, b, ButtonPress, "Down") +#define Release(mi, b) SetButton(mi, b, ButtonRelease, "Up") + +/* + * kdEnqueueMouseEvent + * + * This function converts hardware mouse event information into X event + * information. A mouse movement event is passed off to MI to generate + * a MotionNotify event, if appropriate. Button events are created and + * passed off to MI for enqueueing. + */ + +static void +KdMouseAccelerate (DeviceIntPtr device, int *dx, int *dy) +{ + PtrCtrl *pCtrl = &device->ptrfeed->ctrl; + double speed = sqrt (*dx * *dx + *dy * *dy); + double accel; + double m; + + /* + * Ok, so we want it moving num/den times faster at threshold*2 + * + * accel = m *threshold + b + * 1 = m * 0 + b -> b = 1 + * + * num/den = m * (threshold * 2) + 1 + * + * num / den - 1 = m * threshold * 2 + * (num / den - 1) / threshold * 2 = m + */ + m = (((double) pCtrl->num / (double) pCtrl->den - 1.0) / + ((double) pCtrl->threshold * 2.0)); + accel = m * speed + 1; + *dx = accel * *dx; + *dy = accel * *dy; +} + +void +KdEnqueueMouseEvent(KdMouseInfo *mi, unsigned long flags, int rx, int ry) +{ + CARD32 ms; + xEvent xE; + unsigned char buttons; + int x, y; + int (*matrix)[3] = kdMouseMatrix.matrix; + unsigned long button; + int n; + + if (!pKdPointer) + return; + + ms = GetTimeInMillis(); + + if (flags & KD_MOUSE_DELTA) + { + if (mi->transformCoordinates) + { + x = matrix[0][0] * rx + matrix[0][1] * ry; + y = matrix[1][0] * rx + matrix[1][1] * ry; + } + else + { + x = rx; + y = ry; + } + KdMouseAccelerate (pKdPointer, &x, &y); + xE.u.keyButtonPointer.pad1 = 1; + } + else + { + if (mi->transformCoordinates) + { + x = matrix[0][0] * rx + matrix[0][1] * ry + matrix[0][2]; + y = matrix[1][0] * rx + matrix[1][1] * ry + matrix[1][2]; + } + else + { + x = rx; + y = ry; + } + xE.u.keyButtonPointer.pad1 = 0; + } + xE.u.keyButtonPointer.time = ms; + xE.u.keyButtonPointer.rootX = x; + xE.u.keyButtonPointer.rootY = y; + + xE.u.u.type = MotionNotify; + xE.u.u.detail = 0; + KdHandleMouseEvent (mi, &xE); + + buttons = flags; + + for (button = KD_BUTTON_1, n = 0; button <= KD_BUTTON_5; button <<= 1, n++) + { + if ((mi->buttonState & button) ^ (buttons & button)) + { + if (buttons & button) + { + Press(mi, n); + } + else + { + Release(mi, n); + } + } + } + mi->buttonState = buttons; +} + +static void +KdEnqueueMotionEvent (KdMouseInfo *mi, int x, int y) +{ + xEvent xE; + CARD32 ms; + + ms = GetTimeInMillis(); + + xE.u.u.type = MotionNotify; + xE.u.keyButtonPointer.time = ms; + xE.u.keyButtonPointer.rootX = x; + xE.u.keyButtonPointer.rootY = y; + + KdHandleMouseEvent (mi, &xE); +} + +static void +KdBlockHandler (int screen, + pointer blockData, + pointer timeout, + pointer readmask) +{ + KdMouseInfo *mi; + int myTimeout=0; + + for (mi = kdMouseInfo; mi; mi = mi->next) + { + if (mi->timeoutPending) + { + int ms; + + ms = mi->emulationTimeout - GetTimeInMillis (); + if (ms < 1) + ms = 1; + if(ms<myTimeout || myTimeout==0) + myTimeout=ms; + } + } + /* if we need to poll for events, do that */ + if(kdOsFuncs->pollEvents) + { + (*kdOsFuncs->pollEvents)(); + myTimeout=20; + } + if(myTimeout>0) + AdjustWaitForDelay (timeout, myTimeout); +} + +void +KdWakeupHandler (pointer data, + int result, + pointer readmask) +{ + fd_set *pReadmask = (fd_set *) readmask; + int i; + KdMouseInfo *mi; + + if (kdInputEnabled && result > 0) + { + for (i = 0; i < kdNumInputFds; i++) + if (FD_ISSET (kdInputFds[i].fd, pReadmask)) + { + KdBlockSigio (); + (*kdInputFds[i].read) (kdInputFds[i].fd, kdInputFds[i].closure); + KdUnblockSigio (); + } + } + for (mi = kdMouseInfo; mi; mi = mi->next) + { + if (mi->timeoutPending) + { + if ((long) (GetTimeInMillis () - mi->emulationTimeout) >= 0) + { + mi->timeoutPending = FALSE; + KdBlockSigio (); + KdReceiveTimeout (mi); + KdUnblockSigio (); + } + } + } +// if (kdSwitchPending) +// kdProcessSwitch (); +} + +#define KdScreenOrigin(pScreen) (&(KdGetScreenPriv (pScreen)->origin)) + +static Bool +KdCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y) +{ + ScreenPtr pScreen = *ppScreen; + ScreenPtr pNewScreen; + int n; + int dx, dy; + int best_x, best_y; + int n_best_x, n_best_y; + CARD32 ms; + + if (kdDisableZaphod || screenInfo.numScreens <= 1) + return FALSE; + + if (0 <= *x && *x < pScreen->width && 0 <= *y && *y < pScreen->height) + return FALSE; + + ms = GetTimeInMillis (); + if (kdOffScreen && (int) (ms - kdOffScreenTime) < 1000) + return FALSE; + kdOffScreen = TRUE; + kdOffScreenTime = ms; + n_best_x = -1; + best_x = 32767; + n_best_y = -1; + best_y = 32767; + for (n = 0; n < screenInfo.numScreens; n++) + { + pNewScreen = screenInfo.screens[n]; + if (pNewScreen == pScreen) + continue; + dx = KdScreenOrigin(pNewScreen)->x - KdScreenOrigin(pScreen)->x; + dy = KdScreenOrigin(pNewScreen)->y - KdScreenOrigin(pScreen)->y; + if (*x < 0) + { + if (dx <= 0 && -dx < best_x) + { + best_x = -dx; + n_best_x = n; + } + } + else if (*x >= pScreen->width) + { + if (dx >= 0 && dx < best_x) + { + best_x = dx; + n_best_x = n; + } + } + if (*y < 0) + { + if (dy <= 0 && -dy < best_y) + { + best_y = -dy; + n_best_y = n; + } + } + else if (*y >= pScreen->height) + { + if (dy >= 0 && dy < best_y) + { + best_y = dy; + n_best_y = n; + } + } + } + if (best_y < best_x) + n_best_x = n_best_y; + if (n_best_x == -1) + return FALSE; + pNewScreen = screenInfo.screens[n_best_x]; + + if (*x < 0) + *x += pNewScreen->width; + if (*y < 0) + *y += pNewScreen->height; + + if (*x >= pScreen->width) + *x -= pScreen->width; + if (*y >= pScreen->height) + *y -= pScreen->height; + + *ppScreen = pNewScreen; + return TRUE; +} + +static void +KdCrossScreen(ScreenPtr pScreen, Bool entering) +{ +#ifndef XIPAQ +// if (entering) +// KdEnableScreen (pScreen); +// else +// KdDisableScreen (pScreen); +#endif +} + +int KdCurScreen; /* current event screen */ + +static void +KdWarpCursor (ScreenPtr pScreen, int x, int y) +{ + KdBlockSigio (); + KdCurScreen = pScreen->myNum; + miPointerWarpCursor (pScreen, x, y); + KdUnblockSigio (); +} + +miPointerScreenFuncRec kdPointerScreenFuncs = +{ + KdCursorOffScreen, + KdCrossScreen, + KdWarpCursor +}; + +void +KdProcessInputEvents (void) +{ + mieqProcessInputEvents(); + miPointerUpdate(); +// if (kdSwitchPending) +// KdProcessSwitch (); + KdCheckLock (); +} diff --git a/xorg-server/hw/xgl/egl/kkeymap.h b/xorg-server/hw/xgl/egl/kkeymap.h new file mode 100644 index 000000000..920e807e5 --- /dev/null +++ b/xorg-server/hw/xgl/egl/kkeymap.h @@ -0,0 +1,55 @@ +/* + * Copyright 1999 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ +/* + * All global variables and functions pertaining to keyboard key mapping + * live in this header file. + */ + +#ifndef _KKEYMAP_H +#define _KKEYMAP_H + +/* Offset of MIN_SCANCODE to 8 (X minimum scancode value) */ +#define KD_KEY_OFFSET (8 - kdMinScanCode) + +#define KD_MIN_KEYCODE 8 +#define KD_MAX_KEYCODE 254 +#define KD_MAX_WIDTH 4 +#define KD_MAX_LENGTH (KD_MAX_KEYCODE - KD_MIN_KEYCODE + 1) + +extern int kdMinScanCode; +extern int kdMaxScanCode; +extern int kdMinKeyCode; +extern int kdMaxKeyCode; +extern int kdKeymapWidth; + +extern KeySym kdKeymap[KD_MAX_LENGTH * KD_MAX_WIDTH]; + +extern CARD8 kdModMap[MAP_LENGTH]; + +extern KeySymsRec kdKeySyms; + +typedef struct { + KeySym modsym; + int modbit; +} KdKeySymModsRec; + +#endif /* _KKEYMAP_H */ diff --git a/xorg-server/hw/xgl/egl/module/Makefile.am b/xorg-server/hw/xgl/egl/module/Makefile.am new file mode 100644 index 000000000..c84f85c90 --- /dev/null +++ b/xorg-server/hw/xgl/egl/module/Makefile.am @@ -0,0 +1,15 @@ +AM_CFLAGS = \ + $(DIX_CFLAGS) \ + -I$(srcdir)/.. \ + -I$(srcdir)/../.. \ + $(XEGLMODULES_CFLAGS) + +libxegl_la_LDFLAGS = -avoid-version +libxegl_la_SOURCES = xeglmodule.c +libxegl_la_LIBADD = \ + $(top_builddir)/hw/xgl/glx/libxegl.la \ + $(XEGLMODULES_LIBS) + +moduledir = @xglmoduledir@ + +module_LTLIBRARIES = libxegl.la diff --git a/xorg-server/hw/xgl/egl/module/Makefile.in b/xorg-server/hw/xgl/egl/module/Makefile.in new file mode 100644 index 000000000..648f75d74 --- /dev/null +++ b/xorg-server/hw/xgl/egl/module/Makefile.in @@ -0,0 +1,685 @@ +# 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/xgl/egl/module +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 = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(moduledir)" +moduleLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(module_LTLIBRARIES) +libxegl_la_DEPENDENCIES = $(top_builddir)/hw/xgl/glx/libxegl.la +am_libxegl_la_OBJECTS = xeglmodule.lo +libxegl_la_OBJECTS = $(am_libxegl_la_OBJECTS) +libxegl_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libxegl_la_LDFLAGS) $(LDFLAGS) -o $@ +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 = $(libxegl_la_SOURCES) +DIST_SOURCES = $(libxegl_la_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 = @xglmoduledir@ +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@ +AM_CFLAGS = \ + $(DIX_CFLAGS) \ + -I$(srcdir)/.. \ + -I$(srcdir)/../.. \ + $(XEGLMODULES_CFLAGS) + +libxegl_la_LDFLAGS = -avoid-version +libxegl_la_SOURCES = xeglmodule.c +libxegl_la_LIBADD = \ + $(top_builddir)/hw/xgl/glx/libxegl.la \ + $(XEGLMODULES_LIBS) + +module_LTLIBRARIES = libxegl.la +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/xgl/egl/module/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign hw/xgl/egl/module/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 +install-moduleLTLIBRARIES: $(module_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(moduledir)" || $(MKDIR_P) "$(DESTDIR)$(moduledir)" + @list='$(module_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(moduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(moduledir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(moduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(moduledir)/$$f"; \ + else :; fi; \ + done + +uninstall-moduleLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(module_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(moduledir)/$$p'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(moduledir)/$$p"; \ + done + +clean-moduleLTLIBRARIES: + -test -z "$(module_LTLIBRARIES)" || rm -f $(module_LTLIBRARIES) + @list='$(module_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libxegl.la: $(libxegl_la_OBJECTS) $(libxegl_la_DEPENDENCIES) + $(libxegl_la_LINK) -rpath $(moduledir) $(libxegl_la_OBJECTS) $(libxegl_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xeglmodule.Plo@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 $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(moduledir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +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-moduleLTLIBRARIES \ + 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-moduleLTLIBRARIES + +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: uninstall-moduleLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-moduleLTLIBRARIES 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-moduleLTLIBRARIES 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 uninstall-moduleLTLIBRARIES + +# 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/xgl/egl/module/xeglmodule.c b/xorg-server/hw/xgl/egl/module/xeglmodule.c new file mode 100644 index 000000000..abd0d0d75 --- /dev/null +++ b/xorg-server/hw/xgl/egl/module/xeglmodule.c @@ -0,0 +1,104 @@ +/* + * Copyright © 2005 Novell, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * Novell, Inc. not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * Novell, Inc. makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#include "xglmodule.h" +#include "xegl.h" + +#include <glitz-egl.h> + +char * +moduleVersion (void) +{ + return VERSION; +} + +Bool +moduleInit (const char *module) +{ + glitz_egl_init (module); + + return TRUE; +} + +void +InitOutput (ScreenInfo *pScreenInfo, + int argc, + char **argv) +{ + xeglInitOutput (pScreenInfo, argc, argv); +} + +Bool +LegalModifier (unsigned int key, + DeviceIntPtr pDev) +{ + return xeglLegalModifier (key, pDev); +} + +void +ProcessInputEvents (void) +{ + xeglProcessInputEvents (); +} + +void +InitInput (int argc, + char **argv) +{ + xeglInitInput (argc, argv); +} + +void +ddxUseMsg (void) +{ + ErrorF ("\nXegl usage:\n"); + xeglUseMsg (); +} + +int +ddxProcessArgument (int argc, + char **argv, + int i) +{ + return xeglProcessArgument (argc, argv, i); +} + +void +AbortDDX (void) +{ + xeglAbort (); +} + +void +ddxGiveUp (void) +{ + xeglGiveUp (); +} + +void +OsVendorInit (void) +{ + xeglOsVendorInit (); +} diff --git a/xorg-server/hw/xgl/egl/xegl.c b/xorg-server/hw/xgl/egl/xegl.c new file mode 100644 index 000000000..1cf615bb6 --- /dev/null +++ b/xorg-server/hw/xgl/egl/xegl.c @@ -0,0 +1,303 @@ +/* + * Copyright © 2004 David Reveman + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * David Reveman not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * David Reveman makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <signal.h> +#include <sys/ioctl.h> +#include <errno.h> +#include <math.h> + +#include <glitz-egl.h> + +#include "inputstr.h" +#include "cursorstr.h" +#include "mipointer.h" + +#include "xegl.h" + +#define XEGL_DEFAULT_SCREEN_WIDTH 800 +#define XEGL_DEFAULT_SCREEN_HEIGHT 600 + +DevPrivateKey xeglScreenPrivateKey = &xeglScreenPrivateKey; + +#define XEGL_GET_SCREEN_PRIV(pScreen) ((xeglScreenPtr) \ + dixLookupPrivate(&(pScreen)->devPrivates, xeglScreenPrivateKey)) + +#define XEGL_SET_SCREEN_PRIV(pScreen, v) \ + dixSetPrivate(&(pScreen)->devPrivates, xeglScreenPrivateKey, v) + +#define XEGL_SCREEN_PRIV(pScreen) \ + xeglScreenPtr pScreenPriv = XEGL_GET_SCREEN_PRIV (pScreen) + +static EGLDisplay eDisplay; +static EGLScreenMESA eScreen; +static ScreenPtr currentScreen = 0; +static Bool softCursor = TRUE; + +extern miPointerScreenFuncRec kdPointerScreenFuncs; + +static Bool +xeglAllocatePrivates (ScreenPtr pScreen) +{ + xeglScreenPtr pScreenPriv; + + pScreenPriv = xalloc (sizeof (xeglScreenRec)); + if (!pScreenPriv) + return FALSE; + + XEGL_SET_SCREEN_PRIV (pScreen, pScreenPriv); + + return TRUE; +} + +static Bool +xeglCloseScreen (int index, + ScreenPtr pScreen) +{ + glitz_drawable_t *drawable; + + XEGL_SCREEN_PRIV (pScreen); + + drawable = XGL_GET_SCREEN_PRIV (pScreen)->drawable; + if (drawable) + glitz_drawable_destroy (drawable); + + xglClearVisualTypes (); + + XGL_SCREEN_UNWRAP (CloseScreen); + xfree (pScreenPriv); + + return (*pScreen->CloseScreen) (index, pScreen); +} + +static Bool +xeglScreenInit (int index, + ScreenPtr pScreen, + int argc, + char **argv) +{ + EGLSurface eSurface; + EGLModeMESA mode; + int count; + xeglScreenPtr pScreenPriv; + glitz_drawable_format_t *format; + glitz_drawable_t *drawable; + EGLint screenAttribs[] = { + EGL_WIDTH, 1024, + EGL_HEIGHT, 768, + EGL_NONE + }; + + if (xglScreenInfo.width == 0 || xglScreenInfo.height == 0) + { + xglScreenInfo.width = XEGL_DEFAULT_SCREEN_WIDTH; + xglScreenInfo.height = XEGL_DEFAULT_SCREEN_HEIGHT; + + } + + screenAttribs[1] = xglScreenInfo.width; + screenAttribs[3] = xglScreenInfo.height; + + format = xglVisuals[0].format; + + if (!xeglAllocatePrivates (pScreen)) + return FALSE; + + currentScreen = pScreen; + + pScreenPriv = XEGL_GET_SCREEN_PRIV (pScreen); + + if (xglScreenInfo.width == 0 || xglScreenInfo.height == 0) + { + xglScreenInfo.width = XEGL_DEFAULT_SCREEN_WIDTH; + xglScreenInfo.height = XEGL_DEFAULT_SCREEN_HEIGHT; + } + + eglGetModesMESA (eDisplay, eScreen, &mode, 1, &count); + + eSurface = eglCreateScreenSurfaceMESA (eDisplay, format->id, screenAttribs); + if (eSurface == EGL_NO_SURFACE) + { + ErrorF ("failed to create screen surface\n"); + return FALSE; + } + + eglShowScreenSurfaceMESA (eDisplay, eScreen, eSurface, mode); + + drawable = glitz_egl_create_surface (eDisplay, eScreen, format, eSurface, + xglScreenInfo.width, + xglScreenInfo.height); + if (!drawable) + { + ErrorF ("[%d] couldn't create glitz drawable for window\n", index); + return FALSE; + } + + xglScreenInfo.drawable = drawable; + + if (!xglScreenInit (pScreen)) + return FALSE; + +#ifdef GLXEXT + if (!xglInitVisualConfigs (pScreen)) + return FALSE; +#endif + + XGL_SCREEN_WRAP (CloseScreen, xeglCloseScreen); + + miDCInitialize (pScreen, &kdPointerScreenFuncs); + miCreateDefColormap(pScreen); + + if (!xglFinishScreenInit (pScreen)) + return FALSE; + + return TRUE; +} + +void +xeglInitOutput (ScreenInfo *pScreenInfo, + int argc, + char **argv) +{ + glitz_drawable_format_t *format, templ; + int i, maj, min, count; + unsigned long mask; + + xglSetPixmapFormats (pScreenInfo); + + if (!eDisplay) + { + eDisplay = eglGetDisplay (":0"); + + if (!eglInitialize (eDisplay, &maj, &min)) + FatalError ("can't open display"); + + eglGetScreensMESA (eDisplay, &eScreen, 1, &count); + } + + templ.samples = 1; + templ.doublebuffer = 1; + templ.color.alpha_size = 8; + + mask = GLITZ_FORMAT_SAMPLES_MASK; + + format = glitz_egl_find_window_config (eDisplay, eScreen, + mask, &templ, 0); + + if (!format) + FatalError ("no visual format found"); + + xglSetVisualTypesAndMasks (pScreenInfo, format, (1 << TrueColor)); + + xglInitVisuals (pScreenInfo); + + AddScreen (xeglScreenInit, argc, argv); +} + +static void +xeglBlockHandler (pointer blockData, + OSTimePtr pTimeout, + pointer pReadMask) +{ + XGL_SCREEN_PRIV (currentScreen); + + if (!xglSyncSurface (&pScreenPriv->pScreenPixmap->drawable)) + FatalError (XGL_SW_FAILURE_STRING); + + glitz_surface_flush (pScreenPriv->surface); + glitz_drawable_finish (pScreenPriv->drawable); +} + +void +xeglInitInput (int argc, + char **argv) +{ + eglInitInput (&LinuxEvdevMouseFuncs, &LinuxEvdevKeyboardFuncs); + RegisterBlockAndWakeupHandlers (xeglBlockHandler, KdWakeupHandler, NULL); +} + +Bool +xeglLegalModifier (unsigned int key, + DeviceIntPtr pDev) +{ + return KdLegalModifier (key, pDev); +} + +void +xeglProcessInputEvents (void) +{ + KdProcessInputEvents (); +} + +void +xeglUseMsg (void) +{ + ErrorF ("-screen WIDTH[/WIDTHMM]xHEIGHT[/HEIGHTMM] " + "specify screen characteristics\n"); + ErrorF ("-softcursor force software cursor\n"); +} + +int +xeglProcessArgument (int argc, + char **argv, + int i) +{ + if (!strcmp (argv[i], "-screen")) + { + if ((i + 1) < argc) + { + xglParseScreen (argv[i + 1]); + } + else + return 1; + + return 2; + } + else if (!strcmp (argv[i], "-softcursor")) + { + softCursor = TRUE; + return 1; + } + + return 0; +} + +void +xeglAbort (void) +{ +} + +void +xeglGiveUp (void) +{ + AbortDDX (); +} + +void +xeglOsVendorInit (void) +{ +} diff --git a/xorg-server/hw/xgl/egl/xegl.h b/xorg-server/hw/xgl/egl/xegl.h new file mode 100644 index 000000000..0a07397bf --- /dev/null +++ b/xorg-server/hw/xgl/egl/xegl.h @@ -0,0 +1,214 @@ +/* + * Copyright © 2005 Novell, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * Novell, Inc. not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * Novell, Inc. makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#ifndef _XEGL_H_ +#define _XEGL_H_ + +#include "xgl.h" + +#include "randrstr.h" + +#define KD_BUTTON_1 0x01 +#define KD_BUTTON_2 0x02 +#define KD_BUTTON_3 0x04 +#define KD_BUTTON_4 0x08 +#define KD_BUTTON_5 0x10 +#define KD_MOUSE_DELTA 0x80000000 + +typedef struct _KdMouseFuncs { + Bool (*Init) (void); + void (*Fini) (void); +} KdMouseFuncs; + +typedef struct _KdKeyboardFuncs { + void (*Load) (void); + int (*Init) (void); + void (*Leds) (int); + void (*Bell) (int, int, int); + void (*Fini) (void); + int LockLed; +} KdKeyboardFuncs; + +typedef struct _KdOsFuncs { + int (*Init) (void); + void (*Enable) (void); + Bool (*SpecialKey) (KeySym); + void (*Disable) (void); + void (*Fini) (void); + void (*pollEvents) (void); +} KdOsFuncs; + +typedef struct _KdMouseMatrix { + int matrix[2][3]; +} KdMouseMatrix; + +typedef enum _KdMouseState { + start, + button_1_pend, + button_1_down, + button_2_down, + button_3_pend, + button_3_down, + synth_2_down_13, + synth_2_down_3, + synth_2_down_1, + num_input_states +} KdMouseState; + +#define KD_MAX_BUTTON 7 + +typedef struct _KdMouseInfo { + struct _KdMouseInfo *next; + void *driver; + void *closure; + char *name; + char *prot; + char map[KD_MAX_BUTTON]; + int nbutton; + Bool emulateMiddleButton; + unsigned long emulationTimeout; + Bool timeoutPending; + KdMouseState mouseState; + Bool eventHeld; + xEvent heldEvent; + unsigned char buttonState; + int emulationDx, emulationDy; + int inputType; + Bool transformCoordinates; +} KdMouseInfo; + +typedef struct _xeglScreen { + CloseScreenProcPtr CloseScreen; + ScreenPtr pScreen; + DDXPointRec origin; +} xeglScreenRec, *xeglScreenPtr; + +extern KdMouseInfo *kdMouseInfo; +extern KdOsFuncs *kdOsFuncs; +extern Bool kdDontZap; +extern Bool kdDisableZaphod; +extern DevPrivateKey xeglScreenPrivateKey; +extern KdMouseFuncs LinuxEvdevMouseFuncs; +extern KdKeyboardFuncs LinuxEvdevKeyboardFuncs; + +#define RR_Rotate_All \ + (RR_Rotate_0 | RR_Rotate_90 | RR_Rotate_180 | RR_Rotate_270) +#define RR_Reflect_All (RR_Reflect_X | RR_Reflect_Y) + +#define KdGetScreenPriv(pScreen) ((xeglScreenPtr) \ + dixLookupPrivate(&(pScreen)->devPrivates, xeglScreenPrivateKey)) +#define KdScreenPriv(pScreen) \ + xeglScreenPtr pScreenPriv = KdGetScreenPriv (pScreen) + +void +eglInitInput (KdMouseFuncs *pMouseFuncs, + KdKeyboardFuncs *pKeyboardFuncs); + +void +KdParseMouse (char *arg); + +KdMouseInfo * +KdMouseInfoAdd (void); + +void +KdMouseInfoDispose (KdMouseInfo *mi); + +int +KdAllocInputType (void); + +char * +KdSaveString (char *str); + +Bool +KdRegisterFd (int type, + int fd, + void (*read) (int fd, void *closure), + void *closure); + +void +KdUnregisterFds (int type, + Bool do_close); + +void +KdEnqueueKeyboardEvent (unsigned char scan_code, + unsigned char is_up); + +void +KdEnqueueMouseEvent (KdMouseInfo *mi, + unsigned long flags, + int rx, + int ry); + +void +KdRegisterFdEnableDisable (int fd, + int (*enable) (int fd, void *closure), + void (*disable) (int fd, void *closure)); + +void +KdWakeupHandler (pointer data, + int result, + pointer readmask); + +Bool +KdLegalModifier (unsigned int key, + DeviceIntPtr pDev); + +void +KdProcessInputEvents (void); + +void +xeglInitOutput (ScreenInfo *pScreenInfo, + int argc, + char **argv); + +Bool +xeglLegalModifier (unsigned int key, + DevicePtr pDev); + +void +xeglProcessInputEvents (void); + +void +xeglInitInput (int argc, + char **argv); + +void +xeglUseMsg (void); + +int +xeglProcessArgument (int argc, + char **argv, + int i); + +void +xeglAbort (void); + +void +xeglGiveUp (void); + +void +xeglOsVendorInit (void); + +#endif /* _XEGL_H_ */ diff --git a/xorg-server/hw/xgl/egl/xeglinit.c b/xorg-server/hw/xgl/egl/xeglinit.c new file mode 100644 index 000000000..c28d946ac --- /dev/null +++ b/xorg-server/hw/xgl/egl/xeglinit.c @@ -0,0 +1,131 @@ +/* + * Copyright © 2004 David Reveman + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * David Reveman not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * David Reveman makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#include "xegl.h" + +static xglScreenInfoRec xglScreenInfo = { + NULL, 0, 0, 0, 0, + DEFAULT_GEOMETRY_DATA_TYPE, + DEFAULT_GEOMETRY_USAGE, + FALSE, + XGL_DEFAULT_PBO_MASK, + FALSE, + FALSE +}; + +#ifdef GLXEXT +static Bool loadGlx = TRUE; +#endif + +void +InitOutput (ScreenInfo *pScreenInfo, + int argc, + char **argv) +{ + +#ifdef GLXEXT + if (loadGlx) + { + if (!xglLoadGLXModules ()) + FatalError ("No GLX modules loaded"); + } +#endif + + xeglInitOutput (pScreenInfo, argc, argv); +} + +Bool +LegalModifier (unsigned int key, + DeviceIntPtr pDev) +{ + return xeglLegalModifier (key, pDev); +} + +void +ProcessInputEvents (void) +{ + xeglProcessInputEvents (); +} + +void +InitInput (int argc, + char **argv) +{ + xeglInitInput (argc, argv); +} + +void +ddxUseMsg (void) +{ + ErrorF ("\nXgl usage:\n"); + +#ifdef GLXEXT + ErrorF ("-noglx don't load glx extension\n"); +#endif + + xglUseMsg (); + ErrorF ("\nXegl usage:\n"); + xeglUseMsg (); +} + +int +ddxProcessArgument (int argc, + char **argv, + int i) +{ + int skip; + +#ifdef GLXEXT + if (!strcmp (argv[i], "-noglx")) + { + loadGlx = FALSE; + return 1; + } +#endif + + skip = xglProcessArgument (argc, argv, i); + if (skip) + return skip; + + return xeglProcessArgument (argc, argv, i); +} + +void +AbortDDX (void) +{ + xeglAbort (); +} + +void +ddxGiveUp (void) +{ + xeglGiveUp (); +} + +void +OsVendorInit (void) +{ + xeglOsVendorInit (); +} diff --git a/xorg-server/hw/xgl/egl/xeglinput.c b/xorg-server/hw/xgl/egl/xeglinput.c new file mode 100644 index 000000000..8c50b7846 --- /dev/null +++ b/xorg-server/hw/xgl/egl/xeglinput.c @@ -0,0 +1,168 @@ +#include "xgl.h" +#include "xegl.h" + +KdOsFuncs *kdOsFuncs; +Bool kdEmulateMiddleButton; +Bool kdRawPointerCoordinates; +Bool kdDontZap; +Bool kdDisableZaphod; +int kdScreenPrivateIndex; + +static char * +KdParseFindNext (char *cur, char *delim, char *save, char *last) +{ + while (*cur && !strchr (delim, *cur)) + { + *save++ = *cur++; + } + *save = 0; + *last = *cur; + if (*cur) + cur++; + return cur; +} + +/* + * Mouse argument syntax: + * + * device,protocol,options... + * + * Options are any of: + * 1-5 n button mouse + * 2button emulate middle button + * {NMO} Reorder buttons + */ +char * +KdSaveString (char *str) +{ + char *n = (char *) xalloc (strlen (str) + 1); + + if (!n) + return 0; + strcpy (n, str); + return n; +} + +/* + * Parse mouse information. Syntax: + * + * <device>,<nbutton>,<protocol>{,<option>}... + * + * options: {nmo} pointer mapping (e.g. {321}) + * 2button emulate middle button + * 3button dont emulate middle button + */ +void +KdParseMouse (char *arg) +{ + char save[1024]; + char delim; + KdMouseInfo *mi; + int i; + + mi = KdMouseInfoAdd (); + if (!mi) + return; + mi->name = 0; + mi->prot = 0; + mi->emulateMiddleButton = kdEmulateMiddleButton; + mi->transformCoordinates = !kdRawPointerCoordinates; + mi->nbutton = 3; + for (i = 0; i < KD_MAX_BUTTON; i++) + mi->map[i] = i + 1; + + if (!arg) + return; + if (strlen (arg) >= sizeof (save)) + return; + arg = KdParseFindNext (arg, ",", save, &delim); + if (!save[0]) + return; + mi->name = KdSaveString (save); + if (delim != ',') + return; + + arg = KdParseFindNext (arg, ",", save, &delim); + if (!save[0]) + return; + + if ('1' <= save[0] && save[0] <= '0' + KD_MAX_BUTTON && save[1] == '\0') + { + mi->nbutton = save[0] - '0'; + if (mi->nbutton > KD_MAX_BUTTON) + { + UseMsg (); + return; + } + } + + if (!delim != ',') + return; + + arg = KdParseFindNext (arg, ",", save, &delim); + + if (save[0]) + mi->prot = KdSaveString (save); + + while (delim == ',') + { + arg = KdParseFindNext (arg, ",", save, &delim); + if (save[0] == '{') + { + char *s = save + 1; + i = 0; + while (*s && *s != '}') + { + if ('1' <= *s && *s <= '0' + mi->nbutton) + mi->map[i] = *s - '0'; + else + UseMsg (); + s++; + } + } + else if (!strcmp (save, "2button")) + mi->emulateMiddleButton = TRUE; + else if (!strcmp (save, "3button")) + mi->emulateMiddleButton = FALSE; + else if (!strcmp (save, "rawcoord")) + mi->transformCoordinates = FALSE; + else if (!strcmp (save, "transform")) + mi->transformCoordinates = TRUE; + else + UseMsg (); + } +} + +KdMouseInfo *kdMouseInfo; + +KdMouseInfo * +KdMouseInfoAdd (void) +{ + KdMouseInfo *mi, **prev; + + mi = (KdMouseInfo *) xalloc (sizeof (KdMouseInfo)); + if (!mi) + return 0; + bzero (mi, sizeof (KdMouseInfo)); + for (prev = &kdMouseInfo; *prev; prev = &(*prev)->next); + *prev = mi; + return mi; +} + +void +KdMouseInfoDispose (KdMouseInfo *mi) +{ + KdMouseInfo **prev; + + for (prev = &kdMouseInfo; *prev; prev = &(*prev)->next) + if (*prev == mi) + { + *prev = mi->next; + if (mi->name) + xfree (mi->name); + if (mi->prot) + xfree (mi->prot); + xfree (mi); + break; + } +} diff --git a/xorg-server/hw/xgl/glx/Makefile.am b/xorg-server/hw/xgl/glx/Makefile.am new file mode 100644 index 000000000..ea34ea460 --- /dev/null +++ b/xorg-server/hw/xgl/glx/Makefile.am @@ -0,0 +1,48 @@ +if XGL +XGL_MODULE_DIRS = module +endif + +DIST_SUBDIRS = module + +SUBDIRS = \ + . \ + $(XGL_MODULE_DIRS) + +AM_CFLAGS = \ + -I$(srcdir)/.. \ + -I$(srcdir)/../glxext \ + -I$(top_srcdir)/glx \ + -I$(top_srcdir)/GL/include \ + -I@MESA_SOURCE@/include \ + -I@MESA_SOURCE@/src/mesa/glapi \ + $(DIX_CFLAGS) \ + -DHAVE_XGL_CONFIG_H \ + -DHAVE_DIX_CONFIG_H \ + $(XGLXMODULES_CFLAGS) + +noinst_LTLIBRARIES = libxglx.la + +libxglx_la_SOURCES = \ + xglx.h \ + xglx.c \ + xglxorg.c + +# Xglx_DEPENDENCIES = @XGLX_LIBS@ +# Xglx_LDFLAGS = -export-dynamic +# Xglx_SOURCES = \ +# xglxinit.c \ +# $(top_srcdir)/mi/miinitext.c \ +# $(top_srcdir)/Xext/dpmsstubs.c \ +# $(top_srcdir)/Xi/stubs.c \ +# $(top_srcdir)/fb/fbcmap.c +#Xglx_LDADD = \ +# libxglx.la \ +# ../libxgl.a \ +# $(XORG_CORE_LIBS) \ +# $(XGLX_LIBS) \ +# $(EXTENSION_LIBS) \ +# $(XGLXMODULES_LIBS) \ +# -lXrandr +#Xglx_programs = Xglx +# +#bin_PROGRAMS = $(Xglx_programs) diff --git a/xorg-server/hw/xgl/glx/Makefile.in b/xorg-server/hw/xgl/glx/Makefile.in new file mode 100644 index 000000000..17563358a --- /dev/null +++ b/xorg-server/hw/xgl/glx/Makefile.in @@ -0,0 +1,797 @@ +# 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/xgl/glx +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 = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libxglx_la_LIBADD = +am_libxglx_la_OBJECTS = xglx.lo xglxorg.lo +libxglx_la_OBJECTS = $(am_libxglx_la_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 = $(libxglx_la_SOURCES) +DIST_SOURCES = $(libxglx_la_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +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@ +@XGL_TRUE@XGL_MODULE_DIRS = module +DIST_SUBDIRS = module +SUBDIRS = \ + . \ + $(XGL_MODULE_DIRS) + +AM_CFLAGS = \ + -I$(srcdir)/.. \ + -I$(srcdir)/../glxext \ + -I$(top_srcdir)/glx \ + -I$(top_srcdir)/GL/include \ + -I@MESA_SOURCE@/include \ + -I@MESA_SOURCE@/src/mesa/glapi \ + $(DIX_CFLAGS) \ + -DHAVE_XGL_CONFIG_H \ + -DHAVE_DIX_CONFIG_H \ + $(XGLXMODULES_CFLAGS) + +noinst_LTLIBRARIES = libxglx.la +libxglx_la_SOURCES = \ + xglx.h \ + xglx.c \ + xglxorg.c + +all: all-recursive + +.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/xgl/glx/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign hw/xgl/glx/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-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libxglx.la: $(libxglx_la_OBJECTS) $(libxglx_la_DEPENDENCIES) + $(LINK) $(libxglx_la_OBJECTS) $(libxglx_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglx.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglxorg.Plo@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 + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +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: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + 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: ctags-recursive $(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 + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile $(LTLIBRARIES) +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +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-recursive + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-exec-am: + +install-html: install-html-recursive + +install-info: install-info-recursive + +install-man: + +install-pdf: install-pdf-recursive + +install-ps: install-ps-recursive + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ + install-strip + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-generic clean-libtool \ + clean-noinstLTLIBRARIES ctags ctags-recursive 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 \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am + + +# Xglx_DEPENDENCIES = @XGLX_LIBS@ +# Xglx_LDFLAGS = -export-dynamic +# Xglx_SOURCES = \ +# xglxinit.c \ +# $(top_srcdir)/mi/miinitext.c \ +# $(top_srcdir)/Xext/dpmsstubs.c \ +# $(top_srcdir)/Xi/stubs.c \ +# $(top_srcdir)/fb/fbcmap.c +#Xglx_LDADD = \ +# libxglx.la \ +# ../libxgl.a \ +# $(XORG_CORE_LIBS) \ +# $(XGLX_LIBS) \ +# $(EXTENSION_LIBS) \ +# $(XGLXMODULES_LIBS) \ +# -lXrandr +#Xglx_programs = Xglx +# +#bin_PROGRAMS = $(Xglx_programs) +# 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/xgl/glx/module/Makefile.am b/xorg-server/hw/xgl/glx/module/Makefile.am new file mode 100644 index 000000000..bd1c4b08f --- /dev/null +++ b/xorg-server/hw/xgl/glx/module/Makefile.am @@ -0,0 +1,21 @@ +if GLX +GLX_LIB = $(top_builddir)/hw/xgl/glxext/libxglglxext.la +endif + +AM_CFLAGS = $(DIX_CFLAGS) \ + -I$(srcdir)/.. \ + -I$(srcdir)/../.. \ + $(XGLXMODULES_CFLAGS) + +libxglx_la_DEPENDENCIES = $(GLX_LIB) +libxglx_la_LDFLAGS = -avoid-version +libxglx_la_SOURCES = xglxmodule.c +libxglx_la_LIBADD = \ + $(top_builddir)/hw/xgl/glx/libxglx.la \ + $(GLX_LIB) \ + $(XGLXMODULES_LIBS) \ + -lXrandr + +moduledir = @xglmoduledir@ + +module_LTLIBRARIES = libxglx.la diff --git a/xorg-server/hw/xgl/glx/module/Makefile.in b/xorg-server/hw/xgl/glx/module/Makefile.in new file mode 100644 index 000000000..d84bdb070 --- /dev/null +++ b/xorg-server/hw/xgl/glx/module/Makefile.in @@ -0,0 +1,688 @@ +# 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/xgl/glx/module +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 = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(moduledir)" +moduleLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(module_LTLIBRARIES) +am__DEPENDENCIES_1 = +am_libxglx_la_OBJECTS = xglxmodule.lo +libxglx_la_OBJECTS = $(am_libxglx_la_OBJECTS) +libxglx_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libxglx_la_LDFLAGS) $(LDFLAGS) -o $@ +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 = $(libxglx_la_SOURCES) +DIST_SOURCES = $(libxglx_la_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 = @xglmoduledir@ +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@ +@GLX_TRUE@GLX_LIB = $(top_builddir)/hw/xgl/glxext/libxglglxext.la +AM_CFLAGS = $(DIX_CFLAGS) \ + -I$(srcdir)/.. \ + -I$(srcdir)/../.. \ + $(XGLXMODULES_CFLAGS) + +libxglx_la_DEPENDENCIES = $(GLX_LIB) +libxglx_la_LDFLAGS = -avoid-version +libxglx_la_SOURCES = xglxmodule.c +libxglx_la_LIBADD = \ + $(top_builddir)/hw/xgl/glx/libxglx.la \ + $(GLX_LIB) \ + $(XGLXMODULES_LIBS) \ + -lXrandr + +module_LTLIBRARIES = libxglx.la +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/xgl/glx/module/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign hw/xgl/glx/module/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 +install-moduleLTLIBRARIES: $(module_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(moduledir)" || $(MKDIR_P) "$(DESTDIR)$(moduledir)" + @list='$(module_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(moduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(moduledir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(moduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(moduledir)/$$f"; \ + else :; fi; \ + done + +uninstall-moduleLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(module_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(moduledir)/$$p'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(moduledir)/$$p"; \ + done + +clean-moduleLTLIBRARIES: + -test -z "$(module_LTLIBRARIES)" || rm -f $(module_LTLIBRARIES) + @list='$(module_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libxglx.la: $(libxglx_la_OBJECTS) $(libxglx_la_DEPENDENCIES) + $(libxglx_la_LINK) -rpath $(moduledir) $(libxglx_la_OBJECTS) $(libxglx_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglxmodule.Plo@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 $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(moduledir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +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-moduleLTLIBRARIES \ + 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-moduleLTLIBRARIES + +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: uninstall-moduleLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-moduleLTLIBRARIES 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-moduleLTLIBRARIES 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 uninstall-moduleLTLIBRARIES + +# 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/xgl/glx/module/xglxmodule.c b/xorg-server/hw/xgl/glx/module/xglxmodule.c new file mode 100644 index 000000000..40af8907d --- /dev/null +++ b/xorg-server/hw/xgl/glx/module/xglxmodule.c @@ -0,0 +1,104 @@ +/* + * Copyright © 2005 Novell, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * Novell, Inc. not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * Novell, Inc. makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#include "xglx.h" +#include "xglmodule.h" + +#include <glitz-glx.h> + +char * +moduleVersion (void) +{ + return VERSION; +} + +Bool +moduleInit (const char *module) +{ + glitz_glx_init (module); + + return TRUE; +} + +void +InitOutput (ScreenInfo *pScreenInfo, + int argc, + char **argv) +{ + xglxInitOutput (pScreenInfo, argc, argv); +} + +Bool +LegalModifier (unsigned int key, + DeviceIntPtr pDev) +{ + return xglxLegalModifier (key, pDev); +} + +void +ProcessInputEvents (void) +{ + xglxProcessInputEvents (); +} + +void +InitInput (int argc, + char **argv) +{ + xglxInitInput (argc, argv); +} + +void +ddxUseMsg (void) +{ + ErrorF ("\nXglx usage:\n"); + xglxUseMsg (); +} + +int +ddxProcessArgument (int argc, + char **argv, + int i) +{ + return xglxProcessArgument (argc, argv, i); +} + +void +AbortDDX (void) +{ + xglxAbort (); +} + +void +ddxGiveUp (void) +{ + xglxGiveUp (); +} + +void +OsVendorInit (void) +{ + xglxOsVendorInit (); +} diff --git a/xorg-server/hw/xgl/glx/xglx.c b/xorg-server/hw/xgl/glx/xglx.c new file mode 100644 index 000000000..33b276b74 --- /dev/null +++ b/xorg-server/hw/xgl/glx/xglx.c @@ -0,0 +1,1444 @@ +/* + * Copyright © 2004 David Reveman + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * David Reveman not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * David Reveman makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#include "xglx.h" + +#include <X11/extensions/Xrandr.h> +#include <X11/cursorfont.h> + +#include <glitz-glx.h> + +#ifdef GLXEXT +#include "xglglxext.h" +#endif + +#include "inputstr.h" +#include "cursorstr.h" +#include "mipointer.h" + +#ifdef RANDR +#include "randrstr.h" +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <signal.h> +#include <math.h> + +#ifdef XKB +#include <X11/extensions/XKB.h> +#include <xkbsrv.h> +#include <X11/extensions/XKBconfig.h> + +extern Bool +XkbQueryExtension (Display *dpy, + int *opcodeReturn, + int *eventBaseReturn, + int *errorBaseReturn, + int *majorRtrn, + int *minorRtrn); + +extern XkbDescPtr +XkbGetKeyboard (Display *dpy, + unsigned int which, + unsigned int deviceSpec); + +extern Status +XkbGetControls (Display *dpy, + unsigned long which, + XkbDescPtr desc); + +#ifndef XKB_BASE_DIRECTORY +#define XKB_BASE_DIRECTORY "/usr/lib/X11/xkb/" +#endif +#ifndef XKB_CONFIG_FILE +#define XKB_CONFIG_FILE "X0-config.keyboard" +#endif +#ifndef XKB_DFLT_RULES_FILE +#define XKB_DFLT_RULES_FILE "xorg" +#endif +#ifndef XKB_DFLT_KB_LAYOUT +#define XKB_DFLT_KB_LAYOUT "us" +#endif +#ifndef XKB_DFLT_KB_MODEL +#define XKB_DFLT_KB_MODEL "pc101" +#endif +#ifndef XKB_DFLT_KB_VARIANT +#define XKB_DFLT_KB_VARIANT NULL +#endif +#ifndef XKB_DFLT_KB_OPTIONS +#define XKB_DFLT_KB_OPTIONS NULL +#endif + +#endif + +#define XGLX_DEFAULT_SCREEN_WIDTH 800 +#define XGLX_DEFAULT_SCREEN_HEIGHT 600 + +typedef struct _xglxScreen { + Window win, root; + Colormap colormap; + Bool fullscreen; + CloseScreenProcPtr CloseScreen; +} xglxScreenRec, *xglxScreenPtr; + +DevPrivateKey xglxScreenPrivateKey = &xglxScreenPrivateKey; + +#define XGLX_GET_SCREEN_PRIV(pScreen) ((xglxScreenPtr) \ + dixLookupPrivate(&(pScreen)->devPrivates, xglxScreenPrivateKey)) + +#define XGLX_SET_SCREEN_PRIV(pScreen, v) \ + dixSetPrivate(&(pScreen)->devPrivates, xglxScreenPrivateKey, v) + +#define XGLX_SCREEN_PRIV(pScreen) \ + xglxScreenPtr pScreenPriv = XGLX_GET_SCREEN_PRIV (pScreen) + +typedef struct _xglxCursor { + Cursor cursor; +} xglxCursorRec, *xglxCursorPtr; + +#define XGLX_GET_CURSOR_PRIV(pCursor, pScreen) \ + ((xglxCursorPtr)dixLookupPrivate(&(pCursor)->devPrivates, pScreen)) + +#define XGLX_SET_CURSOR_PRIV(pCursor, pScreen, v) \ + dixSetPrivate(&(pCursor)->devPrivates, pScreen, v) + +#define XGLX_CURSOR_PRIV(pCursor, pScreen) \ + xglxCursorPtr pCursorPriv = XGLX_GET_CURSOR_PRIV (pCursor, pScreen) + +static char *xDisplayName = 0; +static Display *xdisplay = 0; +static int xscreen; +static CARD32 lastEventTime = 0; +static ScreenPtr currentScreen = 0; +static Bool softCursor = FALSE; +static Bool fullscreen = TRUE; + +static Bool randrExtension = FALSE; +static int randrEvent, randrError; + +static glitz_drawable_format_t *xglxScreenFormat = 0; + +static Bool +xglxAllocatePrivates (ScreenPtr pScreen) +{ + xglxScreenPtr pScreenPriv; + + pScreenPriv = xalloc (sizeof (xglxScreenRec)); + if (!pScreenPriv) + return FALSE; + + XGLX_SET_SCREEN_PRIV (pScreen, pScreenPriv); + + return TRUE; +} + +#ifdef RANDR + +#define DEFAULT_REFRESH_RATE 50 + +static Bool +xglxRandRGetInfo (ScreenPtr pScreen, + Rotation *rotations) +{ + RRScreenSizePtr pSize; + + *rotations = RR_Rotate_0; + + if (randrExtension) + { + XRRScreenConfiguration *xconfig; + XRRScreenSize *sizes; + int nSizes, currentSize = 0; + short *rates, currentRate; + int nRates, i, j; + + XGLX_SCREEN_PRIV (pScreen); + + xconfig = XRRGetScreenInfo (xdisplay, pScreenPriv->root); + sizes = XRRConfigSizes (xconfig, &nSizes); + currentRate = XRRConfigCurrentRate (xconfig); + + if (pScreenPriv->fullscreen) + { + Rotation rotation; + + currentSize = XRRConfigCurrentConfiguration (xconfig, &rotation); + + for (i = 0; i < nSizes; i++) + { + pSize = RRRegisterSize (pScreen, + sizes[i].width, + sizes[i].height, + sizes[i].mwidth, + sizes[i].mheight); + + rates = XRRConfigRates (xconfig, i, &nRates); + + for (j = 0; j < nRates; j++) + { + RRRegisterRate (pScreen, pSize, rates[j]); + + if (i == currentSize && rates[j] == currentRate) + RRSetCurrentConfig (pScreen, RR_Rotate_0, currentRate, + pSize); + } + } + } + else + { + pSize = RRRegisterSize (pScreen, + pScreen->width, + pScreen->height, + pScreen->mmWidth, + pScreen->mmHeight); + + for (i = 0; i < nSizes; i++) + { + rates = XRRConfigRates (xconfig, i, &nRates); + + for (j = 0; j < nRates; j++) + { + RRRegisterRate (pScreen, pSize, rates[j]); + + if (rates[j] == currentRate) + RRSetCurrentConfig (pScreen, RR_Rotate_0, currentRate, + pSize); + } + } + } + + XRRFreeScreenConfigInfo (xconfig); + } + else + { + pSize = RRRegisterSize (pScreen, + pScreen->width, + pScreen->height, + pScreen->mmWidth, + pScreen->mmHeight); + + RRRegisterRate (pScreen, pSize, DEFAULT_REFRESH_RATE); + RRSetCurrentConfig (pScreen, RR_Rotate_0, DEFAULT_REFRESH_RATE, pSize); + } + + return TRUE; +} + +static Bool +xglxRandRSetConfig (ScreenPtr pScreen, + Rotation rotations, + int rate, + RRScreenSizePtr pSize) +{ + if (randrExtension) + { + XRRScreenConfiguration *xconfig; + XRRScreenSize *sizes; + int nSizes, currentSize; + int i, size = -1; + int status = RRSetConfigFailed; + Rotation rotation; + + XGLX_SCREEN_PRIV (pScreen); + + xconfig = XRRGetScreenInfo (xdisplay, pScreenPriv->root); + sizes = XRRConfigSizes (xconfig, &nSizes); + currentSize = XRRConfigCurrentConfiguration (xconfig, &rotation); + + for (i = 0; i < nSizes; i++) + { + if (pScreenPriv->fullscreen) + { + if (sizes[i].width == pSize->width && + sizes[i].height == pSize->height && + sizes[i].mwidth == pSize->mmWidth && + sizes[i].mheight == pSize->mmHeight) + { + size = i; + break; + } + } + else + { + short *rates; + int nRates, j; + + rates = XRRConfigRates (xconfig, i, &nRates); + + for (j = 0; j < nRates; j++) + { + if (rates[j] == rate) + { + size = i; + if (i >= currentSize) + break; + } + } + } + } + + if (size >= 0) + status = XRRSetScreenConfigAndRate (xdisplay, + xconfig, + pScreenPriv->root, + size, + RR_Rotate_0, + rate, + CurrentTime); + + XRRFreeScreenConfigInfo (xconfig); + + if (status == RRSetConfigSuccess) + { + PixmapPtr pPixmap; + + pPixmap = (*pScreen->GetScreenPixmap) (pScreen); + + if (pScreenPriv->fullscreen) + { + XGL_PIXMAP_PRIV (pPixmap); + + xglSetRootClip (pScreen, FALSE); + + XResizeWindow (xdisplay, pScreenPriv->win, + pSize->width, pSize->height); + + glitz_drawable_update_size (pPixmapPriv->drawable, + pSize->width, pSize->height); + + pScreen->width = pSize->width; + pScreen->height = pSize->height; + pScreen->mmWidth = pSize->mmWidth; + pScreen->mmHeight = pSize->mmHeight; + + (*pScreen->ModifyPixmapHeader) (pPixmap, + pScreen->width, + pScreen->height, + pPixmap->drawable.depth, + pPixmap->drawable.bitsPerPixel, + 0, 0); + + xglSetRootClip (pScreen, TRUE); + } + + return TRUE; + } + } + + return FALSE; +} + +static Bool +xglxRandRInit (ScreenPtr pScreen) +{ + rrScrPrivPtr pScrPriv; + + if (!RRScreenInit (pScreen)) + return FALSE; + + pScrPriv = rrGetScrPriv (pScreen); + pScrPriv->rrGetInfo = xglxRandRGetInfo; + pScrPriv->rrSetConfig = xglxRandRSetConfig; + + return TRUE; +} + +#endif + +static void +xglxConstrainCursor (ScreenPtr pScreen, + BoxPtr pBox) +{ +} + +static void +xglxCursorLimits (ScreenPtr pScreen, + CursorPtr pCursor, + BoxPtr pHotBox, + BoxPtr pTopLeftBox) +{ + *pTopLeftBox = *pHotBox; +} + +static Bool +xglxDisplayCursor (ScreenPtr pScreen, + CursorPtr pCursor) +{ + XGLX_SCREEN_PRIV (pScreen); + XGLX_CURSOR_PRIV (pCursor, pScreen); + + XDefineCursor (xdisplay, pScreenPriv->win, pCursorPriv->cursor); + + return TRUE; +} + +#ifdef ARGB_CURSOR + +static Bool +xglxARGBCursorSupport (void); + +static Cursor +xglxCreateARGBCursor (ScreenPtr pScreen, + CursorPtr pCursor); + +#endif + +static Bool +xglxRealizeCursor (ScreenPtr pScreen, + CursorPtr pCursor) +{ + xglxCursorPtr pCursorPriv; + XImage *ximage; + Pixmap source, mask; + XColor fgColor, bgColor; + XlibGC xgc; + unsigned long valuemask; + XGCValues values; + + XGLX_SCREEN_PRIV (pScreen); + + valuemask = GCForeground | GCBackground; + + values.foreground = 1L; + values.background = 0L; + + pCursorPriv = xalloc (sizeof (xglxCursorRec)); + if (!pCursorPriv) + return FALSE; + + XGLX_SET_CURSOR_PRIV (pCursor, pScreen, pCursorPriv); + +#ifdef ARGB_CURSOR + if (pCursor->bits->argb) + { + pCursorPriv->cursor = xglxCreateARGBCursor (pScreen, pCursor); + if (pCursorPriv->cursor) + return TRUE; + } +#endif + + source = XCreatePixmap (xdisplay, + pScreenPriv->win, + pCursor->bits->width, + pCursor->bits->height, + 1); + + mask = XCreatePixmap (xdisplay, + pScreenPriv->win, + pCursor->bits->width, + pCursor->bits->height, + 1); + + xgc = XCreateGC (xdisplay, source, valuemask, &values); + + ximage = XCreateImage (xdisplay, + DefaultVisual (xdisplay, xscreen), + 1, XYBitmap, 0, + (char *) pCursor->bits->source, + pCursor->bits->width, + pCursor->bits->height, + BitmapPad (xdisplay), 0); + + XPutImage (xdisplay, source, xgc, ximage, + 0, 0, 0, 0, pCursor->bits->width, pCursor->bits->height); + + XFree (ximage); + + ximage = XCreateImage (xdisplay, + DefaultVisual (xdisplay, xscreen), + 1, XYBitmap, 0, + (char *) pCursor->bits->mask, + pCursor->bits->width, + pCursor->bits->height, + BitmapPad (xdisplay), 0); + + XPutImage (xdisplay, mask, xgc, ximage, + 0, 0, 0, 0, pCursor->bits->width, pCursor->bits->height); + + XFree (ximage); + XFreeGC (xdisplay, xgc); + + fgColor.red = pCursor->foreRed; + fgColor.green = pCursor->foreGreen; + fgColor.blue = pCursor->foreBlue; + + bgColor.red = pCursor->backRed; + bgColor.green = pCursor->backGreen; + bgColor.blue = pCursor->backBlue; + + pCursorPriv->cursor = + XCreatePixmapCursor (xdisplay, source, mask, &fgColor, &bgColor, + pCursor->bits->xhot, pCursor->bits->yhot); + + XFreePixmap (xdisplay, mask); + XFreePixmap (xdisplay, source); + + return TRUE; +} + +static Bool +xglxUnrealizeCursor (ScreenPtr pScreen, + CursorPtr pCursor) +{ + XGLX_CURSOR_PRIV (pCursor, pScreen); + + XFreeCursor (xdisplay, pCursorPriv->cursor); + xfree (pCursorPriv); + + return TRUE; +} + +static void +xglxRecolorCursor (ScreenPtr pScreen, + CursorPtr pCursor, + Bool displayed) +{ + XColor fgColor, bgColor; + + XGLX_CURSOR_PRIV (pCursor, pScreen); + + fgColor.red = pCursor->foreRed; + fgColor.green = pCursor->foreGreen; + fgColor.blue = pCursor->foreBlue; + + bgColor.red = pCursor->backRed; + bgColor.green = pCursor->backGreen; + bgColor.blue = pCursor->backBlue; + + XRecolorCursor (xdisplay, pCursorPriv->cursor, &fgColor, &bgColor); +} + +static Bool +xglxSetCursorPosition (ScreenPtr pScreen, + int x, + int y, + Bool generateEvent) +{ + XGLX_SCREEN_PRIV (pScreen); + + XWarpPointer (xdisplay, pScreenPriv->win, pScreenPriv->win, + 0, 0, 0, 0, x, y); + + return TRUE; +} + +static Bool +xglxCloseScreen (int index, + ScreenPtr pScreen) +{ + glitz_drawable_t *drawable; + + XGLX_SCREEN_PRIV (pScreen); + + drawable = XGL_GET_SCREEN_PRIV (pScreen)->drawable; + if (drawable) + glitz_drawable_destroy (drawable); + + xglClearVisualTypes (); + + if (pScreenPriv->win) + XDestroyWindow (xdisplay, pScreenPriv->win); + + if (pScreenPriv->colormap) + XFreeColormap (xdisplay, pScreenPriv->colormap); + + XGL_SCREEN_UNWRAP (CloseScreen); + xfree (pScreenPriv); + + return (*pScreen->CloseScreen) (index, pScreen); +} + +static Bool +xglxCursorOffScreen (ScreenPtr *ppScreen, int *x, int *y) +{ + return FALSE; +} + +static void +xglxCrossScreen (ScreenPtr pScreen, Bool entering) +{ +} + +static void +xglxWarpCursor (ScreenPtr pScreen, int x, int y) +{ + miPointerWarpCursor (pScreen, x, y); +} + +miPointerScreenFuncRec xglxPointerScreenFuncs = { + xglxCursorOffScreen, + xglxCrossScreen, + xglxWarpCursor +}; + +static Bool +xglxScreenInit (int index, + ScreenPtr pScreen, + int argc, + char **argv) +{ + XSetWindowAttributes xswa; + XWMHints *wmHints; + XSizeHints *normalHints; + XClassHint *classHint; + xglxScreenPtr pScreenPriv; + XVisualInfo *vinfo; + XEvent xevent; + glitz_drawable_format_t *format; + glitz_drawable_t *drawable; + + format = xglxScreenFormat; + + if (!xglxAllocatePrivates (pScreen)) + return FALSE; + + currentScreen = pScreen; + + pScreenPriv = XGLX_GET_SCREEN_PRIV (pScreen); + + pScreenPriv->root = RootWindow (xdisplay, xscreen); + pScreenPriv->fullscreen = fullscreen; + + vinfo = glitz_glx_get_visual_info_from_format (xdisplay, xscreen, format); + if (!vinfo) + { + ErrorF ("[%d] no visual info from format\n", index); + return FALSE; + } + + pScreenPriv->colormap = + XCreateColormap (xdisplay, pScreenPriv->root, vinfo->visual, + AllocNone); + + if (XRRQueryExtension (xdisplay, &randrEvent, &randrError)) + randrExtension = TRUE; + + if (fullscreen) + { + xglScreenInfo.width = DisplayWidth (xdisplay, xscreen); + xglScreenInfo.height = DisplayHeight (xdisplay, xscreen); + xglScreenInfo.widthMm = DisplayWidthMM (xdisplay, xscreen); + xglScreenInfo.heightMm = DisplayHeightMM (xdisplay, xscreen); + + if (randrExtension) + { + XRRScreenConfiguration *xconfig; + Rotation rotation; + XRRScreenSize *sizes; + int nSizes, currentSize; + + xconfig = XRRGetScreenInfo (xdisplay, pScreenPriv->root); + currentSize = XRRConfigCurrentConfiguration (xconfig, &rotation); + sizes = XRRConfigSizes (xconfig, &nSizes); + + xglScreenInfo.width = sizes[currentSize].width; + xglScreenInfo.height = sizes[currentSize].height; + xglScreenInfo.widthMm = sizes[currentSize].mwidth; + xglScreenInfo.heightMm = sizes[currentSize].mheight; + + XRRFreeScreenConfigInfo (xconfig); + } + } + else if (xglScreenInfo.width == 0 || xglScreenInfo.height == 0) + { + xglScreenInfo.width = XGLX_DEFAULT_SCREEN_WIDTH; + xglScreenInfo.height = XGLX_DEFAULT_SCREEN_HEIGHT; + } + + xswa.colormap = pScreenPriv->colormap; + + pScreenPriv->win = + XCreateWindow (xdisplay, pScreenPriv->root, 0, 0, + xglScreenInfo.width, xglScreenInfo.height, 0, + vinfo->depth, InputOutput, vinfo->visual, + CWColormap, &xswa); + + XFree (vinfo); + + normalHints = XAllocSizeHints (); + normalHints->flags = PMinSize | PMaxSize | PSize; + normalHints->min_width = xglScreenInfo.width; + normalHints->min_height = xglScreenInfo.height; + normalHints->max_width = xglScreenInfo.width; + normalHints->max_height = xglScreenInfo.height; + + if (fullscreen) + { + normalHints->x = 0; + normalHints->y = 0; + normalHints->flags |= PPosition; + } + + classHint = XAllocClassHint (); + classHint->res_name = "xglx"; + classHint->res_class = "Xglx"; + + wmHints = XAllocWMHints (); + wmHints->flags = InputHint; + wmHints->input = TRUE; + + Xutf8SetWMProperties (xdisplay, pScreenPriv->win, "Xglx", "Xglx", 0, 0, + normalHints, wmHints, classHint); + + XFree (wmHints); + XFree (classHint); + XFree (normalHints); + + drawable = glitz_glx_create_drawable_for_window (xdisplay, xscreen, + format, pScreenPriv->win, + xglScreenInfo.width, + xglScreenInfo.height); + if (!drawable) + { + ErrorF ("[%d] couldn't create glitz drawable for window\n", index); + return FALSE; + } + + XSelectInput (xdisplay, pScreenPriv->win, + ButtonPressMask | ButtonReleaseMask | + KeyPressMask | KeyReleaseMask | EnterWindowMask | + PointerMotionMask | ExposureMask); + + XMapWindow (xdisplay, pScreenPriv->win); + + if (fullscreen) + { + XClientMessageEvent xev; + + memset (&xev, 0, sizeof (xev)); + + xev.type = ClientMessage; + xev.message_type = XInternAtom (xdisplay, "_NET_WM_STATE", FALSE); + xev.display = xdisplay; + xev.window = pScreenPriv->win; + xev.format = 32; + xev.data.l[0] = 1; + xev.data.l[1] = + XInternAtom (xdisplay, "_NET_WM_STATE_FULLSCREEN", FALSE); + + XSendEvent (xdisplay, pScreenPriv->root, FALSE, + SubstructureRedirectMask, (XEvent *) &xev); + } + + xglScreenInfo.drawable = drawable; + + if (!xglScreenInit (pScreen)) + return FALSE; + +#ifdef GLXEXT + if (!xglInitVisualConfigs (pScreen)) + return FALSE; +#endif + + XGL_SCREEN_WRAP (CloseScreen, xglxCloseScreen); + +#ifdef ARGB_CURSOR + if (!xglxARGBCursorSupport ()) + softCursor = TRUE; +#endif + + if (softCursor) + { + static char data = 0; + XColor black, dummy; + Pixmap bitmap; + Cursor cursor; + + if (!XAllocNamedColor (xdisplay, pScreenPriv->colormap, + "black", &black, &dummy)) + return FALSE; + + bitmap = XCreateBitmapFromData (xdisplay, pScreenPriv->win, &data, + 1, 1); + if (!bitmap) + return FALSE; + + cursor = XCreatePixmapCursor (xdisplay, bitmap, bitmap, &black, &black, + 0, 0); + if (!cursor) + return FALSE; + + XDefineCursor (xdisplay, pScreenPriv->win, cursor); + + XFreeCursor (xdisplay, cursor); + XFreePixmap (xdisplay, bitmap); + XFreeColors (xdisplay, pScreenPriv->colormap, &black.pixel, 1, 0); + + miDCInitialize (pScreen, &xglxPointerScreenFuncs); + } + else + { + pScreen->ConstrainCursor = xglxConstrainCursor; + pScreen->CursorLimits = xglxCursorLimits; + pScreen->DisplayCursor = xglxDisplayCursor; + pScreen->RealizeCursor = xglxRealizeCursor; + pScreen->UnrealizeCursor = xglxUnrealizeCursor; + pScreen->RecolorCursor = xglxRecolorCursor; + pScreen->SetCursorPosition = xglxSetCursorPosition; + } + + if (!xglFinishScreenInit (pScreen)) + return FALSE; + +#ifdef RANDR + if (!xglxRandRInit (pScreen)) + return FALSE; +#endif + + while (XNextEvent (xdisplay, &xevent)) + if (xevent.type == Expose) + break; + + return TRUE; +} + +void +xglxInitOutput (ScreenInfo *pScreenInfo, + int argc, + char **argv) +{ + glitz_drawable_format_t *format, templ; + int i; + unsigned long mask; + unsigned long extraMask[] = { + GLITZ_FORMAT_DOUBLEBUFFER_MASK | GLITZ_FORMAT_ALPHA_SIZE_MASK, + GLITZ_FORMAT_DOUBLEBUFFER_MASK, + GLITZ_FORMAT_ALPHA_SIZE_MASK, + 0 + }; + + xglClearVisualTypes (); + + xglSetPixmapFormats (pScreenInfo); + + if (!xdisplay) + { + char *name = xDisplayName; + + if (!name) + name = xglxInitXorg (); + + xdisplay = XOpenDisplay (name); + if (!xdisplay) + FatalError ("can't open display: %s\n", name ? name : "NULL"); + + xscreen = DefaultScreen (xdisplay); + + if (!xDisplayName) + XDefineCursor (xdisplay, RootWindow (xdisplay, xscreen), + XCreateFontCursor (xdisplay, XC_watch)); + } + + templ.samples = 1; + templ.doublebuffer = 1; + templ.color.fourcc = GLITZ_FOURCC_RGB; + templ.color.alpha_size = 8; + + mask = GLITZ_FORMAT_SAMPLES_MASK | GLITZ_FORMAT_FOURCC_MASK; + + for (i = 0; i < sizeof (extraMask) / sizeof (extraMask[0]); i++) + { + format = glitz_glx_find_window_format (xdisplay, xscreen, + mask | extraMask[i], + &templ, 0); + if (format) + break; + } + + if (!format) + FatalError ("no visual format found"); + + xglScreenInfo.depth = + format->color.red_size + + format->color.green_size + + format->color.blue_size; + + xglSetVisualTypes (xglScreenInfo.depth, + (1 << TrueColor), + format->color.red_size, + format->color.green_size, + format->color.blue_size); + + xglxScreenFormat = format; + + AddScreen (xglxScreenInit, argc, argv); +} + +static Bool +xglxExposurePredicate (Display *xdisplay, + XEvent *xevent, + char *args) +{ + return (xevent->type == Expose); +} + +static Bool +xglxNotExposurePredicate (Display *xdisplay, + XEvent *xevent, + char *args) +{ + return (xevent->type != Expose); +} + +static int +xglxWindowExposures (WindowPtr pWin, + pointer pReg) +{ + ScreenPtr pScreen = pWin->drawable.pScreen; + RegionRec ClipList; + + if (HasBorder (pWin)) + { + REGION_INIT (pScreen, &ClipList, NullBox, 0); + REGION_SUBTRACT (pScreen, &ClipList, &pWin->borderClip, + &pWin->winSize); + REGION_INTERSECT (pScreen, &ClipList, &ClipList, (RegionPtr) pReg); + miPaintWindow(pWin, &ClipList, PW_BORDER); + REGION_UNINIT (pScreen, &ClipList); + } + + REGION_INIT (pScreen, &ClipList, NullBox, 0); + REGION_INTERSECT (pScreen, &ClipList, &pWin->clipList, (RegionPtr) pReg); + (*pScreen->WindowExposures) (pWin, &ClipList, NullRegion); + REGION_UNINIT (pScreen, &ClipList); + + return WT_WALKCHILDREN; +} + +static void +xglxBlockHandler (pointer blockData, + OSTimePtr pTimeout, + pointer pReadMask) +{ + XEvent X; + RegionRec region; + BoxRec box; + + XGL_SCREEN_PRIV (currentScreen); + + while (XCheckIfEvent (xdisplay, &X, xglxExposurePredicate, NULL)) + { + ScreenPtr pScreen = currentScreen; + + box.x1 = X.xexpose.x; + box.y1 = X.xexpose.y; + box.x2 = box.x1 + X.xexpose.width; + box.y2 = box.y1 + X.xexpose.height; + + REGION_INIT (currentScreen, ®ion, &box, 1); + + WalkTree (pScreen, xglxWindowExposures, ®ion); + + REGION_UNINIT (pScreen, ®ion); + } + + if (!xglSyncSurface (&pScreenPriv->pScreenPixmap->drawable)) + FatalError (XGL_SW_FAILURE_STRING); + + glitz_surface_flush (pScreenPriv->surface); + glitz_drawable_flush (pScreenPriv->drawable); + + XFlush (xdisplay); +} + +static void +xglxWakeupHandler (pointer blockData, + int result, + pointer pReadMask) +{ + ScreenPtr pScreen = currentScreen; + XEvent X; + xEvent x; + + while (XCheckIfEvent (xdisplay, &X, xglxNotExposurePredicate, NULL)) + { + switch (X.type) { + case KeyPress: + x.u.u.type = KeyPress; + x.u.u.detail = X.xkey.keycode; + x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis (); + mieqEnqueue (&x); + break; + case KeyRelease: + x.u.u.type = KeyRelease; + x.u.u.detail = X.xkey.keycode; + x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis (); + mieqEnqueue (&x); + break; + case ButtonPress: + x.u.u.type = ButtonPress; + x.u.u.detail = X.xbutton.button; + x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis (); + mieqEnqueue (&x); + break; + case ButtonRelease: + x.u.u.type = ButtonRelease; + x.u.u.detail = X.xbutton.button; + x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis (); + mieqEnqueue (&x); + break; + case MotionNotify: + x.u.u.type = MotionNotify; + x.u.u.detail = 0; + x.u.keyButtonPointer.rootX = X.xmotion.x; + x.u.keyButtonPointer.rootY = X.xmotion.y; + x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis (); + miPointerAbsoluteCursor (X.xmotion.x, X.xmotion.y, lastEventTime); + mieqEnqueue (&x); + break; + case EnterNotify: + if (X.xcrossing.detail != NotifyInferior) { + if (pScreen) { + NewCurrentScreen (pScreen, X.xcrossing.x, X.xcrossing.y); + x.u.u.type = MotionNotify; + x.u.u.detail = 0; + x.u.keyButtonPointer.rootX = X.xcrossing.x; + x.u.keyButtonPointer.rootY = X.xcrossing.y; + x.u.keyButtonPointer.time = lastEventTime = + GetTimeInMillis (); + mieqEnqueue (&x); + } + } + break; + default: + break; + } + } +} + +static void +xglxBell (int volume, + DeviceIntPtr pDev, + pointer ctrl, + int cls) +{ + XBell (xdisplay, volume); +} + +static void +xglxKbdCtrl (DeviceIntPtr pDev, + KeybdCtrl *ctrl) +{ + unsigned long valueMask; + XKeyboardControl values; + int i; + + valueMask = KBKeyClickPercent | KBBellPercent | KBBellPitch | + KBBellDuration | KBAutoRepeatMode; + + values.key_click_percent = ctrl->click; + values.bell_percent = ctrl->bell; + values.bell_pitch = ctrl->bell_pitch; + values.bell_duration = ctrl->bell_duration; + values.auto_repeat_mode = (ctrl->autoRepeat) ? AutoRepeatModeOn : + AutoRepeatModeOff; + + XChangeKeyboardControl (xdisplay, valueMask, &values); + + valueMask = KBLed | KBLedMode; + + for (i = 1; i <= 32; i++) + { + values.led = i; + values.led_mode = (ctrl->leds & (1 << (i - 1))) ? LedModeOn : + LedModeOff; + + XChangeKeyboardControl (xdisplay, valueMask, &values); + } +} + +static int +xglxKeybdProc (DeviceIntPtr pDevice, + int onoff) +{ + Bool ret = FALSE; + DevicePtr pDev = (DevicePtr) pDevice; + + if (!pDev) + return BadImplementation; + + switch (onoff) { + case DEVICE_INIT: { + XModifierKeymap *xmodMap; + KeySym *xkeyMap; + int minKeyCode, maxKeyCode, mapWidth, i, j; + KeySymsRec xglxKeySyms; + CARD8 xglxModMap[256]; + XKeyboardState values; + +#ifdef _XSERVER64 + KeySym64 *xkeyMap64; + int len; +#endif + +#ifdef XKB + Bool xkbExtension = FALSE; + int xkbOp, xkbEvent, xkbError, xkbMajor, xkbMinor; +#endif + + if (pDev != (DevicePtr)inputInfo.keyboard) + return !Success; + + xmodMap = XGetModifierMapping (xdisplay); + + XDisplayKeycodes (xdisplay, &minKeyCode, &maxKeyCode); + +#ifdef _XSERVER64 + xkeyMap64 = XGetKeyboardMapping (xdisplay, + minKeyCode, + maxKeyCode - minKeyCode + 1, + &mapWidth); + + len = (maxKeyCode - minKeyCode + 1) * mapWidth; + xkeyMap = (KeySym *) xalloc (len * sizeof (KeySym)); + for (i = 0; i < len; ++i) + xkeyMap[i] = xkeyMap64[i]; + + XFree (xkeyMap64); +#else + xkeyMap = XGetKeyboardMapping (xdisplay, + minKeyCode, + maxKeyCode - minKeyCode + 1, + &mapWidth); +#endif + + memset (xglxModMap, 0, 256); + + for (j = 0; j < 8; j++) + { + for (i = 0; i < xmodMap->max_keypermod; i++) + { + CARD8 keyCode; + + keyCode = xmodMap->modifiermap[j * xmodMap->max_keypermod + i]; + if (keyCode) + xglxModMap[keyCode] |= 1 << j; + } + } + + XFreeModifiermap (xmodMap); + + xglxKeySyms.minKeyCode = minKeyCode; + xglxKeySyms.maxKeyCode = maxKeyCode; + xglxKeySyms.mapWidth = mapWidth; + xglxKeySyms.map = xkeyMap; + +#ifdef XKB + if (!noXkbExtension) + xkbExtension = XkbQueryExtension (xdisplay, + &xkbOp, &xkbEvent, &xkbError, + &xkbMajor, &xkbMinor); + + if (xkbExtension) + { + XkbDescPtr desc; + char *rules, *model, *layout, *variants, *options; + + desc = XkbGetKeyboard (xdisplay, + XkbGBN_AllComponentsMask, + XkbUseCoreKbd); + + if (desc && desc->geom) + { + XkbComponentNamesRec names; + FILE *file; + + rules = XKB_DFLT_RULES_FILE; + model = XKB_DFLT_KB_MODEL; + layout = XKB_DFLT_KB_LAYOUT; + variants = XKB_DFLT_KB_VARIANT; + options = XKB_DFLT_KB_OPTIONS; + + XkbGetControls (xdisplay, XkbAllControlsMask, desc); + + memset (&names, 0, sizeof (XkbComponentNamesRec)); + + XkbSetRulesDflts (rules, model, layout, variants, options); + + ret = XkbInitKeyboardDeviceStruct ((pointer) pDev, + &names, + &xglxKeySyms, + xglxModMap, + xglxBell, + xglxKbdCtrl); + + if (ret) + XkbDDXChangeControls ((pointer) pDev, desc->ctrls, + desc->ctrls); + + XkbFreeKeyboard (desc, 0, False); + } + } +#endif + + if (!ret) + { + XGetKeyboardControl (xdisplay, &values); + + memmove (defaultKeyboardControl.autoRepeats, + values.auto_repeats, sizeof (values.auto_repeats)); + + ret = InitKeyboardDeviceStruct (pDev, + &xglxKeySyms, + xglxModMap, + xglxBell, + xglxKbdCtrl); + } + +#ifdef _XSERVER64 + xfree (xkeyMap); +#else + XFree (xkeyMap); +#endif + + if (!ret) + return BadImplementation; + + } break; + case DEVICE_ON: + pDev->on = TRUE; + break; + case DEVICE_OFF: + case DEVICE_CLOSE: + pDev->on = FALSE; + break; + } + + return Success; +} + +Bool +xglxLegalModifier (unsigned int key, + DeviceIntPtr pDev) +{ + return TRUE; +} + +void +xglxProcessInputEvents (void) +{ + mieqProcessInputEvents (); + miPointerUpdate (); +} + +void +xglxInitInput (int argc, + char **argv) +{ + DeviceIntPtr pKeyboard, pPointer; + + pPointer = AddInputDevice (xglMouseProc, TRUE); + pKeyboard = AddInputDevice (xglxKeybdProc, TRUE); + + RegisterPointerDevice (pPointer); + RegisterKeyboardDevice (pKeyboard); + + miRegisterPointerDevice (screenInfo.screens[0], pPointer); + mieqInit (&pKeyboard->public, &pPointer->public); + + AddEnabledDevice (XConnectionNumber (xdisplay)); + + RegisterBlockAndWakeupHandlers (xglxBlockHandler, + xglxWakeupHandler, + NULL); +} + +void +xglxUseMsg (void) +{ + ErrorF ("-screen WIDTH[/WIDTHMM]xHEIGHT[/HEIGHTMM] " + "specify screen characteristics\n"); + ErrorF ("-fullscreen run fullscreen\n"); + ErrorF ("-display string display name of the real server\n"); + ErrorF ("-softcursor force software cursor\n"); + + if (!xDisplayName) + xglxUseXorgMsg (); +} + +int +xglxProcessArgument (int argc, + char **argv, + int i) +{ + static Bool checkDisplayName = FALSE; + + if (!checkDisplayName) + { + char *display = ":0"; + int j; + + for (j = i; j < argc; j++) + { + if (!strcmp (argv[j], "-display")) + { + if (++j < argc) + xDisplayName = argv[j]; + + break; + } + else if (argv[j][0] == ':') + { + display = argv[j]; + } + } + + if (!xDisplayName) + xDisplayName = getenv ("DISPLAY"); + + if (xDisplayName) + { + int n; + + n = strspn (xDisplayName, ":0123456789"); + if (strncmp (xDisplayName, display, n) == 0) + xDisplayName = 0; + } + + if (xDisplayName) + fullscreen = FALSE; + + checkDisplayName = TRUE; + } + + if (!strcmp (argv[i], "-screen")) + { + if ((i + 1) < argc) + { + xglParseScreen (argv[i + 1]); + } + else + return 1; + + return 2; + } + else if (!strcmp (argv[i], "-fullscreen")) + { + fullscreen = TRUE; + return 1; + } + else if (!strcmp (argv[i], "-display")) + { + if (++i < argc) + return 2; + + return 0; + } + else if (!strcmp (argv[i], "-softcursor")) + { + softCursor = TRUE; + return 1; + } + else if (!xDisplayName) + { + return xglxProcessXorgArgument (argc, argv, i); + } + + return 0; +} + +void +xglxAbort (void) +{ + xglxAbortXorg (); +} + +void +xglxGiveUp (void) +{ + AbortDDX (); +} + +void +xglxOsVendorInit (void) +{ +} + +#ifdef ARGB_CURSOR + +#include <X11/extensions/Xrender.h> + +static Bool +xglxARGBCursorSupport (void) +{ + int renderMajor, renderMinor; + + if (!XRenderQueryVersion (xdisplay, &renderMajor, &renderMinor)) + renderMajor = renderMinor = -1; + + return (renderMajor > 0 || renderMinor > 4); +} + +static Cursor +xglxCreateARGBCursor (ScreenPtr pScreen, + CursorPtr pCursor) +{ + Pixmap xpixmap; + XlibGC xgc; + XImage *ximage; + XRenderPictFormat *xformat; + Picture xpicture; + Cursor cursor; + + XGLX_SCREEN_PRIV (pScreen); + + xpixmap = XCreatePixmap (xdisplay, + pScreenPriv->win, + pCursor->bits->width, + pCursor->bits->height, + 32); + + xgc = XCreateGC (xdisplay, xpixmap, 0, NULL); + + ximage = XCreateImage (xdisplay, + DefaultVisual (xdisplay, xscreen), + 32, ZPixmap, 0, + (char *) pCursor->bits->argb, + pCursor->bits->width, + pCursor->bits->height, + 32, pCursor->bits->width * 4); + + XPutImage (xdisplay, xpixmap, xgc, ximage, + 0, 0, 0, 0, pCursor->bits->width, pCursor->bits->height); + + XFree (ximage); + XFreeGC (xdisplay, xgc); + + xformat = XRenderFindStandardFormat (xdisplay, PictStandardARGB32); + xpicture = XRenderCreatePicture (xdisplay, xpixmap, xformat, 0, 0); + + cursor = XRenderCreateCursor (xdisplay, xpicture, + pCursor->bits->xhot, + pCursor->bits->yhot); + + XRenderFreePicture (xdisplay, xpicture); + XFreePixmap (xdisplay, xpixmap); + + return cursor; +} + +#endif diff --git a/xorg-server/hw/xgl/glx/xglx.h b/xorg-server/hw/xgl/glx/xglx.h new file mode 100644 index 000000000..a8c894661 --- /dev/null +++ b/xorg-server/hw/xgl/glx/xglx.h @@ -0,0 +1,138 @@ +/* + * Copyright © 2005 Novell, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * Novell, Inc. not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * Novell, Inc. makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#ifndef _XGLX_H_ +#define _XGLX_H_ + +#include "xgl.h" + +#ifdef _XSERVER64 +#define _XSERVER64_tmp +#undef _XSERVER64 +typedef unsigned long XID64; +typedef unsigned long Mask64; +typedef unsigned long Atom64; +typedef unsigned long VisualID64; +typedef unsigned long Time64; +#define XID XID64 +#define Mask Mask64 +#define Atom Atom64 +#define VisualID VisualID64 +#define Time Time64 +typedef XID Window64; +typedef XID Drawable64; +typedef XID Font64; +typedef XID Pixmap64; +typedef XID Cursor64; +typedef XID Colormap64; +typedef XID GContext64; +typedef XID KeySym64; +#define Window Window64 +#define Drawable Drawable64 +#define Font Font64 +#define Pixmap Pixmap64 +#define Cursor Cursor64 +#define Colormap Colormap64 +#define GContext GContext64 +#define KeySym KeySym64 +#endif + +#define GC XlibGC +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#undef GC + +#ifdef _XSERVER64_tmp +#ifndef _XSERVER64 +#define _XSERVER64 +#endif +#undef _XSERVER64_tmp +#undef XID +#undef Mask +#undef Atom +#undef VisualID +#undef Time +#undef Window +#undef Drawable +#undef Font +#undef Pixmap +#undef Cursor +#undef Colormap +#undef GContext +#undef KeySym +#endif + +void +xglxInitOutput (ScreenInfo *pScreenInfo, + int argc, + char **argv); + +Bool +xglxLegalModifier (unsigned int key, + DeviceIntPtr pDev); + +void +xglxProcessInputEvents (void); + +void +xglxInitInput (int argc, + char **argv); + +void +xglxUseMsg (void); + +int +xglxProcessArgument (int argc, + char **argv, + int i); + +void +xglxAbort (void); + +void +xglxGiveUp (void); + +void +xglxOsVendorInit (void); + +#ifndef NXGLXORG + +void +xglxUseXorgMsg (void); + +int +xglxProcessXorgArgument (int argc, + char **argv, + int i); + +void +xglxAbortXorg (void); + +char * +xglxInitXorg (void); + +#endif + +#endif /* _XGLX_H_ */ diff --git a/xorg-server/hw/xgl/glx/xglxorg.c b/xorg-server/hw/xgl/glx/xglxorg.c new file mode 100644 index 000000000..1d6fc9a30 --- /dev/null +++ b/xorg-server/hw/xgl/glx/xglxorg.c @@ -0,0 +1,674 @@ +/* + * Copyright © 2005 Novell, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * Novell, Inc. not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * Novell, Inc. makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Authors: David Reveman <davidr@novell.com> + * Matthias Hopf <mhopf@suse.de> + */ + +#include "xglx.h" + +#ifndef NXGLXORG + +#include <X11/Xauth.h> + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <errno.h> +#include <ctype.h> +#include <signal.h> +#include <setjmp.h> +#include <sys/types.h> +#include <sys/wait.h> +#include <sys/stat.h> +#include <libgen.h> + +typedef void (*sighandler_t) (int); + +#define XORG_DIE_TIMEOUT 3 +#define XORG_DEV_RANDOM "/dev/urandom" + +static char xorgAuthBuf[256]; +static char *xorgAuthTempl = "/tmp/.Xgl-auth-XXXXXX"; +static char *xorgAuth = NULL; + +static char *xorgProgs[] = { "/usr/bin/Xorg", "/usr/X11R6/bin/Xorg" }; +static char *xorgProg = NULL; + +static char *xorgDisplay = ":93"; +static char *xorgTerminate = "-terminate"; + +static pid_t xorgPid = 0; +static int receivedUsr1 = 0; +static jmp_buf jumpbuf; + +static Bool waitAndExit = FALSE; + +static char **xorgArgv = 0; +static int nXorgArgv = 0; + +typedef struct _xglxArg *xglxArgPtr; + +typedef int (*xglxProcessArgumentProc) (xglxArgPtr, int, char **, int); + +typedef struct _xglxArg { + xglxProcessArgumentProc processArgument; + const char *name; + const char *usage; +} xglxArgRec; + +static int +xglxAddXorgArguments (char **argv, + int n) +{ + char **newArgv; + int i; + + newArgv = xrealloc (xorgArgv, sizeof (char *) * (nXorgArgv + n)); + if (!newArgv) + return 0; + + for (i = 0; i < n; i++) + newArgv[nXorgArgv + i] = argv[i]; + + xorgArgv = newArgv; + nXorgArgv += n; + + return n; +} + +static int +xglxProcessCommonXorgArgument (xglxArgPtr pArg, + int n, + int argc, + char **argv, + int i) +{ + if (strcmp (argv[i], pArg->name) == 0) + { + if (i + n - 1 < argc) + return xglxAddXorgArguments (&argv[i], n); + } + + return 0; +} + +#define PROCESS_COMMON_XORG_ARGUMENT_IMP(args) \ + static int \ + xglxProcess ## args ## CommonXorgArgument (xglxArgPtr pArg, \ + int argc, \ + char **argv, \ + int i) \ + { \ + return xglxProcessCommonXorgArgument (pArg, args, argc, argv, i); \ + } + +PROCESS_COMMON_XORG_ARGUMENT_IMP (1) +PROCESS_COMMON_XORG_ARGUMENT_IMP (2) + +static int +xglxProcessXorgVTArgument (xglxArgPtr pArg, + int argc, + char **argv, + int i) +{ + if (argv[i][0] == 'v' && argv[i][1] == 't' && + strspn (&argv[i][2], "0123456789") == strlen (&argv[i][2])) + return xglxAddXorgArguments (&argv[i], 1); + + return 0; +} + +static int +xglxProcessXorgAcArgument (xglxArgPtr pArg, + int argc, + char **argv, + int i) +{ + static char *ac = "-ac"; + + if (strcmp (argv[i], pArg->name) == 0) + { + if (xglxAddXorgArguments (&ac, 1)) + return 1; + } + + return 0; +} + +static int +xglxProcessXorgVersionArgument (xglxArgPtr pArg, + int argc, + char **argv, + int i) +{ + static char *version = "-version"; + + if (strcmp (argv[i], pArg->name) == 0) + { + if (xglxAddXorgArguments (&version, 1)) + { + waitAndExit = TRUE; + return 1; + } + } + + return 0; +} + +static int +xglxProcessXorgProgArgument (xglxArgPtr pArg, + int argc, + char **argv, + int i) +{ + if (strcmp (argv[i], pArg->name) == 0) + { + if (i + 1 < argc) + { + xorgProg = argv[i + 1]; + return 2; + } + } + + return 0; +} + +static int +xglxProcessXorgDisplayArgument (xglxArgPtr pArg, + int argc, + char **argv, + int i) +{ + if (strcmp (argv[i], pArg->name) == 0) + { + if (i + 1 < argc) + { + xorgDisplay = argv[i + 1]; + return 2; + } + } + + return 0; +} + +static int +xglxProcessXorgWaitExitArgument (xglxArgPtr pArg, + int argc, + char **argv, + int i) +{ + if (xglxProcessCommonXorgArgument (pArg, 1, argc, argv, i)) + { + waitAndExit = TRUE; + return 1; + } + + return 0; +} + +#define ARG(processArgument, name, usage) \ + { processArgument, name, usage } + +#define XORG_ARG(name, args) \ + ARG (xglxProcess ## args ## CommonXorgArgument, name, 0) + +#define XORG_UARG(name, usage, args) \ + ARG (xglxProcess ## args ## CommonXorgArgument, name, usage) + +xglxArgRec xorgUid0Args[] = { + XORG_UARG ("-modulepath", " paths specify the module search path", 2), + XORG_UARG ("-logfile", " file specify a log file name", 2), + ARG (xglxProcessXorgWaitExitArgument, "-configure", + " probe for devices and write an Xorg config") +}; + +xglxArgRec xorgUidArgs[] = { + XORG_UARG ("-config", + " file specify configuration file, relative to the\n" + " Xorg config search path, " + "only root can use absolute", 2) +}; + +xglxArgRec xorgArgs[] = { + ARG (xglxProcessXorgWaitExitArgument, "-probeonly", + " probe for devices, then exit"), + XORG_UARG ("-verbose", " [n] verbose startup messages", 2), + XORG_UARG ("-logverbose", " [n] verbose log messages", 2), + XORG_UARG ("-quiet", " minimal startup messages", 1), + XORG_UARG ("-depth", " n set colour depth. Default: 8", 2), + XORG_UARG ("-gamma", + " f set gamma value (0.1 < f < 10.0) " + "Default: 1.0", 2), + XORG_UARG ("-rgamma", " f set gamma value for red phase", 2), + XORG_UARG ("-ggamma", " f set gamma value for green phase", + 2), + XORG_UARG ("-bgamma", " f set gamma value for blue phase", 2), + XORG_UARG ("-layout", + " name specify the ServerLayout section name", 2), + XORG_UARG ("-screen", + " name specify the Screen section name", 2), + XORG_UARG ("-keyboard", + " name specify the core keyboard InputDevice name", 2), + XORG_UARG ("-pointer", + " name specify the core pointer InputDevice name", 2), + XORG_UARG ("-nosilk", " disable Silken Mouse", 1), + XORG_UARG ("-disableModInDev", + " disable dynamic modification of input device settings", + 1), + XORG_UARG ("-allowMouseOpenFail", + " start server even if the mouse can't be initialized", 1), + XORG_UARG ("-bestRefresh", + " choose modes with the best refresh rate", 1), + XORG_UARG ("-ignoreABI", + " make module ABI mismatches non-fatal", 1), + XORG_UARG ("-isolateDevice", + " bus_id restrict device resets to bus_id (PCI only)", 2), + ARG (xglxProcessXorgVTArgument, "vtXX", + " use the specified VT number"), + XORG_UARG ("-keeptty", + " don't detach controlling tty " + "(for debugging only)", 1), + XORG_UARG ("-novtswitch", " don't immediately switch to new VT", + 1), + XORG_UARG ("-sharevts", " share VTs with another X server", + 1), + ARG (xglxProcessXorgAcArgument, "-xorgAc", + " disable access control restrictions"), + ARG (xglxProcessXorgProgArgument, "-xorgProgram", + " server program"), + ARG (xglxProcessXorgDisplayArgument, "-xorgDisplay", + " server display"), + ARG (xglxProcessXorgVersionArgument, "-xorgVersion", + " show the server version") +}; + +xglxArgRec sharedArgs[] = { + XORG_ARG ("-br", 1) +}; + +void +xglxUseXorgMsg (void) +{ + int i; + + ErrorF ("\nXorg usage:\n"); + + if (getuid () == 0) + { + for (i = 0; i < sizeof (xorgUid0Args) / sizeof (xglxArgRec); i++) + ErrorF ("%s%s\n", xorgUid0Args[i].name, xorgUid0Args[i].usage); + } + else + { + for (i = 0; i < sizeof (xorgUidArgs) / sizeof (xglxArgRec); i++) + ErrorF ("%s%s\n", xorgUidArgs[i].name, xorgUidArgs[i].usage); + } + + for (i = 0; i < sizeof (xorgArgs) / sizeof (xglxArgRec); i++) + ErrorF ("%s%s\n", xorgArgs[i].name, xorgArgs[i].usage); +} + +int +xglxProcessXorgArgument (int argc, + char **argv, + int i) +{ + int skip, j; + + if (nXorgArgv == 0) + { + if (!xglxAddXorgArguments (&xorgProg, 1)) + return 0; + } + + if (getuid () == 0) + { + for (j = 0; j < sizeof (xorgUid0Args) / sizeof (xglxArgRec); j++) + { + skip = (*xorgUid0Args[j].processArgument) (&xorgUid0Args[j], + argc, argv, i); + if (skip) + return skip; + } + } + else + { + for (j = 0; j < sizeof (xorgUidArgs) / sizeof (xglxArgRec); j++) + { + skip = (*xorgUidArgs[j].processArgument) (&xorgUidArgs[j], + argc, argv, i); + if (skip) + return skip; + } + } + + for (j = 0; j < sizeof (xorgArgs) / sizeof (xorgArgs[0]); j++) + { + skip = (*xorgArgs[j].processArgument) (&xorgArgs[j], argc, argv, i); + if (skip) + return skip; + } + + for (j = 0; j < sizeof (sharedArgs) / sizeof (sharedArgs[0]); j++) + { + skip = (*sharedArgs[j].processArgument) (&sharedArgs[j], argc, argv, i); + if (skip) + return 0; + } + + return 0; +} + +static void +sigAlarm (int sig) +{ + ErrorF ("%s won't die, killing it\n", basename (xorgProg)); + + kill (xorgPid, SIGKILL); + if (xorgPid) + while (waitpid (xorgPid, NULL, 0) == -1 && errno == EINTR); +} + +void +xglxAbortXorg (void) +{ + sighandler_t oldSigAlarm; + unsigned int oldAlarm; + int status = 0; + char *name; + + if (!xorgPid) + return; + + name = basename (xorgProg); + + oldAlarm = alarm (0); + oldSigAlarm = signal (SIGALRM, sigAlarm); + + kill (xorgPid, SIGTERM); + + alarm (XORG_DIE_TIMEOUT); + while (waitpid (xorgPid, &status, 0) == -1 && errno == EINTR); + alarm (0); + + signal (SIGALRM, oldSigAlarm); + alarm (oldAlarm); + + if (WIFEXITED (status)) + { + if (WEXITSTATUS (status)) + ErrorF ("%s died, exit status %d\n", name, WEXITSTATUS (status)); + } + else if (WIFSIGNALED (status)) + ErrorF ("%s died, signal %d\n", name, WTERMSIG (status)); + else + ErrorF ("%s died, dubious exit\n", name); + + if (xorgAuth) + unlink (xorgAuth); +} + +static void +sigUsr1Waiting (int sig) +{ + signal (sig, sigUsr1Waiting); + receivedUsr1++; +} + +static void +sigUsr1Jump (int sig) +{ + +#ifdef HAVE_SIGPROCMASK + sigset_t set; +#endif + + signal (sig, sigUsr1Waiting); + +#ifdef HAVE_SIGPROCMASK + sigemptyset (&set); + sigaddset (&set, SIGUSR1); + sigprocmask (SIG_UNBLOCK, &set, NULL); +#endif + + longjmp (jumpbuf, 1); +} + +#define AUTH_DATA_LEN 16 /* bytes of authorization data */ + +static Bool +xglxSetupAuth (char *name, int authFd) +{ + Xauth auth; + int randomFd; + ssize_t bytes, size; + char authHost[256]; + char authData[AUTH_DATA_LEN]; + FILE *file; + + auth.family = FamilyLocal; + + gethostname (authHost, sizeof (authHost)); + + auth.address = authHost; + auth.address_length = strlen (authHost); + + auth.number = strrchr (xorgDisplay, ':'); + if (!auth.number) + { + ErrorF ("Bad Xorg display name: %s\n", xorgDisplay); + return FALSE; + } + + auth.number++; + + auth.number_length = strlen (auth.number); + if (!auth.number_length) + { + ErrorF ("Bad Xorg display name: %s\n", xorgDisplay); + return FALSE; + } + + auth.name = "MIT-MAGIC-COOKIE-1"; + auth.name_length = strlen (auth.name); + + randomFd = open (XORG_DEV_RANDOM, O_RDONLY); + if (randomFd == -1) + { + ErrorF ("Failed to open " XORG_DEV_RANDOM "\n"); + return FALSE; + } + + bytes = 0; + do { + size = read (randomFd, authData + bytes, AUTH_DATA_LEN - bytes); + if (size <= 0) + break; + + bytes += size; + } while (bytes != AUTH_DATA_LEN); + + close (randomFd); + + if (bytes != AUTH_DATA_LEN) + { + ErrorF ("Failed to read %d random bytes from " XORG_DEV_RANDOM "\n", + AUTH_DATA_LEN); + return FALSE; + } + + auth.data = authData; + auth.data_length = AUTH_DATA_LEN; + + file = fdopen (authFd, "w"); + if (!file) + { + ErrorF ("Failed to open authorization file: %s\n", name); + close (authFd); + return FALSE; + } + + XauWriteAuth (file, &auth); + fclose (file); + + return TRUE; +} + +char * +xglxInitXorg (void) +{ + sighandler_t oldSigUsr1; + pid_t pid; + char *name; + char *auth[] = { "-auth", xorgAuthBuf, "-nolisten", "tcp" }; + char *saver[] = { "-dpms", "-v", "-s", "0" }; + char *endArg = NULL; + int authFd; + int mask; + + if (xorgPid) + return xorgDisplay; + + if (!xorgProg) + { + struct stat buf; + int i; + + for (i = 0; i < sizeof (xorgProgs) / sizeof (char *); i++) + { + if (stat (xorgProgs[i], &buf) == 0) + { + xorgProg = xorgProgs[i]; + break; + } + } + + if (!xorgProg) + FatalError ("Can't find Xorg executable\n"); + } + + strcpy (xorgAuthBuf, xorgAuthTempl); + mask = umask (0077); + authFd = mkstemp (xorgAuthBuf); + umask (mask); + if (authFd == -1) + FatalError ("Failed to generate unique authorization file\n"); + + xorgAuth = xorgAuthBuf; + + if (nXorgArgv == 0) + { + if (!xglxAddXorgArguments (&xorgProg, 1)) + return 0; + } + else + { + xorgArgv[0] = xorgProg; + } + + if (!xglxAddXorgArguments (auth, sizeof (auth) / sizeof (char *))) + return 0; + + if (!xglxAddXorgArguments (saver, sizeof (saver) / sizeof (char *))) + return 0; + + if (!xglxAddXorgArguments (&xorgDisplay, 1)) + return 0; + + if (!xglxAddXorgArguments (&xorgTerminate, 1)) + return 0; + + if (!xglxAddXorgArguments (&endArg, 1)) + return 0; + + name = basename (xorgProg); + + if (!xglxSetupAuth (xorgAuth, authFd)) + FatalError ("Failed to set up authorization: %s\n", xorgAuth); + + oldSigUsr1 = signal (SIGUSR1, sigUsr1Waiting); + + pid = fork (); + + switch (pid) { + case -1: + perror ("fork"); + FatalError ("fork"); + break; + case 0: + signal (SIGUSR1, SIG_IGN); + execv (xorgArgv[0], xorgArgv); + perror (xorgArgv[0]); + exit (2); + break; + default: + xorgPid = pid; + break; + } + + for (;;) + { + int status; + + signal (SIGUSR1, sigUsr1Waiting); + if (setjmp (jumpbuf) && !waitAndExit) + break; + + signal (SIGUSR1, sigUsr1Jump); + if (receivedUsr1 && !waitAndExit) + break; + + if (waitpid (xorgPid, &status, 0) != -1) + { + if (WIFEXITED (status)) + { + if (waitAndExit) + { + if (WEXITSTATUS (status)) + FatalError ("%s died, exit status %d\n", name, + WEXITSTATUS (status)); + + exit (WEXITSTATUS (status)); + } + else + { + FatalError ("%s died, exit status %d\n", name, + WEXITSTATUS (status)); + } + } + else if (WIFSIGNALED (status)) + FatalError ("%s died, signal %d\n", name, WTERMSIG (status)); + else + FatalError ("%s died, dubious exit\n", name); + } + } + + signal (SIGUSR1, oldSigUsr1); + + setenv ("XAUTHORITY", xorgAuth, 1); + + return xorgDisplay; +} + +#endif diff --git a/xorg-server/hw/xgl/glxext/Makefile.am b/xorg-server/hw/xgl/glxext/Makefile.am new file mode 100644 index 000000000..f79b855e7 --- /dev/null +++ b/xorg-server/hw/xgl/glxext/Makefile.am @@ -0,0 +1,21 @@ +SUBDIRS = module + +AM_CFLAGS = \ + $(DIX_CFLAGS) \ + -DHAVE_XGL_CONFIG_H \ + -DHAVE_DIX_CONFIG_H \ + $(XGLMODULES_CFLAGS) \ + -I$(top_srcdir)/glx \ + -I$(top_srcdir)/GL/include \ + -I$(top_srcdir)/hw/xgl \ + -I@MESA_SOURCE@/include \ + -I@MESA_SOURCE@/src/mesa/glapi + +libxglglxext_libraries = libxglglxext.la +libxglglxext_la_SOURCES = \ + xglglxext.h \ + xglglxext.c \ + xglglxlog.c + +noinst_LTLIBRARIES = $(libxglglxext_libraries) + diff --git a/xorg-server/hw/xgl/glxext/Makefile.in b/xorg-server/hw/xgl/glxext/Makefile.in new file mode 100644 index 000000000..8a034935b --- /dev/null +++ b/xorg-server/hw/xgl/glxext/Makefile.in @@ -0,0 +1,773 @@ +# 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/xgl/glxext +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 = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libxglglxext_la_LIBADD = +am_libxglglxext_la_OBJECTS = xglglxext.lo xglglxlog.lo +libxglglxext_la_OBJECTS = $(am_libxglglxext_la_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 = $(libxglglxext_la_SOURCES) +DIST_SOURCES = $(libxglglxext_la_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +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@ +SUBDIRS = module +AM_CFLAGS = \ + $(DIX_CFLAGS) \ + -DHAVE_XGL_CONFIG_H \ + -DHAVE_DIX_CONFIG_H \ + $(XGLMODULES_CFLAGS) \ + -I$(top_srcdir)/glx \ + -I$(top_srcdir)/GL/include \ + -I$(top_srcdir)/hw/xgl \ + -I@MESA_SOURCE@/include \ + -I@MESA_SOURCE@/src/mesa/glapi + +libxglglxext_libraries = libxglglxext.la +libxglglxext_la_SOURCES = \ + xglglxext.h \ + xglglxext.c \ + xglglxlog.c + +noinst_LTLIBRARIES = $(libxglglxext_libraries) +all: all-recursive + +.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/xgl/glxext/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign hw/xgl/glxext/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-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libxglglxext.la: $(libxglglxext_la_OBJECTS) $(libxglglxext_la_DEPENDENCIES) + $(LINK) $(libxglglxext_la_OBJECTS) $(libxglglxext_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglglxext.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglglxlog.Plo@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 + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +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: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + 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: ctags-recursive $(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 + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile $(LTLIBRARIES) +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +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-recursive + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-exec-am: + +install-html: install-html-recursive + +install-info: install-info-recursive + +install-man: + +install-pdf: install-pdf-recursive + +install-ps: install-ps-recursive + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ + install-strip + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-generic clean-libtool \ + clean-noinstLTLIBRARIES ctags ctags-recursive 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 \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ + 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/xgl/glxext/module/Makefile.am b/xorg-server/hw/xgl/glxext/module/Makefile.am new file mode 100644 index 000000000..67653cde4 --- /dev/null +++ b/xorg-server/hw/xgl/glxext/module/Makefile.am @@ -0,0 +1,22 @@ +AM_CFLAGS = \ + $(DIX_CFLAGS) \ + -DHAVE_XGL_CONFIG_H \ + -DHAVE_DIX_CONFIG_H \ + $(XGLMODULES_CFLAGS) \ + -I$(top_srcdir)/hw/xgl + +libglx_la_LDFLAGS = -avoid-version +libglx_la_SOURCES = glxmodule.c +libglx_la_LIBADD = $(top_builddir)/glx/libglx.la +libglx_modules = libglx.la + +libglcore_la_LDFLAGS = -avoid-version +libglcore_la_SOURCES = glcoremodule.c +libglcore_la_LIBADD = $(top_builddir)/GL/mesa/libGLcore.la +libglcore_modules = libglcore.la + +moduledir = @XGL_MODULE_PATH@ + +module_LTLIBRARIES = \ + $(libglcore_modules) \ + $(libglx_modules) diff --git a/xorg-server/hw/xgl/glxext/module/Makefile.in b/xorg-server/hw/xgl/glxext/module/Makefile.in new file mode 100644 index 000000000..733dfebd2 --- /dev/null +++ b/xorg-server/hw/xgl/glxext/module/Makefile.in @@ -0,0 +1,700 @@ +# 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/xgl/glxext/module +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 = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(moduledir)" +moduleLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(module_LTLIBRARIES) +libglcore_la_DEPENDENCIES = $(top_builddir)/GL/mesa/libGLcore.la +am_libglcore_la_OBJECTS = glcoremodule.lo +libglcore_la_OBJECTS = $(am_libglcore_la_OBJECTS) +libglcore_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libglcore_la_LDFLAGS) $(LDFLAGS) -o $@ +libglx_la_DEPENDENCIES = $(top_builddir)/glx/libglx.la +am_libglx_la_OBJECTS = glxmodule.lo +libglx_la_OBJECTS = $(am_libglx_la_OBJECTS) +libglx_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libglx_la_LDFLAGS) $(LDFLAGS) -o $@ +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 = $(libglcore_la_SOURCES) $(libglx_la_SOURCES) +DIST_SOURCES = $(libglcore_la_SOURCES) $(libglx_la_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 = @XGL_MODULE_PATH@ +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@ +AM_CFLAGS = \ + $(DIX_CFLAGS) \ + -DHAVE_XGL_CONFIG_H \ + -DHAVE_DIX_CONFIG_H \ + $(XGLMODULES_CFLAGS) \ + -I$(top_srcdir)/hw/xgl + +libglx_la_LDFLAGS = -avoid-version +libglx_la_SOURCES = glxmodule.c +libglx_la_LIBADD = $(top_builddir)/glx/libglx.la +libglx_modules = libglx.la +libglcore_la_LDFLAGS = -avoid-version +libglcore_la_SOURCES = glcoremodule.c +libglcore_la_LIBADD = $(top_builddir)/GL/mesa/libGLcore.la +libglcore_modules = libglcore.la +module_LTLIBRARIES = \ + $(libglcore_modules) \ + $(libglx_modules) + +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/xgl/glxext/module/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign hw/xgl/glxext/module/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 +install-moduleLTLIBRARIES: $(module_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(moduledir)" || $(MKDIR_P) "$(DESTDIR)$(moduledir)" + @list='$(module_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(moduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(moduledir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(moduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(moduledir)/$$f"; \ + else :; fi; \ + done + +uninstall-moduleLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(module_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(moduledir)/$$p'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(moduledir)/$$p"; \ + done + +clean-moduleLTLIBRARIES: + -test -z "$(module_LTLIBRARIES)" || rm -f $(module_LTLIBRARIES) + @list='$(module_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libglcore.la: $(libglcore_la_OBJECTS) $(libglcore_la_DEPENDENCIES) + $(libglcore_la_LINK) -rpath $(moduledir) $(libglcore_la_OBJECTS) $(libglcore_la_LIBADD) $(LIBS) +libglx.la: $(libglx_la_OBJECTS) $(libglx_la_DEPENDENCIES) + $(libglx_la_LINK) -rpath $(moduledir) $(libglx_la_OBJECTS) $(libglx_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glcoremodule.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glxmodule.Plo@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 $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(moduledir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +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-moduleLTLIBRARIES \ + 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-moduleLTLIBRARIES + +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: uninstall-moduleLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-moduleLTLIBRARIES 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-moduleLTLIBRARIES 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 uninstall-moduleLTLIBRARIES + +# 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/xgl/glxext/module/glcoremodule.c b/xorg-server/hw/xgl/glxext/module/glcoremodule.c new file mode 100644 index 000000000..37aa9c658 --- /dev/null +++ b/xorg-server/hw/xgl/glxext/module/glcoremodule.c @@ -0,0 +1,38 @@ +/* + * Copyright © 2005 Novell, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * Novell, Inc. not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * Novell, Inc. makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#include "xglmodule.h" + +char * +moduleVersion (void) +{ + return VERSION; +} + +Bool +moduleInit (const char *module) +{ + return TRUE; +} diff --git a/xorg-server/hw/xgl/glxext/module/glxmodule.c b/xorg-server/hw/xgl/glxext/module/glxmodule.c new file mode 100644 index 000000000..37aa9c658 --- /dev/null +++ b/xorg-server/hw/xgl/glxext/module/glxmodule.c @@ -0,0 +1,38 @@ +/* + * Copyright © 2005 Novell, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * Novell, Inc. not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * Novell, Inc. makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#include "xglmodule.h" + +char * +moduleVersion (void) +{ + return VERSION; +} + +Bool +moduleInit (const char *module) +{ + return TRUE; +} diff --git a/xorg-server/hw/xgl/glxext/xglglxext.c b/xorg-server/hw/xgl/glxext/xglglxext.c new file mode 100644 index 000000000..c260d8e2d --- /dev/null +++ b/xorg-server/hw/xgl/glxext/xglglxext.c @@ -0,0 +1,5772 @@ +/* + * Copyright © 2005 Novell, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * Novell, Inc. not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * Novell, Inc. makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#include "xgl.h" +#include "xglglx.h" +#include "xglglxext.h" + +#include <GL/gl.h> +#include <GL/glext.h> +#include <GL/internal/glcore.h> + +#include "glxserver.h" +#include "glxdrawable.h" +#include "glxscreens.h" +#include "glxutil.h" +#include "unpack.h" +#include "g_disptab.h" +#include "glapitable.h" +#include "glxext.h" +#include "micmap.h" + +#define XGL_MAX_TEXTURE_UNITS 8 +#define XGL_MAX_ATTRIB_STACK_DEPTH 16 + +#define XGL_TEXTURE_1D_BIT (1 << 0) +#define XGL_TEXTURE_2D_BIT (1 << 1) +#define XGL_TEXTURE_3D_BIT (1 << 2) +#define XGL_TEXTURE_RECTANGLE_BIT (1 << 3) +#define XGL_TEXTURE_CUBE_MAP_BIT (1 << 4) + +typedef Bool (*GLXScreenProbeProc) (int screen); +typedef __GLinterface *(*GLXCreateContextProc) (__GLimports *imports, + __GLcontextModes *modes, + __GLinterface *shareGC); +typedef void (*GLXCreateBufferProc) (__GLXdrawablePrivate *glxPriv); +typedef GLboolean (*GLXSwapBuffersProc) (__GLXdrawablePrivate *glxPriv); +typedef int (*GLXBindBuffersProc) (__GLXdrawablePrivate *glxPriv, + int buffer); +typedef int (*GLXReleaseBuffersProc) (__GLXdrawablePrivate *glxPriv, + int buffer); + +typedef struct _xglGLXScreenInfo { + GLXScreenProbeProc screenProbe; + GLXCreateContextProc createContext; + GLXCreateBufferProc createBuffer; +} xglGLXScreenInfoRec, *xglGLXScreenInfoPtr; + +extern __GLXscreenInfo *__xglScreenInfoPtr; + +static xglGLXScreenInfoRec screenInfoPriv; + +//extern __GLXscreenInfo __glDDXScreenInfo; + +typedef GLboolean (*GLResizeBuffersProc) (__GLdrawableBuffer *buffer, + GLint x, + GLint y, + GLuint width, + GLuint height, + __GLdrawablePrivate *glPriv, + GLuint bufferMask); +typedef void (*GLFreeBuffersProc) (__GLdrawablePrivate *glPriv); + +typedef struct _xglGLBuffer { + GLXSwapBuffersProc swapBuffers; + GLXBindBuffersProc bindBuffers; + GLXReleaseBuffersProc releaseBuffers; + GLResizeBuffersProc resizeBuffers; + GLFreeBuffersProc freeBuffers; + ScreenPtr pScreen; + DrawablePtr pDrawable; + xglVisualPtr pVisual; + glitz_drawable_t *drawable; + glitz_surface_t *backSurface; + PixmapPtr pPixmap; + GCPtr pGC; + RegionRec damage; + void *private; + int screenX, screenY; + int xOff, yOff; + int yFlip; +} xglGLBufferRec, *xglGLBufferPtr; + +typedef int xglGLXVisualConfigRec, *xglGLXVisualConfigPtr; +typedef struct _xglDisplayList *xglDisplayListPtr; + +#define XGL_LIST_OP_CALLS 0 +#define XGL_LIST_OP_DRAW 1 +#define XGL_LIST_OP_GL 2 +#define XGL_LIST_OP_LIST 3 + +typedef struct _xglGLOp { + void (*glProc) (struct _xglGLOp *pOp); + union { + GLenum enumeration; + GLbitfield bitfield; + GLsizei size; + struct { + GLint x; + GLint y; + GLsizei width; + GLsizei height; + } rect; + struct { + GLenum target; + GLuint texture; + } bind_texture; + struct { + GLenum target; + GLenum pname; + GLfloat params[4]; + } tex_parameter_fv; + struct { + GLint x; + GLint y; + GLsizei width; + GLsizei height; + GLenum type; + } copy_pixels; + struct { + GLenum target; + GLint level; + GLenum internalformat; + GLint x; + GLint y; + GLsizei width; + GLint border; + } copy_tex_image_1d; + struct { + GLenum target; + GLint level; + GLenum internalformat; + GLint x; + GLint y; + GLsizei width; + GLsizei height; + GLint border; + } copy_tex_image_2d; + struct { + GLenum target; + GLint level; + GLint xoffset; + GLint x; + GLint y; + GLsizei width; + } copy_tex_sub_image_1d; + struct { + GLenum target; + GLint level; + GLint xoffset; + GLint yoffset; + GLint x; + GLint y; + GLsizei width; + GLsizei height; + } copy_tex_sub_image_2d; + struct { + GLenum target; + GLenum internalformat; + GLint x; + GLint y; + GLsizei width; + } copy_color_table; + struct { + GLenum target; + GLsizei start; + GLint x; + GLint y; + GLsizei width; + } copy_color_sub_table; + struct { + GLenum target; + GLenum internalformat; + GLint x; + GLint y; + GLsizei width; + } copy_convolution_filter_1d; + struct { + GLenum target; + GLenum internalformat; + GLint x; + GLint y; + GLsizei width; + GLsizei height; + } copy_convolution_filter_2d; + struct { + GLenum target; + GLint level; + GLint xoffset; + GLint yoffset; + GLint zoffset; + GLint x; + GLint y; + GLsizei width; + GLsizei height; + } copy_tex_sub_image_3d; + struct { + GLfloat x; + GLfloat y; + GLfloat z; + } window_pos_3f; + } u; +} xglGLOpRec, *xglGLOpPtr; + +typedef struct _xglListOp { + int type; + union { + GLuint list; + xglGLOpPtr gl; + } u; +} xglListOpRec, *xglListOpPtr; + +typedef struct _xglDisplayList { + xglListOpPtr pOp; + int nOp; + int size; +} xglDisplayListRec; + +typedef struct _xglTexObj { + GLuint key; + GLuint name; + PixmapPtr pPixmap; + glitz_texture_object_t *object; + int refcnt; +} xglTexObjRec, *xglTexObjPtr; + +typedef struct _xglTexUnit { + GLbitfield enabled; + xglTexObjPtr p1D; + xglTexObjPtr p2D; + xglTexObjPtr p3D; + xglTexObjPtr pRect; + xglTexObjPtr pCubeMap; +} xglTexUnitRec, *xglTexUnitPtr; + +typedef struct _xglGLAttributes { + GLbitfield mask; + GLenum drawBuffer; + GLenum readBuffer; + xRectangle viewport; + xRectangle scissor; + GLboolean scissorTest; + xglTexUnitRec texUnits[XGL_MAX_TEXTURE_UNITS]; +} xglGLAttributesRec, *xglGLAttributesPtr; + +typedef struct _xglGLContext { + __GLinterface iface; + __GLinterface *mIface; + int refcnt; + struct _xglGLContext *shared; + glitz_context_t *context; + struct _glapi_table glRenderTable; + PFNGLACTIVETEXTUREARBPROC ActiveTextureARB; + PFNGLWINDOWPOS3FMESAPROC WindowPos3fMESA; + Bool needInit; + xglGLBufferPtr pDrawBuffer; + xglGLBufferPtr pReadBuffer; + int drawXoff, drawYoff; + __GLdrawablePrivate *readPriv; + __GLdrawablePrivate *drawPriv; + char *versionString; + GLenum errorValue; + GLboolean doubleBuffer; + GLint depthBits; + GLint stencilBits; + xglHashTablePtr texObjects; + xglHashTablePtr displayLists; + GLuint list; + GLenum listMode; + GLuint beginCnt; + xglDisplayListPtr pList; + GLuint groupList; + xglGLAttributesRec attrib; + xglGLAttributesRec attribStack[XGL_MAX_ATTRIB_STACK_DEPTH]; + int nAttribStack; + int activeTexUnit; + GLint maxTexUnits; + GLint maxListNesting; + GLint maxAttribStackDepth; +} xglGLContextRec, *xglGLContextPtr; + +static xglGLContextPtr cctx = NULL; + +static void +xglSetCurrentContext (xglGLContextPtr pContext); + +#define XGL_GLX_DRAW_PROLOGUE_WITHOUT_TEXTURES(pBox, nBox, pScissorBox) \ + (pBox) = REGION_RECTS (cctx->pDrawBuffer->pGC->pCompositeClip); \ + (nBox) = REGION_NUM_RECTS (cctx->pDrawBuffer->pGC->pCompositeClip); \ + (pScissorBox)->x1 = cctx->attrib.scissor.x + cctx->pDrawBuffer->xOff; \ + (pScissorBox)->x2 = (pScissorBox)->x1 + cctx->attrib.scissor.width; \ + (pScissorBox)->y2 = cctx->attrib.scissor.y + cctx->pDrawBuffer->yOff; \ + (pScissorBox)->y2 = cctx->pDrawBuffer->yFlip - (pScissorBox)->y2; \ + (pScissorBox)->y1 = (pScissorBox)->y2 - cctx->attrib.scissor.height + +#define XGL_GLX_DRAW_PROLOGUE(pBox, nBox, pScissorBox) \ + XGL_GLX_DRAW_PROLOGUE_WITHOUT_TEXTURES (pBox, nBox, pScissorBox); \ + xglSetupTextures () + +#define XGL_GLX_DRAW_BOX(pBox1, pBox2) \ + (pBox1)->x1 = cctx->pDrawBuffer->screenX + (pBox2)->x1; \ + (pBox1)->y1 = cctx->pDrawBuffer->screenY + (pBox2)->y1; \ + (pBox1)->x2 = cctx->pDrawBuffer->screenX + (pBox2)->x2; \ + (pBox1)->y2 = cctx->pDrawBuffer->screenY + (pBox2)->y2 + +#define XGL_GLX_INTERSECT_BOX(pBox1, pBox2) \ + { \ + if ((pBox1)->x1 < (pBox2)->x1) \ + (pBox1)->x1 = (pBox2)->x1; \ + if ((pBox1)->y1 < (pBox2)->y1) \ + (pBox1)->y1 = (pBox2)->y1; \ + if ((pBox1)->x2 > (pBox2)->x2) \ + (pBox1)->x2 = (pBox2)->x2; \ + if ((pBox1)->y2 > (pBox2)->y2) \ + (pBox1)->y2 = (pBox2)->y2; \ + } + +#define XGL_GLX_SET_SCISSOR_BOX(pBox) \ + glScissor ((pBox)->x1, \ + cctx->pDrawBuffer->yFlip - (pBox)->y2, \ + (pBox)->x2 - (pBox)->x1, \ + (pBox)->y2 - (pBox)->y1) + +#define XGL_GLX_DRAW_DAMAGE(pBox, pRegion) \ + if (cctx->attrib.drawBuffer != GL_BACK) \ + { \ + (pRegion)->extents.x1 = (pBox)->x1 - cctx->pDrawBuffer->screenX; \ + (pRegion)->extents.y1 = (pBox)->y1 - cctx->pDrawBuffer->screenY; \ + (pRegion)->extents.x2 = (pBox)->x2 - cctx->pDrawBuffer->screenX; \ + (pRegion)->extents.y2 = (pBox)->y2 - cctx->pDrawBuffer->screenY; \ + (pRegion)->data = (RegDataPtr) NULL; \ + REGION_UNION (cctx->pDrawBuffer->pGC->pScreen, \ + &cctx->pDrawBuffer->damage, \ + &cctx->pDrawBuffer->damage, \ + pRegion); \ + xglAddBitDamage (cctx->pDrawBuffer->pDrawable, pRegion); \ + } + +static void +xglRecordError (GLenum error) +{ + if (cctx->errorValue == GL_NO_ERROR) + cctx->errorValue = error; +} + +static xglDisplayListPtr +xglCreateList (void) +{ + xglDisplayListPtr pDisplayList; + + pDisplayList = xalloc (sizeof (xglDisplayListRec)); + if (!pDisplayList) + return NULL; + + pDisplayList->pOp = NULL; + pDisplayList->nOp = 0; + pDisplayList->size = 0; + + return pDisplayList; +} + +static void +xglDestroyList (xglDisplayListPtr pDisplayList) +{ + xglListOpPtr pOp = pDisplayList->pOp; + int nOp = pDisplayList->nOp; + + while (nOp--) + { + switch (pOp->type) { + case XGL_LIST_OP_CALLS: + case XGL_LIST_OP_DRAW: + glDeleteLists (pOp->u.list, 1); + break; + case XGL_LIST_OP_GL: + xfree (pOp->u.gl); + break; + case XGL_LIST_OP_LIST: + break; + } + + pOp++; + } + + if (pDisplayList->pOp) + xfree (pDisplayList->pOp); + + xfree (pDisplayList); +} + +static Bool +xglResizeList (xglDisplayListPtr pDisplayList, + int nOp) +{ + if (pDisplayList->size < nOp) + { + int size = pDisplayList->nOp ? pDisplayList->nOp : 4; + + while (size < nOp) + size <<= 1; + + pDisplayList->pOp = xrealloc (pDisplayList->pOp, + sizeof (xglListOpRec) * size); + if (!pDisplayList->pOp) + return FALSE; + + pDisplayList->size = size; + } + + return TRUE; +} + +static void +xglStartList (int type, + GLenum mode) +{ + if (!xglResizeList (cctx->pList, cctx->pList->nOp + 1)) + { + xglRecordError (GL_OUT_OF_MEMORY); + return; + } + + cctx->pList->pOp[cctx->pList->nOp].type = type; + cctx->pList->pOp[cctx->pList->nOp].u.list = glGenLists (1); + + glNewList (cctx->pList->pOp[cctx->pList->nOp].u.list, mode); + + cctx->pList->nOp++; +} + +static void +xglGLOp (xglGLOpPtr pOp) +{ + if (cctx->list) + { + xglGLOpPtr pGLOp; + + pGLOp = xalloc (sizeof (xglGLOpRec)); + if (!pGLOp) + { + xglRecordError (GL_OUT_OF_MEMORY); + return; + } + + if (!xglResizeList (cctx->pList, cctx->pList->nOp + 1)) + { + xfree (pGLOp); + xglRecordError (GL_OUT_OF_MEMORY); + return; + } + + glEndList (); + + *pGLOp = *pOp; + + cctx->pList->pOp[cctx->pList->nOp].type = XGL_LIST_OP_GL; + cctx->pList->pOp[cctx->pList->nOp].u.gl = pGLOp; + cctx->pList->nOp++; + + if (cctx->listMode == GL_COMPILE_AND_EXECUTE) + (*pOp->glProc) (pOp); + + xglStartList (XGL_LIST_OP_CALLS, cctx->listMode); + } + else + (*pOp->glProc) (pOp); +} + +static void +xglViewportProc (xglGLOpPtr pOp) +{ + cctx->attrib.viewport.x = pOp->u.rect.x; + cctx->attrib.viewport.y = pOp->u.rect.y; + cctx->attrib.viewport.width = pOp->u.rect.width; + cctx->attrib.viewport.height = pOp->u.rect.height; + + glViewport (pOp->u.rect.x + cctx->pDrawBuffer->xOff, + pOp->u.rect.y + cctx->pDrawBuffer->yOff, + pOp->u.rect.width, + pOp->u.rect.height); +} + +static void +xglViewport (GLint x, + GLint y, + GLsizei width, + GLsizei height) +{ + xglGLOpRec gl; + + gl.glProc = xglViewportProc; + + gl.u.rect.x = x; + gl.u.rect.y = y; + gl.u.rect.width = width; + gl.u.rect.height = height; + + xglGLOp (&gl); +} + +static void +xglScissorProc (xglGLOpPtr pOp) +{ + cctx->attrib.scissor.x = pOp->u.rect.x; + cctx->attrib.scissor.y = pOp->u.rect.y; + cctx->attrib.scissor.width = pOp->u.rect.width; + cctx->attrib.scissor.height = pOp->u.rect.height; +} + +static void +xglScissor (GLint x, + GLint y, + GLsizei width, + GLsizei height) +{ + xglGLOpRec gl; + + gl.glProc = xglScissorProc; + + gl.u.rect.x = x; + gl.u.rect.y = y; + gl.u.rect.width = width; + gl.u.rect.height = height; + + xglGLOp (&gl); +} + +static void +xglDrawBufferProc (xglGLOpPtr pOp) +{ + glitz_drawable_buffer_t buffers[2]; + + switch (pOp->u.enumeration) { + case GL_FRONT: + buffers[0] = GLITZ_DRAWABLE_BUFFER_FRONT_COLOR; + glitz_context_draw_buffers (cctx->context, buffers, 1); + break; + case GL_FRONT_AND_BACK: + buffers[0] = GLITZ_DRAWABLE_BUFFER_FRONT_COLOR; + if (cctx->doubleBuffer) + { + buffers[1] = GLITZ_DRAWABLE_BUFFER_BACK_COLOR; + glitz_context_draw_buffers (cctx->context, buffers, 2); + } + else + glitz_context_draw_buffers (cctx->context, buffers, 1); + break; + case GL_BACK: + if (!cctx->doubleBuffer) + { + xglRecordError (GL_INVALID_OPERATION); + return; + } + buffers[0] = GLITZ_DRAWABLE_BUFFER_BACK_COLOR; + glitz_context_draw_buffers (cctx->context, buffers, 1); + break; + default: + xglRecordError (GL_INVALID_ENUM); + return; + } + + cctx->attrib.drawBuffer = pOp->u.enumeration; +} + +static void +xglDrawBuffer (GLenum mode) +{ + xglGLOpRec gl; + + gl.glProc = xglDrawBufferProc; + + gl.u.enumeration = mode; + + xglGLOp (&gl); +} + +static void +xglReadBufferProc (xglGLOpPtr pOp) +{ + switch (pOp->u.enumeration) { + case GL_FRONT: + glitz_context_read_buffer (cctx->context, + GLITZ_DRAWABLE_BUFFER_FRONT_COLOR); + break; + case GL_BACK: + if (!cctx->doubleBuffer) + { + xglRecordError (GL_INVALID_OPERATION); + return; + } + glitz_context_read_buffer (cctx->context, + GLITZ_DRAWABLE_BUFFER_BACK_COLOR); + break; + default: + xglRecordError (GL_INVALID_ENUM); + return; + } + + cctx->attrib.readBuffer = pOp->u.enumeration; +} + +static void +xglReadBuffer (GLenum mode) +{ + xglGLOpRec gl; + + gl.glProc = xglReadBufferProc; + + gl.u.enumeration = mode; + + xglGLOp (&gl); +} + +static void +xglDisableProc (xglGLOpPtr pOp) +{ + xglTexUnitPtr pTexUnit = &cctx->attrib.texUnits[cctx->activeTexUnit]; + + switch (pOp->u.enumeration) { + case GL_SCISSOR_TEST: + cctx->attrib.scissorTest = GL_FALSE; + return; + case GL_TEXTURE_1D: + pTexUnit->enabled &= ~XGL_TEXTURE_1D_BIT; + break; + case GL_TEXTURE_2D: + pTexUnit->enabled &= ~XGL_TEXTURE_2D_BIT; + break; + case GL_TEXTURE_3D: + pTexUnit->enabled &= ~XGL_TEXTURE_3D_BIT; + break; + case GL_TEXTURE_RECTANGLE_NV: + pTexUnit->enabled &= ~XGL_TEXTURE_RECTANGLE_BIT; + break; + case GL_TEXTURE_CUBE_MAP_ARB: + pTexUnit->enabled &= ~XGL_TEXTURE_CUBE_MAP_BIT; + break; + default: + break; + } + + glDisable (pOp->u.enumeration); +} + +static void +xglDisable (GLenum cap) +{ + xglGLOpRec gl; + + gl.glProc = xglDisableProc; + + gl.u.enumeration = cap; + + xglGLOp (&gl); +} + +static void +xglEnableProc (xglGLOpPtr pOp) +{ + xglTexUnitPtr pTexUnit = &cctx->attrib.texUnits[cctx->activeTexUnit]; + + switch (pOp->u.enumeration) { + case GL_SCISSOR_TEST: + cctx->attrib.scissorTest = GL_TRUE; + return; + case GL_DEPTH_TEST: + if (!cctx->depthBits) + return; + case GL_STENCIL_TEST: + if (!cctx->stencilBits) + return; + case GL_TEXTURE_1D: + pTexUnit->enabled |= XGL_TEXTURE_1D_BIT; + break; + case GL_TEXTURE_2D: + pTexUnit->enabled |= XGL_TEXTURE_2D_BIT; + break; + case GL_TEXTURE_3D: + pTexUnit->enabled |= XGL_TEXTURE_3D_BIT; + break; + case GL_TEXTURE_RECTANGLE_NV: + pTexUnit->enabled |= XGL_TEXTURE_RECTANGLE_BIT; + break; + case GL_TEXTURE_CUBE_MAP_ARB: + pTexUnit->enabled |= XGL_TEXTURE_CUBE_MAP_BIT; + break; + default: + break; + } + + glEnable (pOp->u.enumeration); +} + +static void +xglEnable (GLenum cap) +{ + xglGLOpRec gl; + + gl.glProc = xglEnableProc; + + gl.u.enumeration = cap; + + xglGLOp (&gl); +} + +static void +xglDeleteTexObj (xglTexObjPtr pTexObj) +{ + if (pTexObj->pPixmap) + { + ScreenPtr pScreen = pTexObj->pPixmap->drawable.pScreen; + + (*pScreen->DestroyPixmap) (pTexObj->pPixmap); + + glitz_texture_object_destroy (pTexObj->object); + } + + if (pTexObj->name) + { + glDeleteTextures (1, &pTexObj->name); + } + + pTexObj->key = 0; + pTexObj->name = 0; + pTexObj->pPixmap = NULL; + pTexObj->object = NULL; +} + +static void +xglRefTexObj (xglTexObjPtr pTexObj) +{ + if (!pTexObj) + return; + + pTexObj->refcnt++; +} + +static void +xglUnrefTexObj (xglTexObjPtr pTexObj) +{ + if (!pTexObj) + return; + + pTexObj->refcnt--; + if (pTexObj->refcnt) + return; + + xglDeleteTexObj (pTexObj); + + xfree (pTexObj); +} + +static void +xglPushAttribProc (xglGLOpPtr pOp) +{ + xglGLAttributesPtr pAttrib; + + if (cctx->nAttribStack == cctx->maxAttribStackDepth) + { + xglRecordError (GL_STACK_OVERFLOW); + return; + } + + pAttrib = &cctx->attribStack[cctx->nAttribStack]; + + *pAttrib = cctx->attrib; + pAttrib->mask = pOp->u.bitfield; + + if (pOp->u.bitfield & GL_TEXTURE_BIT) + { + int i; + + for (i = 0; i < cctx->maxTexUnits; i++) + { + xglRefTexObj (pAttrib->texUnits[i].p1D); + xglRefTexObj (pAttrib->texUnits[i].p2D); + xglRefTexObj (pAttrib->texUnits[i].p3D); + xglRefTexObj (pAttrib->texUnits[i].pRect); + xglRefTexObj (pAttrib->texUnits[i].pCubeMap); + } + } + + cctx->nAttribStack++; + + glPushAttrib (pOp->u.bitfield); +} + +static void +xglPushAttrib (GLbitfield mask) +{ + xglGLOpRec gl; + + gl.glProc = xglPushAttribProc; + + gl.u.bitfield = mask; + + xglGLOp (&gl); +} + +static void +xglPopAttribProc (xglGLOpPtr pOp) +{ + xglGLAttributesPtr pAttrib; + GLbitfield mask; + + if (!cctx->nAttribStack) + { + xglRecordError (GL_STACK_UNDERFLOW); + return; + } + + cctx->nAttribStack--; + + pAttrib = &cctx->attribStack[cctx->nAttribStack]; + mask = pAttrib->mask; + + if (mask & GL_COLOR_BUFFER_BIT) + xglDrawBuffer (pAttrib->drawBuffer); + + if (mask & GL_PIXEL_MODE_BIT) + xglReadBuffer (pAttrib->readBuffer); + + if (mask & GL_SCISSOR_BIT) + { + xglScissor (pAttrib->scissor.x, + pAttrib->scissor.y, + pAttrib->scissor.width, + pAttrib->scissor.height); + + if (pAttrib->scissorTest) + xglEnable (GL_SCISSOR_TEST); + else + xglDisable (GL_SCISSOR_TEST); + } + else if (mask & GL_ENABLE_BIT) + { + if (pAttrib->scissorTest) + xglEnable (GL_SCISSOR_TEST); + else + xglDisable (GL_SCISSOR_TEST); + } + + if (mask & GL_VIEWPORT_BIT) + xglViewport (pAttrib->viewport.x, + pAttrib->viewport.y, + pAttrib->viewport.width, + pAttrib->viewport.height); + + if (mask & GL_TEXTURE_BIT) + { + int i; + + for (i = 0; i < cctx->maxTexUnits; i++) + { + xglUnrefTexObj (cctx->attrib.texUnits[i].p1D); + xglUnrefTexObj (cctx->attrib.texUnits[i].p2D); + xglUnrefTexObj (cctx->attrib.texUnits[i].p3D); + xglUnrefTexObj (cctx->attrib.texUnits[i].pRect); + xglUnrefTexObj (cctx->attrib.texUnits[i].pCubeMap); + + cctx->attrib.texUnits[i] = pAttrib->texUnits[i]; + } + } + else if (mask & GL_ENABLE_BIT) + { + int i; + + for (i = 0; i < cctx->maxTexUnits; i++) + cctx->attrib.texUnits[i].enabled = pAttrib->texUnits[i].enabled; + } + + glPopAttrib (); +} + +static void +xglPopAttrib (void) +{ + xglGLOpRec gl; + + gl.glProc = xglPopAttribProc; + + xglGLOp (&gl); +} + +static GLuint +xglActiveTextureBinding (GLenum target) +{ + xglTexObjPtr pTexObj; + + switch (target) { + case GL_TEXTURE_BINDING_1D: + pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].p1D; + break; + case GL_TEXTURE_BINDING_2D: + pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].p2D; + break; + case GL_TEXTURE_BINDING_3D: + pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].p3D; + break; + case GL_TEXTURE_BINDING_RECTANGLE_NV: + pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].pRect; + break; + case GL_TEXTURE_BINDING_CUBE_MAP_ARB: + pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].pCubeMap; + break; + default: + return 0; + } + + if (pTexObj) + return pTexObj->key; + + return 0; +} + +#define DOUBLE_TO_BOOLEAN(X) ((X) ? GL_TRUE : GL_FALSE) +#define INT_TO_BOOLEAN(I) ((I) ? GL_TRUE : GL_FALSE) +#define ENUM_TO_BOOLEAN(E) ((E) ? GL_TRUE : GL_FALSE) + +static void +xglGetBooleanv (GLenum pname, + GLboolean *params) +{ + switch (pname) { + case GL_CURRENT_RASTER_POSITION: + { + GLdouble v[4]; + + glGetDoublev (GL_CURRENT_RASTER_POSITION, v); + + params[0] = DOUBLE_TO_BOOLEAN (v[0] - (GLdouble) cctx->drawXoff); + params[1] = DOUBLE_TO_BOOLEAN (v[1] - (GLdouble) cctx->drawYoff); + params[2] = DOUBLE_TO_BOOLEAN (v[2]); + params[3] = DOUBLE_TO_BOOLEAN (v[3]); + } break; + case GL_DOUBLEBUFFER: + params[0] = cctx->doubleBuffer; + break; + case GL_DEPTH_BITS: + params[0] = INT_TO_BOOLEAN (cctx->depthBits); + break; + case GL_STENCIL_BITS: + params[0] = INT_TO_BOOLEAN (cctx->stencilBits); + break; + case GL_DRAW_BUFFER: + params[0] = ENUM_TO_BOOLEAN (cctx->attrib.drawBuffer); + break; + case GL_READ_BUFFER: + params[0] = ENUM_TO_BOOLEAN (cctx->attrib.readBuffer); + break; + case GL_SCISSOR_BOX: + params[0] = INT_TO_BOOLEAN (cctx->attrib.scissor.x); + params[1] = INT_TO_BOOLEAN (cctx->attrib.scissor.y); + params[2] = INT_TO_BOOLEAN (cctx->attrib.scissor.width); + params[3] = INT_TO_BOOLEAN (cctx->attrib.scissor.height); + break; + case GL_SCISSOR_TEST: + params[0] = cctx->attrib.scissorTest; + break; + case GL_VIEWPORT: + params[0] = INT_TO_BOOLEAN (cctx->attrib.viewport.x); + params[1] = INT_TO_BOOLEAN (cctx->attrib.viewport.y); + params[2] = INT_TO_BOOLEAN (cctx->attrib.viewport.width); + params[3] = INT_TO_BOOLEAN (cctx->attrib.viewport.height); + break; + case GL_TEXTURE_BINDING_1D: + case GL_TEXTURE_BINDING_2D: + case GL_TEXTURE_BINDING_3D: + case GL_TEXTURE_BINDING_RECTANGLE_NV: + case GL_TEXTURE_BINDING_CUBE_MAP_ARB: + /* should be safe to fall-through here */ + default: + glGetBooleanv (pname, params); + } +} + +#define INT_TO_DOUBLE(I) ((GLdouble) (I)) +#define ENUM_TO_DOUBLE(E) ((GLdouble) (E)) +#define BOOLEAN_TO_DOUBLE(B) ((B) ? 1.0F : 0.0F) + +static void +xglGetDoublev (GLenum pname, + GLdouble *params) +{ + switch (pname) { + case GL_CURRENT_RASTER_POSITION: + glGetDoublev (GL_CURRENT_RASTER_POSITION, params); + + params[0] -= (GLdouble) cctx->drawXoff; + params[1] -= (GLdouble) cctx->drawYoff; + break; + case GL_DOUBLEBUFFER: + params[0] = BOOLEAN_TO_DOUBLE (cctx->doubleBuffer); + break; + case GL_DEPTH_BITS: + params[0] = INT_TO_DOUBLE (cctx->depthBits); + break; + case GL_STENCIL_BITS: + params[0] = INT_TO_DOUBLE (cctx->stencilBits); + break; + case GL_DRAW_BUFFER: + params[0] = ENUM_TO_DOUBLE (cctx->attrib.drawBuffer); + break; + case GL_READ_BUFFER: + params[0] = ENUM_TO_DOUBLE (cctx->attrib.readBuffer); + break; + case GL_SCISSOR_BOX: + params[0] = cctx->attrib.scissor.x; + params[1] = cctx->attrib.scissor.y; + params[2] = cctx->attrib.scissor.width; + params[3] = cctx->attrib.scissor.height; + break; + case GL_SCISSOR_TEST: + params[0] = BOOLEAN_TO_DOUBLE (cctx->attrib.scissorTest); + break; + case GL_VIEWPORT: + params[0] = cctx->attrib.viewport.x; + params[1] = cctx->attrib.viewport.y; + params[2] = cctx->attrib.viewport.width; + params[3] = cctx->attrib.viewport.height; + break; + case GL_TEXTURE_BINDING_1D: + case GL_TEXTURE_BINDING_2D: + case GL_TEXTURE_BINDING_3D: + case GL_TEXTURE_BINDING_RECTANGLE_NV: + case GL_TEXTURE_BINDING_CUBE_MAP_ARB: + params[0] = xglActiveTextureBinding (pname); + break; + case GL_MAX_TEXTURE_UNITS_ARB: + params[0] = cctx->maxTexUnits; + break; + case GL_MAX_ATTRIB_STACK_DEPTH: + params[0] = cctx->maxAttribStackDepth; + break; + default: + glGetDoublev (pname, params); + } +} + +#define INT_TO_FLOAT(I) ((GLfloat) (I)) +#define ENUM_TO_FLOAT(E) ((GLfloat) (E)) +#define BOOLEAN_TO_FLOAT(B) ((B) ? 1.0F : 0.0F) + +static void +xglGetFloatv (GLenum pname, + GLfloat *params) +{ + switch (pname) { + case GL_CURRENT_RASTER_POSITION: + glGetFloatv (GL_CURRENT_RASTER_POSITION, params); + + params[0] -= (GLfloat) cctx->drawXoff; + params[1] -= (GLfloat) cctx->drawYoff; + break; + case GL_DOUBLEBUFFER: + params[0] = BOOLEAN_TO_FLOAT (cctx->doubleBuffer); + break; + case GL_DEPTH_BITS: + params[0] = INT_TO_FLOAT (cctx->depthBits); + break; + case GL_STENCIL_BITS: + params[0] = INT_TO_FLOAT (cctx->stencilBits); + break; + case GL_DRAW_BUFFER: + params[0] = ENUM_TO_FLOAT (cctx->attrib.drawBuffer); + break; + case GL_READ_BUFFER: + params[0] = ENUM_TO_FLOAT (cctx->attrib.readBuffer); + break; + case GL_SCISSOR_BOX: + params[0] = cctx->attrib.scissor.x; + params[1] = cctx->attrib.scissor.y; + params[2] = cctx->attrib.scissor.width; + params[3] = cctx->attrib.scissor.height; + break; + case GL_SCISSOR_TEST: + params[0] = BOOLEAN_TO_FLOAT (cctx->attrib.scissorTest); + break; + case GL_VIEWPORT: + params[0] = cctx->attrib.viewport.x; + params[1] = cctx->attrib.viewport.y; + params[2] = cctx->attrib.viewport.width; + params[3] = cctx->attrib.viewport.height; + break; + case GL_TEXTURE_BINDING_1D: + case GL_TEXTURE_BINDING_2D: + case GL_TEXTURE_BINDING_3D: + case GL_TEXTURE_BINDING_RECTANGLE_NV: + case GL_TEXTURE_BINDING_CUBE_MAP_ARB: + params[0] = xglActiveTextureBinding (pname); + break; + case GL_MAX_TEXTURE_UNITS_ARB: + params[0] = cctx->maxTexUnits; + break; + case GL_MAX_ATTRIB_STACK_DEPTH: + params[0] = cctx->maxAttribStackDepth; + break; + default: + glGetFloatv (pname, params); + } +} + +#define ENUM_TO_INT(E) ((GLint) (E)) +#define BOOLEAN_TO_INT(B) ((GLint) (B)) + +static void +xglGetIntegerv (GLenum pname, + GLint *params) +{ + switch (pname) { + case GL_CURRENT_RASTER_POSITION: + glGetIntegerv (GL_CURRENT_RASTER_POSITION, params); + + params[0] -= (GLint) cctx->drawXoff; + params[1] -= (GLint) cctx->drawYoff; + break; + case GL_DOUBLEBUFFER: + params[0] = BOOLEAN_TO_INT (cctx->doubleBuffer); + break; + case GL_DEPTH_BITS: + params[0] = cctx->depthBits; + break; + case GL_STENCIL_BITS: + params[0] = cctx->stencilBits; + break; + case GL_DRAW_BUFFER: + params[0] = ENUM_TO_INT (cctx->attrib.drawBuffer); + break; + case GL_READ_BUFFER: + params[0] = ENUM_TO_INT (cctx->attrib.readBuffer); + break; + case GL_SCISSOR_BOX: + params[0] = cctx->attrib.scissor.x; + params[1] = cctx->attrib.scissor.y; + params[2] = cctx->attrib.scissor.width; + params[3] = cctx->attrib.scissor.height; + break; + case GL_SCISSOR_TEST: + params[0] = BOOLEAN_TO_INT (cctx->attrib.scissorTest); + break; + case GL_VIEWPORT: + params[0] = cctx->attrib.viewport.x; + params[1] = cctx->attrib.viewport.y; + params[2] = cctx->attrib.viewport.width; + params[3] = cctx->attrib.viewport.height; + break; + case GL_TEXTURE_BINDING_1D: + case GL_TEXTURE_BINDING_2D: + case GL_TEXTURE_BINDING_3D: + case GL_TEXTURE_BINDING_RECTANGLE_NV: + case GL_TEXTURE_BINDING_CUBE_MAP_ARB: + params[0] = xglActiveTextureBinding (pname); + break; + case GL_MAX_TEXTURE_UNITS_ARB: + params[0] = cctx->maxTexUnits; + break; + case GL_MAX_ATTRIB_STACK_DEPTH: + params[0] = cctx->maxAttribStackDepth; + break; + default: + glGetIntegerv (pname, params); + } +} + +static GLboolean +xglIsEnabled (GLenum cap) +{ + switch (cap) { + case GL_SCISSOR_TEST: + return cctx->attrib.scissorTest; + default: + return glIsEnabled (cap); + } +} + +static GLenum +xglGetError (void) +{ + GLenum error = cctx->errorValue; + + if (error != GL_NO_ERROR) + { + cctx->errorValue = GL_NO_ERROR; + return error; + } + + return glGetError (); +} + +static const GLubyte * +xglGetString (GLenum name) +{ + switch (name) { + case GL_VERSION: + if (!cctx->versionString) + { + static char *version = "1.2 (%s)"; + char *nativeVersion = (char *) glGetString (GL_VERSION); + + cctx->versionString = xalloc (strlen (version) + + strlen (nativeVersion)); + if (cctx->versionString) + sprintf (cctx->versionString, version, nativeVersion); + } + return (GLubyte *) cctx->versionString; + default: + return glGetString (name); + } +} + +static void +xglGenTextures (GLsizei n, + GLuint *textures) +{ + xglTexObjPtr pTexObj; + GLuint name; + + name = xglHashFindFreeKeyBlock (cctx->shared->texObjects, n); + + glGenTextures (n, textures); + + while (n--) + { + pTexObj = xalloc (sizeof (xglTexObjRec)); + if (pTexObj) + { + pTexObj->key = name; + pTexObj->name = *textures; + pTexObj->pPixmap = NULL; + pTexObj->object = NULL; + pTexObj->refcnt = 1; + + xglHashInsert (cctx->shared->texObjects, name, pTexObj); + } + else + { + xglRecordError (GL_OUT_OF_MEMORY); + } + + *textures++ = name++; + } +} + +static void +xglBindTextureProc (xglGLOpPtr pOp) +{ + xglTexObjPtr *ppTexObj; + + switch (pOp->u.bind_texture.target) { + case GL_TEXTURE_1D: + ppTexObj = &cctx->attrib.texUnits[cctx->activeTexUnit].p1D; + break; + case GL_TEXTURE_2D: + ppTexObj = &cctx->attrib.texUnits[cctx->activeTexUnit].p2D; + break; + case GL_TEXTURE_3D: + ppTexObj = &cctx->attrib.texUnits[cctx->activeTexUnit].p3D; + break; + case GL_TEXTURE_RECTANGLE_NV: + ppTexObj = &cctx->attrib.texUnits[cctx->activeTexUnit].pRect; + break; + case GL_TEXTURE_CUBE_MAP_ARB: + ppTexObj = &cctx->attrib.texUnits[cctx->activeTexUnit].pCubeMap; + break; + default: + xglRecordError (GL_INVALID_ENUM); + return; + } + + if (pOp->u.bind_texture.texture) + { + if (!*ppTexObj || pOp->u.bind_texture.texture != (*ppTexObj)->key) + { + xglTexObjPtr pTexObj; + + pTexObj = (xglTexObjPtr) + xglHashLookup (cctx->shared->texObjects, + pOp->u.bind_texture.texture); + if (!pTexObj) + { + pTexObj = xalloc (sizeof (xglTexObjRec)); + if (!pTexObj) + { + xglRecordError (GL_OUT_OF_MEMORY); + return; + } + + pTexObj->key = pOp->u.bind_texture.texture; + pTexObj->pPixmap = NULL; + pTexObj->object = NULL; + pTexObj->refcnt = 1; + + glGenTextures (1, &pTexObj->name); + + xglHashInsert (cctx->shared->texObjects, + pOp->u.bind_texture.texture, + pTexObj); + } + + xglRefTexObj (pTexObj); + xglUnrefTexObj (*ppTexObj); + *ppTexObj = pTexObj; + + glBindTexture (pOp->u.bind_texture.target, pTexObj->name); + } + } + else + { + xglUnrefTexObj (*ppTexObj); + *ppTexObj = NULL; + + glBindTexture (pOp->u.bind_texture.target, 0); + } +} + +static void +xglBindTexture (GLenum target, + GLuint texture) +{ + xglGLOpRec gl; + + gl.glProc = xglBindTextureProc; + + gl.u.bind_texture.target = target; + gl.u.bind_texture.texture = texture; + + xglGLOp (&gl); +} + +static void +xglSetupTextures (void) +{ + xglGLContextPtr pContext = cctx; + xglTexUnitPtr pTexUnit; + xglTexObjPtr pTexObj[XGL_MAX_TEXTURE_UNITS]; + int i, activeTexUnit; + + for (i = 0; i < pContext->maxTexUnits; i++) + { + pTexObj[i] = NULL; + + pTexUnit = &pContext->attrib.texUnits[i]; + if (pTexUnit->enabled) + { + if (pTexUnit->enabled & XGL_TEXTURE_RECTANGLE_BIT) + pTexObj[i] = pTexUnit->pRect; + else if (pTexUnit->enabled & XGL_TEXTURE_2D_BIT) + pTexObj[i] = pTexUnit->p2D; + + if (pTexObj[i] && pTexObj[i]->pPixmap) + { + if (!xglSyncSurface (&pTexObj[i]->pPixmap->drawable)) + pTexObj[i] = NULL; + } + else + pTexObj[i] = NULL; + } + } + + if (pContext != cctx) + { + XGL_SCREEN_PRIV (pContext->pDrawBuffer->pGC->pScreen); + + glitz_drawable_finish (pScreenPriv->drawable); + + xglSetCurrentContext (pContext); + } + + activeTexUnit = cctx->activeTexUnit; + for (i = 0; i < pContext->maxTexUnits; i++) + { + if (pTexObj[i]) + { + if (i != activeTexUnit) + { + cctx->ActiveTextureARB (GL_TEXTURE0_ARB + i); + activeTexUnit = i; + } + glitz_context_bind_texture (cctx->context, pTexObj[i]->object); + } + } + + if (activeTexUnit != cctx->activeTexUnit) + cctx->ActiveTextureARB (cctx->activeTexUnit); +} + +static GLboolean +xglAreTexturesResident (GLsizei n, + const GLuint *textures, + GLboolean *residences) +{ + GLboolean allResident = GL_TRUE; + int i, j; + + if (n < 0) + { + xglRecordError (GL_INVALID_VALUE); + return GL_FALSE; + } + + if (!textures || !residences) + return GL_FALSE; + + for (i = 0; i < n; i++) + { + xglTexObjPtr pTexObj; + GLboolean resident; + + if (!textures[i]) + { + xglRecordError (GL_INVALID_VALUE); + return GL_FALSE; + } + + pTexObj = (xglTexObjPtr) xglHashLookup (cctx->shared->texObjects, + textures[i]); + if (!pTexObj) + { + xglRecordError (GL_INVALID_VALUE); + return GL_FALSE; + } + + if (pTexObj->name == 0 || + glAreTexturesResident (1, &pTexObj->name, &resident)) + { + if (!allResident) + residences[i] = GL_TRUE; + } + else + { + if (allResident) + { + allResident = GL_FALSE; + + for (j = 0; j < i; j++) + residences[j] = GL_TRUE; + } + residences[i] = GL_FALSE; + } + } + + return allResident; +} + +static void +xglDeleteTextures (GLsizei n, + const GLuint *textures) +{ + xglTexObjPtr pTexObj; + + while (n--) + { + if (!*textures) + continue; + + pTexObj = (xglTexObjPtr) xglHashLookup (cctx->shared->texObjects, + *textures); + if (pTexObj) + { + xglDeleteTexObj (pTexObj); + xglUnrefTexObj (pTexObj); + xglHashRemove (cctx->shared->texObjects, *textures); + } + textures++; + } +} + +static GLboolean +xglIsTexture (GLuint texture) +{ + xglTexObjPtr pTexObj; + + if (!texture) + return GL_FALSE; + + pTexObj = (xglTexObjPtr) xglHashLookup (cctx->shared->texObjects, texture); + if (pTexObj) + return GL_TRUE; + + return GL_FALSE; +} + +static void +xglPrioritizeTextures (GLsizei n, + const GLuint *textures, + const GLclampf *priorities) +{ + xglTexObjPtr pTexObj; + int i; + + if (n < 0) + { + xglRecordError (GL_INVALID_VALUE); + return; + } + + if (!priorities) + return; + + for (i = 0; i < n; i++) + { + if (!textures[i]) + continue; + + pTexObj = (xglTexObjPtr) xglHashLookup (cctx->shared->texObjects, + textures[i]); + if (pTexObj && pTexObj->name) + glPrioritizeTextures (1, &pTexObj->name, &priorities[i]); + } +} + +static glitz_texture_filter_t +xglTextureFilter (GLenum param) +{ + switch (param) { + case GL_LINEAR: + return GLITZ_TEXTURE_FILTER_LINEAR; + case GL_NEAREST: + default: + return GLITZ_TEXTURE_FILTER_NEAREST; + } +} + +static glitz_texture_wrap_t +xglTextureWrap (GLenum param) +{ + switch (param) { + case GL_CLAMP_TO_EDGE: + return GLITZ_TEXTURE_WRAP_CLAMP_TO_EDGE; + case GL_CLAMP_TO_BORDER: + return GLITZ_TEXTURE_WRAP_CLAMP_TO_BORDER; + case GL_REPEAT: + return GLITZ_TEXTURE_WRAP_REPEAT; + case GL_MIRRORED_REPEAT: + return GLITZ_TEXTURE_WRAP_MIRRORED_REPEAT; + case GL_CLAMP: + default: + return GLITZ_TEXTURE_WRAP_CLAMP; + } +} + +static void +xglTexParameterfvProc (xglGLOpPtr pOp) +{ + xglTexObjPtr pTexObj; + + glTexParameterfv (pOp->u.tex_parameter_fv.target, + pOp->u.tex_parameter_fv.pname, + pOp->u.tex_parameter_fv.params); + + switch (pOp->u.tex_parameter_fv.target) { + case GL_TEXTURE_2D: + pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].p2D; + break; + case GL_TEXTURE_RECTANGLE_NV: + pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].pRect; + break; + default: + pTexObj = NULL; + break; + } + + if (pTexObj && pTexObj->pPixmap) + { + GLfloat *params = pOp->u.tex_parameter_fv.params; + + switch (pOp->u.tex_parameter_fv.pname) { + case GL_TEXTURE_MIN_FILTER: + glitz_texture_object_set_filter (pTexObj->object, + GLITZ_TEXTURE_FILTER_TYPE_MIN, + xglTextureFilter (params[0])); + break; + case GL_TEXTURE_MAG_FILTER: + glitz_texture_object_set_filter (pTexObj->object, + GLITZ_TEXTURE_FILTER_TYPE_MAG, + xglTextureFilter (params[0])); + break; + case GL_TEXTURE_WRAP_S: + glitz_texture_object_set_wrap (pTexObj->object, + GLITZ_TEXTURE_WRAP_TYPE_S, + xglTextureWrap (params[0])); + break; + case GL_TEXTURE_WRAP_T: + glitz_texture_object_set_wrap (pTexObj->object, + GLITZ_TEXTURE_WRAP_TYPE_T, + xglTextureWrap (params[0])); + break; + case GL_TEXTURE_BORDER_COLOR: { + glitz_color_t color; + + color.red = params[0] * 0xffff; + color.green = params[1] * 0xffff; + color.blue = params[2] * 0xffff; + color.alpha = params[3] * 0xffff; + + glitz_texture_object_set_border_color (pTexObj->object, &color); + } + default: + break; + } + } +} + +static void +xglTexParameterfv (GLenum target, + GLenum pname, + const GLfloat *params) +{ + xglGLOpRec gl; + + gl.glProc = xglTexParameterfvProc; + + gl.u.tex_parameter_fv.target = target; + gl.u.tex_parameter_fv.pname = pname; + + switch (pname) { + case GL_TEXTURE_BORDER_COLOR: + gl.u.tex_parameter_fv.params[3] = params[3]; + gl.u.tex_parameter_fv.params[2] = params[2]; + gl.u.tex_parameter_fv.params[1] = params[1]; + /* fall-through */ + default: + gl.u.tex_parameter_fv.params[0] = params[0]; + break; + } + + xglGLOp (&gl); +} + +static void +xglTexParameteriv (GLenum target, + GLenum pname, + const GLint *params) +{ + xglGLOpRec gl; + + gl.glProc = xglTexParameterfvProc; + + gl.u.tex_parameter_fv.target = target; + gl.u.tex_parameter_fv.pname = pname; + + switch (pname) { + case GL_TEXTURE_BORDER_COLOR: + gl.u.tex_parameter_fv.params[3] = (GLfloat) params[3] / INT_MAX; + gl.u.tex_parameter_fv.params[2] = (GLfloat) params[2] / INT_MAX; + gl.u.tex_parameter_fv.params[1] = (GLfloat) params[1] / INT_MAX; + gl.u.tex_parameter_fv.params[0] = (GLfloat) params[0] / INT_MAX; + break; + default: + gl.u.tex_parameter_fv.params[0] = params[0]; + break; + } + + xglGLOp (&gl); +} + +static void +xglTexParameterf (GLenum target, + GLenum pname, + GLfloat param) +{ + xglTexParameterfv (target, pname, (const GLfloat *) ¶m); +} + +static void +xglTexParameteri (GLenum target, + GLenum pname, + GLint param) +{ + xglTexParameteriv (target, pname, (const GLint *) ¶m); +} + +static void +xglGetTexLevelParameterfv (GLenum target, + GLint level, + GLenum pname, + GLfloat *params) +{ + xglTexObjPtr pTexObj; + + switch (target) { + case GL_TEXTURE_2D: + pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].p2D; + break; + case GL_TEXTURE_RECTANGLE_NV: + pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].pRect; + break; + default: + pTexObj = NULL; + break; + } + + if (pTexObj && pTexObj->pPixmap) + { + glitz_context_bind_texture (cctx->context, pTexObj->object); + + glGetTexLevelParameterfv (target, level, pname, params); + glBindTexture (target, pTexObj->name); + } + else + glGetTexLevelParameterfv (target, level, pname, params); +} + +static void +xglGetTexLevelParameteriv (GLenum target, + GLint level, + GLenum pname, + GLint *params) +{ + xglTexObjPtr pTexObj; + + switch (target) { + case GL_TEXTURE_2D: + pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].p2D; + break; + case GL_TEXTURE_RECTANGLE_NV: + pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].pRect; + break; + default: + pTexObj = NULL; + break; + } + + if (pTexObj && pTexObj->pPixmap) + { + glitz_context_bind_texture (cctx->context, pTexObj->object); + + glGetTexLevelParameteriv (target, level, pname, params); + glBindTexture (target, pTexObj->name); + } + else + glGetTexLevelParameteriv (target, level, pname, params); +} + +static GLuint +xglGenLists (GLsizei range) +{ + xglDisplayListPtr pDisplayList; + GLuint first, name; + + first = xglHashFindFreeKeyBlock (cctx->shared->displayLists, range); + + name = first; + for (name = first; range--; name++) + { + pDisplayList = xglCreateList (); + if (pDisplayList) + { + xglHashInsert (cctx->shared->displayLists, name, pDisplayList); + } + else + { + xglRecordError (GL_OUT_OF_MEMORY); + } + } + + return first; +} + +static void +xglNewList (GLuint list, + GLenum mode) +{ + if (!list) + { + xglRecordError (GL_INVALID_VALUE); + return; + } + + if (cctx->list) + { + xglRecordError (GL_INVALID_OPERATION); + return; + } + + cctx->pList = xglCreateList (); + if (!cctx->pList) + { + xglRecordError (GL_OUT_OF_MEMORY); + return; + } + + cctx->list = list; + cctx->listMode = mode; + + xglStartList (XGL_LIST_OP_CALLS, mode); +} + +static void +xglEndList (void) +{ + xglDisplayListPtr pDisplayList; + + if (!cctx->list) + { + xglRecordError (GL_INVALID_OPERATION); + return; + } + + glEndList (); + + pDisplayList = (xglDisplayListPtr) + xglHashLookup (cctx->shared->displayLists, cctx->list); + if (pDisplayList) + { + xglHashRemove (cctx->shared->displayLists, cctx->list); + xglDestroyList (pDisplayList); + } + + xglHashInsert (cctx->shared->displayLists, cctx->list, cctx->pList); + + cctx->list = 0; +} + +static void +xglDrawList (GLuint list) +{ + RegionRec region; + BoxRec scissor, box; + BoxPtr pBox; + int nBox; + + XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor); + + while (nBox--) + { + XGL_GLX_DRAW_BOX (&box, pBox); + + pBox++; + + if (cctx->attrib.scissorTest) + XGL_GLX_INTERSECT_BOX (&box, &scissor); + + if (box.x1 < box.x2 && box.y1 < box.y2) + { + XGL_GLX_SET_SCISSOR_BOX (&box); + + glCallList (list); + + XGL_GLX_DRAW_DAMAGE (&box, ®ion); + } + } +} + +static void +xglCallDisplayList (GLuint list, + int nesting) +{ + if (nesting > cctx->maxListNesting) + return; + + if (!list) + { + xglRecordError (GL_INVALID_VALUE); + return; + } + + if (cctx->list) + { + if (!xglResizeList (cctx->pList, cctx->pList->nOp + 1)) + { + xglRecordError (GL_OUT_OF_MEMORY); + return; + } + + cctx->pList->pOp[cctx->pList->nOp].type = XGL_LIST_OP_LIST; + cctx->pList->pOp[cctx->pList->nOp].u.list = list; + cctx->pList->nOp++; + } + else + { + xglDisplayListPtr pDisplayList; + + pDisplayList = (xglDisplayListPtr) + xglHashLookup (cctx->shared->displayLists, list); + if (pDisplayList) + { + xglListOpPtr pOp = pDisplayList->pOp; + int nOp = pDisplayList->nOp; + + while (nOp--) + { + switch (pOp->type) { + case XGL_LIST_OP_CALLS: + glCallList (pOp->u.list); + break; + case XGL_LIST_OP_DRAW: + xglDrawList (pOp->u.list); + break; + case XGL_LIST_OP_GL: + (*pOp->u.gl->glProc) (pOp->u.gl); + break; + case XGL_LIST_OP_LIST: + xglCallDisplayList (pOp->u.list, nesting + 1); + break; + } + + pOp++; + } + } + } +} + +static void +xglCallList (GLuint list) +{ + xglCallDisplayList (list, 1); +} + +static void +xglCallLists (GLsizei n, + GLenum type, + const GLvoid *lists) +{ + GLuint list; + GLint base, i; + + glGetIntegerv (GL_LIST_BASE, &base); + + for (i = 0; i < n; i++) + { + switch (type) { + case GL_BYTE: + list = (GLuint) *(((GLbyte *) lists) + n); + break; + case GL_UNSIGNED_BYTE: + list = (GLuint) *(((GLubyte *) lists) + n); + break; + case GL_SHORT: + list = (GLuint) *(((GLshort *) lists) + n); + break; + case GL_UNSIGNED_SHORT: + list = (GLuint) *(((GLushort *) lists) + n); + break; + case GL_INT: + list = (GLuint) *(((GLint *) lists) + n); + break; + case GL_UNSIGNED_INT: + list = (GLuint) *(((GLuint *) lists) + n); + break; + case GL_FLOAT: + list = (GLuint) *(((GLfloat *) lists) + n); + break; + case GL_2_BYTES: + { + GLubyte *ubptr = ((GLubyte *) lists) + 2 * n; + list = (GLuint) *ubptr * 256 + (GLuint) *(ubptr + 1); + } break; + case GL_3_BYTES: + { + GLubyte *ubptr = ((GLubyte *) lists) + 3 * n; + list = (GLuint) * ubptr * 65536 + + (GLuint) * (ubptr + 1) * 256 + + (GLuint) * (ubptr + 2); + } break; + case GL_4_BYTES: + { + GLubyte *ubptr = ((GLubyte *) lists) + 4 * n; + list = (GLuint) * ubptr * 16777216 + + (GLuint) * (ubptr + 1) * 65536 + + (GLuint) * (ubptr + 2) * 256 + + (GLuint) * (ubptr + 3); + } break; + default: + xglRecordError (GL_INVALID_ENUM); + return; + } + + xglCallDisplayList (base + list, 1); + } +} + +static void +xglDeleteLists (GLuint list, + GLsizei range) +{ + xglDisplayListPtr pDisplayList; + GLint i; + + if (range < 0) + { + xglRecordError (GL_INVALID_VALUE); + return; + } + + for (i = list; i < list + range; i++) + { + if (!i) + continue; + + pDisplayList = (xglDisplayListPtr) + xglHashLookup (cctx->shared->displayLists, i); + if (pDisplayList) + { + xglHashRemove (cctx->shared->displayLists, i); + xglDestroyList (pDisplayList); + } + } +} + +static GLboolean +xglIsList (GLuint list) +{ + xglDisplayListPtr pDisplayList; + + if (!list) + return GL_FALSE; + + pDisplayList = (xglDisplayListPtr) + xglHashLookup (cctx->shared->displayLists, list); + if (pDisplayList) + return GL_TRUE; + + return GL_FALSE; +} + +static void +xglFlush (void) +{ + glFlush (); + + if (cctx && cctx->pDrawBuffer->pDrawable) + { + xglGLBufferPtr pBuffer = cctx->pDrawBuffer; + + if (REGION_NOTEMPTY (pBuffer->pDrawable->pScreen, &pBuffer->damage)) + { + XGL_DRAWABLE_PIXMAP_PRIV (pBuffer->pDrawable); + + DamageDamageRegion (pBuffer->pDrawable, &pBuffer->damage); + REGION_EMPTY (pBuffer->pDrawable->pScreen, &pBuffer->damage); + + pPixmapPriv->damageBox = miEmptyBox; + } + } +} + +static void +xglFinish (void) +{ + glFinish (); + + if (cctx && cctx->pDrawBuffer->pDrawable) + { + xglGLBufferPtr pBuffer = cctx->pDrawBuffer; + + if (REGION_NOTEMPTY (pBuffer->pDrawable->pScreen, &pBuffer->damage)) + { + XGL_DRAWABLE_PIXMAP_PRIV (pBuffer->pDrawable); + + DamageDamageRegion (pBuffer->pDrawable, &pBuffer->damage); + REGION_EMPTY (pBuffer->pDrawable->pScreen, &pBuffer->damage); + + pPixmapPriv->damageBox = miEmptyBox; + } + } +} + +static void +xglClear (GLbitfield mask) +{ + GLenum mode; + + if (cctx->list) + { + glEndList (); + xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE); + glClear (mask); + glEndList (); + + mode = cctx->listMode; + } + else + mode = GL_COMPILE_AND_EXECUTE; + + if (mode == GL_COMPILE_AND_EXECUTE) + { + RegionRec region; + BoxRec scissor, box; + BoxPtr pBox; + int nBox; + + XGL_GLX_DRAW_PROLOGUE_WITHOUT_TEXTURES (pBox, nBox, &scissor); + + while (nBox--) + { + XGL_GLX_DRAW_BOX (&box, pBox); + + pBox++; + + if (cctx->attrib.scissorTest) + XGL_GLX_INTERSECT_BOX (&box, &scissor); + + if (box.x1 < box.x2 && box.y1 < box.y2) + { + XGL_GLX_SET_SCISSOR_BOX (&box); + + glClear (mask); + + if (mask & GL_COLOR_BUFFER_BIT) + XGL_GLX_DRAW_DAMAGE (&box, ®ion); + } + } + } + + if (cctx->list) + xglStartList (XGL_LIST_OP_CALLS, cctx->listMode); +} + +static void +xglAccum (GLenum op, + GLfloat value) +{ + if (op == GL_RETURN) + { + GLenum listMode; + + if (cctx->list) + { + glEndList (); + xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE); + glAccum (GL_RETURN, value); + glEndList (); + + listMode = cctx->listMode; + } + else + listMode = GL_COMPILE_AND_EXECUTE; + + if (listMode == GL_COMPILE_AND_EXECUTE) + { + RegionRec region; + BoxRec scissor, box; + BoxPtr pBox; + int nBox; + + XGL_GLX_DRAW_PROLOGUE_WITHOUT_TEXTURES (pBox, nBox, &scissor); + + while (nBox--) + { + XGL_GLX_DRAW_BOX (&box, pBox); + + pBox++; + + if (cctx->attrib.scissorTest) + XGL_GLX_INTERSECT_BOX (&box, &scissor); + + if (box.x1 < box.x2 && box.y1 < box.y2) + { + XGL_GLX_SET_SCISSOR_BOX (&box); + + glAccum (GL_RETURN, value); + + XGL_GLX_DRAW_DAMAGE (&box, ®ion); + } + } + } + + if (cctx->list) + xglStartList (XGL_LIST_OP_CALLS, cctx->listMode); + } + else + glAccum (op, value); +} + +static void +xglDrawArrays (GLenum mode, + GLint first, + GLsizei count) +{ + GLenum listMode; + + if (cctx->list) + { + glEndList (); + xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE); + glDrawArrays (mode, first, count); + glEndList (); + + listMode = cctx->listMode; + } + else + listMode = GL_COMPILE_AND_EXECUTE; + + if (listMode == GL_COMPILE_AND_EXECUTE) + { + RegionRec region; + BoxRec scissor, box; + BoxPtr pBox; + int nBox; + + XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor); + + while (nBox--) + { + XGL_GLX_DRAW_BOX (&box, pBox); + + pBox++; + + if (cctx->attrib.scissorTest) + XGL_GLX_INTERSECT_BOX (&box, &scissor); + + if (box.x1 < box.x2 && box.y1 < box.y2) + { + XGL_GLX_SET_SCISSOR_BOX (&box); + + glDrawArrays (mode, first, count); + + XGL_GLX_DRAW_DAMAGE (&box, ®ion); + } + } + } + + if (cctx->list) + xglStartList (XGL_LIST_OP_CALLS, cctx->listMode); +} + +static void +xglDrawElements (GLenum mode, + GLsizei count, + GLenum type, + const GLvoid *indices) +{ + GLenum listMode; + + if (cctx->list) + { + glEndList (); + xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE); + glDrawElements (mode, count, type, indices); + glEndList (); + + listMode = cctx->listMode; + } + else + listMode = GL_COMPILE_AND_EXECUTE; + + if (listMode == GL_COMPILE_AND_EXECUTE) + { + RegionRec region; + BoxRec scissor, box; + BoxPtr pBox; + int nBox; + + XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor); + + while (nBox--) + { + XGL_GLX_DRAW_BOX (&box, pBox); + + pBox++; + + if (cctx->attrib.scissorTest) + XGL_GLX_INTERSECT_BOX (&box, &scissor); + + if (box.x1 < box.x2 && box.y1 < box.y2) + { + XGL_GLX_SET_SCISSOR_BOX (&box); + + glDrawElements (mode, count, type, indices); + + XGL_GLX_DRAW_DAMAGE (&box, ®ion); + } + } + } + + if (cctx->list) + xglStartList (XGL_LIST_OP_CALLS, cctx->listMode); +} + +static void +xglDrawPixels (GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + const GLvoid *pixels) +{ + GLenum listMode; + + if (cctx->list) + { + glEndList (); + xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE); + glDrawPixels (width, height, format, type, pixels); + glEndList (); + + listMode = cctx->listMode; + } + else + listMode = GL_COMPILE_AND_EXECUTE; + + if (listMode == GL_COMPILE_AND_EXECUTE) + { + RegionRec region; + BoxRec scissor, box; + BoxPtr pBox; + int nBox; + + XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor); + + while (nBox--) + { + XGL_GLX_DRAW_BOX (&box, pBox); + + pBox++; + + if (cctx->attrib.scissorTest) + XGL_GLX_INTERSECT_BOX (&box, &scissor); + + if (box.x1 < box.x2 && box.y1 < box.y2) + { + XGL_GLX_SET_SCISSOR_BOX (&box); + + glDrawPixels (width, height, format, type, pixels); + + if (format != GL_STENCIL_INDEX) + XGL_GLX_DRAW_DAMAGE (&box, ®ion); + } + } + } + + if (cctx->list) + xglStartList (XGL_LIST_OP_CALLS, cctx->listMode); +} + +static void +xglBitmap (GLsizei width, + GLsizei height, + GLfloat xorig, + GLfloat yorig, + GLfloat xmove, + GLfloat ymove, + const GLubyte *bitmap) +{ + GLenum listMode; + + if (cctx->list) + { + glEndList (); + xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE); + glBitmap (width, height, xorig, yorig, 0, 0, bitmap); + glEndList (); + + listMode = cctx->listMode; + } + else + listMode = GL_COMPILE_AND_EXECUTE; + + if (listMode == GL_COMPILE_AND_EXECUTE && width && height) + { + RegionRec region; + BoxRec scissor, box; + BoxPtr pBox; + int nBox; + + XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor); + + while (nBox--) + { + XGL_GLX_DRAW_BOX (&box, pBox); + + pBox++; + + if (cctx->attrib.scissorTest) + XGL_GLX_INTERSECT_BOX (&box, &scissor); + + if (box.x1 < box.x2 && box.y1 < box.y2) + { + XGL_GLX_SET_SCISSOR_BOX (&box); + + glBitmap (width, height, xorig, yorig, 0, 0, bitmap); + + XGL_GLX_DRAW_DAMAGE (&box, ®ion); + } + } + } + + if (cctx->list) + xglStartList (XGL_LIST_OP_CALLS, cctx->listMode); + + glBitmap (0, 0, 0, 0, xmove, ymove, NULL); +} + +static void +xglRectdv (const GLdouble *v1, + const GLdouble *v2) +{ + GLenum listMode; + + if (cctx->list) + { + glEndList (); + xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE); + glRectdv (v1, v2); + glEndList (); + + listMode = cctx->listMode; + } + else + listMode = GL_COMPILE_AND_EXECUTE; + + if (listMode == GL_COMPILE_AND_EXECUTE) + { + RegionRec region; + BoxRec scissor, box; + BoxPtr pBox; + int nBox; + + XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor); + + while (nBox--) + { + XGL_GLX_DRAW_BOX (&box, pBox); + + pBox++; + + if (cctx->attrib.scissorTest) + XGL_GLX_INTERSECT_BOX (&box, &scissor); + + if (box.x1 < box.x2 && box.y1 < box.y2) + { + XGL_GLX_SET_SCISSOR_BOX (&box); + + glRectdv (v1, v2); + + XGL_GLX_DRAW_DAMAGE (&box, ®ion); + } + } + } + + if (cctx->list) + xglStartList (XGL_LIST_OP_CALLS, cctx->listMode); +} + +static void +xglRectfv (const GLfloat *v1, + const GLfloat *v2) +{ + GLdouble dv1[2]; + GLdouble dv2[2]; + + dv1[0] = (GLdouble) v1[0]; + dv1[1] = (GLdouble) v1[1]; + dv2[0] = (GLdouble) v2[0]; + dv2[1] = (GLdouble) v2[1]; + + xglRectdv (dv1, dv2); +} + +static void +xglRectiv (const GLint *v1, + const GLint *v2) +{ + GLdouble dv1[2]; + GLdouble dv2[2]; + + dv1[0] = (GLdouble) v1[0]; + dv1[1] = (GLdouble) v1[1]; + dv2[0] = (GLdouble) v2[0]; + dv2[1] = (GLdouble) v2[1]; + + xglRectdv (dv1, dv2); +} + +static void +xglRectsv (const GLshort *v1, + const GLshort *v2) +{ + GLdouble dv1[2]; + GLdouble dv2[2]; + + dv1[0] = (GLdouble) v1[0]; + dv1[1] = (GLdouble) v1[1]; + dv2[0] = (GLdouble) v2[0]; + dv2[1] = (GLdouble) v2[1]; + + xglRectdv (dv1, dv2); +} + +static void +xglBegin (GLenum mode) +{ + if (mode > GL_POLYGON) + { + xglRecordError (GL_INVALID_ENUM); + return; + } + + if (cctx->beginCnt) + { + xglRecordError (GL_INVALID_OPERATION); + return; + } + + cctx->beginCnt++; + + if (cctx->list) + { + glEndList (); + xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE); + } + else + { + if (REGION_NUM_RECTS (cctx->pDrawBuffer->pGC->pCompositeClip) == 1) + { + BoxRec scissor, box; + BoxPtr pBox; + int nBox; + + XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor); + + XGL_GLX_DRAW_BOX (&box, pBox); + + if (cctx->attrib.scissorTest) + XGL_GLX_INTERSECT_BOX (&box, &scissor); + + XGL_GLX_SET_SCISSOR_BOX (&box); + } + else + { + if (!cctx->groupList) + cctx->groupList = glGenLists (1); + + glNewList (cctx->groupList, GL_COMPILE); + } + } + + glBegin (mode); +} + +static void +xglEnd (void) +{ + if (!cctx->beginCnt) + { + xglRecordError (GL_INVALID_OPERATION); + return; + } + + cctx->beginCnt--; + + glEnd (); + + if (!cctx->list || cctx->listMode == GL_COMPILE_AND_EXECUTE) + { + RegionRec region; + BoxRec scissor, box; + BoxPtr pBox; + int nBox; + GLuint list = 0; + + if (cctx->list) + { + XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor); + + list = cctx->pList->pOp[cctx->pList->nOp - 1].u.list; + } + else + { + if (REGION_NUM_RECTS (cctx->pDrawBuffer->pGC->pCompositeClip) == 1) + { + XGL_GLX_DRAW_PROLOGUE_WITHOUT_TEXTURES (pBox, nBox, &scissor); + } + else + { + XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor); + + list = cctx->groupList; + } + } + + if (list) + glEndList (); + + while (nBox--) + { + XGL_GLX_DRAW_BOX (&box, pBox); + + pBox++; + + if (cctx->attrib.scissorTest) + XGL_GLX_INTERSECT_BOX (&box, &scissor); + + if (box.x1 < box.x2 && box.y1 < box.y2) + { + if (list) + { + XGL_GLX_SET_SCISSOR_BOX (&box); + + glCallList (list); + } + + XGL_GLX_DRAW_DAMAGE (&box, ®ion); + } + } + } + else + { + glEndList (); + } + + if (cctx->list) + xglStartList (XGL_LIST_OP_CALLS, cctx->listMode); +} + +static void +xglCopyPixelsProc (xglGLOpPtr pOp) +{ + RegionRec region; + BoxRec scissor, box; + BoxPtr pBox; + int nBox; + + XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor); + + while (nBox--) + { + XGL_GLX_DRAW_BOX (&box, pBox); + + pBox++; + + if (cctx->attrib.scissorTest) + XGL_GLX_INTERSECT_BOX (&box, &scissor); + + if (box.x1 < box.x2 && box.y1 < box.y2) + { + XGL_GLX_SET_SCISSOR_BOX (&box); + + glCopyPixels (pOp->u.copy_pixels.x + cctx->pReadBuffer->xOff, + pOp->u.copy_pixels.y + cctx->pReadBuffer->yOff, + pOp->u.copy_pixels.width, + pOp->u.copy_pixels.height, + pOp->u.copy_pixels.type); + + if (pOp->u.copy_pixels.type == GL_COLOR) + XGL_GLX_DRAW_DAMAGE (&box, ®ion); + } + } +} + +static void +xglCopyPixels (GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLenum type) +{ + xglGLOpRec gl; + + gl.glProc = xglCopyPixelsProc; + + gl.u.copy_pixels.x = x; + gl.u.copy_pixels.y = y; + gl.u.copy_pixels.width = width; + gl.u.copy_pixels.height = height; + gl.u.copy_pixels.type = type; + + xglGLOp (&gl); +} + +static void +xglReadPixels (GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + GLvoid *pixels) +{ + glReadPixels (x + cctx->pReadBuffer->xOff, + y + cctx->pReadBuffer->yOff, + width, height, format, type, pixels); +} + +static void +xglCopyTexImage1DProc (xglGLOpPtr pOp) +{ + glCopyTexImage1D (pOp->u.copy_tex_image_1d.target, + pOp->u.copy_tex_image_1d.level, + pOp->u.copy_tex_image_1d.internalformat, + pOp->u.copy_tex_image_1d.x + cctx->pReadBuffer->xOff, + pOp->u.copy_tex_image_1d.y + cctx->pReadBuffer->yOff, + pOp->u.copy_tex_image_1d.width, + pOp->u.copy_tex_image_1d.border); +} + +static void +xglCopyTexImage1D (GLenum target, + GLint level, + GLenum internalformat, + GLint x, + GLint y, + GLsizei width, + GLint border) +{ + xglGLOpRec gl; + + gl.glProc = xglCopyTexImage1DProc; + + gl.u.copy_tex_image_1d.target = target; + gl.u.copy_tex_image_1d.level = level; + gl.u.copy_tex_image_1d.internalformat = internalformat; + gl.u.copy_tex_image_1d.x = x; + gl.u.copy_tex_image_1d.y = y; + gl.u.copy_tex_image_1d.width = width; + gl.u.copy_tex_image_1d.border = border; + + xglGLOp (&gl); +} + +static void +xglCopyTexImage2DProc (xglGLOpPtr pOp) +{ + glCopyTexImage2D (pOp->u.copy_tex_image_2d.target, + pOp->u.copy_tex_image_2d.level, + pOp->u.copy_tex_image_2d.internalformat, + pOp->u.copy_tex_image_2d.x + cctx->pReadBuffer->xOff, + pOp->u.copy_tex_image_2d.y + cctx->pReadBuffer->yOff, + pOp->u.copy_tex_image_2d.width, + pOp->u.copy_tex_image_2d.height, + pOp->u.copy_tex_image_2d.border); +} + +static void +xglCopyTexImage2D (GLenum target, + GLint level, + GLenum internalformat, + GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLint border) +{ + xglGLOpRec gl; + + gl.glProc = xglCopyTexImage2DProc; + + gl.u.copy_tex_image_2d.target = target; + gl.u.copy_tex_image_2d.level = level; + gl.u.copy_tex_image_2d.internalformat = internalformat; + gl.u.copy_tex_image_2d.x = x; + gl.u.copy_tex_image_2d.y = y; + gl.u.copy_tex_image_2d.width = width; + gl.u.copy_tex_image_2d.height = height; + gl.u.copy_tex_image_2d.border = border; + + xglGLOp (&gl); +} + +static void +xglCopyTexSubImage1DProc (xglGLOpPtr pOp) +{ + glCopyTexSubImage1D (pOp->u.copy_tex_sub_image_1d.target, + pOp->u.copy_tex_sub_image_1d.level, + pOp->u.copy_tex_sub_image_1d.xoffset, + pOp->u.copy_tex_sub_image_1d.x + + cctx->pReadBuffer->xOff, + pOp->u.copy_tex_sub_image_1d.y + + cctx->pReadBuffer->yOff, + pOp->u.copy_tex_sub_image_1d.width); +} + +static void +xglCopyTexSubImage1D (GLenum target, + GLint level, + GLint xoffset, + GLint x, + GLint y, + GLsizei width) +{ + xglGLOpRec gl; + + gl.glProc = xglCopyTexSubImage1DProc; + + gl.u.copy_tex_sub_image_1d.target = target; + gl.u.copy_tex_sub_image_1d.level = level; + gl.u.copy_tex_sub_image_1d.xoffset = xoffset; + gl.u.copy_tex_sub_image_1d.x = x; + gl.u.copy_tex_sub_image_1d.y = y; + gl.u.copy_tex_sub_image_1d.width = width; + + xglGLOp (&gl); +} + +static void +xglCopyTexSubImage2DProc (xglGLOpPtr pOp) +{ + glCopyTexSubImage2D (pOp->u.copy_tex_sub_image_2d.target, + pOp->u.copy_tex_sub_image_2d.level, + pOp->u.copy_tex_sub_image_2d.xoffset, + pOp->u.copy_tex_sub_image_2d.yoffset, + pOp->u.copy_tex_sub_image_2d.x + + cctx->pReadBuffer->xOff, + pOp->u.copy_tex_sub_image_2d.y + + cctx->pReadBuffer->yOff, + pOp->u.copy_tex_sub_image_2d.width, + pOp->u.copy_tex_sub_image_2d.height); +} + +static void +xglCopyTexSubImage2D (GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLint x, + GLint y, + GLsizei width, + GLsizei height) +{ + xglGLOpRec gl; + + gl.glProc = xglCopyTexSubImage2DProc; + + gl.u.copy_tex_sub_image_2d.target = target; + gl.u.copy_tex_sub_image_2d.level = level; + gl.u.copy_tex_sub_image_2d.xoffset = xoffset; + gl.u.copy_tex_sub_image_2d.yoffset = yoffset; + gl.u.copy_tex_sub_image_2d.x = x; + gl.u.copy_tex_sub_image_2d.y = y; + gl.u.copy_tex_sub_image_2d.width = width; + gl.u.copy_tex_sub_image_2d.height = height; + + xglGLOp (&gl); +} + +static void +xglCopyColorTableProc (xglGLOpPtr pOp) +{ + glCopyColorTable (pOp->u.copy_color_table.target, + pOp->u.copy_color_table.internalformat, + pOp->u.copy_color_table.x + cctx->pReadBuffer->xOff, + pOp->u.copy_color_table.y + cctx->pReadBuffer->yOff, + pOp->u.copy_color_table.width); +} + +static void +xglCopyColorTable (GLenum target, + GLenum internalformat, + GLint x, + GLint y, + GLsizei width) +{ + xglGLOpRec gl; + + gl.glProc = xglCopyColorTableProc; + + gl.u.copy_color_table.target = target; + gl.u.copy_color_table.internalformat = internalformat; + gl.u.copy_color_table.x = x; + gl.u.copy_color_table.y = y; + gl.u.copy_color_table.width = width; + + xglGLOp (&gl); +} + +static void +xglCopyColorSubTableProc (xglGLOpPtr pOp) +{ + glCopyColorTable (pOp->u.copy_color_sub_table.target, + pOp->u.copy_color_sub_table.start, + pOp->u.copy_color_sub_table.x + cctx->pReadBuffer->xOff, + pOp->u.copy_color_sub_table.y + cctx->pReadBuffer->yOff, + pOp->u.copy_color_sub_table.width); +} + +static void +xglCopyColorSubTable (GLenum target, + GLsizei start, + GLint x, + GLint y, + GLsizei width) +{ + xglGLOpRec gl; + + gl.glProc = xglCopyColorSubTableProc; + + gl.u.copy_color_sub_table.target = target; + gl.u.copy_color_sub_table.start = start; + gl.u.copy_color_sub_table.x = x; + gl.u.copy_color_sub_table.y = y; + gl.u.copy_color_sub_table.width = width; + + xglGLOp (&gl); +} + +static void +xglCopyConvolutionFilter1DProc (xglGLOpPtr pOp) +{ + GLenum internalformat = pOp->u.copy_convolution_filter_1d.internalformat; + + glCopyConvolutionFilter1D (pOp->u.copy_convolution_filter_1d.target, + internalformat, + pOp->u.copy_convolution_filter_1d.x + + cctx->pReadBuffer->xOff, + pOp->u.copy_convolution_filter_1d.y + + cctx->pReadBuffer->yOff, + pOp->u.copy_convolution_filter_1d.width); +} + +static void +xglCopyConvolutionFilter1D (GLenum target, + GLenum internalformat, + GLint x, + GLint y, + GLsizei width) +{ + xglGLOpRec gl; + + gl.glProc = xglCopyConvolutionFilter1DProc; + + gl.u.copy_convolution_filter_1d.target = target; + gl.u.copy_convolution_filter_1d.internalformat = internalformat; + gl.u.copy_convolution_filter_1d.x = x; + gl.u.copy_convolution_filter_1d.y = y; + gl.u.copy_convolution_filter_1d.width = width; + + xglGLOp (&gl); +} + +static void +xglCopyConvolutionFilter2DProc (xglGLOpPtr pOp) +{ + GLenum internalformat = pOp->u.copy_convolution_filter_2d.internalformat; + + glCopyConvolutionFilter2D (pOp->u.copy_convolution_filter_2d.target, + internalformat, + pOp->u.copy_convolution_filter_2d.x + + cctx->pReadBuffer->xOff, + pOp->u.copy_convolution_filter_2d.y + + cctx->pReadBuffer->yOff, + pOp->u.copy_convolution_filter_2d.width, + pOp->u.copy_convolution_filter_2d.height); +} + +static void +xglCopyConvolutionFilter2D (GLenum target, + GLenum internalformat, + GLint x, + GLint y, + GLsizei width, + GLsizei height) +{ + xglGLOpRec gl; + + gl.glProc = xglCopyConvolutionFilter2DProc; + + gl.u.copy_convolution_filter_2d.target = target; + gl.u.copy_convolution_filter_2d.internalformat = internalformat; + gl.u.copy_convolution_filter_2d.x = x; + gl.u.copy_convolution_filter_2d.y = y; + gl.u.copy_convolution_filter_2d.width = width; + gl.u.copy_convolution_filter_2d.height = height; + + xglGLOp (&gl); +} + +static void +xglCopyTexSubImage3DProc (xglGLOpPtr pOp) +{ + glCopyTexSubImage3D (pOp->u.copy_tex_sub_image_3d.target, + pOp->u.copy_tex_sub_image_3d.level, + pOp->u.copy_tex_sub_image_3d.xoffset, + pOp->u.copy_tex_sub_image_3d.yoffset, + pOp->u.copy_tex_sub_image_3d.zoffset, + pOp->u.copy_tex_sub_image_3d.x + + cctx->pReadBuffer->xOff, + pOp->u.copy_tex_sub_image_3d.y + + cctx->pReadBuffer->yOff, + pOp->u.copy_tex_sub_image_3d.width, + pOp->u.copy_tex_sub_image_3d.height); +} + +static void +xglCopyTexSubImage3D (GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLint zoffset, + GLint x, + GLint y, + GLsizei width, + GLsizei height) +{ + xglGLOpRec gl; + + gl.glProc = xglCopyTexSubImage3DProc; + + gl.u.copy_tex_sub_image_3d.target = target; + gl.u.copy_tex_sub_image_3d.level = level; + gl.u.copy_tex_sub_image_3d.xoffset = xoffset; + gl.u.copy_tex_sub_image_3d.yoffset = yoffset; + gl.u.copy_tex_sub_image_3d.zoffset = zoffset; + gl.u.copy_tex_sub_image_3d.x = x; + gl.u.copy_tex_sub_image_3d.y = y; + gl.u.copy_tex_sub_image_3d.width = width; + gl.u.copy_tex_sub_image_3d.height = height; + + xglGLOp (&gl); +} + +/* GL_ARB_multitexture */ +static void +xglNoOpActiveTextureARB (GLenum texture) {} +static void +xglActiveTextureARBProc (xglGLOpPtr pOp) +{ + GLenum texUnit; + + texUnit = pOp->u.enumeration - GL_TEXTURE0; + if (texUnit < 0 || texUnit >= cctx->maxTexUnits) + { + xglRecordError (GL_INVALID_ENUM); + } + else + { + cctx->activeTexUnit = texUnit; + (*cctx->ActiveTextureARB) (pOp->u.enumeration); + } +} +static void +xglActiveTextureARB (GLenum texture) +{ + xglGLOpRec gl; + + gl.glProc = xglActiveTextureARBProc; + + gl.u.enumeration = texture; + + xglGLOp (&gl); +} +static void +xglNoOpClientActiveTextureARB (GLenum texture) {} +static void +xglNoOpMultiTexCoord1dvARB (GLenum target, const GLdouble *v) {} +static void +xglNoOpMultiTexCoord1fvARB (GLenum target, const GLfloat *v) {} +static void +xglNoOpMultiTexCoord1ivARB (GLenum target, const GLint *v) {} +static void +xglNoOpMultiTexCoord1svARB (GLenum target, const GLshort *v) {} +static void +xglNoOpMultiTexCoord2dvARB (GLenum target, const GLdouble *v) {} +static void +xglNoOpMultiTexCoord2fvARB (GLenum target, const GLfloat *v) {} +static void +xglNoOpMultiTexCoord2ivARB (GLenum target, const GLint *v) {} +static void +xglNoOpMultiTexCoord2svARB (GLenum target, const GLshort *v) {} +static void +xglNoOpMultiTexCoord3dvARB (GLenum target, const GLdouble *v) {} +static void +xglNoOpMultiTexCoord3fvARB (GLenum target, const GLfloat *v) {} +static void +xglNoOpMultiTexCoord3ivARB (GLenum target, const GLint *v) {} +static void +xglNoOpMultiTexCoord3svARB (GLenum target, const GLshort *v) {} +static void +xglNoOpMultiTexCoord4dvARB (GLenum target, const GLdouble *v) {} +static void +xglNoOpMultiTexCoord4fvARB (GLenum target, const GLfloat *v) {} +static void +xglNoOpMultiTexCoord4ivARB (GLenum target, const GLint *v) {} +static void +xglNoOpMultiTexCoord4svARB (GLenum target, const GLshort *v) {} + +/* GL_ARB_multisample */ +static void +xglNoOpSampleCoverageARB (GLclampf value, GLboolean invert) {} + +/* GL_EXT_texture_object */ +static GLboolean +xglNoOpAreTexturesResidentEXT (GLsizei n, + const GLuint *textures, + GLboolean *residences) +{ + return GL_FALSE; +} +static void +xglNoOpGenTexturesEXT (GLsizei n, GLuint *textures) {} +static GLboolean +xglNoOpIsTextureEXT (GLuint texture) +{ + return GL_FALSE; +} + +/* GL_SGIS_multisample */ +static void +xglNoOpSampleMaskSGIS (GLclampf value, GLboolean invert) {} +static void +xglNoOpSamplePatternSGIS (GLenum pattern) {} + +/* GL_EXT_point_parameters */ +static void +xglNoOpPointParameterfEXT (GLenum pname, GLfloat param) {} +static void +xglNoOpPointParameterfvEXT (GLenum pname, const GLfloat *params) {} + +/* GL_MESA_window_pos */ +static void +xglNoOpWindowPos3fMESA (GLfloat x, GLfloat y, GLfloat z) {} +static void +xglWindowPos3fMESAProc (xglGLOpPtr pOp) +{ + (*cctx->WindowPos3fMESA) (pOp->u.window_pos_3f.x + cctx->pDrawBuffer->xOff, + pOp->u.window_pos_3f.y + cctx->pDrawBuffer->yOff, + pOp->u.window_pos_3f.z); +} +static void +xglWindowPos3fMESA (GLfloat x, GLfloat y, GLfloat z) +{ + xglGLOpRec gl; + + gl.glProc = xglWindowPos3fMESAProc; + + gl.u.window_pos_3f.x = x; + gl.u.window_pos_3f.y = y; + gl.u.window_pos_3f.z = z; + + xglGLOp (&gl); +} + +/* GL_EXT_blend_func_separate */ +static void +xglNoOpBlendFuncSeparateEXT (GLenum sfactorRGB, GLenum dfactorRGB, + GLenum sfactorAlpha, GLenum dfactorAlpha) {} + +/* GL_EXT_fog_coord */ +static void +xglNoOpFogCoordfvEXT (const GLfloat *coord) {} +static void +xglNoOpFogCoorddvEXT (const GLdouble *coord) {} +static void +xglNoOpFogCoordPointerEXT (GLenum type, GLsizei stride, + const GLvoid *pointer) {} + +/* GL_EXT_secondary_color */ +static void +xglNoOpSecondaryColor3bvEXT (const GLbyte *v) {} +static void +xglNoOpSecondaryColor3dvEXT (const GLdouble *v) {} +static void +xglNoOpSecondaryColor3fvEXT (const GLfloat *v) {} +static void +xglNoOpSecondaryColor3ivEXT (const GLint *v) {} +static void +xglNoOpSecondaryColor3svEXT (const GLshort *v) {} +static void +xglNoOpSecondaryColor3ubvEXT (const GLubyte *v) {} +static void +xglNoOpSecondaryColor3uivEXT (const GLuint *v) {} +static void +xglNoOpSecondaryColor3usvEXT (const GLushort *v) {} +static void +xglNoOpSecondaryColorPointerEXT (GLint size, GLenum type, GLsizei stride, + const GLvoid *pointer) {} + +/* GL_NV_point_sprite */ +static void +xglNoOpPointParameteriNV (GLenum pname, GLint params) {} +static void +xglNoOpPointParameterivNV (GLenum pname, const GLint *params) {} + +/* GL_EXT_stencil_two_side */ +static void +xglNoOpActiveStencilFaceEXT (GLenum face) {} + +/* GL_EXT_framebuffer_object */ +static GLboolean +xglNoOpIsRenderbufferEXT (GLuint renderbuffer) +{ + return FALSE; +} +static void +xglNoOpBindRenderbufferEXT (GLenum target, GLuint renderbuffer) {} +static void +xglNoOpDeleteRenderbuffersEXT (GLsizei n, const GLuint *renderbuffers) {} +static void +xglNoOpGenRenderbuffersEXT (GLsizei n, GLuint *renderbuffers) {} +static void +xglNoOpRenderbufferStorageEXT (GLenum target, GLenum internalformat, + GLsizei width, GLsizei height) {} +static void +xglNoOpGetRenderbufferParameterivEXT (GLenum target, GLenum pname, + GLint *params) {} +static GLboolean +xglNoOpIsFramebufferEXT (GLuint framebuffer) +{ + return FALSE; +} +static void +xglNoOpBindFramebufferEXT (GLenum target, GLuint framebuffer) {} +static void +xglNoOpDeleteFramebuffersEXT (GLsizei n, const GLuint *framebuffers) {} +static void +xglNoOpGenFramebuffersEXT (GLsizei n, GLuint *framebuffers) {} +static GLenum +xglNoOpCheckFramebufferStatusEXT (GLenum target) +{ + return GL_FRAMEBUFFER_UNSUPPORTED_EXT; +} +static void +xglNoOpFramebufferTexture1DEXT (GLenum target, GLenum attachment, + GLenum textarget, GLuint texture, + GLint level) {} +static void +xglNoOpFramebufferTexture2DEXT (GLenum target, GLenum attachment, + GLenum textarget, GLuint texture, + GLint level) {} +static void +xglNoOpFramebufferTexture3DEXT (GLenum target, GLenum attachment, + GLenum textarget, GLuint texture, + GLint level, GLint zoffset) {} +static void +xglNoOpFramebufferRenderbufferEXT (GLenum target, GLenum attachment, + GLenum renderbuffertarget, + GLuint renderbuffer) {} +static void +xglNoOpGetFramebufferAttachmentParameterivEXT (GLenum target, + GLenum attachment, + GLenum pname, + GLint *params) {} +static void +xglNoOpGenerateMipmapEXT (GLenum target) {} + +static struct _glapi_table __glNativeRenderTable = { + xglNewList, + xglEndList, + xglCallList, + xglCallLists, + xglDeleteLists, + xglGenLists, + glListBase, + xglBegin, + xglBitmap, + 0, /* glColor3b */ + glColor3bv, + 0, /* glColor3d */ + glColor3dv, + 0, /* glColor3f */ + glColor3fv, + 0, /* glColor3i */ + glColor3iv, + 0, /* glColor3s */ + glColor3sv, + 0, /* glColor3ub */ + glColor3ubv, + 0, /* glColor3ui */ + glColor3uiv, + 0, /* glColor3us */ + glColor3usv, + 0, /* glColor4b */ + glColor4bv, + 0, /* glColor4d */ + glColor4dv, + 0, /* glColor4f */ + glColor4fv, + 0, /* glColor4i */ + glColor4iv, + 0, /* glColor4s */ + glColor4sv, + 0, /* glColor4ub */ + glColor4ubv, + 0, /* glColor4ui */ + glColor4uiv, + 0, /* glColor4us */ + glColor4usv, + 0, /* glEdgeFlag */ + glEdgeFlagv, + xglEnd, + 0, /* glIndexd */ + glIndexdv, + 0, /* glIndexf */ + glIndexfv, + 0, /* glIndexi */ + glIndexiv, + 0, /* glIndexs */ + glIndexsv, + 0, /* glNormal3b */ + glNormal3bv, + 0, /* glNormal3d */ + glNormal3dv, + 0, /* glNormal3f */ + glNormal3fv, + 0, /* glNormal3i */ + glNormal3iv, + 0, /* glNormal3s */ + glNormal3sv, + 0, /* glRasterPos2d */ + glRasterPos2dv, + 0, /* glRasterPos2f */ + glRasterPos2fv, + 0, /* glRasterPos2i */ + glRasterPos2iv, + 0, /* glRasterPos2s */ + glRasterPos2sv, + 0, /* glRasterPos3d */ + glRasterPos3dv, + 0, /* glRasterPos3f */ + glRasterPos3fv, + 0, /* glRasterPos3i */ + glRasterPos3iv, + 0, /* glRasterPos3s */ + glRasterPos3sv, + 0, /* glRasterPos4d */ + glRasterPos4dv, + 0, /* glRasterPos4f */ + glRasterPos4fv, + 0, /* glRasterPos4i */ + glRasterPos4iv, + 0, /* glRasterPos4s */ + glRasterPos4sv, + 0, /* glRectd */ + xglRectdv, + 0, /* glRectf */ + xglRectfv, + 0, /* glRecti */ + xglRectiv, + 0, /* glRects */ + xglRectsv, + 0, /* glTexCoord1d */ + glTexCoord1dv, + 0, /* glTexCoord1f */ + glTexCoord1fv, + 0, /* glTexCoord1i */ + glTexCoord1iv, + 0, /* glTexCoord1s */ + glTexCoord1sv, + 0, /* glTexCoord2d */ + glTexCoord2dv, + 0, /* glTexCoord2f */ + glTexCoord2fv, + 0, /* glTexCoord2i */ + glTexCoord2iv, + 0, /* glTexCoord2s */ + glTexCoord2sv, + 0, /* glTexCoord3d */ + glTexCoord3dv, + 0, /* glTexCoord3f */ + glTexCoord3fv, + 0, /* glTexCoord3i */ + glTexCoord3iv, + 0, /* glTexCoord3s */ + glTexCoord3sv, + 0, /* glTexCoord4d */ + glTexCoord4dv, + 0, /* glTexCoord4f */ + glTexCoord4fv, + 0, /* glTexCoord4i */ + glTexCoord4iv, + 0, /* glTexCoord4s */ + glTexCoord4sv, + 0, /* glVertex2d */ + glVertex2dv, + 0, /* glVertex2f */ + glVertex2fv, + 0, /* glVertex2i */ + glVertex2iv, + 0, /* glVertex2s */ + glVertex2sv, + 0, /* glVertex3d */ + glVertex3dv, + 0, /* glVertex3f */ + glVertex3fv, + 0, /* glVertex3i */ + glVertex3iv, + 0, /* glVertex3s */ + glVertex3sv, + 0, /* glVertex4d */ + glVertex4dv, + 0, /* glVertex4f */ + glVertex4fv, + 0, /* glVertex4i */ + glVertex4iv, + 0, /* glVertex4s */ + glVertex4sv, + glClipPlane, + glColorMaterial, + glCullFace, + glFogf, + glFogfv, + glFogi, + glFogiv, + glFrontFace, + glHint, + glLightf, + glLightfv, + glLighti, + glLightiv, + glLightModelf, + glLightModelfv, + glLightModeli, + glLightModeliv, + glLineStipple, + glLineWidth, + glMaterialf, + glMaterialfv, + glMateriali, + glMaterialiv, + glPointSize, + glPolygonMode, + glPolygonStipple, + xglScissor, + glShadeModel, + xglTexParameterf, + xglTexParameterfv, + xglTexParameteri, + xglTexParameteriv, + glTexImage1D, + glTexImage2D, + glTexEnvf, + glTexEnvfv, + glTexEnvi, + glTexEnviv, + glTexGend, + glTexGendv, + glTexGenf, + glTexGenfv, + glTexGeni, + glTexGeniv, + glFeedbackBuffer, + glSelectBuffer, + glRenderMode, + glInitNames, + glLoadName, + glPassThrough, + glPopName, + glPushName, + xglDrawBuffer, + xglClear, + glClearAccum, + glClearIndex, + glClearColor, + glClearStencil, + glClearDepth, + glStencilMask, + glColorMask, + glDepthMask, + glIndexMask, + xglAccum, + xglDisable, + xglEnable, + xglFinish, + xglFlush, + xglPopAttrib, + xglPushAttrib, + glMap1d, + glMap1f, + glMap2d, + glMap2f, + glMapGrid1d, + glMapGrid1f, + glMapGrid2d, + glMapGrid2f, + 0, /* glEvalCoord1d */ + glEvalCoord1dv, + 0, /* glEvalCoord1f */ + glEvalCoord1fv, + 0, /* glEvalCoord2d */ + glEvalCoord2dv, + 0, /* glEvalCoord2f */ + glEvalCoord2fv, + glEvalMesh1, + glEvalPoint1, + glEvalMesh2, + glEvalPoint2, + glAlphaFunc, + glBlendFunc, + glLogicOp, + glStencilFunc, + glStencilOp, + glDepthFunc, + glPixelZoom, + glPixelTransferf, + glPixelTransferi, + glPixelStoref, + glPixelStorei, + glPixelMapfv, + glPixelMapuiv, + glPixelMapusv, + xglReadBuffer, + xglCopyPixels, + xglReadPixels, + xglDrawPixels, + xglGetBooleanv, + glGetClipPlane, + xglGetDoublev, + xglGetError, + xglGetFloatv, + xglGetIntegerv, + glGetLightfv, + glGetLightiv, + glGetMapdv, + glGetMapfv, + glGetMapiv, + glGetMaterialfv, + glGetMaterialiv, + glGetPixelMapfv, + glGetPixelMapuiv, + glGetPixelMapusv, + glGetPolygonStipple, + xglGetString, + glGetTexEnvfv, + glGetTexEnviv, + glGetTexGendv, + glGetTexGenfv, + glGetTexGeniv, + glGetTexImage, + glGetTexParameterfv, + glGetTexParameteriv, + xglGetTexLevelParameterfv, + xglGetTexLevelParameteriv, + xglIsEnabled, + xglIsList, + glDepthRange, + glFrustum, + glLoadIdentity, + glLoadMatrixf, + glLoadMatrixd, + glMatrixMode, + glMultMatrixf, + glMultMatrixd, + glOrtho, + glPopMatrix, + glPushMatrix, + glRotated, + glRotatef, + glScaled, + glScalef, + glTranslated, + glTranslatef, + xglViewport, + glArrayElement, + xglBindTexture, + glColorPointer, + glDisableClientState, + xglDrawArrays, + xglDrawElements, + glEdgeFlagPointer, + glEnableClientState, + glIndexPointer, + 0, /* glIndexub */ + glIndexubv, + glInterleavedArrays, + glNormalPointer, + glPolygonOffset, + glTexCoordPointer, + glVertexPointer, + xglAreTexturesResident, + xglCopyTexImage1D, + xglCopyTexImage2D, + xglCopyTexSubImage1D, + xglCopyTexSubImage2D, + xglDeleteTextures, + xglGenTextures, + glGetPointerv, + xglIsTexture, + xglPrioritizeTextures, + glTexSubImage1D, + glTexSubImage2D, + glPopClientAttrib, + glPushClientAttrib, + glBlendColor, + glBlendEquation, + 0, /* glDrawRangeElements */ + glColorTable, + glColorTableParameterfv, + glColorTableParameteriv, + xglCopyColorTable, + glGetColorTable, + glGetColorTableParameterfv, + glGetColorTableParameteriv, + glColorSubTable, + xglCopyColorSubTable, + glConvolutionFilter1D, + glConvolutionFilter2D, + glConvolutionParameterf, + glConvolutionParameterfv, + glConvolutionParameteri, + glConvolutionParameteriv, + xglCopyConvolutionFilter1D, + xglCopyConvolutionFilter2D, + glGetConvolutionFilter, + glGetConvolutionParameterfv, + glGetConvolutionParameteriv, + glGetSeparableFilter, + glSeparableFilter2D, + glGetHistogram, + glGetHistogramParameterfv, + glGetHistogramParameteriv, + glGetMinmax, + glGetMinmaxParameterfv, + glGetMinmaxParameteriv, + glHistogram, + glMinmax, + glResetHistogram, + glResetMinmax, + glTexImage3D, + glTexSubImage3D, + xglCopyTexSubImage3D, + xglNoOpActiveTextureARB, + xglNoOpClientActiveTextureARB, + 0, /* glMultiTexCoord1dARB */ + xglNoOpMultiTexCoord1dvARB, + 0, /* glMultiTexCoord1fARB */ + xglNoOpMultiTexCoord1fvARB, + 0, /* glMultiTexCoord1iARB */ + xglNoOpMultiTexCoord1ivARB, + 0, /* glMultiTexCoord1sARB */ + xglNoOpMultiTexCoord1svARB, + 0, /* glMultiTexCoord2dARB */ + xglNoOpMultiTexCoord2dvARB, + 0, /* glMultiTexCoord2fARB */ + xglNoOpMultiTexCoord2fvARB, + 0, /* glMultiTexCoord2iARB */ + xglNoOpMultiTexCoord2ivARB, + 0, /* glMultiTexCoord2sARB */ + xglNoOpMultiTexCoord2svARB, + 0, /* glMultiTexCoord3dARB */ + xglNoOpMultiTexCoord3dvARB, + 0, /* glMultiTexCoord3fARB */ + xglNoOpMultiTexCoord3fvARB, + 0, /* glMultiTexCoord3iARB */ + xglNoOpMultiTexCoord3ivARB, + 0, /* glMultiTexCoord3sARB */ + xglNoOpMultiTexCoord3svARB, + 0, /* glMultiTexCoord4dARB */ + xglNoOpMultiTexCoord4dvARB, + 0, /* glMultiTexCoord4fARB */ + xglNoOpMultiTexCoord4fvARB, + 0, /* glMultiTexCoord4iARB */ + xglNoOpMultiTexCoord4ivARB, + 0, /* glMultiTexCoord4sARB */ + xglNoOpMultiTexCoord4svARB, + 0, /* glLoadTransposeMatrixfARB */ + 0, /* glLoadTransposeMatrixdARB */ + 0, /* glMultTransposeMatrixfARB */ + 0, /* glMultTransposeMatrixdARB */ + xglNoOpSampleCoverageARB, + 0, /* glDrawBuffersARB */ + 0, /* glPolygonOffsetEXT */ + 0, /* glGetTexFilterFuncSGIS */ + 0, /* glTexFilterFuncSGIS */ + 0, /* glGetHistogramEXT */ + 0, /* glGetHistogramParameterfvEXT */ + 0, /* glGetHistogramParameterivEXT */ + 0, /* glGetMinmaxEXT */ + 0, /* glGetMinmaxParameterfvEXT */ + 0, /* glGetMinmaxParameterivEXT */ + 0, /* glGetConvolutionFilterEXT */ + 0, /* glGetConvolutionParameterfvEXT */ + 0, /* glGetConvolutionParameterivEXT */ + 0, /* glGetSeparableFilterEXT */ + 0, /* glGetColorTableSGI */ + 0, /* glGetColorTableParameterfvSGI */ + 0, /* glGetColorTableParameterivSGI */ + 0, /* glPixelTexGenSGIX */ + 0, /* glPixelTexGenParameteriSGIS */ + 0, /* glPixelTexGenParameterivSGIS */ + 0, /* glPixelTexGenParameterfSGIS */ + 0, /* glPixelTexGenParameterfvSGIS */ + 0, /* glGetPixelTexGenParameterivSGIS */ + 0, /* glGetPixelTexGenParameterfvSGIS */ + 0, /* glTexImage4DSGIS */ + 0, /* glTexSubImage4DSGIS */ + xglNoOpAreTexturesResidentEXT, + xglNoOpGenTexturesEXT, + xglNoOpIsTextureEXT, + 0, /* glDetailTexFuncSGIS */ + 0, /* glGetDetailTexFuncSGIS */ + 0, /* glSharpenTexFuncSGIS */ + 0, /* glGetSharpenTexFuncSGIS */ + xglNoOpSampleMaskSGIS, + xglNoOpSamplePatternSGIS, + 0, /* glColorPointerEXT */ + 0, /* glEdgeFlagPointerEXT */ + 0, /* glIndexPointerEXT */ + 0, /* glNormalPointerEXT */ + 0, /* glTexCoordPointerEXT */ + 0, /* glVertexPointerEXT */ + 0, /* glSpriteParameterfSGIX */ + 0, /* glSpriteParameterfvSGIX */ + 0, /* glSpriteParameteriSGIX */ + 0, /* glSpriteParameterivSGIX */ + xglNoOpPointParameterfEXT, + xglNoOpPointParameterfvEXT, + 0, /* glGetInstrumentsSGIX */ + 0, /* glInstrumentsBufferSGIX */ + 0, /* glPollInstrumentsSGIX */ + 0, /* glReadInstrumentsSGIX */ + 0, /* glStartInstrumentsSGIX */ + 0, /* glStopInstrumentsSGIX */ + 0, /* glFrameZoomSGIX */ + 0, /* glTagSampleBufferSGIX */ + 0, /* glReferencePlaneSGIX */ + 0, /* glFlushRasterSGIX */ + 0, /* glGetListParameterfvSGIX */ + 0, /* glGetListParameterivSGIX */ + 0, /* glListParameterfSGIX */ + 0, /* glListParameterfvSGIX */ + 0, /* glListParameteriSGIX */ + 0, /* glListParameterivSGIX */ + 0, /* glFragmentColorMaterialSGIX */ + 0, /* glFragmentLightfSGIX */ + 0, /* glFragmentLightfvSGIX */ + 0, /* glFragmentLightiSGIX */ + 0, /* glFragmentLightivSGIX */ + 0, /* glFragmentLightModelfSGIX */ + 0, /* glFragmentLightModelfvSGIX */ + 0, /* glFragmentLightModeliSGIX */ + 0, /* glFragmentLightModelivSGIX */ + 0, /* glFragmentMaterialfSGIX */ + 0, /* glFragmentMaterialfvSGIX */ + 0, /* glFragmentMaterialiSGIX */ + 0, /* glFragmentMaterialivSGIX */ + 0, /* glGetFragmentLightfvSGIX */ + 0, /* glGetFragmentLightivSGIX */ + 0, /* glGetFragmentMaterialfvSGIX */ + 0, /* glGetFragmentMaterialivSGIX */ + 0, /* glLightEnviSGIX */ + 0, /* glVertexWeightfEXT */ + 0, /* glVertexWeightfvEXT */ + 0, /* glVertexWeightPointerEXT */ + 0, /* glFlushVertexArrayRangeNV */ + 0, /* glVertexArrayRangeNV */ + 0, /* glCombinerParameterfvNV */ + 0, /* glCombinerParameterfNV */ + 0, /* glCombinerParameterivNV */ + 0, /* glCombinerParameteriNV */ + 0, /* glCombinerInputNV */ + 0, /* glCombinerOutputNV */ + 0, /* glFinalCombinerInputNV */ + 0, /* glGetCombinerInputParameterfvNV */ + 0, /* glGetCombinerInputParameterivNV */ + 0, /* glGetCombinerOutputParameterfvNV */ + 0, /* glGetCombinerOutputParameterivNV */ + 0, /* glGetFinalCombinerInputParameterfvNV */ + 0, /* glGetFinalCombinerInputParameterivNV */ + 0, /* glResizeBuffersMESA */ + 0, /* glWindowPos2dMESA */ + 0, /* glWindowPos2dvMESA */ + 0, /* glWindowPos2fMESA */ + 0, /* glWindowPos2fvMESA */ + 0, /* glWindowPos2iMESA */ + 0, /* glWindowPos2ivMESA */ + 0, /* glWindowPos2sMESA */ + 0, /* glWindowPos2svMESA */ + 0, /* glWindowPos3dMESA */ + 0, /* glWindowPos3dvMESA */ + xglNoOpWindowPos3fMESA, + 0, /* glWindowPos3fvMESA */ + 0, /* glWindowPos3iMESA */ + 0, /* glWindowPos3ivMESA */ + 0, /* glWindowPos3sMESA */ + 0, /* glWindowPos3svMESA */ + 0, /* glWindowPos4dMESA */ + 0, /* glWindowPos4dvMESA */ + 0, /* glWindowPos4fMESA */ + 0, /* glWindowPos4fvMESA */ + 0, /* glWindowPos4iMESA */ + 0, /* glWindowPos4ivMESA */ + 0, /* glWindowPos4sMESA */ + 0, /* glWindowPos4svMESA */ + xglNoOpBlendFuncSeparateEXT, + 0, /* glIndexMaterialEXT */ + 0, /* glIndexFuncEXT */ + 0, /* glLockArraysEXT */ + 0, /* glUnlockArraysEXT */ + 0, /* glCullParameterdvEXT */ + 0, /* glCullParameterfvEXT */ + 0, /* glHintPGI */ + 0, /* glFogCoordfEXT */ + xglNoOpFogCoordfvEXT, + 0, /* glFogCoorddEXT */ + xglNoOpFogCoorddvEXT, + xglNoOpFogCoordPointerEXT, + 0, /* glGetColorTableEXT */ + 0, /* glGetColorTableParameterivEXT */ + 0, /* glGetColorTableParameterfvEXT */ + 0, /* glTbufferMask3DFX */ + 0, /* glCompressedTexImage3DARB */ + 0, /* glCompressedTexImage2DARB */ + 0, /* glCompressedTexImage1DARB */ + 0, /* glCompressedTexSubImage3DARB */ + 0, /* glCompressedTexSubImage2DARB */ + 0, /* glCompressedTexSubImage1DARB */ + 0, /* glGetCompressedTexImageARB */ + 0, /* glSecondaryColor3bEXT */ + xglNoOpSecondaryColor3bvEXT, + 0, /* glSecondaryColor3dEXT */ + xglNoOpSecondaryColor3dvEXT, + 0, /* glSecondaryColor3fEXT */ + xglNoOpSecondaryColor3fvEXT, + 0, /* glSecondaryColor3iEXT */ + xglNoOpSecondaryColor3ivEXT, + 0, /* glSecondaryColor3sEXT */ + xglNoOpSecondaryColor3svEXT, + 0, /* glSecondaryColor3ubEXT */ + xglNoOpSecondaryColor3ubvEXT, + 0, /* glSecondaryColor3uiEXT */ + xglNoOpSecondaryColor3uivEXT, + 0, /* glSecondaryColor3usEXT */ + xglNoOpSecondaryColor3usvEXT, + xglNoOpSecondaryColorPointerEXT, + 0, /* glAreProgramsResidentNV */ + 0, /* glBindProgramNV */ + 0, /* glDeleteProgramsNV */ + 0, /* glExecuteProgramNV */ + 0, /* glGenProgramsNV */ + 0, /* glGetProgramParameterdvNV */ + 0, /* glGetProgramParameterfvNV */ + 0, /* glGetProgramivNV */ + 0, /* glGetProgramStringNV */ + 0, /* glGetTrackMatrixivNV */ + 0, /* glGetVertexAttribdvARB */ + 0, /* glGetVertexAttribfvARB */ + 0, /* glGetVertexAttribivARB */ + 0, /* glGetVertexAttribPointervNV */ + 0, /* glIsProgramNV */ + 0, /* glLoadProgramNV */ + 0, /* glProgramParameter4dNV */ + 0, /* glProgramParameter4dvNV */ + 0, /* glProgramParameter4fNV */ + 0, /* glProgramParameter4fvNV */ + 0, /* glProgramParameters4dvNV */ + 0, /* glProgramParameters4fvNV */ + 0, /* glRequestResidentProgramsNV */ + 0, /* glTrackMatrixNV */ + 0, /* glVertexAttribPointerNV */ + 0, /* glVertexAttrib1dARB */ + 0, /* glVertexAttrib1dvARB */ + 0, /* glVertexAttrib1fARB */ + 0, /* glVertexAttrib1fvARB */ + 0, /* glVertexAttrib1sARB */ + 0, /* glVertexAttrib1svARB */ + 0, /* glVertexAttrib2dARB */ + 0, /* glVertexAttrib2dvARB */ + 0, /* glVertexAttrib2fARB */ + 0, /* glVertexAttrib2fvARB */ + 0, /* glVertexAttrib2sARB */ + 0, /* glVertexAttrib2svARB */ + 0, /* glVertexAttrib3dARB */ + 0, /* glVertexAttrib3dvARB */ + 0, /* glVertexAttrib3fARB */ + 0, /* glVertexAttrib3fvARB */ + 0, /* glVertexAttrib3sARB */ + 0, /* glVertexAttrib3svARB */ + 0, /* glVertexAttrib4dARB */ + 0, /* glVertexAttrib4dvARB */ + 0, /* glVertexAttrib4fARB */ + 0, /* glVertexAttrib4fvARB */ + 0, /* glVertexAttrib4sARB */ + 0, /* glVertexAttrib4svARB */ + 0, /* glVertexAttrib4NubARB */ + 0, /* glVertexAttrib4NubvARB */ + 0, /* glVertexAttribs1dvNV */ + 0, /* glVertexAttribs1fvNV */ + 0, /* glVertexAttribs1svNV */ + 0, /* glVertexAttribs2dvNV */ + 0, /* glVertexAttribs2fvNV */ + 0, /* glVertexAttribs2svNV */ + 0, /* glVertexAttribs3dvNV */ + 0, /* glVertexAttribs3fvNV */ + 0, /* glVertexAttribs3svNV */ + 0, /* glVertexAttribs4dvNV */ + 0, /* glVertexAttribs4fvNV */ + 0, /* glVertexAttribs4svNV */ + 0, /* glVertexAttribs4ubvNV */ + xglNoOpPointParameteriNV, + xglNoOpPointParameterivNV, + 0, /* glMultiDrawArraysEXT */ + 0, /* glMultiDrawElementsEXT */ + xglNoOpActiveStencilFaceEXT, + 0, /* glDeleteFencesNV */ + 0, /* glGenFencesNV */ + 0, /* glIsFenceNV */ + 0, /* glTestFenceNV */ + 0, /* glGetFenceivNV */ + 0, /* glFinishFenceNV */ + 0, /* glSetFenceNV */ + 0, /* glVertexAttrib4bvARB */ + 0, /* glVertexAttrib4ivARB */ + 0, /* glVertexAttrib4ubvARB */ + 0, /* glVertexAttrib4usvARB */ + 0, /* glVertexAttrib4uivARB */ + 0, /* glVertexAttrib4NbvARB */ + 0, /* glVertexAttrib4NsvARB */ + 0, /* glVertexAttrib4NivARB */ + 0, /* glVertexAttrib4NusvARB */ + 0, /* glVertexAttrib4NuivARB */ + 0, /* glVertexAttribPointerARB */ + 0, /* glEnableVertexAttribArrayARB */ + 0, /* glDisableVertexAttribArrayARB */ + 0, /* glProgramStringARB */ + 0, /* glProgramEnvParameter4dARB */ + 0, /* glProgramEnvParameter4dvARB */ + 0, /* glProgramEnvParameter4fARB */ + 0, /* glProgramEnvParameter4fvARB */ + 0, /* glProgramLocalParameter4dARB */ + 0, /* glProgramLocalParameter4dvARB */ + 0, /* glProgramLocalParameter4fARB */ + 0, /* glProgramLocalParameter4fvARB */ + 0, /* glGetProgramEnvParameterdvARB */ + 0, /* glGetProgramEnvParameterfvARB */ + 0, /* glGetProgramLocalParameterdvARB */ + 0, /* glGetProgramLocalParameterfvARB */ + 0, /* glGetProgramivARB */ + 0, /* glGetProgramStringARB */ + 0, /* glProgramNamedParameter4fNV */ + 0, /* glProgramNamedParameter4dNV */ + 0, /* glProgramNamedParameter4fvNV */ + 0, /* glProgramNamedParameter4dvNV */ + 0, /* glGetProgramNamedParameterfvNV */ + 0, /* glGetProgramNamedParameterdvNV */ + 0, /* glBindBufferARB */ + 0, /* glBufferDataARB */ + 0, /* glBufferSubDataARB */ + 0, /* glDeleteBuffersARB */ + 0, /* glGenBuffersARB */ + 0, /* glGetBufferParameterivARB */ + 0, /* glGetBufferPointervARB */ + 0, /* glGetBufferSubDataARB */ + 0, /* glIsBufferARB */ + 0, /* glMapBufferARB */ + 0, /* glUnmapBufferARB */ + 0, /* glDepthBoundsEXT */ + 0, /* glGenQueriesARB */ + 0, /* glDeleteQueriesARB */ + 0, /* glIsQueryARB */ + 0, /* glBeginQueryARB */ + 0, /* glEndQueryARB */ + 0, /* glGetQueryivARB */ + 0, /* glGetQueryObjectivARB */ + 0, /* glGetQueryObjectuivARB */ + 0, /* glMultiModeDrawArraysIBM */ + 0, /* glMultiModeDrawElementsIBM */ + 0, /* glBlendEquationSeparateEXT */ + 0, /* glDeleteObjectARB */ + 0, /* glGetHandleARB */ + 0, /* glDetachObjectARB */ + 0, /* glCreateShaderObjectARB */ + 0, /* glShaderSourceARB */ + 0, /* glCompileShaderARB */ + 0, /* glCreateProgramObjectARB */ + 0, /* glAttachObjectARB */ + 0, /* glLinkProgramARB */ + 0, /* glUseProgramObjectARB */ + 0, /* glValidateProgramARB */ + 0, /* glUniform1fARB */ + 0, /* glUniform2fARB */ + 0, /* glUniform3fARB */ + 0, /* glUniform4fARB */ + 0, /* glUniform1iARB */ + 0, /* glUniform2iARB */ + 0, /* glUniform3iARB */ + 0, /* glUniform4iARB */ + 0, /* glUniform1fvARB */ + 0, /* glUniform2fvARB */ + 0, /* glUniform3fvARB */ + 0, /* glUniform4fvARB */ + 0, /* glUniform1ivARB */ + 0, /* glUniform2ivARB */ + 0, /* glUniform3ivARB */ + 0, /* glUniform4ivARB */ + 0, /* glUniformMatrix2fvARB */ + 0, /* glUniformMatrix3fvARB */ + 0, /* glUniformMatrix4fvARB */ + 0, /* glGetObjectParameterfvARB */ + 0, /* glGetObjectParameterivARB */ + 0, /* glGetInfoLogARB */ + 0, /* glGetAttachedObjectsARB */ + 0, /* glGetUniformLocationARB */ + 0, /* glGetActiveUniformARB */ + 0, /* glGetUniformfvARB */ + 0, /* glGetUniformivARB */ + 0, /* glGetShaderSourceARB */ + 0, /* glBindAttribLocationARB */ + 0, /* glGetActiveAttribARB */ + 0, /* glGetAttribLocationARB */ + 0, /* glGetVertexAttribdvNV */ + 0, /* glGetVertexAttribfvNV */ + 0, /* glGetVertexAttribivNV */ + 0, /* glVertexAttrib1dNV */ + 0, /* glVertexAttrib1dvNV */ + 0, /* glVertexAttrib1fNV */ + 0, /* glVertexAttrib1fvNV */ + 0, /* glVertexAttrib1sNV */ + 0, /* glVertexAttrib1svNV */ + 0, /* glVertexAttrib2dNV */ + 0, /* glVertexAttrib2dvNV */ + 0, /* glVertexAttrib2fNV */ + 0, /* glVertexAttrib2fvNV */ + 0, /* glVertexAttrib2sNV */ + 0, /* glVertexAttrib2svNV */ + 0, /* glVertexAttrib3dNV */ + 0, /* glVertexAttrib3dvNV */ + 0, /* glVertexAttrib3fNV */ + 0, /* glVertexAttrib3fvNV */ + 0, /* glVertexAttrib3sNV */ + 0, /* glVertexAttrib3svNV */ + 0, /* glVertexAttrib4dNV */ + 0, /* glVertexAttrib4dvNV */ + 0, /* glVertexAttrib4fNV */ + 0, /* glVertexAttrib4fvNV */ + 0, /* glVertexAttrib4sNV */ + 0, /* glVertexAttrib4svNV */ + 0, /* glVertexAttrib4ubNV */ + 0, /* glVertexAttrib4ubvNV */ + 0, /* glGenFragmentShadersATI */ + 0, /* glBindFragmentShaderATI */ + 0, /* glDeleteFragmentShaderATI */ + 0, /* glBeginFragmentShaderATI */ + 0, /* glEndFragmentShaderATI */ + 0, /* glPassTexCoordATI */ + 0, /* glSampleMapATI */ + 0, /* glColorFragmentOp1ATI */ + 0, /* glColorFragmentOp2ATI */ + 0, /* glColorFragmentOp3ATI */ + 0, /* glAlphaFragmentOp1ATI */ + 0, /* glAlphaFragmentOp2ATI */ + 0, /* glAlphaFragmentOp3ATI */ + 0, /* glSetFragmentShaderConstantATI */ + xglNoOpIsRenderbufferEXT, + xglNoOpBindRenderbufferEXT, + xglNoOpDeleteRenderbuffersEXT, + xglNoOpGenRenderbuffersEXT, + xglNoOpRenderbufferStorageEXT, + xglNoOpGetRenderbufferParameterivEXT, + xglNoOpIsFramebufferEXT, + xglNoOpBindFramebufferEXT, + xglNoOpDeleteFramebuffersEXT, + xglNoOpGenFramebuffersEXT, + xglNoOpCheckFramebufferStatusEXT, + xglNoOpFramebufferTexture1DEXT, + xglNoOpFramebufferTexture2DEXT, + xglNoOpFramebufferTexture3DEXT, + xglNoOpFramebufferRenderbufferEXT, + xglNoOpGetFramebufferAttachmentParameterivEXT, + xglNoOpGenerateMipmapEXT, + 0, /* glStencilFuncSeparate */ + 0, /* glStencilOpSeparate */ + 0, /* glStencilMaskSeparate */ + 0, /* glGetQueryObjecti64vEXT */ + 0 /* glGetQueryObjectui64vEXT */ +}; + +static void +xglInitExtensions (xglGLContextPtr pContext) +{ + const char *extensions; + + extensions = (const char *) glGetString (GL_EXTENSIONS); + + if (strstr (extensions, "GL_ARB_multitexture")) + { + pContext->ActiveTextureARB = + (PFNGLACTIVETEXTUREARBPROC) + glitz_context_get_proc_address (pContext->context, + "glActiveTextureARB"); + pContext->glRenderTable.ClientActiveTextureARB = + (PFNGLCLIENTACTIVETEXTUREARBPROC) + glitz_context_get_proc_address (pContext->context, + "glClientActiveTextureARB"); + pContext->glRenderTable.MultiTexCoord1dvARB = + (PFNGLMULTITEXCOORD1DVARBPROC) + glitz_context_get_proc_address (pContext->context, + "glMultiTexCoord1dvARB"); + pContext->glRenderTable.MultiTexCoord1fvARB = + (PFNGLMULTITEXCOORD1FVARBPROC) + glitz_context_get_proc_address (pContext->context, + "glMultiTexCoord1fvARB"); + pContext->glRenderTable.MultiTexCoord1ivARB = + (PFNGLMULTITEXCOORD1IVARBPROC) + glitz_context_get_proc_address (pContext->context, + "glMultiTexCoord1ivARB"); + pContext->glRenderTable.MultiTexCoord1svARB = + (PFNGLMULTITEXCOORD1SVARBPROC) + glitz_context_get_proc_address (pContext->context, + "glMultiTexCoord1svARB"); + pContext->glRenderTable.MultiTexCoord2dvARB = + (PFNGLMULTITEXCOORD2DVARBPROC) + glitz_context_get_proc_address (pContext->context, + "glMultiTexCoord2dvARB"); + pContext->glRenderTable.MultiTexCoord2fvARB = + (PFNGLMULTITEXCOORD2FVARBPROC) + glitz_context_get_proc_address (pContext->context, + "glMultiTexCoord2fvARB"); + pContext->glRenderTable.MultiTexCoord2ivARB = + (PFNGLMULTITEXCOORD2IVARBPROC) + glitz_context_get_proc_address (pContext->context, + "glMultiTexCoord2ivARB"); + pContext->glRenderTable.MultiTexCoord2svARB = + (PFNGLMULTITEXCOORD2SVARBPROC) + glitz_context_get_proc_address (pContext->context, + "glMultiTexCoord2svARB"); + pContext->glRenderTable.MultiTexCoord3dvARB = + (PFNGLMULTITEXCOORD3DVARBPROC) + glitz_context_get_proc_address (pContext->context, + "glMultiTexCoord3dvARB"); + pContext->glRenderTable.MultiTexCoord3fvARB = + (PFNGLMULTITEXCOORD3FVARBPROC) + glitz_context_get_proc_address (pContext->context, + "glMultiTexCoord3fvARB"); + pContext->glRenderTable.MultiTexCoord3ivARB = + (PFNGLMULTITEXCOORD3IVARBPROC) + glitz_context_get_proc_address (pContext->context, + "glMultiTexCoord3ivARB"); + pContext->glRenderTable.MultiTexCoord3svARB = + (PFNGLMULTITEXCOORD3SVARBPROC) + glitz_context_get_proc_address (pContext->context, + "glMultiTexCoord3svARB"); + pContext->glRenderTable.MultiTexCoord4dvARB = + (PFNGLMULTITEXCOORD4DVARBPROC) + glitz_context_get_proc_address (pContext->context, + "glMultiTexCoord4dvARB"); + pContext->glRenderTable.MultiTexCoord4fvARB = + (PFNGLMULTITEXCOORD4FVARBPROC) + glitz_context_get_proc_address (pContext->context, + "glMultiTexCoord4fvARB"); + pContext->glRenderTable.MultiTexCoord4ivARB = + (PFNGLMULTITEXCOORD4IVARBPROC) + glitz_context_get_proc_address (pContext->context, + "glMultiTexCoord4ivARB"); + pContext->glRenderTable.MultiTexCoord4svARB = + (PFNGLMULTITEXCOORD4SVARBPROC) + glitz_context_get_proc_address (pContext->context, + "glMultiTexCoord4svARB"); + + glGetIntegerv (GL_MAX_TEXTURE_UNITS_ARB, &pContext->maxTexUnits); + if (pContext->maxTexUnits > XGL_MAX_TEXTURE_UNITS) + pContext->maxTexUnits = XGL_MAX_TEXTURE_UNITS; + + pContext->glRenderTable.ActiveTextureARB = xglActiveTextureARB; + } + else + pContext->maxTexUnits = 1; + + if (strstr (extensions, "GL_ARB_multisample")) + { + pContext->glRenderTable.SampleCoverageARB = + (PFNGLSAMPLECOVERAGEARBPROC) + glitz_context_get_proc_address (pContext->context, + "glSampleCoverageARB"); + } + + if (strstr (extensions, "GL_EXT_texture_object")) + { + pContext->glRenderTable.AreTexturesResidentEXT = + xglAreTexturesResident; + pContext->glRenderTable.GenTexturesEXT = xglGenTextures; + pContext->glRenderTable.IsTextureEXT = xglIsTexture; + } + + if (strstr (extensions, "GL_SGIS_multisample")) + { + pContext->glRenderTable.SampleMaskSGIS = + (PFNGLSAMPLEMASKSGISPROC) + glitz_context_get_proc_address (pContext->context, + "glSampleMaskSGIS"); + pContext->glRenderTable.SamplePatternSGIS = + (PFNGLSAMPLEPATTERNSGISPROC) + glitz_context_get_proc_address (pContext->context, + "glSamplePatternSGIS"); + } + + if (strstr (extensions, "GL_EXT_point_parameters")) + { + pContext->glRenderTable.PointParameterfEXT = + (PFNGLPOINTPARAMETERFEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glPointParameterfEXT"); + pContext->glRenderTable.PointParameterfvEXT = + (PFNGLPOINTPARAMETERFVEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glPointParameterfvEXT"); + } + + if (strstr (extensions, "GL_MESA_window_pos")) + { + pContext->WindowPos3fMESA = + (PFNGLWINDOWPOS3FMESAPROC) + glitz_context_get_proc_address (pContext->context, + "glWindowPos3fMESA"); + + pContext->glRenderTable.WindowPos3fMESA = xglWindowPos3fMESA; + } + + if (strstr (extensions, "GL_EXT_blend_func_separate")) + { + pContext->glRenderTable.BlendFuncSeparateEXT = + (PFNGLBLENDFUNCSEPARATEEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glBlendFuncSeparateEXT"); + } + + if (strstr (extensions, "GL_EXT_fog_coord")) + { + pContext->glRenderTable.FogCoordfvEXT = + (PFNGLFOGCOORDFVEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glFogCoordfvEXT"); + pContext->glRenderTable.FogCoorddvEXT = + (PFNGLFOGCOORDDVEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glFogCoorddvEXT"); + pContext->glRenderTable.FogCoordPointerEXT = + (PFNGLFOGCOORDPOINTEREXTPROC) + glitz_context_get_proc_address (pContext->context, + "glFogCoordPointerEXT"); + } + + if (strstr (extensions, "GL_EXT_secondary_color")) + { + pContext->glRenderTable.SecondaryColor3bvEXT = + (PFNGLSECONDARYCOLOR3BVEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glSecondaryColor3bvEXT"); + pContext->glRenderTable.SecondaryColor3dvEXT = + (PFNGLSECONDARYCOLOR3DVEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glSecondaryColor3dvEXT"); + pContext->glRenderTable.SecondaryColor3fvEXT = + (PFNGLSECONDARYCOLOR3FVEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glSecondaryColor3fvEXT"); + pContext->glRenderTable.SecondaryColor3ivEXT = + (PFNGLSECONDARYCOLOR3IVEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glSecondaryColor3ivEXT"); + pContext->glRenderTable.SecondaryColor3svEXT = + (PFNGLSECONDARYCOLOR3SVEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glSecondaryColor3svEXT"); + pContext->glRenderTable.SecondaryColor3ubvEXT = + (PFNGLSECONDARYCOLOR3UBVEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glSecondaryColor3ubvEXT"); + pContext->glRenderTable.SecondaryColor3uivEXT = + (PFNGLSECONDARYCOLOR3UIVEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glSecondaryColor3uivEXT"); + pContext->glRenderTable.SecondaryColor3usvEXT = + (PFNGLSECONDARYCOLOR3USVEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glSecondaryColor3usvEXT"); + pContext->glRenderTable.SecondaryColorPointerEXT = + (PFNGLSECONDARYCOLORPOINTEREXTPROC) + glitz_context_get_proc_address (pContext->context, + "glSecondaryColorPointerEXT"); + } + + if (strstr (extensions, "GL_NV_point_sprite")) + { + pContext->glRenderTable.PointParameteriNV = + (PFNGLPOINTPARAMETERINVPROC) + glitz_context_get_proc_address (pContext->context, + "glPointParameteriNV"); + pContext->glRenderTable.PointParameterivNV = + (PFNGLPOINTPARAMETERIVNVPROC) + glitz_context_get_proc_address (pContext->context, + "glPointParameterivNV"); + } + + if (strstr (extensions, "GL_EXT_stencil_two_side")) + { + pContext->glRenderTable.ActiveStencilFaceEXT = + (PFNGLACTIVESTENCILFACEEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glActiveStencilFaceEXT"); + } + + if (strstr (extensions, "GL_EXT_framebuffer_object")) + { + pContext->glRenderTable.IsRenderbufferEXT = + (PFNGLISRENDERBUFFEREXTPROC) + glitz_context_get_proc_address (pContext->context, + "glIsRenderbufferEXT"); + pContext->glRenderTable.BindRenderbufferEXT = + (PFNGLBINDRENDERBUFFEREXTPROC) + glitz_context_get_proc_address (pContext->context, + "glBindRenderbufferEXT"); + pContext->glRenderTable.DeleteRenderbuffersEXT = + (PFNGLDELETERENDERBUFFERSEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glDeleteRenderbuffersEXT"); + pContext->glRenderTable.GenRenderbuffersEXT = + (PFNGLGENRENDERBUFFERSEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glGenRenderbuffersEXT"); + pContext->glRenderTable.RenderbufferStorageEXT = + (PFNGLRENDERBUFFERSTORAGEEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glRenderbufferStorageEXT"); + pContext->glRenderTable.GetRenderbufferParameterivEXT = + (PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glGetRenderbufferParameterivEXT"); + pContext->glRenderTable.IsFramebufferEXT = + (PFNGLISFRAMEBUFFEREXTPROC) + glitz_context_get_proc_address (pContext->context, + "glIsFramebufferEXT"); + pContext->glRenderTable.BindFramebufferEXT = + (PFNGLBINDFRAMEBUFFEREXTPROC) + glitz_context_get_proc_address (pContext->context, + "glBindFramebufferEXT"); + pContext->glRenderTable.DeleteFramebuffersEXT = + (PFNGLDELETEFRAMEBUFFERSEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glDeleteFramebuffersEXT"); + pContext->glRenderTable.GenFramebuffersEXT = + (PFNGLGENFRAMEBUFFERSEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glGenFramebuffersEXT"); + pContext->glRenderTable.CheckFramebufferStatusEXT = + (PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glCheckFramebufferStatusEXT"); + pContext->glRenderTable.FramebufferTexture1DEXT = + (PFNGLFRAMEBUFFERTEXTURE1DEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glFramebufferTexture1DEXT"); + pContext->glRenderTable.FramebufferTexture2DEXT = + (PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glFramebufferTexture2DEXT"); + pContext->glRenderTable.FramebufferTexture3DEXT = + (PFNGLFRAMEBUFFERTEXTURE3DEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glFramebufferTexture3DEXT"); + pContext->glRenderTable.FramebufferRenderbufferEXT = + (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) + glitz_context_get_proc_address (pContext->context, + "glFramebufferRenderbufferEXT"); + pContext->glRenderTable.GetFramebufferAttachmentParameterivEXT = + (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glGetFramebufferAttachment" + "ParameterivEXT"); + pContext->glRenderTable.GenerateMipmapEXT = + (PFNGLGENERATEMIPMAPEXTPROC) + glitz_context_get_proc_address (pContext->context, + "glGenerateMipmapEXT"); + } +} + +static void +xglSetCurrentContext (xglGLContextPtr pContext) +{ + cctx = pContext; + + glitz_context_make_current (cctx->context, cctx->pDrawBuffer->drawable); + + GlxSetRenderTables (&cctx->glRenderTable); +} + +static void +xglFreeContext (xglGLContextPtr pContext) +{ + int i; + + pContext->refcnt--; + if (pContext->shared == pContext) + pContext->refcnt--; + + if (pContext->refcnt) + return; + + if (pContext->shared != pContext) + xglFreeContext (pContext->shared); + + if (pContext->texObjects) + { + xglTexObjPtr pTexObj; + GLuint key; + + do { + key = xglHashFirstEntry (pContext->texObjects); + if (key) + { + pTexObj = (xglTexObjPtr) xglHashLookup (pContext->texObjects, + key); + if (pTexObj) + xglUnrefTexObj (pTexObj); + + xglHashRemove (pContext->texObjects, key); + } + } while (key); + + xglDeleteHashTable (pContext->texObjects); + } + + if (pContext->displayLists) + { + xglDisplayListPtr pDisplayList; + GLuint key; + + do { + key = xglHashFirstEntry (pContext->displayLists); + if (key) + { + pDisplayList = (xglDisplayListPtr) + xglHashLookup (pContext->displayLists, key); + if (pDisplayList) + xglDestroyList (pDisplayList); + + xglHashRemove (pContext->displayLists, key); + } + } while (key); + + xglDeleteHashTable (pContext->displayLists); + } + + for (i = 0; i < pContext->maxTexUnits; i++) + { + xglUnrefTexObj (pContext->attrib.texUnits[i].p1D); + xglUnrefTexObj (pContext->attrib.texUnits[i].p2D); + xglUnrefTexObj (pContext->attrib.texUnits[i].p3D); + xglUnrefTexObj (pContext->attrib.texUnits[i].pRect); + xglUnrefTexObj (pContext->attrib.texUnits[i].pCubeMap); + } + + if (pContext->groupList) + glDeleteLists (pContext->groupList, 1); + + if (pContext->context) + glitz_context_destroy (pContext->context); + + if (pContext->versionString) + xfree (pContext->versionString); + + xfree (pContext); +} + +static GLboolean +xglDestroyContext (__GLcontext *gc) +{ + xglGLContextPtr pContext = (xglGLContextPtr) gc; + __GLinterface *iface = pContext->mIface; + + xglFreeContext (pContext); + + if (!iface) + return GL_TRUE; + + return (*iface->exports.destroyContext) ((__GLcontext *) iface); +} + +static GLboolean +xglLoseCurrent (__GLcontext *gc) +{ + xglGLContextPtr pContext = (xglGLContextPtr) gc; + __GLinterface *iface = pContext->mIface; + + GlxFlushContextCache (); + GlxSetRenderTables (0); + + if (!iface) + return GL_TRUE; + + return (*iface->exports.loseCurrent) ((__GLcontext *) iface); +} + +static GLboolean +xglMakeCurrent (__GLcontext *gc) +{ + xglGLContextPtr pContext = (xglGLContextPtr) gc; + __GLinterface *iface = &pContext->iface; + __GLinterface *mIface = pContext->mIface; + __GLdrawablePrivate *drawPriv = iface->imports.getDrawablePrivate (gc); + __GLdrawablePrivate *readPriv = iface->imports.getReadablePrivate (gc); + xglGLBufferPtr pDrawBufferPriv = drawPriv->private; + xglGLBufferPtr pReadBufferPriv = readPriv->private; + GLboolean status = GL_TRUE; + + if (pReadBufferPriv->pDrawable && pDrawBufferPriv->pDrawable) + { + XID values[2] = { ClipByChildren, 0 }; + int status; + +#ifdef COMPOSITE + /* XXX: temporary hack for root window drawing using + IncludeInferiors */ + if (pDrawBufferPriv->pDrawable->type == DRAWABLE_WINDOW && + (!((WindowPtr) (pDrawBufferPriv->pDrawable))->parent)) + values[0] = IncludeInferiors; +#endif + + /* this happens if client previously used this context with a buffer + not supported by the native GL stack */ + if (!pContext->context) + return GL_FALSE; + + /* XXX: GLX_SGI_make_current_read disabled for now */ + if (pDrawBufferPriv != pReadBufferPriv) + return GL_FALSE; + + if (!pReadBufferPriv->pGC) + pReadBufferPriv->pGC = + CreateGC (pReadBufferPriv->pDrawable, + GCSubwindowMode | GCGraphicsExposures, values, + &status); + + ValidateGC (pReadBufferPriv->pDrawable, pReadBufferPriv->pGC); + + if (!pDrawBufferPriv->pGC) + pDrawBufferPriv->pGC = + CreateGC (pDrawBufferPriv->pDrawable, + GCSubwindowMode | GCGraphicsExposures, values, + &status); + + ValidateGC (pDrawBufferPriv->pDrawable, pDrawBufferPriv->pGC); + + pReadBufferPriv->pPixmap = (PixmapPtr) 0; + pDrawBufferPriv->pPixmap = (PixmapPtr) 0; + + pContext->pReadBuffer = pReadBufferPriv; + pContext->pDrawBuffer = pDrawBufferPriv; + + pContext->readPriv = readPriv; + pContext->drawPriv = drawPriv; + + /* from now on this context can only be used with native GL stack */ + if (mIface) + { + (*mIface->exports.destroyContext) ((__GLcontext *) mIface); + pContext->mIface = NULL; + } + } + else + { + /* this happens if client previously used this context with a buffer + supported by the native GL stack */ + if (!mIface) + return GL_FALSE; + + drawPriv->private = pDrawBufferPriv->private; + readPriv->private = pReadBufferPriv->private; + + status = (*mIface->exports.makeCurrent) ((__GLcontext *) mIface); + + drawPriv->private = pDrawBufferPriv; + readPriv->private = pReadBufferPriv; + + /* from now on this context can not be used with native GL stack */ + if (status == GL_TRUE && pContext->context) + { + glitz_context_destroy (pContext->context); + pContext->context = NULL; + } + } + + return status; +} + +static GLboolean +xglShareContext (__GLcontext *gc, + __GLcontext *gcShare) +{ + xglGLContextPtr pContext = (xglGLContextPtr) gc; + xglGLContextPtr pContextShare = (xglGLContextPtr) gcShare; + __GLinterface *iface = pContext->mIface; + __GLinterface *ifaceShare = pContextShare->mIface; + + if (!iface || !ifaceShare) + return GL_TRUE; + + return (*iface->exports.shareContext) ((__GLcontext *) iface, + (__GLcontext *) ifaceShare); +} + +static GLboolean +xglCopyContext (__GLcontext *dst, + const __GLcontext *src, + GLuint mask) +{ + xglGLContextPtr pDst = (xglGLContextPtr) dst; + xglGLContextPtr pSrc = (xglGLContextPtr) src; + const __GLcontext *srcCtx = (const __GLcontext *) pSrc->mIface; + __GLinterface *dstIface = (__GLinterface *) pDst->mIface; + GLboolean status = GL_TRUE; + + if (pSrc->context && pDst->context) + glitz_context_copy (pSrc->context, pDst->context, mask); + else + status = GL_FALSE; + + if (dstIface && srcCtx) + status = (*dstIface->exports.copyContext) ((__GLcontext *) dstIface, + srcCtx, + mask); + + return status; +} + +static Bool +xglResizeBuffer (__GLdrawablePrivate *glPriv, + int x, + int y, + unsigned int width, + unsigned int height) +{ + xglGLBufferPtr pBufferPriv = glPriv->private; + DrawablePtr pDrawable = pBufferPriv->pDrawable; + + XGL_SCREEN_PRIV (pDrawable->pScreen); + XGL_DRAWABLE_PIXMAP (pBufferPriv->pDrawable); + + if (pPixmap != pScreenPriv->pScreenPixmap) + { + if (!xglCreatePixmapSurface (pPixmap)) + return FALSE; + + if (pBufferPriv->drawable == pScreenPriv->drawable) + { + if (pBufferPriv->backSurface) + glitz_surface_destroy (pBufferPriv->backSurface); + + glitz_drawable_destroy (pBufferPriv->drawable); + + pBufferPriv->drawable = NULL; + pBufferPriv->backSurface = NULL; + } + + if (pBufferPriv->drawable) + { + glitz_drawable_update_size (pBufferPriv->drawable, + pPixmap->drawable.width, + pPixmap->drawable.height); + } + else + { + glitz_drawable_format_t *format; + + format = pBufferPriv->pVisual->format.drawable; + if (pBufferPriv->pVisual->pbuffer) + { + pBufferPriv->drawable = + glitz_create_pbuffer_drawable (pScreenPriv->drawable, + format, + pPixmap->drawable.width, + pPixmap->drawable.height); + } + else + { + pBufferPriv->drawable = + glitz_create_drawable (pScreenPriv->drawable, format, + pPixmap->drawable.width, + pPixmap->drawable.height); + + if (!pBufferPriv->drawable) + return FALSE; + + if (format->doublebuffer) + { + glitz_format_t *backFormat; + + backFormat = pBufferPriv->pVisual->format.surface; + + pBufferPriv->backSurface = + glitz_surface_create (pScreenPriv->drawable, backFormat, + pPixmap->drawable.width, + pPixmap->drawable.height, + 0, NULL); + if (pBufferPriv->backSurface) + glitz_surface_attach (pBufferPriv->backSurface, + pBufferPriv->drawable, + GLITZ_DRAWABLE_BUFFER_BACK_COLOR); + } + } + } + } + else + { + glitz_drawable_reference (pScreenPriv->drawable); + + if (pBufferPriv->backSurface) + glitz_surface_destroy (pBufferPriv->backSurface); + + if (pBufferPriv->drawable) + glitz_drawable_destroy (pBufferPriv->drawable); + + pBufferPriv->drawable = pScreenPriv->drawable; + pBufferPriv->backSurface = NULL; + } + + ValidateGC (pDrawable, pBufferPriv->pGC); + + return TRUE; +} + +static GLboolean +xglForceCurrent (__GLcontext *gc) +{ + xglGLContextPtr pContext = (xglGLContextPtr) gc; + __GLinterface *iface = pContext->mIface; + GLboolean status = GL_TRUE; + + if (pContext && pContext->context) + { + __GLdrawablePrivate *readPriv, *drawPriv; + + readPriv = pContext->readPriv; + drawPriv = pContext->drawPriv; + + drawPriv->lockDP (drawPriv, gc); + if (readPriv != drawPriv) + readPriv->lockDP (readPriv, gc); + + cctx = pContext; + + if (cctx->pReadBuffer->pDrawable && cctx->pDrawBuffer->pDrawable) + { + DrawablePtr pDrawable = cctx->pReadBuffer->pDrawable; + PixmapPtr pReadPixmap, pDrawPixmap; + + XGL_SCREEN_PRIV (pDrawable->pScreen); + + if (pDrawable->type != DRAWABLE_PIXMAP) + { + pReadPixmap = XGL_GET_WINDOW_PIXMAP (pDrawable); + cctx->pReadBuffer->screenX = __XGL_OFF_X_WIN (pReadPixmap); + cctx->pReadBuffer->screenY = __XGL_OFF_Y_WIN (pReadPixmap); + cctx->pReadBuffer->xOff = pDrawable->x + + __XGL_OFF_X_WIN (pReadPixmap); + cctx->pReadBuffer->yOff = pReadPixmap->drawable.height - + ((pDrawable->y + __XGL_OFF_Y_WIN (pReadPixmap)) + + pDrawable->height); + cctx->pReadBuffer->yFlip = pReadPixmap->drawable.height; + } + else + { + pReadPixmap = (PixmapPtr) pDrawable; + cctx->pReadBuffer->screenX = cctx->pReadBuffer->screenY = 0; + cctx->pReadBuffer->xOff = cctx->pReadBuffer->yOff = 0; + cctx->pReadBuffer->yFlip = pDrawable->height; + } + + pDrawable = cctx->pDrawBuffer->pDrawable; + if (pDrawable->type != DRAWABLE_PIXMAP) + { + pDrawPixmap = XGL_GET_WINDOW_PIXMAP (pDrawable); + cctx->pDrawBuffer->screenX = __XGL_OFF_X_WIN (pDrawPixmap); + cctx->pDrawBuffer->screenY = __XGL_OFF_Y_WIN (pDrawPixmap); + cctx->pDrawBuffer->xOff = pDrawable->x + + __XGL_OFF_X_WIN (pDrawPixmap); + cctx->pDrawBuffer->yOff = pDrawPixmap->drawable.height - + ((pDrawable->y + __XGL_OFF_Y_WIN (pDrawPixmap)) + + pDrawable->height); + cctx->pDrawBuffer->yFlip = pDrawPixmap->drawable.height; + } + else + { + pDrawPixmap = (PixmapPtr) pDrawable; + cctx->pDrawBuffer->screenX = cctx->pDrawBuffer->screenY = 0; + cctx->pDrawBuffer->xOff = cctx->pDrawBuffer->yOff = 0; + cctx->pDrawBuffer->yFlip = pDrawable->height; + } + + /* buffer changed */ + if (cctx->pDrawBuffer->pPixmap != pDrawPixmap || + cctx->pReadBuffer->pPixmap != pReadPixmap) + { + if (!xglResizeBuffer (drawPriv, + pDrawable->x, + pDrawable->y, + pDrawable->width, + pDrawable->height)) + { + drawPriv->unlockDP (drawPriv); + if (readPriv != drawPriv) + readPriv->unlockDP (readPriv); + + return FALSE; + } + + if (!xglResizeBuffer (readPriv, + cctx->pReadBuffer->pDrawable->x, + cctx->pReadBuffer->pDrawable->y, + cctx->pReadBuffer->pDrawable->width, + cctx->pReadBuffer->pDrawable->height)) + { + drawPriv->unlockDP (drawPriv); + if (readPriv != drawPriv) + readPriv->unlockDP (readPriv); + + return FALSE; + } + + cctx->pReadBuffer->pPixmap = pReadPixmap; + cctx->pDrawBuffer->pPixmap = pDrawPixmap; + } + + if (!xglSyncSurface (pContext->pDrawBuffer->pDrawable)) + { + drawPriv->unlockDP (drawPriv); + if (readPriv != drawPriv) + readPriv->unlockDP (readPriv); + + return FALSE; + } + + if (pDrawPixmap != pScreenPriv->pScreenPixmap) + { + XGL_PIXMAP_PRIV (pDrawPixmap); + + glitz_surface_attach (pPixmapPriv->surface, + pContext->pDrawBuffer->drawable, + GLITZ_DRAWABLE_BUFFER_FRONT_COLOR); + + if (pPixmapPriv->target) + pPixmapPriv->target = xglPixmapTargetOut; + } + + xglSetCurrentContext (pContext); + + if (cctx->needInit) + { + int i; + + xglInitExtensions (cctx); + + glGetIntegerv (GL_MAX_LIST_NESTING, &cctx->maxListNesting); + glGetIntegerv (GL_MAX_ATTRIB_STACK_DEPTH, + &cctx->maxAttribStackDepth); + if (cctx->maxAttribStackDepth > XGL_MAX_ATTRIB_STACK_DEPTH) + cctx->maxAttribStackDepth = XGL_MAX_ATTRIB_STACK_DEPTH; + + cctx->attrib.scissorTest = GL_FALSE; + cctx->attrib.scissor.x = cctx->attrib.scissor.y = 0; + cctx->attrib.scissor.width = + cctx->pDrawBuffer->pDrawable->width; + cctx->attrib.scissor.height = + cctx->pDrawBuffer->pDrawable->height; + cctx->attrib.viewport = cctx->attrib.scissor; + + cctx->activeTexUnit = 0; + + for (i = 0; i < cctx->maxTexUnits; i++) + { + cctx->attrib.texUnits[i].enabled = 0; + + cctx->attrib.texUnits[i].p1D = NULL; + cctx->attrib.texUnits[i].p2D = NULL; + cctx->attrib.texUnits[i].p3D = NULL; + cctx->attrib.texUnits[i].pRect = NULL; + cctx->attrib.texUnits[i].pCubeMap = NULL; + } + + glEnable (GL_SCISSOR_TEST); + + cctx->needInit = FALSE; + } + + /* update viewport and raster position */ + if (cctx->pDrawBuffer->xOff != cctx->drawXoff || + cctx->pDrawBuffer->yOff != cctx->drawYoff) + { + glViewport (cctx->attrib.viewport.x + cctx->pDrawBuffer->xOff, + cctx->attrib.viewport.y + cctx->pDrawBuffer->yOff, + cctx->attrib.viewport.width, + cctx->attrib.viewport.height); + + glBitmap (0, 0, 0, 0, + cctx->pDrawBuffer->xOff - cctx->drawXoff, + cctx->pDrawBuffer->yOff - cctx->drawYoff, + NULL); + + cctx->drawXoff = cctx->pDrawBuffer->xOff; + cctx->drawYoff = cctx->pDrawBuffer->yOff; + } + + xglDrawBuffer (cctx->attrib.drawBuffer); + xglReadBuffer (cctx->attrib.readBuffer); + } + else + { + xglSetCurrentContext (pContext); + } + + drawPriv->unlockDP (drawPriv); + if (readPriv != drawPriv) + readPriv->unlockDP (readPriv); + } + else + { + cctx = NULL; + status = (*iface->exports.forceCurrent) ((__GLcontext *) iface); + } + + return status; +} + +static GLboolean +xglNotifyResize (__GLcontext *gc) +{ + xglGLContextPtr pContext = (xglGLContextPtr) gc; + __GLinterface *iface = pContext->mIface; + + if (!iface) + return GL_TRUE; + + return (*iface->exports.notifyResize) ((__GLcontext *) iface); +} + +static void +xglNotifyDestroy (__GLcontext *gc) +{ + xglGLContextPtr pContext = (xglGLContextPtr) gc; + __GLinterface *iface = pContext->mIface; + + pContext->pReadBuffer->pDrawable = 0; + pContext->pDrawBuffer->pDrawable = 0; + + if (iface) + (*iface->exports.notifyDestroy) ((__GLcontext *) iface); +} + +static void +xglNotifySwapBuffers (__GLcontext *gc) +{ + xglGLContextPtr pContext = (xglGLContextPtr) gc; + __GLinterface *iface = pContext->mIface; + + if (iface) + (*iface->exports.notifySwapBuffers) ((__GLcontext *) iface); +} + +static struct __GLdispatchStateRec * +xglDispatchExec (__GLcontext *gc) +{ + xglGLContextPtr pContext = (xglGLContextPtr) gc; + __GLinterface *iface = pContext->mIface; + + if (!iface) + return NULL; + + return (*iface->exports.dispatchExec) ((__GLcontext *) iface); +} + +static void +xglBeginDispatchOverride (__GLcontext *gc) +{ + xglGLContextPtr pContext = (xglGLContextPtr) gc; + __GLinterface *iface = pContext->mIface; + + if (iface) + (*iface->exports.beginDispatchOverride) ((__GLcontext *) iface); +} + +static void +xglEndDispatchOverride (__GLcontext *gc) +{ + xglGLContextPtr pContext = (xglGLContextPtr) gc; + __GLinterface *iface = pContext->mIface; + + if (iface) + (*iface->exports.endDispatchOverride) ((__GLcontext *) iface); +} + +static void +xglLoseCurrentContext (void *closure) +{ + if (closure == cctx) + { + cctx = NULL; + + GlxFlushContextCache (); + GlxSetRenderTables (0); + } +} + +static __GLinterface * +xglCreateContext (__GLimports *imports, + __GLcontextModes *modes, + __GLinterface *shareGC) +{ + glitz_drawable_format_t *format; + xglGLContextPtr pShareContext = (xglGLContextPtr) shareGC; + xglGLContextPtr pContext; + __GLinterface *shareIface = NULL; + __GLinterface *iface; + __GLXcontext *glxCtx = (__GLXcontext *) imports->other; + + XGL_SCREEN_PRIV (glxCtx->pScreen); + + pContext = xalloc (sizeof (xglGLContextRec)); + if (!pContext) + return NULL; + + format = glitz_drawable_get_format (pScreenPriv->drawable); + pContext->context = glitz_context_create (pScreenPriv->drawable, format); + glitz_context_set_user_data (pContext->context, pContext, + xglLoseCurrentContext); + + pContext->glRenderTable = __glNativeRenderTable; + pContext->needInit = TRUE; + pContext->versionString = NULL; + pContext->errorValue = GL_NO_ERROR; + pContext->shared = NULL; + pContext->list = 0; + pContext->groupList = 0; + pContext->beginCnt = 0; + pContext->nAttribStack = 0; + pContext->refcnt = 1; + pContext->doubleBuffer = glxCtx->modes->doubleBufferMode; + pContext->depthBits = glxCtx->modes->depthBits; + pContext->stencilBits = glxCtx->modes->stencilBits; + pContext->drawXoff = 0; + pContext->drawYoff = 0; + pContext->maxTexUnits = 0; + + if (pContext->doubleBuffer) + { + pContext->attrib.drawBuffer = GL_BACK; + pContext->attrib.readBuffer = GL_BACK; + } + else + { + pContext->attrib.drawBuffer = GL_FRONT; + pContext->attrib.readBuffer = GL_FRONT; + } + + pContext->attrib.scissorTest = GL_FALSE; + + if (shareGC) + { + pContext->texObjects = NULL; + pContext->displayLists = NULL; + + pContext->shared = pShareContext->shared; + shareIface = pShareContext->mIface; + } + else + { + pContext->texObjects = xglNewHashTable (); + if (!pContext->texObjects) + { + xglFreeContext (pContext); + return NULL; + } + + pContext->displayLists = xglNewHashTable (); + if (!pContext->displayLists) + { + xglFreeContext (pContext); + return NULL; + } + + pContext->shared = pContext; + } + + pContext->shared->refcnt++; + + iface = (*screenInfoPriv.createContext) (imports, modes, shareIface); + if (!iface) + { + xglFreeContext (pContext); + return NULL; + } + + pContext->mIface = iface; + pContext->iface.imports = *imports; + + pContext->iface.exports.destroyContext = xglDestroyContext; + pContext->iface.exports.loseCurrent = xglLoseCurrent; + pContext->iface.exports.makeCurrent = xglMakeCurrent; + pContext->iface.exports.shareContext = xglShareContext; + pContext->iface.exports.copyContext = xglCopyContext; + pContext->iface.exports.forceCurrent = xglForceCurrent; + pContext->iface.exports.notifyResize = xglNotifyResize; + pContext->iface.exports.notifyDestroy = xglNotifyDestroy; + pContext->iface.exports.notifySwapBuffers = xglNotifySwapBuffers; + pContext->iface.exports.dispatchExec = xglDispatchExec; + pContext->iface.exports.beginDispatchOverride = xglBeginDispatchOverride; + pContext->iface.exports.endDispatchOverride = xglEndDispatchOverride; + + return (__GLinterface *) pContext; +} + +static GLboolean +xglSwapBuffers (__GLXdrawablePrivate *glxPriv) +{ + __GLdrawablePrivate *glPriv = &glxPriv->glPriv; + xglGLBufferPtr pBufferPriv = glPriv->private; + DrawablePtr pDrawable = pBufferPriv->pDrawable; + GLboolean status = GL_TRUE; + + if (pDrawable) + { + if (glPriv->modes->doubleBufferMode) + { + glitz_surface_t *surface; + int xOff, yOff; + GCPtr pGC = pBufferPriv->pGC; + BoxPtr pBox = REGION_RECTS (pGC->pCompositeClip); + int nBox = REGION_NUM_RECTS (pGC->pCompositeClip); + + XGL_GET_DRAWABLE (pDrawable, surface, xOff, yOff); + + glitz_drawable_swap_buffer_region (pBufferPriv->drawable, + xOff, yOff, + (glitz_box_t *) pBox, nBox); + + xglAddBitDamage (pDrawable, pGC->pCompositeClip); + DamageDamageRegion (pDrawable, pGC->pCompositeClip); + REGION_EMPTY (pGC->pScreen, &pBufferPriv->damage); + } + } + else if (pBufferPriv->private) + { + glPriv->private = pBufferPriv->private; + status = (*pBufferPriv->swapBuffers) (glxPriv); + glPriv->private = pBufferPriv; + } + + return status; +} + +static GLboolean +xglResizeBuffers (__GLdrawableBuffer *buffer, + GLint x, + GLint y, + GLuint width, + GLuint height, + __GLdrawablePrivate *glPriv, + GLuint bufferMask) +{ + xglGLBufferPtr pBufferPriv = glPriv->private; + DrawablePtr pDrawable = pBufferPriv->pDrawable; + GLboolean status = GL_TRUE; + + if (pDrawable) + { + if (!xglResizeBuffer (glPriv, x, y, width, height)) + return GL_FALSE; + } + else if (pBufferPriv->private) + { + glPriv->private = pBufferPriv->private; + status = (*pBufferPriv->resizeBuffers) (buffer, + x, y, width, height, + glPriv, + bufferMask); + glPriv->private = pBufferPriv; + } + + return status; +} + +static int +xglBindBuffers (__GLXdrawablePrivate *glxPriv, + int buffer) +{ + __GLdrawablePrivate *glPriv = &glxPriv->glPriv; + xglGLBufferPtr pBufferPriv = glPriv->private; + + if (cctx) + { + xglTexUnitPtr pTexUnit = &cctx->attrib.texUnits[cctx->activeTexUnit]; + xglTexObjPtr pTexObj = NULL; + DrawablePtr pDrawable; + + /* XXX: front left buffer is only supported so far */ + if (buffer != GLX_FRONT_LEFT_EXT) + return BadMatch; + + /* Must be a GLXpixmap */ + if (!glxPriv->pGlxPixmap) + return BadDrawable; + + pDrawable = glxPriv->pGlxPixmap->pDraw; + + switch (glxPriv->texTarget) { + case GLX_TEXTURE_RECTANGLE_EXT: + pTexObj = pTexUnit->pRect; + break; + case GLX_TEXTURE_2D_EXT: + pTexObj = pTexUnit->p2D; + break; + default: + break; + } + + if (pTexObj) + { + glitz_texture_object_t *object; + + XGL_SCREEN_PRIV (pDrawable->pScreen); + XGL_DRAWABLE_PIXMAP (pDrawable); + XGL_PIXMAP_PRIV (pPixmap); + + if (pPixmap == pScreenPriv->pScreenPixmap) + return BadDrawable; + + object = glitz_texture_object_create (pPixmapPriv->surface); + if (object) + { + pPixmap->refcnt++; + + if (pTexObj->pPixmap) + (*pDrawable->pScreen->DestroyPixmap) (pTexObj->pPixmap); + + if (pTexObj->object) + glitz_texture_object_destroy (pTexObj->object); + + pTexObj->pPixmap = pPixmap; + pTexObj->object = object; + + return Success; + } + } + } + else if (pBufferPriv->private) + { + int status; + + glPriv->private = pBufferPriv->private; + status = (*pBufferPriv->bindBuffers) (glxPriv, buffer); + glPriv->private = pBufferPriv; + + return status; + } + + return BadDrawable; +} + +static int +xglReleaseBuffers (__GLXdrawablePrivate *glxPriv, + int buffer) +{ + __GLdrawablePrivate *glPriv = &glxPriv->glPriv; + xglGLBufferPtr pBufferPriv = glPriv->private; + + if (cctx) + { + xglTexObjPtr pTexObj; + + /* XXX: front left buffer is only supported so far */ + if (buffer != GLX_FRONT_LEFT_EXT) + return BadMatch; + + /* Must be a GLXpixmap */ + if (glxPriv->pGlxPixmap) + { + DrawablePtr pDrawable = glxPriv->pGlxPixmap->pDraw; + + XGL_DRAWABLE_PIXMAP (pDrawable); + + pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].p2D; + if (pTexObj && pTexObj->pPixmap == pPixmap) + { + (*pDrawable->pScreen->DestroyPixmap) (pTexObj->pPixmap); + pTexObj->pPixmap = NULL; + glitz_texture_object_destroy (pTexObj->object); + pTexObj->object = NULL; + + return Success; + } + else + { + pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].pRect; + if (pTexObj && pTexObj->pPixmap == pPixmap) + { + (*pDrawable->pScreen->DestroyPixmap) (pTexObj->pPixmap); + pTexObj->pPixmap = NULL; + glitz_texture_object_destroy (pTexObj->object); + pTexObj->object = NULL; + + return Success; + } + } + } + } + else if (pBufferPriv->private) + { + int status; + + glPriv->private = pBufferPriv->private; + status = (*pBufferPriv->releaseBuffers) (glxPriv, buffer); + glPriv->private = pBufferPriv; + + return status; + } + + return BadDrawable; +} +static void +xglFreeBuffers (__GLdrawablePrivate *glPriv) +{ + xglGLBufferPtr pBufferPriv = glPriv->private; + + glPriv->private = pBufferPriv->private; + + if (pBufferPriv->freeBuffers) + (*pBufferPriv->freeBuffers) (glPriv); + + if (pBufferPriv->pGC) + FreeGC (pBufferPriv->pGC, (GContext) 0); + + if (pBufferPriv->backSurface) + glitz_surface_destroy (pBufferPriv->backSurface); + + if (pBufferPriv->drawable) + glitz_drawable_destroy (pBufferPriv->drawable); + + xfree (pBufferPriv); +} + +static void +xglCreateBuffer (__GLXdrawablePrivate *glxPriv) +{ + __GLdrawablePrivate *glPriv = &glxPriv->glPriv; + DrawablePtr pDrawable = glxPriv->pDraw; + ScreenPtr pScreen = pDrawable->pScreen; + xglGLBufferPtr pBufferPriv; + xglVisualPtr v; + + XGL_SCREEN_PRIV (pScreen); + XGL_DRAWABLE_PIXMAP (pDrawable); + + pBufferPriv = xalloc (sizeof (xglGLBufferRec)); + if (!pBufferPriv) + FatalError ("xglCreateBuffer: No memory\n"); + + pBufferPriv->pScreen = pScreen; + pBufferPriv->pDrawable = NULL; + pBufferPriv->pPixmap = NULL; + pBufferPriv->pGC = NULL; + + pBufferPriv->swapBuffers = NULL; + + pBufferPriv->bindBuffers = NULL; + pBufferPriv->releaseBuffers = NULL; + + pBufferPriv->resizeBuffers = NULL; + pBufferPriv->private = NULL; + pBufferPriv->freeBuffers = NULL; + + pBufferPriv->drawable = NULL; + pBufferPriv->backSurface = NULL; + + REGION_INIT (pScreen, &pBufferPriv->damage, NullBox, 0); + + pBufferPriv->pVisual = 0; + + /* glx acceleration */ + if (pScreenPriv->accel.glx.enabled && + xglCheckPixmapSize (pPixmap, &pScreenPriv->accel.glx.size)) + { + for (v = pScreenPriv->pGlxVisual; v; v = v->next) + { + glitz_drawable_format_t *format; + + if (pScreenPriv->accel.glx.pbuffer != v->pbuffer) + continue; + + format = v->format.drawable; + if (!format) + continue; + + if (format->color.red_size != glxPriv->modes->redBits || + format->color.green_size != glxPriv->modes->greenBits || + format->color.blue_size != glxPriv->modes->blueBits) + continue; + + if (format->color.alpha_size < glxPriv->modes->alphaBits || + format->depth_size < glxPriv->modes->depthBits || + format->stencil_size < glxPriv->modes->stencilBits || + format->doublebuffer < glxPriv->modes->doubleBufferMode) + continue; + + /* this is good enought for pbuffers */ + if (v->pbuffer) + break; + + /* we want an exact match for non-pbuffer formats */ + if (format->color.alpha_size == glxPriv->modes->alphaBits && + format->depth_size == glxPriv->modes->depthBits && + format->stencil_size == glxPriv->modes->stencilBits && + format->doublebuffer == glxPriv->modes->doubleBufferMode) + break; + } + + pBufferPriv->pVisual = v; + } + + if ((pDrawable->type == DRAWABLE_WINDOW) + +#ifdef COMPOSITE + && (pBufferPriv->pVisual + + /* this is a root window, can't be redirected */ + || (!((WindowPtr) pDrawable)->parent)) +#endif + + ) + { + pBufferPriv->pDrawable = pDrawable; + } + else + { + (*screenInfoPriv.createBuffer) (glxPriv); + + /* Wrap the swap buffers routine */ + pBufferPriv->swapBuffers = glxPriv->swapBuffers; + + /* Wrap the render texture routines */ + pBufferPriv->bindBuffers = glxPriv->bindBuffers; + pBufferPriv->releaseBuffers = glxPriv->releaseBuffers; + + /* Wrap the front buffer's resize routine */ + pBufferPriv->resizeBuffers = glPriv->frontBuffer.resize; + + /* Save Xgl's private buffer structure */ + pBufferPriv->freeBuffers = glPriv->freePrivate; + pBufferPriv->private = glPriv->private; + } + + glxPriv->texTarget = GLX_NO_TEXTURE_EXT; + + /* We enable render texture for all GLXPixmaps right now. Eventually, this + should only be enabled when fbconfig attribute GLX_RENDER_TEXTURE_RGB or + GLX_RENDER_TEXTURE_RGBA is set to TRUE. */ + if (pDrawable->type != DRAWABLE_WINDOW) + { + XGL_DRAWABLE_PIXMAP (pDrawable); + + if (xglCreatePixmapSurface (pPixmap)) + { + glitz_texture_object_t *texture; + + XGL_PIXMAP_PRIV (pPixmap); + + texture = glitz_texture_object_create (pPixmapPriv->surface); + if (texture) + { + switch (glitz_texture_object_get_target (texture)) { + case GLITZ_TEXTURE_TARGET_2D: + glxPriv->texTarget = GLX_TEXTURE_2D_EXT; + break; + case GLITZ_TEXTURE_TARGET_RECT: + glxPriv->texTarget = GLX_TEXTURE_RECTANGLE_EXT; + break; + } + + glitz_texture_object_destroy (texture); + } + } + } + + glxPriv->swapBuffers = xglSwapBuffers; + + glxPriv->bindBuffers = xglBindBuffers; + glxPriv->releaseBuffers = xglReleaseBuffers; + glPriv->frontBuffer.resize = xglResizeBuffers; + + glPriv->private = (void *) pBufferPriv; + glPriv->freePrivate = xglFreeBuffers; +} + +static Bool +xglScreenProbe (int screen) +{ + ScreenPtr pScreen = screenInfo.screens[screen]; + xglVisualPtr pVisual; + Bool status; + int i; + + XGL_SCREEN_PRIV (pScreen); + + status = (*screenInfoPriv.screenProbe) (screen); + + /* Create Xgl GLX visuals */ + for (i = 0; i < __xglScreenInfoPtr->numVisuals; i++) + { + pVisual = xglFindVisualWithId (pScreen, pScreen->visuals[i].vid); + if (pVisual) + { + glitz_drawable_format_t templ, *format, *screenFormat; + unsigned long mask; + + templ.color = pVisual->format.surface->color; + templ.depth_size = __xglScreenInfoPtr->modes[i].depthBits; + templ.stencil_size = __xglScreenInfoPtr->modes[i].stencilBits; + templ.doublebuffer = __xglScreenInfoPtr->modes[i].doubleBufferMode; + templ.samples = 1; + + mask = + GLITZ_FORMAT_FOURCC_MASK | + GLITZ_FORMAT_RED_SIZE_MASK | + GLITZ_FORMAT_GREEN_SIZE_MASK | + GLITZ_FORMAT_BLUE_SIZE_MASK | + GLITZ_FORMAT_ALPHA_SIZE_MASK | + GLITZ_FORMAT_DEPTH_SIZE_MASK | + GLITZ_FORMAT_STENCIL_SIZE_MASK | + GLITZ_FORMAT_DOUBLEBUFFER_MASK | + GLITZ_FORMAT_SAMPLES_MASK; + + format = glitz_find_drawable_format (pScreenPriv->drawable, + mask, &templ, 0); + if (format) + { + xglVisualPtr v, new, *prev; + + new = xalloc (sizeof (xglVisualRec)); + if (new) + { + new->next = 0; + new->vid = pVisual->vid; + new->pPixel = pVisual->pPixel; + new->pbuffer = FALSE; + + new->format.surface = pVisual->format.surface; + new->format.drawable = format; + + prev = &pScreenPriv->pGlxVisual; + while ((v = *prev)) + prev = &v->next; + + *prev = new; + } + } + + /* use same drawable format as screen for pbuffers */ + screenFormat = glitz_drawable_get_format (pScreenPriv->drawable); + templ.id = screenFormat->id; + + mask = + GLITZ_FORMAT_ID_MASK | + GLITZ_FORMAT_FOURCC_MASK | + GLITZ_FORMAT_RED_SIZE_MASK | + GLITZ_FORMAT_GREEN_SIZE_MASK | + GLITZ_FORMAT_BLUE_SIZE_MASK | + GLITZ_FORMAT_SAMPLES_MASK; + + format = glitz_find_pbuffer_format (pScreenPriv->drawable, + mask, &templ, 0); + if (format) + { + xglVisualPtr v, new, *prev; + + new = xalloc (sizeof (xglVisualRec)); + if (new) + { + new->next = 0; + new->vid = pVisual->vid; + new->pPixel = pVisual->pPixel; + new->pbuffer = TRUE; + + new->format.surface = pVisual->format.surface; + new->format.drawable = format; + + prev = &pScreenPriv->pGlxVisual; + while ((v = *prev)) + prev = &v->next; + + *prev = new; + } + } + } + } + + /* Wrap createBuffer */ + if (__xglScreenInfoPtr->createBuffer != xglCreateBuffer) + { + screenInfoPriv.createBuffer = __xglScreenInfoPtr->createBuffer; + __xglScreenInfoPtr->createBuffer = xglCreateBuffer; + } + + /* Wrap createContext */ + if (__xglScreenInfoPtr->createContext != xglCreateContext) + { + screenInfoPriv.createContext = __xglScreenInfoPtr->createContext; + __xglScreenInfoPtr->createContext = xglCreateContext; + } + + return status; +} + +Bool +xglInitVisualConfigs (ScreenPtr pScreen) +{ + miInitVisualsProcPtr initVisualsProc = NULL; + VisualPtr visuals; + int nvisuals; + DepthPtr depths; + int ndepths; + int rootDepth; + VisualID defaultVis; + glitz_drawable_format_t *format; + xglVisualPtr pVisual; + __GLXvisualConfig *pConfig; + xglGLXVisualConfigPtr pConfigPriv, *ppConfigPriv; + XID *installedCmaps; + ColormapPtr installedCmap; + int numInstalledCmaps; + int numConfig = 1; + int bpp, i; + + XGL_SCREEN_PRIV (pScreen); + + if (xglScreenInfo.depth != 16 && xglScreenInfo.depth != 24) + return FALSE; + + for (pVisual = xglVisuals; pVisual; pVisual = pVisual->next) + { + if (pVisual->pPixel->depth == xglScreenInfo.depth) + break; + } + + if (!pVisual) + return FALSE; + + bpp = pVisual->pPixel->masks.bpp; + + format = glitz_drawable_get_format (pScreenPriv->drawable); + if (format->doublebuffer) + numConfig *= 2; + + pConfig = xcalloc (sizeof (__GLXvisualConfig), numConfig); + if (!pConfig) + return FALSE; + + pConfigPriv = xcalloc (sizeof (xglGLXVisualConfigRec), numConfig); + if (!pConfigPriv) + { + xfree (pConfig); + return FALSE; + } + + ppConfigPriv = xcalloc (sizeof (xglGLXVisualConfigPtr), numConfig); + if (!ppConfigPriv) + { + xfree (pConfigPriv); + xfree (pConfig); + return FALSE; + } + + installedCmaps = xalloc (pScreen->maxInstalledCmaps * sizeof (XID)); + if (!installedCmaps) + { + xfree (ppConfigPriv); + xfree (pConfigPriv); + xfree (pConfig); + return FALSE; + } + + for (i = 0; i < numConfig; i++) + { + ppConfigPriv[i] = &pConfigPriv[i]; + + pConfig[i].vid = (VisualID) (-1); + pConfig[i].class = -1; + pConfig[i].rgba = TRUE; + + pConfig[i].redSize = format->color.red_size; + pConfig[i].greenSize = format->color.green_size; + pConfig[i].blueSize = format->color.blue_size; + pConfig[i].alphaSize = format->color.alpha_size; + + pConfig[i].redMask = pVisual->pPixel->masks.red_mask; + pConfig[i].greenMask = pVisual->pPixel->masks.green_mask; + pConfig[i].blueMask = pVisual->pPixel->masks.blue_mask; + pConfig[i].alphaMask = pVisual->pPixel->masks.alpha_mask; + + if (i == 1) + { + pConfig[i].doubleBuffer = FALSE; + pConfig[i].depthSize = 0; + pConfig[i].stencilSize = 0; + } + else + { + pConfig[i].doubleBuffer = TRUE; + pConfig[i].depthSize = format->depth_size; + pConfig[i].stencilSize = format->stencil_size; + } + + pConfig[i].stereo = FALSE; + + if (pScreen->rootDepth == 16) + pConfig[i].bufferSize = 16; + else + pConfig[i].bufferSize = 32; + + pConfig[i].auxBuffers = 0; + pConfig[i].level = 0; + + pConfig[i].visualRating = GLX_NONE; + + pConfig[i].transparentPixel = GLX_NONE; + pConfig[i].transparentRed = 0; + pConfig[i].transparentGreen = 0; + pConfig[i].transparentBlue = 0; + pConfig[i].transparentAlpha = 0; + pConfig[i].transparentIndex = 0; + } + + GlxSetVisualConfigs (numConfig, pConfig, (void **) ppConfigPriv); + + /* Wrap screenProbe */ + if (__xglScreenInfoPtr->screenProbe != xglScreenProbe) + { + screenInfoPriv.screenProbe = __xglScreenInfoPtr->screenProbe; + __xglScreenInfoPtr->screenProbe = xglScreenProbe; + } + + visuals = pScreen->visuals; + nvisuals = pScreen->numVisuals; + depths = pScreen->allowedDepths; + ndepths = pScreen->numDepths; + rootDepth = pScreen->rootDepth; + defaultVis = pScreen->rootVisual; + + /* Find installed colormaps */ + numInstalledCmaps = (*pScreen->ListInstalledColormaps) (pScreen, + installedCmaps); + + GlxWrapInitVisuals (&initVisualsProc); + GlxInitVisuals (&visuals, &depths, &nvisuals, &ndepths, &rootDepth, + &defaultVis, ((unsigned long) 1 << (bpp - 1)), 8, -1); + + /* Fix up any existing installed colormaps. */ + for (i = 0; i < numInstalledCmaps; i++) + { + int j; + + installedCmap = LookupIDByType (installedCmaps[i], RT_COLORMAP); + if (!installedCmap) + continue; + + j = installedCmap->pVisual - pScreen->visuals; + installedCmap->pVisual = &visuals[j]; + } + + pScreen->visuals = visuals; + pScreen->numVisuals = nvisuals; + pScreen->allowedDepths = depths; + pScreen->numDepths = ndepths; + pScreen->rootDepth = rootDepth; + pScreen->rootVisual = defaultVis; + +#ifndef NGLXLOG + xglInitGlxLog (); +#endif + + xfree (installedCmaps); + xfree (pConfigPriv); + xfree (pConfig); + + return TRUE; +} diff --git a/xorg-server/hw/xgl/glxext/xglglxext.h b/xorg-server/hw/xgl/glxext/xglglxext.h new file mode 100644 index 000000000..c353783af --- /dev/null +++ b/xorg-server/hw/xgl/glxext/xglglxext.h @@ -0,0 +1,41 @@ +/* + * Copyright © 2005 Novell, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * Novell, Inc. not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * Novell, Inc. makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#ifndef _XGL_GLXEXT_H_ +#define _XGL_GLXEXT_H_ + +#include "scrnintstr.h" + +Bool +xglInitVisualConfigs (ScreenPtr pScreen); + +#ifndef NGLXEXTLOG + +void +xglInitGlxLog (void); + +#endif + +#endif /* _XGL_GLXEXT_H_ */ diff --git a/xorg-server/hw/xgl/glxext/xglglxlog.c b/xorg-server/hw/xgl/glxext/xglglxlog.c new file mode 100644 index 000000000..0f194c9ed --- /dev/null +++ b/xorg-server/hw/xgl/glxext/xglglxlog.c @@ -0,0 +1,4519 @@ +/* + * Copyright © 2005 Novell, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * Novell, Inc. not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * Novell, Inc. makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#include "xglglx.h" +#include "xglglxext.h" +#include "glapitable.h" + +#ifndef NGLXEXTLOG + +static struct _glapi_table *nativeRenderTable = 0; + +static FILE *logFp = 0; + +static Bool logVertexAttribs = FALSE; + +static struct VertexAttribCount { + int n; + char *name; +} vCnt[] = { + { 0, "glArrayElement" }, + { 0, "glCallList" }, + { 0, "glCallLists" }, + { 0, "glColor3bv" }, + { 0, "glColor3dv" }, + { 0, "glColor3fv" }, + { 0, "glColor3iv" }, + { 0, "glColor3sv" }, + { 0, "glColor3ubv" }, + { 0, "glColor3uiv" }, + { 0, "glColor3usv" }, + { 0, "glColor4bv" }, + { 0, "glColor4dv" }, + { 0, "glColor4fv" }, + { 0, "glColor4iv" }, + { 0, "glColor4sv" }, + { 0, "glColor4ubv" }, + { 0, "glColor4uiv" }, + { 0, "glColor4usv" }, + { 0, "glEdgeFlagv" }, + { 0, "glEvalCoord1dv" }, + { 0, "glEvalCoord1fv" }, + { 0, "glEvalCoord2dv" }, + { 0, "glEvalCoord2fv" }, + { 0, "glEvalPoint1" }, + { 0, "glEvalPoint2" }, + { 0, "glIndexdv" }, + { 0, "glIndexfv" }, + { 0, "glIndexiv" }, + { 0, "glIndexsv" }, + { 0, "glIndexubv" }, + { 0, "glMaterialf" }, + { 0, "glMaterialfv" }, + { 0, "glMateriali" }, + { 0, "glMaterialiv" }, + { 0, "glNormal3bv" }, + { 0, "glNormal3dv" }, + { 0, "glNormal3fv" }, + { 0, "glNormal3iv" }, + { 0, "glNormal3sv" }, + { 0, "glTexCoord1dv" }, + { 0, "glTexCoord1fv" }, + { 0, "glTexCoord1iv" }, + { 0, "glTexCoord1sv" }, + { 0, "glTexCoord2dv" }, + { 0, "glTexCoord2fv" }, + { 0, "glTexCoord2iv" }, + { 0, "glTexCoord2sv" }, + { 0, "glTexCoord3dv" }, + { 0, "glTexCoord3fv" }, + { 0, "glTexCoord3iv" }, + { 0, "glTexCoord3sv" }, + { 0, "glTexCoord4dv" }, + { 0, "glTexCoord4fv" }, + { 0, "glTexCoord4iv" }, + { 0, "glTexCoord4sv" }, + { 0, "glVertex2dv" }, + { 0, "glVertex2fv" }, + { 0, "glVertex2iv" }, + { 0, "glVertex2sv" }, + { 0, "glVertex3dv" }, + { 0, "glVertex3fv" }, + { 0, "glVertex3iv" }, + { 0, "glVertex3sv" }, + { 0, "glVertex4dv" }, + { 0, "glVertex4fv" }, + { 0, "glVertex4iv" }, + { 0, "glVertex4sv" }, + { 0, "glMultiTexCoord1dv" }, + { 0, "glMultiTexCoord1fv" }, + { 0, "glMultiTexCoord1iv" }, + { 0, "glMultiTexCoord1sv" }, + { 0, "glMultiTexCoord2dv" }, + { 0, "glMultiTexCoord2fv" }, + { 0, "glMultiTexCoord2iv" }, + { 0, "glMultiTexCoord2sv" }, + { 0, "glMultiTexCoord3dv" }, + { 0, "glMultiTexCoord3fv" }, + { 0, "glMultiTexCoord3iv" }, + { 0, "glMultiTexCoord3sv" }, + { 0, "glMultiTexCoord4dv" }, + { 0, "glMultiTexCoord4fv" }, + { 0, "glMultiTexCoord4iv" }, + { 0, "glMultiTexCoord4sv" }, + { 0, "glFogCoordfv" }, + { 0, "glFogCoorddv" }, + { 0, "glSecondaryColor3bv" }, + { 0, "glSecondaryColor3dv" }, + { 0, "glSecondaryColor3fv" }, + { 0, "glSecondaryColor3iv" }, + { 0, "glSecondaryColor3sv" }, + { 0, "glSecondaryColor3ubv" }, + { 0, "glSecondaryColor3uiv" }, + { 0, "glSecondaryColor3usv" } +}; + +#define arrayElementIndex 0 +#define callListIndex 1 +#define callListsIndex 2 +#define color3bvIndex 3 +#define color3dvIndex 4 +#define color3fvIndex 5 +#define color3ivIndex 6 +#define color3svIndex 7 +#define color3ubvIndex 8 +#define color3uivIndex 9 +#define color3usvIndex 10 +#define color4bvIndex 11 +#define color4dvIndex 12 +#define color4fvIndex 13 +#define color4ivIndex 14 +#define color4svIndex 15 +#define color4ubvIndex 16 +#define color4uivIndex 17 +#define color4usvIndex 18 +#define edgeFlagvIndex 19 +#define evalCoord1dvIndex 20 +#define evalCoord1fvIndex 21 +#define evalCoord2dvIndex 22 +#define evalCoord2fvIndex 23 +#define evalPoint1Index 24 +#define evalPoint2Index 25 +#define indexdvIndex 26 +#define indexfvIndex 27 +#define indexivIndex 28 +#define indexsvIndex 29 +#define indexubvIndex 30 +#define materialfIndex 31 +#define materialfvIndex 32 +#define materialiIndex 33 +#define materialivIndex 34 +#define normal3bvIndex 35 +#define normal3dvIndex 36 +#define normal3fvIndex 37 +#define normal3ivIndex 38 +#define normal3svIndex 39 +#define texCoord1dvIndex 40 +#define texCoord1fvIndex 41 +#define texCoord1ivIndex 42 +#define texCoord1svIndex 43 +#define texCoord2dvIndex 44 +#define texCoord2fvIndex 45 +#define texCoord2ivIndex 46 +#define texCoord2svIndex 47 +#define texCoord3dvIndex 48 +#define texCoord3fvIndex 49 +#define texCoord3ivIndex 50 +#define texCoord3svIndex 51 +#define texCoord4dvIndex 52 +#define texCoord4fvIndex 53 +#define texCoord4ivIndex 54 +#define texCoord4svIndex 55 +#define vertex2dvIndex 56 +#define vertex2fvIndex 57 +#define vertex2ivIndex 58 +#define vertex2svIndex 59 +#define vertex3dvIndex 60 +#define vertex3fvIndex 61 +#define vertex3ivIndex 62 +#define vertex3svIndex 63 +#define vertex4dvIndex 64 +#define vertex4fvIndex 65 +#define vertex4ivIndex 66 +#define vertex4svIndex 67 +#define multiTexCoord1dvIndex 68 +#define multiTexCoord1fvIndex 69 +#define multiTexCoord1ivIndex 70 +#define multiTexCoord1svIndex 71 +#define multiTexCoord2dvIndex 72 +#define multiTexCoord2fvIndex 73 +#define multiTexCoord2ivIndex 74 +#define multiTexCoord2svIndex 75 +#define multiTexCoord3dvIndex 76 +#define multiTexCoord3fvIndex 77 +#define multiTexCoord3ivIndex 78 +#define multiTexCoord3svIndex 79 +#define multiTexCoord4dvIndex 80 +#define multiTexCoord4fvIndex 81 +#define multiTexCoord4ivIndex 82 +#define multiTexCoord4svIndex 83 +#define fogCoordfvIndex 84 +#define fogCoorddvIndex 85 +#define secondaryColor3bvIndex 86 +#define secondaryColor3dvIndex 87 +#define secondaryColor3fvIndex 88 +#define secondaryColor3ivIndex 89 +#define secondaryColor3svIndex 90 +#define secondaryColor3ubvIndex 91 +#define secondaryColor3uivIndex 92 +#define secondaryColor3usvIndex 93 + +static void +logAccum (GLenum op, + GLfloat value) +{ + fprintf (logFp, "glAccum (0x%x, %f)\n", op, value); + (*nativeRenderTable->Accum) (op, value); +} + +static void +logAlphaFunc (GLenum func, + GLclampf ref) +{ + fprintf (logFp, "glAlphaFunc (0x%x, %f)\n", func, ref); + (*nativeRenderTable->AlphaFunc) (func, ref); +} + +static GLboolean +logAreTexturesResident (GLsizei n, + const GLuint *textures, + GLboolean *residences) +{ + fprintf (logFp, "glAreTexturesResident (%d, %p, %p)\n", n, textures, + residences); + return (*nativeRenderTable->AreTexturesResident) (n, textures, + residences); +} + +static void +logArrayElement (GLint i) +{ + vCnt[arrayElementIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glArrayElement (%d)\n", i); + (*nativeRenderTable->ArrayElement) (i); +} + +static void +logBegin (GLenum mode) +{ + fprintf (logFp, "glBegin (0x%x)\n", mode); + (*nativeRenderTable->Begin) (mode); +} + +static void +logBindTexture (GLenum target, + GLuint texture) +{ + fprintf (logFp, "glBindTexture (0x%x, %u)\n", target, texture); + (*nativeRenderTable->BindTexture) (target, texture); +} + +static void +logBitmap (GLsizei width, + GLsizei height, + GLfloat xorig, + GLfloat yorig, + GLfloat xmove, + GLfloat ymove, + const GLubyte *bitmap) +{ + fprintf (logFp, "glBitmap (%d, %d, %f, %f, %f, %f, %p)\n", + width, height, xorig, yorig, xmove, ymove, bitmap); + (*nativeRenderTable->Bitmap) (width, height, xorig, yorig, + xmove, ymove, bitmap); +} + +static void +logBlendFunc (GLenum sfactor, + GLenum dfactor) +{ + fprintf (logFp, "glBlendFunc (0x%x, 0x%x)\n", sfactor, dfactor); + (*nativeRenderTable->BlendFunc) (sfactor, dfactor); +} + +static void +logCallList (GLuint list) +{ + vCnt[callListIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glCallList (%u)\n", list); + (*nativeRenderTable->CallList) (list); +} + +static void +logCallLists (GLsizei n, + GLenum type, + const void *lists) +{ + vCnt[callListsIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glCallLists (%d, 0x%x, %p)\n", n, type, lists); + (*nativeRenderTable->CallLists) (n, type, lists); +} + +static void +logClear (GLbitfield mask) +{ + fprintf (logFp, "glClear (0x%x)\n", mask); + (*nativeRenderTable->Clear) (mask); +} + +static void +logClearAccum (GLfloat red, + GLfloat green, + GLfloat blue, + GLfloat alpha) +{ + fprintf (logFp, "glClearAccum (%f, %f, %f, %f)\n", + red, green, blue, alpha); + (*nativeRenderTable->ClearAccum) (red, green, blue, alpha); +} + +static void +logClearColor (GLclampf red, + GLclampf green, + GLclampf blue, + GLclampf alpha) +{ + fprintf (logFp, "glClearColor (%f, %f, %f, %f)\n", + red, green, blue, alpha); + (*nativeRenderTable->ClearColor) (red, green, blue, alpha); +} + +static void +logClearDepth (GLclampd depth) +{ + fprintf (logFp, "glClearDepth (%f)\n", depth); + (*nativeRenderTable->ClearDepth) (depth); +} + +static void +logClearIndex (GLfloat c) +{ + fprintf (logFp, "glClearIndex (%f)\n", c); + (*nativeRenderTable->ClearIndex) (c); +} + +static void +logClearStencil (GLint s) +{ + fprintf (logFp, "glClearStencil (%d)\n", s); + (*nativeRenderTable->ClearStencil) (s); +} + +static void +logClipPlane (GLenum plane, + const GLdouble *equation) +{ + fprintf (logFp, "glClipPlane (0x%x, %p)\n", plane, equation); + (*nativeRenderTable->ClipPlane) (plane, equation); +} + +static void +logColor3bv (const GLbyte *v) +{ + vCnt[color3bvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glColor3bv (%p)\n", v); + (*nativeRenderTable->Color3bv) (v); +} + +static void +logColor3dv (const GLdouble *v) +{ + vCnt[color3dvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glColor3dv (%p)\n", v); + (*nativeRenderTable->Color3dv) (v); +} + +static void +logColor3fv (const GLfloat *v) +{ + vCnt[color3fvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glColor3fv (%p)\n", v); + (*nativeRenderTable->Color3fv) (v); +} + +static void +logColor3iv (const GLint *v) +{ + vCnt[color3ivIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glColor3iv (%p)\n", v); + (*nativeRenderTable->Color3iv) (v); +} + +static void +logColor3sv (const GLshort *v) +{ + vCnt[color3svIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glColor3sv (%p)\n", v); + (*nativeRenderTable->Color3sv) (v); +} + +static void +logColor3ubv (const GLubyte *v) +{ + vCnt[color3ubvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glColor3ubv (%p)\n", v); + (*nativeRenderTable->Color3ubv) (v); +} + +static void +logColor3uiv (const GLuint *v) +{ + vCnt[color3uivIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glColor3uiv (%p)\n", v); + (*nativeRenderTable->Color3uiv) (v); +} + +static void +logColor3usv (const GLushort *v) +{ + vCnt[color3usvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glColor3usv (%p)\n", v); + (*nativeRenderTable->Color3usv) (v); +} + +static void +logColor4bv (const GLbyte *v) +{ + vCnt[color4bvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glColor4bv (%p)\n", v); + (*nativeRenderTable->Color4bv) (v); +} + +static void +logColor4dv (const GLdouble *v) +{ + vCnt[color4dvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glColor4dv (%p)\n", v); + (*nativeRenderTable->Color4dv) (v); +} + +static void +logColor4fv (const GLfloat *v) +{ + vCnt[color4fvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glColor4fv (%p)\n", v); + (*nativeRenderTable->Color4fv) (v); +} + +static void +logColor4iv (const GLint *v) +{ + vCnt[color4ivIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glColor4iv (%p)\n", v); + (*nativeRenderTable->Color4iv) (v); +} + +static void +logColor4sv (const GLshort *v) +{ + vCnt[color4svIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glColor4sv (%p)\n", v); + (*nativeRenderTable->Color4sv) (v); +} + +static void +logColor4ubv (const GLubyte *v) +{ + vCnt[color4ubvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glColor4ubv (%p)\n", v); + (*nativeRenderTable->Color4ubv) (v); +} + +static void +logColor4uiv(const GLuint *v) +{ + vCnt[color4uivIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glColor4uiv (%p)\n", v); + (*nativeRenderTable->Color4uiv) (v); +} + +static void +logColor4usv (const GLushort *v) +{ + vCnt[color4usvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glColor4usv (%p)\n", v); + (*nativeRenderTable->Color4usv) (v); +} + +static void +logColorMask (GLboolean red, + GLboolean green, + GLboolean blue, + GLboolean alpha) +{ + fprintf (logFp, "glColorMask (%d, %d, %d, %d)\n", red, green, blue, alpha); + (*nativeRenderTable->ColorMask) (red, green, blue, alpha); +} + +static void +logColorMaterial (GLenum face, + GLenum mode) +{ + fprintf (logFp, "glColorMaterial (0x%x, 0x%x)\n", face, mode); + (*nativeRenderTable->ColorMaterial) (face, mode); +} + +static void +logColorPointer (GLint size, + GLenum type, + GLsizei stride, + const void *pointer) +{ + fprintf (logFp, "glColorPointer (%d, 0x%x, %d, %p)\n", + size, type, stride, pointer); + (*nativeRenderTable->ColorPointer) (size, type, stride, pointer); +} + +static void +logCopyPixels (GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLenum type) +{ + fprintf (logFp, "glCopyPixels (%d, %d, %d, %d, 0x%x)\n", + x, y, width, height, type); + (*nativeRenderTable->CopyPixels) (x, y, width, height, type); +} + +static void +logCopyTexImage1D (GLenum target, + GLint level, + GLenum internalFormat, + GLint x, + GLint y, + GLsizei width, + GLint border) +{ + fprintf (logFp, "glCopyTexImage1D (0x%x, %d, 0x%x, %d, %d, %d, %d)\n", + target, level, internalFormat, x, y, width, border); + (*nativeRenderTable->CopyTexImage1D) (target, level, internalFormat, + x, y, width, border); +} + +static void +logCopyTexImage2D (GLenum target, + GLint level, + GLenum internalFormat, + GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLint border) +{ + fprintf (logFp, "glCopyTexImage2D (0x%x, %d, 0x%x, %d, %d, %d, %d, %d)\n", + target, level, internalFormat, x, y, width, height, border); + (*nativeRenderTable->CopyTexImage2D) (target, level, internalFormat, + x, y, width, height, border); +} + +static void +logCopyTexSubImage1D (GLenum target, + GLint level, + GLint xoffset, + GLint x, + GLint y, + GLsizei width) +{ + fprintf (logFp, "glCopyTexSubImage1D (0x%x, %d, %d, %d, %d, %d)\n", + target, level, xoffset, x, y, width); + (*nativeRenderTable->CopyTexSubImage1D) (target, level, xoffset, x, y, + width); +} + +static void +logCopyTexSubImage2D (GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLint x, + GLint y, + GLsizei width, + GLsizei height) +{ + fprintf (logFp, "glCopyTexSubImage2D (0x%x, %d, %d, %d, %d, %d, %d, %d)\n", + target, level, xoffset, yoffset, x, y, width, height); + (*nativeRenderTable->CopyTexSubImage2D) (target, level, + xoffset, yoffset, x, y, + width, height); +} + +static void +logCullFace (GLenum mode) +{ + fprintf (logFp, "glCullFace (0x%x)\n", mode); + (*nativeRenderTable->CullFace) (mode); +} + +static void +logDeleteLists (GLuint list, + GLsizei range) +{ + fprintf (logFp, "glDeleteLists (%d, %d)\n", list, range); + (*nativeRenderTable->DeleteLists) (list, range); +} + +static void +logDeleteTextures (GLsizei n, const GLuint *textures) +{ + fprintf (logFp, "glDeleteTextures (%d, %p)\n", n, textures); + (*nativeRenderTable->DeleteTextures) (n, textures); +} + +static void +logDepthFunc (GLenum func) +{ + fprintf (logFp, "glDepthFunc (0x%x)\n", func); + (*nativeRenderTable->DepthFunc) (func); +} + +static void +logDepthMask (GLboolean flag) +{ + fprintf (logFp, "glDepthMask (%d)\n", flag); + (*nativeRenderTable->DepthMask) (flag); +} + +static void +logDepthRange (GLclampd zNear, + GLclampd zFar) +{ + fprintf (logFp, "glDepthRange (%f, %f)\n", zNear, zFar); + (*nativeRenderTable->DepthRange) (zNear, zFar); +} + +static void +logDisable (GLenum cap) +{ + fprintf (logFp, "glDisable (0x%x)\n", cap); + (*nativeRenderTable->Disable) (cap); +} + +static void +logDisableClientState (GLenum array) +{ + fprintf (logFp, "glDisableClientState (0x%x)\n", array); + (*nativeRenderTable->DisableClientState) (array); +} + +static void +logDrawArrays (GLenum mode, + GLint first, + GLsizei count) +{ + fprintf (logFp, "glDrawArrays (0x%x, %d, %d)\n", mode, first, count); + (*nativeRenderTable->DrawArrays) (mode, first, count); +} + +static void +logDrawBuffer (GLenum mode) +{ + fprintf (logFp, "glDrawBuffer (0x%x)\n", mode); + (*nativeRenderTable->DrawBuffer) (mode); +} + +static void +logDrawElements (GLenum mode, + GLsizei count, + GLenum type, + const void *indices) +{ + fprintf (logFp, "glDrawElements (0x%x, %d, 0x%x, %p)\n", + mode, count, type, indices); + (*nativeRenderTable->DrawElements) (mode, count, type, indices); +} + +static void +logDrawPixels (GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + const void *pixels) +{ + fprintf (logFp, "glDrawPixels (%d, %d, 0x%x, 0x%x, %p)\n", + width, height, format, type, pixels); + (*nativeRenderTable->DrawPixels) (width, height, format, type, pixels); +} + +static void +logEdgeFlagPointer (GLsizei stride, + const void *pointer) +{ + fprintf (logFp, "glEdgeFlagPointer (%d, %p)", stride, pointer); + (*nativeRenderTable->EdgeFlagPointer) (stride, pointer); +} + +static void +logEdgeFlagv (const GLboolean *flag) +{ + vCnt[edgeFlagvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glEdgeFlagv (%p)\n", flag); + (*nativeRenderTable->EdgeFlagv) (flag); +} + +static void +logEnable (GLenum cap) +{ + fprintf (logFp, "glEnable (0x%x)\n", cap); + (*nativeRenderTable->Enable) (cap); +} + +static void +logEnableClientState (GLenum array) +{ + fprintf (logFp, "glEnableClientState (0x%x)\n", array); + (*nativeRenderTable->EnableClientState) (array); +} + +static void +logEnd (void) +{ + int i; + + for (i = 0; i < sizeof (vCnt) / sizeof (vCnt[0]); i++) + { + if (vCnt[i].n) + { + fprintf (logFp, " %s: %d\n", vCnt[i].name, vCnt[i].n); + vCnt[i].n = 0; + } + } + + fprintf (logFp, "glEnd ()\n" ); + (*nativeRenderTable->End) (); +} + +static void +logEndList (void) +{ + fprintf (logFp, "glEndList ()\n" ); + (*nativeRenderTable->EndList) (); +} + +static void +logEvalCoord1dv (const GLdouble *u) +{ + vCnt[evalCoord1dvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glEvalCoord1dv (%p)\n", u); + (*nativeRenderTable->EvalCoord1dv) (u); +} + +static void +logEvalCoord1fv (const GLfloat *u) +{ + vCnt[evalCoord1fvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glEvalCoord1fv (%p)\n", u); + (*nativeRenderTable->EvalCoord1fv) (u); +} + +static void +logEvalCoord2dv (const GLdouble *u) +{ + vCnt[evalCoord2dvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glEvalCoord2dv (%p)\n", u); + (*nativeRenderTable->EvalCoord2dv) (u); +} + +static void +logEvalCoord2fv (const GLfloat *u) +{ + vCnt[evalCoord1fvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glEvalCoord2fv (%p)\n", u); + (*nativeRenderTable->EvalCoord2fv) (u); +} + +static void +logEvalMesh1 (GLenum mode, + GLint i1, + GLint i2) +{ + fprintf (logFp, "glEvalMesh1 (0x%x, %d, %d)\n", mode, i1, i2); + (*nativeRenderTable->EvalMesh1) (mode, i1, i2 ); +} + +static void +logEvalMesh2 (GLenum mode, + GLint i1, + GLint i2, + GLint j1, + GLint j2) +{ + fprintf (logFp, "glEvalMesh2 (0x%x, %d, %d, %d, %d)\n", + mode, i1, i2, j1, j2); + (*nativeRenderTable->EvalMesh2) (mode, i1, i2, j1, j2); +} + +static void +logEvalPoint1 (GLint i) +{ + vCnt[evalPoint1Index].n++; + if (logVertexAttribs) + fprintf (logFp, "glEvalPoint1 (%d)\n", i); + (*nativeRenderTable->EvalPoint1) (i); +} + +static void +logEvalPoint2 (GLint i, GLint j) +{ + vCnt[evalPoint2Index].n++; + if (logVertexAttribs) + fprintf (logFp, "glEvalPoint2 (%d, %d)\n", i, j); + (*nativeRenderTable->EvalPoint2) (i, j); +} + +static void +logFeedbackBuffer (GLsizei size, + GLenum type, + GLfloat *buffer) +{ + fprintf (logFp, "glFeedbackBuffer (%d, 0x%x, %p)\n", size, type, buffer); + (*nativeRenderTable->FeedbackBuffer) (size, type, buffer); +} + +static void +logFinish (void) +{ + fprintf (logFp, "glFinish ()\n"); + (*nativeRenderTable->Finish) (); +} + +static void +logFlush (void) +{ + fprintf (logFp, "glFlush ()\n"); + (*nativeRenderTable->Flush) (); +} + +static void +logFogf (GLenum pname, + GLfloat param) +{ + fprintf (logFp, "glFogf (0x%x, %f)\n", pname, param); + (*nativeRenderTable->Fogf) (pname, param); +} + +static void +logFogfv (GLenum pname, + const GLfloat *params) +{ + fprintf (logFp, "glFogfv (0x%x, %p)\n", pname, params); + (*nativeRenderTable->Fogfv) (pname, params); +} + +static void +logFogi (GLenum pname, + GLint param) +{ + fprintf (logFp, "glFogi (0x%x, %d)\n", pname, param); + (*nativeRenderTable->Fogi) (pname, param); +} + +static void +logFogiv (GLenum pname, + const GLint *params) +{ + fprintf (logFp, "glFogiv (0x%x, %p)\n", pname, params); + (*nativeRenderTable->Fogiv) (pname, params); +} + +static void +logFrontFace (GLenum mode) +{ + fprintf (logFp, "glFrontFace (0x%x)\n", mode); + (*nativeRenderTable->FrontFace) (mode); +} + +static void +logFrustum (GLdouble left, + GLdouble right, + GLdouble bottom, + GLdouble top, + GLdouble zNear, + GLdouble zFar) +{ + fprintf (logFp, "glFrustum (%f, %f, %f, %f, %f, %f)\n", + left, right, bottom, top, zNear, zFar); + (*nativeRenderTable->Frustum) (left, right, bottom, top, zNear, zFar); +} + +static GLuint +logGenLists (GLsizei range) +{ + fprintf (logFp, "glGenLists (%d)\n", range); + return (*nativeRenderTable->GenLists) (range); +} + +static void +logGenTextures (GLsizei n, + GLuint *textures) +{ + fprintf (logFp, "glGenTextures (%d, %p)\n", n, textures); + (*nativeRenderTable->GenTextures) (n, textures); +} +static void +logGetBooleanv (GLenum pname, + GLboolean *params) +{ + fprintf (logFp, "glGetBooleanv (0x%x, %p)\n", pname, params); + (*nativeRenderTable->GetBooleanv) (pname, params); +} + +static void +logGetClipPlane (GLenum plane, + GLdouble *equation) +{ + fprintf (logFp, "glGetClipPlane (0x%x, %p)\n", plane, equation); + (*nativeRenderTable->GetClipPlane) (plane, equation); +} + +static void +logGetDoublev (GLenum pname, + GLdouble *params) +{ + fprintf (logFp, "glGetDoublev (0x%x, %p)\n", pname, params); + (*nativeRenderTable->GetDoublev) (pname, params); +} + +static GLenum +logGetError (void) +{ + fprintf (logFp, "glGetError ()\n"); + return (*nativeRenderTable->GetError) (); +} + +static void +logGetFloatv (GLenum pname, + GLfloat *params) +{ + fprintf (logFp, "glGetFloatv (0x%x, %p)\n", pname, params); + (*nativeRenderTable->GetFloatv) (pname, params); +} + +static void +logGetIntegerv (GLenum pname, + GLint *params) +{ + fprintf (logFp, "glGetIntegerv (0x%x, %p)\n", pname, params); + (*nativeRenderTable->GetIntegerv) (pname, params); +} + +static void +logGetLightfv (GLenum light, + GLenum pname, + GLfloat *params) +{ + fprintf (logFp, "glGetLightfv (0x%x, 0x%x, %p)\n", light, pname, params); + (*nativeRenderTable->GetLightfv) (light, pname, params); +} + +static void +logGetLightiv (GLenum light, + GLenum pname, + GLint *params) +{ + fprintf (logFp, "glGetLightiv (0x%x, 0x%x, %p)\n", + light, pname, params); + (*nativeRenderTable->GetLightiv) (light, pname, params); +} + +static void +logGetMapdv (GLenum target, + GLenum query, + GLdouble *v) +{ + fprintf (logFp, "glGetMapdv (0x%x, 0x%x, %p)\n", target, query, v); + (*nativeRenderTable->GetMapdv) (target, query, v); +} + +static void +logGetMapfv (GLenum target, + GLenum query, + GLfloat *v) +{ + fprintf (logFp, "glGetMapfv (0x%x, 0x%x, %p)\n", target, query, v); + (*nativeRenderTable->GetMapfv) (target, query, v); +} + +static void +logGetMapiv (GLenum target, + GLenum query, + GLint *v) +{ + fprintf (logFp, "glGetMapiv (0x%x, 0x%x, %p)\n", target, query, v); + (*nativeRenderTable->GetMapiv) (target, query, v); +} + +static void +logGetMaterialfv (GLenum face, + GLenum pname, + GLfloat *params) +{ + fprintf (logFp, "glGetMaterialfv (0x%x, 0x%x, %p)\n", face, pname, params); + (*nativeRenderTable->GetMaterialfv) (face, pname, params); +} + +static void +logGetMaterialiv (GLenum face, + GLenum pname, + GLint *params) +{ + fprintf (logFp, "glGetMaterialiv (0x%x, 0x%x, %p)\n", face, pname, params); + (*nativeRenderTable->GetMaterialiv) (face, pname, params); +} + +static void +logGetPixelMapfv (GLenum map, + GLfloat *values) +{ + fprintf (logFp, "glGetPixelMapfv (0x%x, %p)\n", map, values); + (*nativeRenderTable->GetPixelMapfv) (map, values); +} + +static void +logGetPixelMapuiv (GLenum map, + GLuint *values) +{ + fprintf (logFp, "glGetPixelMapuiv (0x%x, %p)\n", map, values); + (*nativeRenderTable->GetPixelMapuiv) (map, values); +} + +static void +logGetPixelMapusv (GLenum map, + GLushort *values) +{ + fprintf (logFp, "glGetPixelMapusv (0x%x, %p)\n", map, values); + (*nativeRenderTable->GetPixelMapusv) (map, values); +} + +static void +logGetPointerv (GLenum pname, + GLvoid **params) +{ + fprintf (logFp, "glGetPointerv (0x%x, %p)\n", pname, params); + (*nativeRenderTable->GetPointerv) (pname, params); +} + +static void +logGetPolygonStipple (GLubyte *mask) +{ + fprintf (logFp, "glGetPolygonStipple (%p)\n", mask); + (*nativeRenderTable->GetPolygonStipple) (mask); +} + +static const GLubyte * +logGetString (GLenum name) +{ + fprintf (logFp, "glGetString (0x%x)\n", name); + return (*nativeRenderTable->GetString) (name); +} + +static void +logGetTexEnvfv (GLenum target, + GLenum pname, + GLfloat *params) +{ + fprintf (logFp, "glGetTexEnvfv (0x%x, 0x%x, %p)\n", target, pname, params); + (*nativeRenderTable->GetTexEnvfv) (target, pname, params); +} + +static void +logGetTexEnviv (GLenum target, + GLenum pname, + GLint *params) +{ + fprintf (logFp, "glGetTexEnviv (0x%x, 0x%x, %p)\n", target, pname, params); + (*nativeRenderTable->GetTexEnviv) (target, pname, params); +} + +static void +logGetTexGendv (GLenum coord, + GLenum pname, + GLdouble *params) +{ + fprintf (logFp, "glGetTexGendv (0x%x, 0x%x, %p)\n", coord, pname, params); + (*nativeRenderTable->GetTexGendv) (coord, pname, params); +} + +static void +logGetTexGenfv (GLenum coord, + GLenum pname, + GLfloat *params) +{ + fprintf (logFp, "glGetTexGenfv (0x%x, 0x%x, %p)\n", coord, pname, params); + (*nativeRenderTable->GetTexGenfv) (coord, pname, params); +} + +static void +logGetTexGeniv (GLenum coord, + GLenum pname, + GLint *params) +{ + fprintf (logFp, "glGetTexGeniv (0x%x, 0x%x, %p)\n", coord, pname, params); + (*nativeRenderTable->GetTexGeniv) (coord, pname, params); +} + +static void +logGetTexImage (GLenum target, + GLint level, + GLenum format, + GLenum type, + void *pixels) +{ + fprintf (logFp, "glGetTexImage (0x%x, %d, 0x%x, 0x%x, %p)\n", + target, level, format, type, pixels); + (*nativeRenderTable->GetTexImage) (target, level, format, type, + pixels); +} +static void +logGetTexLevelParameterfv (GLenum target, + GLint level, + GLenum pname, + GLfloat *params) +{ + fprintf (logFp, "glGetTexLevelParameterfv (0x%x, %d, 0x%x, %p)\n", + target, level, pname, params); + (*nativeRenderTable->GetTexLevelParameterfv) (target, level, + pname, params); +} + +static void +logGetTexLevelParameteriv (GLenum target, + GLint level, + GLenum pname, + GLint *params) +{ + fprintf (logFp, "glGetTexLevelParameteriv (0x%x, %d, 0x%x, %p)\n", + target, level, pname, params); + (*nativeRenderTable->GetTexLevelParameteriv) (target, level, + pname, params); +} + +static void +logGetTexParameterfv (GLenum target, + GLenum pname, + GLfloat *params) +{ + fprintf (logFp, "glGetTexParameterfv (0x%x, 0x%x, %p)\n", + target, pname, params); + (*nativeRenderTable->GetTexParameterfv) (target, pname, params); +} + +static void +logGetTexParameteriv (GLenum target, + GLenum pname, + GLint *params) +{ + fprintf (logFp, "glGetTexParameteriv (0x%x, 0x%x, %p)\n", + target, pname, params); + (*nativeRenderTable->GetTexParameteriv) (target, pname, params); +} + +static void +logHint (GLenum target, + GLenum mode) +{ + fprintf (logFp, "glHint (0x%x, 0x%x)\n", target, mode); + (*nativeRenderTable->Hint) (target, mode); +} + +static void +logIndexMask (GLuint mask) +{ + fprintf (logFp, "glIndexMask (%d)\n", mask); + (*nativeRenderTable->IndexMask) (mask); +} + +static void +logIndexPointer (GLenum type, + GLsizei stride, + const void *pointer) +{ + fprintf (logFp, "glIndexPointer (0x%x, %d, %p)\n", type, stride, pointer); + (*nativeRenderTable->IndexPointer) (type, stride, pointer); +} + +static void +logIndexdv (const GLdouble *c) +{ + vCnt[indexdvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glIndexdv (%p)\n", c); + (*nativeRenderTable->Indexdv) (c); +} + +static void +logIndexfv (const GLfloat *c) +{ + vCnt[indexfvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glIndexfv (%p)\n", c); + (*nativeRenderTable->Indexfv) (c); +} + +static void +logIndexiv (const GLint *c) +{ + vCnt[indexivIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glIndexiv (%p)\n", c); + (*nativeRenderTable->Indexiv) (c); +} + +static void +logIndexsv (const GLshort *c) +{ + vCnt[indexsvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glIndexsv (%p)\n", c); + (*nativeRenderTable->Indexsv) (c); +} + +static void +logIndexubv (const GLubyte *c) +{ + vCnt[indexubvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glIndexubv (%p)\n", c); + (*nativeRenderTable->Indexubv) (c); +} + +static void +logInitNames (void) +{ + fprintf (logFp, "glInitNames ()\n" ); + (*nativeRenderTable->InitNames) (); +} + +static void +logInterleavedArrays (GLenum format, + GLsizei stride, + const void *pointer) +{ + fprintf (logFp, "glInterleavedArrays (0x%x, %d, %p)\n", + format, stride, pointer); + (*nativeRenderTable->InterleavedArrays) (format, stride, pointer); +} + +static GLboolean +logIsEnabled (GLenum cap) +{ + fprintf (logFp, "glIsEnabled (0x%x)\n", cap); + return (*nativeRenderTable->IsEnabled) (cap); +} + +static GLboolean +logIsList (GLuint list) +{ + fprintf (logFp, "glIsList (%d)\n", list); + return (*nativeRenderTable->IsList) (list); +} + +static GLboolean +logIsTexture (GLuint texture) +{ + fprintf (logFp, "glIsTexture (%d)\n", texture); + return (*nativeRenderTable->IsTexture) (texture); +} + +static void +logLightModelf (GLenum pname, + GLfloat param) +{ + fprintf (logFp, "glLightModelf (0x%x, %f)\n", pname, param); + (*nativeRenderTable->LightModelf) (pname, param); +} + +static void +logLightModelfv (GLenum pname, + const GLfloat *params) +{ + fprintf (logFp, "glLightModelfv (0x%x, %p)\n", pname, params); + (*nativeRenderTable->LightModelfv) (pname, params); +} + +static void +logLightModeli (GLenum pname, + GLint param) +{ + fprintf (logFp, "glLightModeli (0x%x, %d)\n", pname, param); + (*nativeRenderTable->LightModeli) (pname, param); +} + +static void +logLightModeliv (GLenum pname, + const GLint *params) +{ + fprintf (logFp, "glLightModeliv (0x%x, %p)\n", pname, params); + (*nativeRenderTable->LightModeliv) (pname, params); +} + +static void +logLightf (GLenum light, + GLenum pname, + GLfloat param) +{ + fprintf (logFp, "glLightf (0x%x, 0x%x, %f)\n", light, pname, param); + (*nativeRenderTable->Lightf) (light, pname, param); +} + +static void +logLightfv (GLenum light, + GLenum pname, + const GLfloat *params) +{ + fprintf (logFp, "glLightfv (0x%x, 0x%x, %p)\n", light, pname, params); + (*nativeRenderTable->Lightfv) (light, pname, params); +} + +static void +logLighti (GLenum light, + GLenum pname, + GLint param) +{ + fprintf (logFp, "glLighti (0x%x, 0x%x, %d)\n", light, pname, param); + (*nativeRenderTable->Lighti) (light, pname, param); +} + +static void +logLightiv (GLenum light, + GLenum pname, + const GLint *params) +{ + fprintf (logFp, "glLightiv (0x%x, 0x%x, %p)\n", light, pname, params); + (*nativeRenderTable->Lightiv) (light, pname, params); +} + +static void +logLineStipple (GLint factor, + GLushort pattern) +{ + fprintf (logFp, "glLineStipple (%d, %d)\n", factor, pattern); + (*nativeRenderTable->LineStipple) (factor, pattern); +} + +static void +logLineWidth (GLfloat width) +{ + fprintf (logFp, "glLineWidth (%f)\n", width); + (*nativeRenderTable->LineWidth) (width); +} + +static void +logListBase (GLuint base) +{ + fprintf (logFp, "glListBase (%d)\n", base); + (*nativeRenderTable->ListBase) (base); +} + +static void +logLoadIdentity (void) +{ + fprintf (logFp, "glLoadIdentity ()\n"); + (*nativeRenderTable->LoadIdentity) (); +} + +static void +logLoadMatrixd (const GLdouble *m) +{ + fprintf (logFp, "glLoadMatrixd (%p)\n", m); + (*nativeRenderTable->LoadMatrixd) (m); +} + +static void +logLoadMatrixf (const GLfloat *m) +{ + fprintf (logFp, "glLoadMatrixf (%p)\n", m); + (*nativeRenderTable->LoadMatrixf) (m); +} + +static void +logLoadName (GLuint name) +{ + fprintf (logFp, "glLoadName (%d)\n", name); + (*nativeRenderTable->LoadName) (name); +} + +static void +logLogicOp (GLenum opcode) +{ + fprintf (logFp, "glLogicOp(0x%x)\n", opcode); + (*nativeRenderTable->LogicOp) (opcode); +} + +static void +logMap1d (GLenum target, + GLdouble u1, + GLdouble u2, + GLint stride, + GLint order, + const GLdouble *points) +{ + fprintf (logFp, "glMap1d (0x%x, %f, %f, %d, %d, %p)\n", + target, u1, u2, stride, order, points); + (*nativeRenderTable->Map1d) (target, u1, u2, stride, order, points); +} + +static void +logMap1f (GLenum target, + GLfloat u1, + GLfloat u2, + GLint stride, + GLint order, + const GLfloat *points) +{ + fprintf (logFp, "glMap1f (0x%x, %f, %f, %d, %d, %p)\n", + target, u1, u2, stride, order, points); + (*nativeRenderTable->Map1f) (target, u1, u2, stride, order, points); +} + +static void +logMap2d (GLenum target, + GLdouble u1, + GLdouble u2, + GLint ustride, + GLint uorder, + GLdouble v1, + GLdouble v2, + GLint vstride, + GLint vorder, + const GLdouble *points) +{ + fprintf (logFp, "glMap2d (0x%x, %f, %f, %d, %d, %f, %f, %d, %d, %p)\n", + target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); + (*nativeRenderTable->Map2d) (target, u1, u2, ustride, uorder, v1, v2, + vstride, vorder, points); +} + +static void +logMap2f (GLenum target, + GLfloat u1, + GLfloat u2, + GLint ustride, + GLint uorder, + GLfloat v1, + GLfloat v2, + GLint vstride, + GLint vorder, + const GLfloat *points) +{ + fprintf (logFp, "glMap2f (0x%x, %f, %f, %d, %d, %f, %f, %d, %d, %p)\n", + target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); + (*nativeRenderTable->Map2f) (target, u1, u2, ustride, uorder, v1, v2, + vstride, vorder, points); +} + +static void +logMapGrid1d (GLint un, + GLdouble u1, + GLdouble u2) +{ + fprintf (logFp, "glMapGrid1d (%d, %f, %f)\n", un, u1, u2); + (*nativeRenderTable->MapGrid1d) (un, u1, u2); +} + +static void +logMapGrid1f (GLint un, + GLfloat u1, + GLfloat u2) +{ + fprintf (logFp, "glMapGrid1f (%d, %f, %f)\n", un, u1, u2); + (*nativeRenderTable->MapGrid1f) (un, u1, u2); +} + +static void +logMapGrid2d (GLint un, + GLdouble u1, + GLdouble u2, + GLint vn, + GLdouble v1, + GLdouble v2) +{ + fprintf (logFp, "glMapGrid2d (%d, %f, %f, %d, %f, %f)\n", + un, u1, u2, vn, v1, v2); + (*nativeRenderTable->MapGrid2d) (un, u1, u2, vn, v1, v2); +} + +static void +logMapGrid2f (GLint un, + GLfloat u1, + GLfloat u2, + GLint vn, + GLfloat v1, + GLfloat v2) +{ + fprintf (logFp, "glMapGrid2f (%d, %f, %f, %d, %f, %f)\n", + un, u1, u2, vn, v1, v2); + (*nativeRenderTable->MapGrid2f) (un, u1, u2, vn, v1, v2); +} + +static void +logMaterialf (GLenum face, + GLenum pname, + GLfloat param) +{ + vCnt[materialfIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glMaterialf (0x%x, 0x%x, %f)\n", face, pname, param); + (*nativeRenderTable->Materialf) (face, pname, param); +} + +static void +logMaterialfv (GLenum face, + GLenum pname, + const GLfloat *params) +{ + vCnt[materialfvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glMaterialfv (0x%x, 0x%x, %p)\n", + face, pname, params); + (*nativeRenderTable->Materialfv) (face, pname, params); +} + +static void +logMateriali (GLenum face, + GLenum pname, + GLint param) +{ + vCnt[materialiIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glMateriali (0x%x, 0x%x, %d)\n", face, pname, param); + (*nativeRenderTable->Materiali) (face, pname, param); +} + +static void +logMaterialiv (GLenum face, + GLenum pname, + const GLint *params) +{ + vCnt[materialivIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glMaterialiv (0x%x, 0x%x, %p)\n", + face, pname, params); + (*nativeRenderTable->Materialiv) (face, pname, params); +} + +static void +logMatrixMode (GLenum mode) +{ + fprintf (logFp, "glMatrixMode (0x%x)\n", mode); + (*nativeRenderTable->MatrixMode) (mode); +} + +static void +logMultMatrixd (const GLdouble *m) +{ + fprintf (logFp, "glMultMatrixd (%p)\n", m); + (*nativeRenderTable->MultMatrixd) (m); +} + +static void +logMultMatrixf (const GLfloat *m) +{ + fprintf (logFp, "glMultMatrixf (%p)\n", m); + (*nativeRenderTable->MultMatrixf) (m); +} + +static void +logNewList (GLuint list, + GLenum mode) +{ + fprintf (logFp, "glNewList (%d, 0x%x)\n", list, mode); + (*nativeRenderTable->NewList) (list, mode); +} + +static void +logNormal3bv (const GLbyte *v) +{ + vCnt[normal3bvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glNormal3bv (%p)\n", v); + (*nativeRenderTable->Normal3bv) (v); +} + +static void +logNormal3dv (const GLdouble *v) +{ + vCnt[normal3dvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glNormal3dv (%p)\n", v); + (*nativeRenderTable->Normal3dv) (v); +} + +static void +logNormal3fv (const GLfloat *v) +{ + vCnt[normal3fvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glNormal3fv (%p)\n", v); + (*nativeRenderTable->Normal3fv) (v); +} + +static void +logNormal3iv (const GLint *v) +{ + vCnt[normal3ivIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glNormal3iv (%p)\n", v); + (*nativeRenderTable->Normal3iv) (v); +} + +static void +logNormal3sv (const GLshort *v) +{ + vCnt[normal3svIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glNormal3sv (%p)\n", v); + (*nativeRenderTable->Normal3sv) (v); +} + +static void +logNormalPointer (GLenum type, + GLsizei stride, + const void *pointer) +{ + fprintf (logFp, "glNormalPointer (0x%x, %d, %p)\n", type, stride, pointer); + (*nativeRenderTable->NormalPointer) (type, stride, pointer); +} + +static void +logOrtho (GLdouble left, + GLdouble right, + GLdouble bottom, + GLdouble top, + GLdouble zNear, + GLdouble zFar) +{ + fprintf (logFp, "glOrtho (%f, %f, %f, %f, %f, %f)\n", + left, right, bottom, top, zNear, zFar); + (*nativeRenderTable->Ortho) (left, right, bottom, top, zNear, zFar); +} + +static void +logPassThrough (GLfloat token) +{ + fprintf (logFp, "glPassThrough (%f)\n", token); + (*nativeRenderTable->PassThrough) (token); +} + +static void +logPixelMapfv (GLenum map, + GLsizei mapsize, + const GLfloat *values) +{ + fprintf (logFp, "glPixelMapfv (0x%x, %d, %p)\n", map, mapsize, values); + (*nativeRenderTable->PixelMapfv) (map, mapsize, values); +} + +static void +logPixelMapuiv (GLenum map, + GLsizei mapsize, + const GLuint *values) +{ + fprintf (logFp, "glPixelMapuiv (0x%x, %d, %p)\n", map, mapsize, values); + (*nativeRenderTable->PixelMapuiv) (map, mapsize, values); +} + +static void +logPixelMapusv (GLenum map, + GLsizei mapsize, + const GLushort *values) +{ + fprintf (logFp, "glPixelMapusv (0x%x, %d, %p)\n", map, mapsize, values); + (*nativeRenderTable->PixelMapusv) (map, mapsize, values); +} + +static void +logPixelStoref (GLenum pname, + GLfloat param) +{ + fprintf (logFp, "glPixelStoref (0x%x, %f)\n", pname, param); + (*nativeRenderTable->PixelStoref) (pname, param); +} + +static void +logPixelStorei (GLenum pname, + GLint param) +{ + fprintf (logFp, "glPixelStorei (0x%x, %d)\n", pname, param); + (*nativeRenderTable->PixelStorei) (pname, param); +} + +static void +logPixelTransferf (GLenum pname, GLfloat param) +{ + fprintf (logFp, "glPixelTransferf (0x%x, %f)\n", pname, param); + (*nativeRenderTable->PixelTransferf) (pname, param); +} + +static void +logPixelTransferi (GLenum pname, + GLint param) +{ + fprintf (logFp, "glPixelTransferi (0x%x, %d)\n", pname, param); + (*nativeRenderTable->PixelTransferi) (pname, param); +} + +static void +logPixelZoom (GLfloat xfactor, + GLfloat yfactor) +{ + fprintf (logFp, "glPixelZoom (%f, %f)\n", xfactor, yfactor); + (*nativeRenderTable->PixelZoom) (xfactor, yfactor); +} + +static void +logPointSize (GLfloat size) +{ + fprintf (logFp, "glPointSize" ); + (*nativeRenderTable->PointSize) (size); +} + +static void +logPolygonMode (GLenum face, + GLenum mode) +{ + fprintf (logFp, "glPolygonMode (0x%x, 0x%x)\n", face, mode ); + (*nativeRenderTable->PolygonMode) (face, mode); +} + +static void +logPolygonOffset (GLfloat factor, + GLfloat units) +{ + fprintf (logFp, "glPolygonOffset (%f, %f)\n", factor, units); + (*nativeRenderTable->PolygonOffset) (factor, units); +} + +static void +logPolygonStipple (const GLubyte *mask) +{ + fprintf (logFp, "glPolygonStipple (%p)\n", mask); + (*nativeRenderTable->PolygonStipple) (mask); +} + +static void +logPopAttrib (void) +{ + fprintf (logFp, "glPopAttrib ()\n"); + (*nativeRenderTable->PopAttrib) (); +} + +static void +logPopClientAttrib (void) +{ + fprintf (logFp, "glPopClientAttrib ()\n" ); + (*nativeRenderTable->PopClientAttrib) (); +} + +static void +logPopMatrix (void) +{ + fprintf (logFp, "glPopMatrix ()\n" ); + (*nativeRenderTable->PopMatrix) (); +} + +static void +logPopName (void) +{ + fprintf (logFp, "glPopName ()\n"); + (*nativeRenderTable->PopName) (); +} + +static void +logPrioritizeTextures (GLsizei n, + const GLuint *textures, + const GLclampf *priorities) +{ + fprintf (logFp, "glPrioritizeTextures (%d, %p, %p)\n", + n, textures, priorities); + (*nativeRenderTable->PrioritizeTextures) (n, textures, priorities); +} + +static void +logPushAttrib (GLbitfield mask) +{ + fprintf (logFp, "glPushAttrib (0x%x)\n", mask); + (*nativeRenderTable->PushAttrib) (mask); +} + +static void +logPushClientAttrib (GLbitfield mask) +{ + fprintf (logFp, "glPushClientAttrib (0x%x)\n", mask); + (*nativeRenderTable->PushClientAttrib) (mask); +} + +static void +logPushMatrix (void) +{ + fprintf (logFp, "glPushMatrix ()\n" ); + (*nativeRenderTable->PushMatrix) (); +} + +static void +logPushName (GLuint name) +{ + fprintf (logFp, "glPushName (%d)\n", name); + (*nativeRenderTable->PushName) (name); +} + +static void +logRasterPos2dv (const GLdouble *v) +{ + fprintf (logFp, "glRasterPos2dv (%p)\n", v); + (*nativeRenderTable->RasterPos2dv) (v); +} + +static void +logRasterPos2fv (const GLfloat *v) +{ + fprintf (logFp, "glRasterPos2dv (%p)\n", v); + (*nativeRenderTable->RasterPos2fv) (v); +} + +static void +logRasterPos2iv (const GLint *v) +{ + fprintf (logFp, "glRasterPos2iv (%p)\n", v); + (*nativeRenderTable->RasterPos2iv) (v); +} + +static void +logRasterPos2sv (const GLshort *v) +{ + fprintf (logFp, "glRasterPos2sv (%p)\n", v); + (*nativeRenderTable->RasterPos2sv) (v); +} + +static void +logRasterPos3dv (const GLdouble *v) +{ + fprintf (logFp, "glRasterPos3dv (%p)\n", v); + (*nativeRenderTable->RasterPos3dv) (v); +} + +static void +logRasterPos3fv (const GLfloat *v) +{ + fprintf (logFp, "glRasterPos3fv (%p)\n", v); + (*nativeRenderTable->RasterPos3fv) (v); +} + +static void +logRasterPos3iv (const GLint *v) +{ + fprintf (logFp, "glRasterPos3iv (%p)\n", v); + (*nativeRenderTable->RasterPos3iv) (v); +} + +static void +logRasterPos3sv (const GLshort *v) +{ + fprintf (logFp, "glRasterPos3sv (%p)\n", v); + (*nativeRenderTable->RasterPos3sv) (v); +} + +static void +logRasterPos4dv (const GLdouble *v) +{ + fprintf (logFp, "glRasterPos4dv (%p)\n", v); + (*nativeRenderTable->RasterPos4dv) (v); +} + +static void +logRasterPos4fv (const GLfloat *v) +{ + fprintf (logFp, "glRasterPos4fv (%p)\n", v); + (*nativeRenderTable->RasterPos4fv) (v); +} + +static void +logRasterPos4iv (const GLint *v) +{ + fprintf (logFp, "glRasterPos4iv (%p)\n", v); + (*nativeRenderTable->RasterPos4iv) (v); +} + +static void +logRasterPos4sv (const GLshort *v) +{ + fprintf (logFp, "glRasterPos4sv (%p)\n", v); + (*nativeRenderTable->RasterPos4sv) (v); +} + +static void +logReadBuffer (GLenum mode) +{ + fprintf (logFp, "glReadBuffer (0x%x)\n", mode); + (*nativeRenderTable->ReadBuffer) (mode); +} + +static void +logReadPixels (GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + void *pixels) +{ + fprintf (logFp, "glReadPixels (%d, %d, %d, %d, 0x%x, 0x%x, %p)\n", + x, y, width, height, format, type, pixels); + (*nativeRenderTable->ReadPixels) (x, y, width, height, format, type, + pixels); +} + +static void +logRectdv (const GLdouble *v1, + const GLdouble *v2) +{ + fprintf (logFp, "glRectdv (%p, %p)\n", v1, v2); + (*nativeRenderTable->Rectdv) (v1, v2); +} + +static void +logRectfv (const GLfloat *v1, + const GLfloat *v2) +{ + fprintf (logFp, "glRectfv (%p, %p)\n", v1, v2); + (*nativeRenderTable->Rectfv) (v1, v2); +} + +static void +logRectiv (const GLint *v1, + const GLint *v2) +{ + fprintf (logFp, "glRectiv (%p, %p)\n", v1, v2); + (*nativeRenderTable->Rectiv) (v1, v2); +} + +static void +logRectsv (const GLshort *v1, + const GLshort *v2) +{ + fprintf (logFp, "glRectsv (%p, %p)\n", v1, v2); + (*nativeRenderTable->Rectsv) (v1, v2); +} + +static GLint +logRenderMode (GLenum mode) +{ + fprintf (logFp, "glRenderMode (0x%x)\n", mode); + return (*nativeRenderTable->RenderMode) (mode); +} + +static void +logRotated (GLdouble angle, + GLdouble x, + GLdouble y, + GLdouble z) +{ + fprintf (logFp, "glRotated (%f, %f, %f, %f)\n", angle, x, y, z); + (*nativeRenderTable->Rotated) (angle, x, y, z); +} + +static void +logRotatef (GLfloat angle, + GLfloat x, + GLfloat y, + GLfloat z) +{ + fprintf (logFp, "glRotatef (%f, %f, %f, %f)\n", angle, x, y, z); + (*nativeRenderTable->Rotatef) (angle, x, y, z); +} + +static void +logScaled (GLdouble x, + GLdouble y, + GLdouble z) +{ + fprintf (logFp, "glScaled (%f, %f, %f)\n", x, y, z); + (*nativeRenderTable->Scaled) (x, y, z); +} + +static void +logScalef (GLfloat x, + GLfloat y, + GLfloat z) +{ + fprintf (logFp, "glScalef (%f, %f, %f)\n", x, y, z); + (*nativeRenderTable->Scalef) (x, y, z); +} + +static void +logScissor (GLint x, + GLint y, + GLsizei width, + GLsizei height) +{ + fprintf (logFp, "glScissor (%d, %d, %d, %d)\n", x, y, width, height); + (*nativeRenderTable->Scissor) (x, y, width, height); +} + +static void +logSelectBuffer (GLsizei size, + GLuint *buffer) +{ + fprintf (logFp, "glSelectBuffer (%d, %p)\n", size, buffer); + (*nativeRenderTable->SelectBuffer) (size, buffer); +} + +static void +logShadeModel (GLenum mode) +{ + fprintf (logFp, "glShadeModel (0x%x)\n", mode); + (*nativeRenderTable->ShadeModel) (mode); +} + +static void +logStencilFunc (GLenum func, + GLint ref, + GLuint mask) +{ + fprintf (logFp, "glStencilFunc (0x%x, %d, %d)\n", func, ref, mask); + (*nativeRenderTable->StencilFunc) (func, ref, mask); +} + +static void +logStencilMask (GLuint mask) +{ + fprintf (logFp, "glStencilMask (0x%x)\n", mask); + (*nativeRenderTable->StencilMask) (mask); +} + +static void +logStencilOp (GLenum fail, + GLenum zfail, + GLenum zpass) +{ + fprintf (logFp, "glStencilOp (0x%x, 0x%x, 0x%x)\n", fail, zfail, zpass); + (*nativeRenderTable->StencilOp) (fail, zfail, zpass); +} + +static void +logTexCoord1dv (const GLdouble *v) +{ + vCnt[texCoord1dvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glTexCoord1dv (%p)\n", v); + (*nativeRenderTable->TexCoord1dv) (v); +} + +static void +logTexCoord1fv (const GLfloat *v) +{ + vCnt[texCoord1fvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glTexCoord1fv (%p)\n", v); + (*nativeRenderTable->TexCoord1fv) (v); +} + +static void +logTexCoord1iv (const GLint *v) +{ + vCnt[texCoord1ivIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glTexCoord1iv (%p)\n", v); + (*nativeRenderTable->TexCoord1iv) (v); +} + +static void +logTexCoord1sv (const GLshort *v) +{ + vCnt[texCoord1svIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glTexCoord1sv (%p)\n", v); + (*nativeRenderTable->TexCoord1sv) (v); +} + +static void +logTexCoord2dv (const GLdouble *v) +{ + vCnt[texCoord2dvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glTexCoord2dv (%p)\n", v); + (*nativeRenderTable->TexCoord2dv) (v); +} + +static void +logTexCoord2fv (const GLfloat *v) +{ + vCnt[texCoord2fvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glTexCoord2fv (%p)\n", v); + (*nativeRenderTable->TexCoord2fv) (v); +} + +static void +logTexCoord2iv (const GLint *v) +{ + vCnt[texCoord2ivIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glTexCoord2iv (%p)\n", v); + (*nativeRenderTable->TexCoord2iv) (v); +} + +static void +logTexCoord2sv (const GLshort *v) +{ + vCnt[texCoord2svIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glTexCoord2sv (%p)\n", v); + (*nativeRenderTable->TexCoord2sv) (v); +} + + +static void +logTexCoord3dv (const GLdouble *v) +{ + vCnt[texCoord3dvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glTexCoord3dv (%p)\n", v); + (*nativeRenderTable->TexCoord3dv) (v); +} + +static void +logTexCoord3fv (const GLfloat *v) +{ + vCnt[texCoord3fvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glTexCoord3fv (%p)\n", v); + (*nativeRenderTable->TexCoord3fv) (v); +} + +static void +logTexCoord3iv (const GLint *v) +{ + vCnt[texCoord3ivIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glTexCoord3iv (%p)\n", v); + (*nativeRenderTable->TexCoord3iv) (v); +} + +static void +logTexCoord3sv (const GLshort *v) +{ + vCnt[texCoord3svIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glTexCoord3sv (%p)\n", v); + (*nativeRenderTable->TexCoord3sv) (v); +} + +static void +logTexCoord4dv (const GLdouble *v) +{ + vCnt[texCoord4dvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glTexCoord4dv (%p)\n", v); + (*nativeRenderTable->TexCoord4dv) (v); +} + +static void +logTexCoord4fv (const GLfloat *v) +{ + vCnt[texCoord4fvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glTexCoord4fv (%p)\n", v); + (*nativeRenderTable->TexCoord4fv) (v); +} + +static void +logTexCoord4iv (const GLint *v) +{ + vCnt[texCoord4ivIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glTexCoord4iv (%p)\n", v); + (*nativeRenderTable->TexCoord4iv) (v); +} + +static void +logTexCoord4sv (const GLshort *v) +{ + vCnt[texCoord4svIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glTexCoord4sv (%p)\n", v); + (*nativeRenderTable->TexCoord4sv) (v); +} + +static void +logTexCoordPointer (GLint size, + GLenum type, + GLsizei stride, + const void *pointer) +{ + fprintf (logFp, "glTexCoordPointer (%d, 0x%x, %d, %p)\n", + size, type, stride, pointer); + (*nativeRenderTable->TexCoordPointer) (size, type, stride, pointer); +} + +static void +logTexEnvf (GLenum target, + GLenum pname, + GLfloat param) +{ + fprintf (logFp, "glTexEnvf (0x%x, 0x%x, %f)\n", target, pname, param); + (*nativeRenderTable->TexEnvf) (target, pname, param); +} + +static void +logTexEnvfv (GLenum target, + GLenum pname, + const GLfloat *params) +{ + fprintf (logFp, "glTexEnvfv (0x%x, 0x%x, %p)\n", target, pname, params); + (*nativeRenderTable->TexEnvfv) (target, pname, params); +} + +static void +logTexEnvi (GLenum target, + GLenum pname, + GLint param) +{ + fprintf (logFp, "glTexEnvi (0x%x, 0x%x, %d)\n", target, pname, param); + (*nativeRenderTable->TexEnvi) (target, pname, param); +} + +static void +logTexEnviv (GLenum target, + GLenum pname, + const GLint *params) +{ + fprintf (logFp, "glTexEnviv (0x%x, 0x%x, %p)\n", target, pname, params); + (*nativeRenderTable->TexEnviv) (target, pname, params); +} + +static void +logTexGend (GLenum coord, + GLenum pname, + GLdouble param) +{ + fprintf (logFp, "glTexGend (0x%x, 0x%x, %f)\n", coord, pname, param); + (*nativeRenderTable->TexGend) (coord, pname, param); +} + +static void +logTexGendv (GLenum coord, + GLenum pname, + const GLdouble *params) +{ + fprintf (logFp, "glTexGendv (0x%x, 0x%x, %p)\n", coord, pname, params); + (*nativeRenderTable->TexGendv) (coord, pname, params); +} + +static void +logTexGenf (GLenum coord, + GLenum pname, + GLfloat param) +{ + fprintf (logFp, "glTexGenf (0x%x, 0x%x, %f)\n", coord, pname, param); + (*nativeRenderTable->TexGenf) (coord, pname, param); +} + +static void +logTexGenfv (GLenum coord, + GLenum pname, + const GLfloat *params) +{ + fprintf (logFp, "glTexGenfv (0x%x, 0x%x, %p)\n", coord, pname, params); + (*nativeRenderTable->TexGenfv) (coord, pname, params); +} + +static void +logTexGeni (GLenum coord, + GLenum pname, + GLint param) +{ + fprintf (logFp, "glTexGeni (0x%x, 0x%x, %d)\n", coord, pname, param); + (*nativeRenderTable->TexGeni) (coord, pname, param); +} + +static void +logTexGeniv (GLenum coord, + GLenum pname, + const GLint *params) +{ + fprintf (logFp, "glTexGeniv (0x%x, 0x%x, %p)\n", coord, pname, params); + (*nativeRenderTable->TexGeniv) (coord, pname, params); +} + +static void +logTexImage1D (GLenum target, + GLint level, + GLint internalformat, + GLsizei width, + GLint border, + GLenum format, + GLenum type, + const void *pixels) +{ + fprintf (logFp, "glTexImage1D (0x%x, %d, %d, %d, %d, 0x%x, 0x%x, %p)\n", + target, level, internalformat, width, border, format, type, + pixels); + (*nativeRenderTable->TexImage1D) (target, level, internalformat, + width, border, format, type, + pixels); +} + +static void +logTexImage2D (GLenum target, + GLint level, + GLint internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLenum format, + GLenum type, + const void *pixels) +{ + fprintf (logFp, "glTexImage2D (0x%x, %d, %d, %d, %d, %d, " + "0x%x, 0x%x, %p)\n", target, level, internalformat, + width, height, border, format, type, pixels); + (*nativeRenderTable->TexImage2D) (target, level, internalformat, + width, height, border, format, type, + pixels); +} + +static void +logTexParameterf (GLenum target, + GLenum pname, + GLfloat param) +{ + fprintf (logFp, "glTexParameterf (0x%x, 0x%x, %f)\n", + target, pname, param); + (*nativeRenderTable->TexParameterf) (target, pname, param); +} + +static void +logTexParameterfv (GLenum target, + GLenum pname, + const GLfloat *params) +{ + fprintf (logFp, "glTexParameterfv (0x%x, 0x%x, %p)\n", + target, pname, params); + (*nativeRenderTable->TexParameterfv) (target, pname, params); +} + +static void +logTexParameteri (GLenum target, + GLenum pname, + GLint param) +{ + fprintf (logFp, "glTexParameteri (0x%x, 0x%x, 0x%x)\n", + target, pname, param); + (*nativeRenderTable->TexParameteri) (target, pname, param); +} + +static void +logTexParameteriv (GLenum target, + GLenum pname, + const GLint *params) +{ + fprintf (logFp, "glTexParameteriv (0x%x, 0x%x, %p)\n", + target, pname, params); + (*nativeRenderTable->TexParameteriv) (target, pname, params); +} + +static void +logTexSubImage1D (GLenum target, + GLint level, + GLint xoffset, + GLsizei width, + GLenum format, + GLenum type, + const void *pixels) +{ + fprintf (logFp, "glTexSubImage1D (0x%x, %d, %d, %d, 0x%x, 0x%x, %p)\n", + target, level, xoffset, width, format, type, pixels); + (*nativeRenderTable->TexSubImage1D) (target, level, xoffset, width, + format, type, pixels); +} + +static void +logTexSubImage2D (GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + const void *pixels) +{ + fprintf (logFp, "glTexSubImage2D (0x%x, %d, %d, %d, %d, %d, " + "0x%x, 0x%x, %p)\n", target, level, xoffset, yoffset, + width, height, format, type, pixels); + (*nativeRenderTable->TexSubImage2D) (target, level, xoffset, yoffset, + width, height, format, type, + pixels); +} + +static void +logTranslated (GLdouble x, + GLdouble y, + GLdouble z) +{ + fprintf (logFp, "glTranslated (%f, %f, %f)\n", x, y, z); + (*nativeRenderTable->Translated) (x, y, z); +} + +static void +logTranslatef (GLfloat x, + GLfloat y, + GLfloat z) +{ + fprintf (logFp, "glTranslatef (%f, %f, %f)\n", x, y, z); + (*nativeRenderTable->Translatef) (x, y, z); +} + +static void +logVertex2dv (const GLdouble *v) +{ + vCnt[vertex2dvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glVertex2dv (%p)\n", v); + (*nativeRenderTable->Vertex2dv) (v); +} + +static void +logVertex2fv (const GLfloat *v) +{ + vCnt[vertex2fvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glVertex2dv (%p)\n", v); + (*nativeRenderTable->Vertex2fv) (v); +} + +static void +logVertex2iv (const GLint *v) +{ + vCnt[vertex2ivIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glVertex2iv (%p)\n", v); + (*nativeRenderTable->Vertex2iv) (v); +} + +static void +logVertex2sv (const GLshort *v) +{ + vCnt[vertex2svIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glVertex2sv (%p)\n", v); + (*nativeRenderTable->Vertex2sv) (v); +} + +static void +logVertex3dv (const GLdouble *v) +{ + vCnt[vertex3dvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glVertex3dv (%p)\n", v); + (*nativeRenderTable->Vertex3dv) (v); +} + +static void +logVertex3fv (const GLfloat *v) +{ + vCnt[vertex3fvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glVertex3fv (%p)\n", v); + (*nativeRenderTable->Vertex3fv) (v); +} + +static void +logVertex3iv (const GLint *v) +{ + vCnt[vertex3ivIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glVertex3iv (%p)\n", v); + (*nativeRenderTable->Vertex3iv) (v); +} + +static void +logVertex3sv (const GLshort *v) +{ + vCnt[vertex3svIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glVertex3sv (%p)\n", v); + (*nativeRenderTable->Vertex3sv) (v); +} + +static void +logVertex4dv (const GLdouble *v) +{ + vCnt[vertex4dvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glVertex4dv (%p)\n", v); + (*nativeRenderTable->Vertex4dv) (v); +} + +static void +logVertex4fv (const GLfloat *v) +{ + vCnt[vertex4fvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glVertex4fv (%p)\n", v); + (*nativeRenderTable->Vertex4fv) (v); +} + +static void +logVertex4iv (const GLint *v) +{ + vCnt[vertex4ivIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glVertex4iv (%p)\n", v); + (*nativeRenderTable->Vertex4iv) (v); +} + +static void +logVertex4sv (const GLshort *v) +{ + vCnt[vertex4svIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glVertex4sv (%p)\n", v); + (*nativeRenderTable->Vertex4sv) (v); +} + +static void +logVertexPointer (GLint size, + GLenum type, + GLsizei stride, + const void *pointer) +{ + fprintf (logFp, "glVertexPointer (%d, 0x%x, %d, %p)\n", + size, type, stride, pointer); + (*nativeRenderTable->VertexPointer) (size, type, stride, pointer); +} + +static void +logViewport (GLint x, + GLint y, + GLsizei width, + GLsizei height) +{ + fprintf (logFp, "glViewport (%d %d %d %d)\n", x, y, width, height); + (*nativeRenderTable->Viewport) (x, y, width, height); +} + +static void +logBlendColor (GLclampf red, + GLclampf green, + GLclampf blue, + GLclampf alpha) +{ + fprintf (logFp, "glBlendColor (%f, %f, %f, %f)\n", + red, green, blue, alpha); + (*nativeRenderTable->BlendColor) (red, green, blue, alpha); +} + +static void +logBlendEquation (GLenum mode) +{ + fprintf (logFp, "glBlendEquation (0x%x)\n", mode); + (*nativeRenderTable->BlendEquation) (mode); +} + +static void +logColorTable (GLenum target, + GLenum internalformat, + GLsizei width, + GLenum format, + GLenum type, + const GLvoid *table) +{ + fprintf (logFp, "glColorTable (0x%x, 0x%x, %d, 0x%x, 0x%x, %p)\n", + target, internalformat, width, format, type, table); + (*nativeRenderTable->ColorTable) (target, internalformat, width, + format, type, table); +} + +static void +logColorTableParameterfv (GLenum target, + GLenum pname, + const GLfloat *params) +{ + fprintf (logFp, "glColorTableParameterfv (0x%x, 0x%x, %p)\n", + target, pname, params); + (*nativeRenderTable->ColorTableParameterfv) (target, pname, params); +} + +static void +logColorTableParameteriv (GLenum target, + GLenum pname, + const GLint *params) +{ + fprintf (logFp, "glColorTableParameterfv (0x%x, 0x%x, %p)\n", + target, pname, params); + (*nativeRenderTable->ColorTableParameteriv) (target, pname, params); +} + +static void +logCopyColorTable (GLenum target, + GLenum internalformat, + GLint x, + GLint y, + GLsizei width) +{ + fprintf (logFp, "glCopyColorTable (0x%x, 0x%x, %d, %d, %d)\n", + target, internalformat, x, y, width); + (*nativeRenderTable->CopyColorTable) (target, internalformat, + x, y, width); +} + +static void +logGetColorTable (GLenum target, + GLenum format, + GLenum type, + GLvoid *table) +{ + fprintf (logFp, "glGetColorTable (0x%x, 0x%x, 0x%x, %p)\n", + target, format, type, table); + (*nativeRenderTable->GetColorTable) (target, format, type, table); +} + +static void +logGetColorTableParameterfv (GLenum target, + GLenum pname, + GLfloat *params) +{ + fprintf (logFp, "glGetColorTableParameterfv (0x%x, 0x%x, %p)\n", + target, pname, params); + (*nativeRenderTable->GetColorTableParameterfv) (target, pname, params); +} + +static void +logGetColorTableParameteriv (GLenum target, + GLenum pname, + GLint *params) +{ + fprintf (logFp, "glGetColorTableParameteriv (0x%x, 0x%x, %p)\n", + target, pname, params); + (*nativeRenderTable->GetColorTableParameteriv) (target, pname, params); +} + +static void +logColorSubTable (GLenum target, + GLsizei start, + GLsizei count, + GLenum format, + GLenum type, + const GLvoid *data) +{ + fprintf (logFp, "glColorSubTable (0x%x, %d, %d, 0x%x, 0x%x, %p)\n", + target, start, count, format, type, data); + (*nativeRenderTable->ColorSubTable) (target, start, count, + format, type, data); +} + +static void +logCopyColorSubTable (GLenum target, + GLsizei start, + GLint x, + GLint y, + GLsizei width) +{ + fprintf (logFp, "glCopyColorSubTable (0x%x, %d, %d, %d, %d)\n", + target, start, x, y, width); + (*nativeRenderTable->CopyColorSubTable) (target, start, x, y, width); +} + +static void +logConvolutionFilter1D (GLenum target, + GLenum internalformat, + GLsizei width, + GLenum format, + GLenum type, + const GLvoid *image) +{ + fprintf (logFp, "glConvolutionFilter1D (0x%x, 0x%x, %d, 0x%x, 0x%x, %p)\n", + target, internalformat, width, format, type, image); + (*nativeRenderTable->ConvolutionFilter1D) (target, internalformat, + width, format, type, image); +} + +static void +logConvolutionFilter2D (GLenum target, + GLenum internalformat, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + const GLvoid *image) +{ + fprintf (logFp, "glConvolutionFilter2D (0x%x, 0x%x, %d, %d, " + "0x%x, 0x%x, %p)\n", target, internalformat, width, height, + format, type, image); + (*nativeRenderTable->ConvolutionFilter2D) (target, internalformat, + width, height, format, + type, image); +} + +static void +logConvolutionParameterf (GLenum target, + GLenum pname, + GLfloat param) +{ + fprintf (logFp, "glConvolutionParameterf (0x%x, 0x%x, %f)\n", + target, pname, param); + (*nativeRenderTable->ConvolutionParameterf) (target, pname, param); +} + +static void +logConvolutionParameterfv (GLenum target, + GLenum pname, + const GLfloat *params) +{ + fprintf (logFp, "glConvolutionParameterfv (0x%x, 0x%x, %p)\n", + target, pname, params); + (*nativeRenderTable->ConvolutionParameterfv) (target, pname, params); +} + +static void +logConvolutionParameteri (GLenum target, + GLenum pname, + GLint param) +{ + fprintf (logFp, "glConvolutionParameterf (0x%x, 0x%x, %d)\n", + target, pname, param); + (*nativeRenderTable->ConvolutionParameteri) (target, pname, param); +} + +static void +logConvolutionParameteriv (GLenum target, + GLenum pname, + const GLint *params) +{ + fprintf (logFp, "glConvolutionParameteriv (0x%x, 0x%x, %p)\n", + target, pname, params); + (*nativeRenderTable->ConvolutionParameteriv) (target, pname, params); +} + +static void +logCopyConvolutionFilter1D (GLenum target, + GLenum internalformat, + GLint x, + GLint y, + GLsizei width) +{ + fprintf (logFp, "glCopyConvolutionFilter1D (0x%x, 0x%x, %d, %d, %d)\n", + target, internalformat, x, y, width); + (*nativeRenderTable->CopyConvolutionFilter1D) (target, internalformat, + x, y, width); +} + +static void +logCopyConvolutionFilter2D (GLenum target, + GLenum internalformat, + GLint x, + GLint y, + GLsizei width, + GLsizei height) +{ + fprintf (logFp, "glCopyConvolutionFilter2D (0x%x, 0x%x, %d, %d, %d, %d)\n", + target, internalformat, x, y, width, height); + (*nativeRenderTable->CopyConvolutionFilter2D) (target, internalformat, + x, y, width, height); +} + +static void +logGetConvolutionFilter (GLenum target, + GLenum format, + GLenum type, + GLvoid *image) +{ + fprintf (logFp, "glGetConvolutionFilter (0x%x, 0x%x, 0x%x, %p)\n", + target, format, type, image); + (*nativeRenderTable->GetConvolutionFilter) (target, format, type, + image); +} + +static void +logGetConvolutionParameterfv (GLenum target, + GLenum pname, + GLfloat *params) +{ + fprintf (logFp, "glGetConvolutionParameterfv (0x%x, 0x%x, %p)\n", + target, pname, params); + (*nativeRenderTable->GetConvolutionParameterfv) (target, pname, + params); +} + +static void +logGetConvolutionParameteriv (GLenum target, + GLenum pname, + GLint *params) +{ + fprintf (logFp, "glGetConvolutionParameteriv (0x%x, 0x%x, %p)\n", + target, pname, params); + (*nativeRenderTable->GetConvolutionParameteriv) (target, pname, + params); +} + +static void +logGetSeparableFilter (GLenum target, + GLenum format, + GLenum type, + GLvoid *row, + GLvoid *column, + GLvoid *span) +{ + fprintf (logFp, "glGetSeparableFilter (0x%x, 0x%x, 0x%x, %p, %p, %p)\n", + target, format, type, row, column, span); + (*nativeRenderTable->GetSeparableFilter) (target, format, type, + row, column, span); +} + +static void +logSeparableFilter2D (GLenum target, + GLenum internalformat, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + const GLvoid *row, + const GLvoid *column) +{ + fprintf (logFp, "glSeparableFilter2D (0x%x, 0x%x, %d, %d, " + "0x%x, 0x%x, %p, %p)\n", target, internalformat, width, height, + format, type, row, column); + (*nativeRenderTable->SeparableFilter2D) (target, internalformat, + width, height, format, + type, row, column); +} + +static void +logGetHistogram (GLenum target, + GLboolean reset, + GLenum format, + GLenum type, + GLvoid *values) +{ + fprintf (logFp, "glGetHistogram (0x%x, %d, 0x%x, 0x%x, %p)\n", + target, reset, format, type, values); + (*nativeRenderTable->GetHistogram) (target, reset, format, type, + values); +} + +static void +logGetHistogramParameterfv (GLenum target, + GLenum pname, + GLfloat *params) +{ + fprintf (logFp, "glGetHistogramParameterfv (0x%x, 0x%x, %p)\n", + target, pname, params); + (*nativeRenderTable->GetHistogramParameterfv) (target, pname, params); +} + +static void +logGetHistogramParameteriv (GLenum target, + GLenum pname, + GLint *params) +{ + fprintf (logFp, "glGetHistogramParameteriv (0x%x, 0x%x, %p)\n", + target, pname, params); + (*nativeRenderTable->GetHistogramParameteriv) (target, pname, params); +} + +static void +logGetMinmax (GLenum target, + GLboolean reset, + GLenum format, + GLenum type, + GLvoid *values) +{ + fprintf (logFp, "glGetMinmax (0x%x, %d, 0x%x, 0x%x, %p)\n", + target, reset, format, type, values); + (*nativeRenderTable->GetMinmax) (target, reset, format, type, values); +} + +static void +logGetMinmaxParameterfv (GLenum target, + GLenum pname, + GLfloat *params) +{ + fprintf (logFp, "GetMinmaxParameterfv (0x%x, 0x%x, %p)\n", + target, pname, params); + (*nativeRenderTable->GetMinmaxParameterfv) (target, pname, params); +} + +static void +logGetMinmaxParameteriv (GLenum target, + GLenum pname, + GLint *params) +{ + fprintf (logFp, "GetMinmaxParameteriv (0x%x, 0x%x, %p)\n", + target, pname, params); + (*nativeRenderTable->GetMinmaxParameteriv) (target, pname, params); +} + +static void +logHistogram (GLenum target, + GLsizei width, + GLenum internalformat, + GLboolean sink) +{ + fprintf (logFp, "glHistogram (0x%x, %d, 0x%x, %d)\n", + target, width, internalformat, sink); + (*nativeRenderTable->Histogram) (target, width, internalformat, sink); +} + +static void +logMinmax (GLenum target, + GLenum internalformat, + GLboolean sink) +{ + fprintf (logFp, "glMinmax (0x%x, 0x%x, %d)\n", + target, internalformat, sink); + (*nativeRenderTable->Minmax) (target, internalformat, sink); +} + +static void +logResetHistogram (GLenum target) +{ + fprintf (logFp, "glResetHistogram (0x%x)\n", target); + (*nativeRenderTable->ResetHistogram) (target); +} + +static void +logResetMinmax (GLenum target) +{ + fprintf (logFp, "glResetMinmax (0x%x)\n", target); + (*nativeRenderTable->ResetMinmax) (target); +} + +static void +logCopyTexSubImage3D (GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLint zoffset, + GLint x, + GLint y, + GLsizei width, + GLsizei height) +{ + fprintf (logFp, "glCopyTexSubImage3D (0x%x, %d, %d, %d, %d, %d, %d, " + "%d, %d)\n", target, level, xoffset, yoffset, zoffset, + x, y, width, height); + (*nativeRenderTable->CopyTexSubImage3D) (target, level, + xoffset, yoffset, zoffset, + x, y, width, height); +} + +static void +logTexImage3D (GLenum target, + GLint level, + GLint internalformat, + GLsizei width, + GLsizei height, + GLsizei depth, + GLint border, + GLenum format, + GLenum type, + const GLvoid *pixels) +{ + fprintf (logFp, "glTexImage3D (0x%x, %d, %d, %d, %d, %d, %d, " + "0x%x, 0x%x, %p)\n", target, level, internalformat, + width, height, depth, border, format, type, pixels); + (*nativeRenderTable->TexImage3D) (target, level, internalformat, + width, height, depth, border, + format, type, pixels); +} + +static void +logTexSubImage3D (GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLint zoffset, + GLsizei width, + GLsizei height, + GLsizei depth, + GLenum format, + GLenum type, + const GLvoid *pixels) +{ + fprintf (logFp, "glTexSubImage3D (0x%x, %d, %d, %d, %d, %d, %d, %d, " + "0x%x, 0x%x, %p)\n", target, level, xoffset, yoffset, zoffset, + width, height, depth, format, type, pixels); + (*nativeRenderTable->TexSubImage3D) (target, level, + xoffset, yoffset, zoffset, + width, height, depth, + format, type, pixels); +} + +/* GL_ARB_multitexture */ + +static void +logActiveTextureARB (GLenum texture) +{ + fprintf (logFp, "glActiveTextureARB (0x%x)\n", texture); + (*nativeRenderTable->ActiveTextureARB) (texture); +} + +static void +logClientActiveTextureARB (GLenum texture) +{ + fprintf (logFp, "glClientActiveTextureARB (0x%x)\n", texture); + (*nativeRenderTable->ClientActiveTextureARB) (texture); +} + +static void +logMultiTexCoord1dvARB (GLenum target, + const GLdouble *v) +{ + vCnt[multiTexCoord1dvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glMultiTexCoord1dvARB (0x%x, %p)\n", target, v); + (*nativeRenderTable->MultiTexCoord1dvARB) (target, v); +} + +static void +logMultiTexCoord1fvARB (GLenum target, + const GLfloat *v) +{ + vCnt[multiTexCoord1fvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glMultiTexCoord1fvARB (0x%x, %p)\n", target, v); + (*nativeRenderTable->MultiTexCoord1fvARB) (target, v); +} + +static void +logMultiTexCoord1ivARB (GLenum target, + const GLint *v) +{ + vCnt[multiTexCoord1ivIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glMultiTexCoord1ivARB (0x%x, %p)\n", target, v); + (*nativeRenderTable->MultiTexCoord1ivARB) (target, v); +} + +static void +logMultiTexCoord1svARB (GLenum target, + const GLshort *v) +{ + vCnt[multiTexCoord1svIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glMultiTexCoord1svARB (0x%x, %p)\n", target, v); + (*nativeRenderTable->MultiTexCoord1svARB) (target, v); +} + +static void +logMultiTexCoord2dvARB (GLenum target, + const GLdouble *v) +{ + vCnt[multiTexCoord2dvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glMultiTexCoord2dvARB (0x%x, %p)\n", target, v); + (*nativeRenderTable->MultiTexCoord2dvARB) (target, v); +} + +static void +logMultiTexCoord2fvARB (GLenum target, + const GLfloat *v) +{ + vCnt[multiTexCoord2fvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glMultiTexCoord2fvARB (0x%x, %p)\n", target, v); + (*nativeRenderTable->MultiTexCoord2fvARB) (target, v); +} + +static void +logMultiTexCoord2ivARB (GLenum target, + const GLint *v) +{ + vCnt[multiTexCoord2ivIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glMultiTexCoord2ivARB (0x%x, %p)\n", target, v); + (*nativeRenderTable->MultiTexCoord2ivARB) (target, v); +} + +static void +logMultiTexCoord2svARB (GLenum target, + const GLshort *v) +{ + vCnt[multiTexCoord2svIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glMultiTexCoord2svARB (0x%x, %p)\n", target, v); + (*nativeRenderTable->MultiTexCoord2svARB) (target, v); +} + +static void +logMultiTexCoord3dvARB (GLenum target, + const GLdouble *v) +{ + vCnt[multiTexCoord3dvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glMultiTexCoord3dvARB (0x%x, %p)\n", target, v); + (*nativeRenderTable->MultiTexCoord3dvARB) (target, v); +} + +static void +logMultiTexCoord3fvARB (GLenum target, + const GLfloat *v) +{ + vCnt[multiTexCoord3fvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glMultiTexCoord3fvARB (0x%x, %p)\n", target, v); + (*nativeRenderTable->MultiTexCoord3fvARB) (target, v); +} + +static void +logMultiTexCoord3ivARB (GLenum target, + const GLint *v) +{ + vCnt[multiTexCoord3ivIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glMultiTexCoord3ivARB (0x%x, %p)\n", target, v); + (*nativeRenderTable->MultiTexCoord3ivARB) (target, v); +} + +static void +logMultiTexCoord3svARB (GLenum target, + const GLshort *v) +{ + vCnt[multiTexCoord3svIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glMultiTexCoord3svARB (0x%x, %p)\n", target, v); + (*nativeRenderTable->MultiTexCoord3svARB) (target, v); +} + +static void +logMultiTexCoord4dvARB (GLenum target, + const GLdouble *v) +{ + vCnt[multiTexCoord4dvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glMultiTexCoord4dvARB (0x%x, %p)\n", target, v); + (*nativeRenderTable->MultiTexCoord4dvARB) (target, v); +} + +static void +logMultiTexCoord4fvARB (GLenum target, + const GLfloat *v) +{ + vCnt[multiTexCoord4fvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glMultiTexCoord4fvARB (0x%x, %p)\n", target, v); + (*nativeRenderTable->MultiTexCoord4fvARB) (target, v); +} + +static void +logMultiTexCoord4ivARB (GLenum target, + const GLint *v) +{ + vCnt[multiTexCoord4ivIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glMultiTexCoord4ivARB (0x%x, %p)\n", target, v); + (*nativeRenderTable->MultiTexCoord4ivARB) (target, v); +} + +static void +logMultiTexCoord4svARB (GLenum target, + const GLshort *v) +{ + vCnt[multiTexCoord4svIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glMultiTexCoord4svARB (0x%x, %p)\n", target, v); + (*nativeRenderTable->MultiTexCoord4svARB) (target, v); +} + + +/* GL_ARB_multisample */ + +static void +logSampleCoverageARB (GLclampf value, + GLboolean invert) +{ + fprintf (logFp, "glSampleCoverageARB (%f, %d)\n", value, invert); + (*nativeRenderTable->SampleCoverageARB) (value, invert); +} + + +/* GL_EXT_texture_object */ + +static GLboolean +logAreTexturesResidentEXT (GLsizei n, + const GLuint *textures, + GLboolean *residences) +{ + fprintf (logFp, "glAreTexturesResidentEXT (%d, %p, %p)\n", + n, textures, residences); + return (*nativeRenderTable->AreTexturesResidentEXT) (n, textures, + residences); +} +static void +logGenTexturesEXT (GLsizei n, + GLuint *textures) +{ + fprintf (logFp, "glGenTexturesEXT (%d, %p)\n", n, textures); + (*nativeRenderTable->GenTexturesEXT) (n, textures); +} + +static GLboolean +logIsTextureEXT (GLuint texture) +{ + fprintf (logFp, "glIsTextureEXT (%d)\n", texture); + return (*nativeRenderTable->IsTextureEXT) (texture); +} + + +/* GL_SGIS_multisample */ + +static void +logSampleMaskSGIS (GLclampf value, + GLboolean invert) +{ + fprintf (logFp, "glSampleMaskSGIS (%f, %d)\n", value, invert); + (*nativeRenderTable->SampleMaskSGIS) (value, invert); +} + +static void +logSamplePatternSGIS (GLenum pattern) +{ + fprintf (logFp, "glSamplePatternSGIS (0x%x)\n", pattern); + (*nativeRenderTable->SamplePatternSGIS) (pattern); +} + + +/* GL_EXT_point_parameters */ + +static void +logPointParameterfEXT (GLenum pname, + GLfloat param) +{ + fprintf (logFp, "glPointParameterfEXT (0x%x, %f)\n", pname, param); + (*nativeRenderTable->PointParameterfEXT) (pname, param); +} + +static void +logPointParameterfvEXT (GLenum pname, + const GLfloat *params) +{ + fprintf (logFp, "glPointParameterfvEXT (0x%x, %p)\n", pname, params); + (*nativeRenderTable->PointParameterfvEXT) (pname, params); +} + + +/* GL_MESA_window_pos */ + +static void +logWindowPos3fMESA (GLfloat x, + GLfloat y, + GLfloat z) +{ + fprintf (logFp, "glWindowPos3fMESA (%f, %f, %f)\n", x, y, z); + (*nativeRenderTable->WindowPos3fMESA) (x, y, z); +} + + +/* GL_EXT_blend_func_separate */ + +static void +logBlendFuncSeparateEXT (GLenum sfactorRGB, + GLenum dfactorRGB, + GLenum sfactorAlpha, + GLenum dfactorAlpha) +{ + fprintf (logFp, "glBlendFuncSeparateEXT (0x%x, 0x%x, 0x%x, 0x%x)\n", + sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha); + (*nativeRenderTable->BlendFuncSeparateEXT) (sfactorRGB, + dfactorRGB, + sfactorAlpha, + dfactorAlpha); +} + + +/* GL_EXT_fog_coord */ + +static void +logFogCoordfvEXT (const GLfloat *coord) +{ + vCnt[fogCoordfvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glFogCoordfvEXT (%p)\n", coord); + (*nativeRenderTable->FogCoordfvEXT) (coord); +} + +static void +logFogCoorddvEXT (const GLdouble *coord) +{ + vCnt[fogCoorddvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glFogCoorddvEXT (%p)\n", coord); + (*nativeRenderTable->FogCoorddvEXT) (coord); +} + +static void +logFogCoordPointerEXT (GLenum type, + GLsizei stride, + const GLvoid *pointer) +{ + fprintf (logFp, "glFogCoordPointerEXT (0x%x, %d, %p)\n", + type, stride, pointer); + (*nativeRenderTable->FogCoordPointerEXT) (type, stride, pointer); +} + + +/* GL_EXT_secondary_color */ + +static void +logSecondaryColor3bvEXT (const GLbyte *v) +{ + vCnt[secondaryColor3bvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glSecondaryColor3bvEXT (%p)\n", v); + (*nativeRenderTable->SecondaryColor3bvEXT) (v); +} + +static void +logSecondaryColor3dvEXT (const GLdouble *v) +{ + vCnt[secondaryColor3dvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glSecondaryColor3dvEXT (%p)\n", v); + (*nativeRenderTable->SecondaryColor3dvEXT) (v); +} + +static void +logSecondaryColor3fvEXT (const GLfloat *v) +{ + vCnt[secondaryColor3fvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glSecondaryColor3fvEXT (%p)\n", v); + (*nativeRenderTable->SecondaryColor3fvEXT) (v); +} + +static void +logSecondaryColor3ivEXT (const GLint *v) +{ + vCnt[secondaryColor3ivIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glSecondaryColor3ivEXT (%p)\n", v); + (*nativeRenderTable->SecondaryColor3ivEXT) (v); +} + +static void +logSecondaryColor3svEXT (const GLshort *v) +{ + vCnt[secondaryColor3svIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glSecondaryColor3svEXT (%p)\n", v); + (*nativeRenderTable->SecondaryColor3svEXT) (v); +} + +static void +logSecondaryColor3ubvEXT (const GLubyte *v) +{ + vCnt[secondaryColor3ubvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glSecondaryColor3ubvEXT (%p)\n", v); + (*nativeRenderTable->SecondaryColor3ubvEXT) (v); +} + +static void +logSecondaryColor3uivEXT (const GLuint *v) +{ + vCnt[secondaryColor3uivIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glSecondaryColor3uivEXT (%p)\n", v); + (*nativeRenderTable->SecondaryColor3uivEXT) (v); +} + +static void +logSecondaryColor3usvEXT (const GLushort *v) +{ + vCnt[secondaryColor3usvIndex].n++; + if (logVertexAttribs) + fprintf (logFp, "glSecondaryColor3usvEXT (%p)\n", v); + (*nativeRenderTable->SecondaryColor3usvEXT) (v); +} + +static void +logSecondaryColorPointerEXT (GLint size, + GLenum type, + GLsizei stride, + const GLvoid *pointer) +{ + fprintf (logFp, "glSecondaryColorPointerEXT (%d, 0x%x, %d, %p)\n", + size, type, stride, pointer); + (*nativeRenderTable->SecondaryColorPointerEXT) (size, type, + stride, pointer); +} + + +/* GL_NV_point_sprite */ + +static void +logPointParameteriNV (GLenum pname, + GLint param) +{ + fprintf (logFp, "glPointParameteriNV (0x%x, %d)\n", pname, param); + (*nativeRenderTable->PointParameteriNV) (pname, param); +} + +static void +logPointParameterivNV (GLenum pname, + const GLint *params) +{ + fprintf (logFp, "glPointParameterivNV (0x%x, %p)\n", pname, params); + (*nativeRenderTable->PointParameterivNV) (pname, params); +} + + +/* GL_EXT_stencil_two_side */ + +static void +logActiveStencilFaceEXT (GLenum face) +{ + fprintf (logFp, "glActiveStencilFaceEXT (0x%x)\n", face); + (*nativeRenderTable->ActiveStencilFaceEXT) (face); +} + + +/* GL_EXT_framebuffer_object */ + +static GLboolean +logIsRenderbufferEXT (GLuint renderbuffer) +{ + fprintf (logFp, "glIsRenderbufferEXT (%d)\n", renderbuffer); + return (*nativeRenderTable->IsRenderbufferEXT) (renderbuffer); +} + +static void +logBindRenderbufferEXT (GLenum target, + GLuint renderbuffer) +{ + fprintf (logFp, "glBindRenderbufferEXT (0x%x, %d)\n", + target, renderbuffer); + (*nativeRenderTable->BindRenderbufferEXT) (target, renderbuffer); +} + +static void +logDeleteRenderbuffersEXT (GLsizei n, + const GLuint *renderbuffers) +{ + fprintf (logFp, "glDeleteRenderbuffersEXT (%d, %p)\n", n, renderbuffers); + (*nativeRenderTable->DeleteRenderbuffersEXT) (n, renderbuffers); +} + +static void +logGenRenderbuffersEXT (GLsizei n, + GLuint *renderbuffers) +{ + fprintf (logFp, "glGenRenderbuffersEXT (%d, %p)\n", n, renderbuffers); + (*nativeRenderTable->GenRenderbuffersEXT) (n, renderbuffers); +} + +static void +logRenderbufferStorageEXT (GLenum target, + GLenum internalformat, + GLsizei width, + GLsizei height) +{ + fprintf (logFp, "glRenderbufferStorageEXT (0x%x, 0x%x, %d, %d)\n", + target, internalformat, width, height); + (*nativeRenderTable->RenderbufferStorageEXT) (target, + internalformat, + width, height); +} + +static void +logGetRenderbufferParameterivEXT (GLenum target, + GLenum pname, + GLint *params) +{ + fprintf (logFp, "glGetRenderbufferParameterivEXT (0x%x, 0x%x, %p)\n", + target, pname, params); + (*nativeRenderTable->GetRenderbufferParameterivEXT) (target, + pname, + params); +} + +static GLboolean +logIsFramebufferEXT (GLuint framebuffer) +{ + fprintf (logFp, "glIsFramebufferEXT (%d)\n", framebuffer); + return (*nativeRenderTable->IsFramebufferEXT) (framebuffer); +} + +static void +logBindFramebufferEXT (GLenum target, + GLuint framebuffer) +{ + fprintf (logFp, "glBindFramebufferEXT (0x%x, %d)\n", target, framebuffer); + (*nativeRenderTable->BindFramebufferEXT) (target, framebuffer); +} + +static void +logDeleteFramebuffersEXT (GLsizei n, + const GLuint *framebuffers) +{ + fprintf (logFp, "glDeleteFramebuffersEXT (%d, %p)\n", n, framebuffers); + (*nativeRenderTable->DeleteFramebuffersEXT) (n, framebuffers); +} + +static void +logGenFramebuffersEXT (GLsizei n, + GLuint *framebuffers) +{ + fprintf (logFp, "glGenFramebuffersEXT (%d, %p)\n", n, framebuffers); + (*nativeRenderTable->GenFramebuffersEXT) (n, framebuffers); +} + +static GLenum +logCheckFramebufferStatusEXT (GLenum target) +{ + fprintf (logFp, "glCheckFramebufferStatusEXT (0x%x)\n", target); + return (*nativeRenderTable->CheckFramebufferStatusEXT) (target); +} + +static void +logFramebufferTexture1DEXT (GLenum target, + GLenum attachment, + GLenum textarget, + GLuint texture, + GLint level) +{ + fprintf (logFp, "glFramebufferTexture1DEXT (0x%x, 0x%x, 0x%x, %d, %d)\n", + target, attachment, textarget, texture, level); + (*nativeRenderTable->FramebufferTexture1DEXT) (target, attachment, + textarget, texture, + level); +} + +static void +logFramebufferTexture2DEXT (GLenum target, + GLenum attachment, + GLenum textarget, + GLuint texture, + GLint level) +{ + fprintf (logFp, "glFramebufferTexture2DEXT (0x%x, 0x%x, 0x%x, %d, %d)\n", + target, attachment, textarget, texture, level); + (*nativeRenderTable->FramebufferTexture2DEXT) (target, attachment, + textarget, texture, + level); +} + +static void +logFramebufferTexture3DEXT (GLenum target, + GLenum attachment, + GLenum textarget, + GLuint texture, + GLint level, + GLint zoffset) +{ + fprintf (logFp, "glFramebufferTexture3DEXT (0x%x, 0x%x, 0x%x, " + "%d, %d, %d)\n", target, attachment, textarget, texture, + level, zoffset); + (*nativeRenderTable->FramebufferTexture3DEXT) (target, attachment, + textarget, texture, + level, zoffset); +} + +static void +logFramebufferRenderbufferEXT (GLenum target, + GLenum attachment, + GLenum buffertarget, + GLuint renderbuffer) +{ + fprintf (logFp, "glFramebufferRenderbufferEXT (0x%x, 0x%x, 0x%x, %d)\n", + target, attachment, buffertarget, renderbuffer); + (*nativeRenderTable->FramebufferRenderbufferEXT) (target, + attachment, + buffertarget, + renderbuffer); +} + +static void +logGetFramebufferAttachmentParameterivEXT (GLenum target, + GLenum attach, + GLenum pname, + GLint *params) +{ + fprintf (logFp, "glGetFramebufferAttachmentParameterivEXT (0x%x, " + "0x%x, 0x%x, %p)\n", target, attach, pname, params); + (*nativeRenderTable->GetFramebufferAttachmentParameterivEXT) (target, + attach, + pname, + params); +} + +static void +logGenerateMipmapEXT (GLenum target) +{ + fprintf (logFp, "glGenerateMipmapEXT (0x%x)\n", target); + (*nativeRenderTable->GenerateMipmapEXT) (target); +} + +static struct _glapi_table __logRenderTable = { + logNewList, + logEndList, + logCallList, + logCallLists, + logDeleteLists, + logGenLists, + logListBase, + logBegin, + logBitmap, + 0, /* glColor3b */ + logColor3bv, + 0, /* glColor3d */ + logColor3dv, + 0, /* glColor3f */ + logColor3fv, + 0, /* glColor3i */ + logColor3iv, + 0, /* glColor3s */ + logColor3sv, + 0, /* glColor3ub */ + logColor3ubv, + 0, /* glColor3ui */ + logColor3uiv, + 0, /* glColor3us */ + logColor3usv, + 0, /* glColor4b */ + logColor4bv, + 0, /* glColor4d */ + logColor4dv, + 0, /* glColor4f */ + logColor4fv, + 0, /* glColor4i */ + logColor4iv, + 0, /* glColor4s */ + logColor4sv, + 0, /* glColor4ub */ + logColor4ubv, + 0, /* glColor4ui */ + logColor4uiv, + 0, /* glColor4us */ + logColor4usv, + 0, /* glEdgeFlag */ + logEdgeFlagv, + logEnd, + 0, /* glIndexd */ + logIndexdv, + 0, /* glIndexf */ + logIndexfv, + 0, /* glIndexi */ + logIndexiv, + 0, /* glIndexs */ + logIndexsv, + 0, /* glNormal3b */ + logNormal3bv, + 0, /* glNormal3d */ + logNormal3dv, + 0, /* glNormal3f */ + logNormal3fv, + 0, /* glNormal3i */ + logNormal3iv, + 0, /* glNormal3s */ + logNormal3sv, + 0, /* glRasterPos2d */ + logRasterPos2dv, + 0, /* glRasterPos2f */ + logRasterPos2fv, + 0, /* glRasterPos2i */ + logRasterPos2iv, + 0, /* glRasterPos2s */ + logRasterPos2sv, + 0, /* glRasterPos3d */ + logRasterPos3dv, + 0, /* glRasterPos3f */ + logRasterPos3fv, + 0, /* glRasterPos3i */ + logRasterPos3iv, + 0, /* glRasterPos3s */ + logRasterPos3sv, + 0, /* glRasterPos4d */ + logRasterPos4dv, + 0, /* glRasterPos4f */ + logRasterPos4fv, + 0, /* glRasterPos4i */ + logRasterPos4iv, + 0, /* glRasterPos4s */ + logRasterPos4sv, + 0, /* glRectd */ + logRectdv, + 0, /* glRectf */ + logRectfv, + 0, /* glRecti */ + logRectiv, + 0, /* glRects */ + logRectsv, + 0, /* glTexCoord1d */ + logTexCoord1dv, + 0, /* glTexCoord1f */ + logTexCoord1fv, + 0, /* glTexCoord1i */ + logTexCoord1iv, + 0, /* glTexCoord1s */ + logTexCoord1sv, + 0, /* glTexCoord2d */ + logTexCoord2dv, + 0, /* glTexCoord2f */ + logTexCoord2fv, + 0, /* glTexCoord2i */ + logTexCoord2iv, + 0, /* glTexCoord2s */ + logTexCoord2sv, + 0, /* glTexCoord3d */ + logTexCoord3dv, + 0, /* glTexCoord3f */ + logTexCoord3fv, + 0, /* glTexCoord3i */ + logTexCoord3iv, + 0, /* glTexCoord3s */ + logTexCoord3sv, + 0, /* glTexCoord4d */ + logTexCoord4dv, + 0, /* glTexCoord4f */ + logTexCoord4fv, + 0, /* glTexCoord4i */ + logTexCoord4iv, + 0, /* glTexCoord4s */ + logTexCoord4sv, + 0, /* glVertex2d */ + logVertex2dv, + 0, /* glVertex2f */ + logVertex2fv, + 0, /* glVertex2i */ + logVertex2iv, + 0, /* glVertex2s */ + logVertex2sv, + 0, /* glVertex3d */ + logVertex3dv, + 0, /* glVertex3f */ + logVertex3fv, + 0, /* glVertex3i */ + logVertex3iv, + 0, /* glVertex3s */ + logVertex3sv, + 0, /* glVertex4d */ + logVertex4dv, + 0, /* glVertex4f */ + logVertex4fv, + 0, /* glVertex4i */ + logVertex4iv, + 0, /* glVertex4s */ + logVertex4sv, + logClipPlane, + logColorMaterial, + logCullFace, + logFogf, + logFogfv, + logFogi, + logFogiv, + logFrontFace, + logHint, + logLightf, + logLightfv, + logLighti, + logLightiv, + logLightModelf, + logLightModelfv, + logLightModeli, + logLightModeliv, + logLineStipple, + logLineWidth, + logMaterialf, + logMaterialfv, + logMateriali, + logMaterialiv, + logPointSize, + logPolygonMode, + logPolygonStipple, + logScissor, + logShadeModel, + logTexParameterf, + logTexParameterfv, + logTexParameteri, + logTexParameteriv, + logTexImage1D, + logTexImage2D, + logTexEnvf, + logTexEnvfv, + logTexEnvi, + logTexEnviv, + logTexGend, + logTexGendv, + logTexGenf, + logTexGenfv, + logTexGeni, + logTexGeniv, + logFeedbackBuffer, + logSelectBuffer, + logRenderMode, + logInitNames, + logLoadName, + logPassThrough, + logPopName, + logPushName, + logDrawBuffer, + logClear, + logClearAccum, + logClearIndex, + logClearColor, + logClearStencil, + logClearDepth, + logStencilMask, + logColorMask, + logDepthMask, + logIndexMask, + logAccum, + logDisable, + logEnable, + logFinish, + logFlush, + logPopAttrib, + logPushAttrib, + logMap1d, + logMap1f, + logMap2d, + logMap2f, + logMapGrid1d, + logMapGrid1f, + logMapGrid2d, + logMapGrid2f, + 0, /* glEvalCoord1d */ + logEvalCoord1dv, + 0, /* glEvalCoord1f */ + logEvalCoord1fv, + 0, /* glEvalCoord2d */ + logEvalCoord2dv, + 0, /* glEvalCoord2f */ + logEvalCoord2fv, + logEvalMesh1, + logEvalPoint1, + logEvalMesh2, + logEvalPoint2, + logAlphaFunc, + logBlendFunc, + logLogicOp, + logStencilFunc, + logStencilOp, + logDepthFunc, + logPixelZoom, + logPixelTransferf, + logPixelTransferi, + logPixelStoref, + logPixelStorei, + logPixelMapfv, + logPixelMapuiv, + logPixelMapusv, + logReadBuffer, + logCopyPixels, + logReadPixels, + logDrawPixels, + logGetBooleanv, + logGetClipPlane, + logGetDoublev, + logGetError, + logGetFloatv, + logGetIntegerv, + logGetLightfv, + logGetLightiv, + logGetMapdv, + logGetMapfv, + logGetMapiv, + logGetMaterialfv, + logGetMaterialiv, + logGetPixelMapfv, + logGetPixelMapuiv, + logGetPixelMapusv, + logGetPolygonStipple, + logGetString, + logGetTexEnvfv, + logGetTexEnviv, + logGetTexGendv, + logGetTexGenfv, + logGetTexGeniv, + logGetTexImage, + logGetTexParameterfv, + logGetTexParameteriv, + logGetTexLevelParameterfv, + logGetTexLevelParameteriv, + logIsEnabled, + logIsList, + logDepthRange, + logFrustum, + logLoadIdentity, + logLoadMatrixf, + logLoadMatrixd, + logMatrixMode, + logMultMatrixf, + logMultMatrixd, + logOrtho, + logPopMatrix, + logPushMatrix, + logRotated, + logRotatef, + logScaled, + logScalef, + logTranslated, + logTranslatef, + logViewport, + logArrayElement, + logBindTexture, + logColorPointer, + logDisableClientState, + logDrawArrays, + logDrawElements, + logEdgeFlagPointer, + logEnableClientState, + logIndexPointer, + 0, /* glIndexub */ + logIndexubv, + logInterleavedArrays, + logNormalPointer, + logPolygonOffset, + logTexCoordPointer, + logVertexPointer, + logAreTexturesResident, + logCopyTexImage1D, + logCopyTexImage2D, + logCopyTexSubImage1D, + logCopyTexSubImage2D, + logDeleteTextures, + logGenTextures, + logGetPointerv, + logIsTexture, + logPrioritizeTextures, + logTexSubImage1D, + logTexSubImage2D, + logPopClientAttrib, + logPushClientAttrib, + logBlendColor, + logBlendEquation, + 0, /* glDrawRangeElements */ + logColorTable, + logColorTableParameterfv, + logColorTableParameteriv, + logCopyColorTable, + logGetColorTable, + logGetColorTableParameterfv, + logGetColorTableParameteriv, + logColorSubTable, + logCopyColorSubTable, + logConvolutionFilter1D, + logConvolutionFilter2D, + logConvolutionParameterf, + logConvolutionParameterfv, + logConvolutionParameteri, + logConvolutionParameteriv, + logCopyConvolutionFilter1D, + logCopyConvolutionFilter2D, + logGetConvolutionFilter, + logGetConvolutionParameterfv, + logGetConvolutionParameteriv, + logGetSeparableFilter, + logSeparableFilter2D, + logGetHistogram, + logGetHistogramParameterfv, + logGetHistogramParameteriv, + logGetMinmax, + logGetMinmaxParameterfv, + logGetMinmaxParameteriv, + logHistogram, + logMinmax, + logResetHistogram, + logResetMinmax, + logTexImage3D, + logTexSubImage3D, + logCopyTexSubImage3D, + logActiveTextureARB, + logClientActiveTextureARB, + 0, /* glMultiTexCoord1dARB */ + logMultiTexCoord1dvARB, + 0, /* glMultiTexCoord1fARB */ + logMultiTexCoord1fvARB, + 0, /* glMultiTexCoord1iARB */ + logMultiTexCoord1ivARB, + 0, /* glMultiTexCoord1sARB */ + logMultiTexCoord1svARB, + 0, /* glMultiTexCoord2dARB */ + logMultiTexCoord2dvARB, + 0, /* glMultiTexCoord2fARB */ + logMultiTexCoord2fvARB, + 0, /* glMultiTexCoord2iARB */ + logMultiTexCoord2ivARB, + 0, /* glMultiTexCoord2sARB */ + logMultiTexCoord2svARB, + 0, /* glMultiTexCoord3dARB */ + logMultiTexCoord3dvARB, + 0, /* glMultiTexCoord3fARB */ + logMultiTexCoord3fvARB, + 0, /* glMultiTexCoord3iARB */ + logMultiTexCoord3ivARB, + 0, /* glMultiTexCoord3sARB */ + logMultiTexCoord3svARB, + 0, /* glMultiTexCoord4dARB */ + logMultiTexCoord4dvARB, + 0, /* glMultiTexCoord4fARB */ + logMultiTexCoord4fvARB, + 0, /* glMultiTexCoord4iARB */ + logMultiTexCoord4ivARB, + 0, /* glMultiTexCoord4sARB */ + logMultiTexCoord4svARB, + 0, /* glLoadTransposeMatrixfARB */ + 0, /* glLoadTransposeMatrixdARB */ + 0, /* glMultTransposeMatrixfARB */ + 0, /* glMultTransposeMatrixdARB */ + logSampleCoverageARB, + 0, /* glDrawBuffersARB */ + 0, /* glPolygonOffsetEXT */ + 0, /* glGetTexFilterFuncSGIS */ + 0, /* glTexFilterFuncSGIS */ + 0, /* glGetHistogramEXT */ + 0, /* glGetHistogramParameterfvEXT */ + 0, /* glGetHistogramParameterivEXT */ + 0, /* glGetMinmaxEXT */ + 0, /* glGetMinmaxParameterfvEXT */ + 0, /* glGetMinmaxParameterivEXT */ + 0, /* glGetConvolutionFilterEXT */ + 0, /* glGetConvolutionParameterfvEXT */ + 0, /* glGetConvolutionParameterivEXT */ + 0, /* glGetSeparableFilterEXT */ + 0, /* glGetColorTableSGI */ + 0, /* glGetColorTableParameterfvSGI */ + 0, /* glGetColorTableParameterivSGI */ + 0, /* glPixelTexGenSGIX */ + 0, /* glPixelTexGenParameteriSGIS */ + 0, /* glPixelTexGenParameterivSGIS */ + 0, /* glPixelTexGenParameterfSGIS */ + 0, /* glPixelTexGenParameterfvSGIS */ + 0, /* glGetPixelTexGenParameterivSGIS */ + 0, /* glGetPixelTexGenParameterfvSGIS */ + 0, /* glTexImage4DSGIS */ + 0, /* glTexSubImage4DSGIS */ + logAreTexturesResidentEXT, + logGenTexturesEXT, + logIsTextureEXT, + 0, /* glDetailTexFuncSGIS */ + 0, /* glGetDetailTexFuncSGIS */ + 0, /* glSharpenTexFuncSGIS */ + 0, /* glGetSharpenTexFuncSGIS */ + logSampleMaskSGIS, + logSamplePatternSGIS, + 0, /* glColorPointerEXT */ + 0, /* glEdgeFlagPointerEXT */ + 0, /* glIndexPointerEXT */ + 0, /* glNormalPointerEXT */ + 0, /* glTexCoordPointerEXT */ + 0, /* glVertexPointerEXT */ + 0, /* glSpriteParameterfSGIX */ + 0, /* glSpriteParameterfvSGIX */ + 0, /* glSpriteParameteriSGIX */ + 0, /* glSpriteParameterivSGIX */ + logPointParameterfEXT, + logPointParameterfvEXT, + 0, /* glGetInstrumentsSGIX */ + 0, /* glInstrumentsBufferSGIX */ + 0, /* glPollInstrumentsSGIX */ + 0, /* glReadInstrumentsSGIX */ + 0, /* glStartInstrumentsSGIX */ + 0, /* glStopInstrumentsSGIX */ + 0, /* glFrameZoomSGIX */ + 0, /* glTagSampleBufferSGIX */ + 0, /* glReferencePlaneSGIX */ + 0, /* glFlushRasterSGIX */ + 0, /* glGetListParameterfvSGIX */ + 0, /* glGetListParameterivSGIX */ + 0, /* glListParameterfSGIX */ + 0, /* glListParameterfvSGIX */ + 0, /* glListParameteriSGIX */ + 0, /* glListParameterivSGIX */ + 0, /* glFragmentColorMaterialSGIX */ + 0, /* glFragmentLightfSGIX */ + 0, /* glFragmentLightfvSGIX */ + 0, /* glFragmentLightiSGIX */ + 0, /* glFragmentLightivSGIX */ + 0, /* glFragmentLightModelfSGIX */ + 0, /* glFragmentLightModelfvSGIX */ + 0, /* glFragmentLightModeliSGIX */ + 0, /* glFragmentLightModelivSGIX */ + 0, /* glFragmentMaterialfSGIX */ + 0, /* glFragmentMaterialfvSGIX */ + 0, /* glFragmentMaterialiSGIX */ + 0, /* glFragmentMaterialivSGIX */ + 0, /* glGetFragmentLightfvSGIX */ + 0, /* glGetFragmentLightivSGIX */ + 0, /* glGetFragmentMaterialfvSGIX */ + 0, /* glGetFragmentMaterialivSGIX */ + 0, /* glLightEnviSGIX */ + 0, /* glVertexWeightfEXT */ + 0, /* glVertexWeightfvEXT */ + 0, /* glVertexWeightPointerEXT */ + 0, /* glFlushVertexArrayRangeNV */ + 0, /* glVertexArrayRangeNV */ + 0, /* glCombinerParameterfvNV */ + 0, /* glCombinerParameterfNV */ + 0, /* glCombinerParameterivNV */ + 0, /* glCombinerParameteriNV */ + 0, /* glCombinerInputNV */ + 0, /* glCombinerOutputNV */ + 0, /* glFinalCombinerInputNV */ + 0, /* glGetCombinerInputParameterfvNV */ + 0, /* glGetCombinerInputParameterivNV */ + 0, /* glGetCombinerOutputParameterfvNV */ + 0, /* glGetCombinerOutputParameterivNV */ + 0, /* glGetFinalCombinerInputParameterfvNV */ + 0, /* glGetFinalCombinerInputParameterivNV */ + 0, /* glResizeBuffersMESA */ + 0, /* glWindowPos2dMESA */ + 0, /* glWindowPos2dvMESA */ + 0, /* glWindowPos2fMESA */ + 0, /* glWindowPos2fvMESA */ + 0, /* glWindowPos2iMESA */ + 0, /* glWindowPos2ivMESA */ + 0, /* glWindowPos2sMESA */ + 0, /* glWindowPos2svMESA */ + 0, /* glWindowPos3dMESA */ + 0, /* glWindowPos3dvMESA */ + logWindowPos3fMESA, + 0, /* glWindowPos3fvMESA */ + 0, /* glWindowPos3iMESA */ + 0, /* glWindowPos3ivMESA */ + 0, /* glWindowPos3sMESA */ + 0, /* glWindowPos3svMESA */ + 0, /* glWindowPos4dMESA */ + 0, /* glWindowPos4dvMESA */ + 0, /* glWindowPos4fMESA */ + 0, /* glWindowPos4fvMESA */ + 0, /* glWindowPos4iMESA */ + 0, /* glWindowPos4ivMESA */ + 0, /* glWindowPos4sMESA */ + 0, /* glWindowPos4svMESA */ + logBlendFuncSeparateEXT, + 0, /* glIndexMaterialEXT */ + 0, /* glIndexFuncEXT */ + 0, /* glLockArraysEXT */ + 0, /* glUnlockArraysEXT */ + 0, /* glCullParameterdvEXT */ + 0, /* glCullParameterfvEXT */ + 0, /* glHintPGI */ + 0, /* glFogCoordfEXT */ + logFogCoordfvEXT, + 0, /* glFogCoorddEXT */ + logFogCoorddvEXT, + logFogCoordPointerEXT, + 0, /* glGetColorTableEXT */ + 0, /* glGetColorTableParameterivEXT */ + 0, /* glGetColorTableParameterfvEXT */ + 0, /* glTbufferMask3DFX */ + 0, /* glCompressedTexImage3DARB */ + 0, /* glCompressedTexImage2DARB */ + 0, /* glCompressedTexImage1DARB */ + 0, /* glCompressedTexSubImage3DARB */ + 0, /* glCompressedTexSubImage2DARB */ + 0, /* glCompressedTexSubImage1DARB */ + 0, /* glGetCompressedTexImageARB */ + 0, /* glSecondaryColor3bEXT */ + logSecondaryColor3bvEXT, + 0, /* glSecondaryColor3dEXT */ + logSecondaryColor3dvEXT, + 0, /* glSecondaryColor3fEXT */ + logSecondaryColor3fvEXT, + 0, /* glSecondaryColor3iEXT */ + logSecondaryColor3ivEXT, + 0, /* glSecondaryColor3sEXT */ + logSecondaryColor3svEXT, + 0, /* glSecondaryColor3ubEXT */ + logSecondaryColor3ubvEXT, + 0, /* glSecondaryColor3uiEXT */ + logSecondaryColor3uivEXT, + 0, /* glSecondaryColor3usEXT */ + logSecondaryColor3usvEXT, + logSecondaryColorPointerEXT, + 0, /* glAreProgramsResidentNV */ + 0, /* glBindProgramNV */ + 0, /* glDeleteProgramsNV */ + 0, /* glExecuteProgramNV */ + 0, /* glGenProgramsNV */ + 0, /* glGetProgramParameterdvNV */ + 0, /* glGetProgramParameterfvNV */ + 0, /* glGetProgramivNV */ + 0, /* glGetProgramStringNV */ + 0, /* glGetTrackMatrixivNV */ + 0, /* glGetVertexAttribdvARB */ + 0, /* glGetVertexAttribfvARB */ + 0, /* glGetVertexAttribivARB */ + 0, /* glGetVertexAttribPointervNV */ + 0, /* glIsProgramNV */ + 0, /* glLoadProgramNV */ + 0, /* glProgramParameter4dNV */ + 0, /* glProgramParameter4dvNV */ + 0, /* glProgramParameter4fNV */ + 0, /* glProgramParameter4fvNV */ + 0, /* glProgramParameters4dvNV */ + 0, /* glProgramParameters4fvNV */ + 0, /* glRequestResidentProgramsNV */ + 0, /* glTrackMatrixNV */ + 0, /* glVertexAttribPointerNV */ + 0, /* glVertexAttrib1dARB */ + 0, /* glVertexAttrib1dvARB */ + 0, /* glVertexAttrib1fARB */ + 0, /* glVertexAttrib1fvARB */ + 0, /* glVertexAttrib1sARB */ + 0, /* glVertexAttrib1svARB */ + 0, /* glVertexAttrib2dARB */ + 0, /* glVertexAttrib2dvARB */ + 0, /* glVertexAttrib2fARB */ + 0, /* glVertexAttrib2fvARB */ + 0, /* glVertexAttrib2sARB */ + 0, /* glVertexAttrib2svARB */ + 0, /* glVertexAttrib3dARB */ + 0, /* glVertexAttrib3dvARB */ + 0, /* glVertexAttrib3fARB */ + 0, /* glVertexAttrib3fvARB */ + 0, /* glVertexAttrib3sARB */ + 0, /* glVertexAttrib3svARB */ + 0, /* glVertexAttrib4dARB */ + 0, /* glVertexAttrib4dvARB */ + 0, /* glVertexAttrib4fARB */ + 0, /* glVertexAttrib4fvARB */ + 0, /* glVertexAttrib4sARB */ + 0, /* glVertexAttrib4svARB */ + 0, /* glVertexAttrib4NubARB */ + 0, /* glVertexAttrib4NubvARB */ + 0, /* glVertexAttribs1dvNV */ + 0, /* glVertexAttribs1fvNV */ + 0, /* glVertexAttribs1svNV */ + 0, /* glVertexAttribs2dvNV */ + 0, /* glVertexAttribs2fvNV */ + 0, /* glVertexAttribs2svNV */ + 0, /* glVertexAttribs3dvNV */ + 0, /* glVertexAttribs3fvNV */ + 0, /* glVertexAttribs3svNV */ + 0, /* glVertexAttribs4dvNV */ + 0, /* glVertexAttribs4fvNV */ + 0, /* glVertexAttribs4svNV */ + 0, /* glVertexAttribs4ubvNV */ + logPointParameteriNV, + logPointParameterivNV, + 0, /* glMultiDrawArraysEXT */ + 0, /* glMultiDrawElementsEXT */ + logActiveStencilFaceEXT, + 0, /* glDeleteFencesNV */ + 0, /* glGenFencesNV */ + 0, /* glIsFenceNV */ + 0, /* glTestFenceNV */ + 0, /* glGetFenceivNV */ + 0, /* glFinishFenceNV */ + 0, /* glSetFenceNV */ + 0, /* glVertexAttrib4bvARB */ + 0, /* glVertexAttrib4ivARB */ + 0, /* glVertexAttrib4ubvARB */ + 0, /* glVertexAttrib4usvARB */ + 0, /* glVertexAttrib4uivARB */ + 0, /* glVertexAttrib4NbvARB */ + 0, /* glVertexAttrib4NsvARB */ + 0, /* glVertexAttrib4NivARB */ + 0, /* glVertexAttrib4NusvARB */ + 0, /* glVertexAttrib4NuivARB */ + 0, /* glVertexAttribPointerARB */ + 0, /* glEnableVertexAttribArrayARB */ + 0, /* glDisableVertexAttribArrayARB */ + 0, /* glProgramStringARB */ + 0, /* glProgramEnvParameter4dARB */ + 0, /* glProgramEnvParameter4dvARB */ + 0, /* glProgramEnvParameter4fARB */ + 0, /* glProgramEnvParameter4fvARB */ + 0, /* glProgramLocalParameter4dARB */ + 0, /* glProgramLocalParameter4dvARB */ + 0, /* glProgramLocalParameter4fARB */ + 0, /* glProgramLocalParameter4fvARB */ + 0, /* glGetProgramEnvParameterdvARB */ + 0, /* glGetProgramEnvParameterfvARB */ + 0, /* glGetProgramLocalParameterdvARB */ + 0, /* glGetProgramLocalParameterfvARB */ + 0, /* glGetProgramivARB */ + 0, /* glGetProgramStringARB */ + 0, /* glProgramNamedParameter4fNV */ + 0, /* glProgramNamedParameter4dNV */ + 0, /* glProgramNamedParameter4fvNV */ + 0, /* glProgramNamedParameter4dvNV */ + 0, /* glGetProgramNamedParameterfvNV */ + 0, /* glGetProgramNamedParameterdvNV */ + 0, /* glBindBufferARB */ + 0, /* glBufferDataARB */ + 0, /* glBufferSubDataARB */ + 0, /* glDeleteBuffersARB */ + 0, /* glGenBuffersARB */ + 0, /* glGetBufferParameterivARB */ + 0, /* glGetBufferPointervARB */ + 0, /* glGetBufferSubDataARB */ + 0, /* glIsBufferARB */ + 0, /* glMapBufferARB */ + 0, /* glUnmapBufferARB */ + 0, /* glDepthBoundsEXT */ + 0, /* glGenQueriesARB */ + 0, /* glDeleteQueriesARB */ + 0, /* glIsQueryARB */ + 0, /* glBeginQueryARB */ + 0, /* glEndQueryARB */ + 0, /* glGetQueryivARB */ + 0, /* glGetQueryObjectivARB */ + 0, /* glGetQueryObjectuivARB */ + 0, /* glMultiModeDrawArraysIBM */ + 0, /* glMultiModeDrawElementsIBM */ + 0, /* glBlendEquationSeparateEXT */ + 0, /* glDeleteObjectARB */ + 0, /* glGetHandleARB */ + 0, /* glDetachObjectARB */ + 0, /* glCreateShaderObjectARB */ + 0, /* glShaderSourceARB */ + 0, /* glCompileShaderARB */ + 0, /* glCreateProgramObjectARB */ + 0, /* glAttachObjectARB */ + 0, /* glLinkProgramARB */ + 0, /* glUseProgramObjectARB */ + 0, /* glValidateProgramARB */ + 0, /* glUniform1fARB */ + 0, /* glUniform2fARB */ + 0, /* glUniform3fARB */ + 0, /* glUniform4fARB */ + 0, /* glUniform1iARB */ + 0, /* glUniform2iARB */ + 0, /* glUniform3iARB */ + 0, /* glUniform4iARB */ + 0, /* glUniform1fvARB */ + 0, /* glUniform2fvARB */ + 0, /* glUniform3fvARB */ + 0, /* glUniform4fvARB */ + 0, /* glUniform1ivARB */ + 0, /* glUniform2ivARB */ + 0, /* glUniform3ivARB */ + 0, /* glUniform4ivARB */ + 0, /* glUniformMatrix2fvARB */ + 0, /* glUniformMatrix3fvARB */ + 0, /* glUniformMatrix4fvARB */ + 0, /* glGetObjectParameterfvARB */ + 0, /* glGetObjectParameterivARB */ + 0, /* glGetInfoLogARB */ + 0, /* glGetAttachedObjectsARB */ + 0, /* glGetUniformLocationARB */ + 0, /* glGetActiveUniformARB */ + 0, /* glGetUniformfvARB */ + 0, /* glGetUniformivARB */ + 0, /* glGetShaderSourceARB */ + 0, /* glBindAttribLocationARB */ + 0, /* glGetActiveAttribARB */ + 0, /* glGetAttribLocationARB */ + 0, /* glGetVertexAttribdvNV */ + 0, /* glGetVertexAttribfvNV */ + 0, /* glGetVertexAttribivNV */ + 0, /* glVertexAttrib1dNV */ + 0, /* glVertexAttrib1dvNV */ + 0, /* glVertexAttrib1fNV */ + 0, /* glVertexAttrib1fvNV */ + 0, /* glVertexAttrib1sNV */ + 0, /* glVertexAttrib1svNV */ + 0, /* glVertexAttrib2dNV */ + 0, /* glVertexAttrib2dvNV */ + 0, /* glVertexAttrib2fNV */ + 0, /* glVertexAttrib2fvNV */ + 0, /* glVertexAttrib2sNV */ + 0, /* glVertexAttrib2svNV */ + 0, /* glVertexAttrib3dNV */ + 0, /* glVertexAttrib3dvNV */ + 0, /* glVertexAttrib3fNV */ + 0, /* glVertexAttrib3fvNV */ + 0, /* glVertexAttrib3sNV */ + 0, /* glVertexAttrib3svNV */ + 0, /* glVertexAttrib4dNV */ + 0, /* glVertexAttrib4dvNV */ + 0, /* glVertexAttrib4fNV */ + 0, /* glVertexAttrib4fvNV */ + 0, /* glVertexAttrib4sNV */ + 0, /* glVertexAttrib4svNV */ + 0, /* glVertexAttrib4ubNV */ + 0, /* glVertexAttrib4ubvNV */ + 0, /* glGenFragmentShadersATI */ + 0, /* glBindFragmentShaderATI */ + 0, /* glDeleteFragmentShaderATI */ + 0, /* glBeginFragmentShaderATI */ + 0, /* glEndFragmentShaderATI */ + 0, /* glPassTexCoordATI */ + 0, /* glSampleMapATI */ + 0, /* glColorFragmentOp1ATI */ + 0, /* glColorFragmentOp2ATI */ + 0, /* glColorFragmentOp3ATI */ + 0, /* glAlphaFragmentOp1ATI */ + 0, /* glAlphaFragmentOp2ATI */ + 0, /* glAlphaFragmentOp3ATI */ + 0, /* glSetFragmentShaderConstantATI */ + logIsRenderbufferEXT, + logBindRenderbufferEXT, + logDeleteRenderbuffersEXT, + logGenRenderbuffersEXT, + logRenderbufferStorageEXT, + logGetRenderbufferParameterivEXT, + logIsFramebufferEXT, + logBindFramebufferEXT, + logDeleteFramebuffersEXT, + logGenFramebuffersEXT, + logCheckFramebufferStatusEXT, + logFramebufferTexture1DEXT, + logFramebufferTexture2DEXT, + logFramebufferTexture3DEXT, + logFramebufferRenderbufferEXT, + logGetFramebufferAttachmentParameterivEXT, + logGenerateMipmapEXT, + 0, /* glStencilFuncSeparate */ + 0, /* glStencilOpSeparate */ + 0, /* glStencilMaskSeparate */ + 0, /* glGetQueryObjecti64vEXT */ + 0 /* glGetQueryObjectui64vEXT */ +}; + +static Bool isCurrent = FALSE; + +static void (*flushContextCache) (void); +static void (*setRenderTables) (struct _glapi_table *table); + +static void +GlxLogFlushContextCache (void) +{ + if (isCurrent) + { + fprintf (logFp, "LOSE CURRENT\n"); + isCurrent = FALSE; + } + + (*flushContextCache) (); +} + +static void +GlxLogSetRenderTables (struct _glapi_table *table) +{ + nativeRenderTable = table; + + if (table) + { + fprintf (logFp, "FORCE CURRENT\n"); + isCurrent = TRUE; + + (*setRenderTables) (&__logRenderTable); + } + else + { + (*setRenderTables) (0); + } +} + +void +xglInitGlxLog (void) +{ + if (logFp) + return; + + if (__xglGLXLogFp) + { + logFp = __xglGLXLogFp; + + flushContextCache = __xglGLXFunc.flushContextCache; + setRenderTables = __xglGLXFunc.setRenderTables; + + __xglGLXFunc.flushContextCache = GlxLogFlushContextCache; + __xglGLXFunc.setRenderTables = GlxLogSetRenderTables; + } +} + +#endif diff --git a/xorg-server/hw/xgl/xgl.h b/xorg-server/hw/xgl/xgl.h new file mode 100644 index 000000000..03dc90c70 --- /dev/null +++ b/xorg-server/hw/xgl/xgl.h @@ -0,0 +1,1474 @@ +/* + * Copyright © 2004 David Reveman + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * David Reveman not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * David Reveman makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#ifndef _XGL_H_ +#define _XGL_H_ + +#include <xgl-config.h> + +#include <X11/X.h> +#define NEED_EVENTS +#include <X11/Xproto.h> +#include <X11/Xos.h> +#include <glitz.h> + +#include "scrnintstr.h" +#include "pixmapstr.h" +#include "windowstr.h" +#include "servermd.h" +#include "mi.h" +#include "dix.h" +#include "damage.h" +#include "gc.h" +#include "micmap.h" +/* I'd like gc.h to provide this */ +typedef struct _GCFuncs *GCFuncsPtr; + +#ifdef RENDER +#include "mipict.h" +#else +#ifdef XV +#undef XV /* Xv implementation require RENDER */ +#endif +#endif + +#ifdef XV +#define XGL_XV_FORMAT_YUY2 0 +#define XGL_XV_FORMAT_YV12 1 +#define XGL_XV_FORMAT_RGB 2 +#define XGL_XV_FORMAT_NUM 3 +#endif + +/* For the modules. We should decide what the actual version numbering should + * be. + */ +#define VERSION "0.0.1" + +extern WindowPtr *WindowTable; + +#define XGL_DEFAULT_PBO_MASK 0 + +typedef struct _xglSizeConstraint { + int minWidth; + int minHeight; + int aboveWidth; + int aboveHeight; +} xglSizeConstraintRec, *xglSizeConstraintPtr; + +typedef struct _xglAccelInfo { + Bool enabled; + Bool pbuffer; + xglSizeConstraintRec size; +} xglAccelInfoRec, *xglAccelInfoPtr; + +typedef struct _xglScreenAccelInfo { + xglAccelInfoRec pixmap; + xglAccelInfoRec window; + xglAccelInfoRec glx; + xglAccelInfoRec xv; +} xglScreenAccelInfoRec, *xglScreenAccelInfoPtr; + +typedef struct _xglScreenInfo { + glitz_drawable_t *drawable; + unsigned int depth; + unsigned int width; + unsigned int height; + unsigned int widthMm; + unsigned int heightMm; + int geometryDataType; + int geometryUsage; + Bool yInverted; + int pboMask; + Bool lines; + xglScreenAccelInfoRec accel; +} xglScreenInfoRec, *xglScreenInfoPtr; + +extern xglScreenInfoRec xglScreenInfo; + +typedef struct _xglPixelFormat { + CARD8 depth, bitsPerRGB; + glitz_pixel_masks_t masks; +} xglPixelFormatRec, *xglPixelFormatPtr; + +typedef struct _xglVisual { + struct _xglVisual *next; + VisualID vid; + xglPixelFormatPtr pPixel; + Bool pbuffer; + struct { + glitz_drawable_format_t *drawable; + glitz_format_t *surface; + } format; +} xglVisualRec, *xglVisualPtr; + +extern xglVisualPtr xglVisuals; + +#define xglAreaAvailable 0 +#define xglAreaDivided 1 +#define xglAreaOccupied 2 + +typedef struct _xglRootArea *xglRootAreaPtr; + +typedef struct _xglArea { + int state; + int level; + int x, y; + int width, height; + struct _xglArea *pArea[4]; + xglRootAreaPtr pRoot; + pointer closure; + DevUnion devPrivate; +} xglAreaRec, *xglAreaPtr; + +typedef struct _xglAreaFuncs { + Bool (*Create) (xglAreaPtr pArea); + + Bool (*MoveIn) (xglAreaPtr pArea, + pointer closure); + + void (*MoveOut) (xglAreaPtr pArea, + pointer closure); + + int (*CompareScore) (xglAreaPtr pArea, + pointer closure1, + pointer closure2); + +} xglAreaFuncsRec, *xglAreaFuncsPtr; + +typedef struct _xglRootArea { + int maxLevel; + int width, height; + xglAreaPtr pArea; + xglAreaFuncsPtr funcs; + int devPrivateSize; + pointer closure; +} xglRootAreaRec; + +typedef struct xglGeometry { + glitz_buffer_t *buffer; + pointer *data; + Bool broken; + glitz_fixed16_16_t xOff, yOff; + int dataType; + int usage; + int size, endOffset; + glitz_geometry_type_t type; + glitz_geometry_format_t f; + int first, width, count; + glitz_multi_array_t *array; +} xglGeometryRec, *xglGeometryPtr; + +#ifdef RENDER +typedef struct _xglFBox { + glitz_float_t x1, y1, x2, y2; +} xglFBoxRec; + +typedef union _xglBox { + BoxRec sBox; + xglFBoxRec fBox; +} xglBoxRec, *xglBoxPtr; + +typedef struct _xglRange { + int first; + unsigned int count; +} xglRangeRec, *xglRangePtr; + +typedef struct _xglGlyphTexture { + PicturePtr pMask; + glitz_pixel_format_t pixel; + glitz_geometry_format_t format; + int geometryDataType; +} xglGlyphTextureRec, *xglGlyphTexturePtr; + +typedef struct _xglGlyphArea { + unsigned long serial; + union { + xglBoxRec box; + xglRangeRec range; + } u; +} xglGlyphAreaRec, *xglGlyphAreaPtr; + +typedef struct _xglGlyphCache { + ScreenPtr pScreen; + int depth; + xglRootAreaRec rootArea; + union { + xglGlyphTextureRec texture; + xglGeometryRec geometry; + } u; +} xglGlyphCacheRec, *xglGlyphCachePtr; + +typedef struct _xglGlyph { + xglAreaPtr pArea; +} xglGlyphRec, *xglGlyphPtr; + +extern DevPrivateKey xglGlyphPrivateKey; + +#define XGL_GET_GLYPH_PRIV(pScreen, pGlyph) ((xglGlyphPtr) \ + dixLookupPrivate(GetGlyphPrivatesForScreen (pGlyph, pScreen), \ + xglGlyphPrivateKey)) + +#define XGL_GLYPH_PRIV(pScreen, pGlyph) \ + xglGlyphPtr pGlyphPriv = XGL_GET_GLYPH_PRIV (pScreen, pGlyph) + +#endif + +typedef struct _xglScreen { + xglVisualPtr pVisual; + +#ifdef GLXEXT + xglVisualPtr pGlxVisual; +#endif + +#ifdef XV + xglVisualRec pXvVisual[XGL_XV_FORMAT_NUM]; +#endif + + xglVisualPtr rootVisual; + glitz_drawable_t *drawable; + glitz_surface_t *surface; + PixmapPtr pScreenPixmap; + unsigned long features; + int geometryUsage; + int geometryDataType; + Bool yInverted; + int pboMask; + Bool lines; + xglGeometryRec scratchGeometry; + xglScreenAccelInfoRec accel; + +#ifdef RENDER + xglGlyphCacheRec glyphCache[33]; + PicturePtr pSolidAlpha; + struct _trapInfo { + PicturePtr pMask; + glitz_geometry_format_t format; + } trapInfo; +#endif + + GetImageProcPtr GetImage; + GetSpansProcPtr GetSpans; + CreateWindowProcPtr CreateWindow; + DestroyWindowProcPtr DestroyWindow; + ChangeWindowAttributesProcPtr ChangeWindowAttributes; + CopyWindowProcPtr CopyWindow; + CreateGCProcPtr CreateGC; + CloseScreenProcPtr CloseScreen; + SetWindowPixmapProcPtr SetWindowPixmap; + BitmapToRegionProcPtr BitmapToRegion; + +#ifdef RENDER + CompositeProcPtr Composite; + GlyphsProcPtr Glyphs; + TrapezoidsProcPtr Trapezoids; + AddTrapsProcPtr AddTraps; + AddTrianglesProcPtr AddTriangles; + ChangePictureProcPtr ChangePicture; + ChangePictureTransformProcPtr ChangePictureTransform; + ChangePictureFilterProcPtr ChangePictureFilter; + + RealizeGlyphProcPtr RealizeGlyph; + UnrealizeGlyphProcPtr UnrealizeGlyph; +#endif +} xglScreenRec, *xglScreenPtr; + +extern DevPrivateKey xglScreenPrivateKey; + +#define XGL_GET_SCREEN_PRIV(pScreen) ((xglScreenPtr) \ + dixLookupPrivate(&(pScreen)->devPrivates, xglScreenPrivateKey)) + +#define XGL_SET_SCREEN_PRIV(pScreen, v) \ + dixSetPrivate(&(pScreen)->devPrivates, xglScreenPrivateKey, v) + +#define XGL_SCREEN_PRIV(pScreen) \ + xglScreenPtr pScreenPriv = XGL_GET_SCREEN_PRIV (pScreen) + +#define XGL_SCREEN_WRAP(field, wrapper) \ + pScreenPriv->field = pScreen->field; \ + pScreen->field = wrapper + +#define XGL_SCREEN_UNWRAP(field) \ + pScreen->field = pScreenPriv->field + +#ifdef RENDER +#define XGL_PICTURE_SCREEN_WRAP(field, wrapper) \ + pScreenPriv->field = pPictureScreen->field; \ + pPictureScreen->field = wrapper + +#define XGL_PICTURE_SCREEN_UNWRAP(field) \ + pPictureScreen->field = pScreenPriv->field +#endif + +#define xglGCSoftwareDrawableFlag (1L << 0) +#define xglGCBadFunctionFlag (1L << 1) +#define xglGCPlaneMaskFlag (1L << 2) + +typedef struct _xglGC { + glitz_surface_t *fg; + glitz_surface_t *bg; + glitz_format_id_t id; + glitz_operator_t op; + unsigned long flags; + GCFuncsPtr funcs; + GCOpsPtr ops; +} xglGCRec, *xglGCPtr; + +extern DevPrivateKey xglGCPrivateKey; + +#define XGL_GET_GC_PRIV(pGC) ((xglGCPtr) \ + dixLookupPrivate(&(pGC)->devPrivates, xglGCPrivateKey)) + +#define XGL_GC_PRIV(pGC) \ + xglGCPtr pGCPriv = XGL_GET_GC_PRIV (pGC) + +#define XGL_GC_WRAP(field, wrapper) \ + pGCPriv->field = pGC->field; \ + pGC->field = wrapper + +#define XGL_GC_UNWRAP(field) \ + pGC->field = pGCPriv->field + + +#define xglPCFillMask (1L << 0) +#define xglPCFilterMask (1L << 1) +#define xglPCTransformMask (1L << 2) +#define xglPCComponentAlphaMask (1L << 3) +#define xglPCDitherMask (1L << 4) + +#define xglPFFilterMask (1L << 8) + +#define xglPixmapTargetNo 0 +#define xglPixmapTargetOut 1 +#define xglPixmapTargetIn 2 + +#ifdef XV + +typedef struct _xglXvPort { + PixmapPtr pPixmap; + PicturePtr pSrc; + PicturePtr pDst; +} xglXvPortRec, *xglXvPortPtr; + +#endif + +typedef struct _xglPixmap { + xglVisualPtr pVisual; + glitz_surface_t *surface; + glitz_drawable_t *drawable; + glitz_buffer_t *buffer; + int target; + Bool acceleratedTile; + pointer bits; + int stride; + DamagePtr pDamage; + BoxRec damageBox; + RegionRec bitRegion; + Bool allBits; + unsigned long pictureMask; + xglGeometryPtr pGeometry; + +#ifdef XV + xglXvPortPtr pPortPriv; +#endif + +} xglPixmapRec, *xglPixmapPtr; + +extern DevPrivateKey xglPixmapPrivateKey; + +#define XGL_GET_PIXMAP_PRIV(pPixmap) ((xglPixmapPtr) \ + dixLookupPrivate(&(pPixmap)->devPrivates, xglPixmapPrivateKey)) + +#define XGL_PIXMAP_PRIV(pPixmap) \ + xglPixmapPtr pPixmapPriv = XGL_GET_PIXMAP_PRIV (pPixmap) + +#define XGL_PICTURE_CHANGES(pictureMask) (pictureMask & 0x0000ffff) +#define XGL_PICTURE_FAILURES(pictureMask) (pictureMask & 0xffff0000) + +typedef struct _xglWin { + PixmapPtr pPixmap; +} xglWinRec, *xglWinPtr; + +extern DevPrivateKey xglWinPrivateKey; + +#define XGL_GET_WINDOW_PRIV(pWin) ((xglWinPtr) \ + dixLookupPrivate(&(pWin)->devPrivates, xglWinPrivateKey)) + +#define XGL_WINDOW_PRIV(pWin) \ + xglWinPtr pWinPriv = XGL_GET_WINDOW_PRIV (pWin) + +#define XGL_GET_WINDOW_PIXMAP(pWin) \ + (XGL_GET_WINDOW_PRIV((WindowPtr) (pWin))->pPixmap) + + +#define XGL_GET_DRAWABLE_PIXMAP(pDrawable) \ + (((pDrawable)->type == DRAWABLE_WINDOW)? \ + XGL_GET_WINDOW_PIXMAP (pDrawable): \ + (PixmapPtr) (pDrawable)) + +#define XGL_DRAWABLE_PIXMAP(pDrawable) \ + PixmapPtr pPixmap = XGL_GET_DRAWABLE_PIXMAP (pDrawable) + +#define XGL_GET_DRAWABLE_PIXMAP_PRIV(pDrawable) \ + XGL_GET_PIXMAP_PRIV (XGL_GET_DRAWABLE_PIXMAP (pDrawable)) + +#define XGL_DRAWABLE_PIXMAP_PRIV(pDrawable) \ + xglPixmapPtr pPixmapPriv = XGL_GET_DRAWABLE_PIXMAP_PRIV (pDrawable) + +#ifdef COMPOSITE +#define __XGL_OFF_X_WIN(pPix) (-(pPix)->screen_x) +#define __XGL_OFF_Y_WIN(pPix) (-(pPix)->screen_y) +#else +#define __XGL_OFF_X_WIN(pPix) (0) +#define __XGL_OFF_Y_WIN(pPix) (0) +#endif + +#define XGL_GET_DRAWABLE(pDrawable, pSurface, xOff, yOff) \ + { \ + PixmapPtr _pPix; \ + if ((pDrawable)->type != DRAWABLE_PIXMAP) { \ + _pPix = XGL_GET_WINDOW_PIXMAP (pDrawable); \ + (xOff) = __XGL_OFF_X_WIN (_pPix); \ + (yOff) = __XGL_OFF_Y_WIN (_pPix); \ + } else { \ + _pPix = (PixmapPtr) (pDrawable); \ + (yOff) = (xOff) = 0; \ + } \ + (pSurface) = XGL_GET_PIXMAP_PRIV (_pPix)->surface; \ + } + +#define XGL_DEFAULT_DPI 96 + +#define XGL_SW_FAILURE_STRING "software fall-back failure" + +#define MIN(a,b) ((a) < (b) ? (a) : (b)) +#define MAX(a,b) ((a) > (b) ? (a) : (b)) + +#define POWER_OF_TWO(v) ((v & (v - 1)) == 0) + +#define MOD(a,b) ((a) < 0 ? ((b) - ((-(a) - 1) % (b))) - 1 : (a) % (b)) + +#define FIXED_TO_FLOAT(f) (((glitz_float_t) (f)) / 65536) +#define FLOAT_TO_FIXED(f) ((int) ((f) * 65536)) + +#define BOX_NOTEMPTY(pBox) \ + (((pBox)->x2 - (pBox)->x1) > 0 && \ + ((pBox)->y2 - (pBox)->y1) > 0) + + +/* xglinput.c */ + +int +xglMouseProc (DeviceIntPtr pDevice, + int onoff); + +int +xglKeybdProc (DeviceIntPtr pDevice, + int onoff); + +void +xglBell (int volume, + DeviceIntPtr pDev, + pointer ctrl, + int something); + +void +xglKbdCtrl (DeviceIntPtr pDevice, + KeybdCtrl *ctrl); + +void +xglInitInput (int argc, char **argv); + + +/* xgloutput.c */ + +void +xglSetPixmapFormats (ScreenInfo *pScreenInfo); + +void +xglSetRootClip (ScreenPtr pScreen, + Bool enable); + + +/* xglcmap.c */ + +void +xglSetVisualTypes (int depth, + int visuals, + int redSize, + int greenSize, + int blueSize); + +Bool +xglHasVisualTypes (xglVisualPtr pVisual, + int depth); + +glitz_format_t * +xglFindBestSurfaceFormat (ScreenPtr pScreen, + xglPixelFormatPtr pPixel); + +void +xglInitVisuals (ScreenPtr pScreen); + +xglVisualPtr +xglFindVisualWithDepth (ScreenPtr pScreen, + int depth); + +xglVisualPtr +xglFindVisualWithId (ScreenPtr pScreen, + int vid); + +void +xglClearVisualTypes (void); + + +/* xglparse.c */ + +char * +xglParseFindNext (char *cur, + char *delim, + char *save, + char *last); + +void +xglParseScreen (char *arg); + +void +xglUseMsg (void); + +int +xglProcessArgument (int argc, + char **argv, + int i); + + +/* xglscreen.c */ + +Bool +xglScreenInit (ScreenPtr pScreen); + +Bool +xglFinishScreenInit (ScreenPtr pScreen); + +Bool +xglCloseScreen (int index, + ScreenPtr pScreen); + +void +xglCreateSolidAlphaPicture (ScreenPtr pScreen); + + +/* xglarea.c */ + +Bool +xglRootAreaInit (xglRootAreaPtr pRoot, + int maxLevel, + int width, + int height, + int devPrivateSize, + xglAreaFuncsPtr funcs, + pointer closure); + +void +xglRootAreaFini (xglRootAreaPtr pRoot); + +void +xglLeaveArea (xglAreaPtr pArea); + +void +xglWithdrawArea (xglAreaPtr pArea); + +Bool +xglFindArea (xglAreaPtr pArea, + int width, + int height, + Bool kickOut, + pointer closure); + + +/* xglgeometry.c */ + +#define GEOMETRY_DATA_TYPE_SHORT 0 +#define GEOMETRY_DATA_TYPE_FLOAT 1 + +typedef struct _xglDataTypeInfo { + glitz_data_type_t type; + int size; +} xglDataTypeInfoRec, *xglDataTypeInfoPtr; + +extern xglDataTypeInfoRec xglGeometryDataTypes[2]; + +#define DEFAULT_GEOMETRY_DATA_TYPE GEOMETRY_DATA_TYPE_FLOAT + +#define GEOMETRY_USAGE_STREAM 0 +#define GEOMETRY_USAGE_STATIC 1 +#define GEOMETRY_USAGE_DYNAMIC 2 +#define GEOMETRY_USAGE_SYSMEM 3 + +#define DEFAULT_GEOMETRY_USAGE GEOMETRY_USAGE_SYSMEM + +#define GEOMETRY_INIT(pScreen, pGeometry, _type, _usage, _size) \ + { \ + (pGeometry)->type = _type; \ + (pGeometry)->usage = _usage; \ + (pGeometry)->dataType = DEFAULT_GEOMETRY_DATA_TYPE; \ + (pGeometry)->usage = _usage; \ + (pGeometry)->size = 0; \ + (pGeometry)->endOffset = 0; \ + (pGeometry)->data = (pointer) 0; \ + (pGeometry)->buffer = NULL; \ + (pGeometry)->broken = FALSE; \ + (pGeometry)->xOff = 0; \ + (pGeometry)->yOff = 0; \ + (pGeometry)->array = NULL; \ + (pGeometry)->first = 0; \ + (pGeometry)->count = 0; \ + if (_type == GLITZ_GEOMETRY_TYPE_VERTEX) \ + { \ + (pGeometry)->width = 2; \ + (pGeometry)->f.vertex.type = \ + xglGeometryDataTypes[(pGeometry)->dataType].type; \ + (pGeometry)->f.vertex.bytes_per_vertex = (pGeometry)->width * \ + xglGeometryDataTypes[(pGeometry)->dataType].size; \ + (pGeometry)->f.vertex.primitive = GLITZ_PRIMITIVE_QUADS; \ + (pGeometry)->f.vertex.attributes = 0; \ + (pGeometry)->f.vertex.src.type = GLITZ_DATA_TYPE_FLOAT; \ + (pGeometry)->f.vertex.src.size = GLITZ_COORDINATE_SIZE_X; \ + (pGeometry)->f.vertex.src.offset = 0; \ + (pGeometry)->f.vertex.mask.type = GLITZ_DATA_TYPE_FLOAT; \ + (pGeometry)->f.vertex.mask.size = GLITZ_COORDINATE_SIZE_X; \ + (pGeometry)->f.vertex.mask.offset = 0; \ + } \ + else \ + { \ + (pGeometry)->width = 0; \ + (pGeometry)->f.bitmap.scanline_order = \ + GLITZ_PIXEL_SCANLINE_ORDER_TOP_DOWN; \ + (pGeometry)->f.bitmap.bytes_per_line = 0; \ + (pGeometry)->f.bitmap.pad = GLYPHPADBYTES; \ + } \ + if (_size) \ + xglGeometryResize (pScreen, pGeometry, _size); \ + } + +#define GEOMETRY_UNINIT(pGeometry) \ + { \ + if ((pGeometry)->array) \ + glitz_multi_array_destroy ((pGeometry)->array); \ + if ((pGeometry)->buffer) \ + glitz_buffer_destroy ((pGeometry)->buffer); \ + if ((pGeometry)->data) \ + xfree ((pGeometry)->data); \ + } + +#define GEOMETRY_SET_BUFFER(pGeometry, _buffer) \ + { \ + glitz_buffer_reference (_buffer); \ + if ((pGeometry)->buffer) \ + glitz_buffer_destroy ((pGeometry)->buffer); \ + (pGeometry)->buffer = _buffer; \ + } + +#define GEOMETRY_SET_MULTI_ARRAY(pGeometry, _array) \ + { \ + glitz_multi_array_reference (_array); \ + if ((pGeometry)->array) \ + glitz_multi_array_destroy ((pGeometry)->array); \ + (pGeometry)->array = _array; \ + } + +#define GEOMETRY_RESIZE(pScreen, pGeometry, size) \ + xglGeometryResize (pScreen, pGeometry, size) + +#define GEOMETRY_SET_TRANSLATE(pGeometry, _x, _y) \ + { \ + (pGeometry)->xOff = (_x) << 16; \ + (pGeometry)->yOff = (_y) << 16; \ + } + +#define GEOMETRY_TRANSLATE(pGeometry, tx, ty) \ + { \ + (pGeometry)->xOff += (tx) << 16; \ + (pGeometry)->yOff += (ty) << 16; \ + } + +#define GEOMETRY_TRANSLATE_FIXED(pGeometry, ftx, fty) \ + { \ + (pGeometry)->xOff += (ftx); \ + (pGeometry)->yOff += (fty); \ + } + +#define GEOMETRY_SET_VERTEX_PRIMITIVE(pGeometry, _primitive) \ + (pGeometry)->f.vertex.primitive = _primitive + +#define GEOMETRY_SET_VERTEX_DATA_TYPE(pGeometry, _type) \ + { \ + (pGeometry)->dataType = _type; \ + (pGeometry)->f.vertex.type = xglGeometryDataTypes[_type].type; \ + (pGeometry)->f.vertex.bytes_per_vertex = (pGeometry)->width * \ + xglGeometryDataTypes[_type].size; \ + } + +#define GEOMETRY_ADD_BOX(pScreen, pGeometry, pBox, nBox) \ + xglGeometryAddBox (pScreen, pGeometry, pBox, nBox, \ + (pGeometry)->endOffset) + +#define GEOMETRY_ADD_REGION_AT(pScreen, pGeometry, pRegion, offset) \ + xglGeometryAddBox (pScreen, pGeometry, \ + REGION_RECTS (pRegion), \ + REGION_NUM_RECTS (pRegion), \ + offset) + +#define GEOMETRY_ADD_REGION(pScreen, pGeometry, pRegion) \ + xglGeometryAddBox (pScreen, pGeometry, \ + REGION_RECTS (pRegion), \ + REGION_NUM_RECTS (pRegion), \ + (pGeometry)->endOffset) + +#define GEOMETRY_ADD_SPAN(pScreen, pGeometry, ppt, pwidth, n) \ + xglGeometryAddSpan (pScreen, pGeometry, ppt, pwidth, n, \ + (pGeometry)->endOffset) + +#define GEOMETRY_ADD_LINE(pScreen, pGeometry, loop, mode, npt, ppt) \ + xglGeometryAddLine (pScreen, pGeometry, loop, mode, npt, ppt, \ + (pGeometry)->endOffset) + +#define GEOMETRY_ADD_SEGMENT(pScreen, pGeometry, nsegInit, pSegInit) \ + xglGeometryAddSegment (pScreen, pGeometry, nsegInit, pSegInit, \ + (pGeometry)->endOffset) + +#define GEOMETRY_FOR_GLYPH(pScreen, pGeometry, nGlyph, ppciInit, pglyphBase) \ + xglGeometryForGlyph (pScreen, pGeometry, nGlyph, ppciInit, pglyphBase); + +#define GEOMETRY_ADD_TRAPEZOID(pScreen, pGeometry, pTrap, nTrap) \ + xglGeometryAddTrapezoid (pScreen, pGeometry, pTrap, nTrap, \ + (pGeometry)->endOffset) + +#define GEOMETRY_ADD_TRAP(pScreen, pGeometry, pTrap, nTrap) \ + xglGeometryAddTrap (pScreen, pGeometry, pTrap, nTrap, \ + (pGeometry)->endOffset) + +#define GEOMETRY_GET_FORMAT(pGeometry, format) \ + xglGeometryGetFormat (pGeometry, format) + +#define GEOMETRY_ENABLE(pGeometry, surface) \ + xglSetGeometry (pGeometry, surface) + +#define GEOMETRY_DISABLE(surface) \ + glitz_set_geometry (surface, GLITZ_GEOMETRY_TYPE_NONE, NULL, NULL) + +void +xglGeometryResize (ScreenPtr pScreen, + xglGeometryPtr pGeometry, + int size); + +void +xglGeometryAddBox (ScreenPtr pScreen, + xglGeometryPtr pGeometry, + BoxPtr pBox, + int nBox, + int offset); + +void +xglGeometryAddSpan (ScreenPtr pScreen, + xglGeometryPtr pGeometry, + DDXPointPtr ppt, + int *pwidth, + int n, + int offset); + +void +xglGeometryAddLine (ScreenPtr pScreen, + xglGeometryPtr pGeometry, + int loop, + int mode, + int npt, + DDXPointPtr ppt, + int offset); + +void +xglGeometryAddSegment (ScreenPtr pScreen, + xglGeometryPtr pGeometry, + int nsegInit, + xSegment *pSegInit, + int offset); + +void +xglGeometryForGlyph (ScreenPtr pScreen, + xglGeometryPtr pGeometry, + unsigned int nGlyph, + CharInfoPtr *ppciInit, + pointer pglyphBase); + +void +xglGeometryAddTrapezoid (ScreenPtr pScreen, + xglGeometryPtr pGeometry, + xTrapezoid *pTrap, + int nTrap, + int offset); + +void +xglGeometryAddTrap (ScreenPtr pScreen, + xglGeometryPtr pGeometry, + xTrap *pTrap, + int nTrap, + int offset); + +xglGeometryPtr +xglGetScratchGeometryWithSize (ScreenPtr pScreen, + int size); + +xglGeometryPtr +xglGetScratchVertexGeometryWithType (ScreenPtr pScreen, + int type, + int count); + +xglGeometryPtr +xglGetScratchVertexGeometry (ScreenPtr pScreen, + int count); + +Bool +xglSetGeometry (xglGeometryPtr pGeometry, + glitz_surface_t *surface); + + +/* xglpixmap.c */ + +#define XGL_PIXMAP_USAGE_HINT_STREAM_DRAW 1 +#define XGL_PIXMAP_USAGE_HINT_STREAM_READ 2 +#define XGL_PIXMAP_USAGE_HINT_STREAM_COPY 3 +#define XGL_PIXMAP_USAGE_HINT_STATIC_DRAW 4 +#define XGL_PIXMAP_USAGE_HINT_STATIC_READ 5 +#define XGL_PIXMAP_USAGE_HINT_STATIC_COPY 6 +#define XGL_PIXMAP_USAGE_HINT_DYNAMIC_DRAW 7 +#define XGL_PIXMAP_USAGE_HINT_DYNAMIC_READ 8 +#define XGL_PIXMAP_USAGE_HINT_DYNAMIC_COPY 9 + +#define XGL_PIXMAP_USAGE_HINT_DEFAULT XGL_PIXMAP_USAGE_HINT_STREAM_DRAW + +PixmapPtr +xglCreatePixmap (ScreenPtr pScreen, + int width, + int height, + int depth, + unsigned usage_hint); + +void +xglFiniPixmap (PixmapPtr pPixmap); + +Bool +xglDestroyPixmap (PixmapPtr pPixmap); + +Bool +xglModifyPixmapHeader (PixmapPtr pPixmap, + int width, + int height, + int depth, + int bitsPerPixel, + int devKind, + pointer pPixData); + +void +xglSetPixmapVisual (PixmapPtr pPixmap, + xglVisualPtr pVisual); + +RegionPtr +xglPixmapToRegion (PixmapPtr pPixmap); + +xglGeometryPtr +xglPixmapToGeometry (PixmapPtr pPixmap, + int xOff, + int yOff); + +Bool +xglCreatePixmapSurface (PixmapPtr pPixmap); + +Bool +xglAllocatePixmapBits (PixmapPtr pPixmap, int hint); + +Bool +xglMapPixmapBits (PixmapPtr pPixmap); + +Bool +xglUnmapPixmapBits (PixmapPtr pPixmap); + +Bool +xglCheckPixmapSize (PixmapPtr pPixmap, + xglSizeConstraintPtr pSize); + +void +xglEnablePixmapAccel (PixmapPtr pPixmap, + xglAccelInfoPtr pAccel); + + +/* xglsync.c */ + +Bool +xglSyncBits (DrawablePtr pDrawable, + BoxPtr pExtents); + +void +xglSyncDamageBoxBits (DrawablePtr pDrawable); + +Bool +xglSyncSurface (DrawablePtr pDrawable); + +Bool +xglPrepareTarget (DrawablePtr pDrawable); + +void +xglAddSurfaceDamage (DrawablePtr pDrawable, + RegionPtr pRegion); + +void +xglAddCurrentSurfaceDamage (DrawablePtr pDrawable); + +void +xglAddBitDamage (DrawablePtr pDrawable, + RegionPtr pRegion); + +void +xglAddCurrentBitDamage (DrawablePtr pDrawable); + + +/* xglsolid.c */ + +Bool +xglSolid (DrawablePtr pDrawable, + glitz_operator_t op, + glitz_surface_t *solid, + xglGeometryPtr pGeometry, + int x, + int y, + int width, + int height, + BoxPtr pBox, + int nBox); + +Bool +xglSolidGlyph (DrawablePtr pDrawable, + GCPtr pGC, + int x, + int y, + unsigned int nGlyph, + CharInfoPtr *ppci, + pointer pglyphBase); + + +/* xgltile.c */ + +xglGeometryPtr +xglTiledBoxGeometry (PixmapPtr pTile, + int tileX, + int tileY, + BoxPtr pBox, + int nBox); + +Bool +xglTile (DrawablePtr pDrawable, + glitz_operator_t op, + PixmapPtr pTile, + int tileX, + int tileY, + xglGeometryPtr pGeometry, + int x, + int y, + int width, + int height, + BoxPtr pBox, + int nBox); + + +/* xglcopy.c */ + +Bool +xglCopy (DrawablePtr pSrc, + DrawablePtr pDst, + int dx, + int dy, + BoxPtr pBox, + int nBox); + +void +xglCopyProc (DrawablePtr pSrc, + DrawablePtr pDst, + GCPtr pGC, + BoxPtr pBox, + int nBox, + int dx, + int dy, + Bool reverse, + Bool upsidedown, + Pixel bitplane, + void *closure); + + +/* xglfill.c */ + +Bool +xglFill (DrawablePtr pDrawable, + GCPtr pGC, + xglGeometryPtr pGeometry, + int x, + int y, + int width, + int height, + BoxPtr pBox, + int nBox); + +void +xglFillSpan (DrawablePtr pDrawable, + GCPtr pGC, + int n, + DDXPointPtr ppt, + int *pwidth); + +void +xglFillRect (DrawablePtr pDrawable, + GCPtr pGC, + int nrect, + xRectangle *prect); + +Bool +xglFillLine (DrawablePtr pDrawable, + GCPtr pGC, + int mode, + int npt, + DDXPointPtr ppt); + +Bool +xglFillSegment (DrawablePtr pDrawable, + GCPtr pGC, + int nsegInit, + xSegment *pSegInit); + +Bool +xglFillGlyph (DrawablePtr pDrawable, + GCPtr pGC, + int x, + int y, + unsigned int nglyph, + CharInfoPtr *ppciInit, + pointer pglyphBase); + + +/* xglwindow.c */ + +Bool +xglCreateWindow (WindowPtr pWin); + +Bool +xglDestroyWindow (WindowPtr pWin); + +Bool +xglChangeWindowAttributes (WindowPtr pWin, + unsigned long mask); + +void +xglCopyWindow (WindowPtr pWin, + DDXPointRec ptOldOrg, + RegionPtr prgnSrc); + +PixmapPtr +xglGetWindowPixmap (WindowPtr pWin); + +void +xglSetWindowPixmap (WindowPtr pWin, + PixmapPtr pPixmap); + + +/* xglget.c */ + +void +xglGetImage (DrawablePtr pDrawable, + int x, + int y, + int w, + int h, + unsigned int format, + unsigned long planeMask, + char *d); + +void +xglGetSpans (DrawablePtr pDrawable, + int wMax, + DDXPointPtr ppt, + int *pwidth, + int nspans, + char *pchardstStart); + + +/* xglgc.c */ + +Bool +xglCreateGC (GCPtr pGC); + +void +xglDestroyGC (GCPtr pGC); + +void +xglValidateGC (GCPtr pGC, + unsigned long changes, + DrawablePtr pDrawable); + +void +xglFillSpans (DrawablePtr pDrawable, + GCPtr pGC, + int nspans, + DDXPointPtr ppt, + int *pwidth, + int fSorted); + +void +xglSetSpans (DrawablePtr pDrawable, + GCPtr pGC, + char *psrc, + DDXPointPtr ppt, + int *pwidth, + int nspans, + int fSorted); + +void +xglPutImage (DrawablePtr pDrawable, + GCPtr pGC, + int depth, + int x, + int y, + int w, + int h, + int leftPad, + int format, + char *bits); + +RegionPtr +xglCopyArea (DrawablePtr pSrc, + DrawablePtr pDst, + GCPtr pGC, + int srcX, + int srcY, + int w, + int h, + int dstX, + int dstY); + +RegionPtr +xglCopyPlane (DrawablePtr pSrc, + DrawablePtr pDst, + GCPtr pGC, + int srcX, + int srcY, + int w, + int h, + int dstX, + int dstY, + unsigned long bitPlane); + +void +xglPolyPoint (DrawablePtr pDrawable, + GCPtr pGC, + int mode, + int npt, + DDXPointPtr pptInit); + +void +xglPolylines (DrawablePtr pDrawable, + GCPtr pGC, + int mode, + int npt, + DDXPointPtr ppt); + +void +xglPolySegment (DrawablePtr pDrawable, + GCPtr pGC, + int nsegInit, + xSegment *pSegInit); + +void +xglPolyArc (DrawablePtr pDrawable, + GCPtr pGC, + int narcs, + xArc *pArcs); + +void +xglPolyFillRect (DrawablePtr pDrawable, + GCPtr pGC, + int nrect, + xRectangle *prect); + +void +xglPolyFillArc (DrawablePtr pDrawable, + GCPtr pGC, + int narcs, + xArc *pArcs); + +void +xglImageGlyphBlt (DrawablePtr pDrawable, + GCPtr pGC, + int x, + int y, + unsigned int nglyph, + CharInfoPtr *ppci, + pointer pglyphBase); + +void +xglPolyGlyphBlt (DrawablePtr pDrawable, + GCPtr pGC, + int x, + int y, + unsigned int nglyph, + CharInfoPtr *ppci, + pointer pglyphBase); +void +xglPushPixels (GCPtr pGC, + PixmapPtr pBitmap, + DrawablePtr pDrawable, + int w, + int h, + int x, + int y); + + +#ifdef MITSHM + +/* xglshm.c */ + +void +xglShmPutImage (DrawablePtr pDrawable, + GCPtr pGC, + int depth, + unsigned int format, + int w, + int h, + int sx, + int sy, + int sw, + int sh, + int dx, + int dy, + char *data); + +#endif + + +#ifdef RENDER + +/* xglpict.c */ + +void +xglComposite (CARD8 op, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height); + +void +xglAddTriangles (PicturePtr pDst, + INT16 xOff, + INT16 yOff, + int ntri, + xTriangle *tris); + +void +xglChangePicture (PicturePtr pPicture, + Mask mask); + +int +xglChangePictureTransform (PicturePtr pPicture, + PictTransform *transform); + +int +xglChangePictureFilter (PicturePtr pPicture, + int filter, + xFixed *params, + int nparams); + +PicturePtr +xglCreateDevicePicture (pointer data); + +Bool +xglSyncPicture (ScreenPtr pScreen, + PicturePtr pPicture, + INT16 x, + INT16 y, + CARD16 width, + CARD16 height, + INT16 *xOff, + INT16 *yOff); + +Bool +xglPictureInit (ScreenPtr pScreen); + +void +xglPictureClipExtents (PicturePtr pPicture, + BoxPtr extents); + + +/* xglcompose.c */ + +Bool +xglCompositeGeneral (CARD8 op, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + xglGeometryPtr pGeometry, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height); + + +/* xglglyph.c */ + +Bool +xglRealizeGlyph (ScreenPtr pScreen, + GlyphPtr pGlyph); + +void +xglUnrealizeGlyph (ScreenPtr pScreen, + GlyphPtr pGlyph); + +Bool +xglInitGlyphCache (xglGlyphCachePtr pCache, + ScreenPtr pScreen, + PictFormatPtr format); + +void +xglFiniGlyphCache (xglGlyphCachePtr pCache); + +void +xglGlyphs (CARD8 op, + PicturePtr pSrc, + PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, + INT16 ySrc, + int nlist, + GlyphListPtr list, + GlyphPtr *glyphs); + + +/* xgltrap.c */ + +void +xglTrapezoids (CARD8 op, + PicturePtr pSrc, + PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, + INT16 ySrc, + int nTrap, + xTrapezoid *traps); + +void +xglAddTraps (PicturePtr pDst, + INT16 xOff, + INT16 yOff, + int nTrap, + xTrap *traps); + +#endif + +#ifdef XGL_MODULAR + +/* xglloader.c */ + +typedef struct _xglSymbol { + void **ptr; + const char *name; +} xglSymbolRec, *xglSymbolPtr; + +void * +xglLoadModule (const char *name, + int flag); + +void +xglUnloadModule (void *handle); + +Bool +xglLookupSymbols (void *handle, + xglSymbolPtr sym, + int nSym); + +#endif + + +/* xglxv.c */ + +#ifdef XV + +Bool +xglXvScreenInit (ScreenPtr pScreen); + +#endif + + +/* xglhash.c */ + +typedef struct _xglHashTable *xglHashTablePtr; + +Bool +xglLoadHashFuncs (void *handle); + +xglHashTablePtr +xglNewHashTable (void); + +void +xglDeleteHashTable (xglHashTablePtr pTable); + +void * +xglHashLookup (const xglHashTablePtr pTable, + unsigned int key); + +void +xglHashInsert (xglHashTablePtr pTable, + unsigned int key, + void *data); + +void +xglHashRemove (xglHashTablePtr pTable, + unsigned int key); + +unsigned int +xglHashFirstEntry (xglHashTablePtr pTable); + +unsigned int +xglHashNextEntry (const xglHashTablePtr pTable, + unsigned int key); + +unsigned int +xglHashFindFreeKeyBlock (xglHashTablePtr pTable, + unsigned int numKeys); + +#endif /* _XGL_H_ */ diff --git a/xorg-server/hw/xgl/xglarea.c b/xorg-server/hw/xgl/xglarea.c new file mode 100644 index 000000000..cdf652d0f --- /dev/null +++ b/xorg-server/hw/xgl/xglarea.c @@ -0,0 +1,323 @@ +/* + * Copyright © 2005 Novell, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * Novell, Inc. not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * Novell, Inc. makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#include "xgl.h" + +static Bool +xglAreaMoveIn (xglAreaPtr pArea, + pointer closure) +{ + pArea->closure = closure; + pArea->state = xglAreaOccupied; + + return (*pArea->pRoot->funcs->MoveIn) (pArea, closure); +} + +static void +xglAreaMoveOut (xglAreaPtr pArea) +{ + (*pArea->pRoot->funcs->MoveOut) (pArea, pArea->closure); + + pArea->closure = (pointer) 0; + pArea->state = xglAreaAvailable; +} + +static xglAreaPtr +xglAreaCreate (xglRootAreaPtr pRoot, + int level, + int x, + int y, + int width, + int height) +{ + xglAreaPtr pArea; + int n = 4; + + pArea = xalloc (sizeof (xglAreaRec) + pRoot->devPrivateSize); + if (!pArea) + return NULL; + + pArea->level = level; + pArea->x = x; + pArea->y = y; + pArea->width = width; + pArea->height = height; + pArea->pRoot = pRoot; + pArea->closure = (pointer) 0; + pArea->state = xglAreaAvailable; + + while (n--) + pArea->pArea[n] = NULL; + + if (pRoot->devPrivateSize) + pArea->devPrivate.ptr = pArea + 1; + else + pArea->devPrivate.ptr = (pointer) 0; + + if (!(*pArea->pRoot->funcs->Create) (pArea)) + { + free (pArea); + return NULL; + } + + return pArea; +} + +static void +xglAreaDestroy (xglAreaPtr pArea) +{ + if (!pArea) + return; + + if (pArea->state == xglAreaOccupied) + { + xglAreaMoveOut (pArea); + } + else + { + int n = 4; + + while (n--) + xglAreaDestroy (pArea->pArea[n]); + } + + xfree (pArea); +} + +static xglAreaPtr +xglAreaGetTopScoredSubArea (xglAreaPtr pArea) +{ + if (!pArea) + return NULL; + + switch (pArea->state) { + case xglAreaOccupied: + return pArea; + case xglAreaAvailable: + break; + case xglAreaDivided: { + xglAreaPtr tmp, top = NULL; + int i; + + for (i = 0; i < 4; i++) + { + tmp = xglAreaGetTopScoredSubArea (pArea->pArea[i]); + if (tmp && top) + { + if ((*pArea->pRoot->funcs->CompareScore) (tmp, + tmp->closure, + top->closure) > 0) + top = tmp; + } + else if (tmp) + { + top = tmp; + } + } + return top; + } + } + + return NULL; +} + +static Bool +xglAreaFind (xglAreaPtr pArea, + int width, + int height, + Bool kickOut, + pointer closure) +{ + if (pArea->width < width || pArea->height < height) + return FALSE; + + switch (pArea->state) { + case xglAreaOccupied: + if (kickOut) + { + if ((*pArea->pRoot->funcs->CompareScore) (pArea, + pArea->closure, + closure) >= 0) + return FALSE; + + xglAreaMoveOut (pArea); + } else + return FALSE; + + /* fall-through */ + case xglAreaAvailable: + { + if (pArea->level == pArea->pRoot->maxLevel || + (pArea->width == width && pArea->height == height)) + { + if (xglAreaMoveIn (pArea, closure)) + return TRUE; + } + else + { + int dx[4], dy[4], w[4], h[4], i; + + dx[0] = dx[2] = dy[0] = dy[1] = 0; + + w[0] = w[2] = dx[1] = dx[3] = width; + h[0] = h[1] = dy[2] = dy[3] = height; + + w[1] = w[3] = pArea->width - width; + h[2] = h[3] = pArea->height - height; + + for (i = 0; i < 2; i++) + { + if (w[i]) + pArea->pArea[i] = + xglAreaCreate (pArea->pRoot, + pArea->level + 1, + pArea->x + dx[i], + pArea->y + dy[i], + w[i], h[i]); + } + + for (; i < 4; i++) + { + if (w[i] && h[i]) + pArea->pArea[i] = + xglAreaCreate (pArea->pRoot, + pArea->level + 1, + pArea->x + dx[i], + pArea->y + dy[i], + w[i], h[i]); + } + + pArea->state = xglAreaDivided; + + if (xglAreaFind (pArea->pArea[0], width, height, kickOut, closure)) + return TRUE; + } + } break; + case xglAreaDivided: + { + xglAreaPtr topArea; + int i, rejected = FALSE; + + for (i = 0; i < 4; i++) + { + if (pArea->pArea[i]) + { + if (pArea->pArea[i]->width >= width && + pArea->pArea[i]->height >= height) + { + if (xglFindArea (pArea->pArea[i], width, height, kickOut, + closure)) + return TRUE; + + rejected = TRUE; + } + } + } + + if (rejected) + return FALSE; + + topArea = xglAreaGetTopScoredSubArea (pArea); + if (topArea) + { + if (kickOut) + { + if ((*pArea->pRoot->funcs->CompareScore) (topArea, + topArea->closure, + closure) >= 0) + return FALSE; + } else + return FALSE; + } + + for (i = 0; i < 4; i++) + { + xglAreaDestroy (pArea->pArea[i]); + pArea->pArea[i] = NULL; + } + + pArea->closure = (pointer) 0; + pArea->state = xglAreaAvailable; + if (xglFindArea (pArea, width, height, TRUE, closure)) + return TRUE; + + } break; + } + + return FALSE; +} + +Bool +xglRootAreaInit (xglRootAreaPtr pRoot, + int maxLevel, + int width, + int height, + int devPrivateSize, + xglAreaFuncsPtr funcs, + pointer closure) +{ + pRoot->maxLevel = maxLevel; + pRoot->funcs = funcs; + pRoot->devPrivateSize = devPrivateSize; + pRoot->closure = closure; + + pRoot->pArea = xglAreaCreate (pRoot, 0, 0, 0, width, height); + if (!pRoot->pArea) + return FALSE; + + return TRUE; +} + +void +xglRootAreaFini (xglRootAreaPtr pRoot) +{ + xglAreaDestroy (pRoot->pArea); +} + +void +xglLeaveArea (xglAreaPtr pArea) +{ + xglAreaMoveOut (pArea); +} + +void +xglWithdrawArea (xglAreaPtr pArea) +{ + pArea->closure = NULL; + pArea->state = xglAreaAvailable; +} + +Bool +xglFindArea (xglAreaPtr pArea, + int width, + int height, + Bool kickOut, + pointer closure) +{ + if (width < 1 || height < 0) + return FALSE; + + return xglAreaFind (pArea, width, height, kickOut, closure); +} diff --git a/xorg-server/hw/xgl/xglcmap.c b/xorg-server/hw/xgl/xglcmap.c new file mode 100644 index 000000000..b96308ddf --- /dev/null +++ b/xorg-server/hw/xgl/xglcmap.c @@ -0,0 +1,466 @@ +/* + * Copyright © 2004 David Reveman + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * David Reveman not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * David Reveman makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#include "xgl.h" +#include "colormapst.h" +#include "micmap.h" +#include "fb.h" + +static xglPixelFormatRec xglPixelFormats[] = { + { + 8, 8, + { + 8, + 0x000000ff, + 0x00000000, + 0x00000000, + 0x00000000 + } + }, { + 15, 5, + { + 16, + 0x00000000, + 0x00007c00, + 0x000003e0, + 0x0000001f + } + }, { + 16, 6, + { + 16, + 0x00000000, + 0x0000f800, + 0x000007e0, + 0x0000001f + } + }, { + 24, 8, + { + 32, + 0x00000000, + 0x00ff0000, + 0x0000ff00, + 0x000000ff + } + }, { + 32, 8, + { + 32, + 0xff000000, + 0x00ff0000, + 0x0000ff00, + 0x000000ff + } + } +}; + +#define NUM_XGL_PIXEL_FORMATS \ + (sizeof (xglPixelFormats) / sizeof (xglPixelFormats[0])) + +xglVisualPtr xglVisuals = NULL; + +void +xglSetVisualTypes (int depth, + int visuals, + int redSize, + int greenSize, + int blueSize) +{ + xglPixelFormatPtr pBestFormat = 0; + int i, rs, gs, bs, diff, bestDiff = 0; + + for (i = 0; i < NUM_XGL_PIXEL_FORMATS; i++) + { + if (xglPixelFormats[i].depth == depth) + { + if (visuals) + { + rs = Ones (xglPixelFormats[i].masks.red_mask); + gs = Ones (xglPixelFormats[i].masks.green_mask); + bs = Ones (xglPixelFormats[i].masks.blue_mask); + + if (redSize >= rs && + greenSize >= gs && + blueSize >= bs) + { + diff = (redSize - rs) + (greenSize - gs) + (blueSize - bs); + if (pBestFormat) + { + if (diff < bestDiff) + { + pBestFormat = &xglPixelFormats[i]; + bestDiff = diff; + } + } + else + { + pBestFormat = &xglPixelFormats[i]; + bestDiff = diff; + } + } + } + else + { + pBestFormat = &xglPixelFormats[i]; + break; + } + } + } + + if (pBestFormat) + { + xglVisualPtr new, *prev, v; + unsigned int bitsPerRGB; + Pixel rm, gm, bm; + + new = xalloc (sizeof (xglVisualRec)); + if (!new) + return; + + new->next = 0; + + new->format.surface = 0; + new->format.drawable = 0; + new->pPixel = pBestFormat; + new->vid = 0; + + bitsPerRGB = pBestFormat->bitsPerRGB; + + rm = pBestFormat->masks.red_mask; + gm = pBestFormat->masks.green_mask; + bm = pBestFormat->masks.blue_mask; + + fbSetVisualTypesAndMasks (depth, visuals, bitsPerRGB, rm, gm, bm); + + for (prev = &xglVisuals; (v = *prev); prev = &v->next); + *prev = new; + } + else + { + fbSetVisualTypesAndMasks (depth, 0, 0, 0, 0, 0); + } +} + +Bool +xglHasVisualTypes (xglVisualPtr pVisual, + int depth) +{ + xglVisualPtr v; + + for (v = pVisual; v; v = v->next) + if (v->pPixel->depth == depth) + return TRUE; + + return FALSE; +} + +glitz_format_t * +xglFindBestSurfaceFormat (ScreenPtr pScreen, + xglPixelFormatPtr pPixel) +{ + glitz_format_t templ, *format, *best = 0; + unsigned int mask; + unsigned short rs, gs, bs, as; + int i = 0; + + XGL_SCREEN_PRIV (pScreen); + + rs = Ones (pPixel->masks.red_mask); + gs = Ones (pPixel->masks.green_mask); + bs = Ones (pPixel->masks.blue_mask); + as = Ones (pPixel->masks.alpha_mask); + + templ.color.fourcc = GLITZ_FOURCC_RGB; + mask = GLITZ_FORMAT_FOURCC_MASK; + + do { + format = glitz_find_format (pScreenPriv->drawable, mask, &templ, i++); + if (format) + { + if (format->color.red_size >= rs && + format->color.green_size >= gs && + format->color.blue_size >= bs && + format->color.alpha_size >= as) + { + if (best) + { + if (((format->color.red_size - rs) + + (format->color.green_size - gs) + + (format->color.blue_size - bs)) < + ((best->color.red_size - rs) + + (best->color.green_size - gs) + + (best->color.blue_size - bs))) + best = format; + } + else + { + best = format; + } + } + } + } while (format); + + return best; +} + +static Bool +xglInitVisual (ScreenPtr pScreen, + xglVisualPtr pVisual, + xglPixelFormatPtr pPixel, + VisualID vid) +{ + glitz_format_t *format; + + XGL_SCREEN_PRIV (pScreen); + + format = xglFindBestSurfaceFormat (pScreen, pPixel); + if (format) + { + glitz_drawable_format_t templ; + unsigned long mask; + + templ.color = format->color; + templ.depth_size = 0; + templ.stencil_size = 0; + templ.doublebuffer = 0; + templ.samples = 1; + + mask = + GLITZ_FORMAT_FOURCC_MASK | + GLITZ_FORMAT_RED_SIZE_MASK | + GLITZ_FORMAT_GREEN_SIZE_MASK | + GLITZ_FORMAT_BLUE_SIZE_MASK | + GLITZ_FORMAT_ALPHA_SIZE_MASK | + GLITZ_FORMAT_DEPTH_SIZE_MASK | + GLITZ_FORMAT_STENCIL_SIZE_MASK | + GLITZ_FORMAT_DOUBLEBUFFER_MASK | + GLITZ_FORMAT_SAMPLES_MASK; + + pVisual->next = 0; + pVisual->vid = vid; + pVisual->pPixel = pPixel; + pVisual->pbuffer = FALSE; + + pVisual->format.surface = format; + pVisual->format.drawable = + glitz_find_drawable_format (pScreenPriv->drawable, + mask, &templ, 0); + + return TRUE; + } + + return FALSE; +} + +static Bool +xglInitPbufferVisual (ScreenPtr pScreen, + xglVisualPtr pVisual, + xglPixelFormatPtr pPixel, + VisualID vid) +{ + glitz_format_t *format; + + XGL_SCREEN_PRIV (pScreen); + + format = xglFindBestSurfaceFormat (pScreen, pPixel); + if (format) + { + glitz_drawable_format_t templ, *screenFormat; + unsigned long mask; + + /* use same drawable format as screen for pbuffers */ + screenFormat = glitz_drawable_get_format (pScreenPriv->drawable); + templ.id = screenFormat->id; + + templ.color = format->color; + templ.samples = 1; + + mask = + GLITZ_FORMAT_ID_MASK | + GLITZ_FORMAT_FOURCC_MASK | + GLITZ_FORMAT_RED_SIZE_MASK | + GLITZ_FORMAT_GREEN_SIZE_MASK | + GLITZ_FORMAT_BLUE_SIZE_MASK | + GLITZ_FORMAT_SAMPLES_MASK; + + pVisual->next = 0; + pVisual->vid = vid; + pVisual->pPixel = pPixel; + pVisual->pbuffer = TRUE; + + pVisual->format.surface = format; + pVisual->format.drawable = + glitz_find_pbuffer_format (pScreenPriv->drawable, + mask, &templ, 0); + + if (pVisual->format.drawable) + return TRUE; + } + + return FALSE; +} + +void +xglInitVisuals (ScreenPtr pScreen) +{ + xglVisualPtr pVisual, v, new, *prev; + int i; + + XGL_SCREEN_PRIV (pScreen); + + for (i = 0; i < pScreen->numVisuals; i++) + { + for (pVisual = xglVisuals; pVisual; pVisual = pVisual->next) + if (pVisual->pPixel->depth == pScreen->visuals[i].nplanes) + break; + + if (pVisual) + { + new = xalloc (sizeof (xglVisualRec)); + if (new) + { + if (xglInitVisual (pScreen, new, pVisual->pPixel, + pScreen->visuals[i].vid)) + { + new->next = 0; + + prev = &pScreenPriv->pVisual; + while ((v = *prev)) + prev = &v->next; + + *prev = new; + } + else + { + xfree (new); + } + } + + new = xalloc (sizeof (xglVisualRec)); + if (new) + { + if (xglInitPbufferVisual (pScreen, new, pVisual->pPixel, + pScreen->visuals[i].vid)) + { + new->next = 0; + + prev = &pScreenPriv->pVisual; + while ((v = *prev)) + prev = &v->next; + + *prev = new; + } + else + { + xfree (new); + } + } + } + } + + /* Add additional Xgl visuals for pixmap formats */ + for (i = 0; i < screenInfo.numPixmapFormats; i++) + { + if (!xglHasVisualTypes (pScreenPriv->pVisual, + screenInfo.formats[i].depth)) + { + for (v = xglVisuals; v; v = v->next) + if (v->pPixel->depth == screenInfo.formats[i].depth) + break; + + if (v) + { + new = xalloc (sizeof (xglVisualRec)); + if (new) + { + if (xglInitVisual (pScreen, new, v->pPixel, 0)) + { + new->next = 0; + + prev = &pScreenPriv->pVisual; + while ((v = *prev)) + prev = &v->next; + + *prev = new; + } + else + { + xfree (new); + } + } + } + } + } +} + +xglVisualPtr +xglFindVisualWithDepth (ScreenPtr pScreen, + int depth) +{ + xglVisualPtr v; + + XGL_SCREEN_PRIV (pScreen); + + for (v = pScreenPriv->pVisual; v; v = v->next) + { + if (v->pPixel->depth == depth) + return v; + } + + return 0; +} + +xglVisualPtr +xglFindVisualWithId (ScreenPtr pScreen, + int vid) +{ + xglVisualPtr v; + + XGL_SCREEN_PRIV (pScreen); + + for (v = pScreenPriv->pVisual; v; v = v->next) + { + if (v->vid == vid) + return v; + } + + return 0; +} + +void +xglClearVisualTypes (void) +{ + xglVisualPtr v; + + while (xglVisuals) + { + v = xglVisuals; + xglVisuals = v->next; + xfree (v); + } + + miClearVisualTypes (); +} diff --git a/xorg-server/hw/xgl/xglcompose.c b/xorg-server/hw/xgl/xglcompose.c new file mode 100644 index 000000000..34f7a0c43 --- /dev/null +++ b/xorg-server/hw/xgl/xglcompose.c @@ -0,0 +1,281 @@ +/* + * Copyright © 2004 David Reveman + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * David Reveman not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * David Reveman makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#include "xgl.h" + +#ifdef RENDER + +static glitz_operator_t xglOperators[] = { + GLITZ_OPERATOR_CLEAR, + GLITZ_OPERATOR_SRC, + GLITZ_OPERATOR_DST, + GLITZ_OPERATOR_OVER, + GLITZ_OPERATOR_OVER_REVERSE, + GLITZ_OPERATOR_IN, + GLITZ_OPERATOR_IN_REVERSE, + GLITZ_OPERATOR_OUT, + GLITZ_OPERATOR_OUT_REVERSE, + GLITZ_OPERATOR_ATOP, + GLITZ_OPERATOR_ATOP_REVERSE, + GLITZ_OPERATOR_XOR, + GLITZ_OPERATOR_ADD +}; + +#define NUM_XGL_OPERATORS \ + (sizeof (xglOperators) / sizeof (xglOperators[0])) + +#define XGL_OPERATOR(op) (xglOperators[op]) + +#define XGL_GET_SOURCE_PICTURE(pPicture, outSurface) \ + (outSurface) = ((pPicture)->pDrawable) ? \ + XGL_GET_PIXMAP_PRIV ((PixmapPtr) (pPicture)->pDrawable)->surface : \ + (glitz_surface_t *) (pPicture)->pSourcePict->source.devPrivate.ptr + +Bool +xglCompositeGeneral (CARD8 op, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + xglGeometryPtr pGeometry, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) +{ + ScreenPtr pScreen = pDst->pDrawable->pScreen; + INT16 xOff, yOff; + glitz_surface_t *src, *mask = NULL, *dst; + int dstXoff, dstYoff; + RegionRec region; + BoxPtr pBox, pExt; + int nBox; + + if (pDst->alphaMap) + return FALSE; + + if (op >= NUM_XGL_OPERATORS) + return FALSE; + + if (pSrc->pDrawable) + { + if (pSrc->pDrawable->type != DRAWABLE_PIXMAP) + return FALSE; + + if (pSrc->pDrawable->bitsPerPixel == 1) + return FALSE; + } + + if (pMask) + { + if (pMask->pDrawable) + { + if (pMask->pDrawable->type != DRAWABLE_PIXMAP) + return FALSE; + + if (pSrc->pDrawable == pMask->pDrawable && pSrc != pMask) + return FALSE; + } + } + + if (!xglPrepareTarget (pDst->pDrawable)) + return FALSE; + + if (!miComputeCompositeRegion (®ion, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, + xDst, yDst, width, height)) + return TRUE; + + pBox = REGION_RECTS (®ion); + nBox = REGION_NUM_RECTS (®ion); + pExt = REGION_EXTENTS (pScreen, ®ion); + + XGL_GET_DRAWABLE (pDst->pDrawable, dst, dstXoff, dstYoff); + + if (!xglSyncPicture (pScreen, pSrc, + pExt->x1 + xSrc - xDst, + pExt->y1 + ySrc - yDst, + pExt->x2 - pExt->x1, + pExt->y2 - pExt->y1, + &xOff, &yOff)) + { + REGION_UNINIT (pScreen, ®ion); + return FALSE; + } + + xSrc -= xOff; + ySrc -= yOff; + + XGL_GET_SOURCE_PICTURE (pSrc, src); + + if (pMask) + { + /* bitmap as mask */ + if (pMask->pDrawable && pMask->pDrawable->bitsPerPixel == 1) + { + if (pGeometry) + { + REGION_UNINIT (pScreen, ®ion); + return FALSE; + } + + pGeometry = xglPixmapToGeometry ((PixmapPtr) pMask->pDrawable, + xDst - xMask, + yDst - yMask); + if (!pGeometry) + { + REGION_UNINIT (pScreen, ®ion); + return FALSE; + } + } + else + { + if (!xglSyncPicture (pScreen, pMask, + pExt->x1 + xMask - xDst, + pExt->y1 + yMask - yDst, + pExt->x2 - pExt->x1, + pExt->y2 - pExt->y1, + &xOff, &yOff)) + { + REGION_UNINIT (pScreen, ®ion); + return FALSE; + } + + xMask -= xOff; + yMask -= yOff; + + XGL_GET_SOURCE_PICTURE (pMask, mask); + } + } + + if (!pGeometry) + { + if (!pSrc->transform && pSrc->filter != PictFilterConvolution) + { + if (pSrc->pDrawable && pSrc->repeatType == RepeatNormal) + { + XGL_PIXMAP_PRIV ((PixmapPtr) pSrc->pDrawable); + + /* tile */ + if (!pPixmapPriv->acceleratedTile) + { + pGeometry = + xglTiledBoxGeometry ((PixmapPtr) pSrc->pDrawable, + xSrc - xDst, ySrc - yDst, + pBox, nBox); + if (!pGeometry) + { + REGION_UNINIT (pScreen, ®ion); + return FALSE; + } + + pBox = pExt; + nBox = 1; + } + } + else + { + /* copy */ + if (op == PictOpSrc && !mask) + { + if (xglCopy (pSrc->pDrawable, + pDst->pDrawable, + xSrc - xDst, + ySrc - yDst, + pBox, + nBox)) + { + REGION_UNINIT (pScreen, ®ion); + return TRUE; + } + } + } + } + + if (nBox > 1) + { + pGeometry = xglGetScratchVertexGeometry (pScreen, 4 * nBox); + + GEOMETRY_ADD_BOX (pScreen, pGeometry, pBox, nBox); + + pBox = pExt; + } + + xSrc += pBox->x1 - xDst; + ySrc += pBox->y1 - yDst; + + if (pMask) + { + xMask += pBox->x1 - xDst; + yMask += pBox->y1 - yDst; + } + + xDst = pBox->x1; + yDst = pBox->y1; + + width = pBox->x2 - pBox->x1; + height = pBox->y2 - pBox->y1; + } + else + { + glitz_surface_set_clip_region (dst, + dstXoff, dstYoff, + (glitz_box_t *) pBox, nBox); + } + + if (pGeometry) + { + GEOMETRY_TRANSLATE (pGeometry, dstXoff, dstYoff); + + if (!GEOMETRY_ENABLE (pGeometry, dst)) + { + REGION_UNINIT (pScreen, ®ion); + return FALSE; + } + } + else + GEOMETRY_DISABLE (dst); + + glitz_composite (XGL_OPERATOR (op), + src, mask, dst, + xSrc, ySrc, + xMask, yMask, + xDst + dstXoff, yDst + dstYoff, + width, height); + + glitz_surface_set_clip_region (dst, 0, 0, NULL, 0); + + REGION_UNINIT (pScreen, ®ion); + + if (glitz_surface_get_status (dst)) + return FALSE; + + return TRUE; +} + +#endif diff --git a/xorg-server/hw/xgl/xglcopy.c b/xorg-server/hw/xgl/xglcopy.c new file mode 100644 index 000000000..d612b332a --- /dev/null +++ b/xorg-server/hw/xgl/xglcopy.c @@ -0,0 +1,130 @@ +/* + * Copyright © 2004 David Reveman + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * David Reveman not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * David Reveman makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#include "xgl.h" +#include "fb.h" + +Bool +xglCopy (DrawablePtr pSrc, + DrawablePtr pDst, + int dx, + int dy, + BoxPtr pBox, + int nBox) +{ + glitz_surface_t *src, *dst; + int srcXoff, srcYoff; + int dstXoff, dstYoff; + + XGL_DRAWABLE_PIXMAP (pDst); + + if (!nBox) + return TRUE; + + if (xglPrepareTarget (pDst)) + { + if (!xglSyncSurface (pSrc)) + return FALSE; + } + else + { + if (!xglPrepareTarget (pSrc)) + return FALSE; + + if (!xglSyncSurface (pDst)) + return FALSE; + } + + XGL_GET_DRAWABLE (pSrc, src, srcXoff, srcYoff); + XGL_GET_DRAWABLE (pDst, dst, dstXoff, dstYoff); + + glitz_surface_set_clip_region (dst, + dstXoff, dstYoff, + (glitz_box_t *) pBox, nBox); + + glitz_copy_area (src, + dst, + srcXoff + dx, + srcYoff + dy, + pPixmap->drawable.width - dstXoff, + pPixmap->drawable.height - dstYoff, + dstXoff, + dstYoff); + + glitz_surface_set_clip_region (dst, 0, 0, NULL, 0); + + if (glitz_surface_get_status (dst)) + return FALSE; + + return TRUE; +} + +void +xglCopyProc (DrawablePtr pSrc, + DrawablePtr pDst, + GCPtr pGC, + BoxPtr pBox, + int nBox, + int dx, + int dy, + Bool reverse, + Bool upsidedown, + Pixel bitplane, + void *closure) +{ + BoxPtr pSrcBox = (BoxPtr) closure; + + if (!xglCopy (pSrc, pDst, dx, dy, pBox, nBox)) + { + RegionRec region; + + XGL_DRAWABLE_PIXMAP (pDst); + XGL_PIXMAP_PRIV (pPixmap); + + if (!xglSyncBits (pSrc, pSrcBox)) + FatalError (XGL_SW_FAILURE_STRING); + + if (!xglMapPixmapBits (pPixmap)) + FatalError (XGL_SW_FAILURE_STRING); + + fbCopyNtoN (pSrc, pDst, pGC, + pBox, nBox, + dx, dy, + reverse, upsidedown, bitplane, + (void *) 0); + + pPixmapPriv->damageBox = miEmptyBox; + + while (nBox--) + { + REGION_INIT (pDst->pScreen, ®ion, pBox, 1); + xglAddSurfaceDamage (pDst, ®ion); + REGION_UNINIT (pDst->pScreen, ®ion); + + pBox++; + } + } else + xglAddCurrentBitDamage (pDst); +} diff --git a/xorg-server/hw/xgl/xglfill.c b/xorg-server/hw/xgl/xglfill.c new file mode 100644 index 000000000..64759ab2e --- /dev/null +++ b/xorg-server/hw/xgl/xglfill.c @@ -0,0 +1,742 @@ +/* + * Copyright © 2004 David Reveman + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * David Reveman not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * David Reveman makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#include "xgl.h" +#include "gcstruct.h" +#include "fb.h" + +Bool +xglFill (DrawablePtr pDrawable, + GCPtr pGC, + xglGeometryPtr pGeometry, + int x, + int y, + int width, + int height, + BoxPtr pBox, + int nBox) +{ + XGL_GC_PRIV (pGC); + + switch (pGC->fillStyle) { + case FillSolid: + if (xglSolid (pDrawable, + pGCPriv->op, pGCPriv->fg, + pGeometry, + x, y, + width, height, + pBox, nBox)) + return TRUE; + break; + case FillStippled: + case FillOpaqueStippled: + break; + case FillTiled: + if (xglTile (pDrawable, + pGCPriv->op, pGC->tile.pixmap, + -(pGC->patOrg.x + pDrawable->x), + -(pGC->patOrg.y + pDrawable->y), + pGeometry, + x, y, + width, height, + pBox, nBox)) + return TRUE; + break; + } + + return FALSE; +} + +static void +xglFillBox (DrawablePtr pDrawable, + GCPtr pGC, + int x, + int y, + int width, + int height, + BoxPtr pBox, + int nBox) +{ + if (!nBox) + return; + + if (!xglFill (pDrawable, pGC, NULL, x, y, width, height, pBox, nBox)) + { + RegionRec region; + + XGL_DRAWABLE_PIXMAP (pDrawable); + XGL_PIXMAP_PRIV (pPixmap); + + if (!xglMapPixmapBits (pPixmap)) + FatalError (XGL_SW_FAILURE_STRING); + + switch (pGC->fillStyle) { + case FillSolid: + break; + case FillStippled: + case FillOpaqueStippled: + if (!xglSyncBits (&pGC->stipple->drawable, NullBox)) + FatalError (XGL_SW_FAILURE_STRING); + break; + case FillTiled: + if (!xglSyncBits (&pGC->tile.pixmap->drawable, NullBox)) + FatalError (XGL_SW_FAILURE_STRING); + break; + } + + pPixmapPriv->damageBox = miEmptyBox; + + while (nBox--) + { + fbFill (pDrawable, pGC, + pBox->x1, pBox->y1, + pBox->x2 - pBox->x1, pBox->y2 - pBox->y1); + + REGION_INIT (pDrawable->pScreen, ®ion, pBox, 1); + xglAddSurfaceDamage (pDrawable, ®ion); + REGION_UNINIT (pDrawable->pScreen, ®ion); + + pBox++; + } + } else + xglAddCurrentBitDamage (pDrawable); +} + +#define N_STACK_BOX 1024 + +static BoxPtr +xglMoreBoxes (BoxPtr stackBox, + BoxPtr heapBox, + int nBoxes) +{ + Bool stack = !heapBox; + + heapBox = xrealloc (heapBox, sizeof (BoxRec) * nBoxes); + if (!heapBox) + return NULL; + + if (stack) + memcpy (heapBox, stackBox, sizeof (BoxRec) * N_STACK_BOX); + + return heapBox; +} + +#define ADD_BOX(pBox, nBox, stackBox, heapBox, size, box) \ + { \ + if ((nBox) == (size)) \ + { \ + (size) *= 2; \ + (heapBox) = xglMoreBoxes (stackBox, heapBox, size); \ + if (heapBox) \ + { \ + (pBox) = (heapBox) + (nBox); \ + *(pBox)++ = (box); \ + (nBox)++; \ + } \ + } \ + else \ + { \ + *(pBox)++ = (box); \ + (nBox)++; \ + } \ + } + +void +xglFillRect (DrawablePtr pDrawable, + GCPtr pGC, + int nrect, + xRectangle *prect) +{ + RegionPtr pClip = pGC->pCompositeClip; + BoxPtr pClipBox; + BoxPtr pExtent = REGION_EXTENTS (pGC->pScreen, pClip); + BoxRec part, full; + BoxPtr heapBox = NULL; + BoxRec stackBox[N_STACK_BOX]; + int size = N_STACK_BOX; + BoxPtr pBox = stackBox; + int nClip, nBox = 0; + + while (nrect--) + { + full.x1 = prect->x + pDrawable->x; + full.y1 = prect->y + pDrawable->y; + full.x2 = full.x1 + (int) prect->width; + full.y2 = full.y1 + (int) prect->height; + + prect++; + + if (full.x1 < pExtent->x1) + full.x1 = pExtent->x1; + if (full.y1 < pExtent->y1) + full.y1 = pExtent->y1; + if (full.x2 > pExtent->x2) + full.x2 = pExtent->x2; + if (full.y2 > pExtent->y2) + full.y2 = pExtent->y2; + + if (full.x1 >= full.x2 || full.y1 >= full.y2) + continue; + + nClip = REGION_NUM_RECTS (pClip); + if (nClip == 1) + { + ADD_BOX (pBox, nBox, stackBox, heapBox, size, full); + } + else + { + pClipBox = REGION_RECTS (pClip); + while (nClip--) + { + part = *pClipBox++; + + if (part.x1 < full.x1) + part.x1 = full.x1; + if (part.y1 < full.y1) + part.y1 = full.y1; + if (part.x2 > full.x2) + part.x2 = full.x2; + if (part.y2 > full.y2) + part.y2 = full.y2; + + if (part.x1 < part.x2 && part.y1 < part.y2) + ADD_BOX (pBox, nBox, stackBox, heapBox, size, part); + } + } + } + + xglFillBox (pDrawable, pGC, + pExtent->x1, pExtent->y1, + pExtent->x2 - pExtent->x1, pExtent->y2 - pExtent->y1, + (heapBox) ? heapBox : stackBox, nBox); + + if (heapBox) + xfree (heapBox); +} + +void +xglFillSpan (DrawablePtr pDrawable, + GCPtr pGC, + int n, + DDXPointPtr ppt, + int *pwidth) +{ + RegionPtr pClip = pGC->pCompositeClip; + BoxPtr pClipBox; + BoxPtr pExtent = REGION_EXTENTS (pGC->pScreen, pClip); + BoxRec part, full; + BoxPtr heapBox = NULL; + BoxRec stackBox[N_STACK_BOX]; + int size = N_STACK_BOX; + BoxPtr pBox = stackBox; + int nClip, nBox = 0; + + while (n--) + { + full.x1 = ppt->x; + full.y1 = ppt->y; + full.x2 = full.x1 + *pwidth; + full.y2 = full.y1 + 1; + + pwidth++; + ppt++; + + if (full.x1 < pExtent->x1) + full.x1 = pExtent->x1; + if (full.y1 < pExtent->y1) + full.y1 = pExtent->y1; + if (full.x2 > pExtent->x2) + full.x2 = pExtent->x2; + if (full.y2 > pExtent->y2) + full.y2 = pExtent->y2; + + if (full.x1 >= full.x2 || full.y1 >= full.y2) + continue; + + nClip = REGION_NUM_RECTS (pClip); + if (nClip == 1) + { + ADD_BOX (pBox, nBox, stackBox, heapBox, size, full); + } + else + { + pClipBox = REGION_RECTS (pClip); + while (nClip--) + { + part = *pClipBox++; + + if (part.x1 < full.x1) + part.x1 = full.x1; + if (part.y1 < full.y1) + part.y1 = full.y1; + if (part.x2 > full.x2) + part.x2 = full.x2; + if (part.y2 > full.y2) + part.y2 = full.y2; + + if (part.x1 < part.x2 && part.y1 < part.y2) + ADD_BOX (pBox, nBox, stackBox, heapBox, size, part); + } + } + } + + xglFillBox (pDrawable, pGC, + pExtent->x1, pExtent->y1, + pExtent->x2 - pExtent->x1, pExtent->y2 - pExtent->y1, + (heapBox) ? heapBox : stackBox, nBox); + + if (heapBox) + xfree (heapBox); +} + +Bool +xglFillLine (DrawablePtr pDrawable, + GCPtr pGC, + int mode, + int npt, + DDXPointPtr ppt) +{ + RegionPtr pClip = pGC->pCompositeClip; + BoxPtr pExtent = REGION_EXTENTS (pGC->pScreen, pClip); + Bool coincidentEndpoints = FALSE; + Bool horizontalAndVertical = TRUE; + DDXPointPtr pptTmp; + int nptTmp; + DDXPointRec pt; + xglGeometryPtr pGeometry; + + XGL_SCREEN_PRIV (pGC->pScreen); + + if (npt < 2) + return TRUE; + + pt = *ppt; + + nptTmp = npt - 1; + pptTmp = ppt + 1; + + if (mode == CoordModePrevious) + { + while (nptTmp--) + { + if (pptTmp->x && pptTmp->y) + horizontalAndVertical = FALSE; + + pt.x += pptTmp->x; + pt.y += pptTmp->y; + + pptTmp++; + } + + if (pt.x == ppt->x && pt.y == ppt->y) + coincidentEndpoints = TRUE; + } + else + { + while (nptTmp--) + { + if (pptTmp->x != pt.x && pptTmp->y != pt.y) + { + horizontalAndVertical = FALSE; + break; + } + + pt = *pptTmp++; + } + + if (ppt[npt - 1].x == ppt->x && ppt[npt - 1].y == ppt->y) + coincidentEndpoints = TRUE; + } + + if (horizontalAndVertical) + { + BoxPtr pClipBox; + BoxRec part, full; + BoxPtr heapBox = NULL; + BoxRec stackBox[N_STACK_BOX]; + int size = N_STACK_BOX; + BoxPtr pBox = stackBox; + int nClip, nBox = 0; + int dx, dy; + + pt = *ppt; + + ppt++; + npt--; + + while (npt--) + { + if (mode == CoordModePrevious) + { + dx = ppt->x; + dy = ppt->y; + } + else + { + dx = ppt->x - pt.x; + dy = ppt->y - pt.y; + } + + if (dx) + { + if (dx > 0) + { + full.x1 = pt.x + pDrawable->x; + + if (npt || coincidentEndpoints) + full.x2 = full.x1 + dx; + else + full.x2 = full.x1 + dx + 1; + } + else + { + full.x2 = pt.x + pDrawable->x + 1; + + if (npt || coincidentEndpoints) + full.x1 = full.x2 + dx; + else + full.x1 = full.x2 + dx - 1; + } + + full.y1 = pt.y + pDrawable->y; + full.y2 = full.y1 + 1; + } + else + { + if (dy > 0) + { + full.y1 = pt.y + pDrawable->y; + + if (npt || coincidentEndpoints) + full.y2 = full.y1 + dy; + else + full.y2 = full.y1 + dy + 1; + } + else + { + full.y2 = pt.y + pDrawable->y + 1; + + if (npt || coincidentEndpoints) + full.y1 = full.y2 + dy; + else + full.y1 = full.y2 + dy - 1; + } + + full.x1 = pt.x + pDrawable->x; + full.x2 = full.x1 + 1; + } + + pt.x += dx; + pt.y += dy; + + ppt++; + + if (full.x1 < pExtent->x1) + full.x1 = pExtent->x1; + if (full.y1 < pExtent->y1) + full.y1 = pExtent->y1; + if (full.x2 > pExtent->x2) + full.x2 = pExtent->x2; + if (full.y2 > pExtent->y2) + full.y2 = pExtent->y2; + + if (full.x1 >= full.x2 || full.y1 >= full.y2) + continue; + + nClip = REGION_NUM_RECTS (pClip); + if (nClip == 1) + { + ADD_BOX (pBox, nBox, stackBox, heapBox, size, full); + } + else + { + pClipBox = REGION_RECTS (pClip); + while (nClip--) + { + part = *pClipBox++; + + if (part.x1 < full.x1) + part.x1 = full.x1; + if (part.y1 < full.y1) + part.y1 = full.y1; + if (part.x2 > full.x2) + part.x2 = full.x2; + if (part.y2 > full.y2) + part.y2 = full.y2; + + if (part.x1 < part.x2 && part.y1 < part.y2) + ADD_BOX (pBox, nBox, stackBox, heapBox, size, part); + } + } + } + + xglFillBox (pDrawable, pGC, + pExtent->x1, pExtent->y1, + pExtent->x2 - pExtent->x1, pExtent->y2 - pExtent->y1, + (heapBox) ? heapBox : stackBox, nBox); + + if (heapBox) + xfree (heapBox); + + return TRUE; + } + + if (!pScreenPriv->lines) + return FALSE; + + if (coincidentEndpoints) + npt--; + + pGeometry = xglGetScratchVertexGeometry (pGC->pScreen, npt); + + GEOMETRY_ADD_LINE (pGC->pScreen, pGeometry, + coincidentEndpoints, mode, npt, ppt); + + if (coincidentEndpoints) + GEOMETRY_SET_VERTEX_PRIMITIVE (pGeometry, GLITZ_PRIMITIVE_LINE_LOOP); + else + GEOMETRY_SET_VERTEX_PRIMITIVE (pGeometry, GLITZ_PRIMITIVE_LINE_STRIP); + + /* Lines need a 0.5 translate */ + GEOMETRY_TRANSLATE_FIXED (pGeometry, 1 << 15, 1 << 15); + + GEOMETRY_TRANSLATE (pGeometry, pDrawable->x, pDrawable->y); + + pExtent = REGION_EXTENTS (pDrawable->pScreen, pGC->pCompositeClip); + + if (xglFill (pDrawable, pGC, pGeometry, + pExtent->x1, pExtent->y1, + pExtent->x2 - pExtent->x1, pExtent->y2 - pExtent->y1, + REGION_RECTS (pGC->pCompositeClip), + REGION_NUM_RECTS (pGC->pCompositeClip))) + { + xglAddCurrentBitDamage (pDrawable); + return TRUE; + } + + return FALSE; +} + +Bool +xglFillSegment (DrawablePtr pDrawable, + GCPtr pGC, + int nSegInit, + xSegment *pSegInit) +{ + RegionPtr pClip = pGC->pCompositeClip; + BoxPtr pExtent = REGION_EXTENTS (pGC->pScreen, pClip); + Bool horizontalAndVertical = TRUE; + xglGeometryPtr pGeometry; + xSegment *pSeg; + int nSeg; + + XGL_SCREEN_PRIV (pGC->pScreen); + + if (nSegInit < 1) + return TRUE; + + pSeg = pSegInit; + nSeg = nSegInit; + while (nSeg--) + { + if (pSeg->x1 != pSeg->x2 && pSeg->y1 != pSeg->y2) + horizontalAndVertical = FALSE; + + pSeg++; + } + + if (horizontalAndVertical) + { + BoxPtr pClipBox; + BoxRec part, full; + BoxPtr heapBox = NULL; + BoxRec stackBox[N_STACK_BOX]; + int size = N_STACK_BOX; + BoxPtr pBox = stackBox; + int nClip, nBox = 0; + + while (nSegInit--) + { + if (pSegInit->x1 != pSegInit->x2) + { + if (pSegInit->x1 < pSegInit->x2) + { + full.x1 = pSegInit->x1; + full.x2 = pSegInit->x2; + } + else + { + full.x1 = pSegInit->x2; + full.x2 = pSegInit->x1; + } + + full.x1 += pDrawable->x; + full.x2 += pDrawable->x + 1; + full.y1 = pSegInit->y1 + pDrawable->y; + full.y2 = full.y1 + 1; + } + else + { + if (pSegInit->y1 < pSegInit->y2) + { + full.y1 = pSegInit->y1; + full.y2 = pSegInit->y2; + } + else + { + full.y1 = pSegInit->y2; + full.y2 = pSegInit->y1; + } + + full.y1 += pDrawable->y; + full.y2 += pDrawable->y + 1; + full.x1 = pSegInit->x1 + pDrawable->x; + full.x2 = full.x1 + 1; + } + + pSegInit++; + + if (full.x1 < pExtent->x1) + full.x1 = pExtent->x1; + if (full.y1 < pExtent->y1) + full.y1 = pExtent->y1; + if (full.x2 > pExtent->x2) + full.x2 = pExtent->x2; + if (full.y2 > pExtent->y2) + full.y2 = pExtent->y2; + + if (full.x1 >= full.x2 || full.y1 >= full.y2) + continue; + + nClip = REGION_NUM_RECTS (pClip); + if (nClip == 1) + { + ADD_BOX (pBox, nBox, stackBox, heapBox, size, full); + } + else + { + pClipBox = REGION_RECTS (pClip); + while (nClip--) + { + part = *pClipBox++; + + if (part.x1 < full.x1) + part.x1 = full.x1; + if (part.y1 < full.y1) + part.y1 = full.y1; + if (part.x2 > full.x2) + part.x2 = full.x2; + if (part.y2 > full.y2) + part.y2 = full.y2; + + if (part.x1 < part.x2 && part.y1 < part.y2) + ADD_BOX (pBox, nBox, stackBox, heapBox, size, part); + } + } + } + + xglFillBox (pDrawable, pGC, + pExtent->x1, pExtent->y1, + pExtent->x2 - pExtent->x1, pExtent->y2 - pExtent->y1, + (heapBox) ? heapBox : stackBox, nBox); + + if (heapBox) + xfree (heapBox); + + return TRUE; + } + + if (!pScreenPriv->lines) + return FALSE; + + pGeometry = xglGetScratchVertexGeometry (pGC->pScreen, 2 * nSegInit); + + GEOMETRY_ADD_SEGMENT (pGC->pScreen, pGeometry, nSegInit, pSegInit); + + /* Line segments need 0.5 translate */ + GEOMETRY_TRANSLATE_FIXED (pGeometry, 1 << 15, 1 << 15); + GEOMETRY_SET_VERTEX_PRIMITIVE (pGeometry, GLITZ_PRIMITIVE_LINES); + + GEOMETRY_TRANSLATE (pGeometry, pDrawable->x, pDrawable->y); + + if (xglFill (pDrawable, pGC, pGeometry, + pExtent->x1, pExtent->y1, + pExtent->x2 - pExtent->x1, pExtent->y2 - pExtent->y1, + REGION_RECTS (pGC->pCompositeClip), + REGION_NUM_RECTS (pGC->pCompositeClip))) + { + xglAddCurrentBitDamage (pDrawable); + return TRUE; + } + + return FALSE; +} + +Bool +xglFillGlyph (DrawablePtr pDrawable, + GCPtr pGC, + int x, + int y, + unsigned int nGlyph, + CharInfoPtr *ppci, + pointer pglyphBase) +{ + BoxPtr pExtent; + xglGeometryRec geometry; + + if (nGlyph < 1) + return TRUE; + + pExtent = REGION_EXTENTS (pDrawable->pScreen, pGC->pCompositeClip); + + x += pDrawable->x; + y += pDrawable->y; + + GEOMETRY_INIT (pDrawable->pScreen, &geometry, + GLITZ_GEOMETRY_TYPE_BITMAP, + GEOMETRY_USAGE_SYSMEM, 0); + + GEOMETRY_FOR_GLYPH (pDrawable->pScreen, + &geometry, + nGlyph, + ppci, + pglyphBase); + + GEOMETRY_TRANSLATE (&geometry, x, y); + + if (xglFill (pDrawable, pGC, &geometry, + pExtent->x1, pExtent->y1, + pExtent->x2 - pExtent->x1, pExtent->y2 - pExtent->y1, + REGION_RECTS (pGC->pCompositeClip), + REGION_NUM_RECTS (pGC->pCompositeClip))) + { + GEOMETRY_UNINIT (&geometry); + xglAddCurrentBitDamage (pDrawable); + return TRUE; + } + + GEOMETRY_UNINIT (&geometry); + return FALSE; +} diff --git a/xorg-server/hw/xgl/xglgc.c b/xorg-server/hw/xgl/xglgc.c new file mode 100644 index 000000000..7e7e75134 --- /dev/null +++ b/xorg-server/hw/xgl/xglgc.c @@ -0,0 +1,645 @@ +/* + * Copyright © 2004 David Reveman + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * David Reveman not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * David Reveman makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#include "xgl.h" +#include "fb.h" +#include "gcstruct.h" +#include "migc.h" + +#define XGL_GC_OP_FALLBACK_PROLOGUE(pDrawable) \ + xglSyncDamageBoxBits (pDrawable); \ + XGL_GC_UNWRAP (funcs); \ + XGL_GC_UNWRAP (ops) + +#define XGL_GC_OP_FALLBACK_EPILOGUE(pDrawable) \ + XGL_GC_WRAP (funcs, (GCFuncs *) &xglGCFuncs); \ + XGL_GC_WRAP (ops, (GCOps *) &xglGCOps); \ + xglAddCurrentSurfaceDamage (pDrawable) + +#define XGL_GC_FILL_OP_FALLBACK_PROLOGUE(pDrawable) \ + switch (pGC->fillStyle) { \ + case FillSolid: \ + break; \ + case FillStippled: \ + case FillOpaqueStippled: \ + if (!xglSyncBits (&pGC->stipple->drawable, NullBox)) \ + FatalError (XGL_SW_FAILURE_STRING); \ + break; \ + case FillTiled: \ + if (!xglSyncBits (&pGC->tile.pixmap->drawable, NullBox)) \ + FatalError (XGL_SW_FAILURE_STRING); \ + break; \ + } \ + XGL_GC_OP_FALLBACK_PROLOGUE (pDrawable) + +static const GCFuncs xglGCFuncs = { + xglValidateGC, + miChangeGC, + miCopyGC, + xglDestroyGC, + miChangeClip, + miDestroyClip, + miCopyClip +}; + +static const GCOps xglGCOps = { + xglFillSpans, + xglSetSpans, + xglPutImage, + xglCopyArea, + xglCopyPlane, + xglPolyPoint, + xglPolylines, + xglPolySegment, + miPolyRectangle, + xglPolyArc, + miFillPolygon, + xglPolyFillRect, + xglPolyFillArc, + miPolyText8, + miPolyText16, + miImageText8, + miImageText16, + xglImageGlyphBlt, + xglPolyGlyphBlt, + xglPushPixels +}; + +void +xglFillSpans (DrawablePtr pDrawable, + GCPtr pGC, + int nspans, + DDXPointPtr ppt, + int *pwidth, + int fSorted) +{ + XGL_GC_PRIV (pGC); + + if (pGCPriv->flags || pGC->fillStyle == FillStippled) + { + XGL_GC_FILL_OP_FALLBACK_PROLOGUE (pDrawable); + (*pGC->ops->FillSpans) (pDrawable, pGC, nspans, ppt, pwidth, fSorted); + XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable); + } + else + { + /* xglFillSpan handles fall-back */ + xglFillSpan (pDrawable, pGC, nspans, ppt, pwidth); + } +} + +void +xglSetSpans (DrawablePtr pDrawable, + GCPtr pGC, + char *psrc, + DDXPointPtr ppt, + int *pwidth, + int nspans, + int fSorted) +{ + XGL_GC_PRIV (pGC); + + XGL_GC_OP_FALLBACK_PROLOGUE (pDrawable); + (*pGC->ops->SetSpans) (pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted); + XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable); +} + +void +xglPutImage (DrawablePtr pDrawable, + GCPtr pGC, + int depth, + int x, + int y, + int w, + int h, + int leftPad, + int format, + char *bits) +{ + XGL_GC_PRIV (pGC); + + if (pGC->alu != GXcopy || (pGCPriv->flags & xglGCPlaneMaskFlag)) + { + XGL_GC_OP_FALLBACK_PROLOGUE (pDrawable); + (*pGC->ops->PutImage) (pDrawable, pGC, depth, + x, y, w, h, leftPad, format, bits); + XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable); + } + else + { + RegionPtr pClip = pGC->pCompositeClip; + RegionRec region; + BoxRec box; + + XGL_DRAWABLE_PIXMAP (pDrawable); + + if (!xglMapPixmapBits (pPixmap)) + FatalError (XGL_SW_FAILURE_STRING); + + XGL_GC_UNWRAP (funcs); + XGL_GC_UNWRAP (ops); + + (*pGC->ops->PutImage) (pDrawable, pGC, depth, + x, y, w, h, leftPad, format, bits); + + XGL_GC_WRAP (funcs, (GCFuncs *) &xglGCFuncs); + XGL_GC_WRAP (ops, (GCOps *) &xglGCOps); + + box.x1 = pDrawable->x + x; + box.y1 = pDrawable->y + y; + box.x2 = box.x1 + w; + box.y2 = box.y1 + h; + + REGION_INIT (pDrawable->pScreen, ®ion, &box, 1); + REGION_INTERSECT (pDrawable->pScreen, ®ion, pClip, ®ion); + + xglAddSurfaceDamage (pDrawable, ®ion); + + REGION_UNINIT (pDrawable->pScreen, ®ion); + } +} + +RegionPtr +xglCopyArea (DrawablePtr pSrc, + DrawablePtr pDst, + GCPtr pGC, + int srcX, + int srcY, + int w, + int h, + int dstX, + int dstY) +{ + RegionPtr pRegion; + BoxRec box; + + XGL_GC_PRIV (pGC); + + box.x1 = pSrc->x + srcX; + box.y1 = pSrc->y + srcY; + box.x2 = box.x1 + w; + box.y2 = box.y1 + h; + + if (pGC->alu != GXcopy || pGCPriv->flags) + { + if (!xglSyncBits (pSrc, &box)) + FatalError (XGL_SW_FAILURE_STRING); + + XGL_GC_OP_FALLBACK_PROLOGUE (pDst); + pRegion = (*pGC->ops->CopyArea) (pSrc, pDst, pGC, + srcX, srcY, w, h, dstX, dstY); + XGL_GC_OP_FALLBACK_EPILOGUE (pDst); + } + else + { + /* xglCopyProc handles fall-back */ + pRegion = fbDoCopy (pSrc, pDst, pGC, + srcX, srcY, + w, h, + dstX, dstY, + xglCopyProc, 0, + (void *) &box); + } + + return pRegion; +} + +RegionPtr +xglCopyPlane (DrawablePtr pSrc, + DrawablePtr pDst, + GCPtr pGC, + int srcX, + int srcY, + int w, + int h, + int dstX, + int dstY, + unsigned long bitPlane) +{ + RegionPtr pRegion; + BoxRec box; + + XGL_GC_PRIV (pGC); + + box.x1 = pSrc->x + srcX; + box.y1 = pSrc->y + srcY; + box.x2 = box.x1 + w; + box.y2 = box.y1 + h; + + if (!xglSyncBits (pSrc, &box)) + FatalError (XGL_SW_FAILURE_STRING); + + XGL_GC_OP_FALLBACK_PROLOGUE (pDst); + pRegion = (*pGC->ops->CopyPlane) (pSrc, pDst, pGC, + srcX, srcY, w, h, dstX, dstY, + bitPlane); + XGL_GC_OP_FALLBACK_EPILOGUE (pDst); + + return pRegion; +} + +void +xglPolyPoint (DrawablePtr pDrawable, + GCPtr pGC, + int mode, + int npt, + DDXPointPtr pptInit) +{ + XGL_GC_PRIV (pGC); + + XGL_GC_OP_FALLBACK_PROLOGUE (pDrawable); + (*pGC->ops->PolyPoint) (pDrawable, pGC, mode, npt, pptInit); + XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable); +} + +void +xglPolylines (DrawablePtr pDrawable, + GCPtr pGC, + int mode, + int npt, + DDXPointPtr ppt) +{ + if (pGC->lineWidth == 0) + { + XGL_GC_PRIV (pGC); + + if (!pGCPriv->flags) + { + if (pGC->lineStyle == LineSolid) + { + if (xglFillLine (pDrawable, pGC, mode, npt, ppt)) + return; + } + } + + XGL_GC_FILL_OP_FALLBACK_PROLOGUE (pDrawable); + (*pGC->ops->Polylines) (pDrawable, pGC, mode, npt, ppt); + XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable); + } + else + { + if (pGC->lineStyle != LineSolid) + miWideDash (pDrawable, pGC, mode, npt, ppt); + else + miWideLine (pDrawable, pGC, mode, npt, ppt); + } +} + +void +xglPolySegment (DrawablePtr pDrawable, + GCPtr pGC, + int nsegInit, + xSegment *pSegInit) +{ + if (pGC->lineWidth == 0) + { + XGL_GC_PRIV (pGC); + + if (!pGCPriv->flags) + { + if (pGC->lineStyle == LineSolid) + { + if (xglFillSegment (pDrawable, pGC, nsegInit, pSegInit)) + return; + } + } + + XGL_GC_FILL_OP_FALLBACK_PROLOGUE (pDrawable); + (*pGC->ops->PolySegment) (pDrawable, pGC, nsegInit, pSegInit); + XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable); + } else + miPolySegment (pDrawable, pGC, nsegInit, pSegInit); +} + +void +xglPolyArc (DrawablePtr pDrawable, + GCPtr pGC, + int narcs, + xArc *pArcs) +{ + if (pGC->lineWidth == 0) + { + XGL_GC_PRIV (pGC); + + XGL_GC_FILL_OP_FALLBACK_PROLOGUE (pDrawable); + (*pGC->ops->PolyArc) (pDrawable, pGC, narcs, pArcs); + XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable); + } else + miPolyArc (pDrawable, pGC, narcs, pArcs); +} + +void +xglPolyFillRect (DrawablePtr pDrawable, + GCPtr pGC, + int nrect, + xRectangle *prect) +{ + XGL_GC_PRIV (pGC); + + if (pGC->fillStyle == FillStippled || pGCPriv->flags) + { + XGL_GC_FILL_OP_FALLBACK_PROLOGUE (pDrawable); + (*pGC->ops->PolyFillRect) (pDrawable, pGC, nrect, prect); + XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable); + } + else + { + /* xglFillRect handles fall-back */ + xglFillRect (pDrawable, pGC, nrect, prect); + } +} + +void +xglPolyFillArc (DrawablePtr pDrawable, + GCPtr pGC, + int narcs, + xArc *pArcs) +{ + XGL_GC_PRIV (pGC); + + XGL_GC_FILL_OP_FALLBACK_PROLOGUE (pDrawable); + (*pGC->ops->PolyFillArc) (pDrawable, pGC, narcs, pArcs); + XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable); +} + +void +xglImageGlyphBlt (DrawablePtr pDrawable, + GCPtr pGC, + int x, + int y, + unsigned int nglyph, + CharInfoPtr *ppci, + pointer pglyphBase) +{ + XGL_GC_PRIV (pGC); + + if (!pGCPriv->flags) + { + if (xglSolidGlyph (pDrawable, + pGC, + x, + y, + nglyph, + ppci, + pglyphBase)) + return; + } + + XGL_GC_OP_FALLBACK_PROLOGUE (pDrawable); + (*pGC->ops->ImageGlyphBlt) (pDrawable, pGC, x, y, nglyph, ppci, + pglyphBase); + XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable); +} + +void +xglPolyGlyphBlt (DrawablePtr pDrawable, + GCPtr pGC, + int x, + int y, + unsigned int nglyph, + CharInfoPtr *ppci, + pointer pglyphBase) +{ + XGL_GC_PRIV (pGC); + + if (!pGCPriv->flags) + { + if (xglFillGlyph (pDrawable, + pGC, + x, + y, + nglyph, + ppci, + pglyphBase)) + return; + } + + XGL_GC_FILL_OP_FALLBACK_PROLOGUE (pDrawable); + (*pGC->ops->PolyGlyphBlt) (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); + XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable); +} + +void +xglPushPixels (GCPtr pGC, + PixmapPtr pBitmap, + DrawablePtr pDrawable, + int w, + int h, + int x, + int y) +{ + XGL_GC_PRIV (pGC); + + if (!xglSyncBits (&pBitmap->drawable, NullBox)) + FatalError (XGL_SW_FAILURE_STRING); + + XGL_GC_OP_FALLBACK_PROLOGUE (pDrawable); + (*pGC->ops->PushPixels) (pGC, pBitmap, pDrawable, w, h, x, y); + XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable); +} + +Bool +xglCreateGC (GCPtr pGC) +{ + ScreenPtr pScreen = pGC->pScreen; + Bool ret; + + XGL_SCREEN_PRIV (pScreen); + XGL_GC_PRIV (pGC); + + XGL_SCREEN_UNWRAP (CreateGC); + ret = (*pScreen->CreateGC) (pGC); + XGL_SCREEN_WRAP (CreateGC, xglCreateGC); + + XGL_GC_WRAP (funcs, (GCFuncs *) &xglGCFuncs); + XGL_GC_WRAP (ops, (GCOps *) &xglGCOps); + + pGCPriv->flags = 0; + pGCPriv->op = GLITZ_OPERATOR_SRC; + + pGCPriv->fg = NULL; + pGCPriv->bg = NULL; + pGCPriv->id = ~0; + + return ret; +} + +void +xglDestroyGC (GCPtr pGC) +{ + XGL_GC_PRIV (pGC); + + if (pGCPriv->fg) + glitz_surface_destroy (pGCPriv->fg); + + if (pGCPriv->bg) + glitz_surface_destroy (pGCPriv->bg); + + XGL_GC_UNWRAP (funcs); + XGL_GC_UNWRAP (ops); + (*pGC->funcs->DestroyGC) (pGC); + XGL_GC_WRAP (funcs, (GCFuncs *) &xglGCFuncs); + XGL_GC_WRAP (ops, (GCOps *) &xglGCOps); +} + +void +xglValidateGC (GCPtr pGC, + unsigned long changes, + DrawablePtr pDrawable) +{ + XGL_GC_PRIV (pGC); + + if (changes & GCTile) + { + if (!pGC->tileIsPixel && + FbEvenTile (pGC->tile.pixmap->drawable.width * + pDrawable->bitsPerPixel)) + xglSyncBits (&pGC->tile.pixmap->drawable, NULL); + } + + if (changes & GCStipple) + { + if (pGC->stipple) + xglSyncBits (&pGC->stipple->drawable, NULL); + } + + XGL_GC_UNWRAP (funcs); + XGL_GC_UNWRAP (ops); + (*pGC->funcs->ValidateGC) (pGC, changes, pDrawable); + XGL_GC_WRAP (funcs, (GCFuncs *) &xglGCFuncs); + XGL_GC_WRAP (ops, (GCOps *) &xglGCOps); + + if (pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS)) + { + XGL_DRAWABLE_PIXMAP_PRIV (pDrawable); + + if (pPixmapPriv->pVisual && pPixmapPriv->pVisual->format.surface) + { + glitz_format_t *format; + + format = pPixmapPriv->pVisual->format.surface; + if (format->id != pGCPriv->id) + { + XGL_SCREEN_PRIV (pDrawable->pScreen); + + pGCPriv->flags |= xglGCSoftwareDrawableFlag; + + if (pGCPriv->fg) + glitz_surface_destroy (pGCPriv->fg); + + pGCPriv->fg = glitz_surface_create (pScreenPriv->drawable, + format, 1, 1, 0, NULL); + if (pGCPriv->fg) + glitz_surface_set_fill (pGCPriv->fg, GLITZ_FILL_REPEAT); + + if (pGCPriv->bg) + glitz_surface_destroy (pGCPriv->bg); + + pGCPriv->bg = glitz_surface_create (pScreenPriv->drawable, + format, 1, 1, 0, NULL); + if (pGCPriv->bg) + glitz_surface_set_fill (pGCPriv->bg, GLITZ_FILL_REPEAT); + + pGCPriv->id = format->id; + + if (pGCPriv->fg && pGCPriv->bg) + { + changes |= (GCForeground | GCBackground); + pGCPriv->flags &= ~xglGCSoftwareDrawableFlag; + } + } + } + else + pGCPriv->flags |= xglGCSoftwareDrawableFlag; + } + + if (changes & GCFunction) + { + switch (pGC->alu) { + case GXclear: + pGCPriv->op = GLITZ_OPERATOR_CLEAR; + pGCPriv->flags &= ~xglGCBadFunctionFlag; + break; + case GXcopy: + pGCPriv->op = GLITZ_OPERATOR_SRC; + pGCPriv->flags &= ~xglGCBadFunctionFlag; + break; + case GXnoop: + pGCPriv->op = GLITZ_OPERATOR_DST; + pGCPriv->flags &= ~xglGCBadFunctionFlag; + break; + default: + pGCPriv->flags |= xglGCBadFunctionFlag; + break; + } + } + + if (changes & GCPlaneMask) + { + FbBits mask; + + mask = FbFullMask (pDrawable->depth); + + if ((pGC->planemask & mask) != mask) + pGCPriv->flags |= xglGCPlaneMaskFlag; + else + pGCPriv->flags &= ~xglGCPlaneMaskFlag; + } + + if (!(pGCPriv->flags & xglGCSoftwareDrawableFlag)) + { + if (changes & (GCForeground | GCBackground)) + { + glitz_pixel_format_t format; + glitz_buffer_t *buffer; + CARD32 pixel; + + XGL_DRAWABLE_PIXMAP_PRIV (pDrawable); + + format.fourcc = GLITZ_FOURCC_RGB; + format.masks = pPixmapPriv->pVisual->pPixel->masks; + format.xoffset = 0; + format.skip_lines = 0; + format.bytes_per_line = sizeof (CARD32); + format.scanline_order = GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP; + + buffer = glitz_buffer_create_for_data (&pixel); + + if (changes & GCForeground) + { + pixel = pGC->fgPixel; + glitz_set_pixels (pGCPriv->fg, 0, 0, 1, 1, &format, buffer); + } + + if (changes & GCBackground) + { + pixel = pGC->bgPixel; + glitz_set_pixels (pGCPriv->bg, 0, 0, 1, 1, &format, buffer); + } + + glitz_buffer_destroy (buffer); + } + } +} diff --git a/xorg-server/hw/xgl/xglgeometry.c b/xorg-server/hw/xgl/xglgeometry.c new file mode 100644 index 000000000..7ab1ba45c --- /dev/null +++ b/xorg-server/hw/xgl/xglgeometry.c @@ -0,0 +1,724 @@ +/* + * Copyright © 2004 David Reveman + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * David Reveman not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * David Reveman makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#include "xgl.h" +#include <X11/fonts/fontstruct.h> +#include "dixfontstr.h" + +xglDataTypeInfoRec xglGeometryDataTypes[2] = { + { GLITZ_DATA_TYPE_SHORT, sizeof (glitz_short_t) }, + { GLITZ_DATA_TYPE_FLOAT, sizeof (glitz_float_t) } +}; + +glitz_buffer_hint_t usageTypes[] = { + GLITZ_BUFFER_HINT_STREAM_DRAW, + GLITZ_BUFFER_HINT_STATIC_DRAW, + GLITZ_BUFFER_HINT_DYNAMIC_DRAW +}; + +void +xglGeometryResize (ScreenPtr pScreen, + xglGeometryPtr pGeometry, + int size) +{ + XGL_SCREEN_PRIV (pScreen); + + if (size == pGeometry->size) + return; + + if (pGeometry->broken) + return; + + if (pGeometry->usage == GEOMETRY_USAGE_SYSMEM) + { + pGeometry->data = xrealloc (pGeometry->data, size); + + if (pGeometry->buffer) + glitz_buffer_destroy (pGeometry->buffer); + + pGeometry->buffer = NULL; + + if (pGeometry->data) + { + pGeometry->buffer = glitz_buffer_create_for_data (pGeometry->data); + if (!pGeometry->buffer) + { + pGeometry->broken = TRUE; + return; + } + } + else if (size) + { + pGeometry->broken = TRUE; + return; + } + } + else + { + glitz_buffer_t *newBuffer; + + if (size) + { + newBuffer = + glitz_vertex_buffer_create (pScreenPriv->drawable, NULL, size, + usageTypes[pGeometry->usage]); + if (!newBuffer) + { + pGeometry->broken = TRUE; + return; + } + } else + newBuffer = NULL; + + if (pGeometry->buffer && newBuffer) + { + void *oldData, *newData; + + oldData = glitz_buffer_map (pGeometry->buffer, + GLITZ_BUFFER_ACCESS_READ_ONLY); + newData = glitz_buffer_map (newBuffer, + GLITZ_BUFFER_ACCESS_WRITE_ONLY); + + if (oldData && newData) + memcpy (newData, oldData, MIN (size, pGeometry->size)); + + glitz_buffer_unmap (pGeometry->buffer); + glitz_buffer_unmap (newBuffer); + + glitz_buffer_destroy (pGeometry->buffer); + } + pGeometry->buffer = newBuffer; + } + + pGeometry->size = size; + + if (pGeometry->endOffset > size) + pGeometry->endOffset = size; +} + +#define MAP_GEOMETRY(pScreen, pGeometry, offset, units, ptr, _size) \ + if ((pGeometry)->broken) \ + return; \ + (_size) = (units) * xglGeometryDataTypes[(pGeometry)->dataType].size; \ + if (((pGeometry)->size - (offset)) < (_size)) \ + { \ + xglGeometryResize (pScreen, pGeometry, \ + (pGeometry)->endOffset + (_size) + 500); \ + if ((pGeometry)->broken) \ + return; \ + } \ + (ptr) = glitz_buffer_map ((pGeometry)->buffer, \ + GLITZ_BUFFER_ACCESS_WRITE_ONLY); \ + if (!(ptr)) \ + { \ + (pGeometry)->broken = TRUE; \ + return; \ + } \ + (ptr) += (offset) + +#define UNMAP_GEOMETRY(pGeometry, offset, _size) \ + if (glitz_buffer_unmap ((pGeometry)->buffer)) \ + { \ + (pGeometry)->broken = TRUE; \ + return; \ + } \ + if (((offset) + (_size)) > (pGeometry)->endOffset) \ + { \ + (pGeometry)->endOffset = (offset) + (_size); \ + (pGeometry)->count = (pGeometry)->endOffset / \ + (2 * xglGeometryDataTypes[(pGeometry)->dataType].size); \ + } + +/* + * Adds a number of boxes as GL_QUAD primitives + */ +void +xglGeometryAddBox (ScreenPtr pScreen, + xglGeometryPtr pGeometry, + BoxPtr pBox, + int nBox, + int offset) +{ + int size; + char *ptr; + + if (nBox < 1) + return; + + MAP_GEOMETRY (pScreen, pGeometry, offset, nBox * 8, ptr, size); + + switch (pGeometry->dataType) { + case GEOMETRY_DATA_TYPE_SHORT: + { + glitz_short_t *data = (glitz_short_t *) ptr; + + while (nBox--) + { + *data++ = (glitz_short_t) pBox->x1; + *data++ = (glitz_short_t) pBox->y1; + *data++ = (glitz_short_t) pBox->x2; + *data++ = (glitz_short_t) pBox->y1; + *data++ = (glitz_short_t) pBox->x2; + *data++ = (glitz_short_t) pBox->y2; + *data++ = (glitz_short_t) pBox->x1; + *data++ = (glitz_short_t) pBox->y2; + + pBox++; + } + } break; + case GEOMETRY_DATA_TYPE_FLOAT: + { + glitz_float_t *data = (glitz_float_t *) ptr; + + while (nBox--) + { + *data++ = (glitz_float_t) pBox->x1; + *data++ = (glitz_float_t) pBox->y1; + *data++ = (glitz_float_t) pBox->x2; + *data++ = (glitz_float_t) pBox->y1; + *data++ = (glitz_float_t) pBox->x2; + *data++ = (glitz_float_t) pBox->y2; + *data++ = (glitz_float_t) pBox->x1; + *data++ = (glitz_float_t) pBox->y2; + + pBox++; + } + } break; + } + + UNMAP_GEOMETRY (pGeometry, offset, size); +} + +/* + * Adds a number of spans as GL_LINE primitives + */ +void +xglGeometryAddSpan (ScreenPtr pScreen, + xglGeometryPtr pGeometry, + DDXPointPtr ppt, + int *pwidth, + int n, + int offset) +{ + int size; + char *ptr; + + if (n < 1) + return; + + MAP_GEOMETRY (pScreen, pGeometry, offset, n * 4, ptr, size); + + switch (pGeometry->dataType) { + case GEOMETRY_DATA_TYPE_SHORT: + { + glitz_short_t *data = (glitz_short_t *) ptr; + + while (n--) + { + *data++ = (glitz_short_t) ppt->x; + *data++ = (glitz_short_t) ppt->y; + *data++ = (glitz_short_t) (ppt->x + *pwidth); + *data++ = (glitz_short_t) ppt->y; + + ppt++; + pwidth++; + } + } break; + case GEOMETRY_DATA_TYPE_FLOAT: + { + glitz_float_t *data = (glitz_float_t *) ptr; + + while (n--) + { + *data++ = (glitz_float_t) ppt->x; + *data++ = (glitz_float_t) ppt->y; + *data++ = (glitz_float_t) (ppt->x + *pwidth); + *data++ = (glitz_float_t) ppt->y; + + ppt++; + pwidth++; + } + } break; + } + + UNMAP_GEOMETRY (pGeometry, offset, size); +} + +/* + * This macro is needed for end pixels to be rasterized correctly using + * OpenGL as OpenGL line segments are half-opened. + */ +#define ADJUST_END_POINT(start, end, isPoint) \ + (((end) > (start)) ? (end) + 1: \ + ((end) < (start)) ? (end) - 1: \ + (isPoint) ? (end) + 1: \ + (end)) + +/* + * Adds a number of connected lines as GL_LINE_STRIP primitives + */ +void +xglGeometryAddLine (ScreenPtr pScreen, + xglGeometryPtr pGeometry, + int loop, + int mode, + int npt, + DDXPointPtr ppt, + int offset) +{ + DDXPointRec pt; + int size; + char *ptr; + + if (npt < 2) + return; + + MAP_GEOMETRY (pScreen, pGeometry, offset, npt * 2, ptr, size); + + pt.x = 0; + pt.y = 0; + + switch (pGeometry->dataType) { + case GEOMETRY_DATA_TYPE_SHORT: + { + glitz_short_t *data = (glitz_short_t *) ptr; + + while (npt--) + { + if (mode == CoordModePrevious) + { + pt.x += ppt->x; + pt.y += ppt->y; + } + else + { + pt.x = ppt->x; + pt.y = ppt->y; + } + + if (npt || loop) + { + *data++ = (glitz_short_t) pt.x; + *data++ = (glitz_short_t) pt.y; + } + else + { + ppt--; + *data++ = (glitz_short_t) + ADJUST_END_POINT (ppt->x, pt.x, ppt->y == pt.y); + *data++ = (glitz_short_t) ADJUST_END_POINT (ppt->y, pt.y, 0); + } + + ppt++; + } + } break; + case GEOMETRY_DATA_TYPE_FLOAT: + { + glitz_float_t *data = (glitz_float_t *) ptr; + + while (npt--) + { + if (mode == CoordModePrevious) + { + pt.x += ppt->x; + pt.y += ppt->y; + } + else + { + pt.x = ppt->x; + pt.y = ppt->y; + } + + if (npt || loop) + { + *data++ = (glitz_float_t) pt.x; + *data++ = (glitz_float_t) pt.y; + } + else + { + ppt--; + *data++ = (glitz_float_t) + ADJUST_END_POINT (ppt->x, pt.x, ppt->y == pt.y); + *data++ = (glitz_float_t) ADJUST_END_POINT (ppt->y, pt.y, 0); + } + + ppt++; + } + } break; + } + + UNMAP_GEOMETRY (pGeometry, offset, size); +} + +/* + * Adds a number of line segments as GL_LINE primitives + */ +void +xglGeometryAddSegment (ScreenPtr pScreen, + xglGeometryPtr pGeometry, + int nsegInit, + xSegment *pSegInit, + int offset) +{ + int size; + char *ptr; + + if (nsegInit < 1) + return; + + MAP_GEOMETRY (pScreen, pGeometry, offset, nsegInit * 4, ptr, size); + + switch (pGeometry->dataType) { + case GEOMETRY_DATA_TYPE_SHORT: + { + glitz_short_t *data = (glitz_short_t *) ptr; + + while (nsegInit--) + { + *data++ = (glitz_short_t) pSegInit->x1; + *data++ = (glitz_short_t) pSegInit->y1; + *data++ = (glitz_short_t) + ADJUST_END_POINT (pSegInit->x1, pSegInit->x2, + pSegInit->y1 == pSegInit->y2); + *data++ = (glitz_short_t) + ADJUST_END_POINT (pSegInit->y1, pSegInit->y2, 0); + + pSegInit++; + } + } break; + case GEOMETRY_DATA_TYPE_FLOAT: + { + glitz_float_t *data = (glitz_float_t *) ptr; + + while (nsegInit--) + { + *data++ = (glitz_float_t) pSegInit->x1; + *data++ = (glitz_float_t) pSegInit->y1; + *data++ = (glitz_float_t) + ADJUST_END_POINT (pSegInit->x1, pSegInit->x2, + pSegInit->y1 == pSegInit->y2); + *data++ = (glitz_float_t) + ADJUST_END_POINT (pSegInit->y1, pSegInit->y2, 0); + + pSegInit++; + } + } break; + } + + UNMAP_GEOMETRY (pGeometry, offset, size); +} + +void +xglGeometryForGlyph (ScreenPtr pScreen, + xglGeometryPtr pGeometry, + unsigned int nGlyph, + CharInfoPtr *ppciInit, + pointer pglyphBase) +{ + CharInfoPtr *ppci; + CharInfoPtr pci; + unsigned char *glyphbase = (pointer) ~0; + unsigned char *pglyph; + int x = 0; + int gx, gy; + int gWidth, gHeight; + int n, lastX = 0, lastY = 0; + glitz_multi_array_t *array; + glitz_buffer_t *buffer; + + ppci = ppciInit; + n = nGlyph; + + while (n--) + { + pglyph = FONTGLYPHBITS (pglyphBase, *ppci++); + if (pglyph < glyphbase) + glyphbase = pglyph; + } + + buffer = glitz_buffer_create_for_data (glyphbase); + if (!buffer) + { + pGeometry->broken = TRUE; + return; + } + + GEOMETRY_SET_BUFFER (pGeometry, buffer); + + array = glitz_multi_array_create (nGlyph); + if (!array) + { + pGeometry->broken = TRUE; + return; + } + + GEOMETRY_SET_MULTI_ARRAY (pGeometry, array); + + ppci = ppciInit; + while (nGlyph--) + { + pci = *ppci++; + pglyph = FONTGLYPHBITS (pglyphBase, pci); + gWidth = GLYPHWIDTHPIXELS (pci); + gHeight = GLYPHHEIGHTPIXELS (pci); + + if (gWidth && gHeight) + { + gx = x + pci->metrics.leftSideBearing; + gy = -pci->metrics.ascent; + + glitz_multi_array_add (array, + (pglyph - glyphbase) * 8, + gWidth, gHeight, + (gx - lastX) << 16, (gy - lastY) << 16); + lastX = gx; + lastY = gy; + } + x += pci->metrics.characterWidth; + } + + glitz_buffer_destroy (buffer); + glitz_multi_array_destroy (array); +} + +#define FIXED_LINE_X_TO_FLOAT(line, v) \ + (((glitz_float_t) \ + ((line).p1.x + (xFixed_16_16) \ + (((xFixed_32_32) ((v) - (line).p1.y) * \ + ((line).p2.x - (line).p1.x)) / \ + ((line).p2.y - (line).p1.y)))) / 65536) + +#define FIXED_LINE_X_CEIL_TO_FLOAT(line, v) \ + (((glitz_float_t) \ + ((line).p1.x + (xFixed_16_16) \ + (((((line).p2.y - (line).p1.y) - 1) + \ + ((xFixed_32_32) ((v) - (line).p1.y) * \ + ((line).p2.x - (line).p1.x))) / \ + ((line).p2.y - (line).p1.y)))) / 65536) + +/* + * Adds a number of trapezoids as GL_QUAD primitives + */ +void +xglGeometryAddTrapezoid (ScreenPtr pScreen, + xglGeometryPtr pGeometry, + xTrapezoid *pTrap, + int nTrap, + int offset) +{ + int size; + char *ptr; + + if (nTrap < 1) + return; + + MAP_GEOMETRY (pScreen, pGeometry, offset, nTrap * 8, ptr, size); + + switch (pGeometry->dataType) { + case GEOMETRY_DATA_TYPE_SHORT: + /* not supported */ + pGeometry->broken = TRUE; + break; + case GEOMETRY_DATA_TYPE_FLOAT: + { + glitz_float_t *data = (glitz_float_t *) ptr; + glitz_float_t top, bottom; + + while (nTrap--) + { + top = FIXED_TO_FLOAT (pTrap->top); + bottom = FIXED_TO_FLOAT (pTrap->bottom); + + *data++ = FIXED_LINE_X_TO_FLOAT (pTrap->left, pTrap->top); + *data++ = top; + *data++ = FIXED_LINE_X_CEIL_TO_FLOAT (pTrap->right, pTrap->top); + *data++ = top; + *data++ = FIXED_LINE_X_CEIL_TO_FLOAT (pTrap->right, pTrap->bottom); + *data++ = bottom; + *data++ = FIXED_LINE_X_TO_FLOAT (pTrap->left, pTrap->bottom); + *data++ = bottom; + + pTrap++; + } + } break; + } + + UNMAP_GEOMETRY (pGeometry, offset, size); +} + +/* + * Adds a number of traps as GL_QUAD primitives + */ +void +xglGeometryAddTrap (ScreenPtr pScreen, + xglGeometryPtr pGeometry, + xTrap *pTrap, + int nTrap, + int offset) +{ + int size; + char *ptr; + + if (nTrap < 1) + return; + + MAP_GEOMETRY (pScreen, pGeometry, offset, nTrap * 8, ptr, size); + + switch (pGeometry->dataType) { + case GEOMETRY_DATA_TYPE_SHORT: + /* not supported */ + pGeometry->broken = TRUE; + break; + case GEOMETRY_DATA_TYPE_FLOAT: + { + glitz_float_t *data = (glitz_float_t *) ptr; + glitz_float_t top, bottom; + + while (nTrap--) + { + top = FIXED_TO_FLOAT (pTrap->top.y); + bottom = FIXED_TO_FLOAT (pTrap->bot.y); + + *data++ = FIXED_TO_FLOAT (pTrap->top.l); + *data++ = top; + *data++ = FIXED_TO_FLOAT (pTrap->top.r); + *data++ = top; + *data++ = FIXED_TO_FLOAT (pTrap->bot.r); + *data++ = bottom; + *data++ = FIXED_TO_FLOAT (pTrap->bot.l); + *data++ = bottom; + + pTrap++; + } + } break; + } + + UNMAP_GEOMETRY (pGeometry, offset, size); +} + +/* XXX: scratch geometry size never shrinks, it just gets larger when + required. this is not acceptable. */ +xglGeometryPtr +xglGetScratchGeometryWithSize (ScreenPtr pScreen, + int size) +{ + xglGeometryPtr pGeometry; + + XGL_SCREEN_PRIV (pScreen); + + pGeometry = &pScreenPriv->scratchGeometry; + + if (pGeometry->broken || pGeometry->size < size) + { + GEOMETRY_UNINIT (pGeometry); + GEOMETRY_INIT (pScreen, pGeometry, pGeometry->type, + pScreenPriv->geometryUsage, size); + } + else + { + if (pGeometry->array) + { + glitz_multi_array_destroy (pGeometry->array); + pGeometry->array = NULL; + } + pGeometry->endOffset = 0; + pGeometry->xOff = 0; + pGeometry->yOff = 0; + pGeometry->first = 0; + pGeometry->count = 0; + pGeometry->width = 2; + } + + return pGeometry; +} + +xglGeometryPtr +xglGetScratchVertexGeometryWithType (ScreenPtr pScreen, + int type, + int count) +{ + xglGeometryPtr pGeometry; + int stride; + + stride = 2 * xglGeometryDataTypes[type].size; + + pGeometry = xglGetScratchGeometryWithSize (pScreen, count * stride); + + pGeometry->type = GLITZ_GEOMETRY_TYPE_VERTEX; + pGeometry->dataType = type; + + pGeometry->f.vertex.primitive = GLITZ_PRIMITIVE_QUADS; + pGeometry->f.vertex.type = xglGeometryDataTypes[type].type; + pGeometry->f.vertex.bytes_per_vertex = stride; + pGeometry->f.vertex.attributes = 0; + + return pGeometry; +} + +xglGeometryPtr +xglGetScratchVertexGeometry (ScreenPtr pScreen, + int count) +{ + xglGeometryPtr pGeometry; + int type, stride; + + XGL_SCREEN_PRIV (pScreen); + + type = pScreenPriv->geometryDataType; + stride = 2 * xglGeometryDataTypes[type].size; + + pGeometry = xglGetScratchGeometryWithSize (pScreen, count * stride); + + pGeometry->type = GLITZ_GEOMETRY_TYPE_VERTEX; + pGeometry->dataType = type; + + pGeometry->f.vertex.primitive = GLITZ_PRIMITIVE_QUADS; + pGeometry->f.vertex.type = xglGeometryDataTypes[type].type; + pGeometry->f.vertex.bytes_per_vertex = stride; + pGeometry->f.vertex.attributes = 0; + + return pGeometry; +} + +Bool +xglSetGeometry (xglGeometryPtr pGeometry, + glitz_surface_t *surface) +{ + if (pGeometry->broken) + return FALSE; + + glitz_set_geometry (surface, pGeometry->type, &pGeometry->f, + pGeometry->buffer); + + if (pGeometry->array) + glitz_set_multi_array (surface, pGeometry->array, + pGeometry->xOff, pGeometry->yOff); + else + glitz_set_array (surface, + pGeometry->first, pGeometry->width, pGeometry->count, + pGeometry->xOff, pGeometry->yOff); + + return TRUE; +} diff --git a/xorg-server/hw/xgl/xglget.c b/xorg-server/hw/xgl/xglget.c new file mode 100644 index 000000000..87bcb0508 --- /dev/null +++ b/xorg-server/hw/xgl/xglget.c @@ -0,0 +1,88 @@ +/* + * Copyright © 2004 David Reveman + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * David Reveman not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * David Reveman makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#include "xgl.h" + +void +xglGetImage (DrawablePtr pDrawable, + int x, + int y, + int w, + int h, + unsigned int format, + unsigned long planeMask, + char *d) +{ + ScreenPtr pScreen = pDrawable->pScreen; + glitz_surface_t *surface; + int xOff, yOff; + BoxRec box; + + XGL_SCREEN_PRIV (pScreen); + + /* Many apps use GetImage to sync with the visible frame buffer */ + if (pDrawable->type == DRAWABLE_WINDOW) + { + if (!xglSyncSurface (&pScreenPriv->pScreenPixmap->drawable)) + FatalError (XGL_SW_FAILURE_STRING); + + glitz_surface_flush (pScreenPriv->surface); + glitz_drawable_finish (pScreenPriv->drawable); + } + + XGL_GET_DRAWABLE (pDrawable, surface, xOff, yOff); + + box.x1 = pDrawable->x + xOff + x; + box.y1 = pDrawable->y + yOff + y; + box.x2 = box.x1 + w; + box.y2 = box.y1 + h; + + if (!xglSyncBits (pDrawable, &box)) + FatalError (XGL_SW_FAILURE_STRING); + + XGL_SCREEN_UNWRAP (GetImage); + (*pScreen->GetImage) (pDrawable, x, y, w, h, format, planeMask, d); + XGL_SCREEN_WRAP (GetImage, xglGetImage); +} + +void +xglGetSpans (DrawablePtr pDrawable, + int wMax, + DDXPointPtr ppt, + int *pwidth, + int nspans, + char *pchardstStart) +{ + ScreenPtr pScreen = pDrawable->pScreen; + + XGL_SCREEN_PRIV (pScreen); + + if (!xglSyncBits (pDrawable, NullBox)) + FatalError (XGL_SW_FAILURE_STRING); + + XGL_SCREEN_UNWRAP (GetSpans); + (*pScreen->GetSpans) (pDrawable, wMax, ppt, pwidth, nspans, pchardstStart); + XGL_SCREEN_WRAP (GetSpans, xglGetSpans); +} diff --git a/xorg-server/hw/xgl/xglglx.c b/xorg-server/hw/xgl/xglglx.c new file mode 100644 index 000000000..d92f9659e --- /dev/null +++ b/xorg-server/hw/xgl/xglglx.c @@ -0,0 +1,260 @@ +/* + * Copyright © 2005 Novell, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * Novell, Inc. not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * Novell, Inc. makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#include "xglglx.h" + +#ifdef GLXEXT + +#ifdef XGL_MODULAR +#include <dlfcn.h> +#endif + +xglGLXFuncRec __xglGLXFunc; + +#ifndef NGLXEXTLOG +FILE *__xglGLXLogFp; +#endif + +static void *glXHandle = 0; +static void *glCoreHandle = 0; + +#define SYM(ptr, name) { (void **) &(ptr), (name) } + +__GLXextensionInfo *__xglExtensionInfo; +__GLXscreenInfo *__xglScreenInfoPtr; + +void +GlxSetVisualConfigs (int nconfigs, + __GLXvisualConfig *configs, + void **privates) +{ + if (glXHandle && glCoreHandle) + (*__xglGLXFunc.setVisualConfigs) (nconfigs, configs, privates); +} + +void +GlxExtensionInit (void) +{ + if (glXHandle && glCoreHandle) + (*__xglGLXFunc.extensionInit) (); +} + +void +GlxWrapInitVisuals (miInitVisualsProcPtr *initVisuals) +{ + if (glXHandle && glCoreHandle) + (*__xglGLXFunc.wrapInitVisuals) (initVisuals); +} + +int +GlxInitVisuals (VisualPtr *visualp, + DepthPtr *depthp, + int *nvisualp, + int *ndepthp, + int *rootDepthp, + VisualID *defaultVisp, + unsigned long sizes, + int bitsPerRGB, + int preferredVis) +{ + if (glXHandle && glCoreHandle) + return (*__xglGLXFunc.initVisuals) (visualp, depthp, nvisualp, ndepthp, + rootDepthp, defaultVisp, sizes, + bitsPerRGB, preferredVis); + + return 0; +} + +void +GlxFlushContextCache (void) +{ + (*__xglGLXFunc.flushContextCache) (); +} + +void +GlxSetRenderTables (struct _glapi_table *table) +{ + (*__xglGLXFunc.setRenderTables) (table); +} + +struct _glapi_table *_mglapi_Dispatch; + +void *(*__glcore_DDXScreenInfo)(void); + +void *__glXglDDXScreenInfo(void) +{ + return __xglScreenInfoPtr; +} + +void *(*__glcore_DDXExtensionInfo)(void); + +void *__glXglDDXExtensionInfo(void) +{ + return __xglExtensionInfo; +} + +void _gl_copy_visual_to_context_mode( __GLcontextModes * mode, + const __GLXvisualConfig * config ) +{ + (*__xglGLXFunc.copy_visual_to_context_mode)(mode, config); +} + +__GLcontextModes *_gl_context_modes_create( unsigned count, size_t minimum_size ) +{ + return (*__xglGLXFunc.context_modes_create)(count, minimum_size); +} + +void _gl_context_modes_destroy( __GLcontextModes * modes ) +{ + (*__xglGLXFunc.context_modes_destroy)(modes); +} + +GLint _gl_convert_from_x_visual_type( int visualType ) +{ + return (*__xglGLXFunc.convert_from_x_visual_type)(visualType); +} + +GLint _gl_convert_to_x_visual_type( int visualType ) +{ + return (*__xglGLXFunc.convert_to_x_visual_type)(visualType); +} + + + +Bool +xglLoadGLXModules (void) +{ + +#ifdef XGL_MODULAR + if (!glXHandle) + { + xglSymbolRec sym[] = { + SYM (__xglGLXFunc.extensionInit, "GlxExtensionInit"), + SYM (__xglGLXFunc.setVisualConfigs, "GlxSetVisualConfigs"), + SYM (__xglGLXFunc.wrapInitVisuals, "GlxWrapInitVisuals"), + SYM (__xglGLXFunc.initVisuals, "GlxInitVisuals"), + SYM (__xglGLXFunc.flushContextCache, "__glXFlushContextCache"), + SYM (__xglGLXFunc.setRenderTables, "GlxSetRenderTables"), + SYM (__xglGLXFunc.copy_visual_to_context_mode, "_gl_copy_visual_to_context_mode"), + SYM (__xglGLXFunc.context_modes_create, "_gl_context_modes_create"), + SYM (__xglGLXFunc.context_modes_destroy, "_gl_context_modes_destroy"), + SYM (__xglGLXFunc.convert_from_x_visual_type, "_gl_convert_from_x_visual_type"), + SYM (__xglGLXFunc.convert_to_x_visual_type, "_gl_convert_to_x_visual_type"), + }; + + glXHandle = xglLoadModule ("glx", RTLD_NOW | RTLD_LOCAL); + if (!glXHandle) + return FALSE; + + if (!xglLookupSymbols (glXHandle, sym, sizeof (sym) / sizeof (sym[0]))) + { + xglUnloadModule (glXHandle); + glXHandle = 0; + + return FALSE; + } + } + + if (!glCoreHandle) + { + xglSymbolRec ddxsym[] = { + SYM (__glcore_DDXExtensionInfo, "__glXglDDXExtensionInfo"), + SYM (__glcore_DDXScreenInfo, "__glXglDDXScreenInfo") + }; + + glCoreHandle = xglLoadModule ("glcore", RTLD_NOW | RTLD_LOCAL); + if (!glCoreHandle) + return FALSE; + + if (!xglLookupSymbols (glCoreHandle, ddxsym, + sizeof (ddxsym) / sizeof(ddxsym[0]))) + { + xglUnloadModule (glCoreHandle); + glCoreHandle = 0; + + return FALSE; + } + + __xglScreenInfoPtr = __glcore_DDXScreenInfo(); + __xglExtensionInfo = __glcore_DDXExtensionInfo(); + { + xglSymbolRec sym[] = { + SYM (__xglScreenInfoPtr->screenProbe, "__MESA_screenProbe"), + SYM (__xglScreenInfoPtr->createContext, "__MESA_createContext"), + SYM (__xglScreenInfoPtr->createBuffer, "__MESA_createBuffer"), + SYM (__xglExtensionInfo->resetExtension, + "__MESA_resetExtension"), + SYM (__xglExtensionInfo->initVisuals, "__MESA_initVisuals"), + SYM (__xglExtensionInfo->setVisualConfigs, + "__MESA_setVisualConfigs"), + + }; + + + if (!xglLookupSymbols (glCoreHandle, sym, + sizeof (sym) / sizeof (sym[0]))) + { + xglUnloadModule (glCoreHandle); + glCoreHandle = 0; + + return FALSE; + } + } + + if (!xglLoadHashFuncs (glCoreHandle)) + { + xglUnloadModule (glCoreHandle); + glCoreHandle = 0; + } + } + + return TRUE; +#else + return FALSE; +#endif + +} + +void +xglUnloadGLXModules (void) +{ + +#ifdef XGL_MODULAR + if (glXHandle) + { + xglUnloadModule (glXHandle); + glXHandle = 0; + } + + if (glCoreHandle) + { + xglUnloadModule (glCoreHandle); + glCoreHandle = 0; + } +#endif + +} + +#endif diff --git a/xorg-server/hw/xgl/xglglx.h b/xorg-server/hw/xgl/xglglx.h new file mode 100644 index 000000000..d895f4262 --- /dev/null +++ b/xorg-server/hw/xgl/xglglx.h @@ -0,0 +1,79 @@ +/* + * Copyright © 2005 Novell, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * Novell, Inc. not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * Novell, Inc. makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#include "xgl.h" + +#ifdef GLXEXT + +#include "glxserver.h" +#include "glxscreens.h" +#include "glxext.h" +#include "glapitable.h" + + +typedef struct _xglGLXFunc { + void (*extensionInit) (void); + void (*setVisualConfigs) (int nconfigs, + __GLXvisualConfig *configs, + void **privates); + void (*wrapInitVisuals) (miInitVisualsProcPtr *initVisuals); + int (*initVisuals) (VisualPtr *visualp, + DepthPtr *depthp, + int *nvisualp, + int *ndepthp, + int *rootDepthp, + VisualID *defaultVisp, + unsigned long sizes, + int bitsPerRGB, + int preferredVis); + + void (*flushContextCache) (void); + void *(*DDXExtensionInfo) (void); + void *(*DDXScreenInfo) (void); + void (*setRenderTables) (struct _glapi_table *table); + void (*copy_visual_to_context_mode)( __GLcontextModes *mode, const __GLXvisualConfig *config ); + __GLcontextModes *(*context_modes_create)( unsigned count, size_t minimum_size ); + void (*context_modes_destroy)( __GLcontextModes * modes ); + GLint (*convert_from_x_visual_type)( int visualType ); + GLint (*convert_to_x_visual_type)( int visualType ); +} xglGLXFuncRec, *xglGLXFuncPtr; + +extern xglGLXFuncRec __xglGLXFunc; + +#ifndef NGLXEXTLOG + +extern FILE *__xglGLXLogFp; + +#endif + +/* xglglx.c */ + +Bool +xglLoadGLXModules (void); + +void +xglUnloadGLXModules (void); + +#endif diff --git a/xorg-server/hw/xgl/xglglyph.c b/xorg-server/hw/xgl/xglglyph.c new file mode 100644 index 000000000..c1a484ac0 --- /dev/null +++ b/xorg-server/hw/xgl/xglglyph.c @@ -0,0 +1,1170 @@ +/* + * Copyright © 2005 Novell, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * Novell, Inc. not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * Novell, Inc. makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#include "xgl.h" + +#ifdef RENDER +#include "gcstruct.h" +#include "picturestr.h" + +#define BITMAP_CACHE_SIZE 256000 +#define BITMAP_CACHE_MAX_LEVEL ~0 +#define BITMAP_CACHE_MAX_SIZE 512 + +#define TEXTURE_CACHE_SIZE 512 +#define TEXTURE_CACHE_MAX_LEVEL 64 +#define TEXTURE_CACHE_MAX_HEIGHT 72 +#define TEXTURE_CACHE_MAX_WIDTH 72 + +#define NEXT_GLYPH_SERIAL_NUMBER ((++glyphSerialNumber) > MAX_SERIAL_NUM ? \ + (glyphSerialNumber = 1): glyphSerialNumber) + +#define GLYPH_GET_AREA_PRIV(pArea) \ + ((xglGlyphAreaPtr) (pArea)->devPrivate.ptr) + +#define GLYPH_AREA_PRIV(pArea) \ + xglGlyphAreaPtr pAreaPriv = GLYPH_GET_AREA_PRIV (pArea) + +#define NEEDS_COMPONENT(f) (PICT_FORMAT_A (f) != 0 && PICT_FORMAT_RGB (f) != 0) + +#define WRITE_VEC2(ptr, _x, _y) \ + *(ptr)++ = (_x); \ + *(ptr)++ = (_y) + +#define WRITE_BOX(ptr, _vx1, _vy1, _vx2, _vy2, box) \ + WRITE_VEC2 (ptr, _vx1, _vy1); \ + WRITE_VEC2 (ptr, (box).x1, (box).y2); \ + WRITE_VEC2 (ptr, _vx2, _vy1); \ + WRITE_VEC2 (ptr, (box).x2, (box).y2); \ + WRITE_VEC2 (ptr, _vx2, _vy2); \ + WRITE_VEC2 (ptr, (box).x2, (box).y1); \ + WRITE_VEC2 (ptr, _vx1, _vy2); \ + WRITE_VEC2 (ptr, (box).x1, (box).y1) + +typedef union _xglGlyphList { + glitz_short_t *s; + glitz_float_t *f; +} xglGlyphListRec, *xglGlyphListPtr; + +typedef struct _xglGlyphArray { + int lastX, lastY; +} xglGlyphArrayRec, *xglGlyphArrayPtr; + +typedef union _xglGlyphVertexData { + xglGlyphArrayRec array; + xglGlyphListRec list; +} xglGlyphVertexDataRec, *xglGlyphVertexDataPtr; + +typedef struct _xglGlyphOp { + GlyphListPtr pLists; + int listLen; + GlyphPtr *ppGlyphs; + int nGlyphs; + int xOff; + int yOff; + Bool noCache; +} xglGlyphOpRec, *xglGlyphOpPtr; + +unsigned long glyphSerialNumber = 0; + +xglAreaRec zeroSizeArea = { + 0, 0, + 0, 0, + 0, 0, + { NULL, NULL, NULL, NULL }, NULL, + (pointer) 0, + { 0 } +}; + +static Bool +xglGlyphCreate (xglAreaPtr pArea) +{ + return TRUE; +} + +static Bool +xglGlyphMoveIn (xglAreaPtr pArea, + pointer closure) +{ + xglGlyphCachePtr pCache = (xglGlyphCachePtr) pArea->pRoot->closure; + GlyphPtr pGlyph = (GlyphPtr) closure; + + XGL_GLYPH_PRIV (pCache->pScreen, pGlyph); + + pGlyphPriv->pArea = pArea; + + return TRUE; +} + +static void +xglGlyphMoveOut (xglAreaPtr pArea, + pointer closure) +{ + xglGlyphCachePtr pCache = (xglGlyphCachePtr) pArea->pRoot->closure; + GlyphPtr pGlyph = (GlyphPtr) closure; + + XGL_GLYPH_PRIV (pCache->pScreen, pGlyph); + + pGlyphPriv->pArea = NULL; +} + +static int +xglGlyphCompareScore (xglAreaPtr pArea, + pointer closure1, + pointer closure2) +{ + GLYPH_AREA_PRIV (pArea); + + if (pAreaPriv->serial == glyphSerialNumber) + return 1; + + return -1; +} + +static const xglAreaFuncsRec xglGlyphAreaFuncs = { + xglGlyphCreate, + xglGlyphMoveIn, + xglGlyphMoveOut, + xglGlyphCompareScore +}; + +Bool +xglRealizeGlyph (ScreenPtr pScreen, + GlyphPtr pGlyph) +{ + PictureScreenPtr pPictureScreen = GetPictureScreen (pScreen); + Bool ret; + + XGL_SCREEN_PRIV (pScreen); + XGL_GLYPH_PRIV (pScreen, pGlyph); + + XGL_PICTURE_SCREEN_UNWRAP (RealizeGlyph); + ret = (*pPictureScreen->RealizeGlyph) (pScreen, pGlyph); + XGL_PICTURE_SCREEN_WRAP (RealizeGlyph, xglRealizeGlyph); + + pGlyphPriv->pArea = NULL; + + return ret; +} + +void +xglUnrealizeGlyph (ScreenPtr pScreen, + GlyphPtr pGlyph) +{ + PictureScreenPtr pPictureScreen = GetPictureScreen (pScreen); + + XGL_SCREEN_PRIV (pScreen); + XGL_GLYPH_PRIV (pScreen, pGlyph); + + XGL_PICTURE_SCREEN_UNWRAP (UnrealizeGlyph); + (*pPictureScreen->UnrealizeGlyph) (pScreen, pGlyph); + XGL_PICTURE_SCREEN_WRAP (UnrealizeGlyph, xglUnrealizeGlyph); + + if (pGlyphPriv->pArea && pGlyphPriv->pArea->width) + xglWithdrawArea (pGlyphPriv->pArea); +} + +Bool +xglInitGlyphCache (xglGlyphCachePtr pCache, + ScreenPtr pScreen, + PictFormatPtr format) +{ + XGL_SCREEN_PRIV (pScreen); + + pCache->depth = format->depth; + + if (!pScreenPriv->pSolidAlpha) + { + xglCreateSolidAlphaPicture (pScreen); + if (!pScreenPriv->pSolidAlpha) + return FALSE; + } + + if (pCache->depth == 1) + { + int stride; + + GEOMETRY_INIT (pScreen, &pCache->u.geometry, + GLITZ_GEOMETRY_TYPE_VERTEX, + GEOMETRY_USAGE_STATIC, BITMAP_CACHE_SIZE); + GEOMETRY_SET_VERTEX_DATA_TYPE (&pCache->u.geometry, + pScreenPriv->geometryDataType); + + stride = pCache->u.geometry.f.vertex.bytes_per_vertex; + if (!xglRootAreaInit (&pCache->rootArea, + BITMAP_CACHE_MAX_LEVEL, + BITMAP_CACHE_SIZE / (stride * 4), + 0, sizeof (xglGlyphAreaRec), + (xglAreaFuncsPtr) &xglGlyphAreaFuncs, + (pointer) pCache)) + { + GEOMETRY_UNINIT (&pCache->u.geometry); + return FALSE; + } + } + else + { + + xglGlyphTexturePtr pTexture = &pCache->u.texture; + glitz_surface_t *mask; + glitz_surface_attributes_t attr; + glitz_vertex_format_t *vertex; + xglVisualPtr pVisual; + + pVisual = xglFindVisualWithDepth (pScreen, format->depth); + if (!pVisual) + return FALSE; + + if (!xglRootAreaInit (&pCache->rootArea, + TEXTURE_CACHE_MAX_LEVEL, + TEXTURE_CACHE_SIZE, TEXTURE_CACHE_SIZE, + sizeof (xglGlyphAreaRec), + (xglAreaFuncsPtr) &xglGlyphAreaFuncs, + (pointer) pCache)) + return FALSE; + + if (pScreenPriv->geometryDataType == GEOMETRY_DATA_TYPE_SHORT) + { + attr.unnormalized = 1; + mask = glitz_surface_create (pScreenPriv->drawable, + pVisual->format.surface, + TEXTURE_CACHE_SIZE, + TEXTURE_CACHE_SIZE, + GLITZ_SURFACE_UNNORMALIZED_MASK, + &attr); + } + else + mask = NULL; + + if (!mask) + { + mask = glitz_surface_create (pScreenPriv->drawable, + pVisual->format.surface, + TEXTURE_CACHE_SIZE, + TEXTURE_CACHE_SIZE, + 0, NULL); + if (!mask) + return FALSE; + + pTexture->geometryDataType = GEOMETRY_DATA_TYPE_FLOAT; + } + else + pTexture->geometryDataType = GEOMETRY_DATA_TYPE_SHORT; + + if (NEEDS_COMPONENT (format->format)) + glitz_surface_set_component_alpha (mask, 1); + + pTexture->pMask = xglCreateDevicePicture (mask); + if (!pTexture->pMask) + return FALSE; + + vertex = &pCache->u.texture.format.vertex; + vertex->primitive = GLITZ_PRIMITIVE_QUADS; + vertex->mask.size = GLITZ_COORDINATE_SIZE_XY; + vertex->attributes = GLITZ_VERTEX_ATTRIBUTE_MASK_COORD_MASK; + + if (pTexture->geometryDataType == GEOMETRY_DATA_TYPE_FLOAT) + { + vertex->type = GLITZ_DATA_TYPE_FLOAT; + vertex->bytes_per_vertex = sizeof (glitz_float_t) * 4; + vertex->mask.offset = sizeof (glitz_float_t) * 2; + vertex->mask.type = GLITZ_DATA_TYPE_FLOAT; + } + else + { + vertex->type = GLITZ_DATA_TYPE_SHORT; + vertex->bytes_per_vertex = sizeof (glitz_short_t) * 4; + vertex->mask.offset = sizeof (glitz_short_t) * 2; + vertex->mask.type = GLITZ_DATA_TYPE_SHORT; + } + + pTexture->pixel.fourcc = GLITZ_FOURCC_RGB; + pTexture->pixel.masks = pVisual->pPixel->masks; + pTexture->pixel.scanline_order = GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP; + pTexture->pixel.bytes_per_line = 0; + pTexture->pixel.xoffset = 0; + pTexture->pixel.skip_lines = 0; + } + + pCache->pScreen = pScreen; + + return TRUE; +} + +void +xglFiniGlyphCache (xglGlyphCachePtr pCache) +{ + if (pCache->pScreen) + { + xglRootAreaFini (&pCache->rootArea); + + if (pCache->depth == 1) + { + GEOMETRY_UNINIT (&pCache->u.geometry); + } + else + { + if (pCache->u.texture.pMask) + FreePicture ((pointer) pCache->u.texture.pMask, 0); + } + + pCache->pScreen = NULL; + } +} + +static xglAreaPtr +xglCacheGlyph (xglGlyphCachePtr pCache, + GlyphPtr pGlyph) +{ + ScreenPtr pScreen = pCache->pScreen; + + XGL_GLYPH_PRIV (pScreen, pGlyph); + + if (pCache->depth == 1) + { + PixmapPtr pPixmap; + RegionPtr pRegion; + int nBox; + + pPixmap = GetScratchPixmapHeader (pScreen, + pGlyph->info.width, + pGlyph->info.height, + pCache->depth, pCache->depth, 0, + (pointer) (pGlyph + 1)); + if (!pPixmap) + return NULL; + + (*pScreen->ModifyPixmapHeader) (pPixmap, + pGlyph->info.width, + pGlyph->info.height, + 0, 0, -1, (pointer) (pGlyph + 1)); + + pRegion = (*pScreen->BitmapToRegion) (pPixmap); + FreeScratchPixmapHeader (pPixmap); + + if (!pRegion) + return NULL; + + nBox = REGION_NUM_RECTS (pRegion); + if (nBox > BITMAP_CACHE_MAX_SIZE) + { + REGION_DESTROY (pScreen, pRegion); + return NULL; + } + + if (nBox > 0) + { + /* Find available area */ + if (!xglFindArea (pCache->rootArea.pArea, nBox, 0, + FALSE, (pointer) pGlyph)) + { + /* Kicking out area with lower score */ + xglFindArea (pCache->rootArea.pArea, nBox, 0, + TRUE, (pointer) pGlyph); + } + + if (pGlyphPriv->pArea) + { + int stride; + + GLYPH_AREA_PRIV (pGlyphPriv->pArea); + + pAreaPriv->serial = glyphSerialNumber; + pAreaPriv->u.range.first = pGlyphPriv->pArea->x * 4; + pAreaPriv->u.range.count = nBox * 4; + + stride = pCache->u.geometry.f.vertex.bytes_per_vertex; + GEOMETRY_ADD_REGION_AT (pScreen, &pCache->u.geometry, pRegion, + pGlyphPriv->pArea->x * stride * 4); + } + } else + pGlyphPriv->pArea = &zeroSizeArea; + + REGION_DESTROY (pScreen, pRegion); + } + else + { + xglGlyphTexturePtr pTexture = &pCache->u.texture; + + if (pGlyph->info.width > TEXTURE_CACHE_MAX_WIDTH || + pGlyph->info.height > TEXTURE_CACHE_MAX_HEIGHT) + return NULL; + + if (pGlyph->info.width > 0 && pGlyph->info.height > 0) + { + glitz_buffer_t *buffer; + + buffer = glitz_buffer_create_for_data (pGlyph + 1); + if (!buffer) + return NULL; + + /* Find available area */ + if (!xglFindArea (pCache->rootArea.pArea, + pGlyph->info.width, pGlyph->info.height, + FALSE, (pointer) pGlyph)) + { + /* Kicking out area with lower score */ + xglFindArea (pCache->rootArea.pArea, + pGlyph->info.width, pGlyph->info.height, + TRUE, (pointer) pGlyph); + } + + if (pGlyphPriv->pArea) + { + glitz_surface_t *surface; + glitz_point_fixed_t p1, p2; + glitz_pixel_format_t pixel; + + GLYPH_AREA_PRIV (pGlyphPriv->pArea); + + pixel = pTexture->pixel; + pixel.bytes_per_line = + PixmapBytePad (pGlyph->info.width, pCache->depth); + + surface = pTexture->pMask->pSourcePict->source.devPrivate.ptr; + + glitz_set_pixels (surface, + pGlyphPriv->pArea->x, + pGlyphPriv->pArea->y, + pGlyph->info.width, + pGlyph->info.height, + &pixel, + buffer); + + p1.x = pGlyphPriv->pArea->x << 16; + p1.y = pGlyphPriv->pArea->y << 16; + p2.x = (pGlyphPriv->pArea->x + pGlyph->info.width) << 16; + p2.y = (pGlyphPriv->pArea->y + pGlyph->info.height) << 16; + + glitz_surface_translate_point (surface, &p1, &p1); + glitz_surface_translate_point (surface, &p2, &p2); + + pAreaPriv->serial = glyphSerialNumber; + if (pTexture->geometryDataType) + { + pAreaPriv->u.box.fBox.x1 = FIXED_TO_FLOAT (p1.x); + pAreaPriv->u.box.fBox.y1 = FIXED_TO_FLOAT (p1.y); + pAreaPriv->u.box.fBox.x2 = FIXED_TO_FLOAT (p2.x); + pAreaPriv->u.box.fBox.y2 = FIXED_TO_FLOAT (p2.y); + } + else + { + pAreaPriv->u.box.sBox.x1 = p1.x >> 16; + pAreaPriv->u.box.sBox.y1 = p1.y >> 16; + pAreaPriv->u.box.sBox.x2 = p2.x >> 16; + pAreaPriv->u.box.sBox.y2 = p2.y >> 16; + } + } + glitz_buffer_destroy (buffer); + } else + pGlyphPriv->pArea = &zeroSizeArea; + } + + return pGlyphPriv->pArea; +} + +static void +xglUncachedGlyphs (CARD8 op, + PicturePtr pSrc, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + xglGlyphOpPtr pOp) +{ + ScreenPtr pScreen = pDst->pDrawable->pScreen; + PicturePtr pPicture = NULL; + PixmapPtr pPixmap = NULL; + xglGlyphCachePtr pCache; + int depth = pOp->pLists->format->depth; + GlyphPtr glyph; + INT16 xOff, yOff; + xglGlyphPtr pGlyphPriv; + xglAreaPtr pArea; + Bool usingCache = !pOp->noCache; + + XGL_SCREEN_PRIV (pScreen); + + pCache = &pScreenPriv->glyphCache[depth]; + if (usingCache) + { + if (!pCache->pScreen) + { + if (!xglInitGlyphCache (pCache, pScreen, pOp->pLists->format)) + usingCache = FALSE; + } + } + + while (pOp->nGlyphs) + { + glyph = *pOp->ppGlyphs; + + if (!pOp->listLen) + { + pOp->pLists++; + pOp->listLen = pOp->pLists->len; + pOp->xOff += pOp->pLists->xOff; + pOp->yOff += pOp->pLists->yOff; + } + + xOff = pOp->xOff; + yOff = pOp->yOff; + + if (usingCache) + { + pGlyphPriv = XGL_GET_GLYPH_PRIV (pScreen, glyph); + pArea = pGlyphPriv->pArea; + if (pSrc) + { + if (!pArea) + pArea = xglCacheGlyph (pCache, glyph); + + if (pArea) + break; + } + } else + pArea = NULL; + + pOp->listLen--; + pOp->nGlyphs--; + pOp->ppGlyphs++; + + pOp->xOff += glyph->info.xOff; + pOp->yOff += glyph->info.yOff; + + if (pArea) + continue; + + if (!pPicture) + { + XID componentAlpha; + int error; + + pPixmap = GetScratchPixmapHeader (pScreen, + glyph->info.width, + glyph->info.height, + depth, depth, + 0, (pointer) (glyph + 1)); + if (!pPixmap) + return; + + componentAlpha = NEEDS_COMPONENT (pOp->pLists->format->format); + pPicture = CreatePicture (0, &pPixmap->drawable, + pOp->pLists->format, + CPComponentAlpha, &componentAlpha, + serverClient, &error); + if (!pPicture) + { + FreeScratchPixmapHeader (pPixmap); + return; + } + } + + (*pScreen->ModifyPixmapHeader) (pPixmap, + glyph->info.width, glyph->info.height, + 0, 0, -1, (pointer) (glyph + 1)); + pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER; + + if (pSrc) + CompositePicture (op, + pSrc, + pPicture, + pDst, + xSrc + (xOff - glyph->info.x), + ySrc + (yOff - glyph->info.y), + 0, 0, + xOff - glyph->info.x, + yOff - glyph->info.y, + glyph->info.width, + glyph->info.height); + else + CompositePicture (PictOpAdd, + pPicture, + NULL, + pDst, + 0, 0, + 0, 0, + xOff - glyph->info.x, + yOff - glyph->info.y, + glyph->info.width, + glyph->info.height); + } + + if (pPicture) + { + FreeScratchPixmapHeader (pPixmap); + FreePicture ((pointer) pPicture, 0); + } +} + +static Bool +xglCachedGlyphs (CARD8 op, + PicturePtr pSrc, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + xglGlyphOpPtr pOp) +{ + ScreenPtr pScreen = pDst->pDrawable->pScreen; + xglGlyphOpRec opSave = *pOp; + xglGlyphCachePtr pCache; + xglGlyphVertexDataRec vData; + xglGeometryPtr pGeometry; + GlyphPtr glyph; + xglGlyphPtr pGlyphPriv; + xglAreaPtr pArea; + xglGlyphAreaPtr pGlyphArea; + BoxRec extents; + INT16 xOff, yOff, x1, x2, y1, y2; + int depth = pOp->pLists->format->depth; + int i, remaining = pOp->nGlyphs; + int nGlyph = 0; + PicturePtr pMaskPicture = NULL; + + XGL_SCREEN_PRIV (pScreen); + + pCache = &pScreenPriv->glyphCache[depth]; + if (!pCache->pScreen) + { + if (!xglInitGlyphCache (pCache, pScreen, pOp->pLists->format)) + { + pOp->noCache = TRUE; + return 1; + } + } + + /* update serial number for all glyphs already in cache so that + we don't accidentally replace one. */ + for (i = 0; i < pOp->nGlyphs; i++) + { + pGlyphPriv = XGL_GET_GLYPH_PRIV (pScreen, pOp->ppGlyphs[i]); + pArea = pGlyphPriv->pArea; + if (pArea && pArea->width) + GLYPH_GET_AREA_PRIV (pArea)->serial = glyphSerialNumber; + } + + for (i = 0; i < pOp->nGlyphs; i++) + { + pGlyphPriv = XGL_GET_GLYPH_PRIV (pScreen, pOp->ppGlyphs[i]); + pArea = pGlyphPriv->pArea; + if (!pArea) + pArea = xglCacheGlyph (pCache, pOp->ppGlyphs[i]); + + if (pArea) + { + if (pArea->width) + nGlyph++; + } + else if (pSrc) + break; + } + + if (nGlyph) + { + if (depth == 1) + { + glitz_multi_array_t *multiArray; + + pGeometry = &pCache->u.geometry; + pGeometry->xOff = pGeometry->yOff = 0; + + multiArray = glitz_multi_array_create (nGlyph); + if (!multiArray) + return 1; + + GEOMETRY_SET_MULTI_ARRAY (pGeometry, multiArray); + glitz_multi_array_destroy (multiArray); + + vData.array.lastX = 0; + vData.array.lastY = 0; + } + else + { + i = 4 * pCache->u.texture.format.vertex.bytes_per_vertex * nGlyph; + pGeometry = xglGetScratchGeometryWithSize (pScreen, i); + + pGeometry->f = pCache->u.texture.format; + pGeometry->type = GLITZ_GEOMETRY_TYPE_VERTEX; + pMaskPicture = pCache->u.texture.pMask; + + vData.list.s = glitz_buffer_map (pGeometry->buffer, + GLITZ_BUFFER_ACCESS_WRITE_ONLY); + } + } else + pGeometry = NULL; + + extents.x1 = MAXSHORT; + extents.y1 = MAXSHORT; + extents.x2 = MINSHORT; + extents.y2 = MINSHORT; + + while (pOp->nGlyphs) + { + glyph = *pOp->ppGlyphs; + + if (!pOp->listLen) + { + pOp->pLists++; + pOp->listLen = pOp->pLists->len; + pOp->xOff += pOp->pLists->xOff; + pOp->yOff += pOp->pLists->yOff; + } + + xOff = pOp->xOff; + yOff = pOp->yOff; + + pGlyphPriv = XGL_GET_GLYPH_PRIV (pScreen, glyph); + pArea = pGlyphPriv->pArea; + if (!pArea && pSrc) + break; + + pOp->listLen--; + pOp->nGlyphs--; + pOp->ppGlyphs++; + + pOp->xOff += glyph->info.xOff; + pOp->yOff += glyph->info.yOff; + + if (!pArea) + continue; + + x1 = xOff - glyph->info.x; + x2 = x1 + glyph->info.width; + if (x1 < extents.x1) + extents.x1 = x1; + if (x2 > extents.x2) + extents.x2 = x2; + + y1 = yOff - glyph->info.y; + y2 = y1 + glyph->info.height; + if (y1 < extents.y1) + extents.y1 = y1; + if (y2 > extents.y2) + extents.y2 = y2; + + if (pArea->width) + { + pGlyphArea = GLYPH_GET_AREA_PRIV (pArea); + if (depth == 1) + { + glitz_multi_array_add (pGeometry->array, + pGlyphArea->u.range.first, 2, + pGlyphArea->u.range.count, + (x1 - vData.array.lastX) << 16, + (y1 - vData.array.lastY) << 16); + vData.array.lastX = x1; + vData.array.lastY = y1; + } + else + { + if (pCache->u.texture.geometryDataType) + { + WRITE_BOX (vData.list.f, x1, y1, x2, y2, + pGlyphArea->u.box.fBox); + } + else + { + WRITE_BOX (vData.list.s, x1, y1, x2, y2, + pGlyphArea->u.box.sBox); + } + } + } + remaining--; + } + + NEXT_GLYPH_SERIAL_NUMBER; + + if (nGlyph) + { + if (depth != 1) + { + glitz_buffer_unmap (pGeometry->buffer); + pGeometry->count = nGlyph * 4; + } + + xSrc += extents.x1; + ySrc += extents.y1; + + if (!pSrc) + { + op = PictOpAdd; + pSrc = pScreenPriv->pSolidAlpha; + + if (remaining) + *pOp = opSave; + } + + GEOMETRY_TRANSLATE (pGeometry, + pDst->pDrawable->x, + pDst->pDrawable->y); + + if (xglCompositeGeneral (op, + pSrc, + pMaskPicture, + pDst, + pGeometry, + xSrc, ySrc, + 0, 0, + pDst->pDrawable->x + extents.x1, + pDst->pDrawable->y + extents.y1, + extents.x2 - extents.x1, + extents.y2 - extents.y1)) + { + xglAddCurrentBitDamage (pDst->pDrawable); + return remaining; + } + + remaining = ~0; + *pOp = opSave; + pOp->noCache = TRUE; + } + else + { + if (remaining) + { + *pOp = opSave; + pOp->noCache = TRUE; + } + } + + return remaining; +} + +static Bool +xglGlyphExtents (PicturePtr pDst, + int nlist, + GlyphListPtr list, + GlyphPtr *glyphs, + BoxPtr extents) +{ + GlyphPtr glyph; + BoxRec line; + int x1, x2, y1, y2; + int n; + int x; + int y; + Bool overlap = FALSE; + + x = 0; + y = 0; + + extents->x1 = MAXSHORT; + extents->x2 = MINSHORT; + extents->y1 = MAXSHORT; + extents->y2 = MINSHORT; + + while (!list->len) + { + if (--nlist) + { + x += list->xOff; + y += list->yOff; + list++; + } + else + { + return FALSE; + } + } + + glyph = *glyphs; + x1 = (x + list->xOff) - glyph->info.x; + if (x1 < MINSHORT) + x1 = MINSHORT; + y1 = (y + list->yOff) - glyph->info.y; + if (y1 < MINSHORT) + y1 = MINSHORT; + + line.x1 = x1; + line.x2 = x1; + line.y1 = y1; + line.y2 = y1; + + while (nlist--) + { + x += list->xOff; + y += list->yOff; + n = list->len; + list++; + + while (n--) + { + glyph = *glyphs++; + x1 = x - glyph->info.x; + if (x1 < MINSHORT) + x1 = MINSHORT; + y1 = y - glyph->info.y; + if (y1 < MINSHORT) + y1 = MINSHORT; + x2 = x1 + glyph->info.width; + if (x2 > MAXSHORT) + x2 = MAXSHORT; + y2 = y1 + glyph->info.height; + if (y2 > MAXSHORT) + y2 = MAXSHORT; + + if (x1 >= line.x2) + { + line.x2 = x2; + if (y1 < line.y1) + line.y1 = y1; + if (y2 > line.y2) + line.y2 = y2; + } + else if (x2 <= line.x1) + { + line.x1 = x1; + if (y1 < line.y1) + line.y1 = y1; + if (y2 > line.y2) + line.y2 = y2; + } + else + { + if (line.y1 >= extents->y2) + { + extents->y2 = line.y2; + if (line.y1 < extents->y1) + extents->y1 = line.y1; + } + else if (line.y2 <= extents->y1) + { + extents->y1 = line.y1; + if (line.y2 > extents->y2) + extents->y2 = line.y2; + } + else + { + if (line.y1 < extents->y1) + extents->y1 = line.y1; + if (line.y2 > extents->y2) + extents->y2 = line.y2; + + overlap = TRUE; + } + + if (line.x1 < extents->x1) + extents->x1 = line.x1; + if (line.x2 > extents->x2) + extents->x2 = line.x2; + + line.x1 = x1; + line.y1 = y1; + line.x2 = x2; + line.y2 = y2; + } + + x += glyph->info.xOff; + y += glyph->info.yOff; + } + } + + if (line.y1 >= extents->y2) + { + extents->y2 = line.y2; + if (line.y1 < extents->y1) + extents->y1 = line.y1; + } + else if (line.y2 <= extents->y1) + { + extents->y1 = line.y1; + if (line.y2 > extents->y2) + extents->y2 = line.y2; + } + else + { + if (line.y1 < extents->y1) + extents->y1 = line.y1; + if (line.y2 > extents->y2) + extents->y2 = line.y2; + + overlap = TRUE; + } + + if (line.x1 < extents->x1) + extents->x1 = line.x1; + if (line.x2 > extents->x2) + extents->x2 = line.x2; + + xglPictureClipExtents (pDst, extents); + + return overlap; +} + +/* returns 0 if all glyph lists don't have the same format */ +static CARD32 +xglGlyphListFormatId (GlyphListPtr list, + int nlist) +{ + CARD32 id = list->format->id; + + nlist--; + list++; + + while (nlist--) + { + if (list->format->id != id) + return 0; + + list++; + } + + return id; +} + +void +xglGlyphs (CARD8 op, + PicturePtr pSrc, + PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, + INT16 ySrc, + int nlist, + GlyphListPtr list, + GlyphPtr *glyphs) +{ + ScreenPtr pScreen = pDst->pDrawable->pScreen; + PicturePtr pMask = NULL, pSrcPicture, pDstPicture; + BoxRec extents; + xglGlyphOpRec glyphOp; + int xDst = list->xOff, yDst = list->yOff; + int overlap; + int target; + + overlap = xglGlyphExtents (pDst, nlist, list, glyphs, &extents); + if (extents.x2 <= extents.x1 || extents.y2 <= extents.y1) + return; + + target = xglPrepareTarget (pDst->pDrawable); + + if (op != PictOpAdd && maskFormat && + (!target || overlap || op != PictOpOver || + xglGlyphListFormatId (list, nlist) != maskFormat->id)) + { + PixmapPtr pPixmap; + XID componentAlpha; + GCPtr pGC; + xRectangle rect; + int error; + + rect.x = 0; + rect.y = 0; + rect.width = extents.x2 - extents.x1; + rect.height = extents.y2 - extents.y1; + + pPixmap = (*pScreen->CreatePixmap) (pScreen, + rect.width, rect.height, + maskFormat->depth, + CREATE_PIXMAP_USAGE_SCRATCH); + if (!pPixmap) + return; + + componentAlpha = NEEDS_COMPONENT (maskFormat->format); + pMask = CreatePicture (0, &pPixmap->drawable, + maskFormat, CPComponentAlpha, &componentAlpha, + serverClient, &error); + if (!pMask) + { + (*pScreen->DestroyPixmap) (pPixmap); + return; + } + + if (!target) + { + /* make sure we don't do accelerated drawing to mask */ + xglSetPixmapVisual (pPixmap, NULL); + } + + ValidatePicture (pMask); + pGC = GetScratchGC (pPixmap->drawable.depth, pScreen); + ValidateGC (&pPixmap->drawable, pGC); + (*pGC->ops->PolyFillRect) (&pPixmap->drawable, pGC, 1, &rect); + FreeScratchGC (pGC); + + (*pScreen->DestroyPixmap) (pPixmap); + + target = xglPrepareTarget (pMask->pDrawable); + + glyphOp.xOff = -extents.x1; + glyphOp.yOff = -extents.y1; + pSrcPicture = NULL; + pDstPicture = pMask; + } + else + { + glyphOp.xOff = 0; + glyphOp.yOff = 0; + pSrcPicture = pSrc; + pDstPicture = pDst; + } + + glyphOp.ppGlyphs = glyphs; + glyphOp.noCache = !target; + + while (nlist--) + { + glyphOp.xOff += list->xOff; + glyphOp.yOff += list->yOff; + glyphOp.listLen = list->len; + glyphOp.nGlyphs = list->len; + glyphOp.pLists = list++; + + for (; nlist; nlist--, list++) + { + if (list->format->id != glyphOp.pLists->format->id) + break; + + glyphOp.nGlyphs += list->len; + } + + while (glyphOp.nGlyphs) + { + if (glyphOp.noCache || xglCachedGlyphs (op, + pSrcPicture, + pDstPicture, + xSrc - xDst, ySrc - yDst, + &glyphOp)) + xglUncachedGlyphs (op, + pSrcPicture, + pDstPicture, + xSrc - xDst, ySrc - yDst, + &glyphOp); + } + } + + if (pMask) + { + CompositePicture (op, pSrc, pMask, pDst, + xSrc + extents.x1 - xDst, + ySrc + extents.y1 - yDst, + 0, 0, + extents.x1, extents.y1, + extents.x2 - extents.x1, + extents.y2 - extents.y1); + + FreePicture ((pointer) pMask, (XID) 0); + } +} + +#endif diff --git a/xorg-server/hw/xgl/xglhash.c b/xorg-server/hw/xgl/xglhash.c new file mode 100644 index 000000000..c6c22ad88 --- /dev/null +++ b/xorg-server/hw/xgl/xglhash.c @@ -0,0 +1,134 @@ +/* + * Copyright © 2005 Novell, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * Novell, Inc. not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * Novell, Inc. makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#include "xgl.h" + +#define SYM(ptr, name) { (void **) &(ptr), (name) } + +typedef struct _xglHashFunc { + xglHashTablePtr (*NewHashTable) (void); + void (*DeleteHashTable) (xglHashTablePtr pTable); + void *(*HashLookup) (const xglHashTablePtr pTable, + unsigned int key); + void (*HashInsert) (xglHashTablePtr pTable, + unsigned int key, + void *data); + void (*HashRemove) (xglHashTablePtr pTable, + unsigned int key); + unsigned int (*HashFirstEntry) (xglHashTablePtr pTable); + unsigned int (*HashNextEntry) (const xglHashTablePtr pTable, + unsigned int key); + unsigned int (*HashFindFreeKeyBlock) (xglHashTablePtr pTable, + unsigned int numKeys); +} xglHashFuncRec; + +static xglHashFuncRec __hashFunc; + +static void *hashHandle = 0; + +Bool +xglLoadHashFuncs (void *handle) +{ + +#ifdef XGL_MODULAR + xglSymbolRec sym[] = { + SYM (__hashFunc.NewHashTable, "_mesa_NewHashTable"), + SYM (__hashFunc.DeleteHashTable, "_mesa_DeleteHashTable"), + SYM (__hashFunc.HashLookup, "_mesa_HashLookup"), + SYM (__hashFunc.HashInsert, "_mesa_HashInsert"), + SYM (__hashFunc.HashRemove, "_mesa_HashRemove"), + SYM (__hashFunc.HashFirstEntry, "_mesa_HashFirstEntry"), + SYM (__hashFunc.HashNextEntry, "_mesa_HashNextEntry"), + SYM (__hashFunc.HashFindFreeKeyBlock, "_mesa_HashFindFreeKeyBlock") + }; + + if (!xglLookupSymbols (handle, sym, sizeof (sym) / sizeof (sym[0]))) + return FALSE; + + hashHandle = handle; + + return TRUE; +#else + return FALSE; +#endif + +} + +xglHashTablePtr +xglNewHashTable (void) +{ + if (!hashHandle) + return 0; + + return (*__hashFunc.NewHashTable) (); +} + +void +xglDeleteHashTable (xglHashTablePtr pTable) +{ + (*__hashFunc.DeleteHashTable) (pTable); +} + +void * +xglHashLookup (const xglHashTablePtr pTable, + unsigned int key) +{ + return (*__hashFunc.HashLookup) (pTable, key); +} + +void +xglHashInsert (xglHashTablePtr pTable, + unsigned int key, + void *data) +{ + (*__hashFunc.HashInsert) (pTable, key, data); +} + +void +xglHashRemove (xglHashTablePtr pTable, + unsigned int key) +{ + (*__hashFunc.HashRemove) (pTable, key); +} + +unsigned int +xglHashFirstEntry (xglHashTablePtr pTable) +{ + return (*__hashFunc.HashFirstEntry) (pTable); +} + +unsigned int +xglHashNextEntry (const xglHashTablePtr pTable, + unsigned int key) +{ + return (*__hashFunc.HashNextEntry) (pTable, key); +} + +unsigned int +xglHashFindFreeKeyBlock (xglHashTablePtr pTable, + unsigned int numKeys) +{ + return (*__hashFunc.HashFindFreeKeyBlock) (pTable, numKeys); +} diff --git a/xorg-server/hw/xgl/xglinit.c b/xorg-server/hw/xgl/xglinit.c new file mode 100644 index 000000000..e0c9e7ded --- /dev/null +++ b/xorg-server/hw/xgl/xglinit.c @@ -0,0 +1,336 @@ +/* + * Copyright © 2005 Novell, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * Novell, Inc. not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * Novell, Inc. makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#include "xgl.h" +#include "xglglx.h" +#include "micmap.h" +#include "mipointer.h" +#include "fb.h" + +#ifdef XGL_MODULAR +#include <dlfcn.h> +#endif + +#define DEFAULT_DDX_MODULE_NAME "xglx" + +static char *ddxModuleName = DEFAULT_DDX_MODULE_NAME; + +xglScreenInfoRec xglScreenInfo = { + NULL, 0, 0, 0, 0, 0, + DEFAULT_GEOMETRY_DATA_TYPE, + DEFAULT_GEOMETRY_USAGE, + FALSE, + XGL_DEFAULT_PBO_MASK, + FALSE, + { + { FALSE, FALSE, { 0, 0, 0, 0 } }, + { FALSE, FALSE, { 0, 0, 0, 0 } }, + { FALSE, FALSE, { 0, 0, 0, 0 } }, + { FALSE, FALSE, { 0, 0, 0, 0 } } + } +}; + +#ifdef GLXEXT +static Bool loadGlx = TRUE; + +#ifndef NGLXEXTLOG +static char *glxExtLogFile = 0; +#endif + +#endif + +typedef struct _xglDDXFunc { + void (*initOutput) (ScreenInfo *pScreenInfo, + int argc, + char **argv); + void (*initInput) (int argc, + char **argv); + Bool (*legalModifier) (unsigned int key, + DevicePtr pDev); + void (*processInputEvents) (void); + void (*useMsg) (void); + int (*processArgument) (int argc, + char **argv, + int i); + void (*abort) (void); + void (*giveUp) (void); + void (*osVendorInit) (void); +} xglDDXFuncRec; + +static xglDDXFuncRec __ddxFunc; + +#define SYMFUNC(name) ((void *) (name)) +#define SYMVAR(name) ((void *) &(name)) + +/* + * The following table is used to make sure that all symbols required by + * dynamically loaded modules are present in the main program. Add more symbols + * as needed. + */ + +void *symTab[] = { + SYMFUNC (xglKbdCtrl), + SYMFUNC (xglSetPixmapFormats), + SYMVAR (xglVisuals), + + SYMFUNC (mieqEnqueue), + SYMFUNC (mieqInit), + SYMFUNC (mieqProcessInputEvents), + SYMFUNC (miPointerAbsoluteCursor), + SYMFUNC (miRegisterPointerDevice), + SYMFUNC (miPointerWarpCursor), + SYMFUNC (miDCInitialize), + SYMFUNC (miPointerAbsoluteCursor), + SYMFUNC (miPointerUpdate), + SYMFUNC (miRegisterRedirectBorderClipProc) +}; + +#define SYM(ptr, name) { (void **) &(ptr), (name) } + +static Bool +xglEnsureDDXModule (void) +{ + +#ifdef XGL_MODULAR + static void *ddxHandle = 0; + static Bool status = TRUE; + + if (!status) + return FALSE; + +#ifdef GLXEXT + /* GLX and GLcore modules must be loaded with RTLD_NOW and RTLD_LOCAL + flags before DDX module which is linked to libGL and should be + loaded with RTLD_GLOBAL. */ + if (loadGlx) + { + if (!xglLoadGLXModules ()) + FatalError ("No GLX modules loaded"); + +#ifndef NGLXEXTLOG + if (glxExtLogFile) + { + __xglGLXLogFp = fopen (glxExtLogFile, "w"); + if (!__xglGLXLogFp) + perror ("InitOutput"); + } + else + __xglGLXLogFp = 0; +#endif + + } +#endif + + if (!ddxHandle) + { + xglSymbolRec sym[] = { + SYM (__ddxFunc.initOutput, "InitOutput"), + SYM (__ddxFunc.initInput, "InitInput"), + SYM (__ddxFunc.legalModifier, "LegalModifier"), + SYM (__ddxFunc.processInputEvents, "ProcessInputEvents"), + SYM (__ddxFunc.useMsg, "ddxUseMsg"), + SYM (__ddxFunc.processArgument, "ddxProcessArgument"), + SYM (__ddxFunc.abort, "AbortDDX"), + SYM (__ddxFunc.giveUp, "ddxGiveUp"), + SYM (__ddxFunc.osVendorInit, "OsVendorInit") + }; + + ddxHandle = xglLoadModule (ddxModuleName, RTLD_NOW | RTLD_GLOBAL); + if (!ddxHandle) + return (status = FALSE); + + if (!xglLookupSymbols (ddxHandle, sym, sizeof (sym) / sizeof (sym[0]))) + { + xglUnloadModule (ddxHandle); + ddxHandle = 0; + + return (status = FALSE); + } + } + + return TRUE; +#else + return FALSE; +#endif + +} + +void +InitOutput (ScreenInfo *pScreenInfo, + int argc, + char **argv) +{ + (void) symTab; + + if (!xglEnsureDDXModule ()) + FatalError ("No DDX module loaded"); + + (*__ddxFunc.initOutput) (pScreenInfo, argc, argv); +} + +Bool +LegalModifier (unsigned int key, + DeviceIntPtr pDev) +{ + return (*__ddxFunc.legalModifier) (key, pDev); +} + +void +ProcessInputEvents (void) +{ + (*__ddxFunc.processInputEvents) (); +} + +void +InitInput (int argc, + char **argv) +{ + if (!xglEnsureDDXModule ()) + FatalError ("No DDX module loaded"); + + (*__ddxFunc.initInput) (argc, argv); +} + +void +ddxUseMsg (void) +{ + ErrorF ("\nXgl usage:\n"); + ErrorF ("-ddx module specify ddx module\n"); + +#ifdef GLXEXT + ErrorF ("-noglx don't load glx extension\n"); + +#ifndef NGLXEXTLOG + ErrorF ("-glxlog file glx extension log file\n"); +#endif + +#endif + + xglUseMsg (); + + if (xglEnsureDDXModule ()) + (*__ddxFunc.useMsg) (); +} + +int +ddxProcessArgument (int argc, + char **argv, + int i) +{ + static Bool checkDDX = FALSE; + int skip; + + if (!checkDDX) + { + int j; + + for (j = i; j < argc; j++) + { + if (!strcmp (argv[j], "-ddx")) + { + if (++j < argc) + ddxModuleName = argv[j]; + } + +#ifdef GLXEXT + else if (!strcmp (argv[j], "-noglx")) + { + loadGlx = FALSE; + } + +#ifndef NGLXEXTLOG + else if (!strcmp (argv[j], "-glxlog")) + { + if (++j < argc) + glxExtLogFile = argv[j]; + } +#endif + +#endif + + } + checkDDX = TRUE; + } + + if (!strcmp (argv[i], "-ddx")) + { + if ((i + 1) < argc) + return 2; + + return 1; + } + +#ifdef GLXEXT + else if (!strcmp (argv[i], "-noglx")) + { + return 1; + } + +#ifndef NGLXEXTLOG + else if (!strcmp (argv[i], "-glxlog")) + { + if ((i + 1) < argc) + return 2; + + return 1; + } +#endif + +#endif + + skip = xglProcessArgument (argc, argv, i); + if (skip) + return skip; + + if (xglEnsureDDXModule ()) + return (*__ddxFunc.processArgument) (argc, argv, i); + + return 0; +} + +void +AbortDDX (void) +{ + if (xglEnsureDDXModule ()) + (*__ddxFunc.abort) (); +} + +void +ddxGiveUp (void) +{ + if (xglEnsureDDXModule ()) + (*__ddxFunc.giveUp) (); +} + +void +OsVendorInit (void) +{ + if (xglEnsureDDXModule ()) + (*__ddxFunc.osVendorInit) (); +} + +void ddxInitGlobals() +{ +} diff --git a/xorg-server/hw/xgl/xglinput.c b/xorg-server/hw/xgl/xglinput.c new file mode 100644 index 000000000..9499fcf1f --- /dev/null +++ b/xorg-server/hw/xgl/xglinput.c @@ -0,0 +1,263 @@ +/* + * Copyright © 2004 David Reveman + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * David Reveman not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * David Reveman makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#include "xgl.h" +#include "inputstr.h" +#include "mipointer.h" + +#define XK_PUBLISHING +#include <X11/keysym.h> +#if HAVE_X11_XF86KEYSYM_H +#include <X11/XF86keysym.h> +#endif + +#define NUM_BUTTONS 7 + +int +xglMouseProc (DeviceIntPtr pDevice, + int onoff) +{ + BYTE map[NUM_BUTTONS + 1]; + DevicePtr pDev = (DevicePtr) pDevice; + int i; + + switch (onoff) { + case DEVICE_INIT: + for (i = 1; i <= NUM_BUTTONS; i++) + map[i] = i; + + InitPointerDeviceStruct (pDev, + map, + NUM_BUTTONS, + miPointerGetMotionEvents, + (PtrCtrlProcPtr) NoopDDA, + miPointerGetMotionBufferSize ()); + break; + case DEVICE_ON: + pDev->on = TRUE; + break; + case DEVICE_OFF: + case DEVICE_CLOSE: + pDev->on = FALSE; + break; + } + + return Success; +} + +void +xglBell (int volume, + DeviceIntPtr pDev, + pointer ctrl, + int something) +{ +} + +void +xglKbdCtrl (DeviceIntPtr pDevice, + KeybdCtrl *ctrl) +{ +} + +#define XGL_KEYMAP_WIDTH 2 + +KeySym xglKeymap[] = { +/* 1 8 */ XK_Escape, NoSymbol, +/* 2 9 */ XK_1, XK_exclam, +/* 3 10 */ XK_2, XK_at, +/* 4 11 */ XK_3, XK_numbersign, +/* 5 12 */ XK_4, XK_dollar, +/* 6 13 */ XK_5, XK_percent, +/* 7 14 */ XK_6, XK_asciicircum, +/* 8 15 */ XK_7, XK_ampersand, +/* 9 16 */ XK_8, XK_asterisk, +/* 10 17 */ XK_9, XK_parenleft, +/* 11 18 */ XK_0, XK_parenright, +/* 12 19 */ XK_minus, XK_underscore, +/* 13 20 */ XK_equal, XK_plus, +/* 14 21 */ XK_BackSpace, NoSymbol, +/* 15 22 */ XK_Tab, NoSymbol, +/* 16 23 */ XK_Q, NoSymbol, +/* 17 24 */ XK_W, NoSymbol, +/* 18 25 */ XK_E, NoSymbol, +/* 19 26 */ XK_R, NoSymbol, +/* 20 27 */ XK_T, NoSymbol, +/* 21 28 */ XK_Y, NoSymbol, +/* 22 29 */ XK_U, NoSymbol, +/* 23 30 */ XK_I, NoSymbol, +/* 24 31 */ XK_O, NoSymbol, +/* 25 32 */ XK_P, NoSymbol, +/* 26 33 */ XK_bracketleft, XK_braceleft, +/* 27 34 */ XK_bracketright, XK_braceright, +/* 28 35 */ XK_Return, NoSymbol, +/* 29 36 */ XK_Control_L, NoSymbol, +/* 30 37 */ XK_A, NoSymbol, +/* 31 38 */ XK_S, NoSymbol, +/* 32 39 */ XK_D, NoSymbol, +/* 33 40 */ XK_F, NoSymbol, +/* 34 41 */ XK_G, NoSymbol, +/* 35 42 */ XK_H, NoSymbol, +/* 36 43 */ XK_J, NoSymbol, +/* 37 44 */ XK_K, NoSymbol, +/* 38 45 */ XK_L, NoSymbol, +/* 39 46 */ XK_semicolon, XK_colon, +/* 40 47 */ XK_apostrophe, XK_quotedbl, +/* 41 48 */ XK_grave, XK_asciitilde, +/* 42 49 */ XK_Shift_L, NoSymbol, +/* 43 50 */ XK_backslash, XK_bar, +/* 44 51 */ XK_Z, NoSymbol, +/* 45 52 */ XK_X, NoSymbol, +/* 46 53 */ XK_C, NoSymbol, +/* 47 54 */ XK_V, NoSymbol, +/* 48 55 */ XK_B, NoSymbol, +/* 49 56 */ XK_N, NoSymbol, +/* 50 57 */ XK_M, NoSymbol, +/* 51 58 */ XK_comma, XK_less, +/* 52 59 */ XK_period, XK_greater, +/* 53 60 */ XK_slash, XK_question, +/* 54 61 */ XK_Shift_R, NoSymbol, +/* 55 62 */ XK_KP_Multiply, NoSymbol, +/* 56 63 */ XK_Alt_L, XK_Meta_L, +/* 57 64 */ XK_space, NoSymbol, +/* 58 65 */ XK_Caps_Lock, NoSymbol, +/* 59 66 */ XK_F1, NoSymbol, +/* 60 67 */ XK_F2, NoSymbol, +/* 61 68 */ XK_F3, NoSymbol, +/* 62 69 */ XK_F4, NoSymbol, +/* 63 70 */ XK_F5, NoSymbol, +/* 64 71 */ XK_F6, NoSymbol, +/* 65 72 */ XK_F7, NoSymbol, +/* 66 73 */ XK_F8, NoSymbol, +/* 67 74 */ XK_F9, NoSymbol, +/* 68 75 */ XK_F10, NoSymbol, +/* 69 76 */ XK_Break, XK_Pause, +/* 70 77 */ XK_Scroll_Lock, NoSymbol, +/* 71 78 */ XK_KP_Home, XK_KP_7, +/* 72 79 */ XK_KP_Up, XK_KP_8, +/* 73 80 */ XK_KP_Page_Up, XK_KP_9, +/* 74 81 */ XK_KP_Subtract, NoSymbol, +/* 75 82 */ XK_KP_Left, XK_KP_4, +/* 76 83 */ XK_KP_5, NoSymbol, +/* 77 84 */ XK_KP_Right, XK_KP_6, +/* 78 85 */ XK_KP_Add, NoSymbol, +/* 79 86 */ XK_KP_End, XK_KP_1, +/* 80 87 */ XK_KP_Down, XK_KP_2, +/* 81 88 */ XK_KP_Page_Down, XK_KP_3, +/* 82 89 */ XK_KP_Insert, XK_KP_0, +/* 83 90 */ XK_KP_Delete, XK_KP_Decimal, +/* 84 91 */ NoSymbol, NoSymbol, +/* 85 92 */ NoSymbol, NoSymbol, +/* 86 93 */ NoSymbol, NoSymbol, +/* 87 94 */ XK_F11, NoSymbol, +/* 88 95 */ XK_F12, NoSymbol, +/* 89 96 */ XK_Control_R, NoSymbol, +/* 90 97 */ XK_KP_Enter, NoSymbol, +/* 91 98 */ XK_KP_Divide, NoSymbol, +/* 92 99 */ XK_Sys_Req, XK_Print, +/* 93 100 */ XK_Alt_R, XK_Meta_R, +/* 94 101 */ XK_Num_Lock, NoSymbol, +/* 95 102 */ XK_Home, NoSymbol, +/* 96 103 */ XK_Up, NoSymbol, +/* 97 104 */ XK_Page_Up, NoSymbol, +/* 98 105 */ XK_Left, NoSymbol, +/* 99 106 */ XK_Right, NoSymbol, +/* 100 107 */ XK_End, NoSymbol, +/* 101 108 */ XK_Down, NoSymbol, +/* 102 109 */ XK_Page_Down, NoSymbol, +/* 103 110 */ XK_Insert, NoSymbol, +/* 104 111 */ XK_Delete, NoSymbol, +/* 105 112 */ XK_Super_L, NoSymbol, +/* 106 113 */ XK_Super_R, NoSymbol, +/* 107 114 */ XK_Menu, NoSymbol, + +/* 108 115 */ XK_Next, NoSymbol, /* right button on side */ +/* 109 116 */ XK_Prior, NoSymbol, /* left button on side */ +/* 110 117 */ XK_Up, NoSymbol, /* joypad */ +/* 111 118 */ XK_Down, NoSymbol, +/* 112 119 */ XK_Left, NoSymbol, +/* 113 120 */ XK_Right, NoSymbol, +/* 114 121 */ NoSymbol, NoSymbol, /* left near speaker */ +/* 115 122 */ NoSymbol, NoSymbol, /* right near speaker */ +/* 116 123 */ NoSymbol, NoSymbol, /* tiny button */ +}; + +CARD8 xglModMap[MAP_LENGTH]; + +KeySymsRec xglKeySyms = { + xglKeymap, + 8, + 8 + (sizeof (xglKeymap) / sizeof (xglKeymap[0]) / XGL_KEYMAP_WIDTH) - 1, + XGL_KEYMAP_WIDTH +}; + +int +xglKeybdProc (DeviceIntPtr pDevice, + int onoff) +{ + Bool ret; + DevicePtr pDev = (DevicePtr) pDevice; + + if (!pDev) + return BadImplementation; + + switch (onoff) { + case DEVICE_INIT: + if (pDev != (DevicePtr)inputInfo.keyboard) + return !Success; + + ret = InitKeyboardDeviceStruct (pDev, + &xglKeySyms, + xglModMap, + xglBell, + xglKbdCtrl); + if (!ret) + return BadImplementation; + break; + case DEVICE_ON: + pDev->on = TRUE; + break; + case DEVICE_OFF: + case DEVICE_CLOSE: + pDev->on = FALSE; + break; + } + + return Success; +} + +void +xglInitInput (int argc, char **argv) +{ + DeviceIntPtr pKeyboard, pPointer; + + pPointer = AddInputDevice (xglMouseProc, TRUE); + pKeyboard = AddInputDevice (xglKeybdProc, TRUE); + + RegisterPointerDevice (pPointer); + RegisterKeyboardDevice (pKeyboard); + + miRegisterPointerDevice (screenInfo.screens[0], pPointer); + mieqInit (&pKeyboard->public, &pPointer->public); +} diff --git a/xorg-server/hw/xgl/xglloader.c b/xorg-server/hw/xgl/xglloader.c new file mode 100644 index 000000000..f64acf18d --- /dev/null +++ b/xorg-server/hw/xgl/xglloader.c @@ -0,0 +1,130 @@ +/* + * Copyright © 2005 Novell, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * Novell, Inc. not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * Novell, Inc. makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#include "xgl.h" +#include "xglmodule.h" + +#ifdef XGL_MODULAR + +#include <dlfcn.h> + +#define SYM(ptr, name) { (void **) &(ptr), (name) } + +void * +xglLoadModule (const char *name, + int flag) +{ + ModuleVersionProcPtr moduleVersion; + ModuleInitProcPtr moduleInit; + void *handle = 0; + char *module; + xglSymbolRec mSym[] = { + SYM (moduleVersion, "moduleVersion"), + SYM (moduleInit, "moduleInit") + }; + + module = malloc (strlen (XGL_MODULE_PATH "/lib.so") + strlen (name) + 1); + if (!module) + return 0; + + sprintf (module, XGL_MODULE_PATH "/lib%s.so", name); + + handle = dlopen (module, flag); + if (handle) + { + if (xglLookupSymbols (handle, mSym, sizeof (mSym) / sizeof (mSym[0]))) + { + const char *version; + + version = (*moduleVersion) (); + if (strcmp (VERSION, version) == 0) + { + if (!(*moduleInit) (module)) + { + dlclose (handle); + handle = 0; + } + } + else + { + ErrorF ("Module version mismatch. " + "%s is %s Xserver is" VERSION "\n", + module, version); + + dlclose (handle); + handle = 0; + } + } + else + { + dlclose (handle); + handle = 0; + } + } + else + ErrorF ("dlopen: %s\n", dlerror ()); + + free (module); + + return handle; +} + +void +xglUnloadModule (void *handle) +{ + dlclose (handle); +} + +Bool +xglLookupSymbols (void *handle, + xglSymbolPtr sym, + int nSym) +{ + void *symbol; + char *error; + int i; + + /* avoid previous error */ + dlerror (); + + for (i = 0; i < nSym; i++) + { + symbol = dlsym (handle, sym[i].name); + if (!symbol) + { + error = dlerror (); + if (error != 0) + ErrorF ("dlsym: %s: %s\n", sym[i].name, error); + + return FALSE; + } + + *(sym[i].ptr) = symbol; + } + + return TRUE; +} + +#endif diff --git a/xorg-server/hw/xgl/xglmodule.h b/xorg-server/hw/xgl/xglmodule.h new file mode 100644 index 000000000..da868e960 --- /dev/null +++ b/xorg-server/hw/xgl/xglmodule.h @@ -0,0 +1,45 @@ +/* + * Copyright © 2005 Novell, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * Novell, Inc. not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * Novell, Inc. makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#ifndef _XGL_MODULE_H_ +#define _XGL_MODULE_H_ + +#include <xgl-config.h> + +#include <X11/Xdefs.h> +#include "misc.h" + +#define VERSION "0.0.1" + +typedef const char *(*ModuleVersionProcPtr) (void); +typedef Bool (*ModuleInitProcPtr) (const char *module); + +char * +moduleVersion (void); + +Bool +moduleInit (const char *module); + +#endif /* _XGL_MODULE_H_ */ diff --git a/xorg-server/hw/xgl/xgloutput.c b/xorg-server/hw/xgl/xgloutput.c new file mode 100644 index 000000000..76903a886 --- /dev/null +++ b/xorg-server/hw/xgl/xgloutput.c @@ -0,0 +1,181 @@ +/* + * Copyright © 2004 David Reveman + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * David Reveman not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * David Reveman makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#include "xgl.h" + +#include <mivalidate.h> +#include <dixstruct.h> + +typedef struct _xglDepth { + CARD8 depth; + CARD8 bpp; +} xglDepthRec, *xglDepthPtr; + +static xglDepthRec xglDepths[] = { + { 1, 1 }, + { 4, 4 }, + { 8, 8 }, + { 15, 16 }, + { 16, 16 }, + { 24, 32 }, + { 32, 32 } +}; + +#define NUM_XGL_DEPTHS (sizeof (xglDepths) / sizeof (xglDepths[0])) + +void +xglSetPixmapFormats (ScreenInfo *pScreenInfo) +{ + int i; + + pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER; + pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; + pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD; + pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER; + pScreenInfo->numPixmapFormats = 0; + + for (i = 0; i < NUM_XGL_DEPTHS; i++) + { + PixmapFormatRec *format; + + format = &pScreenInfo->formats[pScreenInfo->numPixmapFormats++]; + + format->depth = xglDepths[i].depth; + format->bitsPerPixel = xglDepths[i].bpp; + format->scanlinePad = BITMAP_SCANLINE_PAD; + } +} + +void +xglSetRootClip (ScreenPtr pScreen, + Bool enable) +{ + WindowPtr pWin = WindowTable[pScreen->myNum]; + WindowPtr pChild; + Bool wasViewable; + Bool anyMarked = FALSE; + RegionPtr pOldClip = 0; + +#ifdef DO_SAVE_UNDERS + Bool dosave = FALSE; +#endif + + WindowPtr pLayerWin; + BoxRec box; + + if (!pWin) + return; + + wasViewable = (Bool) (pWin->viewable); + if (wasViewable) + { + for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib) + { + (void) (*pScreen->MarkOverlappedWindows) (pChild, + pChild, + &pLayerWin); + } + + (*pScreen->MarkWindow) (pWin); + anyMarked = TRUE; + + if (pWin->valdata) + { + if (HasBorder (pWin)) + { + RegionPtr borderVisible; + + borderVisible = REGION_CREATE (pScreen, NullBox, 1); + REGION_SUBTRACT (pScreen, borderVisible, + &pWin->borderClip, &pWin->winSize); + pWin->valdata->before.borderVisible = borderVisible; + } + pWin->valdata->before.resized = TRUE; + } + } + + if (enable) + { + box.x1 = 0; + box.y1 = 0; + box.x2 = pScreen->width; + box.y2 = pScreen->height; + + pWin->drawable.width = pScreen->width; + pWin->drawable.height = pScreen->height; + + REGION_INIT (pScreen, &pWin->winSize, &box, 1); + REGION_INIT (pScreen, &pWin->borderSize, &box, 1); + REGION_RESET (pScreen, &pWin->borderClip, &box); + REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList); + } + else + { + REGION_EMPTY (pScreen, &pWin->borderClip); + REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList); + } + + ResizeChildrenWinSize (pWin, 0, 0, 0, 0); + + if (wasViewable) + { + if (pWin->firstChild) + { + anyMarked |= (*pScreen->MarkOverlappedWindows) (pWin->firstChild, + pWin->firstChild, + (WindowPtr *) 0); + } + else + { + (*pScreen->MarkWindow) (pWin); + anyMarked = TRUE; + } + +#ifdef DO_SAVE_UNDERS + if (DO_SAVE_UNDERS (pWin)) + dosave = (*pScreen->ChangeSaveUnder) (pLayerWin, pLayerWin); +#endif + + if (anyMarked) + (*pScreen->ValidateTree)(pWin, NullWindow, VTOther); + } + + if (wasViewable) + { + if (anyMarked) + (*pScreen->HandleExposures) (pWin); + +#ifdef DO_SAVE_UNDERS + if (dosave) + (*pScreen->PostChangeSaveUnder) (pLayerWin, pLayerWin); +#endif + + if (anyMarked && pScreen->PostValidateTree) + (*pScreen->PostValidateTree) (pWin, NullWindow, VTOther); + } + + if (pWin->realized) + WindowsRestructured (); +} diff --git a/xorg-server/hw/xgl/xglparse.c b/xorg-server/hw/xgl/xglparse.c new file mode 100644 index 000000000..5292692a4 --- /dev/null +++ b/xorg-server/hw/xgl/xglparse.c @@ -0,0 +1,257 @@ +/* + * Copyright © 2004 David Reveman + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * David Reveman not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * David Reveman makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#include "xgl.h" + +char * +xglParseFindNext (char *cur, + char *delim, + char *save, + char *last) +{ + while (*cur && !strchr (delim, *cur)) + *save++ = *cur++; + + *save = 0; + *last = *cur; + + if (*cur) + cur++; + + return cur; +} + +void +xglParseScreen (char *arg) +{ + char delim; + char save[1024]; + int i, pixels, mm; + + xglScreenInfo.width = 0; + xglScreenInfo.height = 0; + xglScreenInfo.widthMm = 0; + xglScreenInfo.heightMm = 0; + + if (!arg) + return; + + if (strlen (arg) >= sizeof (save)) + return; + + for (i = 0; i < 2; i++) + { + arg = xglParseFindNext (arg, "x/", save, &delim); + if (!save[0]) + return; + + pixels = atoi (save); + mm = 0; + + if (delim == '/') + { + arg = xglParseFindNext (arg, "x", save, &delim); + if (!save[0]) + return; + + mm = atoi (save); + } + + if (i == 0) + { + xglScreenInfo.width = pixels; + xglScreenInfo.widthMm = mm; + } + else + { + xglScreenInfo.height = pixels; + xglScreenInfo.heightMm = mm; + } + + if (delim != 'x') + return; + } +} + +static void +xglParseAccel (char *arg) +{ + xglAccelInfoPtr pAccel; + char delim; + char save[1024]; + + if (!arg) + return; + + if (strlen (arg) >= sizeof (save)) + return; + + arg = xglParseFindNext (arg, "@:", save, &delim); + if (!save[0]) + return; + + if (strcasecmp (save, "pixmap") == 0) + pAccel = &xglScreenInfo.accel.pixmap; + else if (strcasecmp (save, "window") == 0) + pAccel = &xglScreenInfo.accel.window; + else if (strcasecmp (save, "glx") == 0) + pAccel = &xglScreenInfo.accel.glx; + else if (strcasecmp (save, "xv") == 0) + pAccel = &xglScreenInfo.accel.xv; + else + return; + + if (delim == '@') + { + arg = xglParseFindNext (arg, "/x:", save, &delim); + if (!save[0]) + return; + + pAccel->size.aboveWidth = pAccel->size.minWidth = atoi (save); + + if (delim == '/') + { + arg = xglParseFindNext (arg, "x:", save, &delim); + if (!save[0]) + return; + + pAccel->size.aboveWidth = atoi (save); + } + + if (delim == 'x') + { + arg = xglParseFindNext (arg, "/:", save, &delim); + if (!save[0]) + return; + + pAccel->size.aboveHeight = pAccel->size.minHeight = atoi (save); + + if (delim == '/') + { + arg = xglParseFindNext (arg, ":", save, &delim); + if (!save[0]) + return; + + pAccel->size.aboveHeight = atoi (save); + } + } + } + + pAccel->enabled = TRUE; + pAccel->pbuffer = FALSE; + + if (delim == ':') + { + if (strcasecmp (arg, "fbo") == 0) + ; + else if (strcasecmp (arg, "off") == 0 || + strncasecmp (arg, "0", 1) == 0 || + strncasecmp (arg, "f", 1) == 0 || + strncasecmp (arg, "n", 1) == 0) + { + pAccel->enabled = FALSE; + pAccel->pbuffer = FALSE; + } + else if (strcasecmp (arg, "pbuffer") == 0) + { + pAccel->pbuffer = TRUE; + } + } +} + +void +xglUseMsg (void) +{ + ErrorF ("-vertextype [short|float] set vertex data type\n"); + ErrorF ("-yinverted Y is upside-down\n"); + ErrorF ("-lines " + "accelerate lines that are not vertical or horizontal\n"); + ErrorF ("-vbo " + "use vertex buffer objects for streaming of vertex data\n"); + ErrorF ("-pbomask [1|4|8|16|32] " + "set bpp's to use with pixel buffer objects\n"); + ErrorF ("-accel TYPE[@WIDTH[/MIN]xHEIGHT[/MIN]][:METHOD] " + "offscreen acceleration\n"); +} + +int +xglProcessArgument (int argc, + char **argv, + int i) +{ + if (!strcmp (argv[i], "-vertextype")) + { + if ((i + 1) < argc) + { + if (!strcasecmp (argv[i + 1], "short")) + xglScreenInfo.geometryDataType = GEOMETRY_DATA_TYPE_SHORT; + else if (!strcasecmp (argv[i + 1], "float")) + xglScreenInfo.geometryDataType = GEOMETRY_DATA_TYPE_FLOAT; + } + else + return 1; + + return 2; + } + else if (!strcmp (argv[i], "-yinverted")) + { + xglScreenInfo.yInverted = TRUE; + return 1; + } + else if (!strcmp (argv[i], "-lines")) + { + xglScreenInfo.lines = TRUE; + return 1; + } + else if (!strcmp (argv[i], "-vbo")) + { + xglScreenInfo.geometryUsage = GEOMETRY_USAGE_STREAM; + return 1; + } + else if (!strcmp (argv[i], "-pbomask")) + { + if ((i + 1) < argc) + { + xglScreenInfo.pboMask = atoi (argv[i + 1]); + } + else + return 1; + + return 2; + } + else if (!strcmp (argv[i], "-accel")) + { + if ((i + 1) < argc) + { + xglParseAccel (argv[i + 1]); + } + else + return 1; + + return 2; + } + + return 0; +} diff --git a/xorg-server/hw/xgl/xglpict.c b/xorg-server/hw/xgl/xglpict.c new file mode 100644 index 000000000..fee2431b7 --- /dev/null +++ b/xorg-server/hw/xgl/xglpict.c @@ -0,0 +1,787 @@ +/* + * Copyright © 2004 David Reveman + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * David Reveman not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * David Reveman makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#include "xgl.h" +#include "fb.h" + +#ifdef RENDER + +#include "fbpict.h" + +#define XGL_PICTURE_FALLBACK_PROLOGUE(pPicture, func) \ + xglSyncDamageBoxBits (pPicture->pDrawable); \ + XGL_PICTURE_SCREEN_UNWRAP (func) + +#define XGL_PICTURE_FALLBACK_EPILOGUE(pPicture, func, xglfunc) \ + XGL_PICTURE_SCREEN_WRAP (func, xglfunc); \ + xglAddCurrentSurfaceDamage (pPicture->pDrawable) + +void +xglComposite (CARD8 op, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) +{ + PictureScreenPtr pPictureScreen; + ScreenPtr pScreen = pDst->pDrawable->pScreen; + + XGL_SCREEN_PRIV (pScreen); + + if (xglCompositeGeneral (op, + pSrc, pMask, pDst, NULL, + xSrc, ySrc, + xMask, yMask, + xDst + pDst->pDrawable->x, + yDst + pDst->pDrawable->y, + width, height)) + { + xglAddCurrentBitDamage (pDst->pDrawable); + return; + } + + pPictureScreen = GetPictureScreen (pScreen); + + if (pSrc->pDrawable) + { + if (!xglSyncBits (pSrc->pDrawable, NullBox)) + FatalError (XGL_SW_FAILURE_STRING); + } + + if (pMask && pMask->pDrawable) + { + if (!xglSyncBits (pMask->pDrawable, NullBox)) + FatalError (XGL_SW_FAILURE_STRING); + } + + if (op == PictOpSrc) + { + XGL_DRAWABLE_PIXMAP (pDst->pDrawable); + + if (!xglMapPixmapBits (pPixmap)) + FatalError (XGL_SW_FAILURE_STRING); + } else + xglSyncDamageBoxBits (pDst->pDrawable); + + XGL_PICTURE_SCREEN_UNWRAP (Composite); + (*pPictureScreen->Composite) (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); + XGL_PICTURE_SCREEN_WRAP (Composite, xglComposite); + + if (op == PictOpSrc) + { + RegionRec region; + + xDst += pDst->pDrawable->x; + yDst += pDst->pDrawable->y; + + if (pSrc->pDrawable) + { + xSrc += pSrc->pDrawable->x; + ySrc += pSrc->pDrawable->y; + } + + if (pMask && pMask->pDrawable) + { + xMask += pMask->pDrawable->x; + yMask += pMask->pDrawable->y; + } + + if (!miComputeCompositeRegion (®ion, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height)) + return; + + xglAddSurfaceDamage (pDst->pDrawable, ®ion); + REGION_UNINIT (pDst->pDrawable->pScreen, ®ion); + } else + xglAddCurrentSurfaceDamage (pDst->pDrawable); +} + +void +xglAddTriangles (PicturePtr pDst, + INT16 xOff, + INT16 yOff, + int ntri, + xTriangle *tris) +{ + PictureScreenPtr pPictureScreen; + ScreenPtr pScreen = pDst->pDrawable->pScreen; + + XGL_SCREEN_PRIV (pScreen); + XGL_DRAWABLE_PIXMAP_PRIV (pDst->pDrawable); + + pPictureScreen = GetPictureScreen (pScreen); + + pPixmapPriv->damageBox.x1 = 0; + pPixmapPriv->damageBox.y1 = 0; + pPixmapPriv->damageBox.x2 = pDst->pDrawable->width; + pPixmapPriv->damageBox.y2 = pDst->pDrawable->height; + + XGL_PICTURE_FALLBACK_PROLOGUE (pDst, AddTriangles); + (*pPictureScreen->AddTriangles) (pDst, xOff, yOff, ntri, tris); + XGL_PICTURE_FALLBACK_EPILOGUE (pDst, AddTriangles, xglAddTriangles); +} + + +void +xglChangePicture (PicturePtr pPicture, + Mask mask) +{ + PictureScreenPtr pPictureScreen; + ScreenPtr pScreen = pPicture->pDrawable->pScreen; + + XGL_SCREEN_PRIV (pScreen); + XGL_DRAWABLE_PIXMAP_PRIV (pPicture->pDrawable); + + pPictureScreen = GetPictureScreen (pScreen); + + if (pPicture->stateChanges & CPRepeat) + pPixmapPriv->pictureMask |= xglPCFillMask; + + if (pPicture->stateChanges & CPComponentAlpha) + pPixmapPriv->pictureMask |= xglPCComponentAlphaMask; + + if (pPicture->stateChanges & CPDither) + pPixmapPriv->pictureMask |= xglPCDitherMask; + + XGL_PICTURE_SCREEN_UNWRAP (ChangePicture); + (*pPictureScreen->ChangePicture) (pPicture, mask); + XGL_PICTURE_SCREEN_WRAP (ChangePicture, xglChangePicture); +} + +int +xglChangePictureTransform (PicturePtr pPicture, + PictTransform *transform) +{ + PictureScreenPtr pPictureScreen; + ScreenPtr pScreen = pPicture->pDrawable->pScreen; + int ret; + + XGL_SCREEN_PRIV (pScreen); + XGL_DRAWABLE_PIXMAP_PRIV (pPicture->pDrawable); + + pPictureScreen = GetPictureScreen (pScreen); + + if (transform != pPicture->transform || + (transform && memcmp (transform, &pPicture->transform, + sizeof (PictTransform)))) + pPixmapPriv->pictureMask |= xglPCTransformMask; + + XGL_PICTURE_SCREEN_UNWRAP (ChangePictureTransform); + ret = (*pPictureScreen->ChangePictureTransform) (pPicture, transform); + XGL_PICTURE_SCREEN_WRAP (ChangePictureTransform, + xglChangePictureTransform); + + return ret; +} + +int +xglChangePictureFilter (PicturePtr pPicture, + int filter, + xFixed *params, + int nparams) +{ + PictureScreenPtr pPictureScreen; + ScreenPtr pScreen = pPicture->pDrawable->pScreen; + int ret; + + XGL_SCREEN_PRIV (pScreen); + XGL_DRAWABLE_PIXMAP_PRIV (pPicture->pDrawable); + + pPictureScreen = GetPictureScreen (pScreen); + + pPixmapPriv->pictureMask |= xglPCFilterMask; + + XGL_PICTURE_SCREEN_UNWRAP (ChangePictureFilter); + ret = (*pPictureScreen->ChangePictureFilter) (pPicture, filter, + params, nparams); + XGL_PICTURE_SCREEN_WRAP (ChangePictureFilter, xglChangePictureFilter); + + return ret; +} + +static void +xglDestroyDevicePicture (PicturePtr pPicture) +{ + if (pPicture->pSourcePict->source.devPrivate.ptr) + glitz_surface_destroy (pPicture->pSourcePict->source.devPrivate.ptr); +} + +PicturePtr +xglCreateDevicePicture (pointer data) +{ + PicturePtr pPicture; + int error; + + pPicture = CreateDevicePicture (0, &error); + if (!pPicture) + return 0; + + pPicture->pSourcePict->source.devPrivate.ptr = data; + pPicture->pSourcePict->source.Destroy = xglDestroyDevicePicture; + + return pPicture; +} + +static int fillMode[] = { + GLITZ_FILL_TRANSPARENT, /* RepeatNone */ + GLITZ_FILL_REPEAT, /* RepeatNormal */ + GLITZ_FILL_NEAREST, /* RepeatPad */ + GLITZ_FILL_REFLECT /* RepeatReflect */ +}; + +static void +xglUpdatePicture (PicturePtr pPicture) +{ + glitz_surface_t *surface; + + XGL_DRAWABLE_PIXMAP_PRIV (pPicture->pDrawable); + + surface = pPixmapPriv->surface; + + if (pPixmapPriv->pictureMask & xglPCFillMask) + { + glitz_surface_set_fill (surface, fillMode[pPicture->repeat]); + } + + if (pPixmapPriv->pictureMask & xglPCFilterMask) + { + switch (pPicture->filter) { + case PictFilterNearest: + case PictFilterFast: + glitz_surface_set_filter (surface, GLITZ_FILTER_NEAREST, NULL, 0); + break; + case PictFilterGood: + case PictFilterBest: + case PictFilterBilinear: + glitz_surface_set_filter (surface, GLITZ_FILTER_BILINEAR, NULL, 0); + break; + case PictFilterConvolution: + glitz_surface_set_filter (surface, GLITZ_FILTER_CONVOLUTION, + (glitz_fixed16_16_t *) + pPicture->filter_params, + pPicture->filter_nparams); + break; + } + } + + if (pPixmapPriv->pictureMask & xglPCTransformMask) + { + glitz_surface_set_transform (surface, (glitz_transform_t *) + pPicture->transform); + } + + if (pPixmapPriv->pictureMask & xglPCComponentAlphaMask) + { + glitz_surface_set_component_alpha (surface, pPicture->componentAlpha); + } + + if (pPixmapPriv->pictureMask & xglPCDitherMask) + { + glitz_surface_set_dither (surface, pPicture->dither); + } + + pPixmapPriv->pictureMask &= ~XGL_PICTURE_CHANGES (~0); +} + +#define N_STACK_PARAM 256 + +static int gradientNParam[] = { + 0, /* SourcePictTypeSolidFill */ + 4, /* SourcePictTypeLinear */ + 6, /* SourcePictTypeRadial */ + 4, /* SourcePictTypeConical */ +}; + +Bool +xglSyncPicture (ScreenPtr pScreen, + PicturePtr pPicture, + INT16 x, + INT16 y, + CARD16 width, + CARD16 height, + INT16 *xOff, + INT16 *yOff) +{ + xglPixmapPtr pPixmapPriv; + + XGL_SCREEN_PRIV (pScreen); + + *xOff = *yOff = 0; + + if (pPicture->pSourcePict) + { + if (pPicture->pSourcePict->source.devPrivate.ptr) + return TRUE; + + if (pPicture->pDrawable) + { + (*pScreen->DestroyPixmap) ((PixmapPtr) pPicture->pDrawable); + pPicture->pDrawable = (DrawablePtr) 0; + } + + switch (pPicture->pSourcePict->source.type) { + case SourcePictTypeSolidFill: + x = y = 0; + width = height = 1; + break; + case SourcePictTypeLinear: + case SourcePictTypeRadial: { + glitz_fixed16_16_t stackParam[N_STACK_PARAM]; + glitz_fixed16_16_t *param; + int nParam, nStop, size, i; + CARD32 *pixel; + PictGradientStopPtr pStop; + glitz_buffer_t *buffer; + glitz_format_t *format; + glitz_surface_t *surface; + static glitz_pixel_format_t pixelFormat = { + GLITZ_FOURCC_RGB, + { + 32, + 0xff000000, + 0x00ff0000, + 0x0000ff00, + 0x000000ff + }, + 0, 0, 0, + GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP + }; + + if (!(pScreenPriv->features & GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK)) + break; + + format = glitz_find_standard_format (pScreenPriv->drawable, + GLITZ_STANDARD_ARGB32); + if (!format) + break; + + nParam = gradientNParam[pPicture->pSourcePict->gradient.type]; + pStop = pPicture->pSourcePict->gradient.stops; + nStop = pPicture->pSourcePict->gradient.nstops; + + size = nParam + nStop * 4; + if (size > N_STACK_PARAM) + { + param = malloc (sizeof (xFixed) * size); + if (!param) + break; + } + else + { + param = stackParam; + } + + pixel = (CARD32 *) (param + nParam + nStop * 3); + + buffer = glitz_buffer_create_for_data (pixel); + if (!buffer) + { + if (size > N_STACK_PARAM) + free (param); + + break; + } + + surface = glitz_surface_create (pScreenPriv->drawable, + format, nStop, 1, 0, NULL); + if (!surface) + { + glitz_buffer_destroy (buffer); + if (size > N_STACK_PARAM) + free (param); + + break; + } + + for (i = 0; i < nStop; i++) + { + pixel[i] = pStop[i].color; + + param[nParam + 3 * i + 0] = pStop[i].x; + param[nParam + 3 * i + 1] = i << 16; + param[nParam + 3 * i + 2] = 0; + } + + glitz_set_pixels (surface, 0, 0, nStop, 1, &pixelFormat, buffer); + + glitz_buffer_destroy (buffer); + + switch (pPicture->pSourcePict->source.type) { + case SourcePictTypeLinear: + param[0] = pPicture->pSourcePict->linear.p1.x; + param[1] = pPicture->pSourcePict->linear.p1.y; + param[2] = pPicture->pSourcePict->linear.p2.x; + param[3] = pPicture->pSourcePict->linear.p2.y; + + glitz_surface_set_filter (surface, + GLITZ_FILTER_LINEAR_GRADIENT, + param, nParam + nStop * 3); + break; + case SourcePictTypeRadial: + param[0] = pPicture->pSourcePict->radial.inner.x; + param[1] = pPicture->pSourcePict->radial.inner.y; + param[2] = pPicture->pSourcePict->radial.inner_radius; + param[3] = pPicture->pSourcePict->radial.outer.x; + param[4] = pPicture->pSourcePict->radial.outer.y; + param[5] = pPicture->pSourcePict->radial.outer_radius; + + glitz_surface_set_filter (surface, + GLITZ_FILTER_RADIAL_GRADIENT, + param, nParam + nStop * 3); + break; + } + + glitz_surface_set_fill (surface, fillMode[pPicture->repeat]); + glitz_surface_set_transform (surface, (glitz_transform_t *) + pPicture->transform); + + pPicture->pSourcePict->gradient.devPrivate.ptr = surface; + pPicture->pSourcePict->gradient.Destroy = xglDestroyDevicePicture; + + if (size > N_STACK_PARAM) + free (param); + + return TRUE; + } break; + case SourcePictTypeConical: + default: + break; + } + + if (!pPicture->pDrawable) + { + PictFormatPtr pFormat; + PixmapPtr pPixmap; + PicturePtr pTmp; + RegionRec region; + BoxRec box; + int error; + + pFormat = PictureMatchFormat (pScreen, 32, PICT_a8r8g8b8); + if (!pFormat) + return FALSE; + + pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, + pFormat->depth, 0); + if (!pPixmap) + return FALSE; + + pTmp = CreatePicture (0, &pPixmap->drawable, pFormat, 0, NULL, + serverClient, &error); + if (!pTmp) + { + (*pScreen->DestroyPixmap) (pPixmap); + return FALSE; + } + + ValidatePicture (pTmp); + + if (!xglSyncBits (pTmp->pDrawable, NullBox)) + FatalError (XGL_SW_FAILURE_STRING); + + fbCompositeGeneral (PictOpSrc, + pPicture, 0, pTmp, + x, y, 0, 0, 0, 0, + width, height); + + FreePicture ((pointer) pTmp, (XID) 0); + + box.x1 = 0; + box.y1 = 0; + box.x2 = width; + box.y2 = height; + + REGION_INIT (pScreen, ®ion, &box, 1); + xglAddSurfaceDamage (&pPixmap->drawable, ®ion); + REGION_UNINIT (pDrawable->pScreen, ®ion); + + pPicture->pDrawable = &pPixmap->drawable; + + *xOff = x; + *yOff = y; + + XGL_GET_PIXMAP_PRIV (pPixmap)->pictureMask &= + ~(xglPCFillMask | xglPCFilterMask | xglPCTransformMask); + } + } + +#ifdef XV + switch (pPicture->format) { + case PICT_yuy2: + xglSetPixmapVisual ((PixmapPtr) pPicture->pDrawable, + &pScreenPriv->pXvVisual[XGL_XV_FORMAT_YUY2]); + break; + case PICT_yv12: + xglSetPixmapVisual ((PixmapPtr) pPicture->pDrawable, + &pScreenPriv->pXvVisual[XGL_XV_FORMAT_YV12]); + default: + break; + } +#endif + + if (!xglSyncSurface (pPicture->pDrawable)) + return FALSE; + + pPixmapPriv = XGL_GET_PIXMAP_PRIV ((PixmapPtr) pPicture->pDrawable); + if (XGL_PICTURE_CHANGES (pPixmapPriv->pictureMask)) + xglUpdatePicture (pPicture); + + return TRUE; +} + +static int +xglVisualDepth (ScreenPtr pScreen, VisualPtr pVisual) +{ + DepthPtr pDepth; + int d, v; + + for (d = 0; d < pScreen->numDepths; d++) + { + pDepth = &pScreen->allowedDepths[d]; + for (v = 0; v < pDepth->numVids; v++) + if (pDepth->vids[v] == pVisual->vid) + return pDepth->depth; + } + + return 0; +} + +typedef struct _xglformatInit { + CARD32 format; + CARD8 depth; +} xglFormatInitRec, *xglFormatInitPtr; + +static int +xglAddFormat (xglFormatInitPtr formats, + int nformat, + CARD32 format, + CARD8 depth) +{ + int n; + + for (n = 0; n < nformat; n++) + if (formats[n].format == format && formats[n].depth == depth) + return nformat; + + formats[nformat].format = format; + formats[nformat].depth = depth; + + return ++nformat; +} + +#define Mask(n) ((n) == 32 ? 0xffffffff : ((1 << (n)) - 1)) + +Bool +xglPictureInit (ScreenPtr pScreen) +{ + int f, nformats = 0; + PictFormatPtr pFormats; + xglFormatInitRec formats[64]; + CARD32 format; + CARD8 depth; + VisualPtr pVisual; + int v; + int bpp; + int r, g, b; + int d; + DepthPtr pDepth; + + /* formats required by protocol */ + formats[nformats].format = PICT_a1; + formats[nformats].depth = 1; + nformats++; + formats[nformats].format = PICT_a4; + formats[nformats].depth = 4; + nformats++; + formats[nformats].format = PICT_a8; + formats[nformats].depth = 8; + nformats++; + formats[nformats].format = PICT_a8r8g8b8; + formats[nformats].depth = 32; + nformats++; + + /* now look through the depths and visuals adding other formats */ + for (v = 0; v < pScreen->numVisuals; v++) + { + pVisual = &pScreen->visuals[v]; + depth = xglVisualDepth (pScreen, pVisual); + if (!depth) + continue; + + bpp = BitsPerPixel (depth); + switch (pVisual->class) { + case DirectColor: + case TrueColor: + r = Ones (pVisual->redMask); + g = Ones (pVisual->greenMask); + b = Ones (pVisual->blueMask); + if (pVisual->offsetBlue == 0 && + pVisual->offsetGreen == b && + pVisual->offsetRed == b + g) + { + format = PICT_FORMAT (bpp, PICT_TYPE_ARGB, 0, r, g, b); + nformats = xglAddFormat (formats, nformats, format, depth); + } + break; + case StaticColor: + case PseudoColor: + case StaticGray: + case GrayScale: + break; + } + } + + /* walk supported depths and add missing Direct formats */ + for (d = 0; d < pScreen->numDepths; d++) + { + pDepth = &pScreen->allowedDepths[d]; + bpp = BitsPerPixel (pDepth->depth); + format = 0; + switch (bpp) { + case 16: + if (pDepth->depth == 15) + nformats = xglAddFormat (formats, nformats, + PICT_x1r5g5b5, pDepth->depth); + if (pDepth->depth == 16) + nformats = xglAddFormat (formats, nformats, + PICT_r5g6b5, pDepth->depth); + break; + case 24: + if (pDepth->depth == 24) + nformats = xglAddFormat (formats, nformats, + PICT_r8g8b8, pDepth->depth); + break; + case 32: + if (pDepth->depth == 24) + nformats = xglAddFormat (formats, nformats, + PICT_x8r8g8b8, pDepth->depth); + break; + } + } + + /* add YUV formats */ + nformats = xglAddFormat (formats, nformats, PICT_yuy2, 16); + nformats = xglAddFormat (formats, nformats, PICT_yv12, 12); + + pFormats = (PictFormatPtr) xalloc (nformats * sizeof (PictFormatRec)); + if (!pFormats) + return 0; + + memset (pFormats, '\0', nformats * sizeof (PictFormatRec)); + for (f = 0; f < nformats; f++) + { + pFormats[f].id = FakeClientID (0); + pFormats[f].depth = formats[f].depth; + format = formats[f].format; + pFormats[f].format = format; + switch (PICT_FORMAT_TYPE (format)) { + case PICT_TYPE_ARGB: + pFormats[f].type = PictTypeDirect; + pFormats[f].direct.alphaMask = Mask (PICT_FORMAT_A (format)); + if (pFormats[f].direct.alphaMask) + pFormats[f].direct.alpha = (PICT_FORMAT_R (format) + + PICT_FORMAT_G (format) + + PICT_FORMAT_B (format)); + + pFormats[f].direct.redMask = Mask (PICT_FORMAT_R (format)); + pFormats[f].direct.red = (PICT_FORMAT_G (format) + + PICT_FORMAT_B (format)); + + pFormats[f].direct.greenMask = Mask (PICT_FORMAT_G (format)); + pFormats[f].direct.green = PICT_FORMAT_B (format); + + pFormats[f].direct.blueMask = Mask (PICT_FORMAT_B (format)); + pFormats[f].direct.blue = 0; + break; + case PICT_TYPE_A: + pFormats[f].type = PictTypeDirect; + pFormats[f].direct.alpha = 0; + pFormats[f].direct.alphaMask = Mask (PICT_FORMAT_A (format)); + break; + case PICT_TYPE_COLOR: + case PICT_TYPE_GRAY: + pFormats[f].type = PictTypeDirect; + break; + case PICT_TYPE_YUY2: + case PICT_TYPE_YV12: + pFormats[f].type = PictTypeOther; + break; + } + } + + if (!fbPictureInit (pScreen, pFormats, nformats)) + return FALSE; + + return TRUE; +} + +void +xglPictureClipExtents (PicturePtr pPicture, + BoxPtr extents) +{ + if (pPicture->clientClipType != CT_NONE) + { + BoxPtr clip = REGION_EXTENTS (pPicture->pDrawable->pScreen, + (RegionPtr) pPicture->clientClip); + + if (extents->x1 < pPicture->clipOrigin.x + clip->x1) + extents->x1 = pPicture->clipOrigin.x + clip->x1; + + if (extents->y1 < pPicture->clipOrigin.y + clip->y1) + extents->y1 = pPicture->clipOrigin.y + clip->y1; + + if (extents->x2 > pPicture->clipOrigin.x + clip->x2) + extents->x2 = pPicture->clipOrigin.x + clip->x2; + + if (extents->y2 > pPicture->clipOrigin.y + clip->y2) + extents->y2 = pPicture->clipOrigin.y + clip->y2; + } + else + { + if (extents->x1 < 0) + extents->x1 = 0; + + if (extents->y1 < 0) + extents->y1 = 0; + + if (extents->x2 > pPicture->pDrawable->width) + extents->x2 = pPicture->pDrawable->width; + + if (extents->y2 > pPicture->pDrawable->height) + extents->y2 = pPicture->pDrawable->height; + } +} + +#endif diff --git a/xorg-server/hw/xgl/xglpixmap.c b/xorg-server/hw/xgl/xglpixmap.c new file mode 100644 index 000000000..8e602cee3 --- /dev/null +++ b/xorg-server/hw/xgl/xglpixmap.c @@ -0,0 +1,744 @@ +/* + * Copyright © 2004 David Reveman + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * David Reveman not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * David Reveman makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#include "xgl.h" +#include "fb.h" + +static glitz_buffer_hint_t xglPixmapUsageHints[] = { + (glitz_buffer_hint_t) 0, /* reserved for system memory */ + GLITZ_BUFFER_HINT_STREAM_DRAW, + GLITZ_BUFFER_HINT_STREAM_READ, + GLITZ_BUFFER_HINT_STREAM_COPY, + GLITZ_BUFFER_HINT_STATIC_DRAW, + GLITZ_BUFFER_HINT_STATIC_READ, + GLITZ_BUFFER_HINT_STATIC_COPY, + GLITZ_BUFFER_HINT_DYNAMIC_DRAW, + GLITZ_BUFFER_HINT_DYNAMIC_READ, + GLITZ_BUFFER_HINT_DYNAMIC_COPY +}; + +#define NUM_XGL_PIXMAP_USAGE_HINTS \ + (sizeof (xglPixmapUsageHints) / sizeof (xglPixmapUsageHints[0])) + +#define XGL_PIXMAP_USAGE_HINT(hint) (xglPixmapUsageHints[hint]) + +static void +xglPixmapDamageReport (DamagePtr pDamage, + RegionPtr pRegion, + void *closure) +{ + PixmapPtr pPixmap = (PixmapPtr) closure; + BoxPtr pExt; + + XGL_PIXMAP_PRIV (pPixmap); + + pExt = REGION_EXTENTS (pPixmap->drawable.pScreen, pRegion); + + if (BOX_NOTEMPTY (&pPixmapPriv->damageBox)) + { + if (pExt->x1 < pPixmapPriv->damageBox.x1) + pPixmapPriv->damageBox.x1 = pExt->x1; + + if (pExt->y1 < pPixmapPriv->damageBox.y1) + pPixmapPriv->damageBox.y1 = pExt->y1; + + if (pExt->x2 > pPixmapPriv->damageBox.x2) + pPixmapPriv->damageBox.x2 = pExt->x2; + + if (pExt->y2 > pPixmapPriv->damageBox.y2) + pPixmapPriv->damageBox.y2 = pExt->y2; + } + else + pPixmapPriv->damageBox = *pExt; +} + + +static Bool +xglPixmapCreateDamage (PixmapPtr pPixmap) +{ + XGL_PIXMAP_PRIV (pPixmap); + + pPixmapPriv->pDamage = + DamageCreate (xglPixmapDamageReport, (DamageDestroyFunc) 0, + DamageReportRawRegion, TRUE, + pPixmap->drawable.pScreen, + (void *) pPixmap); + if (!pPixmapPriv->pDamage) + return FALSE; + + DamageRegister (&pPixmap->drawable, pPixmapPriv->pDamage); + + return TRUE; +} + +void +xglSetPixmapVisual (PixmapPtr pPixmap, + xglVisualPtr pVisual) +{ + xglVisualPtr pOldVisual; + + XGL_PIXMAP_PRIV (pPixmap); + + pOldVisual = pPixmapPriv->pVisual; + if (pOldVisual && pVisual) + { + glitz_surface_t *surface; + + if (pOldVisual->vid != pVisual->vid) + { + surface = pPixmapPriv->surface; + if (surface) + { + glitz_drawable_t *drawable; + + drawable = glitz_surface_get_attached_drawable (surface); + if (drawable) + { + if (pOldVisual->format.drawable->id != + pVisual->format.drawable->id) + { + glitz_surface_detach (pPixmapPriv->surface); + pPixmapPriv->target = xglPixmapTargetOut; + } + } + + if (pOldVisual->format.surface->id != pVisual->format.surface->id) + { + xglSyncBits (&pPixmap->drawable, NULL); + glitz_surface_destroy (pPixmapPriv->surface); + pPixmapPriv->surface = 0; + } + } + } + } + else if (pOldVisual) + { + if (pPixmapPriv->surface) + { + xglSyncBits (&pPixmap->drawable, NULL); + glitz_surface_destroy (pPixmapPriv->surface); + pPixmapPriv->surface = 0; + } + pPixmapPriv->target = xglPixmapTargetNo; + } + + pPixmapPriv->pVisual = pVisual; + + if (pPixmapPriv->pVisual && pPixmapPriv->pVisual->format.surface) + { + if (!pPixmapPriv->pDamage) + { + if (!xglPixmapCreateDamage (pPixmap)) + FatalError (XGL_SW_FAILURE_STRING); + } + } +} + +static Bool +xglPixmapSurfaceInit (PixmapPtr pPixmap, + unsigned long features, + int width, + int height) +{ + BoxRec box; + + XGL_PIXMAP_PRIV (pPixmap); + + pPixmapPriv->surface = NULL; + pPixmapPriv->drawable = NULL; + pPixmapPriv->acceleratedTile = FALSE; + pPixmapPriv->pictureMask = ~0; + pPixmapPriv->target = xglPixmapTargetNo; + + box.x1 = 0; + box.y1 = 0; + box.x2 = width; + box.y2 = height; + + REGION_INIT (pScreen, &pPixmapPriv->bitRegion, &box, 1); + + pPixmapPriv->pVisual = xglFindVisualWithDepth (pPixmap->drawable.pScreen, + pPixmap->drawable.depth); + if (pPixmapPriv->pVisual) + { + XGL_SCREEN_PRIV (pPixmap->drawable.pScreen); + + /* general pixmap acceleration */ + if (pPixmapPriv->pVisual->format.drawable && + pScreenPriv->accel.pixmap.enabled && + xglCheckPixmapSize (pPixmap, &pScreenPriv->accel.pixmap.size)) + pPixmapPriv->target = xglPixmapTargetOut; + } + + if (pPixmapPriv->pVisual && pPixmapPriv->pVisual->format.surface) + { + if (!pPixmapPriv->pDamage) + { + if (!xglPixmapCreateDamage (pPixmap)) + FatalError (XGL_SW_FAILURE_STRING); + } + + if (width && height) + { + if (width == 1 && height == 1) + { + pPixmapPriv->acceleratedTile = TRUE; + } + else if (features & GLITZ_FEATURE_TEXTURE_BORDER_CLAMP_MASK) + { + if ((features & GLITZ_FEATURE_TEXTURE_NON_POWER_OF_TWO_MASK) || + (POWER_OF_TWO (width) && POWER_OF_TWO (height))) + pPixmapPriv->acceleratedTile = TRUE; + } + } + } + + return TRUE; +} + +PixmapPtr +xglCreatePixmap (ScreenPtr pScreen, + int width, + int height, + int depth, + unsigned usage_hint) +{ + xglPixmapPtr pPixmapPriv; + PixmapPtr pPixmap; + + XGL_SCREEN_PRIV (pScreen); + + pPixmap = AllocatePixmap (pScreen, 0); + if (!pPixmap) + return NullPixmap; + + pPixmap->drawable.type = DRAWABLE_PIXMAP; + pPixmap->drawable.class = 0; + pPixmap->drawable.pScreen = pScreen; + pPixmap->drawable.depth = depth; + pPixmap->drawable.bitsPerPixel = BitsPerPixel (depth); + pPixmap->drawable.id = 0; + pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER; + pPixmap->drawable.x = 0; + pPixmap->drawable.y = 0; + pPixmap->drawable.width = width; + pPixmap->drawable.height = height; + +#ifdef COMPOSITE + pPixmap->screen_x = 0; + pPixmap->screen_y = 0; +#endif + + pPixmap->devKind = 0; + pPixmap->refcnt = 1; + pPixmap->devPrivate.ptr = 0; + pPixmap->usage_hint = usage_hint; + + pPixmapPriv = XGL_GET_PIXMAP_PRIV (pPixmap); + + pPixmapPriv->pVisual = NULL; + pPixmapPriv->pDamage = NULL; + + if (!xglPixmapSurfaceInit (pPixmap, pScreenPriv->features, width, height)) + return NullPixmap; + + pPixmapPriv->buffer = NULL; + pPixmapPriv->bits = (pointer) 0; + pPixmapPriv->stride = 0; + pPixmapPriv->pGeometry = NULL; + pPixmapPriv->allBits = TRUE; + + pPixmapPriv->damageBox = miEmptyBox; + + return pPixmap; +} + +void +xglFiniPixmap (PixmapPtr pPixmap) +{ + XGL_PIXMAP_PRIV (pPixmap); + + if (pPixmap->devPrivate.ptr) + { + if (pPixmapPriv->buffer) + glitz_buffer_unmap (pPixmapPriv->buffer); + } + + if (pPixmapPriv->pGeometry) + GEOMETRY_UNINIT (pPixmapPriv->pGeometry); + + if (pPixmapPriv->buffer) + glitz_buffer_destroy (pPixmapPriv->buffer); + + if (pPixmapPriv->bits) + xfree (pPixmapPriv->bits); + + REGION_UNINIT (pPixmap->drawable.pScreen, &pPixmapPriv->bitRegion); + + if (pPixmapPriv->drawable) + glitz_drawable_destroy (pPixmapPriv->drawable); + + if (pPixmapPriv->surface) + glitz_surface_destroy (pPixmapPriv->surface); +} + +Bool +xglDestroyPixmap (PixmapPtr pPixmap) +{ + if (--pPixmap->refcnt) + return TRUE; + + xglFiniPixmap (pPixmap); + + dixFreePrivates(pPixmap->devPrivates); + xfree (pPixmap); + + return TRUE; +} + +Bool +xglModifyPixmapHeader (PixmapPtr pPixmap, + int width, + int height, + int depth, + int bitsPerPixel, + int devKind, + pointer pPixData) +{ + xglScreenPtr pScreenPriv; + xglPixmapPtr pPixmapPriv; + int oldWidth, oldHeight; + + if (!pPixmap) + return FALSE; + + pScreenPriv = XGL_GET_SCREEN_PRIV (pPixmap->drawable.pScreen); + pPixmapPriv = XGL_GET_PIXMAP_PRIV (pPixmap); + + oldWidth = pPixmap->drawable.width; + oldHeight = pPixmap->drawable.height; + + if ((width > 0) && (height > 0) && (depth > 0) && (bitsPerPixel > 0) && + (devKind > 0) && pPixData) + { + pPixmap->drawable.depth = depth; + pPixmap->drawable.bitsPerPixel = bitsPerPixel; + pPixmap->drawable.id = 0; + pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER; + pPixmap->drawable.x = 0; + pPixmap->drawable.y = 0; + pPixmap->drawable.width = width; + pPixmap->drawable.height = height; + pPixmapPriv->stride = devKind; + pPixmap->refcnt = 1; + } + else + { + if (width > 0) + pPixmap->drawable.width = width; + + if (height > 0) + pPixmap->drawable.height = height; + + if (depth > 0) + pPixmap->drawable.depth = depth; + + if (bitsPerPixel > 0) + pPixmap->drawable.bitsPerPixel = bitsPerPixel; + else if ((bitsPerPixel < 0) && (depth > 0)) + pPixmap->drawable.bitsPerPixel = BitsPerPixel (depth); + + if (devKind > 0) + pPixmapPriv->stride = devKind; + else if ((devKind < 0) && ((width > 0) || (depth > 0))) + pPixmapPriv->stride = PixmapBytePad (pPixmap->drawable.width, + pPixmap->drawable.depth); + } + + if (pPixmap->drawable.width != oldWidth || + pPixmap->drawable.height != oldHeight) + { + pPixmapPriv->pVisual = NULL; + pPixmapPriv->target = xglPixmapTargetNo; + + if (pPixmapPriv->drawable) + glitz_drawable_destroy (pPixmapPriv->drawable); + + if (pPixmapPriv->surface) + glitz_surface_destroy (pPixmapPriv->surface); + + REGION_UNINIT (pPixmap->drawable.pScreen, &pPixmapPriv->bitRegion); + + if (!xglPixmapSurfaceInit (pPixmap, + pScreenPriv->features, + pPixmap->drawable.width, + pPixmap->drawable.height)) + return FALSE; + } + + if (pPixData) + { + BoxRec box; + + if (pPixmap->devPrivate.ptr) + { + if (pPixmapPriv->buffer) + glitz_buffer_unmap (pPixmapPriv->buffer); + + pPixmap->devPrivate.ptr = 0; + } + + if (pPixmapPriv->pGeometry) + { + GEOMETRY_UNINIT (pPixmapPriv->pGeometry); + pPixmapPriv->pGeometry = NULL; + } + + if (pPixmapPriv->buffer) + glitz_buffer_destroy (pPixmapPriv->buffer); + + if (pPixmapPriv->bits) + xfree (pPixmapPriv->bits); + + pPixmapPriv->bits = (pointer) 0; + pPixmapPriv->buffer = glitz_buffer_create_for_data (pPixData); + if (!pPixmapPriv->buffer) + return FALSE; + + pPixmapPriv->allBits = TRUE; + + box.x1 = 0; + box.y1 = 0; + box.x2 = pPixmap->drawable.width; + box.y2 = pPixmap->drawable.height; + + REGION_UNINIT (pPixmap->drawable.pScreen, &pPixmapPriv->bitRegion); + REGION_INIT (pPixmap->drawable.pScreen, &pPixmapPriv->bitRegion, + &box, 1); + + if (pPixmapPriv->pDamage) + { + RegionPtr pRegion; + + pRegion = DamageRegion (pPixmapPriv->pDamage); + + REGION_UNINIT (pPixmap->drawable.pScreen, pRegion); + REGION_INIT (pPixmap->drawable.pScreen, pRegion, NullBox, 0); + REGION_SUBTRACT (pPixmap->drawable.pScreen, pRegion, + &pPixmapPriv->bitRegion, pRegion); + + } + } + + /* + * Screen pixmap + */ + if (!pScreenPriv->pScreenPixmap || pScreenPriv->pScreenPixmap == pPixmap) + { + if (!pPixmapPriv->drawable) + { + glitz_drawable_reference (pScreenPriv->drawable); + pPixmapPriv->drawable = pScreenPriv->drawable; + } + + if (!pPixmapPriv->surface) + { + glitz_surface_reference (pScreenPriv->surface); + pPixmapPriv->surface = pScreenPriv->surface; + } + + pPixmapPriv->pVisual = pScreenPriv->rootVisual; + pPixmapPriv->target = xglPixmapTargetIn; + + if (!pScreenPriv->pScreenPixmap) + pScreenPriv->pScreenPixmap = pPixmap; + } + + return TRUE; +} + +RegionPtr +xglPixmapToRegion (PixmapPtr pPixmap) +{ + ScreenPtr pScreen = pPixmap->drawable.pScreen; + RegionPtr pRegion; + + XGL_SCREEN_PRIV (pScreen); + + if (!xglSyncBits (&pPixmap->drawable, NullBox)) + FatalError (XGL_SW_FAILURE_STRING); + + XGL_SCREEN_UNWRAP (BitmapToRegion); + pRegion = (*pScreen->BitmapToRegion) (pPixmap); + XGL_SCREEN_WRAP (BitmapToRegion, xglPixmapToRegion); + + return pRegion; +} + +xglGeometryPtr +xglPixmapToGeometry (PixmapPtr pPixmap, + int xOff, + int yOff) +{ + XGL_PIXMAP_PRIV (pPixmap); + + if (pPixmap->devPrivate.ptr) + xglUnmapPixmapBits (pPixmap); + + if (!pPixmapPriv->pGeometry) + { + xglGeometryPtr pGeometry; + + if (!pPixmapPriv->buffer) + { + if (!xglAllocatePixmapBits (pPixmap, + XGL_PIXMAP_USAGE_HINT_DEFAULT)) + return NULL; + } + + pGeometry = xalloc (sizeof (xglGeometryRec)); + if (!pGeometry) + return NULL; + + GEOMETRY_INIT (pPixmap->drawable.pScreen, pGeometry, + GLITZ_GEOMETRY_TYPE_BITMAP, + GEOMETRY_USAGE_DYNAMIC, 0); + + GEOMETRY_SET_BUFFER (pGeometry, pPixmapPriv->buffer); + + if (pPixmapPriv->stride < 0) + { + pGeometry->f.bitmap.bytes_per_line = -pPixmapPriv->stride; + pGeometry->f.bitmap.scanline_order = + GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP; + } + else + { + pGeometry->f.bitmap.bytes_per_line = pPixmapPriv->stride; + pGeometry->f.bitmap.scanline_order = + GLITZ_PIXEL_SCANLINE_ORDER_TOP_DOWN; + } + + pGeometry->f.bitmap.pad = ((1 + FB_MASK) >> FB_SHIFT) * + sizeof (FbBits); + pGeometry->width = pPixmap->drawable.width; + pGeometry->count = pPixmap->drawable.height; + + pPixmapPriv->pGeometry = pGeometry; + } + + pPixmapPriv->pGeometry->xOff = xOff << 16; + pPixmapPriv->pGeometry->yOff = yOff << 16; + + return pPixmapPriv->pGeometry; +} + +Bool +xglCreatePixmapSurface (PixmapPtr pPixmap) +{ + XGL_PIXMAP_PRIV (pPixmap); + + if (!pPixmapPriv->surface) + { + XGL_SCREEN_PRIV (pPixmap->drawable.pScreen); + + if (!pPixmapPriv->pVisual || !pPixmapPriv->pVisual->format.surface) + return FALSE; + + pPixmapPriv->surface = + glitz_surface_create (pScreenPriv->drawable, + pPixmapPriv->pVisual->format.surface, + pPixmap->drawable.width, + pPixmap->drawable.height, + 0, NULL); + if (!pPixmapPriv->surface) + { + pPixmapPriv->pVisual = NULL; + pPixmapPriv->target = xglPixmapTargetNo; + + return FALSE; + } + } + + return TRUE; +} + +Bool +xglAllocatePixmapBits (PixmapPtr pPixmap, int hint) +{ + int width, height, bpp, stride; + + XGL_PIXMAP_PRIV (pPixmap); + XGL_SCREEN_PRIV (pPixmap->drawable.pScreen); + + width = pPixmap->drawable.width; + height = pPixmap->drawable.height; + bpp = pPixmap->drawable.bitsPerPixel; + + stride = ((width * bpp + FB_MASK) >> FB_SHIFT) * sizeof (FbBits); + + if (stride) + { + glitz_buffer_t *buffer; + + if ((pScreenPriv->pboMask & bpp) && hint) + { + buffer = glitz_pixel_buffer_create (pScreenPriv->drawable, + NULL, height * stride, + XGL_PIXMAP_USAGE_HINT (hint)); + } + else + { + pPixmapPriv->bits = xalloc (height * stride); + if (!pPixmapPriv->bits) + return FALSE; + + buffer = glitz_buffer_create_for_data (pPixmapPriv->bits); + } + + if (!buffer) + { + if (pPixmapPriv->bits) + xfree (pPixmapPriv->bits); + pPixmapPriv->bits = NULL; + return FALSE; + } + pPixmapPriv->buffer = buffer; + } + + if (pScreenPriv->yInverted) + pPixmapPriv->stride = stride; + else + pPixmapPriv->stride = -stride; + + return TRUE; +} + +Bool +xglMapPixmapBits (PixmapPtr pPixmap) +{ + if (!pPixmap->devPrivate.ptr) + { + CARD8 *bits; + + XGL_PIXMAP_PRIV (pPixmap); + + if (!pPixmapPriv->buffer) + if (!xglAllocatePixmapBits (pPixmap, + XGL_PIXMAP_USAGE_HINT_DEFAULT)) + return FALSE; + + bits = glitz_buffer_map (pPixmapPriv->buffer, + GLITZ_BUFFER_ACCESS_READ_WRITE); + if (!bits) + return FALSE; + + pPixmap->devKind = pPixmapPriv->stride; + if (pPixmapPriv->stride < 0) + { + pPixmap->devPrivate.ptr = bits + + (pPixmap->drawable.height - 1) * -pPixmapPriv->stride; + } + else + { + pPixmap->devPrivate.ptr = bits; + } + } + + return TRUE; +} + +Bool +xglUnmapPixmapBits (PixmapPtr pPixmap) +{ + XGL_PIXMAP_PRIV (pPixmap); + + pPixmap->devKind = 0; + pPixmap->devPrivate.ptr = 0; + + if (pPixmapPriv->buffer) + if (glitz_buffer_unmap (pPixmapPriv->buffer)) + return FALSE; + + return TRUE; +} + +Bool +xglCheckPixmapSize (PixmapPtr pPixmap, + xglSizeConstraintPtr pSize) +{ + if (pPixmap->drawable.width < pSize->minWidth || + pPixmap->drawable.height < pSize->minHeight) + return FALSE; + + if (pPixmap->drawable.width > pSize->aboveWidth || + pPixmap->drawable.height > pSize->aboveHeight) + return TRUE; + + return FALSE; +} + +void +xglEnablePixmapAccel (PixmapPtr pPixmap, + xglAccelInfoPtr pAccel) +{ + XGL_SCREEN_PRIV (pPixmap->drawable.pScreen); + XGL_PIXMAP_PRIV (pPixmap); + + if (pAccel->enabled && xglCheckPixmapSize (pPixmap, &pAccel->size)) + { + xglVisualPtr v; + + if (pAccel->pbuffer) + { + for (v = pScreenPriv->pVisual; v; v = v->next) + { + if (v->pPixel->depth != pPixmap->drawable.depth) + continue; + + if (v->format.drawable && v->pbuffer) + break; + } + } + else + { + for (v = pScreenPriv->pVisual; v; v = v->next) + { + if (v->pPixel->depth != pPixmap->drawable.depth) + continue; + + if (v->format.drawable && !v->pbuffer) + break; + } + } + + if (v) + { + xglSetPixmapVisual (pPixmap, v); + if (!pPixmapPriv->target) + pPixmapPriv->target = xglPixmapTargetOut; + } + } +} diff --git a/xorg-server/hw/xgl/xglscreen.c b/xorg-server/hw/xgl/xglscreen.c new file mode 100644 index 000000000..47ed34508 --- /dev/null +++ b/xorg-server/hw/xgl/xglscreen.c @@ -0,0 +1,473 @@ +/* + * Copyright © 2004 David Reveman + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * David Reveman not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * David Reveman makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#include "xgl.h" +#include "inputstr.h" +#include "mipointer.h" +#include "damage.h" +#include "fb.h" +#ifdef MITSHM +#include "shmint.h" +static ShmFuncs shmFuncs = { NULL, xglShmPutImage }; +#endif +#ifdef RENDER +#include "glyphstr.h" +#endif +#ifdef COMPOSITE +#include "compint.h" +#endif + +int xglScreenGeneration = -1; +int xglScreenPrivateIndex; +int xglGCPrivateIndex; +int xglPixmapPrivateIndex; +int xglWinPrivateIndex; + +#ifdef RENDER +int xglGlyphPrivateIndex; +#endif + +#define xglQueryBestSize (void *) NoopDDA +#define xglSaveScreen (void *) NoopDDA + +#define xglConstrainCursor (void *) NoopDDA +#define xglCursorLimits (void *) NoopDDA +#define xglDisplayCursor (void *) NoopDDA +#define xglRealizeCursor (void *) NoopDDA +#define xglUnrealizeCursor (void *) NoopDDA +#define xglRecolorCursor (void *) NoopDDA +#define xglSetCursorPosition (void *) NoopDDA + +static Bool +xglAllocatePrivates (ScreenPtr pScreen) +{ + xglScreenPtr pScreenPriv; + + if (xglScreenGeneration != serverGeneration) + { + xglScreenPrivateIndex = AllocateScreenPrivateIndex (); + if (xglScreenPrivateIndex < 0) + return FALSE; + + xglGCPrivateIndex = AllocateGCPrivateIndex (); + if (xglGCPrivateIndex < 0) + return FALSE; + + xglPixmapPrivateIndex = AllocatePixmapPrivateIndex (); + if (xglPixmapPrivateIndex < 0) + return FALSE; + + xglWinPrivateIndex = AllocateWindowPrivateIndex (); + if (xglWinPrivateIndex < 0) + return FALSE; + +#ifdef RENDER + xglGlyphPrivateIndex = AllocateGlyphPrivateIndex (); + if (xglGlyphPrivateIndex < 0) + return FALSE; +#endif + + xglScreenGeneration = serverGeneration; + } + + if (!AllocateGCPrivate (pScreen, xglGCPrivateIndex, sizeof (xglGCRec))) + return FALSE; + + if (!AllocatePixmapPrivate (pScreen, xglPixmapPrivateIndex, + sizeof (xglPixmapRec))) + return FALSE; + + if (!AllocateWindowPrivate (pScreen, xglWinPrivateIndex, + sizeof (xglWinRec))) + return FALSE; + + pScreenPriv = xalloc (sizeof (xglScreenRec)); + if (!pScreenPriv) + return FALSE; + + XGL_SET_SCREEN_PRIV (pScreen, pScreenPriv); + + return TRUE; +} + +Bool +xglScreenInit (ScreenPtr pScreen) +{ + xglScreenPtr pScreenPriv; + xglVisualPtr v; + int i, depth, bpp = 0; + +#ifdef RENDER + PictureScreenPtr pPictureScreen; +#endif + + depth = xglScreenInfo.depth; + + for (v = xglVisuals; v; v = v->next) + { + if (v->pPixel->depth == depth) + { + bpp = v->pPixel->masks.bpp; + break; + } + } + + if (!bpp) + return FALSE; + + if (!xglAllocatePrivates (pScreen)) + return FALSE; + + pScreenPriv = XGL_GET_SCREEN_PRIV (pScreen); + + pScreenPriv->pScreenPixmap = NULL; + + /* Add any unlisted depths from the pixmap formats */ + for (i = 0; i < screenInfo.numPixmapFormats; i++) + { + if (!xglHasVisualTypes (xglVisuals, screenInfo.formats[i].depth)) + xglSetVisualTypes (screenInfo.formats[i].depth, 0, 0, 0, 0); + } + + pScreenPriv->pVisual = 0; + +#ifdef GLXEXT + pScreenPriv->pGlxVisual = 0; +#endif + + pScreenPriv->rootVisual = 0; + + pScreenPriv->drawable = xglScreenInfo.drawable; + pScreenPriv->features = + glitz_drawable_get_features (xglScreenInfo.drawable); + + GEOMETRY_INIT (pScreen, &pScreenPriv->scratchGeometry, + GLITZ_GEOMETRY_TYPE_VERTEX, + pScreenPriv->geometryUsage, 0); + + pScreenPriv->geometryDataType = xglScreenInfo.geometryDataType; + pScreenPriv->geometryUsage = xglScreenInfo.geometryUsage; + pScreenPriv->yInverted = xglScreenInfo.yInverted; + pScreenPriv->pboMask = xglScreenInfo.pboMask; + pScreenPriv->lines = xglScreenInfo.lines; + pScreenPriv->accel = xglScreenInfo.accel; + + if (monitorResolution == 0) + monitorResolution = XGL_DEFAULT_DPI; + + if (!fbSetupScreen (pScreen, NULL, + xglScreenInfo.width, xglScreenInfo.height, + monitorResolution, monitorResolution, + xglScreenInfo.width, bpp)) + return FALSE; + + pScreen->SaveScreen = xglSaveScreen; + + pScreen->CreatePixmap = xglCreatePixmap; + pScreen->DestroyPixmap = xglDestroyPixmap; + + if (!fbFinishScreenInit (pScreen, NULL, + xglScreenInfo.width, xglScreenInfo.height, + monitorResolution, monitorResolution, + xglScreenInfo.width, bpp)) + return FALSE; + +#ifdef MITSHM + ShmRegisterFuncs (pScreen, &shmFuncs); +#endif + +#ifdef RENDER + if (!xglPictureInit (pScreen)) + return FALSE; +#endif + + XGL_SCREEN_WRAP (GetImage, xglGetImage); + XGL_SCREEN_WRAP (GetSpans, xglGetSpans); + + XGL_SCREEN_WRAP (CopyWindow, xglCopyWindow); + XGL_SCREEN_WRAP (CreateWindow, xglCreateWindow); + XGL_SCREEN_WRAP (DestroyWindow, xglDestroyWindow); + XGL_SCREEN_WRAP (ChangeWindowAttributes, xglChangeWindowAttributes); + + XGL_SCREEN_WRAP (CreateGC, xglCreateGC); + + pScreen->ConstrainCursor = xglConstrainCursor; + pScreen->CursorLimits = xglCursorLimits; + pScreen->DisplayCursor = xglDisplayCursor; + pScreen->RealizeCursor = xglRealizeCursor; + pScreen->UnrealizeCursor = xglUnrealizeCursor; + pScreen->RecolorCursor = xglRecolorCursor; + pScreen->SetCursorPosition = xglSetCursorPosition; + + pScreen->ModifyPixmapHeader = xglModifyPixmapHeader; + + XGL_SCREEN_WRAP (BitmapToRegion, xglPixmapToRegion); + + pScreen->GetWindowPixmap = xglGetWindowPixmap; + + XGL_SCREEN_WRAP (SetWindowPixmap, xglSetWindowPixmap); + +#ifdef RENDER + pPictureScreen = GetPictureScreenIfSet (pScreen); + if (pPictureScreen) + { + if (!AllocateGlyphPrivate (pScreen, xglGlyphPrivateIndex, + sizeof (xglGlyphRec))) + return FALSE; + + XGL_PICTURE_SCREEN_WRAP (RealizeGlyph, xglRealizeGlyph); + XGL_PICTURE_SCREEN_WRAP (UnrealizeGlyph, xglUnrealizeGlyph); + XGL_PICTURE_SCREEN_WRAP (Composite, xglComposite); + XGL_PICTURE_SCREEN_WRAP (Glyphs, xglGlyphs); + XGL_PICTURE_SCREEN_WRAP (Trapezoids, xglTrapezoids); + XGL_PICTURE_SCREEN_WRAP (AddTraps, xglAddTraps); + XGL_PICTURE_SCREEN_WRAP (AddTriangles, xglAddTriangles); + XGL_PICTURE_SCREEN_WRAP (ChangePicture, xglChangePicture); + XGL_PICTURE_SCREEN_WRAP (ChangePictureTransform, + xglChangePictureTransform); + XGL_PICTURE_SCREEN_WRAP (ChangePictureFilter, xglChangePictureFilter); + } +#endif + + if (!fbCreateDefColormap (pScreen)) + return FALSE; + +#ifdef COMPOSITE +#warning "composite building" + if (!compScreenInit (pScreen)) + return FALSE; +#endif + + /* Damage is required */ + DamageSetup (pScreen); + + XGL_SCREEN_WRAP (CloseScreen, xglCloseScreen); + + return TRUE; +} + +Bool +xglFinishScreenInit (ScreenPtr pScreen) +{ + xglVisualPtr v; + +#ifdef RENDER + glitz_vertex_format_t *format; + static glitz_color_t clearBlack = { 0x0, 0x0, 0x0, 0x0 }; + static glitz_color_t solidWhite = { 0xffff, 0xffff, 0xffff, 0xffff }; + int i; +#endif + + XGL_SCREEN_PRIV (pScreen); + + xglInitVisuals (pScreen); + + for (v = pScreenPriv->pVisual; v; v = v->next) + { + if (v->vid == pScreen->rootVisual) + pScreenPriv->rootVisual = v; + } + + if (!pScreenPriv->rootVisual || !pScreenPriv->rootVisual->format.surface) + return FALSE; + + pScreenPriv->surface = + glitz_surface_create (pScreenPriv->drawable, + pScreenPriv->rootVisual->format.surface, + xglScreenInfo.width, xglScreenInfo.height, + 0, NULL); + if (!pScreenPriv->surface) + return FALSE; + + glitz_surface_attach (pScreenPriv->surface, + pScreenPriv->drawable, + GLITZ_DRAWABLE_BUFFER_FRONT_COLOR); + +#ifdef RENDER + for (i = 0; i < 33; i++) + pScreenPriv->glyphCache[i].pScreen = NULL; + + for (v = pScreenPriv->pVisual; v; v = v->next) + { + if (v->pPixel->depth == 8) + break; + } + + pScreenPriv->pSolidAlpha = 0; + pScreenPriv->trapInfo.pMask = 0; + + /* An accelerated alpha only Xgl visual is required for trapezoid + acceleration */ + if (v && v->format.surface) + { + glitz_surface_t *mask; + + mask = glitz_surface_create (pScreenPriv->drawable, + v->format.surface, + 2, 1, 0, NULL); + if (mask) + { + glitz_set_rectangle (mask, &clearBlack, 0, 0, 1, 1); + glitz_set_rectangle (mask, &solidWhite, 1, 0, 1, 1); + + glitz_surface_set_fill (mask, GLITZ_FILL_NEAREST); + glitz_surface_set_filter (mask, GLITZ_FILTER_BILINEAR, NULL, 0); + + pScreenPriv->trapInfo.pMask = xglCreateDevicePicture (mask); + if (!pScreenPriv->trapInfo.pMask) + return FALSE; + } + } + + format = &pScreenPriv->trapInfo.format.vertex; + format->primitive = GLITZ_PRIMITIVE_QUADS; + format->attributes = GLITZ_VERTEX_ATTRIBUTE_MASK_COORD_MASK; + + format->mask.type = GLITZ_DATA_TYPE_FLOAT; + format->mask.size = GLITZ_COORDINATE_SIZE_X; + format->bytes_per_vertex = sizeof (glitz_float_t); + + if (pScreenPriv->geometryDataType) + { + format->type = GLITZ_DATA_TYPE_FLOAT; + format->bytes_per_vertex += 2 * sizeof (glitz_float_t); + format->mask.offset = 2 * sizeof (glitz_float_t); + } + else + { + format->type = GLITZ_DATA_TYPE_SHORT; + format->bytes_per_vertex += 2 * sizeof (glitz_short_t); + format->mask.offset = 2 * sizeof (glitz_short_t); + } +#endif + +#ifdef XV + if (!xglXvScreenInit (pScreen)) + return FALSE; +#endif + + return TRUE; +} + +Bool +xglCloseScreen (int index, + ScreenPtr pScreen) +{ + xglVisualPtr v; + + XGL_SCREEN_PRIV (pScreen); + XGL_PIXMAP_PRIV (pScreenPriv->pScreenPixmap); + +#ifdef RENDER + int i; + + for (i = 0; i < 33; i++) + xglFiniGlyphCache (&pScreenPriv->glyphCache[i]); + + if (pScreenPriv->pSolidAlpha) + FreePicture ((pointer) pScreenPriv->pSolidAlpha, 0); + + if (pScreenPriv->trapInfo.pMask) + FreePicture ((pointer) pScreenPriv->trapInfo.pMask, 0); +#endif + + xglFiniPixmap (pScreenPriv->pScreenPixmap); + if (pPixmapPriv->pDamage) + DamageDestroy (pPixmapPriv->pDamage); + + if (pScreenPriv->surface) + glitz_surface_destroy (pScreenPriv->surface); + + GEOMETRY_UNINIT (&pScreenPriv->scratchGeometry); + + while (pScreenPriv->pVisual) + { + v = pScreenPriv->pVisual; + pScreenPriv->pVisual = v->next; + xfree (v); + } + +#ifdef GLXEXT + while (pScreenPriv->pGlxVisual) + { + v = pScreenPriv->pGlxVisual; + pScreenPriv->pGlxVisual = v->next; + xfree (v); + } +#endif + + XGL_SCREEN_UNWRAP (CloseScreen); + xfree (pScreenPriv); + + return (*pScreen->CloseScreen) (index, pScreen); +} + +#ifdef RENDER +void +xglCreateSolidAlphaPicture (ScreenPtr pScreen) +{ + static xRenderColor solidWhite = { 0xffff, 0xffff, 0xffff, 0xffff }; + static xRectangle one = { 0, 0, 1, 1 }; + PixmapPtr pPixmap; + PictFormatPtr pFormat; + int error; + Pixel pixel; + GCPtr pGC; + XID tmpval[2]; + + XGL_SCREEN_PRIV (pScreen); + + pFormat = PictureMatchFormat (pScreen, 32, PICT_a8r8g8b8); + if (!pFormat) + return; + + pGC = GetScratchGC (pFormat->depth, pScreen); + if (!pGC) + return; + + pPixmap = (*pScreen->CreatePixmap) (pScreen, 1, 1, pFormat->depth, 0); + if (!pPixmap) + return; + + miRenderColorToPixel (pFormat, &solidWhite, &pixel); + + tmpval[0] = GXcopy; + tmpval[1] = pixel; + + ChangeGC (pGC, GCFunction | GCForeground, tmpval); + ValidateGC (&pPixmap->drawable, pGC); + (*pGC->ops->PolyFillRect) (&pPixmap->drawable, pGC, 1, &one); + FreeScratchGC (pGC); + + tmpval[0] = xTrue; + pScreenPriv->pSolidAlpha = CreatePicture (0, &pPixmap->drawable, pFormat, + CPRepeat, tmpval, + serverClient, &error); + (*pScreen->DestroyPixmap) (pPixmap); + + if (pScreenPriv->pSolidAlpha) + ValidatePicture (pScreenPriv->pSolidAlpha); +} +#endif diff --git a/xorg-server/hw/xgl/xglshm.c b/xorg-server/hw/xgl/xglshm.c new file mode 100644 index 000000000..567daa954 --- /dev/null +++ b/xorg-server/hw/xgl/xglshm.c @@ -0,0 +1,123 @@ +/* + * Copyright © 2005 Novell, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * Novell, Inc. not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * Novell, Inc. makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#include "xgl.h" +#include "gcstruct.h" + +#ifdef MITSHM + +void +xglShmPutImage (DrawablePtr pDrawable, + GCPtr pGC, + int depth, + unsigned int format, + int w, + int h, + int sx, + int sy, + int sw, + int sh, + int dx, + int dy, + char *data) +{ + ScreenPtr pScreen = pDrawable->pScreen; + PixmapPtr pPixmapHeader = NULL; + PixmapPtr pPixmap; + int saveTarget; + + XGL_DRAWABLE_PIXMAP_PRIV (pDrawable); + + if ((format == ZPixmap) || (depth == 1)) + { + pPixmap = pPixmapHeader = + GetScratchPixmapHeader (pScreen, w, h, depth, + BitsPerPixel (depth), + PixmapBytePad (w, depth), + (pointer) data); + + /* disable any possible acceleration of this pixmap */ + if (pPixmap) + xglSetPixmapVisual (pPixmap, 0); + } + else + { + pPixmap = (*pScreen->CreatePixmap) (pScreen, sw, sh, depth, + CREATE_PIXMAP_USAGE_SCRATCH); + if (pPixmap) + { + GCPtr pScratchGC; + + if (!xglAllocatePixmapBits (pPixmap, + XGL_PIXMAP_USAGE_HINT_DEFAULT)) + { + (*pScreen->DestroyPixmap) (pPixmap); + return; + } + + xglSetPixmapVisual (pPixmap, 0); + + pScratchGC = GetScratchGC (depth, pScreen); + if (!pScratchGC) + { + (*pScreen->DestroyPixmap) (pPixmap); + return; + } + + ValidateGC ((DrawablePtr) pPixmap, pScratchGC); + (*pGC->ops->PutImage) ((DrawablePtr) pPixmap, pScratchGC, depth, + -sx, -sy, w, h, 0, + (format == XYPixmap) ? XYPixmap : ZPixmap, + data); + + FreeScratchGC (pScratchGC); + + sx = sy = 0; + } + } + + if (!pPixmap) + return; + + /* CopyArea should always be done in software */ + saveTarget = pPixmapPriv->target; + pPixmapPriv->target = xglPixmapTargetNo; + + if (format == XYBitmap) + (*pGC->ops->CopyPlane) ((DrawablePtr) pPixmap, pDrawable, pGC, + sx, sy, sw, sh, dx, dy, 1L); + else + (*pGC->ops->CopyArea) ((DrawablePtr) pPixmap, pDrawable, pGC, + sx, sy, sw, sh, dx, dy); + + pPixmapPriv->target = saveTarget; + + if (pPixmapHeader) + FreeScratchPixmapHeader (pPixmapHeader); + else + (*pScreen->DestroyPixmap) (pPixmap); +} + +#endif diff --git a/xorg-server/hw/xgl/xglsolid.c b/xorg-server/hw/xgl/xglsolid.c new file mode 100644 index 000000000..8657a9a16 --- /dev/null +++ b/xorg-server/hw/xgl/xglsolid.c @@ -0,0 +1,159 @@ +/* + * Copyright © 2004 David Reveman + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * David Reveman not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * David Reveman makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#include "xgl.h" +#include "gcstruct.h" +#include <X11/fonts/fontstruct.h> +#include "dixfontstr.h" + +Bool +xglSolid (DrawablePtr pDrawable, + glitz_operator_t op, + glitz_surface_t *solid, + xglGeometryPtr pGeometry, + int x, + int y, + int width, + int height, + BoxPtr pBox, + int nBox) +{ + glitz_surface_t *surface; + int xOff, yOff; + + if (nBox < 1) + return TRUE; + + if (!xglPrepareTarget (pDrawable)) + return FALSE; + + XGL_GET_DRAWABLE (pDrawable, surface, xOff, yOff); + + if (pGeometry) + { + glitz_surface_set_clip_region (surface, xOff, yOff, + (glitz_box_t *) pBox, nBox); + } + else + { + pGeometry = xglGetScratchVertexGeometry (pDrawable->pScreen, 4 * nBox); + GEOMETRY_ADD_BOX (pDrawable->pScreen, pGeometry, pBox, nBox); + } + + GEOMETRY_TRANSLATE (pGeometry, xOff, yOff); + + if (!GEOMETRY_ENABLE (pGeometry, surface)) + return FALSE; + + glitz_composite (op, + solid, NULL, surface, + 0, 0, + 0, 0, + x + xOff, + y + yOff, + width, height); + + glitz_surface_set_clip_region (surface, 0, 0, NULL, 0); + + if (glitz_surface_get_status (surface)) + return FALSE; + + return TRUE; +} + +Bool +xglSolidGlyph (DrawablePtr pDrawable, + GCPtr pGC, + int x, + int y, + unsigned int nGlyph, + CharInfoPtr *ppci, + pointer pglyphBase) +{ + xglGeometryRec geometry; + int xBack, widthBack; + int yBack, heightBack; + + XGL_GC_PRIV (pGC); + + x += pDrawable->x; + y += pDrawable->y; + + GEOMETRY_INIT (pDrawable->pScreen, &geometry, + GLITZ_GEOMETRY_TYPE_BITMAP, + GEOMETRY_USAGE_SYSMEM, 0); + + GEOMETRY_FOR_GLYPH (pDrawable->pScreen, + &geometry, + nGlyph, + ppci, + pglyphBase); + + GEOMETRY_TRANSLATE (&geometry, x, y); + + widthBack = 0; + while (nGlyph--) + widthBack += (*ppci++)->metrics.characterWidth; + + xBack = x; + if (widthBack < 0) + { + xBack += widthBack; + widthBack = -widthBack; + } + yBack = y - FONTASCENT (pGC->font); + heightBack = FONTASCENT (pGC->font) + FONTDESCENT (pGC->font); + + if (xglSolid (pDrawable, + pGCPriv->op, + pGCPriv->bg, + NULL, + xBack, + yBack, + widthBack, + heightBack, + REGION_RECTS (pGC->pCompositeClip), + REGION_NUM_RECTS (pGC->pCompositeClip))) + { + if (xglSolid (pDrawable, + pGCPriv->op, + pGCPriv->fg, + &geometry, + xBack, + yBack, + widthBack, + heightBack, + REGION_RECTS (pGC->pCompositeClip), + REGION_NUM_RECTS (pGC->pCompositeClip))) + { + GEOMETRY_UNINIT (&geometry); + xglAddCurrentBitDamage (pDrawable); + return TRUE; + } + } + + GEOMETRY_UNINIT (&geometry); + return FALSE; +} diff --git a/xorg-server/hw/xgl/xglsync.c b/xorg-server/hw/xgl/xglsync.c new file mode 100644 index 000000000..6b5c00b57 --- /dev/null +++ b/xorg-server/hw/xgl/xglsync.c @@ -0,0 +1,453 @@ +/* + * Copyright © 2004 David Reveman + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * David Reveman not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * David Reveman makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#include "xgl.h" + +Bool +xglSyncBits (DrawablePtr pDrawable, + BoxPtr pExtents) +{ + RegionRec region; + BoxRec box; + + XGL_DRAWABLE_PIXMAP (pDrawable); + XGL_PIXMAP_PRIV (pPixmap); + + if (pPixmapPriv->allBits) + return xglMapPixmapBits (pPixmap); + + if (pPixmapPriv->target == xglPixmapTargetIn && pExtents) + { + box.x1 = 0; + box.y1 = 0; + box.x2 = pPixmap->drawable.width; + box.y2 = pPixmap->drawable.height; + if (pExtents->x1 > box.x1) + box.x1 = pExtents->x1; + if (pExtents->y1 > box.y1) + box.y1 = pExtents->y1; + if (pExtents->x2 < box.x2) + box.x2 = pExtents->x2; + if (pExtents->y2 < box.y2) + box.y2 = pExtents->y2; + + if (box.x2 <= box.x1 || box.y2 <= box.y1) + return xglMapPixmapBits (pPixmap); + + if (REGION_NOTEMPTY (pDrawable->pScreen, &pPixmapPriv->bitRegion)) + { + switch (RECT_IN_REGION (pDrawable->pScreen, + &pPixmapPriv->bitRegion, + &box)) { + case rgnIN: + REGION_INIT (pDrawable->pScreen, ®ion, NullBox, 0); + break; + case rgnOUT: + REGION_INIT (pDrawable->pScreen, ®ion, &box, 1); + REGION_UNION (pDrawable->pScreen, + &pPixmapPriv->bitRegion, &pPixmapPriv->bitRegion, + ®ion); + break; + case rgnPART: + REGION_INIT (pDrawable->pScreen, ®ion, &box, 1); + REGION_SUBTRACT (pDrawable->pScreen, ®ion, ®ion, + &pPixmapPriv->bitRegion); + REGION_UNION (pDrawable->pScreen, + &pPixmapPriv->bitRegion, &pPixmapPriv->bitRegion, + ®ion); + break; + } + } + else + { + REGION_INIT (pDrawable->pScreen, ®ion, &box, 1); + REGION_SUBTRACT (pDrawable->pScreen, &pPixmapPriv->bitRegion, + ®ion, &pPixmapPriv->bitRegion); + } + + if (REGION_NUM_RECTS (&pPixmapPriv->bitRegion) == 1) + { + BoxPtr pBox; + + pBox = REGION_RECTS (&pPixmapPriv->bitRegion); + + if (pBox->x1 <= 0 && + pBox->y1 <= 0 && + pBox->x2 >= pPixmap->drawable.width && + pBox->y2 >= pPixmap->drawable.height) + pPixmapPriv->allBits = TRUE; + } + } + else + { + box.x1 = 0; + box.y1 = 0; + box.x2 = pPixmap->drawable.width; + box.y2 = pPixmap->drawable.height; + + REGION_INIT (pDrawable->pScreen, ®ion, &box, 1); + REGION_SUBTRACT (pDrawable->pScreen, ®ion, ®ion, + &pPixmapPriv->bitRegion); + + pPixmapPriv->allBits = TRUE; + } + + if (!pPixmapPriv->buffer) + if (!xglAllocatePixmapBits (pPixmap, XGL_PIXMAP_USAGE_HINT_DEFAULT)) + return FALSE; + + if (REGION_NOTEMPTY (pDrawable->pScreen, ®ion) && pPixmapPriv->surface) + { + glitz_pixel_format_t format; + BoxPtr pBox; + BoxPtr pExt; + int nBox; + + if (!xglSyncSurface (pDrawable)) + FatalError (XGL_SW_FAILURE_STRING); + + xglUnmapPixmapBits (pPixmap); + + pBox = REGION_RECTS (®ion); + nBox = REGION_NUM_RECTS (®ion); + pExt = REGION_EXTENTS (pDrawable->pScreen, ®ion); + + format.fourcc = GLITZ_FOURCC_RGB; + format.masks = pPixmapPriv->pVisual->pPixel->masks; + format.xoffset = pExt->x1; + + if (pPixmapPriv->stride < 0) + { + format.skip_lines = pPixmap->drawable.height - pExt->y2; + format.bytes_per_line = -pPixmapPriv->stride; + format.scanline_order = GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP; + } + else + { + format.skip_lines = pExt->y1; + format.bytes_per_line = pPixmapPriv->stride; + format.scanline_order = GLITZ_PIXEL_SCANLINE_ORDER_TOP_DOWN; + } + + glitz_surface_set_clip_region (pPixmapPriv->surface, + 0, 0, (glitz_box_t *) pBox, nBox); + + glitz_get_pixels (pPixmapPriv->surface, + pExt->x1, + pExt->y1, + pExt->x2 - pExt->x1, + pExt->y2 - pExt->y1, + &format, + pPixmapPriv->buffer); + + glitz_surface_set_clip_region (pPixmapPriv->surface, 0, 0, NULL, 0); + } + + REGION_UNINIT (pDrawable->pScreen, ®ion); + + if (pPixmapPriv->allBits) + { + box.x1 = 0; + box.y1 = 0; + box.x2 = pPixmap->drawable.width; + box.y2 = pPixmap->drawable.height; + + REGION_UNINIT (pDrawable->pScreen, &pPixmapPriv->bitRegion); + REGION_INIT (pDrawable->pScreen, &pPixmapPriv->bitRegion, &box, 1); + } + + return xglMapPixmapBits (pPixmap); +} + +void +xglSyncDamageBoxBits (DrawablePtr pDrawable) +{ + XGL_DRAWABLE_PIXMAP_PRIV (pDrawable); + + if (!xglSyncBits (pDrawable, &pPixmapPriv->damageBox)) + FatalError (XGL_SW_FAILURE_STRING); +} + +Bool +xglSyncSurface (DrawablePtr pDrawable) +{ + RegionPtr pRegion; + + XGL_DRAWABLE_PIXMAP (pDrawable); + XGL_PIXMAP_PRIV (pPixmap); + + if (!pPixmapPriv->surface) + { + if (!xglCreatePixmapSurface (pPixmap)) + return FALSE; + } + + pRegion = DamageRegion (pPixmapPriv->pDamage); + + if (REGION_NOTEMPTY (pDrawable->pScreen, pRegion)) + { + glitz_pixel_format_t format; + BoxPtr pBox; + BoxPtr pExt; + int nBox; + + xglUnmapPixmapBits (pPixmap); + + nBox = REGION_NUM_RECTS (pRegion); + pBox = REGION_RECTS (pRegion); + pExt = REGION_EXTENTS (pDrawable->pScreen, pRegion); + + format.fourcc = pPixmapPriv->pVisual->format.surface->color.fourcc; + format.masks = pPixmapPriv->pVisual->pPixel->masks; + format.xoffset = pExt->x1; + + if (pPixmapPriv->stride < 0) + { + format.skip_lines = pPixmap->drawable.height - pExt->y2; + format.bytes_per_line = -pPixmapPriv->stride; + format.scanline_order = GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP; + } + else + { + format.skip_lines = pExt->y1; + format.bytes_per_line = pPixmapPriv->stride; + format.scanline_order = GLITZ_PIXEL_SCANLINE_ORDER_TOP_DOWN; + } + + glitz_surface_set_clip_region (pPixmapPriv->surface, + 0, 0, (glitz_box_t *) pBox, nBox); + + glitz_set_pixels (pPixmapPriv->surface, + pExt->x1, + pExt->y1, + pExt->x2 - pExt->x1, + pExt->y2 - pExt->y1, + &format, + pPixmapPriv->buffer); + + glitz_surface_set_clip_region (pPixmapPriv->surface, 0, 0, NULL, 0); + + REGION_EMPTY (pDrawable->pScreen, pRegion); + } + + return TRUE; +} + +Bool +xglPrepareTarget (DrawablePtr pDrawable) +{ + XGL_DRAWABLE_PIXMAP (pDrawable); + XGL_PIXMAP_PRIV (pPixmap); + + switch (pPixmapPriv->target) { + case xglPixmapTargetNo: + break; + case xglPixmapTargetOut: + if (xglSyncSurface (pDrawable)) + { + glitz_drawable_format_t *format; + + XGL_SCREEN_PRIV (pDrawable->pScreen); + + if (!pPixmapPriv->drawable) + { + unsigned int width, height; + + format = pPixmapPriv->pVisual->format.drawable; + width = pPixmap->drawable.width; + height = pPixmap->drawable.height; + + if (pPixmapPriv->pVisual->pbuffer) + { + pPixmapPriv->drawable = + glitz_create_pbuffer_drawable (pScreenPriv->drawable, + format, width, height); + } + else + { + pPixmapPriv->drawable = + glitz_create_drawable (pScreenPriv->drawable, + format, width, height); + } + } + + if (pPixmapPriv->drawable) + { + glitz_surface_attach (pPixmapPriv->surface, + pPixmapPriv->drawable, + GLITZ_DRAWABLE_BUFFER_FRONT_COLOR); + + pPixmapPriv->target = xglPixmapTargetIn; + + return TRUE; + } + } + pPixmapPriv->target = xglPixmapTargetNo; + break; + case xglPixmapTargetIn: + if (xglSyncSurface (pDrawable)) + return TRUE; + break; + } + + return FALSE; +} + +void +xglAddSurfaceDamage (DrawablePtr pDrawable, + RegionPtr pRegion) +{ + glitz_surface_t *surface; + int xOff, yOff; + + XGL_DRAWABLE_PIXMAP_PRIV (pDrawable); + + pPixmapPriv->damageBox = miEmptyBox; + + XGL_GET_DRAWABLE (pDrawable, surface, xOff, yOff); + + if (xOff || yOff) + REGION_TRANSLATE (pDrawable->pScreen, pRegion, xOff, yOff); + + if (pPixmapPriv->pDamage) + { + RegionPtr pDamageRegion; + + pDamageRegion = DamageRegion (pPixmapPriv->pDamage); + + REGION_UNION (pDrawable->pScreen, + pDamageRegion, pDamageRegion, + pRegion); + } + + REGION_UNION (pDrawable->pScreen, + &pPixmapPriv->bitRegion, &pPixmapPriv->bitRegion, + pRegion); + + if (xOff || yOff) + REGION_TRANSLATE (pDrawable->pScreen, pRegion, -xOff, -yOff); +} + +void +xglAddCurrentSurfaceDamage (DrawablePtr pDrawable) +{ + XGL_DRAWABLE_PIXMAP_PRIV (pDrawable); + + if (BOX_NOTEMPTY (&pPixmapPriv->damageBox)) + { + RegionRec region; + + REGION_INIT (pDrawable->pScreen, ®ion, &pPixmapPriv->damageBox, 1); + + if (pPixmapPriv->pDamage) + { + RegionPtr pDamageRegion; + + pDamageRegion = DamageRegion (pPixmapPriv->pDamage); + + REGION_UNION (pDrawable->pScreen, + pDamageRegion, pDamageRegion, + ®ion); + } + + REGION_UNION (pDrawable->pScreen, + &pPixmapPriv->bitRegion, &pPixmapPriv->bitRegion, + ®ion); + + REGION_UNINIT (pDrawable->pScreen, ®ion); + + pPixmapPriv->damageBox = miEmptyBox; + } +} + +void +xglAddBitDamage (DrawablePtr pDrawable, + RegionPtr pRegion) +{ + XGL_DRAWABLE_PIXMAP_PRIV (pDrawable); + + if (REGION_NOTEMPTY (pDrawable->pScreen, &pPixmapPriv->bitRegion)) + { + BoxPtr pBox; + BoxPtr pExt, pBitExt; + int nBox; + + pBox = REGION_RECTS (pRegion); + pExt = REGION_EXTENTS (pDrawable->pScreen, pRegion); + nBox = REGION_NUM_RECTS (pRegion); + + pBitExt = REGION_EXTENTS (pDrawable->pScreen, &pPixmapPriv->bitRegion); + + if (pExt->x1 < pBitExt->x2 && + pExt->y1 < pBitExt->y2 && + pExt->x2 > pBitExt->x1 && + pExt->y2 > pBitExt->y1) + { + while (nBox--) + { + if (pBox->x1 < pBitExt->x2 && + pBox->y1 < pBitExt->y2 && + pBox->x2 > pBitExt->x1 && + pBox->y2 > pBitExt->y1) + { + REGION_UNINIT (pDrawable->pScreen, + &pPixmapPriv->bitRegion); + REGION_INIT (pDrawable->pScreen, &pPixmapPriv->bitRegion, + NullBox, 0); + pPixmapPriv->allBits = FALSE; + return; + } + + pBox++; + } + } + } +} + +void +xglAddCurrentBitDamage (DrawablePtr pDrawable) +{ + XGL_DRAWABLE_PIXMAP_PRIV (pDrawable); + + if (REGION_NOTEMPTY (pDrawable->pScreen, &pPixmapPriv->bitRegion)) + { + BoxPtr pBitExt; + + pBitExt = REGION_EXTENTS (pDrawable->pScreen, &pPixmapPriv->bitRegion); + + if (pPixmapPriv->damageBox.x1 < pBitExt->x2 && + pPixmapPriv->damageBox.y1 < pBitExt->y2 && + pPixmapPriv->damageBox.x2 > pBitExt->x1 && + pPixmapPriv->damageBox.y2 > pBitExt->y1) + { + REGION_UNINIT (pDrawable->pScreen, &pPixmapPriv->bitRegion); + REGION_INIT (pDrawable->pScreen, &pPixmapPriv->bitRegion, + NullBox, 0); + pPixmapPriv->allBits = FALSE; + } + } + + pPixmapPriv->damageBox = miEmptyBox; +} diff --git a/xorg-server/hw/xgl/xgltile.c b/xorg-server/hw/xgl/xgltile.c new file mode 100644 index 000000000..25b78c316 --- /dev/null +++ b/xorg-server/hw/xgl/xgltile.c @@ -0,0 +1,268 @@ +/* + * Copyright © 2004 David Reveman + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * David Reveman not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * David Reveman makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#include "xgl.h" + +static glitz_geometry_format_t tileGeometryFormat = { + { + GLITZ_PRIMITIVE_QUADS, + GLITZ_DATA_TYPE_FLOAT, + sizeof (glitz_float_t) * 4, + GLITZ_VERTEX_ATTRIBUTE_SRC_COORD_MASK, { + GLITZ_DATA_TYPE_FLOAT, + GLITZ_COORDINATE_SIZE_XY, + sizeof (glitz_float_t) * 2, + }, { + 0, 0, 0 + } + } +}; + +xglGeometryPtr +xglTiledBoxGeometry (PixmapPtr pTile, + int tileX, + int tileY, + BoxPtr pBox, + int nBox) +{ + ScreenPtr pScreen = pTile->drawable.pScreen; + glitz_point_fixed_t p1, p2; + xglGeometryPtr pGeometry; + glitz_float_t x1, x2, y1, y2; + int x, y, width, height, i; + int xTile, yTile; + int widthTile, heightTile; + int widthTmp, xTmp, yTmp, xTileTmp; + int tileWidth, tileHeight; + int size = 0; + glitz_float_t *data; + + XGL_PIXMAP_PRIV (pTile); + + tileWidth = pTile->drawable.width; + tileHeight = pTile->drawable.height; + + for (i = 0; i < nBox; i++) + size += + (((pBox[i].x2 - pBox[i].x1) / tileWidth) + 2) * + (((pBox[i].y2 - pBox[i].y1) / tileHeight) + 2); + + pGeometry = xglGetScratchVertexGeometryWithType (pScreen, + GEOMETRY_DATA_TYPE_FLOAT, + 8 * size); + + data = glitz_buffer_map (pGeometry->buffer, + GLITZ_BUFFER_ACCESS_WRITE_ONLY); + + while (nBox--) + { + x = pBox->x1; + y = pBox->y1; + width = pBox->x2 - pBox->x1; + height = pBox->y2 - pBox->y1; + + xTile = MOD (tileX + x, tileWidth); + yTile = MOD (tileY + y, tileHeight); + + yTmp = y; + + while (height) + { + heightTile = MIN (tileHeight - yTile, height); + + xTileTmp = xTile; + widthTmp = width; + xTmp = x; + + while (widthTmp) + { + widthTile = MIN (tileWidth - xTileTmp, widthTmp); + + p1.x = xTileTmp << 16; + p1.y = yTile << 16; + p2.x = (xTileTmp + widthTile) << 16; + p2.y = (yTile + heightTile) << 16; + + glitz_surface_translate_point (pPixmapPriv->surface, &p1, &p1); + glitz_surface_translate_point (pPixmapPriv->surface, &p2, &p2); + + x1 = FIXED_TO_FLOAT (p1.x); + y1 = FIXED_TO_FLOAT (p1.y); + x2 = FIXED_TO_FLOAT (p2.x); + y2 = FIXED_TO_FLOAT (p2.y); + + *data++ = (glitz_float_t) xTmp; + *data++ = (glitz_float_t) yTmp; + *data++ = x1; + *data++ = y1; + + *data++ = (glitz_float_t) (xTmp + widthTile); + *data++ = (glitz_float_t) yTmp; + *data++ = x2; + *data++ = y1; + + *data++ = (glitz_float_t) (xTmp + widthTile); + *data++ = (glitz_float_t) (yTmp + heightTile); + *data++ = x2; + *data++ = y2; + + *data++ = (glitz_float_t) xTmp; + *data++ = (glitz_float_t) (yTmp + heightTile); + *data++ = x1; + *data++ = y2; + + pGeometry->endOffset += sizeof (glitz_float_t) * 16; + + xTileTmp = 0; + xTmp += widthTile; + widthTmp -= widthTile; + } + + yTile = 0; + yTmp += heightTile; + height -= heightTile; + } + + pBox++; + } + + if (glitz_buffer_unmap (pGeometry->buffer)) + return NULL; + + pGeometry->f = tileGeometryFormat; + pGeometry->count = + pGeometry->endOffset / tileGeometryFormat.vertex.bytes_per_vertex; + + pPixmapPriv->pictureMask |= xglPCFillMask; + glitz_surface_set_fill (pPixmapPriv->surface, GLITZ_FILL_TRANSPARENT); + + return pGeometry; +} + +Bool +xglTile (DrawablePtr pDrawable, + glitz_operator_t op, + PixmapPtr pTile, + int tileX, + int tileY, + xglGeometryPtr pGeometry, + int x, + int y, + int width, + int height, + BoxPtr pBox, + int nBox) +{ + xglPixmapPtr pTilePriv; + glitz_surface_t *surface; + int xOff, yOff; + + if (nBox < 1) + return TRUE; + + if (!xglPrepareTarget (pDrawable)) + return FALSE; + + if (!xglSyncSurface (&pTile->drawable)) + return FALSE; + + XGL_GET_DRAWABLE (pDrawable, surface, xOff, yOff); + + pTilePriv = XGL_GET_PIXMAP_PRIV (pTile); + + pTilePriv->pictureMask |= xglPCFilterMask | xglPCTransformMask; + glitz_surface_set_filter (pTilePriv->surface, + GLITZ_FILTER_NEAREST, + NULL, 0); + glitz_surface_set_transform (pTilePriv->surface, NULL); + + if (pTilePriv->acceleratedTile) + { + if (pGeometry) + { + glitz_surface_set_clip_region (surface, xOff, yOff, + (glitz_box_t *) pBox, nBox); + nBox = 0; + } + else + { + pGeometry = xglGetScratchVertexGeometry (pDrawable->pScreen, + 4 * nBox); + GEOMETRY_ADD_BOX (pDrawable->pScreen, pGeometry, pBox, nBox); + } + + GEOMETRY_TRANSLATE (pGeometry, xOff, yOff); + + if (!GEOMETRY_ENABLE (pGeometry, surface)) + return FALSE; + + pTilePriv->pictureMask |= xglPCFillMask; + glitz_surface_set_fill (pTilePriv->surface, GLITZ_FILL_REPEAT); + + glitz_composite (op, + pTilePriv->surface, NULL, surface, + x + tileX, + y + tileY, + 0, 0, + x + xOff, + y + yOff, + width, height); + + glitz_surface_set_clip_region (surface, 0, 0, NULL, 0); + + if (!glitz_surface_get_status (surface)) + return TRUE; + + if (!nBox) + return FALSE; + } + else + { + if (pGeometry) + return FALSE; + } + + pGeometry = xglTiledBoxGeometry (pTile, tileX, tileY, pBox, nBox); + if (!pGeometry) + return FALSE; + + GEOMETRY_TRANSLATE (pGeometry, xOff, yOff); + + if (!GEOMETRY_ENABLE (pGeometry, surface)) + return FALSE; + + glitz_composite (op, + pTilePriv->surface, NULL, surface, + 0, 0, + 0, 0, + x + xOff, + y + yOff, + width, height); + + if (glitz_surface_get_status (surface)) + return FALSE; + + return TRUE; +} diff --git a/xorg-server/hw/xgl/xgltrap.c b/xorg-server/hw/xgl/xgltrap.c new file mode 100644 index 000000000..6e7a5082c --- /dev/null +++ b/xorg-server/hw/xgl/xgltrap.c @@ -0,0 +1,481 @@ +/* + * Copyright © 2005 Novell, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * Novell, Inc. not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * Novell, Inc. makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#include "xgl.h" +#include "gcstruct.h" +#include "damage.h" + +#ifdef RENDER + +#define XGL_TRAP_FALLBACK_PROLOGUE(pPicture, func) \ + xglSyncDamageBoxBits (pPicture->pDrawable); \ + XGL_PICTURE_SCREEN_UNWRAP (func) + +#define XGL_TRAP_FALLBACK_EPILOGUE(pPicture, func, xglfunc) \ + XGL_PICTURE_SCREEN_WRAP (func, xglfunc); \ + xglAddCurrentSurfaceDamage (pPicture->pDrawable) + +/* just a guess */ +#define SMOOTH_TRAPS_ESTIMATE_RECTS(nTrap) (30 * nTrap) + +#define LINE_FIXED_X(l, _y, v) \ + dx = (l)->p2.x - (l)->p1.x; \ + ex = (xFixed_32_32) ((_y) - (l)->p1.y) * dx; \ + dy = (l)->p2.y - (l)->p1.y; \ + (v) = (l)->p1.x + (xFixed) (ex / dy) + +#define LINE_FIXED_X_CEIL(l, _y, v) \ + dx = (l)->p2.x - (l)->p1.x; \ + ex = (xFixed_32_32) ((_y) - (l)->p1.y) * dx; \ + dy = (l)->p2.y - (l)->p1.y; \ + (v) = (l)->p1.x + (xFixed) ((ex + (dy - 1)) / dy) + +static Bool +xglTrapezoidExtents (PicturePtr pDst, + int ntrap, + xTrapezoid *traps, + BoxPtr extents) +{ + Bool x_overlap, overlap = FALSE; + xFixed dx, dy, top, bottom; + xFixed_32_32 ex; + + if (!ntrap) + { + extents->x1 = MAXSHORT; + extents->x2 = MINSHORT; + extents->y1 = MAXSHORT; + extents->y2 = MINSHORT; + + return FALSE; + } + + extents->y1 = xFixedToInt (traps->top); + extents->y2 = xFixedToInt (xFixedCeil (traps->bottom)); + + LINE_FIXED_X (&traps->left, traps->top, top); + LINE_FIXED_X (&traps->left, traps->bottom, bottom); + extents->x1 = xFixedToInt (MIN (top, bottom)); + + LINE_FIXED_X_CEIL (&traps->right, traps->top, top); + LINE_FIXED_X_CEIL (&traps->right, traps->bottom, bottom); + extents->x2 = xFixedToInt (xFixedCeil (MAX (top, bottom))); + + ntrap--; + traps++; + + for (; ntrap; ntrap--, traps++) + { + INT16 x1, y1, x2, y2; + + if (!xTrapezoidValid (traps)) + continue; + + y1 = xFixedToInt (traps->top); + y2 = xFixedToInt (xFixedCeil (traps->bottom)); + + LINE_FIXED_X (&traps->left, traps->top, top); + LINE_FIXED_X (&traps->left, traps->bottom, bottom); + x1 = xFixedToInt (MIN (top, bottom)); + + LINE_FIXED_X_CEIL (&traps->right, traps->top, top); + LINE_FIXED_X_CEIL (&traps->right, traps->bottom, bottom); + x2 = xFixedToInt (xFixedCeil (MAX (top, bottom))); + + x_overlap = FALSE; + if (x1 >= extents->x2) + extents->x2 = x2; + else if (x2 <= extents->x1) + extents->x1 = x1; + else + { + x_overlap = TRUE; + if (x1 < extents->x1) + extents->x1 = x1; + if (x2 > extents->x2) + extents->x2 = x2; + } + + if (y1 >= extents->y2) + extents->y2 = y2; + else if (y2 <= extents->y1) + extents->y1 = y1; + else + { + if (y1 < extents->y1) + extents->y1 = y1; + if (y2 > extents->y2) + extents->y2 = y2; + + if (x_overlap) + overlap = TRUE; + } + } + + xglPictureClipExtents (pDst, extents); + + return overlap; +} + +void +xglTrapezoids (CARD8 op, + PicturePtr pSrc, + PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, + INT16 ySrc, + int nTrap, + xTrapezoid *traps) +{ + ScreenPtr pScreen = pDst->pDrawable->pScreen; + PicturePtr pMask = NULL, pSrcPicture, pDstPicture; + PicturePtr pMaskPicture = NULL; + xglGeometryPtr pGeometry = NULL; + unsigned int polyEdge = pDst->polyEdge; + INT16 xDst, yDst; + INT16 xOff, yOff; + BoxRec extents; + Bool overlap; + Bool target; + + XGL_SCREEN_PRIV (pScreen); + + xDst = traps[0].left.p1.x >> 16; + yDst = traps[0].left.p1.y >> 16; + + overlap = xglTrapezoidExtents (pDst, nTrap, traps, &extents); + if (extents.y1 >= extents.y2 || extents.x1 >= extents.x2) + return; + + target = xglPrepareTarget (pDst->pDrawable); + + if (nTrap > 1 && op != PictOpAdd && maskFormat && + (!target || overlap || op != PictOpOver)) + { + PixmapPtr pPixmap; + GCPtr pGC; + xRectangle rect; + int error; + int area; + + if (!pScreenPriv->pSolidAlpha) + { + xglCreateSolidAlphaPicture (pScreen); + if (!pScreenPriv->pSolidAlpha) + return; + } + + rect.x = 0; + rect.y = 0; + rect.width = extents.x2 - extents.x1; + rect.height = extents.y2 - extents.y1; + + pPixmap = (*pScreen->CreatePixmap) (pScreen, + rect.width, rect.height, + maskFormat->depth, + CREATE_PIXMAP_USAGE_SCRATCH); + if (!pPixmap) + return; + + pMask = CreatePicture (0, &pPixmap->drawable, maskFormat, + 0, 0, serverClient, &error); + if (!pMask) + { + (*pScreen->DestroyPixmap) (pPixmap); + return; + } + + if (!target) + { + /* make sure we don't do accelerated drawing to mask */ + xglSetPixmapVisual (pPixmap, NULL); + } + + area = rect.width * rect.height; + if ((SMOOTH_TRAPS_ESTIMATE_RECTS (nTrap) * 4) > area) + XGL_GET_PIXMAP_PRIV (pPixmap)->target = xglPixmapTargetNo; + + ValidatePicture (pMask); + pGC = GetScratchGC (pPixmap->drawable.depth, pScreen); + ValidateGC (&pPixmap->drawable, pGC); + (*pGC->ops->PolyFillRect) (&pPixmap->drawable, pGC, 1, &rect); + FreeScratchGC (pGC); + + (*pScreen->DestroyPixmap) (pPixmap); + + target = xglPrepareTarget (pMask->pDrawable); + + xOff = -extents.x1; + yOff = -extents.y1; + pSrcPicture = pScreenPriv->pSolidAlpha; + pDstPicture = pMask; + } + else + { + if (maskFormat) + { + if (maskFormat->depth == 1) + polyEdge = PolyEdgeSharp; + else + polyEdge = PolyEdgeSmooth; + } + + xOff = 0; + yOff = 0; + pSrcPicture = pSrc; + pDstPicture = pDst; + } + + if (target) + { + if (maskFormat || polyEdge == PolyEdgeSmooth) + { + glitz_vertex_format_t *format; + glitz_surface_t *mask; + xTrapezoid *pTrap = traps; + int nAddedTrap, n = nTrap; + int offset = 0; + int size = SMOOTH_TRAPS_ESTIMATE_RECTS (n); + + pMaskPicture = pScreenPriv->trapInfo.pMask; + format = &pScreenPriv->trapInfo.format.vertex; + mask = pMaskPicture->pSourcePict->source.devPrivate.ptr; + + size *= format->bytes_per_vertex; + pGeometry = xglGetScratchGeometryWithSize (pScreen, size); + + while (n) + { + if (pGeometry->size < size) + GEOMETRY_RESIZE (pScreen, pGeometry, size); + + if (!pGeometry->buffer) + { + if (pMask) + FreePicture (pMask, 0); + + return; + } + + offset += + glitz_add_trapezoids (pGeometry->buffer, + offset, size - offset, format->type, + mask, (glitz_trapezoid_t *) pTrap, n, + &nAddedTrap); + + n -= nAddedTrap; + pTrap += nAddedTrap; + size *= 2; + } + + pGeometry->f = pScreenPriv->trapInfo.format; + pGeometry->count = offset / format->bytes_per_vertex; + } + else + { + pGeometry = + xglGetScratchVertexGeometryWithType (pScreen, + GEOMETRY_DATA_TYPE_FLOAT, + 4 * nTrap); + if (!pGeometry->buffer) + { + if (pMask) + FreePicture (pMask, 0); + + return; + } + + GEOMETRY_ADD_TRAPEZOID (pScreen, pGeometry, traps, nTrap); + } + + GEOMETRY_TRANSLATE (pGeometry, + pDstPicture->pDrawable->x + xOff, + pDstPicture->pDrawable->y + yOff); + } + + if (pGeometry && + xglCompositeGeneral (pMask ? PictOpAdd : op, + pSrcPicture, + pMaskPicture, + pDstPicture, + pGeometry, + extents.x1 + xOff + xSrc - xDst, + extents.y1 + yOff + ySrc - yDst, + 0, 0, + pDstPicture->pDrawable->x + extents.x1 + xOff, + pDstPicture->pDrawable->y + extents.y1 + yOff, + extents.x2 - extents.x1, + extents.y2 - extents.y1)) + { + /* no intermediate mask? we need to register damage from here as + CompositePicture will never be called. */ + if (!pMask) + { + RegionRec region; + + REGION_INIT (pScreen, ®ion, &extents, 1); + REGION_TRANSLATE (pScreen, ®ion, + pDst->pDrawable->x, pDst->pDrawable->y); + + DamageDamageRegion (pDst->pDrawable, ®ion); + + REGION_UNINIT (pScreen, ®ion); + } + + xglAddCurrentBitDamage (pDstPicture->pDrawable); + } + else + { + XGL_DRAWABLE_PIXMAP_PRIV (pDstPicture->pDrawable); + + pPixmapPriv->damageBox.x1 = extents.x1 + xOff; + pPixmapPriv->damageBox.y1 = extents.y1 + yOff; + pPixmapPriv->damageBox.x2 = extents.x2 + xOff; + pPixmapPriv->damageBox.y2 = extents.y2 + yOff; + + xglSyncDamageBoxBits (pDstPicture->pDrawable); + + if (pMask || (polyEdge == PolyEdgeSmooth && + op == PictOpAdd && miIsSolidAlpha (pSrc))) + { + PictureScreenPtr ps = GetPictureScreen (pScreen); + + for (; nTrap; nTrap--, traps++) + (*ps->RasterizeTrapezoid) (pDstPicture, traps, xOff, yOff); + + xglAddCurrentSurfaceDamage (pDstPicture->pDrawable); + } + else + miTrapezoids (op, pSrc, pDstPicture, maskFormat, + xSrc, ySrc, nTrap, traps); + } + + if (pMask) + { + CompositePicture (op, pSrc, pMask, pDst, + extents.x1 + xSrc - xDst, + extents.y1 + ySrc - yDst, + 0, 0, + extents.x1, extents.y1, + extents.x2 - extents.x1, + extents.y2 - extents.y1); + + FreePicture (pMask, 0); + } +} + +void +xglAddTraps (PicturePtr pDst, + INT16 xOff, + INT16 yOff, + int nTrap, + xTrap *traps) +{ + PictureScreenPtr pPictureScreen; + ScreenPtr pScreen = pDst->pDrawable->pScreen; + + XGL_SCREEN_PRIV (pScreen); + XGL_DRAWABLE_PIXMAP_PRIV (pDst->pDrawable); + + if (!pScreenPriv->pSolidAlpha) + { + xglCreateSolidAlphaPicture (pScreen); + if (!pScreenPriv->pSolidAlpha) + return; + } + + pPixmapPriv->damageBox.x1 = 0; + pPixmapPriv->damageBox.y1 = 0; + pPixmapPriv->damageBox.x2 = pDst->pDrawable->width; + pPixmapPriv->damageBox.y2 = pDst->pDrawable->height; + + if (xglPrepareTarget (pDst->pDrawable)) + { + PicturePtr pMask; + glitz_vertex_format_t *format; + glitz_surface_t *mask; + xglGeometryPtr pGeometry; + xTrap *pTrap = traps; + int nAddedTrap, n = nTrap; + int offset = 0; + int size = SMOOTH_TRAPS_ESTIMATE_RECTS (n); + + pMask = pScreenPriv->trapInfo.pMask; + format = &pScreenPriv->trapInfo.format.vertex; + mask = pMask->pSourcePict->source.devPrivate.ptr; + + size *= format->bytes_per_vertex; + pGeometry = xglGetScratchGeometryWithSize (pScreen, size); + + while (n) + { + if (pGeometry->size < size) + GEOMETRY_RESIZE (pScreen, pGeometry, size); + + if (!pGeometry->buffer) + return; + + offset += + glitz_add_traps (pGeometry->buffer, + offset, size - offset, format->type, mask, + (glitz_trap_t *) pTrap, n, + &nAddedTrap); + + n -= nAddedTrap; + pTrap += nAddedTrap; + size *= 2; + } + + pGeometry->f = pScreenPriv->trapInfo.format; + pGeometry->count = offset / format->bytes_per_vertex; + + GEOMETRY_TRANSLATE (pGeometry, + pDst->pDrawable->x + xOff, + pDst->pDrawable->y + yOff); + + if (xglCompositeGeneral (PictOpAdd, + pScreenPriv->pSolidAlpha, + pMask, + pDst, + pGeometry, + 0, 0, + 0, 0, + pDst->pDrawable->x, pDst->pDrawable->y, + pDst->pDrawable->width, + pDst->pDrawable->height)) + { + xglAddCurrentBitDamage (pDst->pDrawable); + return; + } + } + + pPictureScreen = GetPictureScreen (pScreen); + + XGL_TRAP_FALLBACK_PROLOGUE (pDst, AddTraps); + (*pPictureScreen->AddTraps) (pDst, xOff, yOff, nTrap, traps); + XGL_TRAP_FALLBACK_EPILOGUE (pDst, AddTraps, xglAddTraps); +} + +#endif diff --git a/xorg-server/hw/xgl/xglwindow.c b/xorg-server/hw/xgl/xglwindow.c new file mode 100644 index 000000000..393f01df1 --- /dev/null +++ b/xorg-server/hw/xgl/xglwindow.c @@ -0,0 +1,166 @@ +/* + * Copyright © 2004 David Reveman + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * David Reveman not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * David Reveman makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: David Reveman <davidr@novell.com> + */ + +#include "xgl.h" +#include "fb.h" + +#define XGL_WINDOW_FALLBACK_PROLOGUE(pWin, func) \ + if (!xglMapPixmapBits (XGL_GET_DRAWABLE_PIXMAP (&pWin->drawable))) \ + FatalError (XGL_SW_FAILURE_STRING); \ + XGL_SCREEN_UNWRAP (func) + +#define XGL_WINDOW_FALLBACK_EPILOGUE(pWin, pRegion, func, xglfunc) \ + XGL_SCREEN_WRAP (func, xglfunc); \ + xglAddSurfaceDamage (&pWin->drawable, pRegion) + +Bool +xglCreateWindow (WindowPtr pWin) +{ + ScreenPtr pScreen = pWin->drawable.pScreen; + Bool ret; + + XGL_SCREEN_PRIV (pScreen); + XGL_WINDOW_PRIV (pWin); + + XGL_SCREEN_UNWRAP (CreateWindow); + ret = (*pScreen->CreateWindow) (pWin); + XGL_SCREEN_WRAP (CreateWindow, xglCreateWindow); + + pWinPriv->pPixmap = pWin->drawable.pScreen->devPrivate; + + return ret; +} + +Bool +xglDestroyWindow (WindowPtr pWin) +{ + ScreenPtr pScreen = pWin->drawable.pScreen; + Bool ret; + + XGL_SCREEN_PRIV (pScreen); + + XGL_SCREEN_UNWRAP (DestroyWindow); + ret = (*pScreen->DestroyWindow) (pWin); + XGL_SCREEN_WRAP (DestroyWindow, xglDestroyWindow); + + return ret; +} + +Bool +xglChangeWindowAttributes (WindowPtr pWin, + unsigned long mask) +{ + ScreenPtr pScreen = pWin->drawable.pScreen; + PixmapPtr pPixmap; + Bool ret; + + XGL_SCREEN_PRIV (pScreen); + + if (mask & CWBackPixmap) + { + if (pWin->backgroundState == BackgroundPixmap) + { + pPixmap = pWin->background.pixmap; + + if (FbEvenTile (pPixmap->drawable.width * + pPixmap->drawable.bitsPerPixel)) + xglSyncBits (&pPixmap->drawable, NULL); + } + } + + if (mask & CWBorderPixmap) + { + if (pWin->borderIsPixel == FALSE) + { + pPixmap = pWin->border.pixmap; + + if (FbEvenTile (pPixmap->drawable.width * + pPixmap->drawable.bitsPerPixel)) + xglSyncBits (&pPixmap->drawable, NULL); + } + } + + XGL_SCREEN_UNWRAP (ChangeWindowAttributes); + ret = (*pScreen->ChangeWindowAttributes) (pWin, mask); + XGL_SCREEN_WRAP (ChangeWindowAttributes, xglChangeWindowAttributes); + + return ret; +} + +void +xglCopyWindow (WindowPtr pWin, + DDXPointRec ptOldOrg, + RegionPtr prgnSrc) +{ + PixmapPtr pPixmap; + RegionRec rgnDst; + int dx, dy; + BoxPtr pExtent = REGION_EXTENTS (pWin->drawable.pScreen, prgnSrc); + BoxRec box; + + pPixmap = XGL_GET_WINDOW_PIXMAP (pWin); + + box.x1 = pExtent->x1; + box.y1 = pExtent->y1; + box.x2 = pExtent->x2; + box.y2 = pExtent->y2; + + dx = ptOldOrg.x - pWin->drawable.x; + dy = ptOldOrg.y - pWin->drawable.y; + + REGION_TRANSLATE (pWin->drawable.pScreen, prgnSrc, -dx, -dy); + REGION_INIT (pWin->drawable.pScreen, &rgnDst, NullBox, 0); + REGION_INTERSECT (pWin->drawable.pScreen, + &rgnDst, &pWin->borderClip, prgnSrc); + + fbCopyRegion (&pWin->drawable, &pWin->drawable, + 0, &rgnDst, dx, dy, xglCopyProc, 0, (void *) &box); + + REGION_UNINIT (pWin->drawable.pScreen, &rgnDst); +} + +PixmapPtr +xglGetWindowPixmap (WindowPtr pWin) +{ + return XGL_GET_WINDOW_PIXMAP (pWin); +} + +void +xglSetWindowPixmap (WindowPtr pWin, + PixmapPtr pPixmap) +{ + ScreenPtr pScreen = pWin->drawable.pScreen; + + XGL_SCREEN_PRIV (pScreen); + + XGL_SCREEN_UNWRAP (SetWindowPixmap); + (*pScreen->SetWindowPixmap) (pWin, pPixmap); + XGL_SCREEN_WRAP (SetWindowPixmap, xglSetWindowPixmap); + + XGL_GET_WINDOW_PRIV (pWin)->pPixmap = pPixmap; + + if (pPixmap != pScreenPriv->pScreenPixmap) + xglEnablePixmapAccel (pPixmap, &pScreenPriv->accel.window); +} diff --git a/xorg-server/hw/xgl/xglxv.c b/xorg-server/hw/xgl/xglxv.c new file mode 100644 index 000000000..353f9b3bb --- /dev/null +++ b/xorg-server/hw/xgl/xglxv.c @@ -0,0 +1,634 @@ +/* + * Copyright © 2005 Novell, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * Novell, Inc. not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * Novell, Inc. makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Authors: David Reveman <davidr@novell.com> + * Matthias Hopf <mhopf@suse.de> + */ + +#include "xgl.h" + +#ifdef XV + +#include "xvdix.h" +#include "gcstruct.h" +#include "dixstruct.h" + +#include <X11/extensions/Xv.h> +#include <X11/extensions/Xvproto.h> + +static DevPrivateKey xglXvScreenKey; +static unsigned long portResource = 0; + +#define XGL_GET_XV_SCREEN(pScreen) ((XvScreenPtr) \ + dixLookupPrivate(&(pScreen)->devPrivates, xglXvScreenKey)) + +#define XGL_XV_SCREEN(pScreen) \ + XvScreenPtr pXvScreen = XGL_GET_XV_SCREEN (pScreen) + +#define XGL_GET_XV_SCREEN_PRIV(pScreen) \ + ((xglXvScreenPtr) (GET_XV_SCREEN (pScreen)->devPriv.ptr)) + +#define XGL_XV_SCREEN_PRIV(pScreen) \ + xglXvScreenPtr pXvScreenPriv = XGL_GET_XV_SCREEN_PRIV (pScreen) + +#define XGL_GET_XV_PORT_PRIV(pPort) \ + ((xglXvPortPtr) ((pPort)->devPriv.ptr)) + +#define XGL_XV_PORT_PRIV(pPort) \ + xglXvPortPtr pPortPriv = XGL_GET_XV_PORT_PRIV (pPort) + +#define XGL_XV_NUM_PORTS 32 + +#define XGL_XV_IMAGE_MAX_WIDTH 2048 +#define XGL_XV_IMAGE_MAX_HEIGHT 2048 + +static XvImageRec xvImages[] = { + { + GLITZ_FOURCC_YUY2, XvYUV, BITMAP_BIT_ORDER, + { + 'Y','U','Y','2', + 0x00, 0x00, 0x00, 0x10, 0x80, 0x00, + 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71 + }, + 16, XvPacked, 1, + 0, 0, 0, 0, + 8, 8, 8, 1, 2, 2, 1, 1, 1, + { + 'Y', 'U', 'Y', 'V', + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }, + XvTopToBottom + }, { + GLITZ_FOURCC_YV12, XvYUV, BITMAP_BIT_ORDER, + { + 'Y', 'V', '1', '2', + 0x00, 0x00, 0x00, 0x10, 0x80, 0x00, + 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71 + }, + 12, XvPlanar, 3, + 0, 0, 0, 0, + 8, 8, 8, 1, 2, 2, 1, 2, 2, + { + 'Y', 'V', 'U', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }, + XvTopToBottom + }, { + GLITZ_FOURCC_RGB, XvRGB, BITMAP_BIT_ORDER, + { + 0x03, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x10, 0x80, 0x00, + 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71 + }, + 32, XvPacked, 1, + 24, 0xff0000, 0xff00, 0xff, + 0, 0, 0, 0, 0, 0, 0, 0, 0, + { + 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }, + XvTopToBottom + } +}; + +static struct _xglXvFormat { + CARD32 format; + glitz_fourcc_t fourcc; + xglPixelFormatRec pixel; +} xglXvFormat[XGL_XV_FORMAT_NUM] = { + { + PICT_yuy2, + GLITZ_FOURCC_YUY2, + { + 16, 6, + { + 16, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + } + } + }, { + PICT_yv12, + GLITZ_FOURCC_YV12, + { + 12, 4, + { + 12, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + } + } + }, { + PICT_x8r8g8b8, + GLITZ_FOURCC_RGB, + { + 24, 8, + { + 32, + 0x00000000, + 0x00ff0000, + 0x0000ff00, + 0x000000ff, + } + } + } +}; + +static int +xglXvQueryAdaptors (ScreenPtr pScreen, + XvAdaptorPtr *pAdaptors, + int *nAdaptors) +{ + XGL_XV_SCREEN (pScreen); + + *nAdaptors = pXvScreen->nAdaptors; + *pAdaptors = pXvScreen->pAdaptors; + + return Success; +} + +static int +xglXvAllocatePort (unsigned long port, + XvPortPtr pPort, + XvPortPtr *ppPort) +{ + *ppPort = pPort; + + return Success; +} + +static int +xglXvFreePort (XvPortPtr pPort) +{ + XGL_XV_PORT_PRIV (pPort); + + if (pPortPriv->pDst) + { + FreePicture ((pointer) pPortPriv->pDst, 0); + pPortPriv->pDst = (PicturePtr) 0; + } + + if (pPortPriv->pSrc) + { + FreePicture ((pointer) pPortPriv->pSrc, 0); + pPortPriv->pSrc = (PicturePtr) 0; + } + + if (pPortPriv->pPixmap) + { + ScreenPtr pScreen; + + pScreen = pPortPriv->pPixmap->drawable.pScreen; + (*pScreen->DestroyPixmap) (pPortPriv->pPixmap); + pPortPriv->pPixmap = (PixmapPtr) 0; + } + + return Success; +} + +static int +xglXvQueryBestSize (ClientPtr client, + XvPortPtr pPort, + CARD8 motion, + CARD16 srcWidth, + CARD16 srcHeight, + CARD16 dstWidth, + CARD16 dstHeight, + unsigned int *pWidth, + unsigned int *pHeight) +{ + *pWidth = dstWidth; + *pHeight = dstHeight; + + return Success; +} + +static int +xglXvStopVideo (ClientPtr client, + XvPortPtr pPort, + DrawablePtr pDrawable) +{ + xglXvFreePort (pPort); + + return Success; +} + +static int +xglXvPutImage (ClientPtr client, + DrawablePtr pDrawable, + XvPortPtr pPort, + GCPtr pGC, + INT16 srcX, + INT16 srcY, + CARD16 srcWidth, + CARD16 srcHeight, + INT16 dstX, + INT16 dstY, + CARD16 dstWidth, + CARD16 dstHeight, + XvImagePtr pImage, + unsigned char *data, + Bool sync, + CARD16 width, + CARD16 height) +{ + ScreenPtr pScreen = pDrawable->pScreen; + PictTransform transform; + int depth, bpp; + CARD32 format; + + XGL_SCREEN_PRIV (pScreen); + XGL_XV_PORT_PRIV (pPort); + XGL_DRAWABLE_PIXMAP (pDrawable); + XGL_PIXMAP_PRIV (pPixmap); + + switch (pImage->id) { + case GLITZ_FOURCC_YUY2: + bpp = depth = 16; + format = PICT_yuy2; + break; + case GLITZ_FOURCC_YV12: + depth = bpp = 12; + format = PICT_yv12; + break; + case GLITZ_FOURCC_RGB: + depth = 24; + bpp = 32; + format = PICT_x8r8g8b8; + break; + default: + return BadImplementation; + } + + pPort->pDraw = pDrawable; + + if (!pPortPriv->pPixmap) + { + pPortPriv->pPixmap = (*pScreen->CreatePixmap) (pScreen, 0, 0, depth, 0); + if (!pPortPriv->pPixmap) + return BadAlloc; + } + + (*pScreen->ModifyPixmapHeader) (pPortPriv->pPixmap, + srcWidth, srcHeight, + depth, bpp, -1, (pointer) data); + + XGL_GET_PIXMAP_PRIV (pPortPriv->pPixmap)->stride = -srcWidth; + + pPortPriv->pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER; + + if (!pPortPriv->pSrc || pPortPriv->pSrc->format != format) + { + PictFormatPtr pFormat; + int error; + static XID value = RepeatPad; + + pFormat = PictureMatchFormat (pScreen, depth, format); + if (!pFormat) + return BadImplementation; + + if (pPortPriv->pSrc) + FreePicture ((pointer) pPortPriv->pSrc, 0); + + pPortPriv->pSrc = CreatePicture (0, &pPortPriv->pPixmap->drawable, + pFormat, CPRepeat, &value, + serverClient, &error); + if (!pPortPriv->pSrc) + { + xglXvFreePort (pPort); + return error; + } + + SetPictureFilter (pPortPriv->pSrc, + FilterBilinear, strlen (FilterBilinear), + 0, 0); + } + + if (!pPortPriv->pDst || pPortPriv->pDst->pDrawable != pDrawable) + { + PictFormatPtr pFormat = 0; + int i, error; + + for (i = 0; i < pScreen->numVisuals; i++) + { + if (pScreen->visuals[i].nplanes == pDrawable->depth) + { + pFormat = PictureMatchVisual (pScreen, pDrawable->depth, + &pScreen->visuals[i]); + break; + } + } + + if (!pFormat) + return BadImplementation; + + if (pPortPriv->pDst) + FreePicture ((pointer) pPortPriv->pDst, 0); + + pPortPriv->pDst = CreatePicture (0, pDrawable, + pFormat, 0, 0, serverClient, + &error); + if (!pPortPriv->pDst) + { + xglXvFreePort (pPort); + return error; + } + } + + transform.matrix[0][0] = ((srcWidth << 16) + (dstWidth >> 1)) + / dstWidth; + transform.matrix[0][1] = 0; + transform.matrix[0][2] = 0; + + /* flip Y */ + transform.matrix[1][0] = 0; + transform.matrix[1][1] = -((srcHeight << 16) + (dstHeight >> 1)) + / dstHeight; + transform.matrix[1][2] = (srcHeight << 16); + + transform.matrix[2][0] = 0; + transform.matrix[2][1] = 0; + transform.matrix[2][2] = 1 << 16; + + SetPictureTransform (pPortPriv->pSrc, &transform); + + if (pPixmap != pScreenPriv->pScreenPixmap && !pPixmapPriv->target) + xglEnablePixmapAccel (pPixmap, &pScreenPriv->accel.xv); + + CompositePicture (PictOpSrc, + pPortPriv->pSrc, + (PicturePtr) 0, + pPortPriv->pDst, + srcX, srcY, + 0, 0, + dstX, dstY, + dstWidth, dstHeight); + + return Success; +} + +static int +xglXvQueryImageAttributes (ClientPtr client, + XvPortPtr pPort, + XvImagePtr pImage, + CARD16 *width, + CARD16 *height, + int *pitches, + int *offsets) +{ + if (*width > XGL_XV_IMAGE_MAX_WIDTH) + *width = XGL_XV_IMAGE_MAX_WIDTH; + + if (*height > XGL_XV_IMAGE_MAX_HEIGHT) + *height = XGL_XV_IMAGE_MAX_HEIGHT; + + *width = (*width + 7) & ~7; + + switch (pImage->id) { + case GLITZ_FOURCC_YUY2: + if (offsets) + offsets[0] = 0; + + if (pitches) + pitches[0] = *width * 2; + + return *width * *height * 2; + case GLITZ_FOURCC_YV12: + *height = (*height + 1) & ~1; + + if (offsets) + { + offsets[0] = 0; + offsets[1] = *width * *height; + offsets[2] = *width * *height + (*width >> 1) * (*height >> 1); + } + + if (pitches) + { + pitches[0] = *width; + pitches[1] = pitches[2] = *width >> 1; + } + + return *width * *height + (*width >> 1) * *height; + case GLITZ_FOURCC_RGB: + if (offsets) + offsets[0] = 0; + + if (pitches) + pitches[0] = *width * 4; + + return *width * *height * 4; + default: + return 0; + } +} + +static void +xglXvFreeAdaptor (XvAdaptorPtr pAdaptor) +{ + xfree (pAdaptor->pEncodings); + xfree (pAdaptor->pFormats); + + if (pAdaptor->pPorts) + xfree (pAdaptor->pPorts); +} + +static Bool +xglXvInitAdaptors (ScreenPtr pScreen) +{ + XvAdaptorPtr pAdaptor; + xglXvPortPtr pPortPriv; + XvPortPtr pPort; + XvFormatPtr pFormat; + XvEncodingPtr pEncoding; + int i; + + XGL_XV_SCREEN (pScreen); + + pXvScreen->nAdaptors = 0; + pXvScreen->pAdaptors = NULL; + + pAdaptor = xcalloc (1, sizeof (XvAdaptorRec)); + if (!pAdaptor) + return FALSE; + + pAdaptor->type = XvInputMask | XvImageMask; + pAdaptor->pScreen = pScreen; + + pAdaptor->ddAllocatePort = xglXvAllocatePort; + pAdaptor->ddFreePort = xglXvFreePort; + pAdaptor->ddStopVideo = xglXvStopVideo; + pAdaptor->ddPutImage = xglXvPutImage; + pAdaptor->ddQueryBestSize = xglXvQueryBestSize; + pAdaptor->ddQueryImageAttributes = xglXvQueryImageAttributes; + + pAdaptor->name = "Xgl Generic Texture Video"; + + pEncoding = xcalloc (1, sizeof (XvEncodingRec)); + if (!pEncoding) + return FALSE; + + pEncoding->id = 0; + pEncoding->pScreen = pScreen; + pEncoding->name = "XV_IMAGE"; + + pEncoding->width = XGL_XV_IMAGE_MAX_WIDTH; + pEncoding->height = XGL_XV_IMAGE_MAX_HEIGHT; + + pEncoding->rate.numerator = 1; + pEncoding->rate.denominator = 1; + + pAdaptor->nEncodings = 1; + pAdaptor->pEncodings = pEncoding; + + pAdaptor->nImages = sizeof (xvImages) / sizeof (XvImageRec); + pAdaptor->pImages = xvImages; + + /* TODO: Currently no attributes */ + pAdaptor->nAttributes = 0; + pAdaptor->pAttributes = 0; + + pFormat = xcalloc (pScreen->numVisuals, sizeof (XvFormatRec)); + if (!pFormat) + return FALSE; + + for (i = 0; i < pScreen->numVisuals; i++) + { + pFormat[i].depth = pScreen->visuals[i].nplanes; + pFormat[i].visual = pScreen->visuals[i].vid; + } + + /* All visuals allowed */ + pAdaptor->nFormats = pScreen->numVisuals; + pAdaptor->pFormats = pFormat; + + pPort = xcalloc (XGL_XV_NUM_PORTS, + sizeof (XvPortRec) + sizeof (xglXvPortRec)); + pPortPriv = (xglXvPortPtr) (pPort + XGL_XV_NUM_PORTS); + if (!pPort) + return FALSE; + + for (i = 0; i < XGL_XV_NUM_PORTS; i++) + { + pPort[i].id = FakeClientID (0); + if (!pPort[i].id) + return FALSE; + + if (!AddResource (pPort[i].id, portResource, &pPort[i])) + return FALSE; + + pPort[i].pAdaptor = pAdaptor; + pPort[i].pNotify = (XvPortNotifyPtr) 0; + pPort[i].pDraw = (DrawablePtr) 0; + pPort[i].client = (ClientPtr) 0; + pPort[i].grab.client = (ClientPtr) 0; + pPort[i].time = currentTime; + pPort[i].devPriv.ptr = pPortPriv + i; + } + + pAdaptor->nPorts = XGL_XV_NUM_PORTS; + pAdaptor->pPorts = pPort; + pAdaptor->base_id = pPort->id; + + pXvScreen->pAdaptors = pAdaptor; + pXvScreen->nAdaptors = 1; + + return TRUE; +} + +static Bool +xglXvCloseScreen (int i, ScreenPtr pScreen) +{ + int j; + + XGL_XV_SCREEN (pScreen); + + for (j = 0; j < pXvScreen->nAdaptors; j++) + xglXvFreeAdaptor (&pXvScreen->pAdaptors[j]); + + if (pXvScreen->pAdaptors) + xfree (pXvScreen->pAdaptors); + + return TRUE; +} + +Bool +xglXvScreenInit (ScreenPtr pScreen) +{ + XvScreenPtr pXvScreen; + xglVisualPtr v; + int i, status, vid = 0; + + XGL_SCREEN_PRIV (pScreen); + + status = XvScreenInit (pScreen); + if (status != Success) + return FALSE; + + xglXvScreenKey = XvGetScreenKey (); + portResource = XvGetRTPort (); + + pXvScreen = XGL_GET_XV_SCREEN (pScreen); + + /* Anyone initializing the Xv layer must provide these two. + The Xv di layer calls them without even checking if they exist! */ + pXvScreen->ddCloseScreen = xglXvCloseScreen; + pXvScreen->ddQueryAdaptors = xglXvQueryAdaptors; + + pXvScreen->devPriv.ptr = (pointer) 0; + + if (!xglXvInitAdaptors (pScreen)) + return FALSE; + + for (v = pScreenPriv->pVisual; v; v = v->next) + { + if (v->vid > vid) + vid = v->vid; + } + + memset (pScreenPriv->pXvVisual, 0, sizeof (pScreenPriv->pXvVisual)); + + for (i = 0; i < XGL_XV_FORMAT_NUM; i++) + { + glitz_format_t templ; + + templ.color.fourcc = xglXvFormat[i].fourcc; + + pScreenPriv->pXvVisual[i].vid = ++vid; + pScreenPriv->pXvVisual[i].pPixel = &xglXvFormat[i].pixel; + pScreenPriv->pXvVisual[i].format.surface = + glitz_find_format (pScreenPriv->drawable, + GLITZ_FORMAT_FOURCC_MASK, + &templ, 0); + } + + return TRUE; +} + +#endif |