diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2010-07-27 19:02:39 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2010-07-27 19:02:39 +0000 |
commit | 269d40cbcc43b41f621ca6d91c182952f60ec48e (patch) | |
tree | 872f2fddd3f2207e57a28595e73886713ce4a77a /xserver/glx | |
parent | 917a2249b787451cad3f9697872aeccfd0da3324 (diff) |
Update to xserver 1.8. Tested by many. Ok oga@, todd@.
Diffstat (limited to 'xserver/glx')
42 files changed, 606 insertions, 478 deletions
diff --git a/xserver/glx/Makefile.am b/xserver/glx/Makefile.am index 6facc2011..9d9fa3c31 100644 --- a/xserver/glx/Makefile.am +++ b/xserver/glx/Makefile.am @@ -7,6 +7,7 @@ noinst_LTLIBRARIES = libglx.la $(GLXDRI_LIBRARY) AM_CFLAGS = \ @DIX_CFLAGS@ \ @GL_CFLAGS@ \ + @DRI_CFLAGS@ \ @XLIB_CFLAGS@ \ @LIBDRM_CFLAGS@ \ @DRIPROTO_CFLAGS@ \ @@ -57,6 +58,8 @@ if DRI2_AIGLX libglxdri_la_SOURCES += glxdri2.c endif +libglxdri_la_LIBADD = $(DLOPEN_LIBS) + libglx_la_SOURCES = \ $(indirect_sources) \ $(glapi_sources) \ @@ -94,3 +97,5 @@ libglx_la_SOURCES = \ swap_interval.c \ unpack.h \ xfont.c + +libglx_la_LIBADD = $(DLOPEN_LIBS) diff --git a/xserver/glx/Makefile.in b/xserver/glx/Makefile.in index 3b3dcfcfd..dc5e91cf5 100644 --- a/xserver/glx/Makefile.in +++ b/xserver/glx/Makefile.in @@ -41,8 +41,8 @@ host_triplet = @host@ subdir = 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__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ + $(top_srcdir)/m4/dolt.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(install_sh) -d @@ -52,10 +52,12 @@ CONFIG_HEADER = $(top_builddir)/include/do-not-use-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 + $(top_builddir)/include/kdrive-config.h \ + $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) -libglx_la_LIBADD = +am__DEPENDENCIES_1 = +libglx_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am__objects_1 = indirect_dispatch.lo indirect_dispatch_swap.lo \ indirect_reqsize.lo indirect_size_get.lo indirect_table.lo \ glapi.lo glthread.lo @@ -67,7 +69,7 @@ am_libglx_la_OBJECTS = $(am__objects_1) indirect_util.lo \ singlepix.lo singlepixswap.lo singlesize.lo swap_interval.lo \ xfont.lo libglx_la_OBJECTS = $(am_libglx_la_OBJECTS) -libglxdri_la_LIBADD = +libglxdri_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am__libglxdri_la_SOURCES_DIST = glxdri.c extension_string.c \ extension_string.h glxdri2.c @DRI2_AIGLX_TRUE@am__objects_2 = glxdri2.lo @@ -75,7 +77,7 @@ am_libglxdri_la_OBJECTS = glxdri.lo extension_string.lo \ $(am__objects_2) libglxdri_la_OBJECTS = $(am_libglxdri_la_OBJECTS) @AIGLX_TRUE@am_libglxdri_la_rpath = -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_builddir)/include -I$(top_builddir)/include -I$(top_builddir)/include -I$(top_builddir)/include -I$(top_builddir)/include -I$(top_builddir)/include +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_builddir)/include -I$(top_builddir)/include -I$(top_builddir)/include -I$(top_builddir)/include -I$(top_builddir)/include -I$(top_builddir)/include -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ @@ -101,12 +103,13 @@ ALPHA_VIDEO_TRUE = @ALPHA_VIDEO_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ -APPLE_APPLICATION_ID = @APPLE_APPLICATION_ID@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ +ARM_BACKTRACE_CFLAGS = @ARM_BACKTRACE_CFLAGS@ ARM_VIDEO_FALSE = @ARM_VIDEO_FALSE@ ARM_VIDEO_TRUE = @ARM_VIDEO_TRUE@ AS = @AS@ @@ -134,6 +137,7 @@ CCAS = @CCAS@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ COMPOSITE_FALSE = @COMPOSITE_FALSE@ COMPOSITE_TRUE = @COMPOSITE_TRUE@ @@ -143,8 +147,11 @@ CONFIG_HAL_FALSE = @CONFIG_HAL_FALSE@ CONFIG_HAL_TRUE = @CONFIG_HAL_TRUE@ CONFIG_NEED_DBUS_FALSE = @CONFIG_NEED_DBUS_FALSE@ CONFIG_NEED_DBUS_TRUE = @CONFIG_NEED_DBUS_TRUE@ +CONFIG_UDEV_FALSE = @CONFIG_UDEV_FALSE@ +CONFIG_UDEV_TRUE = @CONFIG_UDEV_TRUE@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CWARNFLAGS = @CWARNFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ @@ -158,6 +165,7 @@ DBUS_LIBS = @DBUS_LIBS@ DEBUG_FALSE = @DEBUG_FALSE@ DEBUG_TRUE = @DEBUG_TRUE@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ +DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFS = @DEFS@ @@ -167,7 +175,9 @@ DGA_FALSE = @DGA_FALSE@ DGA_LIBS = @DGA_LIBS@ DGA_TRUE = @DGA_TRUE@ DIX_CFLAGS = @DIX_CFLAGS@ +DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ +DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ @@ -183,6 +193,7 @@ DMX_BUILD_USB_TRUE = @DMX_BUILD_USB_TRUE@ DMX_FALSE = @DMX_FALSE@ DMX_TRUE = @DMX_TRUE@ DOLT_BASH = @DOLT_BASH@ +DOXYGEN = @DOXYGEN@ DPMSExtension_FALSE = @DPMSExtension_FALSE@ DPMSExtension_TRUE = @DPMSExtension_TRUE@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ @@ -195,8 +206,10 @@ DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ DRIPROTO_LIBS = @DRIPROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ +DRI_CFLAGS = @DRI_CFLAGS@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DRI_FALSE = @DRI_FALSE@ +DRI_LIBS = @DRI_LIBS@ DRI_TRUE = @DRI_TRUE@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ @@ -212,8 +225,17 @@ FBDEVHW_TRUE = @FBDEVHW_TRUE@ FFLAGS = @FFLAGS@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ +FONT100DPIDIR = @FONT100DPIDIR@ +FONT75DPIDIR = @FONT75DPIDIR@ +FONTMISCDIR = @FONTMISCDIR@ +FONTOTFDIR = @FONTOTFDIR@ +FONTROOTDIR = @FONTROOTDIR@ +FONTTTFDIR = @FONTTTFDIR@ +FONTTYPE1DIR = @FONTTYPE1DIR@ FREEBSD_KLDLOAD_FALSE = @FREEBSD_KLDLOAD_FALSE@ FREEBSD_KLDLOAD_TRUE = @FREEBSD_KLDLOAD_TRUE@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_FALSE = @GLX_FALSE@ @@ -223,18 +245,17 @@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ -HAVE_AGL_FRAMEWORK_FALSE = @HAVE_AGL_FRAMEWORK_FALSE@ -HAVE_AGL_FRAMEWORK_TRUE = @HAVE_AGL_FRAMEWORK_TRUE@ HAVE_DBUS_FALSE = @HAVE_DBUS_FALSE@ HAVE_DBUS_TRUE = @HAVE_DBUS_TRUE@ -HAVE_XPLUGIN_FALSE = @HAVE_XPLUGIN_FALSE@ -HAVE_XPLUGIN_TRUE = @HAVE_XPLUGIN_TRUE@ +HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ +HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ HP300_VIDEO_FALSE = @HP300_VIDEO_FALSE@ HP300_VIDEO_TRUE = @HP300_VIDEO_TRUE@ HPPA_VIDEO_FALSE = @HPPA_VIDEO_FALSE@ HPPA_VIDEO_TRUE = @HPPA_VIDEO_TRUE@ I386_VIDEO_FALSE = @I386_VIDEO_FALSE@ I386_VIDEO_TRUE = @I386_VIDEO_TRUE@ +INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_LIBXF86CONFIG_FALSE = @INSTALL_LIBXF86CONFIG_FALSE@ INSTALL_LIBXF86CONFIG_TRUE = @INSTALL_LIBXF86CONFIG_TRUE@ @@ -243,6 +264,8 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_SETUID_FALSE = @INSTALL_SETUID_FALSE@ INSTALL_SETUID_TRUE = @INSTALL_SETUID_TRUE@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INT10MODULE_FALSE = @INT10MODULE_FALSE@ +INT10MODULE_TRUE = @INT10MODULE_TRUE@ INT10_STUB_FALSE = @INT10_STUB_FALSE@ INT10_STUB_TRUE = @INT10_STUB_TRUE@ INT10_VM86_FALSE = @INT10_VM86_FALSE@ @@ -255,20 +278,23 @@ KDRIVELINUX_FALSE = @KDRIVELINUX_FALSE@ KDRIVELINUX_TRUE = @KDRIVELINUX_TRUE@ KDRIVEOPENBSD_FALSE = @KDRIVEOPENBSD_FALSE@ KDRIVEOPENBSD_TRUE = @KDRIVEOPENBSD_TRUE@ -KDRIVEVESA_FALSE = @KDRIVEVESA_FALSE@ -KDRIVEVESA_TRUE = @KDRIVEVESA_TRUE@ KDRIVEWSCONS_FALSE = @KDRIVEWSCONS_FALSE@ KDRIVEWSCONS_TRUE = @KDRIVEWSCONS_TRUE@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ +KDRIVE_EVDEV_FALSE = @KDRIVE_EVDEV_FALSE@ +KDRIVE_EVDEV_TRUE = @KDRIVE_EVDEV_TRUE@ KDRIVE_FALSE = @KDRIVE_FALSE@ -KDRIVE_HW_FALSE = @KDRIVE_HW_FALSE@ -KDRIVE_HW_TRUE = @KDRIVE_HW_TRUE@ KDRIVE_INCS = @KDRIVE_INCS@ +KDRIVE_KBD_FALSE = @KDRIVE_KBD_FALSE@ +KDRIVE_KBD_TRUE = @KDRIVE_KBD_TRUE@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ +KDRIVE_MOUSE_FALSE = @KDRIVE_MOUSE_FALSE@ +KDRIVE_MOUSE_TRUE = @KDRIVE_MOUSE_TRUE@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KDRIVE_TRUE = @KDRIVE_TRUE@ +LAUNCHD_ID_PREFIX = @LAUNCHD_ID_PREFIX@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LEX = @LEX@ @@ -297,12 +323,12 @@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAIN_LIB = @MAIN_LIB@ 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@ MITSHM_FALSE = @MITSHM_FALSE@ @@ -321,6 +347,9 @@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ +OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ +OPENSSL_LIBS = @OPENSSL_LIBS@ +OS_LIB = @OS_LIB@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -349,34 +378,51 @@ SCREENSAVER_TRUE = @SCREENSAVER_TRUE@ SECURE_RPC_FALSE = @SECURE_RPC_FALSE@ SECURE_RPC_TRUE = @SECURE_RPC_TRUE@ SED = @SED@ +SELINUX_CFLAGS = @SELINUX_CFLAGS@ +SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SGI_VIDEO_FALSE = @SGI_VIDEO_FALSE@ SGI_VIDEO_TRUE = @SGI_VIDEO_TRUE@ +SHA1_CFLAGS = @SHA1_CFLAGS@ +SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@ SOLARIS_ASM_INLINE_FALSE = @SOLARIS_ASM_INLINE_FALSE@ SOLARIS_ASM_INLINE_TRUE = @SOLARIS_ASM_INLINE_TRUE@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ -SOLARIS_USL_CONSOLE_FALSE = @SOLARIS_USL_CONSOLE_FALSE@ -SOLARIS_USL_CONSOLE_TRUE = @SOLARIS_USL_CONSOLE_TRUE@ +SOLARIS_VT_FALSE = @SOLARIS_VT_FALSE@ +SOLARIS_VT_TRUE = @SOLARIS_VT_TRUE@ SPARC64_VIDEO_FALSE = @SPARC64_VIDEO_FALSE@ SPARC64_VIDEO_TRUE = @SPARC64_VIDEO_TRUE@ +SPECIAL_DTRACE_OBJECTS_FALSE = @SPECIAL_DTRACE_OBJECTS_FALSE@ +SPECIAL_DTRACE_OBJECTS_TRUE = @SPECIAL_DTRACE_OBJECTS_TRUE@ STANDALONE_XPBPROXY_FALSE = @STANDALONE_XPBPROXY_FALSE@ STANDALONE_XPBPROXY_TRUE = @STANDALONE_XPBPROXY_TRUE@ STRIP = @STRIP@ +SYSCONFDIR = @SYSCONFDIR@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_FALSE = @TSLIB_FALSE@ TSLIB_LIBS = @TSLIB_LIBS@ TSLIB_TRUE = @TSLIB_TRUE@ +UDEV_CFLAGS = @UDEV_CFLAGS@ +UDEV_LIBS = @UDEV_LIBS@ +UNITTESTS_FALSE = @UNITTESTS_FALSE@ +UNITTESTS_TRUE = @UNITTESTS_TRUE@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ -VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@ -VENDOR_NAME = @VENDOR_NAME@ +VBE_FALSE = @VBE_FALSE@ +VBE_TRUE = @VBE_TRUE@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ -VENDOR_RELEASE = @VENDOR_RELEASE@ VERSION = @VERSION@ +VGAHW_FALSE = @VGAHW_FALSE@ +VGAHW_TRUE = @VGAHW_TRUE@ +WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ +WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ +WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ +XAA_FALSE = @XAA_FALSE@ +XAA_TRUE = @XAA_TRUE@ XACE_FALSE = @XACE_FALSE@ XACE_TRUE = @XACE_TRUE@ XCALIBRATE_FALSE = @XCALIBRATE_FALSE@ @@ -401,6 +447,7 @@ XEPHYR_LIBS = @XEPHYR_LIBS@ XEPHYR_TRUE = @XEPHYR_TRUE@ XF86BIGFONT_FALSE = @XF86BIGFONT_FALSE@ XF86BIGFONT_TRUE = @XF86BIGFONT_TRUE@ +XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XF86UTILS_FALSE = @XF86UTILS_FALSE@ XF86UTILS_TRUE = @XF86UTILS_TRUE@ @@ -443,15 +490,14 @@ XORG_TRUE = @XORG_TRUE@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_FALSE = @XQUARTZ_FALSE@ +XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ +XQUARTZ_SPARKLE_FALSE = @XQUARTZ_SPARKLE_FALSE@ +XQUARTZ_SPARKLE_TRUE = @XQUARTZ_SPARKLE_TRUE@ XQUARTZ_TRUE = @XQUARTZ_TRUE@ XREGISTRY_FALSE = @XREGISTRY_FALSE@ XREGISTRY_TRUE = @XREGISTRY_TRUE@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ -XSDLSERVER_FALSE = @XSDLSERVER_FALSE@ -XSDLSERVER_TRUE = @XSDLSERVER_TRUE@ -XSDL_INCS = @XSDL_INCS@ -XSDL_LIBS = @XSDL_LIBS@ XSELINUX_FALSE = @XSELINUX_FALSE@ XSELINUX_TRUE = @XSELINUX_TRUE@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ @@ -499,10 +545,10 @@ X_PRIVSEP_FALSE = @X_PRIVSEP_FALSE@ X_PRIVSEP_TRUE = @X_PRIVSEP_TRUE@ YACC = @YACC@ YFLAGS = @YFLAGS@ +__XCONFIGDIR__ = @__XCONFIGDIR__@ __XCONFIGFILE__ = @__XCONFIGFILE__@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ -abi_font = @abi_font@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ ac_ct_CC = @ac_ct_CC@ @@ -557,13 +603,16 @@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ +symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ +sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ @AIGLX_TRUE@GLXDRI_LIBRARY = libglxdri.la noinst_LTLIBRARIES = libglx.la $(GLXDRI_LIBRARY) AM_CFLAGS = \ @DIX_CFLAGS@ \ @GL_CFLAGS@ \ + @DRI_CFLAGS@ \ @XLIB_CFLAGS@ \ @LIBDRM_CFLAGS@ \ @DRIPROTO_CFLAGS@ \ @@ -601,6 +650,7 @@ glapi_sources = \ libglxdri_la_SOURCES = glxdri.c extension_string.c extension_string.h \ $(am__append_2) +libglxdri_la_LIBADD = $(DLOPEN_LIBS) libglx_la_SOURCES = \ $(indirect_sources) \ $(glapi_sources) \ @@ -639,6 +689,7 @@ libglx_la_SOURCES = \ unpack.h \ xfont.c +libglx_la_LIBADD = $(DLOPEN_LIBS) all: all-am .SUFFIXES: diff --git a/xserver/glx/extension_string.c b/xserver/glx/extension_string.c index a4b202af3..7721cb056 100644 --- a/xserver/glx/extension_string.c +++ b/xserver/glx/extension_string.c @@ -80,8 +80,9 @@ static const struct extension_info known_glx_extensions[] = { { GLX(SGI_swap_control), VER(0,0), N, }, { GLX(SGIS_multisample), VER(0,0), Y, }, { GLX(SGIX_fbconfig), VER(1,3), Y, }, - { GLX(SGIX_pbuffer), VER(1,3), N, }, + { GLX(SGIX_pbuffer), VER(1,3), Y, }, { GLX(SGIX_visual_select_group), VER(0,0), Y, }, + { GLX(INTEL_swap_event), VER(1,4), N, }, { NULL } }; diff --git a/xserver/glx/extension_string.h b/xserver/glx/extension_string.h index 98e91bc18..912534a04 100644 --- a/xserver/glx/extension_string.h +++ b/xserver/glx/extension_string.h @@ -50,6 +50,7 @@ enum { SGIX_fbconfig_bit, SGIX_pbuffer_bit, SGIX_visual_select_group_bit, + INTEL_swap_event_bit, __NUM_GLX_EXTS, }; diff --git a/xserver/glx/glapi.c b/xserver/glx/glapi.c index 94a804329..d6a568e88 100644 --- a/xserver/glx/glapi.c +++ b/xserver/glx/glapi.c @@ -53,7 +53,8 @@ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> -#define PUBLIC +#include <X11/Xfuncproto.h> +#define PUBLIC _X_EXPORT #else @@ -113,10 +114,15 @@ warn(void) } } +#if defined(__GNUC__) && (__GNUC__ > 2) +#define possibly_unused __attribute((unused)) +#else +#define possibly_unused +#endif #define KEYWORD1 static #define KEYWORD1_ALT static -#define KEYWORD2 GLAPIENTRY +#define KEYWORD2 GLAPIENTRY possibly_unused #define NAME(func) NoOp##func #define F NULL @@ -242,7 +248,7 @@ str_dup(const char *str) * We should call this periodically from a function such as glXMakeCurrent * in order to test if multiple threads are being used. */ -void +PUBLIC void _glapi_check_multithread(void) { #if defined(THREADS) && !defined(GLX_USE_TLS) diff --git a/xserver/glx/glapitemp.h b/xserver/glx/glapitemp.h index 09259f470..ddd67afec 100644 --- a/xserver/glx/glapitemp.h +++ b/xserver/glx/glapitemp.h @@ -27,7 +27,7 @@ */ -# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__) +# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))) && defined(__ELF__) # define HIDDEN __attribute__((visibility("hidden"))) # else # define HIDDEN diff --git a/xserver/glx/glthread.c b/xserver/glx/glthread.c index b818f4e26..8b9f61885 100644 --- a/xserver/glx/glthread.c +++ b/xserver/glx/glthread.c @@ -31,6 +31,7 @@ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> +#include <X11/Xfuncproto.h> #endif #include <stdlib.h> @@ -71,7 +72,7 @@ */ #ifdef PTHREADS -unsigned long +_X_EXPORT unsigned long _glthread_GetID(void) { return (unsigned long) pthread_self(); @@ -125,10 +126,10 @@ _glthread_SetTSD(_glthread_TSD *tsd, void *ptr) #define USE_LOCK_FOR_KEY /* undef this to try a version without lock for the global key... */ -unsigned long +_X_EXPORT unsigned long _glthread_GetID(void) { - abort(); /* XXX not implemented yet */ + OsAbort(); /* XXX not implemented yet */ return (unsigned long) 0; } @@ -256,7 +257,7 @@ _glthread_SetTSD(_glthread_TSD *tsd, void *ptr) */ #ifdef USE_XTHREADS -unsigned long +_X_EXPORT unsigned long _glthread_GetID(void) { return (unsigned long) xthread_self(); @@ -346,7 +347,7 @@ _glthread_SetTSD(_glthread_TSD *tsd, void *ptr) * no-op functions */ -unsigned long +_X_EXPORT unsigned long _glthread_GetID(void) { return 0; diff --git a/xserver/glx/glxcmds.c b/xserver/glx/glxcmds.c index ff8b126be..ec3bbe6a3 100644 --- a/xserver/glx/glxcmds.c +++ b/xserver/glx/glxcmds.c @@ -28,8 +28,6 @@ * Silicon Graphics, Inc. */ -#define NEED_REPLIES -#define FONT_PCF #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif @@ -53,12 +51,6 @@ #include "indirect_table.h" #include "indirect_util.h" -void -GlxSetRenderTables (struct _glapi_table *table) -{ - _glapi_set_dispatch (table); -} - static int validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err) { @@ -139,6 +131,62 @@ validGlxFBConfigForWindow(ClientPtr client, __GLXconfig *config, return TRUE; } +static int +validGlxContext(ClientPtr client, XID id, int access_mode, + __GLXcontext **context, int *err) +{ + *err = dixLookupResourceByType((pointer *) context, id, + __glXContextRes, client, access_mode); + if (*err != Success) { + client->errorValue = id; + if (*err == BadValue) + *err = __glXError(GLXBadContext); + return FALSE; + } + + return TRUE; +} + +static int +validGlxDrawable(ClientPtr client, XID id, int type, int access_mode, + __GLXdrawable **drawable, int *err) +{ + int rc; + + rc = dixLookupResourceByType((pointer *) drawable, id, + __glXDrawableRes, client, access_mode); + if (rc != Success && rc != BadValue) { + *err = rc; + client->errorValue = id; + return FALSE; + } + + /* If the ID of the glx drawable we looked up doesn't match the id + * we looked for, it's because we looked it up under the X + * drawable ID (see DoCreateGLXDrawable). */ + if (rc == BadValue || + (*drawable)->drawId != id || + (type != GLX_DRAWABLE_ANY && type != (*drawable)->type)) { + client->errorValue = id; + switch (type) { + case GLX_DRAWABLE_WINDOW: + *err = __glXError(GLXBadWindow); + return FALSE; + case GLX_DRAWABLE_PIXMAP: + *err = __glXError(GLXBadPixmap); + return FALSE; + case GLX_DRAWABLE_PBUFFER: + *err = __glXError(GLXBadPbuffer); + return FALSE; + case GLX_DRAWABLE_ANY: + *err = __glXError(GLXBadDrawable); + return FALSE; + } + } + + return TRUE; +} + void __glXContextDestroy(__GLXcontext *context) { @@ -181,7 +229,8 @@ DoCreateContext(__GLXclientState *cl, GLXContextID gcId, { ClientPtr client = cl->client; __GLXcontext *glxc, *shareglxc; - + int err; + LEGAL_NEW_RESOURCE(gcId, client); /* @@ -196,11 +245,10 @@ DoCreateContext(__GLXclientState *cl, GLXContextID gcId, if (shareList == None) { shareglxc = 0; } else { - shareglxc = (__GLXcontext *) LookupIDByType(shareList, __glXContextRes); - if (!shareglxc) { - client->errorValue = shareList; - return __glXError(GLXBadContext); - } + if (!validGlxContext(client, shareList, DixReadAccess, + &shareglxc, &err)) + return err; + if (shareglxc->isDirect) { /* ** NOTE: no support for sharing display lists between direct @@ -315,25 +363,16 @@ int __glXDisp_CreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc) } int __glXDisp_DestroyContext(__GLXclientState *cl, GLbyte *pc) { - ClientPtr client = cl->client; xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) pc; - GLXContextID gcId = req->context; __GLXcontext *glxc; - - glxc = (__GLXcontext *) LookupIDByType(gcId, __glXContextRes); - if (glxc) { - /* - ** Just free the resource; don't actually destroy the context, - ** because it might be in use. The - ** destroy method will be called by the resource destruction routine - ** if necessary. - */ - FreeResourceByType(gcId, __glXContextRes, FALSE); - return Success; - } else { - client->errorValue = gcId; - return __glXError(GLXBadContext); - } + int err; + + if (!validGlxContext(cl->client, req->context, DixDestroyAccess, + &glxc, &err)) + return err; + + FreeResourceByType(req->context, __glXContextRes, FALSE); + return Success; } /*****************************************************************************/ @@ -428,20 +467,10 @@ static void StartUsingContext(__GLXclientState *cl, __GLXcontext *glxc) } /** - * Given a drawable ID, get the associated drawable and / or pixmap. - * - * If the specified drawable ID is not a pixmap, \c ppPixmap will be set - * to \c NULL on return. In either case, \c ppDraw will be set to a drawable. - * In the case where the drawable ID is a pixmap, \c ppDraw will be set to - * the drawable associated with that pixmap. - * - * \param glxc Associated GLX context. - * \param drawId ID of the drawable. - * \param client Pointer to the client state. - * \return the __GLXdrawable is returned on success. Otherwise NULL. - * - * \notes This function will need some modification when support pbuffers - * is added. + * This is a helper function to handle the legacy (pre GLX 1.3) cases + * where passing an X window to glXMakeCurrent is valid. Given a + * resource ID, look up the GLX drawable if available, otherwise, make + * sure it's an X window and create a GLX drawable one the fly. */ static __GLXdrawable * __glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client, @@ -451,10 +480,8 @@ __glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client, __GLXdrawable *pGlxDraw; int rc; - /* This is the GLX 1.3 case - the client passes in a GLXWindow or - * GLXPixmap and we just return the __GLXdrawable. */ - pGlxDraw = (__GLXdrawable *) LookupIDByType(drawId, __glXDrawableRes); - if (pGlxDraw != NULL) { + if (validGlxDrawable(client, drawId, GLX_DRAWABLE_ANY, + DixWriteAccess, &pGlxDraw, &rc)) { if (glxc != NULL && pGlxDraw->config != glxc->config) { client->errorValue = drawId; *error = BadMatch; @@ -464,13 +491,10 @@ __glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client, return pGlxDraw; } - /* The drawId wasn't a GLX drawable, so presumably it's a regular - * X window. In that case, we create a shadow GLXWindow for it on - * demand here for pre GLX 1.3 compatibility and use the X Window - * XID as its GLXWindow XID. The client can't explicitly create a - * GLXWindow with the same XID as an X Window, so we wont get any - * resource ID clashes. Effectively, the X Window is now also a - * GLXWindow. */ + /* The drawId wasn't a GLX drawable. Make sure it's a window and + * create a GLXWindow for it. Check that the drawable screen + * matches the context screen and that the context fbconfig is + * compatible with the window visual. */ rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixGetAttrAccess); if (rc != Success || pDraw->type != DRAWABLE_WINDOW) { @@ -479,22 +503,18 @@ __glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client, return NULL; } - /* If we're not given a context, don't create the __GLXdrawable */ - if (glxc == NULL) { - *error = __glXError(GLXBadDrawable); + if (pDraw->pScreen != glxc->pGlxScreen->pScreen) { + client->errorValue = pDraw->pScreen->myNum; + *error = BadMatch; return NULL; } - /* We're binding an X Window for the first time and need to create - * a GLX drawable for it. Check that the drawable screen matches - * the context screen and that the context fbconfig is compatible - * with the window visual. */ - if (pDraw->pScreen != glxc->pGlxScreen->pScreen || - !validGlxFBConfigForWindow(client, glxc->config, pDraw, error)) + if (!validGlxFBConfigForWindow(client, glxc->config, pDraw, error)) return NULL; - pGlxDraw = glxc->pGlxScreen->createDrawable(glxc->pGlxScreen, - pDraw, GLX_DRAWABLE_WINDOW, + pGlxDraw = glxc->pGlxScreen->createDrawable(client, glxc->pGlxScreen, + pDraw, drawId, + GLX_DRAWABLE_WINDOW, drawId, glxc->config); /* since we are creating the drawablePrivate, drawId should be new */ @@ -522,7 +542,7 @@ DoMakeCurrent(__GLXclientState *cl, __GLXcontext *glxc, *prevglxc; __GLXdrawable *drawPriv = NULL; __GLXdrawable *readPriv = NULL; - GLint error; + int error; GLuint mask; /* @@ -563,11 +583,8 @@ DoMakeCurrent(__GLXclientState *cl, if (contextId != None) { int status; - glxc = (__GLXcontext *) LookupIDByType(contextId, __glXContextRes); - if (!glxc) { - client->errorValue = contextId; - return __glXError(GLXBadContext); - } + if (!validGlxContext(client, contextId, DixUseAccess, &glxc, &error)) + return error; if ((glxc != prevglxc) && glxc->isCurrent) { /* Context is current to somebody else */ return BadAccess; @@ -690,15 +707,10 @@ int __glXDisp_IsDirect(__GLXclientState *cl, GLbyte *pc) xGLXIsDirectReq *req = (xGLXIsDirectReq *) pc; xGLXIsDirectReply reply; __GLXcontext *glxc; + int err; - /* - ** Find the GL context. - */ - glxc = (__GLXcontext *) LookupIDByType(req->context, __glXContextRes); - if (!glxc) { - client->errorValue = req->context; - return __glXError(GLXBadContext); - } + if (!validGlxContext(cl->client, req->context, DixReadAccess, &glxc, &err)) + return err; reply.isDirect = glxc->isDirect; reply.length = 0; @@ -731,8 +743,8 @@ int __glXDisp_QueryVersion(__GLXclientState *cl, GLbyte *pc) ** client if it wants to work with older clients; however, in this ** implementation the server just returns its version number. */ - reply.majorVersion = GLX_SERVER_MAJOR_VERSION; - reply.minorVersion = GLX_SERVER_MINOR_VERSION; + reply.majorVersion = glxMajorVersion; + reply.minorVersion = glxMinorVersion; reply.length = 0; reply.type = X_Reply; reply.sequenceNumber = client->sequence; @@ -785,8 +797,8 @@ int __glXDisp_WaitX(__GLXclientState *cl, GLbyte *pc) return error; } - if (glxc && glxc->drawPriv->waitGL) - (*glxc->drawPriv->waitGL)(glxc->drawPriv); + if (glxc && glxc->drawPriv->waitX) + (*glxc->drawPriv->waitX)(glxc->drawPriv); return Success; } @@ -802,19 +814,10 @@ int __glXDisp_CopyContext(__GLXclientState *cl, GLbyte *pc) __GLXcontext *src, *dst; int error; - /* - ** Check that each context exists. - */ - src = (__GLXcontext *) LookupIDByType(source, __glXContextRes); - if (!src) { - client->errorValue = source; - return __glXError(GLXBadContext); - } - dst = (__GLXcontext *) LookupIDByType(dest, __glXContextRes); - if (!dst) { - client->errorValue = dest; - return __glXError(GLXBadContext); - } + if (!validGlxContext(cl->client, source, DixReadAccess, &src, &error)) + return error; + if (!validGlxContext(cl->client, dest, DixWriteAccess, &dst, &error)) + return error; /* ** They must be in the same address space, and same screen. @@ -872,6 +875,14 @@ int __glXDisp_CopyContext(__GLXclientState *cl, GLbyte *pc) return Success; } +enum { + GLX_VIS_CONFIG_UNPAIRED = 18, + GLX_VIS_CONFIG_PAIRED = 20 +}; + +enum { + GLX_VIS_CONFIG_TOTAL = GLX_VIS_CONFIG_UNPAIRED + GLX_VIS_CONFIG_PAIRED +}; int __glXDisp_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc) { @@ -880,7 +891,7 @@ int __glXDisp_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc) xGLXGetVisualConfigsReply reply; __GLXscreen *pGlxScreen; __GLXconfig *modes; - CARD32 buf[__GLX_TOTAL_CONFIG]; + CARD32 buf[GLX_VIS_CONFIG_TOTAL]; int p, i, err; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; @@ -889,8 +900,8 @@ int __glXDisp_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc) return err; reply.numVisuals = pGlxScreen->numVisuals; - reply.numProps = __GLX_TOTAL_CONFIG; - reply.length = (reply.numVisuals * __GLX_SIZE_CARD32 * __GLX_TOTAL_CONFIG) >> 2; + reply.numProps = GLX_VIS_CONFIG_TOTAL; + reply.length = (reply.numVisuals * __GLX_SIZE_CARD32 * GLX_VIS_CONFIG_TOTAL) >> 2; reply.type = X_Reply; reply.sequenceNumber = client->sequence; @@ -928,6 +939,8 @@ int __glXDisp_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc) buf[p++] = modes->stencilBits; buf[p++] = modes->numAuxBuffers; buf[p++] = modes->level; + + assert(p == GLX_VIS_CONFIG_UNPAIRED); /* ** Add token/value pairs for extensions. */ @@ -952,11 +965,11 @@ int __glXDisp_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc) buf[p++] = 0; /* copy over visualSelectGroup (GLX_VISUAL_SELECT_GROUP_SGIX)? */ buf[p++] = 0; + assert(p == GLX_VIS_CONFIG_TOTAL); if (client->swapped) { - __GLX_SWAP_INT_ARRAY(buf, __GLX_TOTAL_CONFIG); + __GLX_SWAP_INT_ARRAY(buf, p); } - WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_TOTAL_CONFIG, - (char *)buf); + WriteToClient(client, __GLX_SIZE_CARD32 * p, (char *)buf); } return Success; } @@ -1089,28 +1102,20 @@ __glXDrawableInit(__GLXdrawable *drawable, void __glXDrawableRelease(__GLXdrawable *drawable) { - ScreenPtr pScreen = drawable->pDraw->pScreen; - - switch (drawable->type) { - case GLX_DRAWABLE_PIXMAP: - case GLX_DRAWABLE_PBUFFER: - (*pScreen->DestroyPixmap)((PixmapPtr) drawable->pDraw); - break; - } } static int -DoCreateGLXDrawable(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *config, - DrawablePtr pDraw, XID glxDrawableId, int type) +DoCreateGLXDrawable(ClientPtr client, __GLXscreen *pGlxScreen, + __GLXconfig *config, DrawablePtr pDraw, XID drawableId, + XID glxDrawableId, int type) { __GLXdrawable *pGlxDraw; - LEGAL_NEW_RESOURCE(glxDrawableId, client); - if (pGlxScreen->pScreen != pDraw->pScreen) return BadMatch; - pGlxDraw = pGlxScreen->createDrawable(pGlxScreen, pDraw, type, + pGlxDraw = pGlxScreen->createDrawable(client, pGlxScreen, pDraw, + drawableId, type, glxDrawableId, config); if (pGlxDraw == NULL) return BadAlloc; @@ -1120,6 +1125,15 @@ DoCreateGLXDrawable(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *conf return BadAlloc; } + /* Add the glx drawable under the XID of the underlying X drawable + * too. That way we'll get a callback in DrawableGone and can + * clean up properly when the drawable is destroyed. */ + if (drawableId != glxDrawableId && + !AddResource(pDraw->id, __glXDrawableRes, pGlxDraw)) { + pGlxDraw->destroy (pGlxDraw); + return BadAlloc; + } + return Success; } @@ -1130,30 +1144,37 @@ DoCreateGLXPixmap(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *config DrawablePtr pDraw; int err; + LEGAL_NEW_RESOURCE(glxDrawableId, client); + err = dixLookupDrawable(&pDraw, drawableId, client, 0, DixAddAccess); - if (err != Success || pDraw->type != DRAWABLE_PIXMAP) { + if (err != Success) { + client->errorValue = drawableId; + return err; + } + if (pDraw->type != DRAWABLE_PIXMAP) { client->errorValue = drawableId; return BadPixmap; } - err = DoCreateGLXDrawable(client, pGlxScreen, config, pDraw, + err = DoCreateGLXDrawable(client, pGlxScreen, config, pDraw, drawableId, glxDrawableId, GLX_DRAWABLE_PIXMAP); - if (err == Success) - ((PixmapPtr) pDraw)->refcnt++; - return err; } static void -determineTextureTarget(XID glxDrawableID, CARD32 *attribs, CARD32 numAttribs) +determineTextureTarget(ClientPtr client, XID glxDrawableID, + CARD32 *attribs, CARD32 numAttribs) { GLenum target = 0; GLenum format = 0; - int i; + int i, err; __GLXdrawable *pGlxDraw; - pGlxDraw = LookupIDByType(glxDrawableID, __glXDrawableRes); + if (!validGlxDrawable(client, glxDrawableID, GLX_DRAWABLE_PIXMAP, + DixWriteAccess, &pGlxDraw, &err)) + /* We just added it in CreatePixmap, so we should never get here. */ + return; for (i = 0; i < numAttribs; i++) { if (attribs[2 * i] == GLX_TEXTURE_TARGET_EXT) { @@ -1217,7 +1238,7 @@ int __glXDisp_CreatePixmap(__GLXclientState *cl, GLbyte *pc) if (err != Success) return err; - determineTextureTarget(req->glxpixmap, + determineTextureTarget(cl->client, req->glxpixmap, (CARD32*) (req + 1), req->numAttribs); return Success; @@ -1243,24 +1264,12 @@ int __glXDisp_CreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc) static int DoDestroyDrawable(__GLXclientState *cl, XID glxdrawable, int type) { - ClientPtr client = cl->client; __GLXdrawable *pGlxDraw; + int err; - /* - ** Check it's the right type of drawable. - */ - pGlxDraw = LookupIDByType(glxdrawable, __glXDrawableRes); - if (pGlxDraw == NULL || pGlxDraw->type != type) { - client->errorValue = glxdrawable; - switch (type) { - case GLX_DRAWABLE_WINDOW: - return __glXError(GLXBadWindow); - case GLX_DRAWABLE_PIXMAP: - return __glXError(GLXBadDrawable); - case GLX_DRAWABLE_PBUFFER: - return __glXError(GLXBadPbuffer); - } - } + if (!validGlxDrawable(cl->client, glxdrawable, type, + DixDestroyAccess, &pGlxDraw, &err)) + return err; FreeResource(glxdrawable, FALSE); @@ -1290,6 +1299,8 @@ DoCreatePbuffer(ClientPtr client, int screenNum, XID fbconfigId, PixmapPtr pPixmap; int err; + LEGAL_NEW_RESOURCE(glxDrawableId, client); + if (!validGlxScreen(client, screenNum, &pGlxScreen, &err)) return err; if (!validGlxFBConfig(client, pGlxScreen, fbconfigId, &config, &err)) @@ -1300,8 +1311,16 @@ DoCreatePbuffer(ClientPtr client, int screenNum, XID fbconfigId, width, height, config->rgbBits, 0); __glXleaveServer(GL_FALSE); + /* Assign the pixmap the same id as the pbuffer and add it as a + * resource so it and the DRI2 drawable will be reclaimed when the + * pbuffer is destroyed. */ + pPixmap->drawable.id = glxDrawableId; + if (!AddResource(pPixmap->drawable.id, RT_PIXMAP, pPixmap)) + return BadAlloc; + return DoCreateGLXDrawable(client, pGlxScreen, config, &pPixmap->drawable, - glxDrawableId, GLX_DRAWABLE_PBUFFER); + glxDrawableId, glxDrawableId, + GLX_DRAWABLE_PBUFFER); } int __glXDisp_CreatePbuffer(__GLXclientState *cl, GLbyte *pc) @@ -1360,9 +1379,12 @@ DoChangeDrawableAttributes(ClientPtr client, XID glxdrawable, int numAttribs, CARD32 *attribs) { __GLXdrawable *pGlxDraw; - int i; + int i, err; + + if (!validGlxDrawable(client, glxdrawable, GLX_DRAWABLE_ANY, + DixSetAttrAccess, &pGlxDraw, &err)) + return err; - pGlxDraw = LookupIDByType(glxdrawable, __glXDrawableRes); for (i = 0; i < numAttribs; i++) { switch(attribs[i * 2]) { case GLX_EVENT_MASK: @@ -1404,6 +1426,8 @@ int __glXDisp_CreateWindow(__GLXclientState *cl, GLbyte *pc) DrawablePtr pDraw; int err; + LEGAL_NEW_RESOURCE(req->glxwindow, client); + if (!validGlxScreen(client, req->screen, &pGlxScreen, &err)) return err; if (!validGlxFBConfig(client, pGlxScreen, req->fbconfig, &config, &err)) @@ -1419,7 +1443,8 @@ int __glXDisp_CreateWindow(__GLXclientState *cl, GLbyte *pc) return err; return DoCreateGLXDrawable(client, pGlxScreen, config, - pDraw, req->glxwindow, GLX_DRAWABLE_WINDOW); + pDraw, req->window, + req->glxwindow, GLX_DRAWABLE_WINDOW); } int __glXDisp_DestroyWindow(__GLXclientState *cl, GLbyte *pc) @@ -1474,7 +1499,7 @@ int __glXDisp_SwapBuffers(__GLXclientState *cl, GLbyte *pc) return error; if (pGlxDraw->type == DRAWABLE_WINDOW && - (*pGlxDraw->swapBuffers)(pGlxDraw) == GL_FALSE) + (*pGlxDraw->swapBuffers)(cl->client, pGlxDraw) == GL_FALSE) return __glXError(GLXBadDrawable); return Success; @@ -1490,12 +1515,10 @@ DoQueryContext(__GLXclientState *cl, GLXContextID gcId) int nProps; int *sendBuf, *pSendBuf; int nReplyBytes; + int err; - ctx = (__GLXcontext *) LookupIDByType(gcId, __glXContextRes); - if (!ctx) { - client->errorValue = gcId; - return __glXError(GLXBadContext); - } + if (!validGlxContext(cl->client, gcId, DixReadAccess, &ctx, &err)) + return err; nProps = 3; reply.length = nProps << 1; @@ -1563,11 +1586,9 @@ int __glXDisp_BindTexImageEXT(__GLXclientState *cl, GLbyte *pc) if (!context) return error; - pGlxDraw = __glXGetDrawable(NULL, drawId, client, &error); - if (!pGlxDraw || pGlxDraw->type != GLX_DRAWABLE_PIXMAP) { - client->errorValue = drawId; - return __glXError(GLXBadPixmap); - } + if (!validGlxDrawable(client, drawId, GLX_DRAWABLE_PIXMAP, + DixReadAccess, &pGlxDraw, &error)) + return error; if (!context->textureFromPixmap) return __glXError(GLXUnsupportedPrivateRequest); @@ -1596,11 +1617,9 @@ int __glXDisp_ReleaseTexImageEXT(__GLXclientState *cl, GLbyte *pc) if (!context) return error; - pGlxDraw = __glXGetDrawable(NULL, drawId, client, &error); - if (!pGlxDraw || pGlxDraw->type != GLX_DRAWABLE_PIXMAP) { - client->errorValue = drawId; + if (!validGlxDrawable(client, drawId, GLX_DRAWABLE_PIXMAP, + DixReadAccess, &pGlxDraw, &error)) return error; - } if (!context->textureFromPixmap) return __glXError(GLXUnsupportedPrivateRequest); @@ -1680,11 +1699,9 @@ DoGetDrawableAttributes(__GLXclientState *cl, XID drawId) CARD32 attributes[6]; int numAttribs, error; - pGlxDraw = __glXGetDrawable(NULL, drawId, client, &error); - if (!pGlxDraw) { - client->errorValue = drawId; + if (!validGlxDrawable(client, drawId, GLX_DRAWABLE_ANY, + DixGetAttrAccess, &pGlxDraw, &error)) return error; - } numAttribs = 3; reply.length = numAttribs << 1; @@ -2058,7 +2075,7 @@ int __glXDisp_BindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc) if (ret == Success) { if (barrier) /* add source for cleanup when drawable is gone */ - AddResource(drawable, __glXSwapBarrierRes, (pointer)screen); + AddResource(drawable, __glXSwapBarrierRes, (pointer)(intptr_t)screen); else /* delete source */ FreeResourceByType(drawable, __glXSwapBarrierRes, FALSE); @@ -2360,6 +2377,7 @@ int __glXDisp_QueryServerString(__GLXclientState *cl, GLbyte *pc) char *buf; __GLXscreen *pGlxScreen; int err; + char ver_str[16]; if (!validGlxScreen(client, req->screen, &pGlxScreen, &err)) return err; @@ -2369,7 +2387,11 @@ int __glXDisp_QueryServerString(__GLXclientState *cl, GLbyte *pc) ptr = pGlxScreen->GLXvendor; break; case GLX_VERSION: - ptr = pGlxScreen->GLXversion; + /* Return to the server version rather than the screen version + * to prevent confusion when they do not match. + */ + snprintf(ver_str, 16, "%d.%d", glxMajorVersion, glxMinorVersion); + ptr = ver_str; break; case GLX_EXTENSIONS: ptr = pGlxScreen->GLXextensions; diff --git a/xserver/glx/glxcmdsswap.c b/xserver/glx/glxcmdsswap.c index 65edf6991..c414dc8e2 100644 --- a/xserver/glx/glxcmdsswap.c +++ b/xserver/glx/glxcmdsswap.c @@ -28,8 +28,6 @@ * Silicon Graphics, Inc. */ -#define NEED_REPLIES -#define FONT_PCF #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif @@ -356,7 +354,7 @@ int __glXDispSwap_CreateGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_DestroyPbuffer(__GLXclientState *cl, GLbyte *pc) { - xGLXDestroyPbufferReq *req = (xGLXDestroyPbufferReq *) req; + xGLXDestroyPbufferReq *req = (xGLXDestroyPbufferReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(&req->pbuffer); @@ -366,7 +364,7 @@ int __glXDispSwap_DestroyPbuffer(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_DestroyGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc) { - xGLXDestroyGLXPbufferSGIXReq *req = (xGLXDestroyGLXPbufferSGIXReq *) req; + xGLXDestroyGLXPbufferSGIXReq *req = (xGLXDestroyGLXPbufferSGIXReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(&req->pbuffer); @@ -377,7 +375,7 @@ int __glXDispSwap_DestroyGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_ChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc) { xGLXChangeDrawableAttributesReq *req = - (xGLXChangeDrawableAttributesReq *) req; + (xGLXChangeDrawableAttributesReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; CARD32 *attribs; @@ -394,7 +392,7 @@ int __glXDispSwap_ChangeDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc) { xGLXChangeDrawableAttributesSGIXReq *req = - (xGLXChangeDrawableAttributesSGIXReq *) req; + (xGLXChangeDrawableAttributesSGIXReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; CARD32 *attribs; diff --git a/xserver/glx/glxcontext.h b/xserver/glx/glxcontext.h index 70a14115d..79bc083a8 100644 --- a/xserver/glx/glxcontext.h +++ b/xserver/glx/glxcontext.h @@ -55,6 +55,10 @@ struct __GLXcontext { unsigned long mask); int (*forceCurrent) (__GLXcontext *context); + Bool (*wait) (__GLXcontext *context, + __GLXclientState *cl, + int *error); + __GLXtextureFromPixmap *textureFromPixmap; /* diff --git a/xserver/glx/glxdrawable.h b/xserver/glx/glxdrawable.h index f5a040359..2a365c505 100644 --- a/xserver/glx/glxdrawable.h +++ b/xserver/glx/glxdrawable.h @@ -35,18 +35,17 @@ * Silicon Graphics, Inc. */ -#include <damage.h> - /* We just need to avoid clashing with DRAWABLE_{WINDOW,PIXMAP} */ enum { GLX_DRAWABLE_WINDOW, GLX_DRAWABLE_PIXMAP, - GLX_DRAWABLE_PBUFFER + GLX_DRAWABLE_PBUFFER, + GLX_DRAWABLE_ANY }; struct __GLXdrawable { void (*destroy)(__GLXdrawable *private); - GLboolean (*swapBuffers)(__GLXdrawable *); + GLboolean (*swapBuffers)(ClientPtr client, __GLXdrawable *); void (*copySubBuffer)(__GLXdrawable *drawable, int x, int y, int w, int h); void (*waitX)(__GLXdrawable *); diff --git a/xserver/glx/glxdri.c b/xserver/glx/glxdri.c index 3b4970470..e4870c319 100644 --- a/xserver/glx/glxdri.c +++ b/xserver/glx/glxdri.c @@ -38,11 +38,12 @@ #include <windowstr.h> #include <os.h> +#include <damage.h> #define _XF86DRI_SERVER_ #include <drm_sarea.h> #include <xf86drm.h> -#include <xf86dristr.h> +#include <X11/dri/xf86driproto.h> #include <xf86str.h> #include <xf86.h> #include <dri.h> @@ -244,7 +245,7 @@ __glXDRIdrawableDestroy(__GLXdrawable *drawable) } static GLboolean -__glXDRIdrawableSwapBuffers(__GLXdrawable *basePrivate) +__glXDRIdrawableSwapBuffers(ClientPtr client, __GLXdrawable *basePrivate) { __GLXDRIdrawable *private = (__GLXDRIdrawable *) basePrivate; __GLXDRIscreen *screen = @@ -681,10 +682,12 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen, } static __GLXdrawable * -__glXDRIscreenCreateDrawable(__GLXscreen *screen, +__glXDRIscreenCreateDrawable(ClientPtr client, + __GLXscreen *screen, DrawablePtr pDraw, - int type, XID drawId, + int type, + XID glxDrawId, __GLXconfig *glxConfig) { __GLXDRIscreen *driScreen = (__GLXDRIscreen *) screen; @@ -698,7 +701,7 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen, return NULL; if (!__glXDrawableInit(&private->base, screen, - pDraw, type, drawId, glxConfig)) { + pDraw, type, glxDrawId, glxConfig)) { xfree(private); return NULL; } @@ -1086,7 +1089,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen) if (!DRIGetDeviceInfo(pScreen, &hFB, &junk, &framebuffer.size, &framebuffer.stride, &framebuffer.dev_priv_size, &framebuffer.dev_priv)) { - LogMessage(X_ERROR, "AIGLX error: XF86DRIGetDeviceInfo failed"); + LogMessage(X_ERROR, "AIGLX error: XF86DRIGetDeviceInfo failed\n"); goto handle_error; } @@ -1097,7 +1100,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen) status = drmMap(fd, hFB, framebuffer.size, (drmAddressPtr)&framebuffer.base); if (status != 0) { - LogMessage(X_ERROR, "AIGLX error: drmMap of framebuffer failed (%s)", + LogMessage(X_ERROR, "AIGLX error: drmMap of framebuffer failed (%s)\n", strerror(-status)); goto handle_error; } @@ -1107,7 +1110,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen) */ status = drmMap(fd, hSAREA, SAREA_MAX, &pSAREA); if (status != 0) { - LogMessage(X_ERROR, "AIGLX error: drmMap of SAREA failed (%s)", + LogMessage(X_ERROR, "AIGLX error: drmMap of SAREA failed (%s)\n", strerror(-status)); goto handle_error; } @@ -1125,7 +1128,8 @@ __glXDRIscreenProbe(ScreenPtr pScreen) screen); if (screen->driScreen == NULL) { - LogMessage(X_ERROR, "AIGLX error: Calling driver entry point failed\n"); + LogMessage(X_ERROR, + "AIGLX error: Calling driver entry point failed\n"); goto handle_error; } @@ -1138,6 +1142,10 @@ __glXDRIscreenProbe(ScreenPtr pScreen) __glXScreenInit(&screen->base, pScreen); + /* The first call simply determines the length of the extension string. + * This allows us to allocate some memory to hold the extension string, + * but it requires that we call __glXGetExtensionString a second time. + */ buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL); if (buffer_size > 0) { if (screen->base.GLXextensions != NULL) { @@ -1152,7 +1160,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen) __glXsetEnterLeaveServerFuncs(__glXDRIenterServer, __glXDRIleaveServer); screen->enterVT = pScrn->EnterVT; - pScrn->EnterVT = glxDRIEnterVT; + pScrn->EnterVT = glxDRIEnterVT; screen->leaveVT = pScrn->LeaveVT; pScrn->LeaveVT = glxDRILeaveVT; @@ -1183,7 +1191,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen) return NULL; } -__GLXprovider __glXDRIProvider = { +_X_EXPORT __GLXprovider __glXDRIProvider = { __glXDRIscreenProbe, "DRI", NULL diff --git a/xserver/glx/glxdri2.c b/xserver/glx/glxdri2.c index 146ea828f..a580df381 100644 --- a/xserver/glx/glxdri2.c +++ b/xserver/glx/glxdri2.c @@ -70,6 +70,7 @@ struct __GLXDRIscreen { const __DRIcoreExtension *core; const __DRIdri2Extension *dri2; + const __DRI2flushExtension *flush; const __DRIcopySubBufferExtension *copySubBuffer; const __DRIswapControlExtension *swapControl; const __DRItexBufferExtension *texBuffer; @@ -104,11 +105,6 @@ __glXDRIdrawableDestroy(__GLXdrawable *drawable) (*core->destroyDrawable)(private->driDrawable); - /* If the X window was destroyed, the dri DestroyWindow hook will - * aready have taken care of this, so only call if pDraw isn't NULL. */ - if (drawable->pDraw != NULL) - DRI2DestroyDrawable(drawable->pDraw); - __glXDrawableRelease(drawable); xfree(private); @@ -132,17 +128,6 @@ __glXDRIdrawableCopySubBuffer(__GLXdrawable *drawable, DRI2BufferFrontLeft, DRI2BufferBackLeft); } -static GLboolean -__glXDRIdrawableSwapBuffers(__GLXdrawable *drawable) -{ - __GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable; - - __glXDRIdrawableCopySubBuffer(drawable, 0, 0, - private->width, private->height); - - return TRUE; -} - static void __glXDRIdrawableWaitX(__GLXdrawable *drawable) { @@ -177,9 +162,81 @@ __glXDRIdrawableWaitGL(__GLXdrawable *drawable) DRI2BufferFrontLeft, DRI2BufferFakeFrontLeft); } +static void +__glXdriSwapEvent(ClientPtr client, void *data, int type, CARD64 ust, + CARD64 msc, CARD64 sbc) +{ + __GLXdrawable *drawable = data; + xGLXBufferSwapComplete wire; + + if (!(drawable->eventMask & GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK)) + return; + + wire.type = __glXEventBase + GLX_BufferSwapComplete; + switch (type) { + case DRI2_EXCHANGE_COMPLETE: + wire.event_type = GLX_EXCHANGE_COMPLETE_INTEL; + break; + case DRI2_BLIT_COMPLETE: + wire.event_type = GLX_BLIT_COMPLETE_INTEL; + break; + case DRI2_FLIP_COMPLETE: + wire.event_type = GLX_FLIP_COMPLETE_INTEL; + break; + default: + /* unknown swap completion type */ + break; + } + wire.sequenceNumber = client->sequence; + wire.drawable = drawable->drawId; + wire.ust_hi = ust >> 32; + wire.ust_lo = ust & 0xffffffff; + wire.msc_hi = msc >> 32; + wire.msc_lo = msc & 0xffffffff; + wire.sbc_hi = sbc >> 32; + wire.sbc_lo = sbc & 0xffffffff; + + WriteEventsToClient(client, 1, (xEvent *) &wire); +} + +/* + * Copy or flip back to front, honoring the swap interval if possible. + * + * If the kernel supports it, we request an event for the frame when the + * swap should happen, then perform the copy when we receive it. + */ +static GLboolean +__glXDRIdrawableSwapBuffers(ClientPtr client, __GLXdrawable *drawable) +{ + __GLXDRIdrawable *priv = (__GLXDRIdrawable *) drawable; + __GLXDRIscreen *screen = priv->screen; + CARD64 unused; + +#if __DRI2_FLUSH_VERSION >= 3 + if (screen->flush) { + (*screen->flush->flush)(priv->driDrawable); + (*screen->flush->invalidate)(priv->driDrawable); + } +#else + if (screen->flush) + (*screen->flush->flushInvalidate)(priv->driDrawable); +#endif + + if (DRI2SwapBuffers(client, drawable->pDraw, 0, 0, 0, &unused, + __glXdriSwapEvent, drawable->pDraw) != Success) + return FALSE; + + return TRUE; +} + static int __glXDRIdrawableSwapInterval(__GLXdrawable *drawable, int interval) { + if (interval <= 0) /* || interval > BIGNUM? */ + return GLX_BAD_VALUE; + + DRI2SwapInterval(drawable->pDraw, interval); + return 0; } @@ -241,6 +298,18 @@ __glXDRIcontextForceCurrent(__GLXcontext *baseContext) read->driDrawable); } +static Bool +__glXDRIcontextWait(__GLXcontext *baseContext, + __GLXclientState *cl, int *error) +{ + if (DRI2WaitSwap(cl->client, baseContext->drawPriv->pDraw)) { + *error = cl->client->noClientException; + return TRUE; + } + + return FALSE; +} + #ifdef __DRI_TEX_BUFFER static int @@ -346,6 +415,7 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen, context->base.copy = __glXDRIcontextCopy; context->base.forceCurrent = __glXDRIcontextForceCurrent; context->base.textureFromPixmap = &__glXDRItextureFromPixmap; + context->base.wait = __glXDRIcontextWait; context->driContext = (*screen->dri2->createNewContext)(screen->driScreen, @@ -360,10 +430,12 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen, } static __GLXdrawable * -__glXDRIscreenCreateDrawable(__GLXscreen *screen, +__glXDRIscreenCreateDrawable(ClientPtr client, + __GLXscreen *screen, DrawablePtr pDraw, - int type, XID drawId, + int type, + XID glxDrawId, __GLXconfig *glxConfig) { __GLXDRIscreen *driScreen = (__GLXDRIscreen *) screen; @@ -376,7 +448,7 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen, private->screen = driScreen; if (!__glXDrawableInit(&private->base, screen, - pDraw, type, drawId, glxConfig)) { + pDraw, type, glxDrawId, glxConfig)) { xfree(private); return NULL; } @@ -387,7 +459,7 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen, private->base.waitGL = __glXDRIdrawableWaitGL; private->base.waitX = __glXDRIdrawableWaitX; - if (DRI2CreateDrawable(pDraw)) { + if (DRI2CreateDrawable(client, pDraw, drawId)) { xfree(private); return NULL; } @@ -541,6 +613,7 @@ glxDRILeaveVT (int index, int flags) static void initializeExtensions(__GLXDRIscreen *screen) { + ScreenPtr pScreen = screen->base.pScreen; const __DRIextension **extensions; int i; @@ -550,17 +623,24 @@ initializeExtensions(__GLXDRIscreen *screen) "GLX_MESA_copy_sub_buffer"); LogMessage(X_INFO, "AIGLX: enabled GLX_MESA_copy_sub_buffer\n"); + __glXEnableExtension(screen->glx_enable_bits, "GLX_INTEL_swap_event"); + LogMessage(X_INFO, "AIGLX: enabled GLX_INTEL_swap_event\n"); + + if (DRI2HasSwapControl(pScreen)) { + __glXEnableExtension(screen->glx_enable_bits, + "GLX_SGI_swap_control"); + __glXEnableExtension(screen->glx_enable_bits, + "GLX_MESA_swap_control"); + LogMessage(X_INFO, "AIGLX: enabled GLX_SGI_swap_control and GLX_MESA_swap_control\n"); + } + for (i = 0; extensions[i]; i++) { -#ifdef __DRI_SWAP_CONTROL - if (strcmp(extensions[i]->name, __DRI_SWAP_CONTROL) == 0) { - screen->swapControl = - (const __DRIswapControlExtension *) extensions[i]; - __glXEnableExtension(screen->glx_enable_bits, - "GLX_SGI_swap_control"); +#ifdef __DRI_READ_DRAWABLE + if (strcmp(extensions[i]->name, __DRI_READ_DRAWABLE) == 0) { __glXEnableExtension(screen->glx_enable_bits, - "GLX_MESA_swap_control"); - - LogMessage(X_INFO, "AIGLX: enabled GLX_SGI_swap_control and GLX_MESA_swap_control\n"); + "GLX_SGI_make_current_read"); + + LogMessage(X_INFO, "AIGLX: enabled GLX_SGI_make_current_read\n"); } #endif @@ -572,6 +652,14 @@ initializeExtensions(__GLXDRIscreen *screen) LogMessage(X_INFO, "AIGLX: GLX_EXT_texture_from_pixmap backed by buffer objects\n"); } #endif + +#ifdef __DRI2_FLUSH + if (strcmp(extensions[i]->name, __DRI2_FLUSH) == 0 && + extensions[i]->version >= 3) { + screen->flush = (__DRI2flushExtension *) extensions[i]; + } +#endif + /* Ignore unknown extensions */ } } @@ -627,11 +715,11 @@ __glXDRIscreenProbe(ScreenPtr pScreen) for (i = 0; extensions[i]; i++) { if (strcmp(extensions[i]->name, __DRI_CORE) == 0 && - extensions[i]->version >= __DRI_CORE_VERSION) { + extensions[i]->version >= 1) { screen->core = (const __DRIcoreExtension *) extensions[i]; } if (strcmp(extensions[i]->name, __DRI_DRI2) == 0 && - extensions[i]->version >= __DRI_DRI2_VERSION) { + extensions[i]->version >= 1) { screen->dri2 = (const __DRIdri2Extension *) extensions[i]; } } @@ -661,6 +749,10 @@ __glXDRIscreenProbe(ScreenPtr pScreen) __glXScreenInit(&screen->base, pScreen); + /* The first call simply determines the length of the extension string. + * This allows us to allocate some memory to hold the extension string, + * but it requires that we call __glXGetExtensionString a second time. + */ buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL); if (buffer_size > 0) { if (screen->base.GLXextensions != NULL) { @@ -672,6 +764,18 @@ __glXDRIscreenProbe(ScreenPtr pScreen) screen->base.GLXextensions); } + /* We're going to assume (perhaps incorrectly?) that all DRI2-enabled + * drivers support the required extensions for GLX 1.4. The extensions + * we're assuming are: + * + * - GLX_SGI_make_current_read (1.3) + * - GLX_SGIX_fbconfig (1.3) + * - GLX_SGIX_pbuffer (1.3) + * - GLX_ARB_multisample (1.4) + */ + screen->base.GLXmajor = 1; + screen->base.GLXminor = 4; + screen->enterVT = pScrn->EnterVT; pScrn->EnterVT = glxDRIEnterVT; screen->leaveVT = pScrn->LeaveVT; @@ -693,7 +797,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen) return NULL; } -__GLXprovider __glXDRI2Provider = { +_X_EXPORT __GLXprovider __glXDRI2Provider = { __glXDRIscreenProbe, "DRI2", NULL diff --git a/xserver/glx/glxdriswrast.c b/xserver/glx/glxdriswrast.c index f8c441e65..6a34393dd 100644 --- a/xserver/glx/glxdriswrast.c +++ b/xserver/glx/glxdriswrast.c @@ -55,6 +55,13 @@ #include "dispatch.h" #include "extension_string.h" +/* RTLD_LOCAL is not defined on Cygwin */ +#ifdef __CYGWIN__ +#ifndef RTLD_LOCAL +#define RTLD_LOCAL 0 +#endif +#endif + typedef struct __GLXDRIscreen __GLXDRIscreen; typedef struct __GLXDRIcontext __GLXDRIcontext; typedef struct __GLXDRIdrawable __GLXDRIdrawable; @@ -101,7 +108,7 @@ __glXDRIdrawableDestroy(__GLXdrawable *drawable) } static GLboolean -__glXDRIdrawableSwapBuffers(__GLXdrawable *drawable) +__glXDRIdrawableSwapBuffers(ClientPtr client, __GLXdrawable *drawable) { __GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable; const __DRIcoreExtension *core = private->screen->core; @@ -294,10 +301,12 @@ glxChangeGC(GCPtr gc, BITS32 mask, CARD32 val) } static __GLXdrawable * -__glXDRIscreenCreateDrawable(__GLXscreen *screen, +__glXDRIscreenCreateDrawable(ClientPtr client, + __GLXscreen *screen, DrawablePtr pDraw, - int type, XID drawId, + int type, + XID glxDrawId, __GLXconfig *glxConfig) { __GLXDRIscreen *driScreen = (__GLXDRIscreen *) screen; @@ -312,7 +321,7 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen, private->screen = driScreen; if (!__glXDrawableInit(&private->base, screen, - pDraw, type, drawId, glxConfig)) { + pDraw, type, glxDrawId, glxConfig)) { xfree(private); return NULL; } @@ -492,7 +501,8 @@ __glXDRIscreenProbe(ScreenPtr pScreen) screen); if (screen->driScreen == NULL) { - LogMessage(X_ERROR, "AIGLX error: Calling driver entry point failed"); + LogMessage(X_ERROR, + "AIGLX error: Calling driver entry point failed\n"); goto handle_error; } @@ -502,6 +512,9 @@ __glXDRIscreenProbe(ScreenPtr pScreen) __glXScreenInit(&screen->base, pScreen); + screen->base.GLXmajor = 1; + screen->base.GLXminor = 4; + LogMessage(X_INFO, "AIGLX: Loaded and initialized %s\n", filename); @@ -518,7 +531,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen) return NULL; } -__GLXprovider __glXDRISWRastProvider = { +_X_EXPORT __GLXprovider __glXDRISWRastProvider = { __glXDRIscreenProbe, "DRISWRAST", NULL diff --git a/xserver/glx/glxext.c b/xserver/glx/glxext.c index ca1d2ec8d..89e58b0b0 100644 --- a/xserver/glx/glxext.c +++ b/xserver/glx/glxext.c @@ -28,7 +28,6 @@ * Silicon Graphics, Inc. */ -#define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif @@ -37,6 +36,7 @@ #include "glxserver.h" #include <windowstr.h> #include <propertyst.h> +#include <registry.h> #include "privates.h" #include <os.h> #include "g_disptab.h" @@ -126,6 +126,17 @@ static Bool DrawableGone(__GLXdrawable *glxPriv, XID xid) { __GLXcontext *c; + /* If this drawable was created using glx 1.3 drawable + * constructors, we added it as a glx drawable resource under both + * its glx drawable ID and it X drawable ID. Remove the other + * resource now so we don't a callback for freed memory. */ + if (glxPriv->drawId != glxPriv->pDraw->id) { + if (xid == glxPriv->drawId) + FreeResourceByType(glxPriv->pDraw->id, __glXDrawableRes, TRUE); + else + FreeResourceByType(glxPriv->drawId, __glXDrawableRes, TRUE); + } + for (c = glxAllContexts; c; c = c->next) { if (c->isCurrent && (c->drawPriv == glxPriv || c->readPriv == glxPriv)) { int i; @@ -171,14 +182,20 @@ void __glXAddToContextList(__GLXcontext *cx) glxAllContexts = cx; } -void __glXRemoveFromContextList(__GLXcontext *cx) +static void __glXRemoveFromContextList(__GLXcontext *cx) { - __GLXcontext *c, **prev; + __GLXcontext *c, *prev; - prev = &glxAllContexts; - for (c = glxAllContexts; c; c = c->next) - if (c == cx) - *prev = c->next; + if (cx == glxAllContexts) + glxAllContexts = cx->next; + else { + prev = glxAllContexts; + for (c = glxAllContexts; c; c = c->next) { + if (c == cx) + prev->next = c->next; + prev = c; + } + } } /* @@ -261,6 +278,7 @@ GLboolean __glXErrorOccured(void) } static int __glXErrorBase; +int __glXEventBase; int __glXError(int error) { @@ -337,9 +355,14 @@ void GlxExtensionInit(void) __GLXprovider *p; Bool glx_provided = False; - __glXContextRes = CreateNewResourceType((DeleteType)ContextGone); - __glXDrawableRes = CreateNewResourceType((DeleteType)DrawableGone); - __glXSwapBarrierRes = CreateNewResourceType((DeleteType)SwapBarrierGone); + __glXContextRes = CreateNewResourceType((DeleteType)ContextGone, + "GLXContext"); + __glXDrawableRes = CreateNewResourceType((DeleteType)DrawableGone, + "GLXDrawable"); + __glXSwapBarrierRes = CreateNewResourceType((DeleteType)SwapBarrierGone, + "GLXSwapBarrier"); + if (!__glXContextRes || !__glXDrawableRes || !__glXSwapBarrierRes) + return; if (!dixRequestPrivate(glxClientPrivateKey, sizeof (__GLXclientState))) return; @@ -350,12 +373,18 @@ void GlxExtensionInit(void) pScreen = screenInfo.screens[i]; for (p = __glXProviderStack; p != NULL; p = p->next) { - if (p->screenProbe(pScreen) != NULL) { + __GLXscreen *glxScreen; + + glxScreen = p->screenProbe(pScreen); + if (glxScreen != NULL) { + if (glxScreen->GLXminor < glxMinorVersion) + glxMinorVersion = glxScreen->GLXminor; LogMessage(X_INFO, "GLX: Initialized %s GL provider for screen %d\n", p->name, i); break; } + } if (!p) @@ -386,6 +415,7 @@ void GlxExtensionInit(void) } __glXErrorBase = extEntry->errorBase; + __glXEventBase = extEntry->eventBase; } /************************************************************************/ @@ -429,6 +459,9 @@ __GLXcontext *__glXForceCurrent(__GLXclientState *cl, GLXContextTag tag, } } + if (cx->wait && (*cx->wait)(cx, cl, error)) + return NULL; + if (cx == __glXLastContext) { /* No need to re-bind */ return cx; diff --git a/xserver/glx/glxscreens.c b/xserver/glx/glxscreens.c index 95d35eb67..b75aea6f2 100644 --- a/xserver/glx/glxscreens.c +++ b/xserver/glx/glxscreens.c @@ -42,6 +42,7 @@ #include "glxserver.h" #include "glxutil.h" #include "glxext.h" +#include "protocol-versions.h" static int glxScreenPrivateKeyIndex; static DevPrivateKey glxScreenPrivateKey = &glxScreenPrivateKeyIndex; @@ -162,7 +163,8 @@ static const char GLServerExtensions[] = ** supported across all screens in a multi-screen system. */ static char GLXServerVendorName[] = "SGI"; -static char GLXServerVersion[] = "1.2"; +unsigned glxMajorVersion = SERVER_GLX_MAJOR_VERSION; +unsigned glxMinorVersion = SERVER_GLX_MINOR_VERSION; static char GLXServerExtensions[] = "GLX_ARB_multisample " "GLX_EXT_visual_info " @@ -177,7 +179,9 @@ static char GLXServerExtensions[] = "GLX_SGIX_swap_barrier " #endif "GLX_SGIX_fbconfig " + "GLX_SGIX_pbuffer " "GLX_MESA_copy_sub_buffer " + "GLX_INTEL_swap_event" ; /* @@ -223,8 +227,8 @@ glxGetScreen(ScreenPtr pScreen) return dixLookupPrivate(&pScreen->devPrivates, glxScreenPrivateKey); } -void GlxSetVisualConfigs(int nconfigs, - __GLXvisualConfig *configs, void **privates) +_X_EXPORT void GlxSetVisualConfigs(int nconfigs, + void *configs, void **privates) { /* We keep this stub around for the DDX drivers that still * call it. */ @@ -248,10 +252,7 @@ GLint glxConvertToXVisualType(int visualType) static VisualPtr AddScreenVisuals(ScreenPtr pScreen, int count, int d) { - XID *installedCmaps, *vids, vid; - int numInstalledCmaps, numVisuals, i, j; - VisualPtr visuals; - ColormapPtr installedCmap; + int i; DepthPtr depth; depth = NULL; @@ -264,54 +265,8 @@ AddScreenVisuals(ScreenPtr pScreen, int count, int d) if (depth == NULL) return NULL; - /* Find the installed colormaps */ - installedCmaps = xalloc (pScreen->maxInstalledCmaps * sizeof (XID)); - if (!installedCmaps) - return NULL; - - numInstalledCmaps = pScreen->ListInstalledColormaps(pScreen, installedCmaps); - - /* realloc the visual array to fit the new one in place */ - numVisuals = pScreen->numVisuals; - visuals = xrealloc(pScreen->visuals, (numVisuals + count) * sizeof(VisualRec)); - if (!visuals) { - xfree(installedCmaps); - return NULL; - } - - vids = xrealloc(depth->vids, (depth->numVids + count) * sizeof(XID)); - if (vids == NULL) { - xfree(installedCmaps); - xfree(visuals); - return NULL; - } - - /* - * Fix up any existing installed colormaps -- we'll assume that - * the only ones created so far have been installed. If this - * isn't true, we'll have to walk the resource database looking - * for all colormaps. - */ - for (i = 0; i < numInstalledCmaps; i++) { - installedCmap = LookupIDByType (installedCmaps[i], RT_COLORMAP); - if (!installedCmap) - continue; - j = installedCmap->pVisual - pScreen->visuals; - installedCmap->pVisual = &visuals[j]; - } - - xfree(installedCmaps); - - for (i = 0; i < count; i++) { - vid = FakeClientID(0); - visuals[pScreen->numVisuals + i].vid = vid; - vids[depth->numVids + i] = vid; - } - - pScreen->visuals = visuals; - pScreen->numVisuals += count; - depth->vids = vids; - depth->numVids += count; + if (ResizeVisualArray(pScreen, count, depth) == FALSE) + return NULL; /* Return a pointer to the first of the added visuals. */ return pScreen->visuals + pScreen->numVisuals - count; @@ -400,9 +355,17 @@ void __glXScreenInit(__GLXscreen *pGlxScreen, ScreenPtr pScreen) pGlxScreen->pScreen = pScreen; pGlxScreen->GLextensions = xstrdup(GLServerExtensions); pGlxScreen->GLXvendor = xstrdup(GLXServerVendorName); - pGlxScreen->GLXversion = xstrdup(GLXServerVersion); pGlxScreen->GLXextensions = xstrdup(GLXServerExtensions); + /* All GLX providers must support all of the functionality required for at + * least GLX 1.2. If the provider supports a higher version, the GLXminor + * version can be changed in the provider's screen-probe routine. For + * most providers, the screen-probe routine is the caller of this + * function. + */ + pGlxScreen->GLXmajor = 1; + pGlxScreen->GLXminor = 2; + pGlxScreen->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = glxCloseScreen; @@ -474,7 +437,6 @@ void __glXScreenInit(__GLXscreen *pGlxScreen, ScreenPtr pScreen) void __glXScreenDestroy(__GLXscreen *screen) { xfree(screen->GLXvendor); - xfree(screen->GLXversion); xfree(screen->GLXextensions); xfree(screen->GLextensions); } diff --git a/xserver/glx/glxscreens.h b/xserver/glx/glxscreens.h index 34e441e7c..861e03ce8 100644 --- a/xserver/glx/glxscreens.h +++ b/xserver/glx/glxscreens.h @@ -134,10 +134,12 @@ struct __GLXscreen { __GLXconfig *modes, __GLXcontext *shareContext); - __GLXdrawable *(*createDrawable)(__GLXscreen *context, + __GLXdrawable *(*createDrawable)(ClientPtr client, + __GLXscreen *context, DrawablePtr pDraw, - int type, XID drawId, + int type, + XID glxDrawId, __GLXconfig *modes); int (*swapInterval) (__GLXdrawable *drawable, int interval); @@ -161,6 +163,17 @@ struct __GLXscreen { char *GLXversion; char *GLXextensions; + /** + * \name GLX version supported by this screen. + * + * Since the GLX version advertised by the server is for the whole server, + * the GLX protocol code uses the minimum version supported on all screens. + */ + /*@{*/ + unsigned GLXmajor; + unsigned GLXminor; + /*@}*/ + Bool (*CloseScreen)(int index, ScreenPtr pScreen); }; diff --git a/xserver/glx/glxserver.h b/xserver/glx/glxserver.h index a5ca0a20b..1daf97758 100644 --- a/xserver/glx/glxserver.h +++ b/xserver/glx/glxserver.h @@ -55,9 +55,15 @@ #define GL_GLEXT_PROTOTYPES /* we want prototypes */ #include <GL/gl.h> #include <GL/glxproto.h> -#include <GL/glxint.h> -/* For glxscreens.h */ +/* +** GLX resources. +*/ +typedef XID GLXContextID; +typedef XID GLXPixmap; +typedef XID GLXDrawable; + +typedef struct __GLXclientStateRec __GLXclientState; typedef struct __GLXdrawable __GLXdrawable; typedef struct __GLXcontext __GLXcontext; @@ -65,10 +71,6 @@ typedef struct __GLXcontext __GLXcontext; #include "glxdrawable.h" #include "glxcontext.h" - -#define GLX_SERVER_MAJOR_VERSION 1 -#define GLX_SERVER_MINOR_VERSION 2 - #ifndef True #define True 1 #endif @@ -76,15 +78,6 @@ typedef struct __GLXcontext __GLXcontext; #define False 0 #endif -/* -** GLX resources. -*/ -typedef XID GLXContextID; -typedef XID GLXPixmap; -typedef XID GLXDrawable; - -typedef struct __GLXclientStateRec __GLXclientState; - extern __GLXscreen *glxGetScreen(ScreenPtr pScreen); extern __GLXclientState *glxGetClient(ClientPtr pClient); @@ -93,10 +86,7 @@ extern __GLXclientState *glxGetClient(ClientPtr pClient); void GlxExtensionInit(void); void GlxSetVisualConfigs(int nconfigs, - __GLXvisualConfig *configs, void **privates); - -struct _glapi_table; -void GlxSetRenderTables (struct _glapi_table *table); + void *configs, void **privates); void __glXScreenInitVisuals(__GLXscreen *screen); @@ -256,4 +246,9 @@ extern int __glXImageSize(GLenum format, GLenum type, GLint imageHeight, GLint rowLength, GLint skipImages, GLint skipRows, GLint alignment); +extern unsigned glxMajorVersion; +extern unsigned glxMinorVersion; + +extern int __glXEventBase; + #endif /* !__GLX_server_h__ */ diff --git a/xserver/glx/glxutil.c b/xserver/glx/glxutil.c deleted file mode 100644 index bc71087d4..000000000 --- a/xserver/glx/glxutil.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) - * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice including the dates of first publication and - * either this permission notice or a reference to - * http://oss.sgi.com/projects/FreeB/ - * shall be included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Silicon Graphics, Inc. - * shall not be used in advertising or otherwise to promote the sale, use or - * other dealings in this Software without prior written authorization from - * Silicon Graphics, Inc. - */ - -#define NEED_REPLIES -#define FONT_PCF -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <string.h> - -#include "glxserver.h" -#include "glxutil.h" - -/*****************************************************************************/ -/* Drawable private stuff */ - -void -__glXRefDrawable(__GLXdrawable *glxPriv) -{ - glxPriv->refCount++; -} - -void -__glXUnrefDrawable(__GLXdrawable *glxPriv) -{ - glxPriv->refCount--; - if (glxPriv->refCount == 0) { - /* remove the drawable from the drawable list */ - FreeResourceByType(glxPriv->drawId, __glXDrawableRes, FALSE); - glxPriv->destroy(glxPriv); - } -} - -GLboolean -__glXDrawableInit(__GLXdrawable *drawable, - __GLXscreen *screen, DrawablePtr pDraw, int type, - XID drawId, __GLXconfig *config) -{ - drawable->pDraw = pDraw; - drawable->type = type; - drawable->drawId = drawId; - drawable->refCount = 1; - drawable->config = config; - drawable->eventMask = 0; - - return GL_TRUE; -} diff --git a/xserver/glx/indirect_dispatch.c b/xserver/glx/indirect_dispatch.c index 6547f5d96..ecd2bc8de 100644 --- a/xserver/glx/indirect_dispatch.c +++ b/xserver/glx/indirect_dispatch.c @@ -98,8 +98,6 @@ void __glXDisp_CallLists(GLbyte * pc) const GLenum type = *(GLenum *)(pc + 4); const GLvoid * lists = (const GLvoid *)(pc + 8); - lists = (const GLvoid *) (pc + 8); - CALL_CallLists( GET_DISPATCH(), ( n, type, @@ -3743,7 +3741,7 @@ void __glXDisp_ResetMinmax(GLbyte * pc) void __glXDisp_TexImage3D(GLbyte * pc) { const CARD32 ptr_is_null = *(CARD32 *)(pc + 76); - const GLvoid * const pixels = (const GLvoid *) (ptr_is_null != 0) ? NULL : (pc + 80); + const GLvoid * const pixels = (const GLvoid *) ((ptr_is_null != 0) ? NULL : (pc + 80)); __GLXpixel3DHeader * const hdr = (__GLXpixel3DHeader *)(pc); CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); diff --git a/xserver/glx/indirect_dispatch.h b/xserver/glx/indirect_dispatch.h index 014e417c9..6cc322c24 100644 --- a/xserver/glx/indirect_dispatch.h +++ b/xserver/glx/indirect_dispatch.h @@ -28,7 +28,7 @@ #if !defined( _INDIRECT_DISPATCH_H_ ) # define _INDIRECT_DISPATCH_H_ -# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__) +# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))) && defined(__ELF__) # define HIDDEN __attribute__((visibility("hidden"))) # else # define HIDDEN diff --git a/xserver/glx/indirect_dispatch_swap.c b/xserver/glx/indirect_dispatch_swap.c index 0b8c27cac..3221c809d 100644 --- a/xserver/glx/indirect_dispatch_swap.c +++ b/xserver/glx/indirect_dispatch_swap.c @@ -3879,7 +3879,7 @@ void __glXDispSwap_ResetMinmax(GLbyte * pc) void __glXDispSwap_TexImage3D(GLbyte * pc) { const CARD32 ptr_is_null = *(CARD32 *)(pc + 76); - const GLvoid * const pixels = (const GLvoid *) (ptr_is_null != 0) ? NULL : (pc + 80); + const GLvoid * const pixels = (const GLvoid *) ((ptr_is_null != 0) ? NULL : (pc + 80)); __GLXpixel3DHeader * const hdr = (__GLXpixel3DHeader *)(pc); CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); diff --git a/xserver/glx/indirect_program.c b/xserver/glx/indirect_program.c index d23a0a9e6..237da2908 100644 --- a/xserver/glx/indirect_program.c +++ b/xserver/glx/indirect_program.c @@ -29,7 +29,6 @@ * \author Ian Romanick <idr@us.ibm.com> */ -#define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif @@ -103,7 +102,7 @@ int DoGetProgramString(struct __GLXclientStateRec *cl, GLbyte *pc, CALL_by_offset(GET_DISPATCH(), (void (GLAPIENTRYP)(GLuint, GLenum, GLubyte *)), get_program_string_offset, - (target, pname, answer)); + (target, pname, (GLubyte *)answer)); } if (__glXErrorOccured()) { diff --git a/xserver/glx/indirect_reqsize.c b/xserver/glx/indirect_reqsize.c index c47f01ee9..35bb9370f 100644 --- a/xserver/glx/indirect_reqsize.c +++ b/xserver/glx/indirect_reqsize.c @@ -39,12 +39,12 @@ #endif #ifdef HAVE_ALIAS # define ALIAS2(from,to) \ - GLint __glX ## from ## ReqSize( const GLbyte * pc, Bool swap ) \ + int __glX ## from ## ReqSize( const GLbyte * pc, Bool swap ) \ __attribute__ ((alias( # to ))); # define ALIAS(from,to) ALIAS2( from, __glX ## to ## ReqSize ) #else # define ALIAS(from,to) \ - GLint __glX ## from ## ReqSize( const GLbyte * pc, Bool swap ) \ + int __glX ## from ## ReqSize( const GLbyte * pc, Bool swap ) \ { return __glX ## to ## ReqSize( pc, swap ); } #endif diff --git a/xserver/glx/indirect_reqsize.h b/xserver/glx/indirect_reqsize.h index 26211ee5c..05ad5913f 100644 --- a/xserver/glx/indirect_reqsize.h +++ b/xserver/glx/indirect_reqsize.h @@ -28,13 +28,13 @@ #if !defined( _INDIRECT_REQSIZE_H_ ) # define _INDIRECT_REQSIZE_H_ -# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__) +# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))) && defined(__ELF__) # define HIDDEN __attribute__((visibility("hidden"))) # else # define HIDDEN # endif -# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) # define PURE __attribute__((pure)) # else # define PURE diff --git a/xserver/glx/indirect_size.h b/xserver/glx/indirect_size.h index 9ba0bd690..af0919f96 100644 --- a/xserver/glx/indirect_size.h +++ b/xserver/glx/indirect_size.h @@ -36,7 +36,7 @@ * \author Ian Romanick <idr@us.ibm.com> */ -# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) # define PURE __attribute__((pure)) # else # define PURE @@ -48,7 +48,7 @@ # define FASTCALL # endif -# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__) +# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))) && defined(__ELF__) # define INTERNAL __attribute__((visibility("internal"))) # else # define INTERNAL diff --git a/xserver/glx/indirect_size_get.c b/xserver/glx/indirect_size_get.c index 80f81dec6..475aa58ee 100644 --- a/xserver/glx/indirect_size_get.c +++ b/xserver/glx/indirect_size_get.c @@ -32,7 +32,7 @@ #include "indirect_util.h" #include "indirect_size.h" -# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) # define PURE __attribute__((pure)) # else # define PURE @@ -44,7 +44,7 @@ # define FASTCALL # endif -# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__) +# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))) && defined(__ELF__) # define INTERNAL __attribute__((visibility("internal"))) # else # define INTERNAL diff --git a/xserver/glx/indirect_size_get.h b/xserver/glx/indirect_size_get.h index 4fcb55b4e..378baa673 100644 --- a/xserver/glx/indirect_size_get.h +++ b/xserver/glx/indirect_size_get.h @@ -36,7 +36,7 @@ * \author Ian Romanick <idr@us.ibm.com> */ -# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) # define PURE __attribute__((pure)) # else # define PURE @@ -48,7 +48,7 @@ # define FASTCALL # endif -# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__) +# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))) && defined(__ELF__) # define INTERNAL __attribute__((visibility("internal"))) # else # define INTERNAL diff --git a/xserver/glx/indirect_texture_compression.c b/xserver/glx/indirect_texture_compression.c index 3c09663fc..5f44d7b1a 100644 --- a/xserver/glx/indirect_texture_compression.c +++ b/xserver/glx/indirect_texture_compression.c @@ -23,7 +23,6 @@ * SOFTWARE. */ -#define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif @@ -53,7 +52,7 @@ int __glXDisp_GetCompressedTexImageARB(struct __GLXclientStateRec *cl, GLbyte *p const GLenum target = *(GLenum *)(pc + 0); const GLint level = *(GLint *)(pc + 4); GLint compsize = 0; - char *answer, answerBuffer[200]; + char *answer = NULL, answerBuffer[200]; CALL_GetTexLevelParameteriv(GET_DISPATCH(), (target, level, GL_TEXTURE_COMPRESSED_IMAGE_SIZE, &compsize)); @@ -93,7 +92,7 @@ int __glXDispSwap_GetCompressedTexImageARB(struct __GLXclientStateRec *cl, GLbyt const GLenum target = (GLenum) bswap_32( *(int *)(pc + 0) ); const GLint level = (GLint ) bswap_32( *(int *)(pc + 4) ); GLint compsize = 0; - char *answer, answerBuffer[200]; + char *answer = NULL, answerBuffer[200]; CALL_GetTexLevelParameteriv(GET_DISPATCH(), (target, level, GL_TEXTURE_COMPRESSED_IMAGE_SIZE, &compsize)); diff --git a/xserver/glx/indirect_util.c b/xserver/glx/indirect_util.c index 58c194c99..44309104e 100644 --- a/xserver/glx/indirect_util.c +++ b/xserver/glx/indirect_util.c @@ -126,7 +126,7 @@ __glXSendReply( ClientPtr client, const void * data, size_t elements, elements = 0; } else if ( (elements > 1) || always_array ) { - reply_ints = ((elements * element_size) + 3) >> 2; + reply_ints = bytes_to_int32(elements * element_size); } __glXReply.length = reply_ints; @@ -174,7 +174,7 @@ __glXSendReplySwap( ClientPtr client, const void * data, size_t elements, elements = 0; } else if ( (elements > 1) || always_array ) { - reply_ints = ((elements * element_size) + 3) >> 2; + reply_ints = bytes_to_int32(elements * element_size); } __glXReply.length = bswap_32( reply_ints ); diff --git a/xserver/glx/render2.c b/xserver/glx/render2.c index a86a22acb..eb7c30ba0 100644 --- a/xserver/glx/render2.c +++ b/xserver/glx/render2.c @@ -28,7 +28,6 @@ * Silicon Graphics, Inc. */ -/* #define NEED_REPLIES */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif @@ -252,8 +251,3 @@ void __glXDisp_DrawArrays(GLbyte *pc) CALL_DisableClientState( GET_DISPATCH(), (GL_SECONDARY_COLOR_ARRAY) ); CALL_DisableClientState( GET_DISPATCH(), (GL_FOG_COORD_ARRAY) ); } - -void __glXDisp_DrawArraysEXT(GLbyte *pc) -{ - __glXDisp_DrawArrays(pc); -} diff --git a/xserver/glx/render2swap.c b/xserver/glx/render2swap.c index 49449ff6f..17354c4f8 100644 --- a/xserver/glx/render2swap.c +++ b/xserver/glx/render2swap.c @@ -28,7 +28,6 @@ * Silicon Graphics, Inc. */ -/* #define NEED_REPLIES */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif @@ -363,8 +362,3 @@ void __glXDispSwap_DrawArrays(GLbyte *pc) CALL_DisableClientState( GET_DISPATCH(), (GL_SECONDARY_COLOR_ARRAY) ); CALL_DisableClientState( GET_DISPATCH(), (GL_FOG_COORD_ARRAY) ); } - -void __glXDispSwap_DrawArraysEXT(GLbyte *pc) -{ - __glXDispSwap_DrawArrays(pc); -} diff --git a/xserver/glx/renderpix.c b/xserver/glx/renderpix.c index 17deb33c4..056e62c87 100644 --- a/xserver/glx/renderpix.c +++ b/xserver/glx/renderpix.c @@ -28,7 +28,6 @@ * Silicon Graphics, Inc. */ -#define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/xserver/glx/renderpixswap.c b/xserver/glx/renderpixswap.c index ebb20cfda..9cd57410e 100644 --- a/xserver/glx/renderpixswap.c +++ b/xserver/glx/renderpixswap.c @@ -28,7 +28,6 @@ * Silicon Graphics, Inc. */ -#define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/xserver/glx/rensize.c b/xserver/glx/rensize.c index 5c6b1500d..8a58e08d7 100644 --- a/xserver/glx/rensize.c +++ b/xserver/glx/rensize.c @@ -195,7 +195,7 @@ int __glXImageSize( GLenum format, GLenum type, GLenum target, } else { groupsPerRow = w; } - rowSize = (groupsPerRow + 7) >> 3; + rowSize = bits_to_bytes(groupsPerRow); padding = (rowSize % alignment); if (padding) { rowSize += alignment - padding; diff --git a/xserver/glx/single2.c b/xserver/glx/single2.c index 09065ae00..3d662e525 100644 --- a/xserver/glx/single2.c +++ b/xserver/glx/single2.c @@ -28,7 +28,6 @@ * Silicon Graphics, Inc. */ -#define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif @@ -336,6 +335,9 @@ int DoGetString(__GLXclientState *cl, GLbyte *pc, GLboolean need_swap) string = (const char *) CALL_GetString( GET_DISPATCH(), (name) ); client = cl->client; + if (string == NULL) + string = ""; + /* ** Restrict extensions to those that are supported by both the ** implementation and the connection. That is, return the diff --git a/xserver/glx/single2swap.c b/xserver/glx/single2swap.c index fcb0657d4..cf83bdc88 100644 --- a/xserver/glx/single2swap.c +++ b/xserver/glx/single2swap.c @@ -28,7 +28,6 @@ * Silicon Graphics, Inc. */ -#define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/xserver/glx/singlepix.c b/xserver/glx/singlepix.c index 6611b0380..a0a6a7918 100644 --- a/xserver/glx/singlepix.c +++ b/xserver/glx/singlepix.c @@ -28,7 +28,6 @@ * Silicon Graphics, Inc. */ -#define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif @@ -92,6 +91,7 @@ int __glXDisp_ReadPixels(__GLXclientState *cl, GLbyte *pc) __GLX_SEND_HEADER(); __GLX_SEND_VOID_ARRAY(compsize); } + __GLX_NOTE_FLUSHED_CMDS(cx); return Success; } diff --git a/xserver/glx/singlepixswap.c b/xserver/glx/singlepixswap.c index b546ec864..a7febc9a6 100644 --- a/xserver/glx/singlepixswap.c +++ b/xserver/glx/singlepixswap.c @@ -28,7 +28,6 @@ * Silicon Graphics, Inc. */ -#define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif @@ -103,6 +102,7 @@ int __glXDispSwap_ReadPixels(__GLXclientState *cl, GLbyte *pc) __GLX_SEND_HEADER(); __GLX_SEND_VOID_ARRAY(compsize); } + __GLX_NOTE_FLUSHED_CMDS(cx); return Success; } diff --git a/xserver/glx/swap_interval.c b/xserver/glx/swap_interval.c index 24abd69fa..0bae3247e 100644 --- a/xserver/glx/swap_interval.c +++ b/xserver/glx/swap_interval.c @@ -22,7 +22,6 @@ * USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif @@ -54,8 +53,6 @@ int DoSwapInterval(__GLXclientState *cl, GLbyte *pc, int do_swap) cx = __glXLookupContextByTag(cl, tag); - LogMessage(X_ERROR, "%s: cx = %p, GLX screen = %p\n", __func__, - cx, (cx == NULL) ? NULL : cx->pGlxScreen); if ((cx == NULL) || (cx->pGlxScreen == NULL)) { client->errorValue = tag; return __glXError(GLXBadContext); @@ -69,7 +66,7 @@ int DoSwapInterval(__GLXclientState *cl, GLbyte *pc, int do_swap) if (cx->drawPriv == NULL) { client->errorValue = tag; - return __glXError(GLXBadDrawable); + return BadValue; } pc += __GLX_VENDPRIV_HDR_SIZE; @@ -77,6 +74,9 @@ int DoSwapInterval(__GLXclientState *cl, GLbyte *pc, int do_swap) ? bswap_32(*(int *)(pc + 0)) : *(int *)(pc + 0); + if (interval <= 0) + return BadValue; + (void) (*cx->pGlxScreen->swapInterval)(cx->drawPriv, interval); return Success; } diff --git a/xserver/glx/unpack.h b/xserver/glx/unpack.h index a1dd17d52..90cb71bd7 100644 --- a/xserver/glx/unpack.h +++ b/xserver/glx/unpack.h @@ -47,7 +47,7 @@ ** Fetch a double from potentially unaligned memory. */ #ifdef __GLX_ALIGN64 -#define __GLX_MEM_COPY(dst,src,n) if (src && dst) memcpy(dst,src,n) +#define __GLX_MEM_COPY(dst,src,n) if (src != NULL && dst != NULL) memcpy(dst,src,n) #define __GLX_GET_DOUBLE(dst,src) __GLX_MEM_COPY(&dst,src,8) #else #define __GLX_GET_DOUBLE(dst,src) (dst) = *((GLdouble*)(src)) diff --git a/xserver/glx/xfont.c b/xserver/glx/xfont.c index 6df373a16..b8b466d87 100644 --- a/xserver/glx/xfont.c +++ b/xserver/glx/xfont.c @@ -28,7 +28,6 @@ * Silicon Graphics, Inc. */ -#define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif @@ -181,12 +180,17 @@ int __glXDisp_UseXFont(__GLXclientState *cl, GLbyte *pc) ** Font can actually be either the ID of a font or the ID of a GC ** containing a font. */ - pFont = (FontPtr)LookupIDByType(req->font, RT_FONT); - if (!pFont) { - pGC = (GC *)LookupIDByType(req->font, RT_GC); - if (!pGC) { + + error = dixLookupResourceByType((pointer *)&pFont, + req->font, RT_FONT, + client, DixReadAccess); + if (error != Success) { + error = dixLookupResourceByType((pointer *)&pGC, + req->font, RT_GC, + client, DixReadAccess); + if (error != Success) { client->errorValue = req->font; - return BadFont; + return error == BadGC ? BadFont : error; } pFont = pGC->font; } |