summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/glx/xlib
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2009-01-13 18:08:24 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2009-01-13 19:46:18 +0000
commit2f19fecd583a4406385708de6362b3bdef23811e (patch)
treeea10148c44d8d65ccd091a16759249ca5da44e9a /src/gallium/state_trackers/glx/xlib
parenta2d5031b1e133523591f1683527c2c96f58aa606 (diff)
xlib: allow winsys's to register themselves with glx/xlib state tracker
Diffstat (limited to 'src/gallium/state_trackers/glx/xlib')
-rw-r--r--src/gallium/state_trackers/glx/xlib/xm_api.c21
-rw-r--r--src/gallium/state_trackers/glx/xlib/xm_winsys.h31
2 files changed, 34 insertions, 18 deletions
diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c
index 82d125b5f3..4811641559 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_api.c
+++ b/src/gallium/state_trackers/glx/xlib/xm_api.c
@@ -71,6 +71,18 @@
#include "xm_winsys.h"
#include <GL/glx.h>
+
+/* Driver interface routines, set up by xlib backend on library
+ * _init(). These are global in the same way that function names are
+ * global.
+ */
+static struct xm_driver driver;
+
+void xmesa_set_driver( const struct xm_driver *templ )
+{
+ driver = *templ;
+}
+
/**
* Global X driver lock
*/
@@ -756,17 +768,17 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list )
/* XXX: create once per Xlib Display.
*/
- winsys = xmesa_create_pipe_winsys();
+ winsys = driver.create_pipe_winsys();
if (winsys == NULL)
goto fail;
/* XXX: create once per Xlib Display.
*/
- screen = xmesa_create_pipe_screen( winsys );
+ screen = driver.create_pipe_screen( winsys );
if (screen == NULL)
goto fail;
- pipe = xmesa_create_pipe_context( screen,
+ pipe = driver.create_pipe_context( screen,
(void *)c );
if (pipe == NULL)
goto fail;
@@ -1118,8 +1130,7 @@ void XMesaSwapBuffers( XMesaBuffer b )
surf = st_get_framebuffer_surface(b->stfb, ST_SURFACE_BACK_LEFT);
if (surf) {
- xmesa_display_surface(b, surf);
-// xmesa_display_surface(b, surf);
+ driver.display_surface(b, surf);
}
xmesa_check_and_update_buffer_size(NULL, b);
diff --git a/src/gallium/state_trackers/glx/xlib/xm_winsys.h b/src/gallium/state_trackers/glx/xlib/xm_winsys.h
index b22d65a569..8b6d1644e8 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_winsys.h
+++ b/src/gallium/state_trackers/glx/xlib/xm_winsys.h
@@ -36,22 +36,27 @@ struct pipe_surface;
struct xmesa_buffer;
-/* Will turn this into a callback-style interface. For now, these
- * have fixed names, and are implemented in the winsys/xlib directory.
- */
-struct pipe_winsys *xmesa_create_pipe_winsys( void );
-
-struct pipe_screen *xmesa_create_pipe_screen( struct pipe_winsys * );
-
-/* The context_private argument needs to go away. Is currently used
- * in a round-about way to associate a display-target surface with its
- * Xlib window.
- */
-struct pipe_context *xmesa_create_pipe_context( struct pipe_screen *,
+struct xm_driver {
+
+ struct pipe_winsys *(*create_pipe_winsys)( void );
+
+ struct pipe_screen *(*create_pipe_screen)( struct pipe_winsys * );
+
+ /* The context_private argument needs to go away. Is currently used
+ * in a round-about way to associate a display-target surface with its
+ * Xlib window.
+ */
+ struct pipe_context *(*create_pipe_context)( struct pipe_screen *,
void *context_private );
-void xmesa_display_surface( struct xmesa_buffer *,
+ void (*display_surface)( struct xmesa_buffer *,
struct pipe_surface * );
+};
+
+
+extern void
+xmesa_set_driver( const struct xm_driver *driver );
+
#endif