[PATCH] xf86-video-radeonhd: remove the GlxSetVisualConfigs stub and friends

Emil Velikov emil.l.velikov at gmail.com
Mon Jul 31 13:13:52 UTC 2017


From: Emil Velikov <emil.velikov at collabora.com>

The function was an empty since 2008 at least. Remove it alongside the
unused GLX visuals code.

With this all the GL/GLX dependencies in the driver are gone.

Note: the driver currently does not build if XAA is missing

Cc: Matthias Hopf <mhopf at suse.de>
Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
Analogous to the earlier VIA one - patch is for posterity.
Feel free to pick or ignore.
---
 configure.ac     |   2 +-
 src/rhd_dri.c    | 153 ++-----------------------------------------------------
 src/rhd_driver.c |   4 +-
 3 files changed, 5 insertions(+), 154 deletions(-)

diff --git a/configure.ac b/configure.ac
index 4a8fec1..55e4262 100644
--- a/configure.ac
+++ b/configure.ac
@@ -167,7 +167,7 @@ if test "x$DRI" = xyes; then
 	USE_DRI="yes"
 	AC_CHECK_DECL(XF86DRI,, [USE_DRI=no], [#include <xorg-server.h>])
 	XORG_CFLAGS="$XORG_CFLAGS $DRI_CFLAGS"
-	PKG_CHECK_MODULES(DRI, [libdrm >= 2.2 xf86driproto glproto],, [USE_DRI=no])
+	PKG_CHECK_MODULES(DRI, [libdrm >= 2.2 xf86driproto],, [USE_DRI=no])
 fi
 
 AC_MSG_CHECKING([whether to enable DRI support])
diff --git a/src/rhd_dri.c b/src/rhd_dri.c
index d7e599b..ead33e3 100644
--- a/src/rhd_dri.c
+++ b/src/rhd_dri.c
@@ -55,7 +55,7 @@
 #include "xf86PciInfo.h"
 #include "windowstr.h"
 
-/* GLX/DRI/DRM definitions */
+/* DRI/DRM definitions */
 #define _XF86DRI_SERVER_
 #include "dri.h"
 /* Workaround for header mismatches */
@@ -67,8 +67,6 @@
 # include "xf86drmMode.h"
 #endif
 #include "radeon_drm.h"
-#include "GL/glxint.h"
-#include "GL/glxtokens.h"
 #include "sarea.h"
 
 #if HAVE_XF86_ANSIC_H
@@ -119,11 +117,6 @@
 typedef struct {
     /* Nothing here yet */
     int dummy;
-} RADEONConfigPrivRec, *RADEONConfigPrivPtr;
-
-typedef struct {
-    /* Nothing here yet */
-    int dummy;
 } RADEONDRIContextRec, *RADEONDRIContextPtr;
 
 /* driver data only needed by dri */
@@ -139,9 +132,6 @@ struct rhdDri {
 
     DRIInfoPtr        pDRIInfo;
     int               drmFD;
-    int               numVisualConfigs;
-    __GLXvisualConfig *pVisualConfigs;
-    RADEONConfigPrivPtr pVisualConfigsPriv;
 
     drm_handle_t      registerHandle;
     drm_handle_t      pciMemHandle;
@@ -210,10 +200,6 @@ static char  *r300_driver_name = "r300";
 static char  *r600_driver_name = "r600";
 
 
-extern void GlxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs,
-				void **configprivs);
-
-
 static void RHDDRIAllocatePCIGARTTable(ScrnInfoPtr pScrn);
 static int  RHDDRIGetPciAperTableSize(ScrnInfoPtr pScrn);
 static int  RHDDRISetParam(ScrnInfoPtr pScrn,
@@ -234,119 +220,6 @@ static __inline__ int RHDMinBits(int val)
     return bits;
 }
 
-/* Initialize the visual configs that are supported by the hardware.
- * These are combined with the visual configs that the indirect
- * rendering core supports, and the intersection is exported to the
- * client. */
-static Bool RHDInitVisualConfigs(ScreenPtr pScreen)
-{
-    ScrnInfoPtr          pScrn             = xf86Screens[pScreen->myNum];
-    struct rhdDri       *rhdDRI              = RHDPTR(pScrn)->dri;
-    int                  numConfigs        = 0;
-    __GLXvisualConfig   *pConfigs          = 0;
-    RADEONConfigPrivPtr  pRADEONConfigs    = 0;
-    RADEONConfigPrivPtr *pRADEONConfigPtrs = 0;
-    int                  i, accum, stencil, db;
-    int pixel_code = PIXEL_CODE(pScrn);
-    RHDFUNC(pScrn);
-
-#define RHD_USE_ACCUM   1
-#define RHD_USE_STENCIL 1
-#define RHD_USE_DB      1
-
-    switch (pixel_code) {
-
-    case 16:
-    case 32:
-	numConfigs = 1;
-	if (RHD_USE_ACCUM)   numConfigs *= 2;
-	if (RHD_USE_STENCIL) numConfigs *= 2;
-	if (RHD_USE_DB)      numConfigs *= 2;
-
-	if (!(pConfigs
-	      = (__GLXvisualConfig *)xcalloc(sizeof(__GLXvisualConfig),
-					     numConfigs))) {
-	    return FALSE;
-	}
-	if (!(pRADEONConfigs
-	      = (RADEONConfigPrivPtr)xcalloc(sizeof(RADEONConfigPrivRec),
-					     numConfigs))) {
-	    xfree(pConfigs);
-	    return FALSE;
-	}
-	if (!(pRADEONConfigPtrs
-	      = (RADEONConfigPrivPtr *)xcalloc(sizeof(RADEONConfigPrivPtr),
-					       numConfigs))) {
-	    xfree(pConfigs);
-	    xfree(pRADEONConfigs);
-	    return FALSE;
-	}
-
-	i = 0;
-	for (db = RHD_USE_DB; db >= 0; db--) {
-	  for (accum = 0; accum <= RHD_USE_ACCUM; accum++) {
-	    for (stencil = 0; stencil <= RHD_USE_STENCIL; stencil++) {
-		pRADEONConfigPtrs[i] = &pRADEONConfigs[i];
-
-		pConfigs[i].vid                = (VisualID)(-1);
-		pConfigs[i].class              = -1;
-		pConfigs[i].rgba               = TRUE;
-		if (pixel_code == 32) {
-		    pConfigs[i].redSize            = 8;
-		    pConfigs[i].greenSize          = 8;
-		    pConfigs[i].blueSize           = 8;
-		    pConfigs[i].alphaSize          = 8;
-		    pConfigs[i].redMask            = 0x00FF0000;
-		    pConfigs[i].greenMask          = 0x0000FF00;
-		    pConfigs[i].blueMask           = 0x000000FF;
-		    pConfigs[i].alphaMask          = 0xFF000000;
-		} else {
-		    pConfigs[i].redSize            = 5;
-		    pConfigs[i].greenSize          = 6;
-		    pConfigs[i].blueSize           = 5;
-		    pConfigs[i].redMask            = 0x0000F800;
-		    pConfigs[i].greenMask          = 0x000007E0;
-		    pConfigs[i].blueMask           = 0x0000001F;
-		}
-		if (accum) { /* Simulated in software */
-		    pConfigs[i].accumRedSize   = 16;
-		    pConfigs[i].accumGreenSize = 16;
-		    pConfigs[i].accumBlueSize  = 16;
-		    if (pixel_code == 32)
-			pConfigs[i].accumAlphaSize = 16;
-		}
-		pConfigs[i].doubleBuffer       = db;
-		pConfigs[i].bufferSize         = pixel_code;
-		pConfigs[i].depthSize          = rhdDRI->depthBits;
-		if (stencil)
-		    pConfigs[i].stencilSize    = 8;
-		if (accum ||
-		    (pConfigs[i].stencilSize && pConfigs[i].depthSize != 24))
-		    pConfigs[i].visualRating   = GLX_SLOW_CONFIG;
-		else
-		    pConfigs[i].visualRating   = GLX_NONE;
-		pConfigs[i].transparentPixel   = GLX_NONE;
-		i++;
-	    }
-	  }
-	}
-	break;
-
-    default:
-	xf86DrvMsg(pScreen->myNum, X_ERROR,
-		   "[dri] RHDInitVisualConfigs failed "
-		   "(depth %d not supported).  "
-		   "Disabling DRI.\n", pixel_code);
-	return FALSE;
-    }
-
-    rhdDRI->numVisualConfigs   = numConfigs;
-    rhdDRI->pVisualConfigs     = pConfigs;
-    rhdDRI->pVisualConfigsPriv = pRADEONConfigs;
-    GlxSetVisualConfigs(numConfigs, pConfigs, (void**)pRADEONConfigPtrs);
-    return TRUE;
-}
-
 /* Create the Radeon-specific context information */
 static Bool RHDCreateContext(ScreenPtr pScreen, VisualPtr visual,
 			     drm_context_t hwContext, void *pVisualConfigPriv,
@@ -1005,14 +878,8 @@ RHDDRIVersionCheck(RHDPtr rhdPtr)
 
     RHDFUNC(rhdPtr);
 
-    /* Check that the GLX, DRI, and DRM modules have been loaded by testing
+    /* Check that the DRI, and DRM modules have been loaded by testing
      * for known symbols in each module. */
-    if (!xf86LoaderCheckSymbol("GlxSetVisualConfigs")) {
-	xf86DrvMsg(rhdPtr->scrnIndex, X_ERROR,
-		   "%s: symbol GlxSetVisualConfigs not available.\n", __func__);
-	return FALSE;
-    }
-
     if (!xf86LoaderCheckSymbol("drmAvailable")) {
 	xf86DrvMsg(rhdPtr->scrnIndex, X_ERROR,
 		   "%s: symbol drmAvailable not available.\n", __func__);
@@ -1215,7 +1082,7 @@ Bool RHDDRIPreInit(ScrnInfoPtr pScrn)
     /* Only 16 and 32 color depths are supports currently. */
     if (pixel_code != 16 && pixel_code != 32) {
 	xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-		   "[dri] RHDInitVisualConfigs failed "
+		   "[dri] RHDDRIPreInit failed "
 		   "(depth %d not supported).  "
 		   "Disabling DRI.\n", pixel_code);
 	xfree(rhdDRI);
@@ -1440,12 +1307,6 @@ Bool RHDDRIScreenInit(ScreenPtr pScreen)
 	return FALSE;
     }
 
-    /* FIXME: When are these mappings unmapped? */
-    if (!RHDInitVisualConfigs(pScreen)) {
-	RHDDRICloseScreen(pScreen);
-	return FALSE;
-    }
-
     xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] Visual configs initialized\n");
 
     /* Tell DRI about new memory map */
@@ -1747,14 +1608,6 @@ Bool RHDDRICloseScreen(ScreenPtr pScreen)
 	DRIDestroyInfoRec(rhdDRI->pDRIInfo);
 	rhdDRI->pDRIInfo = NULL;
     }
-    if (rhdDRI->pVisualConfigs) {
-	xfree(rhdDRI->pVisualConfigs);
-	rhdDRI->pVisualConfigs = NULL;
-    }
-    if (rhdDRI->pVisualConfigsPriv) {
-	xfree(rhdDRI->pVisualConfigsPriv);
-	rhdDRI->pVisualConfigsPriv = NULL;
-    }
 
     rhdPtr->directRenderingEnabled = FALSE;
 
diff --git a/src/rhd_driver.c b/src/rhd_driver.c
index c8cd04a..2d7e48f 100644
--- a/src/rhd_driver.c
+++ b/src/rhd_driver.c
@@ -88,7 +88,6 @@
 #ifdef USE_DRI
 #define _XF86DRI_SERVER_
 #include "dri.h"
-#include "GL/glxint.h"
 #ifdef HAVE_XF86DRMMODE_H
 #include "xf86drmMode.h"
 #endif
@@ -1155,8 +1154,7 @@ RHDScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
 
 #ifdef USE_DRI
     /* Setup DRI after visuals have been established, but before fbScreenInit is
-     * called.  fbScreenInit will eventually call the driver's InitGLXVisuals
-     * call back. */
+     * called.  */
     if (rhdPtr->dri)
 	DriScreenInited = RHDDRIScreenInit(pScreen);
 #endif
-- 
2.13.0



More information about the xorg-devel mailing list