Replace open-coded major, minor, and patch version fields with __DRIversionRec.

This commit is contained in:
Kristian Høgsberg
2007-05-14 16:37:19 -04:00
committed by Kristian Høgsberg
parent 5987a03f99
commit efd03a278a
15 changed files with 41 additions and 65 deletions

View File

@@ -727,15 +727,9 @@ __driUtilCreateNewScreen(int scr, __DRIscreen *psc,
*/ */
psp->drawLockID = 1; psp->drawLockID = 1;
psp->drmMajor = drm_version->major; psp->drm_version = *drm_version;
psp->drmMinor = drm_version->minor; psp->ddx_version = *ddx_version;
psp->drmPatch = drm_version->patch; psp->dri_version = *dri_version;
psp->ddxMajor = ddx_version->major;
psp->ddxMinor = ddx_version->minor;
psp->ddxPatch = ddx_version->patch;
psp->driMajor = dri_version->major;
psp->driMinor = dri_version->minor;
psp->driPatch = dri_version->patch;
/* install driver's callback functions */ /* install driver's callback functions */
memcpy( &psp->DriverAPI, driverAPI, sizeof(struct __DriverAPIRec) ); memcpy( &psp->DriverAPI, driverAPI, sizeof(struct __DriverAPIRec) );

View File

@@ -372,37 +372,19 @@ struct __DRIscreenPrivateRec {
struct __DriverAPIRec DriverAPI; struct __DriverAPIRec DriverAPI;
/** /**
* \name DDX version
* DDX / 2D driver version information. * DDX / 2D driver version information.
* \todo Replace these fields with a \c __DRIversionRec.
*/ */
/*@{*/ __DRIversion ddx_version;
int ddxMajor;
int ddxMinor;
int ddxPatch;
/*@}*/
/** /**
* \name DRI version
* DRI X extension version information. * DRI X extension version information.
* \todo Replace these fields with a \c __DRIversionRec.
*/ */
/*@{*/ __DRIversion dri_version;
int driMajor;
int driMinor;
int driPatch;
/*@}*/
/** /**
* \name DRM version
* DRM (kernel module) version information. * DRM (kernel module) version information.
* \todo Replace these fields with a \c __DRIversionRec.
*/ */
/*@{*/ __DRIversion drm_version;
int drmMajor;
int drmMinor;
int drmPatch;
/*@}*/
/** /**
* ID used when the client sets the drawable lock. * ID used when the client sets the drawable lock.

View File

@@ -231,7 +231,7 @@ intelWindowMoved(struct intel_context *intel)
} }
} }
if (intel->intelScreen->driScrnPriv->ddxMinor >= 7) { if (intel->intelScreen->driScrnPriv->ddx_version.minor >= 7) {
drmI830Sarea *sarea = intel->sarea; drmI830Sarea *sarea = intel->sarea;
drm_clip_rect_t drw_rect = { .x1 = dPriv->x, .x2 = dPriv->x + dPriv->w, drm_clip_rect_t drw_rect = { .x1 = dPriv->x, .x2 = dPriv->x + dPriv->w,
.y1 = dPriv->y, .y2 = dPriv->y + dPriv->h }; .y1 = dPriv->y, .y2 = dPriv->y + dPriv->h };

View File

@@ -217,7 +217,7 @@ intel_recreate_static_regions(intelScreenPrivate *intelScreen)
/* The rotated region is only used for old DDXes that didn't handle rotation /* The rotated region is only used for old DDXes that didn't handle rotation
\ * on their own. \ * on their own.
*/ */
if (intelScreen->driScrnPriv->ddxMinor < 8) { if (intelScreen->driScrnPriv->ddx_version.minor < 8) {
intelScreen->rotated_region = intelScreen->rotated_region =
intel_recreate_static(intelScreen, intel_recreate_static(intelScreen,
intelScreen->rotated_region, intelScreen->rotated_region,
@@ -377,7 +377,7 @@ intelUpdateScreenFromSAREA(intelScreenPrivate * intelScreen,
intelScreen->back.handle = sarea->back_handle; intelScreen->back.handle = sarea->back_handle;
intelScreen->back.size = sarea->back_size; intelScreen->back.size = sarea->back_size;
if (intelScreen->driScrnPriv->ddxMinor >= 8) { if (intelScreen->driScrnPriv->ddx_version.minor >= 8) {
intelScreen->third.offset = sarea->third_offset; intelScreen->third.offset = sarea->third_offset;
intelScreen->third.pitch = sarea->pitch * intelScreen->cpp; intelScreen->third.pitch = sarea->pitch * intelScreen->cpp;
intelScreen->third.handle = sarea->third_handle; intelScreen->third.handle = sarea->third_handle;
@@ -389,7 +389,7 @@ intelUpdateScreenFromSAREA(intelScreenPrivate * intelScreen,
intelScreen->depth.handle = sarea->depth_handle; intelScreen->depth.handle = sarea->depth_handle;
intelScreen->depth.size = sarea->depth_size; intelScreen->depth.size = sarea->depth_size;
if (intelScreen->driScrnPriv->ddxMinor >= 9) { if (intelScreen->driScrnPriv->ddx_version.minor >= 9) {
intelScreen->front.bo_handle = sarea->front_bo_handle; intelScreen->front.bo_handle = sarea->front_bo_handle;
intelScreen->back.bo_handle = sarea->back_bo_handle; intelScreen->back.bo_handle = sarea->back_bo_handle;
intelScreen->third.bo_handle = sarea->third_bo_handle; intelScreen->third.bo_handle = sarea->third_bo_handle;
@@ -488,7 +488,7 @@ intelInitDriver(__DRIscreenPrivate * sPriv)
if (0) if (0)
intelPrintDRIInfo(intelScreen, sPriv, gDRIPriv); intelPrintDRIInfo(intelScreen, sPriv, gDRIPriv);
intelScreen->drmMinor = sPriv->drmMinor; intelScreen->drmMinor = sPriv->drm_version.minor;
/* Determine if IRQs are active? */ /* Determine if IRQs are active? */
{ {
@@ -535,7 +535,7 @@ intelInitDriver(__DRIscreenPrivate * sPriv)
*/ */
intelScreen->ttm = GL_FALSE; intelScreen->ttm = GL_FALSE;
if (getenv("INTEL_NO_TTM") == NULL && if (getenv("INTEL_NO_TTM") == NULL &&
intelScreen->driScrnPriv->ddxMinor >= 9 && intelScreen->driScrnPriv->ddx_version.minor >= 9 &&
intelScreen->front.bo_handle != -1) { intelScreen->front.bo_handle != -1) {
intelScreen->bufmgr = dri_bufmgr_ttm_init(sPriv->fd, intelScreen->bufmgr = dri_bufmgr_ttm_init(sPriv->fd,
DRM_FENCE_TYPE_EXE, DRM_FENCE_TYPE_EXE,

View File

@@ -316,7 +316,7 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv)
return GL_FALSE; return GL_FALSE;
} }
intelScreen->drmMinor = sPriv->drmMinor; intelScreen->drmMinor = sPriv->drm_version.minor;
/* Determine if IRQs are active? */ /* Determine if IRQs are active? */
{ {

View File

@@ -216,7 +216,7 @@ mgaInitDriver(__DRIscreenPrivate *sPriv)
mgaScreen->sPriv = sPriv; mgaScreen->sPriv = sPriv;
sPriv->private = (void *)mgaScreen; sPriv->private = (void *)mgaScreen;
if (sPriv->drmMinor >= 1) { if (sPriv->drm_version.minor >= 1) {
int ret; int ret;
drm_mga_getparam_t gp; drm_mga_getparam_t gp;
@@ -273,7 +273,7 @@ mgaInitDriver(__DRIscreenPrivate *sPriv)
* there is a new, in-kernel mechanism for handling the wait. * there is a new, in-kernel mechanism for handling the wait.
*/ */
if (mgaScreen->sPriv->drmMinor < 2) { if (mgaScreen->sPriv->drm_version.minor < 2) {
mgaScreen->mmio.handle = serverInfo->registers.handle; mgaScreen->mmio.handle = serverInfo->registers.handle;
mgaScreen->mmio.size = serverInfo->registers.size; mgaScreen->mmio.size = serverInfo->registers.size;
if ( drmMap( sPriv->fd, if ( drmMap( sPriv->fd,

View File

@@ -55,7 +55,7 @@ mgaSetFence( mgaContextPtr mmesa, uint32_t * fence )
{ {
int ret = ENOSYS; int ret = ENOSYS;
if ( mmesa->driScreen->drmMinor >= 2 ) { if ( mmesa->driScreen->drm_version.minor >= 2 ) {
ret = drmCommandWriteRead( mmesa->driScreen->fd, DRM_MGA_SET_FENCE, ret = drmCommandWriteRead( mmesa->driScreen->fd, DRM_MGA_SET_FENCE,
fence, sizeof( uint32_t )); fence, sizeof( uint32_t ));
if (ret) { if (ret) {
@@ -73,7 +73,7 @@ mgaWaitFence( mgaContextPtr mmesa, uint32_t fence, uint32_t * curr_fence )
{ {
int ret = ENOSYS; int ret = ENOSYS;
if ( mmesa->driScreen->drmMinor >= 2 ) { if ( mmesa->driScreen->drm_version.minor >= 2 ) {
uint32_t temp = fence; uint32_t temp = fence;
ret = drmCommandWriteRead( mmesa->driScreen->fd, ret = drmCommandWriteRead( mmesa->driScreen->fd,

View File

@@ -254,7 +254,7 @@ GLboolean r128CreateContext( const __GLcontextModes *glVisual,
_tnl_allow_vertex_fog( ctx, GL_TRUE ); _tnl_allow_vertex_fog( ctx, GL_TRUE );
driInitExtensions( ctx, card_extensions, GL_TRUE ); driInitExtensions( ctx, card_extensions, GL_TRUE );
if (sPriv->drmMinor >= 4) if (sPriv->drm_version.minor >= 4)
_mesa_enable_extension( ctx, "GL_MESA_ycbcr_texture" ); _mesa_enable_extension( ctx, "GL_MESA_ycbcr_texture" );
r128InitTriFuncs( ctx ); r128InitTriFuncs( ctx );

View File

@@ -120,7 +120,7 @@ r128CreateScreen( __DRIscreenPrivate *sPriv )
r128Screen->IsPCI = r128DRIPriv->IsPCI; r128Screen->IsPCI = r128DRIPriv->IsPCI;
r128Screen->sarea_priv_offset = r128DRIPriv->sarea_priv_offset; r128Screen->sarea_priv_offset = r128DRIPriv->sarea_priv_offset;
if (sPriv->drmMinor >= 3) { if (sPriv->drm_version.minor >= 3) {
drm_r128_getparam_t gp; drm_r128_getparam_t gp;
int ret; int ret;

View File

@@ -277,14 +277,14 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual,
"def_max_anisotropy"); "def_max_anisotropy");
if ( driQueryOptionb( &rmesa->optionCache, "hyperz" ) ) { if ( driQueryOptionb( &rmesa->optionCache, "hyperz" ) ) {
if ( sPriv->drmMinor < 13 ) if ( sPriv->drm_version.minor < 13 )
fprintf( stderr, "DRM version 1.%d too old to support HyperZ, " fprintf( stderr, "DRM version 1.%d too old to support HyperZ, "
"disabling.\n",sPriv->drmMinor ); "disabling.\n", sPriv->drm_version.minor );
else else
rmesa->using_hyperz = GL_TRUE; rmesa->using_hyperz = GL_TRUE;
} }
if ( sPriv->drmMinor >= 15 ) if ( sPriv->drm_version.minor >= 15 )
rmesa->texmicrotile = GL_TRUE; rmesa->texmicrotile = GL_TRUE;
/* Init default driver functions then plug in our R200-specific functions /* Init default driver functions then plug in our R200-specific functions
@@ -317,7 +317,7 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual,
rmesa->dri.hwContext = driContextPriv->hHWContext; rmesa->dri.hwContext = driContextPriv->hHWContext;
rmesa->dri.hwLock = &sPriv->pSAREA->lock; rmesa->dri.hwLock = &sPriv->pSAREA->lock;
rmesa->dri.fd = sPriv->fd; rmesa->dri.fd = sPriv->fd;
rmesa->dri.drmMinor = sPriv->drmMinor; rmesa->dri.drmMinor = sPriv->drm_version.minor;
rmesa->r200Screen = screen; rmesa->r200Screen = screen;
rmesa->sarea = (drm_radeon_sarea_t *)((GLubyte *)sPriv->pSAREA + rmesa->sarea = (drm_radeon_sarea_t *)((GLubyte *)sPriv->pSAREA +

View File

@@ -156,7 +156,7 @@ GLboolean radeonInitContext(radeonContextPtr radeon,
radeon->dri.hwContext = driContextPriv->hHWContext; radeon->dri.hwContext = driContextPriv->hHWContext;
radeon->dri.hwLock = &sPriv->pSAREA->lock; radeon->dri.hwLock = &sPriv->pSAREA->lock;
radeon->dri.fd = sPriv->fd; radeon->dri.fd = sPriv->fd;
radeon->dri.drmMinor = sPriv->drmMinor; radeon->dri.drmMinor = sPriv->drm_version.minor;
radeon->radeonScreen = screen; radeon->radeonScreen = screen;
radeon->sarea = (drm_radeon_sarea_t *) ((GLubyte *) sPriv->pSAREA + radeon->sarea = (drm_radeon_sarea_t *) ((GLubyte *) sPriv->pSAREA +

View File

@@ -233,14 +233,14 @@ radeonCreateContext( const __GLcontextModes *glVisual,
"def_max_anisotropy"); "def_max_anisotropy");
if ( driQueryOptionb( &rmesa->optionCache, "hyperz" ) ) { if ( driQueryOptionb( &rmesa->optionCache, "hyperz" ) ) {
if ( sPriv->drmMinor < 13 ) if ( sPriv->drm_version.minor < 13 )
fprintf( stderr, "DRM version 1.%d too old to support HyperZ, " fprintf( stderr, "DRM version 1.%d too old to support HyperZ, "
"disabling.\n",sPriv->drmMinor ); "disabling.\n", sPriv->drm_version.minor );
else else
rmesa->using_hyperz = GL_TRUE; rmesa->using_hyperz = GL_TRUE;
} }
if ( sPriv->drmMinor >= 15 ) if ( sPriv->drm_version.minor >= 15 )
rmesa->texmicrotile = GL_TRUE; rmesa->texmicrotile = GL_TRUE;
/* Init default driver functions then plug in our Radeon-specific functions /* Init default driver functions then plug in our Radeon-specific functions
@@ -271,7 +271,7 @@ radeonCreateContext( const __GLcontextModes *glVisual,
rmesa->dri.hwContext = driContextPriv->hHWContext; rmesa->dri.hwContext = driContextPriv->hHWContext;
rmesa->dri.hwLock = &sPriv->pSAREA->lock; rmesa->dri.hwLock = &sPriv->pSAREA->lock;
rmesa->dri.fd = sPriv->fd; rmesa->dri.fd = sPriv->fd;
rmesa->dri.drmMinor = sPriv->drmMinor; rmesa->dri.drmMinor = sPriv->drm_version.minor;
rmesa->radeonScreen = screen; rmesa->radeonScreen = screen;
rmesa->sarea = (drm_radeon_sarea_t *)((GLubyte *)sPriv->pSAREA + rmesa->sarea = (drm_radeon_sarea_t *)((GLubyte *)sPriv->pSAREA +

View File

@@ -395,13 +395,13 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv )
fprintf(stderr, "drm_radeon_getparam_t (RADEON_PARAM_IRQ_NR): %d\n", ret); fprintf(stderr, "drm_radeon_getparam_t (RADEON_PARAM_IRQ_NR): %d\n", ret);
return NULL; return NULL;
} }
screen->drmSupportsCubeMapsR200 = (sPriv->drmMinor >= 7); screen->drmSupportsCubeMapsR200 = (sPriv->drm_version.minor >= 7);
screen->drmSupportsBlendColor = (sPriv->drmMinor >= 11); screen->drmSupportsBlendColor = (sPriv->drm_version.minor >= 11);
screen->drmSupportsTriPerf = (sPriv->drmMinor >= 16); screen->drmSupportsTriPerf = (sPriv->drm_version.minor >= 16);
screen->drmSupportsFragShader = (sPriv->drmMinor >= 18); screen->drmSupportsFragShader = (sPriv->drm_version.minor >= 18);
screen->drmSupportsPointSprites = (sPriv->drmMinor >= 13); screen->drmSupportsPointSprites = (sPriv->drm_version.minor >= 13);
screen->drmSupportsCubeMapsR100 = (sPriv->drmMinor >= 15); screen->drmSupportsCubeMapsR100 = (sPriv->drm_version.minor >= 15);
screen->drmSupportsVertexProgram = (sPriv->drmMinor >= 25); screen->drmSupportsVertexProgram = (sPriv->drm_version.minor >= 25);
} }
screen->mmio.handle = dri_priv->registerHandle; screen->mmio.handle = dri_priv->registerHandle;
@@ -666,7 +666,7 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv )
return NULL; return NULL;
} }
if ((screen->chip_family == CHIP_FAMILY_R350 || screen->chip_family == CHIP_FAMILY_R300) && if ((screen->chip_family == CHIP_FAMILY_R350 || screen->chip_family == CHIP_FAMILY_R300) &&
sPriv->ddxMinor < 2) { sPriv->ddx_version.minor < 2) {
fprintf(stderr, "xf86-video-ati-6.6.2 or newer needed for Radeon 9500/9700/9800 cards.\n"); fprintf(stderr, "xf86-video-ati-6.6.2 or newer needed for Radeon 9500/9700/9800 cards.\n");
return NULL; return NULL;
} }
@@ -683,7 +683,7 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv )
screen->fbLocation = ( INREG( RADEON_MC_FB_LOCATION ) & 0xffff ) << 16; screen->fbLocation = ( INREG( RADEON_MC_FB_LOCATION ) & 0xffff ) << 16;
if ( sPriv->drmMinor >= 10 ) { if ( sPriv->drm_version.minor >= 10 ) {
drm_radeon_setparam_t sp; drm_radeon_setparam_t sp;
sp.param = RADEON_SETPARAM_FB_LOCATION; sp.param = RADEON_SETPARAM_FB_LOCATION;
@@ -701,7 +701,7 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv )
screen->depthPitch = dri_priv->depthPitch; screen->depthPitch = dri_priv->depthPitch;
/* Check if ddx has set up a surface reg to cover depth buffer */ /* Check if ddx has set up a surface reg to cover depth buffer */
screen->depthHasSurface = ((sPriv->ddxMajor > 4) && screen->depthHasSurface = ((sPriv->ddx_version.major > 4) &&
(screen->chip_flags & RADEON_CHIPSET_TCL)); (screen->chip_flags & RADEON_CHIPSET_TCL));
if ( dri_priv->textureSize == 0 ) { if ( dri_priv->textureSize == 0 ) {

View File

@@ -524,7 +524,7 @@ savageCreateContext( const __GLcontextModes *mesaVis,
"enable_fastpath"); "enable_fastpath");
/* DRM versions before 2.1.3 would only render triangle lists. ELTS /* DRM versions before 2.1.3 would only render triangle lists. ELTS
* support was added in 2.2.0. */ * support was added in 2.2.0. */
if (imesa->enable_fastpath && sPriv->drmMinor < 2) { if (imesa->enable_fastpath && sPriv->drm_version.minor < 2) {
fprintf (stderr, fprintf (stderr,
"*** Disabling fast path because your DRM version is buggy " "*** Disabling fast path because your DRM version is buggy "
"or doesn't\n*** support ELTS. You need at least Savage DRM " "or doesn't\n*** support ELTS. You need at least Savage DRM "

View File

@@ -1016,7 +1016,7 @@ static void savageUploadTexImages( savageContextPtr imesa, savageTexObjPtr t )
/* Heap timestamps are only reliable with Savage DRM 2.3.x or /* Heap timestamps are only reliable with Savage DRM 2.3.x or
* later. Earlier versions had only 16 bit time stamps which * later. Earlier versions had only 16 bit time stamps which
* would wrap too frequently. */ * would wrap too frequently. */
if (imesa->savageScreen->driScrnPriv->drmMinor >= 3) { if (imesa->savageScreen->driScrnPriv->drm_version.minor >= 3) {
unsigned int heap = t->base.heap->heapId; unsigned int heap = t->base.heap->heapId;
LOCK_HARDWARE(imesa); LOCK_HARDWARE(imesa);
savageWaitEvent (imesa, imesa->textureHeaps[heap]->timestamp); savageWaitEvent (imesa, imesa->textureHeaps[heap]->timestamp);
@@ -1713,7 +1713,7 @@ static void savageTimestampTextures( savageContextPtr imesa )
* Only useful with long-lived 32-bit event tags available * Only useful with long-lived 32-bit event tags available
* with Savage DRM 2.3.x or later. */ * with Savage DRM 2.3.x or later. */
if ((imesa->CurrentTexObj[0] || imesa->CurrentTexObj[1]) && if ((imesa->CurrentTexObj[0] || imesa->CurrentTexObj[1]) &&
imesa->savageScreen->driScrnPriv->drmMinor >= 3) { imesa->savageScreen->driScrnPriv->drm_version.minor >= 3) {
unsigned int e; unsigned int e;
FLUSH_BATCH(imesa); FLUSH_BATCH(imesa);
e = savageEmitEvent(imesa, SAVAGE_WAIT_3D); e = savageEmitEvent(imesa, SAVAGE_WAIT_3D);