summaryrefslogtreecommitdiff
path: root/src/glx
diff options
context:
space:
mode:
Diffstat (limited to 'src/glx')
-rw-r--r--src/glx/x11/dri2_glx.c7
-rw-r--r--src/glx/x11/dri_glx.c23
-rw-r--r--src/glx/x11/drisw_glx.c2
-rw-r--r--src/glx/x11/glxcmds.c16
-rw-r--r--src/glx/x11/glxcurrent.c2
5 files changed, 48 insertions, 2 deletions
diff --git a/src/glx/x11/dri2_glx.c b/src/glx/x11/dri2_glx.c
index fb31898db2..f4865aecb1 100644
--- a/src/glx/x11/dri2_glx.c
+++ b/src/glx/x11/dri2_glx.c
@@ -80,6 +80,8 @@ struct __GLXDRIdrawablePrivateRec {
int have_fake_front;
};
+static void dri2WaitX(__GLXDRIdrawable *pdraw);
+
static void dri2DestroyContext(__GLXDRIcontext *context,
__GLXscreenConfigs *psc, Display *dpy)
{
@@ -215,6 +217,11 @@ static void dri2CopySubBuffer(__GLXDRIdrawable *pdraw,
DRI2CopyRegion(pdraw->psc->dpy, pdraw->drawable, region,
DRI2BufferFrontLeft, DRI2BufferBackLeft);
XFixesDestroyRegion(pdraw->psc->dpy, region);
+
+ /* Refresh the fake front (if present) after we just damaged the real
+ * front.
+ */
+ dri2WaitX(pdraw);
}
static void dri2SwapBuffers(__GLXDRIdrawable *pdraw)
diff --git a/src/glx/x11/dri_glx.c b/src/glx/x11/dri_glx.c
index 3ce410d9be..ac2eb05341 100644
--- a/src/glx/x11/dri_glx.c
+++ b/src/glx/x11/dri_glx.c
@@ -305,6 +305,7 @@ CallCreateNewScreen(Display *dpy, int scrn, __GLXscreenConfigs *psc,
drm_handle_t hFB;
int junk;
const __DRIconfig **driver_configs;
+ __GLcontextModes *visual;
/* DRI protocol version. */
dri_version.major = driDpy->driMajor;
@@ -417,6 +418,28 @@ CallCreateNewScreen(Display *dpy, int scrn, __GLXscreenConfigs *psc,
psc->configs = driConvertConfigs(psc->core, psc->configs, driver_configs);
psc->visuals = driConvertConfigs(psc->core, psc->visuals, driver_configs);
+ /* Visuals with depth != screen depth are subject to automatic compositing
+ * in the X server, so DRI1 can't render to them properly. Mark them as
+ * non-conformant to prevent apps from picking them up accidentally.
+ */
+ for (visual = psc->visuals; visual; visual = visual->next) {
+ XVisualInfo template;
+ XVisualInfo *visuals;
+ int num_visuals;
+ long mask;
+
+ template.visualid = visual->visualID;
+ mask = VisualIDMask;
+ visuals = XGetVisualInfo(dpy, mask, &template, &num_visuals);
+
+ if (visuals) {
+ if (num_visuals > 0 && visuals->depth != DefaultDepth(dpy, scrn))
+ visual->visualRating = GLX_NON_CONFORMANT_CONFIG;
+
+ XFree(visuals);
+ }
+ }
+
return psp;
handle_error:
diff --git a/src/glx/x11/drisw_glx.c b/src/glx/x11/drisw_glx.c
index b843ce484f..1c229dde90 100644
--- a/src/glx/x11/drisw_glx.c
+++ b/src/glx/x11/drisw_glx.c
@@ -401,6 +401,8 @@ driCreateScreen(__GLXscreenConfigs * psc, int screen,
psc->configs = driConvertConfigs(psc->core, psc->configs, driver_configs);
psc->visuals = driConvertConfigs(psc->core, psc->visuals, driver_configs);
+ free(driver_configs);
+
psp->destroyScreen = driDestroyScreen;
psp->createContext = driCreateContext;
psp->createDrawable = driCreateDrawable;
diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c
index ec3e69e4fe..820d8b9868 100644
--- a/src/glx/x11/glxcmds.c
+++ b/src/glx/x11/glxcmds.c
@@ -164,7 +164,7 @@ GetGLXScreenConfigs(Display *dpy, int scrn)
{
__GLXdisplayPrivate * const priv = __glXInitialize(dpy);
- return (priv->screenConfigs != NULL) ? &priv->screenConfigs[scrn] : NULL;
+ return (priv && priv->screenConfigs != NULL) ? &priv->screenConfigs[scrn] : NULL;
}
@@ -869,6 +869,20 @@ PUBLIC void glXDestroyGLXPixmap(Display *dpy, GLXPixmap glxpixmap)
req->glxpixmap = glxpixmap;
UnlockDisplay(dpy);
SyncHandle();
+
+#ifdef GLX_DIRECT_RENDERING
+ {
+ int screen;
+ __GLXdisplayPrivate *const priv = __glXInitialize(dpy);
+ __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, glxpixmap, &screen);
+ __GLXscreenConfigs *psc = &priv->screenConfigs[screen];
+
+ if (pdraw != NULL) {
+ (*pdraw->destroyDrawable) (pdraw);
+ __glxHashDelete(psc->drawHash, glxpixmap);
+ }
+ }
+#endif
}
PUBLIC void glXSwapBuffers(Display *dpy, GLXDrawable drawable)
diff --git a/src/glx/x11/glxcurrent.c b/src/glx/x11/glxcurrent.c
index 01f4233241..d44e0dd1fc 100644
--- a/src/glx/x11/glxcurrent.c
+++ b/src/glx/x11/glxcurrent.c
@@ -457,7 +457,7 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
&dummy_reply);
}
#ifdef GLX_DIRECT_RENDERING
- else if (oldGC->driContext) {
+ else if (oldGC->driContext && oldGC != gc) {
oldGC->driContext->unbindContext(oldGC->driContext);
}
#endif