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

Emil Velikov emil.l.velikov at gmail.com
Mon Jul 31 13:13:50 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.

Cc: Mathieu Larouche <mathieu.larouche at matrox.com>
Cc: Dave Airlie <airlied at redhat.com>
Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
There's a GLX reference in mga_ucode.h - a file which was seemingly
never used since day 1. I'm not going to bother with that, since I've
taken enough of a diversion already ;-)
---
 src/mga.h         |   7 --
 src/mga_dri.c     | 236 +-----------------------------------------------------
 src/mga_dripriv.h |  11 ---
 src/mga_storm.c   |   4 -
 4 files changed, 2 insertions(+), 256 deletions(-)

diff --git a/src/mga.h b/src/mga.h
index 0df16e9..081472a 100644
--- a/src/mga.h
+++ b/src/mga.h
@@ -41,11 +41,7 @@
 #define _XF86DRI_SERVER_
 #include "mga_dripriv.h"
 #include "dri.h"
-#include "GL/glxint.h"
 
-#include "dri.h"
-
-#include "GL/glxint.h"
 #include "mga_dri.h"
 #endif
 
@@ -611,9 +607,6 @@ typedef struct {
     Bool 		directRenderingEnabled;
     DRIInfoPtr 		pDRIInfo;
     int 		drmFD;
-    int 		numVisualConfigs;
-    __GLXvisualConfig*	pVisualConfigs;
-    MGAConfigPrivPtr 	pVisualConfigsPriv;
     MGADRIServerPrivatePtr DRIServerInfo;
 
     MGARegRec		DRContextRegs;
diff --git a/src/mga_dri.c b/src/mga_dri.c
index b957028..bb8e84d 100644
--- a/src/mga_dri.c
+++ b/src/mga_dri.c
@@ -48,15 +48,8 @@
 #include "mga_drm.h"
 
 #define _XF86DRI_SERVER_
-#include "GL/glxtokens.h"
 #include "sarea.h"
 
-
-
-
-
-#include "GL/glxtokens.h"
-
 #include "mga_reg.h"
 #include "mga.h"
 #include "mga_macros.h"
@@ -67,224 +60,6 @@
 static char MGAKernelDriverName[] = "mga";
 static char MGAClientDriverName[] = "mga";
 
-/* 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 MGAInitVisualConfigs( ScreenPtr pScreen )
-{
-   ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
-   MGAPtr pMga = MGAPTR(pScrn);
-   int numConfigs = 0;
-   __GLXvisualConfig *pConfigs = 0;
-   MGAConfigPrivPtr pMGAConfigs = 0;
-   MGAConfigPrivPtr *pMGAConfigPtrs = 0;
-   int i, db, depth, stencil, accum;
-
-   switch ( pScrn->bitsPerPixel ) {
-   case 8:
-   case 24:
-      break;
-
-   case 16:
-      numConfigs = 8;
-
-      pConfigs = (__GLXvisualConfig*)calloc( sizeof(__GLXvisualConfig),
-						numConfigs );
-      if ( !pConfigs ) {
-	 return FALSE;
-      }
-
-      pMGAConfigs = (MGAConfigPrivPtr)calloc( sizeof(MGAConfigPrivRec),
-						 numConfigs );
-      if ( !pMGAConfigs ) {
-	 free(pConfigs);
-	 return FALSE;
-      }
-
-      pMGAConfigPtrs = (MGAConfigPrivPtr*)calloc( sizeof(MGAConfigPrivPtr),
-						     numConfigs );
-      if ( !pMGAConfigPtrs ) {
-	 free(pConfigs);
-	 free(pMGAConfigs);
-	 return FALSE;
-      }
-
-      for ( i = 0 ; i < numConfigs ; i++ ) {
-	 pMGAConfigPtrs[i] = &pMGAConfigs[i];
-      }
-
-      i = 0;
-      for ( accum = 0 ; accum <= 1 ; accum++ ) {
-         for ( stencil = 0 ; stencil <= 1 ; stencil++ ) {
-            for ( db = 1 ; db >= 0 ; db-- ) {
-               pConfigs[i].vid			= -1;
-               pConfigs[i].class		= -1;
-               pConfigs[i].rgba			= TRUE;
-               pConfigs[i].redSize		= 5;
-               pConfigs[i].greenSize		= 6;
-               pConfigs[i].blueSize		= 5;
-               pConfigs[i].alphaSize		= 0;
-               pConfigs[i].redMask		= 0x0000F800;
-               pConfigs[i].greenMask		= 0x000007E0;
-               pConfigs[i].blueMask		= 0x0000001F;
-               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		= 16;
-               pConfigs[i].depthSize		= 16;
-               if ( stencil ) {
-                  pConfigs[i].stencilSize	= 8;
-               } else {
-                  pConfigs[i].stencilSize	= 0;
-	       }
-               pConfigs[i].auxBuffers		= 0;
-               pConfigs[i].level		= 0;
-               if ( accum || stencil ) {
-                  pConfigs[i].visualRating	= GLX_SLOW_CONFIG;
-               } else {
-                  pConfigs[i].visualRating	= GLX_NONE;
-	       }
-               pConfigs[i].transparentPixel	= GLX_NONE;
-               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,
-		     "[drm] Incorrect initialization of visuals\n" );
-         return FALSE;
-      }
-      break;
-
-   case 32:
-      numConfigs = 8;
-
-      pConfigs = (__GLXvisualConfig*)calloc( sizeof(__GLXvisualConfig),
-						numConfigs );
-      if ( !pConfigs ) {
-	 return FALSE;
-      }
-
-      pMGAConfigs = (MGAConfigPrivPtr)calloc( sizeof(MGAConfigPrivRec),
-						 numConfigs );
-      if ( !pMGAConfigs ) {
-	 free(pConfigs);
-	 return FALSE;
-      }
-
-      pMGAConfigPtrs = (MGAConfigPrivPtr*)calloc( sizeof(MGAConfigPrivPtr),
-						     numConfigs );
-      if ( !pMGAConfigPtrs ) {
-	 free(pConfigs);
-	 free(pMGAConfigs);
-	 return FALSE;
-      }
-
-      for ( i = 0 ; i < numConfigs ; i++ ) {
-	 pMGAConfigPtrs[i] = &pMGAConfigs[i];
-      }
-
-      i = 0;
-      for ( accum = 0 ; accum <= 1 ; accum++ ) {
-         for ( depth = 0 ; depth <= 1 ; depth++ ) { /* and stencil */
-            for ( db = 1 ; db >= 0 ; db-- ) {
-               pConfigs[i].vid			= -1;
-               pConfigs[i].class		= -1;
-               pConfigs[i].rgba			= TRUE;
-               pConfigs[i].redSize		= 8;
-               pConfigs[i].greenSize		= 8;
-               pConfigs[i].blueSize		= 8;
-               pConfigs[i].alphaSize		= 0;
-               pConfigs[i].redMask		= 0x00FF0000;
-               pConfigs[i].greenMask		= 0x0000FF00;
-               pConfigs[i].blueMask		= 0x000000FF;
-               pConfigs[i].alphaMask		= 0x0;
-               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		= 24;
-               if ( depth ) {
-		     pConfigs[i].depthSize	= 24;
-                     pConfigs[i].stencilSize	= 8;
-               }
-               else {
-                     pConfigs[i].depthSize	= 0;
-                     pConfigs[i].stencilSize	= 0;
-               }
-               pConfigs[i].auxBuffers		= 0;
-               pConfigs[i].level		= 0;
-               if ( accum ) {
-                  pConfigs[i].visualRating	= GLX_SLOW_CONFIG;
-               } else {
-                  pConfigs[i].visualRating	= GLX_NONE;
-	       }
-               pConfigs[i].transparentPixel	= GLX_NONE;
-               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,
-		     "[drm] Incorrect initialization of visuals\n" );
-         return FALSE;
-      }
-      break;
-
-   default:
-      /* Unexpected bits/pixels */
-      break;
-   }
-
-   pMga->numVisualConfigs = numConfigs;
-   pMga->pVisualConfigs = pConfigs;
-   pMga->pVisualConfigsPriv = pMGAConfigs;
-
-   GlxSetVisualConfigs( numConfigs, pConfigs, (void **)pMGAConfigPtrs );
-
-   return TRUE;
-}
-
 static Bool MGACreateContext( ScreenPtr pScreen, VisualPtr visual,
 			      drm_context_t hwContext, void *pVisualConfigPriv,
 			      DRIContextType contextStore )
@@ -1095,10 +870,9 @@ Bool MGADRIScreenInit( ScreenPtr pScreen )
        return FALSE;
    }
 
-   /* 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,
@@ -1350,11 +1124,7 @@ Bool MGADRIScreenInit( ScreenPtr pScreen )
 			&scratch_ptr);
    }
 
-   if ( !MGAInitVisualConfigs( pScreen ) ) {
-      DRICloseScreen( pScreen );
-      return FALSE;
-   }
-   xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[dri] visual configs initialized\n" );
+   xf85DrvMsg( pScrn->scrnIndex, X_INFO, "[dri] visual configs initialized\n" );
 
    return TRUE;
 }
@@ -1495,6 +1265,4 @@ void MGADRICloseScreen( ScreenPtr pScreen )
    }
    free(pMga->DRIServerInfo);
    pMga->DRIServerInfo = 0;
-   free(pMga->pVisualConfigs);
-   free(pMga->pVisualConfigsPriv);
 }
diff --git a/src/mga_dripriv.h b/src/mga_dripriv.h
index feca134..d494665 100644
--- a/src/mga_dripriv.h
+++ b/src/mga_dripriv.h
@@ -28,19 +28,8 @@
 #ifndef __MGA_DRIPRIV_H__
 #define __MGA_DRIPRIV_H__
 
-#include "GL/glxint.h"
-
 #define MGA_MAX_DRAWABLES 256
 
-extern void GlxSetVisualConfigs( int nconfigs,
-				 __GLXvisualConfig *configs,
-				 void **configprivs );
-
-typedef struct {
-  /* Nothing here yet */
-  int dummy;
-} MGAConfigPrivRec, *MGAConfigPrivPtr;
-
 typedef struct {
   /* Nothing here yet */
   int dummy;
diff --git a/src/mga_storm.c b/src/mga_storm.c
index c945971..3e0d382 100644
--- a/src/mga_storm.c
+++ b/src/mga_storm.c
@@ -23,10 +23,6 @@
 #include "miline.h"
 #include "servermd.h"
 
-#ifdef MGADRI
-#include "GL/glxtokens.h"
-#endif
-
 #include "mga.h"
 #include "mga_reg.h"
 #include "mga_macros.h"
-- 
2.13.0



More information about the xorg-devel mailing list