Mesa (mesa_7_4_branch): GLX/DRI1: Mark GLX visuals with depth != screen depth non-conformant.

Michel Dänzer daenzer at kemper.freedesktop.org
Tue Jul 7 12:18:28 UTC 2009


Module: Mesa
Branch: mesa_7_4_branch
Commit: a3537de1ddc834c2e6efc05bca4d1e4b1a51242e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a3537de1ddc834c2e6efc05bca4d1e4b1a51242e

Author: Michel Dänzer <daenzer at vmware.com>
Date:   Tue Jul  7 13:52:35 2009 +0200

GLX/DRI1: Mark GLX visuals with depth != screen depth non-conformant.

Such visuals are subject to automatic compositing in the X server, so DRI1
can't render to them properly.
(cherry picked from commit 25b492b976632269dfa3de164545d50a53c090ce)

---

 src/glx/x11/dri_glx.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/src/glx/x11/dri_glx.c b/src/glx/x11/dri_glx.c
index 372d9d9..619490c 100644
--- a/src/glx/x11/dri_glx.c
+++ b/src/glx/x11/dri_glx.c
@@ -291,6 +291,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;
@@ -403,6 +404,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:




More information about the mesa-commit mailing list