summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2010-03-23 17:22:43 -0600
committerBrian Paul <[email protected]>2010-03-23 17:24:54 -0600
commit8ba47561dd45e1cd737992544545d7fa0f61918b (patch)
tree01b482d1a6f53156ea8e2fd064b32e737317b059 /src/gallium
parent2d84d58975187639291d8f02faa02ffc83b5c195 (diff)
st/glx: add support for multiple displays
This is a quick & dirty solution, but it works. See comments in the code for other ideas. Fixes regressions/breakage seen in progs/xdemos/glxheads, etc. from commit 6632915e957149c153a3f793c400a532b4995b18.
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/state_trackers/glx/xlib/xm_api.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c
index 8dd54206af2..3022d45157a 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_api.c
+++ b/src/gallium/state_trackers/glx/xlib/xm_api.c
@@ -78,17 +78,39 @@ void xmesa_set_driver( const struct xm_driver *templ )
stapi = driver.create_st_api();
}
+
+/*
+ * XXX replace this with a linked list, or better yet, try to attach the
+ * gallium/mesa extra bits to the X Display object with XAddExtension().
+ */
+#define MAX_DISPLAYS 10
+static struct xmesa_display Displays[MAX_DISPLAYS];
+static int NumDisplays = 0;
+
+
static XMesaDisplay
xmesa_init_display( Display *display )
{
pipe_static_mutex(init_mutex);
- static struct xmesa_display xm_display;
XMesaDisplay xmdpy;
-
+ int i;
+
pipe_mutex_lock(init_mutex);
- /* TODO support for multiple displays */
- xmdpy = &xm_display;
+ /* Look for XMesaDisplay which corresponds to 'display' */
+ for (i = 0; i < NumDisplays; i++) {
+ if (Displays[i].display == display) {
+ /* Found it */
+ pipe_mutex_unlock(init_mutex);
+ return &Displays[i];
+ }
+ }
+
+ /* Create new XMesaDisplay */
+
+ assert(NumDisplays < MAX_DISPLAYS);
+ xmdpy = &Displays[NumDisplays];
+ NumDisplays++;
if (!xmdpy->display && display) {
xmdpy->display = display;