summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorGeorge Kyriazis <[email protected]>2016-03-02 18:28:00 -0700
committerBrian Paul <[email protected]>2016-03-04 10:57:24 -0700
commit01e92e7010aebee111e70bdc18081b483511cac0 (patch)
treed29bdec2a674e3e524437ec6a99705ded3df781c /src/gallium
parent51e562c3ea984f476efc0c4cbd01a4b718f3a007 (diff)
st/xlib: Hang off screen destructor off main XCloseDisplay() callback.
This resolves some order dependencies between the already existing callback the newly created one. Tested-by: Brian Paul <[email protected]> Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/state_trackers/glx/xlib/glx_api.c1
-rw-r--r--src/gallium/state_trackers/glx/xlib/xm_api.c58
-rw-r--r--src/gallium/state_trackers/glx/xlib/xm_api.h3
3 files changed, 27 insertions, 35 deletions
diff --git a/src/gallium/state_trackers/glx/xlib/glx_api.c b/src/gallium/state_trackers/glx/xlib/glx_api.c
index 0456d44104e..1c541b76db5 100644
--- a/src/gallium/state_trackers/glx/xlib/glx_api.c
+++ b/src/gallium/state_trackers/glx/xlib/glx_api.c
@@ -615,6 +615,7 @@ close_display_callback(Display *dpy, XExtCodes *codes)
{
xmesa_destroy_buffers_on_display(dpy);
destroy_visuals_on_display(dpy);
+ xmesa_close_display(dpy);
return 0;
}
diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c
index 2f1bfaec4a0..cee4f18295e 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_api.c
+++ b/src/gallium/state_trackers/glx/xlib/xm_api.c
@@ -126,7 +126,6 @@ xmesa_get_param(struct st_manager *smapi,
typedef struct _XMesaExtDisplayInfo {
struct _XMesaExtDisplayInfo *next;
Display *display;
- XExtCodes *codes;
struct xmesa_display mesaDisplay;
} XMesaExtDisplayInfo;
@@ -138,8 +137,8 @@ typedef struct _XMesaExtInfo {
static XMesaExtInfo MesaExtInfo;
/* hook to delete XMesaDisplay on XDestroyDisplay */
-static int
-xmesa_close_display(Display *display, XExtCodes *codes)
+extern void
+xmesa_close_display(Display *display)
{
XMesaExtDisplayInfo *info, *prev;
@@ -159,7 +158,7 @@ xmesa_close_display(Display *display, XExtCodes *codes)
if (info == NULL) {
/* no display found */
_XUnlockMutex(_Xglobal_lock);
- return 0;
+ return;
}
/* remove display entry from list */
@@ -181,7 +180,6 @@ xmesa_close_display(Display *display, XExtCodes *codes)
free(xmdpy->smapi);
XFree((char *) info);
- return 1;
}
static XMesaDisplay
@@ -218,14 +216,6 @@ xmesa_init_display( Display *display )
return NULL;
}
info->display = display;
- info->codes = XAddExtension(display);
- if (info->codes == NULL) {
- /* could not allocate extension. Fail */
- Xfree(info);
- pipe_mutex_unlock(init_mutex);
- return NULL;
- }
- XESetCloseDisplay(display, info->codes->extension, xmesa_close_display);
xmdpy = &info->mesaDisplay; /* to be filled out below */
/* chain to the list of displays */
@@ -236,32 +226,30 @@ xmesa_init_display( Display *display )
_XUnlockMutex(_Xglobal_lock);
/* now create the new XMesaDisplay info */
- if (display) {
- xmdpy->display = display;
- xmdpy->screen = driver.create_pipe_screen(display);
- xmdpy->smapi = CALLOC_STRUCT(st_manager);
- xmdpy->pipe = NULL;
- if (xmdpy->smapi) {
- xmdpy->smapi->screen = xmdpy->screen;
- xmdpy->smapi->get_param = xmesa_get_param;
- }
+ assert(display);
+
+ xmdpy->display = display;
+ xmdpy->screen = driver.create_pipe_screen(display);
+ xmdpy->smapi = CALLOC_STRUCT(st_manager);
+ xmdpy->pipe = NULL;
+ if (xmdpy->smapi) {
+ xmdpy->smapi->screen = xmdpy->screen;
+ xmdpy->smapi->get_param = xmesa_get_param;
+ }
- if (xmdpy->screen && xmdpy->smapi) {
- pipe_mutex_init(xmdpy->mutex);
+ if (xmdpy->screen && xmdpy->smapi) {
+ pipe_mutex_init(xmdpy->mutex);
+ }
+ else {
+ if (xmdpy->screen) {
+ xmdpy->screen->destroy(xmdpy->screen);
+ xmdpy->screen = NULL;
}
- else {
- if (xmdpy->screen) {
- xmdpy->screen->destroy(xmdpy->screen);
- xmdpy->screen = NULL;
- }
- free(xmdpy->smapi);
- xmdpy->smapi = NULL;
+ free(xmdpy->smapi);
+ xmdpy->smapi = NULL;
- xmdpy->display = NULL;
- }
+ xmdpy->display = NULL;
}
- if (!xmdpy->display || xmdpy->display != display)
- xmdpy = NULL;
pipe_mutex_unlock(init_mutex);
diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.h b/src/gallium/state_trackers/glx/xlib/xm_api.h
index ffdffc0940f..ccf35a5eb5a 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_api.h
+++ b/src/gallium/state_trackers/glx/xlib/xm_api.h
@@ -378,6 +378,9 @@ xmesa_check_buffer_size(XMesaBuffer b);
extern void
xmesa_destroy_buffers_on_display(Display *dpy);
+extern void
+xmesa_close_display(Display *dpy);
+
static inline GLuint
xmesa_buffer_width(XMesaBuffer b)
{