aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/glx/xlib
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/state_trackers/glx/xlib')
-rw-r--r--src/gallium/state_trackers/glx/xlib/Makefile18
-rw-r--r--src/gallium/state_trackers/glx/xlib/SConscript5
-rw-r--r--src/gallium/state_trackers/glx/xlib/glxapi.c10
-rw-r--r--src/gallium/state_trackers/glx/xlib/xm_api.c35
-rw-r--r--src/gallium/state_trackers/glx/xlib/xm_api.h1
5 files changed, 35 insertions, 34 deletions
diff --git a/src/gallium/state_trackers/glx/xlib/Makefile b/src/gallium/state_trackers/glx/xlib/Makefile
index 1b63db1f0ea..6d10b090aa0 100644
--- a/src/gallium/state_trackers/glx/xlib/Makefile
+++ b/src/gallium/state_trackers/glx/xlib/Makefile
@@ -3,23 +3,15 @@ include $(TOP)/configs/current
LIBNAME = xlib
-
-DRIVER_INCLUDES = \
+LIBRARY_INCLUDES = \
-I$(TOP)/include \
-I$(TOP)/src/mesa \
- -I$(TOP)/src/mesa/main \
- -I$(TOP)/src/gallium/include \
- -I$(TOP)/src/gallium/drivers \
- -I$(TOP)/src/gallium/auxiliary
+ -I$(TOP)/src/mesa/main
C_SOURCES = \
- glxapi.c \
- fakeglx.c \
- fakeglx_fonts.c \
+ glxapi.c \
+ fakeglx.c \
+ fakeglx_fonts.c \
xm_api.c
-
include ../../../Makefile.template
-
-symlinks:
-
diff --git a/src/gallium/state_trackers/glx/xlib/SConscript b/src/gallium/state_trackers/glx/xlib/SConscript
index 14cdad69cbe..0dbe3413972 100644
--- a/src/gallium/state_trackers/glx/xlib/SConscript
+++ b/src/gallium/state_trackers/glx/xlib/SConscript
@@ -5,8 +5,7 @@ Import('*')
if env['platform'] == 'linux' \
and 'mesa' in env['statetrackers'] \
- and ('softpipe' or 'i915simple' or 'trace') in env['drivers'] \
- and not env['dri']:
+ and ('softpipe' or 'i915simple' or 'trace') in env['drivers']:
env = env.Clone()
@@ -15,6 +14,8 @@ if env['platform'] == 'linux' \
'#/src/mesa/main',
])
+ env.Append(CPPDEFINES = ['USE_XSHM'])
+
st_xlib = env.ConvenienceLibrary(
target = 'st_xlib',
source = [ 'glxapi.c',
diff --git a/src/gallium/state_trackers/glx/xlib/glxapi.c b/src/gallium/state_trackers/glx/xlib/glxapi.c
index 1ff04804f15..c2cb34d7cf7 100644
--- a/src/gallium/state_trackers/glx/xlib/glxapi.c
+++ b/src/gallium/state_trackers/glx/xlib/glxapi.c
@@ -34,13 +34,21 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include "main/glheader.h"
#include "glapi/glapi.h"
#include "glxapi.h"
#include "fakeglx.h"
#include "pipe/p_thread.h"
+#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303
+# define PUBLIC __attribute__((visibility("default")))
+# define USED __attribute__((used))
+#else
+# define PUBLIC
+# define USED
+#endif
+
+
struct display_dispatch {
Display *Dpy;
struct _glxapi_table *Table;
diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c
index 33dc044ad55..a3d16516531 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_api.c
+++ b/src/gallium/state_trackers/glx/xlib/xm_api.c
@@ -458,7 +458,7 @@ xmesa_free_buffer(XMesaBuffer buffer)
XDestroyImage(buffer->tempImage);
/* Unreference. If count = zero we'll really delete the buffer */
- _mesa_unreference_framebuffer(&fb);
+ _mesa_reference_framebuffer(&fb, NULL);
XFreeGC(b->xm_visual->display, b->gc);
@@ -763,7 +763,8 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list )
c->xm_visual = v;
c->xm_buffer = NULL; /* set later by XMesaMakeCurrent */
-
+ c->xm_read_buffer = NULL;
+
/* XXX: create once per Xlib Display.
*/
screen = driver.create_pipe_screen();
@@ -1037,27 +1038,25 @@ PUBLIC
GLboolean XMesaMakeCurrent2( XMesaContext c, XMesaBuffer drawBuffer,
XMesaBuffer readBuffer )
{
+ XMesaContext old_ctx = XMesaGetCurrentContext();
+
+ if (old_ctx && old_ctx != c) {
+ XMesaFlush(old_ctx);
+ old_ctx->xm_buffer = NULL;
+ old_ctx->xm_read_buffer = NULL;
+ }
+
if (c) {
if (!drawBuffer || !readBuffer)
return GL_FALSE; /* must specify buffers! */
-#if 0
- /* XXX restore this optimization */
- if (&(c->mesa) == _mesa_get_current_context()
- && c->mesa.DrawBuffer == &drawBuffer->mesa_buffer
- && c->mesa.ReadBuffer == &readBuffer->mesa_buffer
- && xmesa_buffer(c->mesa.DrawBuffer)->wasCurrent) {
- /* same context and buffer, do nothing */
- return GL_TRUE;
- }
-#endif
+ if (c == old_ctx &&
+ c->xm_buffer == drawBuffer &&
+ c->xm_read_buffer == readBuffer)
+ return GL_TRUE;
c->xm_buffer = drawBuffer;
-
- /* Call this periodically to detect when the user has begun using
- * GL rendering from multiple threads.
- */
- _glapi_check_multithread();
+ c->xm_read_buffer = readBuffer;
st_make_current(c->st, drawBuffer->stfb, readBuffer->stfb);
@@ -1071,6 +1070,7 @@ GLboolean XMesaMakeCurrent2( XMesaContext c, XMesaBuffer drawBuffer,
else {
/* Detach */
st_make_current( NULL, NULL, NULL );
+
}
return GL_TRUE;
}
@@ -1143,7 +1143,6 @@ void XMesaCopySubBuffer( XMesaBuffer b, int x, int y, int width, int height )
return;
pipe->surface_copy(pipe,
- FALSE,
surf_front, x, y, /* dest */
surf_back, x, y, /* src */
width, height);
diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.h b/src/gallium/state_trackers/glx/xlib/xm_api.h
index 2b8302d1747..bdd434cd364 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_api.h
+++ b/src/gallium/state_trackers/glx/xlib/xm_api.h
@@ -295,6 +295,7 @@ struct xmesa_context {
struct st_context *st;
XMesaVisual xm_visual; /** pixel format info */
XMesaBuffer xm_buffer; /** current drawbuffer */
+ XMesaBuffer xm_read_buffer; /** current readbuffer */
};