From: Emil Velikov <emil.veli...@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

Signed-off-by: Emil Velikov <emil.veli...@collabora.com>
---
Analogous to the radeonhd one - patch is for posterity.
Feel free to pick or ignore.
---
 src/via_dri.c    | 248 +------------------------------------------------------
 src/via_dri.h    |   4 -
 src/via_driver.c |   1 -
 src/via_driver.h |   4 -
 4 files changed, 1 insertion(+), 256 deletions(-)

diff --git a/src/via_dri.c b/src/via_dri.c
index 98956bc..c19b65d 100644
--- a/src/via_dri.c
+++ b/src/via_dri.c
@@ -34,7 +34,6 @@
 #include "xf86Pci.h"
 
 #define _XF86DRI_SERVER_
-#include "GL/glxtokens.h"
 #include "sarea.h"
 
 #include "via.h"
@@ -60,12 +59,6 @@
 #define VIA_AGP_1X_MODE 0x01
 #define VIA_AGP_FW_MODE 0x10
 
-extern void GlxSetVisualConfigs(
-    int nconfigs,
-    __GLXvisualConfig *configs,
-    void **configprivs
-);
-
 typedef struct {
     int major;
     int minor;
@@ -79,7 +72,6 @@ static const ViaDRMVersion drmCompat = {2, 0, 0};
 
 int test_alloc_FB(ScreenPtr pScreen, VIAPtr pVia, int Size);
 int test_alloc_AGP(ScreenPtr pScreen, VIAPtr pVia, int Size);
-static Bool VIAInitVisualConfigs(ScreenPtr pScreen);
 static Bool VIADRIAgpInit(ScreenPtr pScreen, VIAPtr pVia);
 static Bool VIADRIPciInit(ScreenPtr pScreen, VIAPtr pVia);
 static Bool VIADRIFBInit(ScreenPtr pScreen, VIAPtr pVia);
@@ -395,230 +387,6 @@ static Bool VIADRIPciInit(ScreenPtr pScreen, VIAPtr pVia)
     return TRUE;       
 }
 
-static Bool
-VIAInitVisualConfigs(ScreenPtr pScreen)
-{
-    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
-    VIAPtr pVia = VIAPTR(pScrn);
-    int numConfigs = 0;
-    __GLXvisualConfig *pConfigs = 0;
-    VIAConfigPrivPtr pVIAConfigs = 0;
-    VIAConfigPrivPtr *pVIAConfigPtrs = 0;
-    int i, db, stencil, accum;
-
-    switch (pScrn->bitsPerPixel) {
-       case 8:
-       case 24:
-           break;
-       case 16:
-           numConfigs = 12;
-           if (!(pConfigs = 
(__GLXvisualConfig*)xcalloc(sizeof(__GLXvisualConfig),
-                                                  numConfigs)))
-               return FALSE;
-           if (!(pVIAConfigs = 
(VIAConfigPrivPtr)xcalloc(sizeof(VIAConfigPrivRec),
-                                                   numConfigs))) {
-               xfree(pConfigs);
-               return FALSE;
-           }
-           if (!(pVIAConfigPtrs = 
(VIAConfigPrivPtr*)xcalloc(sizeof(VIAConfigPrivPtr),
-                                                         numConfigs))) {
-               xfree(pConfigs);
-               xfree(pVIAConfigs);
-               return FALSE;
-           }
-           for (i=0; i<numConfigs; i++) 
-               pVIAConfigPtrs[i] = &pVIAConfigs[i];
-
-           i = 0;
-           for (accum = 0; accum <= 1; accum++) {
-               /* 32bpp depth buffer disabled, as Mesa has limitations */
-               for (stencil=0; stencil<=2; stencil++) {
-                   for (db = 0; db <= 1; db++) {
-                       pConfigs[i].vid = -1;
-                       pConfigs[i].class = -1;
-                       pConfigs[i].rgba = TRUE;
-                       pConfigs[i].redSize = -1;
-                       pConfigs[i].greenSize = -1;
-                       pConfigs[i].blueSize = -1;
-                       pConfigs[i].redMask = -1;
-                       pConfigs[i].greenMask = -1;
-                       pConfigs[i].blueMask = -1;
-                       pConfigs[i].alphaSize = 0;
-                       pConfigs[i].alphaMask = 0;
-                       
-                       if (accum) {
-                           pConfigs[i].accumRedSize = 16;
-                           pConfigs[i].accumGreenSize = 16;
-                           pConfigs[i].accumBlueSize = 16;
-                           pConfigs[i].accumAlphaSize = 0;
-                       }
-                       else {
-                           pConfigs[i].accumRedSize = 0;
-                           pConfigs[i].accumGreenSize = 0;
-                           pConfigs[i].accumBlueSize = 0;
-                           pConfigs[i].accumAlphaSize = 0;
-                       }
-                       if (!db)
-                           pConfigs[i].doubleBuffer = TRUE;
-                       else
-                           pConfigs[i].doubleBuffer = FALSE;
-                       
-                       pConfigs[i].stereo = FALSE;
-                       pConfigs[i].bufferSize = -1;
-                       
-                       switch (stencil) {
-                           case 0:
-                               pConfigs[i].depthSize = 24;
-                               pConfigs[i].stencilSize = 8;
-                               break;
-                           case 1:
-                               pConfigs[i].depthSize = 16;
-                               pConfigs[i].stencilSize = 0;
-                               break;
-                           case 2:
-                               pConfigs[i].depthSize = 0;
-                               pConfigs[i].stencilSize = 0;
-                               break;
-                           case 3:
-                               pConfigs[i].depthSize = 32;
-                               pConfigs[i].stencilSize = 0;
-                               break;
-                       }
-                       
-                       pConfigs[i].auxBuffers = 0;
-                       pConfigs[i].level = 0;
-                       if (accum) {
-                           pConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT;
-                       } else {
-                           pConfigs[i].visualRating = GLX_NONE_EXT;
-                       }
-                       pConfigs[i].transparentPixel = GLX_NONE_EXT;
-                       pConfigs[i].transparentRed = 0;
-                       pConfigs[i].transparentGreen = 0;
-                       pConfigs[i].transparentBlue = 0;
-                       pConfigs[i].transparentAlpha = 0;
-                       pConfigs[i].transparentIndex = 0;
-                       i++;
-                   }
-               }
-           }
-       
-       if (i != numConfigs) {
-           xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-               "[dri] Incorrect initialization of visuals.  Disabling DRI.\n");
-               return FALSE;
-       }
-       break;
-           
-       case 32:
-           numConfigs = 12;
-           if (!(pConfigs = 
(__GLXvisualConfig*)xcalloc(sizeof(__GLXvisualConfig),
-                                                  numConfigs)))
-               return FALSE;
-           if (!(pVIAConfigs = 
(VIAConfigPrivPtr)xcalloc(sizeof(VIAConfigPrivRec),
-                                                   numConfigs))) {
-               xfree(pConfigs);
-               return FALSE;
-           }
-           if (!(pVIAConfigPtrs = 
(VIAConfigPrivPtr*)xcalloc(sizeof(VIAConfigPrivPtr),
-                                                         numConfigs))) {
-               xfree(pConfigs);
-               xfree(pVIAConfigs);
-               return FALSE;
-           }
-           for (i=0; i<numConfigs; i++) 
-               pVIAConfigPtrs[i] = &pVIAConfigs[i];
-
-           i = 0;
-           for (accum = 0; accum <= 1; accum++) {
-               /* 32bpp depth buffer disabled, as Mesa has limitations */
-               for (stencil=0; stencil<=2; stencil++) {
-                   for (db = 0; db <= 1; db++) {
-                       pConfigs[i].vid = -1;
-                       pConfigs[i].class = -1;
-                       pConfigs[i].rgba = TRUE;
-                       pConfigs[i].redSize = -1;
-                       pConfigs[i].greenSize = -1;
-                       pConfigs[i].blueSize = -1;
-                       pConfigs[i].redMask = -1;
-                       pConfigs[i].greenMask = -1;
-                       pConfigs[i].blueMask = -1;
-                       pConfigs[i].alphaSize = 8;
-                       pConfigs[i].alphaMask = 0xFF000000;
-                       
-                       if (accum) {
-                           pConfigs[i].accumRedSize = 16;
-                           pConfigs[i].accumGreenSize = 16;
-                           pConfigs[i].accumBlueSize = 16;
-                           pConfigs[i].accumAlphaSize = 16;
-                       }
-                       else {
-                           pConfigs[i].accumRedSize = 0;
-                           pConfigs[i].accumGreenSize = 0;
-                           pConfigs[i].accumBlueSize = 0;
-                           pConfigs[i].accumAlphaSize = 0;
-                       }
-                       if (!db)
-                           pConfigs[i].doubleBuffer = TRUE;
-                       else
-                           pConfigs[i].doubleBuffer = FALSE;
-                       
-                       pConfigs[i].stereo = FALSE;
-                       pConfigs[i].bufferSize = -1;
-                       
-                       switch (stencil) {
-                           case 0:
-                               pConfigs[i].depthSize = 24;
-                               pConfigs[i].stencilSize = 8;
-                               break;
-                           case 1:
-                               pConfigs[i].depthSize = 16;
-                               pConfigs[i].stencilSize = 0;
-                               break;
-                           case 2:
-                               pConfigs[i].depthSize = 0;
-                               pConfigs[i].stencilSize = 0;
-                               break;
-                           case 3:
-                               pConfigs[i].depthSize = 32;
-                               pConfigs[i].stencilSize = 0;
-                               break;
-                       }
-                       
-                       pConfigs[i].auxBuffers = 0;
-                       pConfigs[i].level = 0;
-                       if (accum)
-                           pConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT;
-                       else
-                           pConfigs[i].visualRating = GLX_NONE_EXT;
-                       pConfigs[i].transparentPixel = GLX_NONE_EXT;
-                       pConfigs[i].transparentRed = 0;
-                       pConfigs[i].transparentGreen = 0;
-                       pConfigs[i].transparentBlue = 0;
-                       pConfigs[i].transparentAlpha = 0;
-                       pConfigs[i].transparentIndex = 0;
-                       i++;
-                   }
-               }
-           }
-       
-       if (i != numConfigs) {
-           xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-               "[dri] Incorrect initialization of visuals.  Disabling DRI.\n");
-               return FALSE;
-       }
-           
-       break;
-    }
- 
-    pVia->numVisualConfigs = numConfigs;
-    pVia->pVisualConfigs = pConfigs;
-    pVia->pVisualConfigsPriv = pVIAConfigs;
-    GlxSetVisualConfigs(numConfigs, pConfigs, (void**)pVIAConfigPtrs);
-
-    return TRUE;
-}
-
 Bool VIADRIScreenInit(ScreenPtr pScreen)
 {
     ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
@@ -630,9 +398,8 @@ Bool VIADRIScreenInit(ScreenPtr pScreen)
     /* if symbols or version check fails, we still want this to be NULL */
     pVia->pDRIInfo = NULL;
 
-    /* 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 canonical symbols in each module. */
-    if (!xf86LoaderCheckSymbol("GlxSetVisualConfigs")) return FALSE;
     if (!xf86LoaderCheckSymbol("drmAvailable"))        return FALSE;
     if (!xf86LoaderCheckSymbol("DRIQueryVersion")) {
        xf86DrvMsg(pScreen->myNum, X_ERROR,
@@ -759,10 +526,6 @@ Bool VIADRIScreenInit(ScreenPtr pScreen)
     drmFreeVersion(drmVer);
 
           
-    if (!(VIAInitVisualConfigs(pScreen))) {
-       VIADRICloseScreen(pScreen);
-       return FALSE;
-    }
     xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] visual configs initialized.\n" 
);
   
     /* DRIScreenInit doesn't add all the common mappings.  Add additional 
mappings here. */
@@ -812,15 +575,6 @@ VIADRICloseScreen(ScreenPtr pScreen)
        DRIDestroyInfoRec(pVia->pDRIInfo);
        pVia->pDRIInfo = NULL;
     }
-    
-    if (pVia->pVisualConfigs) {
-       xfree(pVia->pVisualConfigs);
-       pVia->pVisualConfigs = NULL;
-    }
-    if (pVia->pVisualConfigsPriv) {
-       xfree(pVia->pVisualConfigsPriv);
-       pVia->pVisualConfigsPriv = NULL;
-    }
 }
 
 /* TODO: xserver receives driver's swapping event and does something
diff --git a/src/via_dri.h b/src/via_dri.h
index e7e9f32..fb8821b 100644
--- a/src/via_dri.h
+++ b/src/via_dri.h
@@ -69,10 +69,6 @@ typedef struct {
 
 typedef struct {
     int dummy;
-} VIAConfigPrivRec, *VIAConfigPrivPtr;
-
-typedef struct {
-    int dummy;
 } VIADRIContextRec, *VIADRIContextPtr;
 
 #endif /* _VIA_DRI_H_ */
diff --git a/src/via_driver.c b/src/via_driver.c
index fe59dfe..7880653 100644
--- a/src/via_driver.c
+++ b/src/via_driver.c
@@ -349,7 +349,6 @@ static const char *driSymbols[] = {
     "DRIUnlock",
     "DRIOpenConnection",
     "DRICloseConnection",
-    "GlxSetVisualConfigs",
     NULL
 };
 #endif
diff --git a/src/via_driver.h b/src/via_driver.h
index b2012a3..d7a719d 100644
--- a/src/via_driver.h
+++ b/src/via_driver.h
@@ -60,7 +60,6 @@
 #define _XF86DRI_SERVER_
 #include "sarea.h"
 #include "dri.h"
-#include "GL/glxint.h"
 #include "via_dri.h"
 #endif
 
@@ -295,9 +294,6 @@ typedef struct _VIA {
     Bool                XvMCEnabled;
     DRIInfoPtr         pDRIInfo;
     int                drmFD;
-    int                numVisualConfigs;
-    __GLXvisualConfig*         pVisualConfigs;
-    VIAConfigPrivPtr   pVisualConfigsPriv;
     drm_handle_t       agpHandle;
     drm_handle_t       registerHandle;
     drm_handle_t        frameBufferHandle;
-- 
2.13.0

_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to