aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/glx
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/glx')
-rw-r--r--xorg-server/glx/Makefile.am1
-rw-r--r--xorg-server/glx/Makefile.in36
-rw-r--r--xorg-server/glx/extension_string.c2
-rw-r--r--xorg-server/glx/glapi.c5
-rw-r--r--xorg-server/glx/glthread.c9
-rw-r--r--xorg-server/glx/glxcmds.c281
-rw-r--r--xorg-server/glx/glxcmdsswap.c2
-rw-r--r--xorg-server/glx/glxdrawable.h5
-rw-r--r--xorg-server/glx/glxdri.c18
-rw-r--r--xorg-server/glx/glxdri2.c15
-rw-r--r--xorg-server/glx/glxdriswrast.c12
-rw-r--r--xorg-server/glx/glxext.c24
-rw-r--r--xorg-server/glx/glxscreens.c40
-rw-r--r--xorg-server/glx/glxscreens.h1
-rw-r--r--xorg-server/glx/glxserver.h6
-rw-r--r--xorg-server/glx/indirect_dispatch.c2
-rw-r--r--xorg-server/glx/indirect_dispatch_swap.c2
-rw-r--r--xorg-server/glx/indirect_program.c3
-rw-r--r--xorg-server/glx/indirect_reqsize.c4
-rw-r--r--xorg-server/glx/indirect_texture_compression.c1
-rw-r--r--xorg-server/glx/indirect_util.c4
-rw-r--r--xorg-server/glx/render2.c6
-rw-r--r--xorg-server/glx/render2swap.c6
-rw-r--r--xorg-server/glx/renderpix.c1
-rw-r--r--xorg-server/glx/renderpixswap.c1
-rw-r--r--xorg-server/glx/rensize.c2
-rw-r--r--xorg-server/glx/single2.c4
-rw-r--r--xorg-server/glx/single2swap.c1
-rw-r--r--xorg-server/glx/singlepix.c2
-rw-r--r--xorg-server/glx/singlepixswap.c2
-rw-r--r--xorg-server/glx/swap_interval.c1
-rw-r--r--xorg-server/glx/xfont.c16
32 files changed, 293 insertions, 222 deletions
diff --git a/xorg-server/glx/Makefile.am b/xorg-server/glx/Makefile.am
index 6facc2011..a23ae0a47 100644
--- a/xorg-server/glx/Makefile.am
+++ b/xorg-server/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@ \
diff --git a/xorg-server/glx/Makefile.in b/xorg-server/glx/Makefile.in
index 4eeb62b6b..515cc690c 100644
--- a/xorg-server/glx/Makefile.in
+++ b/xorg-server/glx/Makefile.in
@@ -39,8 +39,11 @@ 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)/m4/libtool.m4 \
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+ $(top_srcdir)/m4/shave.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
@@ -50,7 +53,8 @@ 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 =
CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
@@ -94,6 +98,7 @@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
ALLOCA = @ALLOCA@
AMTAR = @AMTAR@
+AM_MAKEFLAGS = @AM_MAKEFLAGS@
APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
APPLE_APPLICATION_ID = @APPLE_APPLICATION_ID@
APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@
@@ -114,9 +119,12 @@ CCASDEPMODE = @CCASDEPMODE@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
+CHANGELOG_CMD = @CHANGELOG_CMD@
COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CWARNFLAGS = @CWARNFLAGS@
+CXX = @CXX@
CYGPATH_W = @CYGPATH_W@
DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
@@ -145,7 +153,9 @@ 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_LIBS = @DRI_LIBS@
DSYMUTIL = @DSYMUTIL@
DTRACE = @DTRACE@
DUMPBIN = @DUMPBIN@
@@ -154,9 +164,13 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
+F77 = @F77@
+FC = @FC@
FGREP = @FGREP@
FILE_MAN_DIR = @FILE_MAN_DIR@
FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_LIBS = @GLIB_LIBS@
GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
GLX_DEFINES = @GLX_DEFINES@
GL_CFLAGS = @GL_CFLAGS@
@@ -195,12 +209,13 @@ LTCOMPILE = @LTCOMPILE@
LTCXXCOMPILE = @LTCXXCOMPILE@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
+MAIN_LIB = @MAIN_LIB@
+MAKEFLAGS = @MAKEFLAGS@
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@
@@ -220,7 +235,6 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
@@ -230,6 +244,7 @@ PERL = @PERL@
PKG_CONFIG = @PKG_CONFIG@
PROJECTROOT = @PROJECTROOT@
PS2PDF = @PS2PDF@
+Q = @Q@
RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
@@ -243,11 +258,10 @@ 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@
+V = @V@
VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
-VENDOR_RELEASE = @VENDOR_RELEASE@
VERSION = @VERSION@
+WINDRES = @WINDRES@
X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
XDMCP_CFLAGS = @XDMCP_CFLAGS@
@@ -283,6 +297,7 @@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
XORG_SYS_LIBS = @XORG_SYS_LIBS@
XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@
XPBPROXY_LIBS = @XPBPROXY_LIBS@
+XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@
XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
XSDL_INCS = @XSDL_INCS@
@@ -307,7 +322,6 @@ 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@
@@ -330,6 +344,7 @@ build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
+distcleancheck_listfiles = @distcleancheck_listfiles@
docdir = @docdir@
driverdir = @driverdir@
dvidir = @dvidir@
@@ -361,7 +376,9 @@ psdir = @psdir@
sbindir = @sbindir@
sdkdir = @sdkdir@
sharedstatedir = @sharedstatedir@
+shavedir = @shavedir@
srcdir = @srcdir@
+symbol_visibility = @symbol_visibility@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
@@ -372,6 +389,7 @@ noinst_LTLIBRARIES = libglx.la $(GLXDRI_LIBRARY)
AM_CFLAGS = \
@DIX_CFLAGS@ \
@GL_CFLAGS@ \
+ @DRI_CFLAGS@ \
@XLIB_CFLAGS@ \
@LIBDRM_CFLAGS@ \
@DRIPROTO_CFLAGS@ \
diff --git a/xorg-server/glx/extension_string.c b/xorg-server/glx/extension_string.c
index a4b202af3..9d110cf98 100644
--- a/xorg-server/glx/extension_string.c
+++ b/xorg-server/glx/extension_string.c
@@ -80,7 +80,7 @@ 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, },
{ NULL }
};
diff --git a/xorg-server/glx/glapi.c b/xorg-server/glx/glapi.c
index 94a804329..fa3808e4d 100644
--- a/xorg-server/glx/glapi.c
+++ b/xorg-server/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
@@ -242,7 +243,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/xorg-server/glx/glthread.c b/xorg-server/glx/glthread.c
index b818f4e26..4caaea110 100644
--- a/xorg-server/glx/glthread.c
+++ b/xorg-server/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,7 +126,7 @@ _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 */
@@ -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/xorg-server/glx/glxcmds.c b/xorg-server/glx/glxcmds.c
index ff8b126be..f5632d162 100644
--- a/xorg-server/glx/glxcmds.c
+++ b/xorg-server/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,58 @@ 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 (rc == BadValue ||
+ (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 +225,8 @@ DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
{
ClientPtr client = cl->client;
__GLXcontext *glxc, *shareglxc;
-
+ int err;
+
LEGAL_NEW_RESOURCE(gcId, client);
/*
@@ -196,11 +241,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 +359,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 +463,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 +476,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 +487,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,18 +499,13 @@ __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,
@@ -522,7 +537,7 @@ DoMakeCurrent(__GLXclientState *cl,
__GLXcontext *glxc, *prevglxc;
__GLXdrawable *drawPriv = NULL;
__GLXdrawable *readPriv = NULL;
- GLint error;
+ int error;
GLuint mask;
/*
@@ -563,11 +578,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 +702,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;
@@ -785,8 +792,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 +809,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 +870,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 +886,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 +895,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 +934,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 +960,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;
}
@@ -1131,7 +1139,11 @@ DoCreateGLXPixmap(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *config
int err;
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;
}
@@ -1146,14 +1158,18 @@ DoCreateGLXPixmap(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *config
}
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 +1233,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 +1259,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);
@@ -1360,9 +1364,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:
@@ -1490,12 +1497,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 +1568,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 +1599,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 +1681,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;
diff --git a/xorg-server/glx/glxcmdsswap.c b/xorg-server/glx/glxcmdsswap.c
index 65edf6991..f1c0ce69f 100644
--- a/xorg-server/glx/glxcmdsswap.c
+++ b/xorg-server/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
diff --git a/xorg-server/glx/glxdrawable.h b/xorg-server/glx/glxdrawable.h
index f5a040359..3f165ed4f 100644
--- a/xorg-server/glx/glxdrawable.h
+++ b/xorg-server/glx/glxdrawable.h
@@ -35,13 +35,12 @@
* 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 {
diff --git a/xorg-server/glx/glxdri.c b/xorg-server/glx/glxdri.c
index 64606ab5a..c9d226bdf 100644
--- a/xorg-server/glx/glxdri.c
+++ b/xorg-server/glx/glxdri.c
@@ -38,6 +38,7 @@
#include <windowstr.h>
#include <os.h>
+#include <damage.h>
#define _XF86DRI_SERVER_
#include <drm_sarea.h>
@@ -1086,7 +1087,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 +1098,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 +1108,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 +1126,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;
}
@@ -1138,6 +1140,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 +1158,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 +1189,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
return NULL;
}
-__GLXprovider __glXDRIProvider = {
+_X_EXPORT __GLXprovider __glXDRIProvider = {
__glXDRIscreenProbe,
"DRI",
NULL
diff --git a/xorg-server/glx/glxdri2.c b/xorg-server/glx/glxdri2.c
index 146ea828f..ed7fb4c4b 100644
--- a/xorg-server/glx/glxdri2.c
+++ b/xorg-server/glx/glxdri2.c
@@ -551,6 +551,15 @@ initializeExtensions(__GLXDRIscreen *screen)
LogMessage(X_INFO, "AIGLX: enabled GLX_MESA_copy_sub_buffer\n");
for (i = 0; extensions[i]; i++) {
+#ifdef __DRI_READ_DRAWABLE
+ if (strcmp(extensions[i]->name, __DRI_READ_DRAWABLE) == 0) {
+ __glXEnableExtension(screen->glx_enable_bits,
+ "GLX_SGI_make_current_read");
+
+ LogMessage(X_INFO, "AIGLX: enabled GLX_SGI_make_current_read\n");
+ }
+#endif
+
#ifdef __DRI_SWAP_CONTROL
if (strcmp(extensions[i]->name, __DRI_SWAP_CONTROL) == 0) {
screen->swapControl =
@@ -661,6 +670,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) {
@@ -693,7 +706,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
return NULL;
}
-__GLXprovider __glXDRI2Provider = {
+_X_EXPORT __GLXprovider __glXDRI2Provider = {
__glXDRIscreenProbe,
"DRI2",
NULL
diff --git a/xorg-server/glx/glxdriswrast.c b/xorg-server/glx/glxdriswrast.c
index f8c441e65..44f658fa9 100644
--- a/xorg-server/glx/glxdriswrast.c
+++ b/xorg-server/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;
@@ -492,7 +499,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;
}
@@ -518,7 +526,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
return NULL;
}
-__GLXprovider __glXDRISWRastProvider = {
+_X_EXPORT __GLXprovider __glXDRISWRastProvider = {
__glXDRIscreenProbe,
"DRISWRAST",
NULL
diff --git a/xorg-server/glx/glxext.c b/xorg-server/glx/glxext.c
index ca1d2ec8d..19d70d495 100644
--- a/xorg-server/glx/glxext.c
+++ b/xorg-server/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"
@@ -171,14 +171,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;
+ }
+ }
}
/*
@@ -341,6 +347,10 @@ void GlxExtensionInit(void)
__glXDrawableRes = CreateNewResourceType((DeleteType)DrawableGone);
__glXSwapBarrierRes = CreateNewResourceType((DeleteType)SwapBarrierGone);
+ RegisterResourceName(__glXContextRes, "GLXContext");
+ RegisterResourceName(__glXDrawableRes, "GLXDrawable");
+ RegisterResourceName(__glXSwapBarrierRes, "GLXSwapBarrier");
+
if (!dixRequestPrivate(glxClientPrivateKey, sizeof (__GLXclientState)))
return;
if (!AddCallback (&ClientStateCallback, glxClientCallback, 0))
diff --git a/xorg-server/glx/glxscreens.c b/xorg-server/glx/glxscreens.c
index 95d35eb67..81faddd04 100644
--- a/xorg-server/glx/glxscreens.c
+++ b/xorg-server/glx/glxscreens.c
@@ -177,6 +177,7 @@ static char GLXServerExtensions[] =
"GLX_SGIX_swap_barrier "
#endif
"GLX_SGIX_fbconfig "
+ "GLX_SGIX_pbuffer "
"GLX_MESA_copy_sub_buffer "
;
@@ -211,6 +212,7 @@ glxCloseScreen (int index, ScreenPtr pScreen)
__GLXscreen *pGlxScreen = glxGetScreen(pScreen);
pScreen->CloseScreen = pGlxScreen->CloseScreen;
+ pScreen->DestroyWindow = pGlxScreen->DestroyWindow;
pGlxScreen->destroy(pGlxScreen);
@@ -223,8 +225,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. */
@@ -253,6 +255,7 @@ AddScreenVisuals(ScreenPtr pScreen, int count, int d)
VisualPtr visuals;
ColormapPtr installedCmap;
DepthPtr depth;
+ int rc;
depth = NULL;
for (i = 0; i < pScreen->numDepths; i++) {
@@ -293,8 +296,10 @@ AddScreenVisuals(ScreenPtr pScreen, int count, int d)
* for all colormaps.
*/
for (i = 0; i < numInstalledCmaps; i++) {
- installedCmap = LookupIDByType (installedCmaps[i], RT_COLORMAP);
- if (!installedCmap)
+ rc = dixLookupResourceByType((pointer *)&installedCmap,
+ installedCmaps[i], RT_COLORMAP,
+ serverClient, DixReadAccess);
+ if (rc != Success)
continue;
j = installedCmap->pVisual - pScreen->visuals;
installedCmap->pVisual = &visuals[j];
@@ -391,6 +396,31 @@ pickFBConfig(__GLXscreen *pGlxScreen, VisualPtr visual)
return best;
}
+static Bool
+glxDestroyWindow(WindowPtr pWin)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ __GLXscreen *pGlxScreen = glxGetScreen(pScreen);
+ Bool retval = TRUE;
+
+ FreeResource(pWin->drawable.id, FALSE);
+
+ /* call lower wrapped functions */
+ if (pGlxScreen->DestroyWindow) {
+ /* unwrap */
+ pScreen->DestroyWindow = pGlxScreen->DestroyWindow;
+
+ /* call lower layers */
+ retval = (*pScreen->DestroyWindow)(pWin);
+
+ /* rewrap */
+ pGlxScreen->DestroyWindow = pScreen->DestroyWindow;
+ pScreen->DestroyWindow = glxDestroyWindow;
+ }
+
+ return retval;
+}
+
void __glXScreenInit(__GLXscreen *pGlxScreen, ScreenPtr pScreen)
{
__GLXconfig *m;
@@ -405,6 +435,8 @@ void __glXScreenInit(__GLXscreen *pGlxScreen, ScreenPtr pScreen)
pGlxScreen->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = glxCloseScreen;
+ pGlxScreen->DestroyWindow = pScreen->DestroyWindow;
+ pScreen->DestroyWindow = glxDestroyWindow;
i = 0;
for (m = pGlxScreen->fbconfigs; m != NULL; m = m->next) {
diff --git a/xorg-server/glx/glxscreens.h b/xorg-server/glx/glxscreens.h
index 34e441e7c..3c1bdd4ba 100644
--- a/xorg-server/glx/glxscreens.h
+++ b/xorg-server/glx/glxscreens.h
@@ -162,6 +162,7 @@ struct __GLXscreen {
char *GLXextensions;
Bool (*CloseScreen)(int index, ScreenPtr pScreen);
+ Bool (*DestroyWindow)(WindowPtr pWindow);
};
diff --git a/xorg-server/glx/glxserver.h b/xorg-server/glx/glxserver.h
index a5ca0a20b..46c938268 100644
--- a/xorg-server/glx/glxserver.h
+++ b/xorg-server/glx/glxserver.h
@@ -55,7 +55,6 @@
#define GL_GLEXT_PROTOTYPES /* we want prototypes */
#include <GL/gl.h>
#include <GL/glxproto.h>
-#include <GL/glxint.h>
/* For glxscreens.h */
typedef struct __GLXdrawable __GLXdrawable;
@@ -93,10 +92,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);
diff --git a/xorg-server/glx/indirect_dispatch.c b/xorg-server/glx/indirect_dispatch.c
index 6547f5d96..666551903 100644
--- a/xorg-server/glx/indirect_dispatch.c
+++ b/xorg-server/glx/indirect_dispatch.c
@@ -3743,7 +3743,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/xorg-server/glx/indirect_dispatch_swap.c b/xorg-server/glx/indirect_dispatch_swap.c
index 0b8c27cac..3221c809d 100644
--- a/xorg-server/glx/indirect_dispatch_swap.c
+++ b/xorg-server/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/xorg-server/glx/indirect_program.c b/xorg-server/glx/indirect_program.c
index d23a0a9e6..237da2908 100644
--- a/xorg-server/glx/indirect_program.c
+++ b/xorg-server/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/xorg-server/glx/indirect_reqsize.c b/xorg-server/glx/indirect_reqsize.c
index c47f01ee9..35bb9370f 100644
--- a/xorg-server/glx/indirect_reqsize.c
+++ b/xorg-server/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/xorg-server/glx/indirect_texture_compression.c b/xorg-server/glx/indirect_texture_compression.c
index 3c09663fc..25c6eb30e 100644
--- a/xorg-server/glx/indirect_texture_compression.c
+++ b/xorg-server/glx/indirect_texture_compression.c
@@ -23,7 +23,6 @@
* SOFTWARE.
*/
-#define NEED_REPLIES
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
diff --git a/xorg-server/glx/indirect_util.c b/xorg-server/glx/indirect_util.c
index 58c194c99..44309104e 100644
--- a/xorg-server/glx/indirect_util.c
+++ b/xorg-server/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/xorg-server/glx/render2.c b/xorg-server/glx/render2.c
index a86a22acb..eb7c30ba0 100644
--- a/xorg-server/glx/render2.c
+++ b/xorg-server/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/xorg-server/glx/render2swap.c b/xorg-server/glx/render2swap.c
index 49449ff6f..17354c4f8 100644
--- a/xorg-server/glx/render2swap.c
+++ b/xorg-server/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/xorg-server/glx/renderpix.c b/xorg-server/glx/renderpix.c
index 17deb33c4..056e62c87 100644
--- a/xorg-server/glx/renderpix.c
+++ b/xorg-server/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/xorg-server/glx/renderpixswap.c b/xorg-server/glx/renderpixswap.c
index ebb20cfda..9cd57410e 100644
--- a/xorg-server/glx/renderpixswap.c
+++ b/xorg-server/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/xorg-server/glx/rensize.c b/xorg-server/glx/rensize.c
index 5c6b1500d..8a58e08d7 100644
--- a/xorg-server/glx/rensize.c
+++ b/xorg-server/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/xorg-server/glx/single2.c b/xorg-server/glx/single2.c
index d8b259269..50a59ed71 100644
--- a/xorg-server/glx/single2.c
+++ b/xorg-server/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/xorg-server/glx/single2swap.c b/xorg-server/glx/single2swap.c
index fcb0657d4..cf83bdc88 100644
--- a/xorg-server/glx/single2swap.c
+++ b/xorg-server/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/xorg-server/glx/singlepix.c b/xorg-server/glx/singlepix.c
index 6611b0380..a0a6a7918 100644
--- a/xorg-server/glx/singlepix.c
+++ b/xorg-server/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/xorg-server/glx/singlepixswap.c b/xorg-server/glx/singlepixswap.c
index b546ec864..a7febc9a6 100644
--- a/xorg-server/glx/singlepixswap.c
+++ b/xorg-server/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/xorg-server/glx/swap_interval.c b/xorg-server/glx/swap_interval.c
index 24abd69fa..3a5242022 100644
--- a/xorg-server/glx/swap_interval.c
+++ b/xorg-server/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
diff --git a/xorg-server/glx/xfont.c b/xorg-server/glx/xfont.c
index 6df373a16..b8b466d87 100644
--- a/xorg-server/glx/xfont.c
+++ b/xorg-server/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;
}