diff options
Diffstat (limited to 'src/via_dri.c')
-rw-r--r-- | src/via_dri.c | 248 |
1 files changed, 1 insertions, 247 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 |