summaryrefslogtreecommitdiffstats
path: root/src/glx
diff options
context:
space:
mode:
authorJon TURNEY <[email protected]>2014-05-12 10:47:07 +0100
committerJon TURNEY <[email protected]>2014-05-23 15:24:07 +0100
commit5a459a036e33683410bab4df431ed553bd0eeb66 (patch)
treef45ad877571c64d1163ba4c8afb5038eb75d32d1 /src/glx
parent45f9aae004f7bd723c3f313ee3dd8a25aa420ffa (diff)
Fix build of appleglx
Define GLX_USE_APPLEGL, as config/darwin used to, to turn on specific code to use the applegl direct renderer Convert src/glx/apple/Makefile to automake Since the applegl libGL is now built by linking libappleglx into libGL, rather than by linking selected files into a special libGL: - Remove duplicate code in apple/glxreply.c and apple/apple_glx.c. This makes apple/glxreply.c empty, so remove it - Some indirect rendering code is already guarded by !GLX_USE_APPLEGL, but we need to add those guards to indirect_glx.c, indirect_init.c (via it's generator), render2.c and vertarr.c so they don't generate anything Fix and update various includes glapi_gentable.c (which is only used on darwin), should be included in shared glapi as well, to provide _glapi_create_table_from_handle() Note that neither swrast nor indirect is supported in the APPLEGL path at the moment, which makes things more complex than they need to be. More untangling is needed to allow that v2: Correct apple/Makefile.am for srcdir != builddir Signed-off-by: Jon TURNEY <[email protected]> Reviewed-by: Jeremy Huddleston Sequoia <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/glx')
-rw-r--r--src/glx/Makefile.am11
-rw-r--r--src/glx/apple/Makefile131
-rw-r--r--src/glx/apple/Makefile.am33
-rw-r--r--src/glx/apple/apple_glapi.c1
-rw-r--r--src/glx/apple/apple_glx.c2
-rw-r--r--src/glx/apple/apple_glx.h1
-rw-r--r--src/glx/apple/apple_xgl_api_read.c1
-rw-r--r--src/glx/apple/apple_xgl_api_stereo.c7
-rw-r--r--src/glx/apple/apple_xgl_api_viewport.c1
-rw-r--r--src/glx/apple/glxreply.c134
-rw-r--r--src/glx/applegl_glx.c6
-rw-r--r--src/glx/glx_pbuffer.c2
-rw-r--r--src/glx/glxcmds.c4
-rw-r--r--src/glx/glxcurrent.c6
-rw-r--r--src/glx/glxext.c4
-rw-r--r--src/glx/indirect_glx.c4
-rw-r--r--src/glx/render2.c4
-rw-r--r--src/glx/vertarr.c3
18 files changed, 67 insertions, 288 deletions
diff --git a/src/glx/Makefile.am b/src/glx/Makefile.am
index 4553de01a17..cdd898efc87 100644
--- a/src/glx/Makefile.am
+++ b/src/glx/Makefile.am
@@ -24,7 +24,7 @@ SHARED_GLAPI_CFLAGS = -DGLX_SHARED_GLAPI
SHARED_GLAPI_LIB = $(top_builddir)/src/mapi/shared-glapi/libglapi.la
endif
-SUBDIRS=. tests
+SUBDIRS =
if HAVE_XF86VIDMODE
EXTRA_DEFINES_XF86VIDMODE = -DXF86VIDMODE
@@ -86,6 +86,8 @@ libglx_la_SOURCES = \
glx_query.c \
glxhash.c
+libglx_la_LIBADD = $(top_builddir)/src/loader/libloader.la
+
if HAVE_DRISW
libglx_la_SOURCES += \
drisw_glx.c
@@ -114,9 +116,10 @@ endif
if HAVE_APPLEDRI
libglx_la_SOURCES += \
applegl_glx.c
-endif
-libglx_la_LIBADD = $(top_builddir)/src/loader/libloader.la
+SUBDIRS += apple
+libglx_la_LIBADD += $(builddir)/apple/libappleglx.la
+endif
GL_LIBS = \
libglx.la \
@@ -135,4 +138,6 @@ lib@GL_LIB@_la_SOURCES =
lib@GL_LIB@_la_LIBADD = $(GL_LIBS)
lib@GL_LIB@_la_LDFLAGS = $(GL_LDFLAGS)
+SUBDIRS += . tests
+
include $(top_srcdir)/install-lib-links.mk
diff --git a/src/glx/apple/Makefile b/src/glx/apple/Makefile
deleted file mode 100644
index 91a72189253..00000000000
--- a/src/glx/apple/Makefile
+++ /dev/null
@@ -1,131 +0,0 @@
-TOP = ../../..
-top_builddir = $(TOP)
-# This can be a filthy lie. But it doesn't currently build out-of-tree
-# anyway, so it's no worse than what we've got now.
-top_srcdir = $(TOP)
-
-include $(TOP)/configs/current
-
-#CC=gcc
-#GL_CFLAGS=-Wall -ggdb3 -Os -DHAVE_PTHREAD -D_REENTRANT $(RC_CFLAGS) $(CFLAGS)
-#GL_LDFLAGS=-L$(INSTALL_DIR)/lib -L$(X11_DIR)/lib $(LDFLAGS) -Wl,-single_module
-
-TCLSH=tclsh8.5
-MKDIR=mkdir
-INSTALL=install
-LN=ln
-RM=rm
-
-#INCLUDE=-I. -Iinclude -I.. -DGLX_ALIAS_UNSUPPORTED -I$(INSTALL_DIR)/include -I$(X11_DIR)/include
-
-#COMPILE=$(CC) $(INCLUDE) $(GL_CFLAGS) -c
-
-#The directory with the final binaries.
-BUILD_DIR=builds
-
-default: $(TOP)/$(LIB_DIR)/lib$(GL_LIB).$(LIB_EXT)
-
-SOURCES = \
- apple_cgl.c \
- apple_glx.c \
- apple_glx_context.c \
- apple_glx_drawable.c \
- apple_glx_log.c \
- apple_glx_pbuffer.c \
- apple_glx_pixmap.c \
- apple_glx_surface.c \
- apple_visual.c \
- apple_glapi.c \
- apple_xgl_api_read.c \
- apple_xgl_api_stereo.c \
- apple_xgl_api_viewport.c \
- appledri.c \
- ../create_context.c \
- ../clientattrib.c \
- ../compsize.c \
- ../glxconfig.c \
- glx_empty.c \
- ../glx_error.c \
- ../glx_pbuffer.c \
- ../glx_query.c \
- ../glxcmds.c \
- ../glxcurrent.c \
- ../glxext.c \
- ../glxextensions.c \
- ../glxhash.c \
- glxreply.c \
- ../pixel.c \
- ../xfont.c \
- ../applegl_glx.c
-
-include $(TOP)/src/mesa/Makefile.sources
-
-# override GLAPI_LIB
-GLAPI_LIB = $(TOP)/src/mapi/glapi/libglapi.a
-
-LDFLAGS += -lXplugin -framework ApplicationServices -framework CoreFoundation
-
-OBJECTS = $(SOURCES:.c=.o)
-
-INCLUDES = -I. -Iinclude -I..\
- -I$(TOP)/include \
- -I$(TOP)/include/GL/internal \
- -I$(TOP)/src/mesa \
- -I$(TOP)/src/mesa/main \
- -I$(TOP)/src/mapi \
- -I$(TOP)/src/mapi/glapi \
- $(LIBDRM_CFLAGS) \
- $(DRI2PROTO_CFLAGS) \
- $(X11_INCLUDES)
-
-##### RULES #####
-
-.c.o:
- $(CC) -c $(INCLUDES) $(CFLAGS) $(EXTRA_DEFINES) $< -o $@
-
-.S.o:
- $(CC) -c $(INCLUDES) $(CFLAGS) $(EXTRA_DEFINES) $< -o $@
-
-##### TARGETS #####
-
-default: depend $(TOP)/$(LIB_DIR)/lib$(GL_LIB).$(LIB_EXT)
-
-# Make libGL
-$(TOP)/$(LIB_DIR)/lib$(GL_LIB).$(LIB_EXT): $(OBJECTS) $(GLAPI_LIB) Makefile
- $(MKLIB) -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
- -major 1 -minor 2 $(MKLIB_OPTIONS) \
- -install $(TOP)/$(LIB_DIR) -id $(INSTALL_LIB_DIR)/lib$(GL_LIB).1.dylib \
- $(GL_LIB_DEPS) $(OBJECTS) $(GLAPI_LIB)
-
-$(GLAPI_LIB):
- @$(MAKE) -C $(TOP)/src/mapi/glapi
-
-depend: $(SOURCES) $(MESA_GLAPI_SOURCES) $(MESA_GLAPI_ASM_SOURCES) Makefile
- rm -f depend
- touch depend
- $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(SOURCES) \
- $(MESA_GLAPI_SOURCES) $(MESA_GLAPI_ASM_SOURCES)
-
-# Emacs tags
-tags:
- etags `find . -name \*.[ch]` `find $(TOP)/include`
-
-install_headers: include/GL/gl.h
- $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL
- $(INSTALL) -m 644 include/GL/gl.h $(DESTDIR)$(INSTALL_DIR)/include/GL
-
-install_libraries: $(TOP)/$(LIB_DIR)/lib$(GL_LIB).$(LIB_EXT)
- $(MAKE) -C $(TOP)/src/mesa install-libgl
-
-install: install_libraries
-
-# Remove .o and backup files
-clean:
- -rm -f *.o *.a *~
- -rm -f *.c~ *.h~
- -rm -f *.dylib
- -rm -f include/GL/gl.h
- -rm -f *.o *~
- -rm -f depend depend.bak
-
--include depend
diff --git a/src/glx/apple/Makefile.am b/src/glx/apple/Makefile.am
new file mode 100644
index 00000000000..894ab5b3c78
--- /dev/null
+++ b/src/glx/apple/Makefile.am
@@ -0,0 +1,33 @@
+noinst_LTLIBRARIES = libappleglx.la
+
+AM_CFLAGS = \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/src/glx \
+ -I$(top_srcdir)/src/mesa \
+ -I$(top_builddir)/src/mesa \
+ -I$(top_srcdir)/src/mapi \
+ -I$(top_srcdir)/src/mapi/glapi \
+ -I$(top_builddir)/src/mapi/glapi \
+ $(VISIBILITY_CFLAGS) \
+ $(SHARED_GLAPI_CFLAGS) \
+ $(DEFINES) \
+ $(X11_INCLUDES)
+
+libappleglx_la_SOURCES = \
+ apple_cgl.c \
+ apple_glapi.c \
+ apple_glx.c \
+ apple_glx_context.c \
+ apple_glx_drawable.c \
+ apple_glx_log.c \
+ apple_glx_pbuffer.c \
+ apple_glx_pixmap.c \
+ apple_glx_surface.c \
+ apple_visual.c \
+ apple_xgl_api_read.c \
+ apple_xgl_api_stereo.c \
+ apple_xgl_api_viewport.c \
+ appledri.c \
+ glx_empty.c
+
+libappleglx_la_LDFLAGS = -lXplugin -framework ApplicationServices -framework CoreFoundation
diff --git a/src/glx/apple/apple_glapi.c b/src/glx/apple/apple_glapi.c
index c9327814d98..4d19f7f6a3e 100644
--- a/src/glx/apple/apple_glapi.c
+++ b/src/glx/apple/apple_glapi.c
@@ -38,6 +38,7 @@
#include <GL/gl.h>
+#include "main/glheader.h"
#include "glapi.h"
#include "glapitable.h"
#include "main/dispatch.h"
diff --git a/src/glx/apple/apple_glx.c b/src/glx/apple/apple_glx.c
index 4e2aa33e59f..3b570882572 100644
--- a/src/glx/apple/apple_glx.c
+++ b/src/glx/apple/apple_glx.c
@@ -43,8 +43,6 @@
static bool initialized = false;
static int dri_event_base = 0;
-const GLuint __glXDefaultPixelStore[9] = { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
-
int
apple_get_dri_event_base(void)
{
diff --git a/src/glx/apple/apple_glx.h b/src/glx/apple/apple_glx.h
index 0967f1812a0..7d94f8873db 100644
--- a/src/glx/apple/apple_glx.h
+++ b/src/glx/apple/apple_glx.h
@@ -32,7 +32,6 @@
#include <stdbool.h>
#include <GL/gl.h>
-#include <GL/glxint.h>
#include <X11/Xlib.h>
#define XP_NO_X_HEADERS
diff --git a/src/glx/apple/apple_xgl_api_read.c b/src/glx/apple/apple_xgl_api_read.c
index 612f5f7b01f..4a9a20d3477 100644
--- a/src/glx/apple/apple_xgl_api_read.c
+++ b/src/glx/apple/apple_xgl_api_read.c
@@ -37,6 +37,7 @@
#include "glxclient.h"
#include "apple_glx_context.h"
#include "apple_xgl_api.h"
+#include "main/glheader.h"
#include "glapitable.h"
extern struct _glapi_table * __ogl_framework_api;
diff --git a/src/glx/apple/apple_xgl_api_stereo.c b/src/glx/apple/apple_xgl_api_stereo.c
index c9ed684b279..4b21aaf79ef 100644
--- a/src/glx/apple/apple_xgl_api_stereo.c
+++ b/src/glx/apple/apple_xgl_api_stereo.c
@@ -40,6 +40,7 @@
#include "glxclient.h"
#include "apple_glx_context.h"
#include "apple_xgl_api.h"
+#include "main/glheader.h"
#include "glapitable.h"
extern struct _glapi_table * __ogl_framework_api;
@@ -75,7 +76,7 @@ __applegl_glDrawBuffer(GLenum mode)
break;
}
- __ogl_framework_api->DrawBuffersARB(n, buf);
+ __ogl_framework_api->DrawBuffers(n, buf);
}
else {
__ogl_framework_api->DrawBuffer(mode);
@@ -116,9 +117,9 @@ __applegl_glDrawBuffers(GLsizei n, const GLenum * bufs)
newbuf[outi++] = GL_FRONT_RIGHT;
}
- __ogl_framework_api->DrawBuffersARB(outi, newbuf);
+ __ogl_framework_api->DrawBuffers(outi, newbuf);
}
else {
- __ogl_framework_api->DrawBuffersARB(n, bufs);
+ __ogl_framework_api->DrawBuffers(n, bufs);
}
}
diff --git a/src/glx/apple/apple_xgl_api_viewport.c b/src/glx/apple/apple_xgl_api_viewport.c
index 8f914b425f2..281c90c6bbd 100644
--- a/src/glx/apple/apple_xgl_api_viewport.c
+++ b/src/glx/apple/apple_xgl_api_viewport.c
@@ -30,6 +30,7 @@
#include "glxclient.h"
#include "apple_glx_context.h"
#include "apple_xgl_api.h"
+#include "main/glheader.h"
#include "glapitable.h"
extern struct _glapi_table * __ogl_framework_api;
diff --git a/src/glx/apple/glxreply.c b/src/glx/apple/glxreply.c
deleted file mode 100644
index 240caa738f9..00000000000
--- a/src/glx/apple/glxreply.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * (C) Copyright Apple Inc. 2008
- * (C) Copyright IBM Corporation 2004, 2005
- * 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, sub license,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * IBM,
- * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include <GL/gl.h>
-#include "glxclient.h"
-#include <GL/glxproto.h>
-
-CARD32
-__glXReadReply(Display * dpy, size_t size, void *dest,
- GLboolean reply_is_always_array)
-{
- xGLXSingleReply reply;
-
- (void) _XReply(dpy, (xReply *) & reply, 0, False);
- if (size != 0) {
- if ((reply.length > 0) || reply_is_always_array) {
- const GLint bytes = (reply_is_always_array)
- ? (4 * reply.length) : (reply.size * size);
- const GLint extra = 4 - (bytes & 3);
-
- _XRead(dpy, dest, bytes);
- if (extra < 4) {
- _XEatData(dpy, extra);
- }
- }
- else {
- (void) memcpy(dest, &(reply.pad3), size);
- }
- }
-
- return reply.retval;
-}
-
-void
-__glXReadPixelReply(Display * dpy, struct glx_context * gc, unsigned max_dim,
- GLint width, GLint height, GLint depth, GLenum format,
- GLenum type, void *dest, GLboolean dimensions_in_reply)
-{
- xGLXSingleReply reply;
- GLint size;
-
- (void) _XReply(dpy, (xReply *) & reply, 0, False);
-
- if (dimensions_in_reply) {
- width = reply.pad3;
- height = reply.pad4;
- depth = reply.pad5;
-
- if ((height == 0) || (max_dim < 2)) {
- height = 1;
- }
- if ((depth == 0) || (max_dim < 3)) {
- depth = 1;
- }
- }
-
- size = reply.length * 4;
- if (size != 0) {
- void *buf = malloc(size);
-
- if (buf == NULL) {
- _XEatData(dpy, size);
- __glXSetError(gc, GL_OUT_OF_MEMORY);
- }
- else {
- const GLint extra = 4 - (size & 3);
-
- _XRead(dpy, buf, size);
- if (extra < 4) {
- _XEatData(dpy, extra);
- }
-
- __glEmptyImage(gc, 3, width, height, depth, format, type, buf, dest);
- free(buf);
- }
- }
-}
-
-#if 0
-GLubyte *
-__glXSetupSingleRequest(struct glx_context * gc, GLint sop, GLint cmdlen)
-{
- xGLXSingleReq *req;
- Display *const dpy = gc->currentDpy;
-
- (void) __glXFlushRenderBuffer(gc, gc->pc);
- LockDisplay(dpy);
- GetReqExtra(GLXSingle, cmdlen, req);
- req->reqType = gc->majorOpcode;
- req->contextTag = gc->currentContextTag;
- req->glxCode = sop;
- return (GLubyte *) (req) + sz_xGLXSingleReq;
-}
-#endif
-
-GLubyte *
-__glXSetupVendorRequest(struct glx_context * gc, GLint code, GLint vop,
- GLint cmdlen)
-{
- xGLXVendorPrivateReq *req;
- Display *const dpy = gc->currentDpy;
-
- (void) __glXFlushRenderBuffer(gc, gc->pc);
- LockDisplay(dpy);
- GetReqExtra(GLXVendorPrivate, cmdlen, req);
- req->reqType = gc->majorOpcode;
- req->glxCode = code;
- req->vendorCode = vop;
- req->contextTag = gc->currentContextTag;
- return (GLubyte *) (req) + sz_xGLXVendorPrivateReq;
-}
diff --git a/src/glx/applegl_glx.c b/src/glx/applegl_glx.c
index 4e2d5d021ae..c086e5146a8 100644
--- a/src/glx/applegl_glx.c
+++ b/src/glx/applegl_glx.c
@@ -37,9 +37,9 @@
#include <dlfcn.h>
#include "glxclient.h"
-#include "apple_glx_context.h"
-#include "apple_glx.h"
-#include "apple_cgl.h"
+#include "apple/apple_glx_context.h"
+#include "apple/apple_glx.h"
+#include "apple/apple_cgl.h"
#include "glx_error.h"
static void
diff --git a/src/glx/glx_pbuffer.c b/src/glx/glx_pbuffer.c
index 0cd05545786..8f480934558 100644
--- a/src/glx/glx_pbuffer.c
+++ b/src/glx/glx_pbuffer.c
@@ -39,7 +39,7 @@
#ifdef GLX_USE_APPLEGL
#include <pthread.h>
-#include "apple_glx_drawable.h"
+#include "apple/apple_glx_drawable.h"
#endif
#include "glx_error.h"
diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
index 79847150360..c8de7927613 100644
--- a/src/glx/glxcmds.c
+++ b/src/glx/glxcmds.c
@@ -41,8 +41,8 @@
#ifdef GLX_DIRECT_RENDERING
#ifdef GLX_USE_APPLEGL
-#include "apple_glx_context.h"
-#include "apple_glx.h"
+#include "apple/apple_glx_context.h"
+#include "apple/apple_glx.h"
#else
#include <sys/time.h>
#ifdef XF86VIDMODE
diff --git a/src/glx/glxcurrent.c b/src/glx/glxcurrent.c
index 2e5111b8cf7..dc2acd5e2ab 100644
--- a/src/glx/glxcurrent.c
+++ b/src/glx/glxcurrent.c
@@ -38,12 +38,6 @@
#endif
#include "glxclient.h"
-#ifdef GLX_USE_APPLEGL
-#include <stdlib.h>
-
-#include "apple_glx.h"
-#include "apple_glx_context.h"
-#endif
#include "glapi.h"
diff --git a/src/glx/glxext.c b/src/glx/glxext.c
index 29317906d52..24c80d4f31d 100644
--- a/src/glx/glxext.c
+++ b/src/glx/glxext.c
@@ -42,8 +42,8 @@
#include <X11/extensions/Xext.h>
#include <X11/extensions/extutil.h>
#ifdef GLX_USE_APPLEGL
-#include "apple_glx.h"
-#include "apple_visual.h"
+#include "apple/apple_glx.h"
+#include "apple/apple_visual.h"
#endif
#include "glxextensions.h"
diff --git a/src/glx/indirect_glx.c b/src/glx/indirect_glx.c
index 1bcecda9f48..bb121f85b40 100644
--- a/src/glx/indirect_glx.c
+++ b/src/glx/indirect_glx.c
@@ -33,6 +33,8 @@
#include "glapi.h"
#include "glxclient.h"
+#ifndef GLX_USE_APPLEGL
+
extern struct _glapi_table *__glXNewIndirectAPI(void);
/*
@@ -488,3 +490,5 @@ indirect_create_screen(int screen, struct glx_display * priv)
return psc;
}
+
+#endif
diff --git a/src/glx/render2.c b/src/glx/render2.c
index a33c2cf19bf..3dfee7c4651 100644
--- a/src/glx/render2.c
+++ b/src/glx/render2.c
@@ -28,6 +28,8 @@
* Silicon Graphics, Inc.
*/
+#ifndef GLX_USE_APPLEGL
+
#include "packrender.h"
#include "indirect.h"
#include "indirect_size.h"
@@ -379,3 +381,5 @@ __indirect_glDisable(GLenum cap)
__GLX_PUT_LONG(4, cap);
__GLX_END(8);
}
+
+#endif
diff --git a/src/glx/vertarr.c b/src/glx/vertarr.c
index 609cafac2b1..066bf59f759 100644
--- a/src/glx/vertarr.c
+++ b/src/glx/vertarr.c
@@ -32,6 +32,7 @@
#include "indirect.h"
#include "indirect_vertex_array.h"
+#ifndef GLX_USE_APPLEGL
/*****************************************************************************/
@@ -210,3 +211,5 @@ __indirect_glInterleavedArrays(GLenum format, GLsizei stride,
trueStride,
(const char *) pointer + offsets[3]);
}
+
+#endif