[Mesa-dev] [PATCH 1/2] glx: Fix build in GLX_DIRECT_RENDERING !GLX_USE_APPLEGL !GLX_USE_DRM case

Jon TURNEY jon.turney at dronecode.org.uk
Tue Jun 3 06:14:10 PDT 2014


Some untangling to fix building in the dri_platform=none, --enable-driglx-direct
case, where only driswast can be used.

Turn the test for including the glXGetScreenDriver()/glXGetScreenDriver()
interface used by xdriinfo from !GLX_USE_APPLEGL into a positive form, as it is
only useful when dri_platform=drm

Add additional GLX_USE_DRM tests so DRI[123] renderers are only used when
dri_platform=drm

Note that swrast and indirect must still be disabled in the APPLEGL case at the
moment, which makes things more complex than they need to be.  More untangling
is needed to allow that

Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
---
 configure.ac      |  1 +
 src/glx/glxcmds.c |  2 +-
 src/glx/glxext.c  | 17 ++++++++++++-----
 3 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/configure.ac b/configure.ac
index 9c64400..d2adb15 100644
--- a/configure.ac
+++ b/configure.ac
@@ -939,6 +939,7 @@ xyesno)
 
     if test x"$driglx_direct" = xyes; then
         if test x"$dri_platform" = xdrm ; then
+            DEFINES="$DEFINES -DGLX_USE_DRM"
             if test "x$have_libdrm" != xyes; then
                AC_MSG_ERROR([Direct rendering requires libdrm >= $LIBDRM_REQUIRED])
             fi
diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
index c8de792..04d8db1 100644
--- a/src/glx/glxcmds.c
+++ b/src/glx/glxcmds.c
@@ -2581,7 +2581,7 @@ static const struct name_address_pair GLX_functions[] = {
    GLX_FUNCTION2(glXReleaseTexImageEXT, __glXReleaseTexImageEXT),
 #endif
 
-#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
+#if defined(GLX_DIRECT_RENDERING) && defined(GLX_USE_DRM)
    /*** DRI configuration ***/
    GLX_FUNCTION(glXGetScreenDriver),
    GLX_FUNCTION(glXGetDriverConfig),
diff --git a/src/glx/glxext.c b/src/glx/glxext.c
index 8528e88..94582f6 100644
--- a/src/glx/glxext.c
+++ b/src/glx/glxext.c
@@ -242,6 +242,7 @@ glx_display_free(struct glx_display *priv)
       (*priv->driswDisplay->destroyDisplay) (priv->driswDisplay);
    priv->driswDisplay = NULL;
 
+#if defined (GLX_USE_DRM)
    if (priv->driDisplay)
       (*priv->driDisplay->destroyDisplay) (priv->driDisplay);
    priv->driDisplay = NULL;
@@ -253,7 +254,8 @@ glx_display_free(struct glx_display *priv)
    if (priv->dri3Display)
       (*priv->dri3Display->destroyDisplay) (priv->dri3Display);
    priv->dri3Display = NULL;
-#endif
+#endif /* GLX_USE_DRM */
+#endif /* GLX_DIRECT_RENDERING && !GLX_USE_APPLEGL */
 
    free((char *) priv);
 }
@@ -779,17 +781,20 @@ AllocAndFetchScreenConfigs(Display * dpy, struct glx_display * priv)
    for (i = 0; i < screens; i++, psc++) {
       psc = NULL;
 #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
+#if defined(GLX_USE_DRM)
 #if defined(HAVE_DRI3)
       if (priv->dri3Display)
          psc = (*priv->dri3Display->createScreen) (i, priv);
-#endif
+#endif /* HAVE_DRI3 */
       if (psc == NULL && priv->dri2Display)
 	 psc = (*priv->dri2Display->createScreen) (i, priv);
       if (psc == NULL && priv->driDisplay)
 	 psc = (*priv->driDisplay->createScreen) (i, priv);
+#endif /* GLX_USE_DRM */
       if (psc == NULL && priv->driswDisplay)
 	 psc = (*priv->driswDisplay->createScreen) (i, priv);
-#endif
+#endif /* GLX_DIRECT_RENDERING && !GLX_USE_APPLEGL */
+
 #if defined(GLX_USE_APPLEGL)
       if (psc == NULL)
          psc = applegl_create_screen(i, priv);
@@ -873,17 +878,19 @@ __glXInitialize(Display * dpy)
     ** Note: This _must_ be done before calling any other DRI routines
     ** (e.g., those called in AllocAndFetchScreenConfigs).
     */
+#if defined(GLX_USE_DRM)
    if (glx_direct && glx_accel) {
 #if defined(HAVE_DRI3)
       if (!getenv("LIBGL_DRI3_DISABLE"))
          dpyPriv->dri3Display = dri3_create_display(dpy);
-#endif
+#endif /* HAVE_DRI3 */
       dpyPriv->dri2Display = dri2CreateDisplay(dpy);
       dpyPriv->driDisplay = driCreateDisplay(dpy);
    }
+#endif /* GLX_USE_DRM */
    if (glx_direct)
       dpyPriv->driswDisplay = driswCreateDisplay(dpy);
-#endif
+#endif /* GLX_DIRECT_RENDERING && !GLX_USE_APPLEGL */
 
 #ifdef GLX_USE_APPLEGL
    if (!applegl_create_display(dpyPriv)) {
-- 
1.8.5.5



More information about the mesa-dev mailing list