diff options
author | Alan Hourihane <alanh@tungstengraphics.com> | 2005-08-15 06:59:24 +0000 |
---|---|---|
committer | Alan Hourihane <alanh@tungstengraphics.com> | 2005-08-15 06:59:24 +0000 |
commit | dabec11d277e68b6940e741651e61102767240b9 (patch) | |
tree | 12e8d6988b4b20a0d4fbcf4312ee89f66ddb1225 | |
parent | 69dc32cfac945bf664ddfbd6f0116404f893e66e (diff) |
Add Egberts fixes for 64bit architectures
Add additional checks for the *DRIRec info structure passed in from the
device driver. This ensures that things fallback to indirect rendering if
the DDX driver has had modifications (i.e. removal of the drmAddress field).
27 files changed, 107 insertions, 36 deletions
diff --git a/src/mesa/drivers/dri/ffb/ffb_xmesa.c b/src/mesa/drivers/dri/ffb/ffb_xmesa.c index e260e1de24..5b50d24d9e 100644 --- a/src/mesa/drivers/dri/ffb/ffb_xmesa.c +++ b/src/mesa/drivers/dri/ffb/ffb_xmesa.c @@ -68,6 +68,12 @@ ffbInitDriver(__DRIscreenPrivate *sPriv) if (getenv("LIBGL_FORCE_XSERVER")) return GL_FALSE; + + if (sPriv->devPrivSize != sizeof(FFBDRIRec)) { + fprintf(stderr,"\nERROR! sizeof(FFBDRIRec) does not match passed size from device driver\n"); + return GL_FALSE; + } + /* Allocate the private area. */ ffbScreen = (ffbScreenPrivate *) MALLOC(sizeof(ffbScreenPrivate)); if (!ffbScreen) @@ -721,7 +727,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIsc { __DRIscreenPrivate *psp; - static const __DRIversion ddx_expected = { 0, 0, 1 }; + static const __DRIversion ddx_expected = { 0, 1, 1 }; static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 0, 0, 1 }; diff --git a/src/mesa/drivers/dri/ffb/server/ffb_drishare.h b/src/mesa/drivers/dri/ffb/server/ffb_drishare.h index f023920a1f..baf2f0d0a6 100644 --- a/src/mesa/drivers/dri/ffb/server/ffb_drishare.h +++ b/src/mesa/drivers/dri/ffb/server/ffb_drishare.h @@ -21,23 +21,18 @@ typedef struct ffb_dri_state { typedef struct { drm_handle_t hFbcRegs; drmSize sFbcRegs; - drmAddress mFbcRegs; drm_handle_t hDacRegs; drmSize sDacRegs; - drmAddress mDacRegs; drm_handle_t hSfb8r; drmSize sSfb8r; - drmAddress mSfb8r; drm_handle_t hSfb32; drmSize sSfb32; - drmAddress mSfb32; drm_handle_t hSfb64; drmSize sSfb64; - drmAddress mSfb64; /* Fastfill/Pagefill parameters. */ unsigned char disable_pagefill; diff --git a/src/mesa/drivers/dri/gamma/gamma_screen.c b/src/mesa/drivers/dri/gamma/gamma_screen.c index bc6b254d32..0b91d059e9 100644 --- a/src/mesa/drivers/dri/gamma/gamma_screen.c +++ b/src/mesa/drivers/dri/gamma/gamma_screen.c @@ -35,6 +35,11 @@ gammaScreenPtr gammaCreateScreen( __DRIscreenPrivate *sPriv ) GLINTDRIPtr gDRIPriv = (GLINTDRIPtr)sPriv->pDevPriv; int i; + if (sPriv->devPrivSize != sizeof(GLINTDRIRec)) { + fprintf(stderr,"\nERROR! sizeof(GLINTDRIRec) does not match passed size from device driver\n"); + return GL_FALSE; + } + #if 0 /* Check the DRI externsion version */ if ( sPriv->driMajor != 3 || sPriv->driMinor != 1 ) { diff --git a/src/mesa/drivers/dri/i810/i810screen.c b/src/mesa/drivers/dri/i810/i810screen.c index 7c5f38e358..c6546d1ebd 100644 --- a/src/mesa/drivers/dri/i810/i810screen.c +++ b/src/mesa/drivers/dri/i810/i810screen.c @@ -223,6 +223,10 @@ i810InitDriver(__DRIscreenPrivate *sPriv) i810ScreenPrivate *i810Screen; I810DRIPtr gDRIPriv = (I810DRIPtr)sPriv->pDevPriv; + if (sPriv->devPrivSize != sizeof(I810DRIRec)) { + fprintf(stderr,"\nERROR! sizeof(I810DRIRec) does not match passed size from device driver\n"); + return GL_FALSE; + } /* Allocate the private area */ i810Screen = (i810ScreenPrivate *)CALLOC(sizeof(i810ScreenPrivate)); diff --git a/src/mesa/drivers/dri/i810/server/i810_dri.c b/src/mesa/drivers/dri/i810/server/i810_dri.c index 17e0f4ead3..f52797c5ed 100644 --- a/src/mesa/drivers/dri/i810/server/i810_dri.c +++ b/src/mesa/drivers/dri/i810/server/i810_dri.c @@ -212,7 +212,7 @@ static int I810DRIAgpInit( const DRIDriverContext *ctx, I810Ptr info) drmAgpAlloc(ctx->drmFD, 4096 * 1024, 1, NULL, &dcacheHandle); info->dcacheHandle = dcacheHandle; - fprintf(stderr, "[agp] dcacheHandle : %p\n", dcacheHandle); + fprintf(stderr, "[agp] dcacheHandle : 0x%x\n", dcacheHandle); #define Elements(x) sizeof(x)/sizeof(*x) for (pitch_idx = 0; pitch_idx < Elements(i810_pitches); pitch_idx++) @@ -710,7 +710,7 @@ static int I810ScreenInit( DRIDriverContext *ctx, I810Ptr info ) return 0; } fprintf(stderr, - "[drm] register handle = 0x%08lx\n", info->regs); + "[drm] register handle = 0x%08x\n", info->regs); I810DRIAgpPreInit(ctx, info); /* Need to AddMap the framebuffer and mmio regions here: diff --git a/src/mesa/drivers/dri/i810/server/i810_dri.h b/src/mesa/drivers/dri/i810/server/i810_dri.h index 2e710a414a..408a4ebb4d 100644 --- a/src/mesa/drivers/dri/i810/server/i810_dri.h +++ b/src/mesa/drivers/dri/i810/server/i810_dri.h @@ -11,7 +11,6 @@ typedef struct { drm_handle_t regs; drmSize regsSize; - drmAddress regsMap; drmSize backbufferSize; drm_handle_t backbuffer; diff --git a/src/mesa/drivers/dri/i830/i830_screen.c b/src/mesa/drivers/dri/i830/i830_screen.c index 4d47f16181..25def0b6fe 100644 --- a/src/mesa/drivers/dri/i830/i830_screen.c +++ b/src/mesa/drivers/dri/i830/i830_screen.c @@ -146,6 +146,10 @@ static GLboolean i830InitDriver(__DRIscreenPrivate *sPriv) (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); void * const psc = sPriv->psc->screenConfigs; + if (sPriv->devPrivSize != sizeof(I830DRIRec)) { + fprintf(stderr,"\nERROR! sizeof(I830DRIRec) does not match passed size from device driver\n"); + return GL_FALSE; + } /* Allocate the private area */ i830Screen = (i830ScreenPrivate *)CALLOC(sizeof(i830ScreenPrivate)); diff --git a/src/mesa/drivers/dri/i830/server/i830_dri.h b/src/mesa/drivers/dri/i830/server/i830_dri.h index 6477f4e79f..e4b36cc16a 100644 --- a/src/mesa/drivers/dri/i830/server/i830_dri.h +++ b/src/mesa/drivers/dri/i830/server/i830_dri.h @@ -18,7 +18,6 @@ typedef struct _I830DRIRec { drm_handle_t regs; drmSize regsSize; - drmAddress regsMap; drmSize backbufferSize; drm_handle_t backbuffer; diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index 61166fe2a6..57c7504bf2 100644 --- a/src/mesa/drivers/dri/i915/intel_screen.c +++ b/src/mesa/drivers/dri/i915/intel_screen.c @@ -80,7 +80,7 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv) void * const psc = sPriv->psc->screenConfigs; if (sPriv->devPrivSize != sizeof(I830DRIRec)) { - fprintf(stderr,"\nERROR! sizeof(I830DRIRec) does not match passed size from 2D driver\n"); + fprintf(stderr,"\nERROR! sizeof(I830DRIRec) does not match passed size from device driver\n"); return GL_FALSE; } diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.c b/src/mesa/drivers/dri/mach64/mach64_screen.c index 0bd8d6eb77..bcdaea166d 100644 --- a/src/mesa/drivers/dri/mach64/mach64_screen.c +++ b/src/mesa/drivers/dri/mach64/mach64_screen.c @@ -211,6 +211,10 @@ mach64CreateScreen( __DRIscreenPrivate *sPriv ) (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); void * const psc = sPriv->psc->screenConfigs; + if (sPriv->devPrivSize != sizeof(ATIDRIRec)) { + fprintf(stderr,"\nERROR! sizeof(ATIDRIRec) does not match passed size from device driver\n"); + return GL_FALSE; + } if ( MACH64_DEBUG & DEBUG_VERBOSE_DRI ) fprintf( stderr, "%s\n", __FUNCTION__ ); diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index 1eb03ef0ec..3e7db69c2d 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -200,6 +200,10 @@ mgaInitDriver(__DRIscreenPrivate *sPriv) (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); void * const psc = sPriv->psc->screenConfigs; + if (sPriv->devPrivSize != sizeof(MGADRIRec)) { + fprintf(stderr,"\nERROR! sizeof(MGADRIRec) does not match passed size from device driver\n"); + return GL_FALSE; + } /* Allocate the private area */ mgaScreen = (mgaScreenPrivate *)MALLOC(sizeof(mgaScreenPrivate)); @@ -945,7 +949,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIsc { __DRIscreenPrivate *psp; - static const __DRIversion ddx_expected = { 1, 1, 1 }; + static const __DRIversion ddx_expected = { 1, 2, 0 }; static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 3, 0, 0 }; diff --git a/src/mesa/drivers/dri/mga/server/mga_dri.c b/src/mesa/drivers/dri/mga/server/mga_dri.c index a9830814a1..258ace83a0 100644 --- a/src/mesa/drivers/dri/mga/server/mga_dri.c +++ b/src/mesa/drivers/dri/mga/server/mga_dri.c @@ -206,7 +206,7 @@ static int MGADRIAgpInit(struct DRIDriverContextRec *ctx, MGAPtr pMga) return 0; } fprintf( stderr, - "[agp] WARP microcode handle = 0x%08lx\n", + "[agp] WARP microcode handle = 0x%08x\n", pMga->warp.handle ); if ( drmMap( ctx->drmFD, @@ -233,7 +233,7 @@ static int MGADRIAgpInit(struct DRIDriverContextRec *ctx, MGAPtr pMga) return 0; } fprintf( stderr, - "[agp] Primary DMA handle = 0x%08lx\n", + "[agp] Primary DMA handle = 0x%08x\n", pMga->primary.handle ); if ( drmMap( ctx->drmFD, @@ -260,7 +260,7 @@ static int MGADRIAgpInit(struct DRIDriverContextRec *ctx, MGAPtr pMga) return 0; } fprintf( stderr, - "[agp] DMA buffers handle = 0x%08lx\n", + "[agp] DMA buffers handle = 0x%08x\n", pMga->buffers.handle ); if ( drmMap( ctx->drmFD, @@ -304,7 +304,7 @@ static int MGADRIAgpInit(struct DRIDriverContextRec *ctx, MGAPtr pMga) } /* should i map it ? */ fprintf( stderr, - "[agp] agpTexture handle = 0x%08lx\n", + "[agp] agpTexture handle = 0x%08x\n", pMga->agpTextures.handle ); fprintf( stderr, "[agp] agpTexture size: %d kb\n", pMga->agpTextures.size/1024 ); @@ -339,7 +339,7 @@ static int MGADRIMapInit( struct DRIDriverContextRec *ctx, MGAPtr pMga ) return 0; } fprintf( stderr, - "[drm] Status handle = 0x%08lx\n", + "[drm] Status handle = 0x%08x\n", pMga->status.handle ); if ( drmMap( ctx->drmFD, diff --git a/src/mesa/drivers/dri/mga/server/mga_dri.h b/src/mesa/drivers/dri/mga/server/mga_dri.h index 1ef6592196..03b8414603 100644 --- a/src/mesa/drivers/dri/mga/server/mga_dri.h +++ b/src/mesa/drivers/dri/mga/server/mga_dri.h @@ -49,6 +49,16 @@ # define DEPRECATED #endif +#if 1 +typedef struct _mgaDrmRegion { + drm_handle_t handle; + unsigned int offset; + drmSize size; +} mgaDrmRegion, *mgaDrmRegionPtr; +#else +#define mgaDrmRegion drmRegion +#endif + typedef struct { int chipset; int width DEPRECATED; @@ -91,10 +101,10 @@ typedef struct { * for the X.org 6.9 / 7.0 release), these fields should be removed. */ /*@{*/ - drmRegion registers; /**< MMIO registers. */ - drmRegion status DEPRECATED; /**< No longer used on the client-side. */ - drmRegion primary; /**< Primary DMA region. */ - drmRegion buffers DEPRECATED; /**< No longer used on the client-side. */ + mgaDrmRegion registers; /**< MMIO registers. */ + mgaDrmRegion status DEPRECATED; /**< No longer used on the client-side. */ + mgaDrmRegion primary; /**< Primary DMA region. */ + mgaDrmRegion buffers DEPRECATED; /**< No longer used on the client-side. */ /*@}*/ unsigned int sarea_priv_offset; diff --git a/src/mesa/drivers/dri/r128/r128_screen.c b/src/mesa/drivers/dri/r128/r128_screen.c index 52b9b7bcbc..c6c598cc3b 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.c +++ b/src/mesa/drivers/dri/r128/r128_screen.c @@ -102,6 +102,10 @@ r128CreateScreen( __DRIscreenPrivate *sPriv ) (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); void * const psc = sPriv->psc->screenConfigs; + if (sPriv->devPrivSize != sizeof(R128DRIRec)) { + fprintf(stderr,"\nERROR! sizeof(R128DRIRec) does not match passed size from device driver\n"); + return GL_FALSE; + } /* Allocate the private area */ r128Screen = (r128ScreenPtr) CALLOC( sizeof(*r128Screen) ); diff --git a/src/mesa/drivers/dri/r128/server/r128_dri.c b/src/mesa/drivers/dri/r128/server/r128_dri.c index 4cc3c23098..5edf1e1003 100644 --- a/src/mesa/drivers/dri/r128/server/r128_dri.c +++ b/src/mesa/drivers/dri/r128/server/r128_dri.c @@ -164,7 +164,7 @@ static GLboolean R128DRIAgpInit(const DRIDriverContext *ctx) return GL_FALSE; } fprintf(stderr, - "[agp] ring handle = 0x%08lx\n", info->ringHandle); + "[agp] ring handle = 0x%08x\n", info->ringHandle); if (drmMap(ctx->drmFD, info->ringHandle, info->ringMapSize, (drmAddressPtr)&info->ring) < 0) { @@ -182,7 +182,7 @@ static GLboolean R128DRIAgpInit(const DRIDriverContext *ctx) return GL_FALSE; } fprintf(stderr, - "[agp] ring read ptr handle = 0x%08lx\n", + "[agp] ring read ptr handle = 0x%08x\n", info->ringReadPtrHandle); if (drmMap(ctx->drmFD, info->ringReadPtrHandle, info->ringReadMapSize, @@ -398,7 +398,7 @@ static GLboolean R128DRIMapInit(const DRIDriverContext *ctx) return GL_FALSE; } fprintf(stderr, - "[drm] register handle = 0x%08lx\n", info->registerHandle); + "[drm] register handle = 0x%08x\n", info->registerHandle); return GL_TRUE; } diff --git a/src/mesa/drivers/dri/r200/r200_screen.c b/src/mesa/drivers/dri/r200/r200_screen.c index 480ee64f00..b4c360c218 100644 --- a/src/mesa/drivers/dri/r200/r200_screen.c +++ b/src/mesa/drivers/dri/r200/r200_screen.c @@ -239,6 +239,10 @@ r200CreateScreen( __DRIscreenPrivate *sPriv ) (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); void * const psc = sPriv->psc->screenConfigs; + if (sPriv->devPrivSize != sizeof(RADEONDRIRec)) { + fprintf(stderr,"\nERROR! sizeof(RADEONDRIRec) does not match passed size from device driver\n"); + return GL_FALSE; + } /* Allocate the private area */ screen = (r200ScreenPtr) CALLOC( sizeof(*screen) ); diff --git a/src/mesa/drivers/dri/r300/radeon_screen.c b/src/mesa/drivers/dri/r300/radeon_screen.c index 2893a9824c..ea15e87287 100644 --- a/src/mesa/drivers/dri/r300/radeon_screen.c +++ b/src/mesa/drivers/dri/r300/radeon_screen.c @@ -315,6 +315,10 @@ static radeonScreenPtr radeonCreateScreen(__DRIscreenPrivate * sPriv) (*dri_interface->getProcAddress("glxEnableExtension")); void *const psc = sPriv->psc->screenConfigs; + if (sPriv->devPrivSize != sizeof(RADEONDRIRec)) { + fprintf(stderr,"\nERROR! sizeof(RADEONDRIRec) does not match passed size from device driver\n"); + return GL_FALSE; + } /* Allocate the private area */ screen = (radeonScreenPtr) CALLOC(sizeof(*screen)); diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 6822fed9ca..b3a768c285 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -212,6 +212,10 @@ radeonScreenPtr radeonCreateScreen( __DRIscreenPrivate *sPriv ) (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); void * const psc = sPriv->psc->screenConfigs; + if (sPriv->devPrivSize != sizeof(RADEONDRIRec)) { + fprintf(stderr,"\nERROR! sizeof(RADEONDRIRec) does not match passed size from device driver\n"); + return GL_FALSE; + } /* Allocate the private area */ screen = (radeonScreenPtr) CALLOC( sizeof(*screen) ); diff --git a/src/mesa/drivers/dri/radeon/server/radeon_dri.c b/src/mesa/drivers/dri/radeon/server/radeon_dri.c index 1258b263f5..7f83d868cb 100644 --- a/src/mesa/drivers/dri/radeon/server/radeon_dri.c +++ b/src/mesa/drivers/dri/radeon/server/radeon_dri.c @@ -398,7 +398,7 @@ static int RADEONDRIAgpInit( const DRIDriverContext *ctx, RADEONInfoPtr info) fprintf(stderr, "[gart] Could not add ring mapping\n"); return 0; } - fprintf(stderr, "[gart] ring handle = 0x%08lx\n", info->ringHandle); + fprintf(stderr, "[gart] ring handle = 0x%08x\n", info->ringHandle); if (drmAddMap(ctx->drmFD, info->ringReadOffset, info->ringReadMapSize, @@ -409,7 +409,7 @@ static int RADEONDRIAgpInit( const DRIDriverContext *ctx, RADEONInfoPtr info) } fprintf(stderr, - "[gart] ring read ptr handle = 0x%08lx\n", + "[gart] ring read ptr handle = 0x%08lx\n", info->ringReadPtrHandle); if (drmAddMap(ctx->drmFD, info->bufStart, info->bufMapSize, @@ -419,7 +419,7 @@ static int RADEONDRIAgpInit( const DRIDriverContext *ctx, RADEONInfoPtr info) return 0; } fprintf(stderr, - "[gart] vertex/indirect buffers handle = 0x%08lx\n", + "[gart] vertex/indirect buffers handle = 0x%08x\n", info->bufHandle); if (drmAddMap(ctx->drmFD, info->gartTexStart, info->gartTexMapSize, @@ -429,7 +429,7 @@ static int RADEONDRIAgpInit( const DRIDriverContext *ctx, RADEONInfoPtr info) return 0; } fprintf(stderr, - "[gart] AGP texture map handle = 0x%08lx\n", + "[gart] AGP texture map handle = 0x%08lx\n", info->gartTexHandle); /* Initialize Radeon's AGP registers */ @@ -486,7 +486,7 @@ static int RADEONDRIPciInit(const DRIDriverContext *ctx, RADEONInfoPtr info) return 0; } fprintf(stderr, - "[pci] ring handle = 0x%08lx\n", info->ringHandle); + "[pci] ring handle = 0x%08x\n", info->ringHandle); if (drmAddMap(ctx->drmFD, info->ringReadOffset, info->ringReadMapSize, DRM_SCATTER_GATHER, flags, &info->ringReadPtrHandle) < 0) { @@ -495,7 +495,7 @@ static int RADEONDRIPciInit(const DRIDriverContext *ctx, RADEONInfoPtr info) return 0; } fprintf(stderr, - "[pci] ring read ptr handle = 0x%08lx\n", + "[pci] ring read ptr handle = 0x%08lx\n", info->ringReadPtrHandle); if (drmAddMap(ctx->drmFD, info->bufStart, info->bufMapSize, @@ -505,7 +505,7 @@ static int RADEONDRIPciInit(const DRIDriverContext *ctx, RADEONInfoPtr info) return 0; } fprintf(stderr, - "[pci] vertex/indirect buffers handle = 0x%08lx\n", + "[pci] vertex/indirect buffers handle = 0x%08lx\n", info->bufHandle); if (drmAddMap(ctx->drmFD, info->gartTexStart, info->gartTexMapSize, @@ -515,7 +515,7 @@ static int RADEONDRIPciInit(const DRIDriverContext *ctx, RADEONInfoPtr info) return 0; } fprintf(stderr, - "[pci] GART texture map handle = 0x%08lx\n", + "[pci] GART texture map handle = 0x%08x\n", info->gartTexHandle); return 1; diff --git a/src/mesa/drivers/dri/s3v/s3v_screen.c b/src/mesa/drivers/dri/s3v/s3v_screen.c index 810232fec4..f1810597e6 100644 --- a/src/mesa/drivers/dri/s3v/s3v_screen.c +++ b/src/mesa/drivers/dri/s3v/s3v_screen.c @@ -17,6 +17,11 @@ s3vScreenPtr s3vCreateScreen( __DRIscreenPrivate *sPriv ) DEBUG(("sPriv->pDevPriv at %p\n", sPriv->pDevPriv)); DEBUG(("size = %i\n", sizeof(*vDRIPriv))); + if (sPriv->devPrivSize != sizeof(S3VDRIRec)) { + fprintf(stderr,"\nERROR! sizeof(S3VDRIRec) does not match passed size from device driver\n"); + return GL_FALSE; + } + /* Allocate the private area */ s3vScreen = (s3vScreenPtr) CALLOC( sizeof(*s3vScreen) ); if ( !s3vScreen ) return NULL; diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c index d57b2c52d4..12cf78535a 100644 --- a/src/mesa/drivers/dri/savage/savage_xmesa.c +++ b/src/mesa/drivers/dri/savage/savage_xmesa.c @@ -170,6 +170,11 @@ savageInitDriver(__DRIscreenPrivate *sPriv) savageScreenPrivate *savageScreen; SAVAGEDRIPtr gDRIPriv = (SAVAGEDRIPtr)sPriv->pDevPriv; + if (sPriv->devPrivSize != sizeof(SAVAGEDRIRec)) { + fprintf(stderr,"\nERROR! sizeof(SAVAGEDRIRec) does not match passed size from device driver\n"); + return GL_FALSE; + } + /* Allocate the private area */ savageScreen = (savageScreenPrivate *)Xmalloc(sizeof(savageScreenPrivate)); if (!savageScreen) diff --git a/src/mesa/drivers/dri/sis/server/sis_dri.h b/src/mesa/drivers/dri/sis/server/sis_dri.h index df18ff0bac..a05662430e 100644 --- a/src/mesa/drivers/dri/sis/server/sis_dri.h +++ b/src/mesa/drivers/dri/sis/server/sis_dri.h @@ -38,7 +38,6 @@ typedef struct { typedef struct { drm_handle_t handle; drmSize size; - drmAddress map; } sisRegion, *sisRegionPtr; typedef struct { diff --git a/src/mesa/drivers/dri/sis/sis_screen.c b/src/mesa/drivers/dri/sis/sis_screen.c index 174a74169c..8815d0e832 100644 --- a/src/mesa/drivers/dri/sis/sis_screen.c +++ b/src/mesa/drivers/dri/sis/sis_screen.c @@ -129,6 +129,10 @@ sisCreateScreen( __DRIscreenPrivate *sPriv ) sisScreenPtr sisScreen; SISDRIPtr sisDRIPriv = (SISDRIPtr)sPriv->pDevPriv; + if (sPriv->devPrivSize != sizeof(SISDRIRec)) { + fprintf(stderr,"\nERROR! sizeof(SISDRIRec) does not match passed size from device driver\n"); + return GL_FALSE; + } /* Allocate the private area */ sisScreen = (sisScreenPtr)CALLOC( sizeof(*sisScreen) ); @@ -427,7 +431,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, { __DRIscreenPrivate *psp; - static const __DRIversion ddx_expected = {0, 1, 0}; + static const __DRIversion ddx_expected = {0, 8, 0}; static const __DRIversion dri_expected = {4, 0, 0}; static const __DRIversion drm_expected = {1, 0, 0}; diff --git a/src/mesa/drivers/dri/tdfx/server/tdfx_dri.h b/src/mesa/drivers/dri/tdfx/server/tdfx_dri.h index 8f3104f3d9..acd0b9ae5b 100644 --- a/src/mesa/drivers/dri/tdfx/server/tdfx_dri.h +++ b/src/mesa/drivers/dri/tdfx/server/tdfx_dri.h @@ -9,7 +9,6 @@ typedef struct { drm_handle_t regs; drmSize regsSize; - drmAddress regsMap; int deviceID; int width; int height; diff --git a/src/mesa/drivers/dri/tdfx/tdfx_screen.c b/src/mesa/drivers/dri/tdfx/tdfx_screen.c index 0da4d7e3c2..ab64f7986d 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_screen.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_screen.c @@ -74,6 +74,11 @@ tdfxCreateScreen( __DRIscreenPrivate *sPriv ) tdfxScreenPrivate *fxScreen; TDFXDRIPtr fxDRIPriv = (TDFXDRIPtr) sPriv->pDevPriv; + if (sPriv->devPrivSize != sizeof(TDFXDRIRec)) { + fprintf(stderr,"\nERROR! sizeof(TDFXDRIRec) does not match passed size from device driver\n"); + return GL_FALSE; + } + /* Allocate the private area */ fxScreen = (tdfxScreenPrivate *) CALLOC( sizeof(tdfxScreenPrivate) ); if ( !fxScreen ) @@ -441,7 +446,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIsc __GLcontextModes ** driver_modes ) { __DRIscreenPrivate *psp; - static const __DRIversion ddx_expected = { 1, 0, 0 }; + static const __DRIversion ddx_expected = { 1, 1, 0 }; static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 1, 0, 0 }; diff --git a/src/mesa/drivers/dri/trident/trident_context.c b/src/mesa/drivers/dri/trident/trident_context.c index 8d0717937e..b44c6205c9 100644 --- a/src/mesa/drivers/dri/trident/trident_context.c +++ b/src/mesa/drivers/dri/trident/trident_context.c @@ -358,6 +358,10 @@ tridentScreenPtr tridentCreateScreen( __DRIscreenPrivate *sPriv ) TRIDENTDRIPtr tDRIPriv = (TRIDENTDRIPtr)sPriv->pDevPriv; tridentScreenPtr tridentScreen; + if (sPriv->devPrivSize != sizeof(TRIDENTDRIRec)) { + fprintf(stderr,"\nERROR! sizeof(TRIDENTDRIRec) does not match passed size from device driver\n"); + return GL_FALSE; + } /* Allocate the private area */ tridentScreen = (tridentScreenPtr) CALLOC( sizeof(*tridentScreen) ); diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c index 924818c124..50342f3ff5 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.c +++ b/src/mesa/drivers/dri/unichrome/via_screen.c @@ -101,6 +101,10 @@ viaInitDriver(__DRIscreenPrivate *sPriv) (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); void * const psc = sPriv->psc->screenConfigs; + if (sPriv->devPrivSize != sizeof(VIADRIRec)) { + fprintf(stderr,"\nERROR! sizeof(VIADRIRec) does not match passed size from device driver\n"); + return GL_FALSE; + } /* Allocate the private area */ viaScreen = (viaScreenPrivate *) CALLOC(sizeof(viaScreenPrivate)); |