From: Dave Airlie Date: Tue, 4 Apr 2006 11:04:30 +0000 (+0000) Subject: switch to card_type rather than IsPCI, doesn't change any functionality yet X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6a9f0a27c3853738e4bbfb33e8b20464a7d92923;p=mesa.git switch to card_type rather than IsPCI, doesn't change any functionality yet --- diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c index e4d9e264bf9..210feddb6a9 100644 --- a/src/mesa/drivers/dri/r200/r200_context.c +++ b/src/mesa/drivers/dri/r200/r200_context.c @@ -107,7 +107,7 @@ static const GLubyte *r200GetString( GLcontext *ctx, GLenum name ) r200ContextPtr rmesa = R200_CONTEXT(ctx); static char buffer[128]; unsigned offset; - GLuint agp_mode = rmesa->r200Screen->IsPCI ? 0 : + GLuint agp_mode = (rmesa->r200Screen->card_type == RADEON_CARD_PCI)? 0 : rmesa->r200Screen->AGPMode; switch ( name ) { diff --git a/src/mesa/drivers/dri/r300/radeon_context.c b/src/mesa/drivers/dri/r300/radeon_context.c index 4e351dd66b0..0147c6492e5 100644 --- a/src/mesa/drivers/dri/r300/radeon_context.c +++ b/src/mesa/drivers/dri/r300/radeon_context.c @@ -76,7 +76,7 @@ static const GLubyte *radeonGetString(GLcontext * ctx, GLenum name) case GL_RENDERER: { unsigned offset; - GLuint agp_mode = radeon->radeonScreen->IsPCI ? 0 : + GLuint agp_mode = (radeon->radeonScreen->card_type==RADEON_CARD_PCI) ? 0 : radeon->radeonScreen->AGPMode; const char* chipname; diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c index 791d1a37bc0..4c7730485b7 100644 --- a/src/mesa/drivers/dri/radeon/radeon_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_context.c @@ -102,7 +102,7 @@ static const GLubyte *radeonGetString( GLcontext *ctx, GLenum name ) radeonContextPtr rmesa = RADEON_CONTEXT(ctx); static char buffer[128]; unsigned offset; - GLuint agp_mode = rmesa->radeonScreen->IsPCI ? 0 : + GLuint agp_mode = (rmesa->radeonScreen->card_type==RADEON_CARD_PCI) ? 0 : rmesa->radeonScreen->AGPMode; switch ( name ) { diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 5257e541e5f..8cc5aeff5ea 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -209,6 +209,19 @@ extern const struct dri_extension card_extensions[]; static int getSwapInfo( __DRIdrawablePrivate *dPriv, __DRIswapInfo * sInfo ); +static int +radeonGetParam(int fd, int param, void *value) +{ + int ret; + drm_radeon_getparam_t gp; + + gp.param = param; + gp.value = value; + + ret = drmCommandWriteRead( fd, DRM_RADEON_GETPARAM, &gp, sizeof(gp)); + return ret; +} + static __GLcontextModes * radeonFillInModes( unsigned pixel_bits, unsigned depth_bits, unsigned stencil_bits, GLboolean have_back_buffer ) @@ -326,17 +339,12 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) /* This is first since which regions we map depends on whether or * not we are using a PCI card. */ - screen->IsPCI = dri_priv->IsPCI; - + screen->card_type = (dri_priv->IsPCI ? RADEON_CARD_PCI : RADEON_CARD_AGP); { int ret; - drm_radeon_getparam_t gp; - - gp.param = RADEON_PARAM_GART_BUFFER_OFFSET; - gp.value = &screen->gart_buffer_offset; - - ret = drmCommandWriteRead( sPriv->fd, DRM_RADEON_GETPARAM, - &gp, sizeof(gp)); + ret = radeonGetParam( sPriv->fd, RADEON_PARAM_GART_BUFFER_OFFSET, + &screen->gart_buffer_offset); + if (ret) { FREE( screen ); fprintf(stderr, "drm_radeon_getparam_t (RADEON_PARAM_GART_BUFFER_OFFSET): %d\n", ret); @@ -344,22 +352,17 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) } if (sPriv->drmMinor >= 6) { - gp.param = RADEON_PARAM_GART_BASE; - gp.value = &screen->gart_base; - ret = drmCommandWriteRead( sPriv->fd, DRM_RADEON_GETPARAM, - &gp, sizeof(gp)); + ret = radeonGetParam( sPriv->fd, RADEON_PARAM_GART_BASE, + &screen->gart_base); if (ret) { FREE( screen ); - fprintf(stderr, "drmR200GetParam (RADEON_PARAM_GART_BASE): %d\n", ret); + fprintf(stderr, "drm_radeon_getparam_t (RADEON_PARAM_GART_BASE): %d\n", ret); return NULL; } - gp.param = RADEON_PARAM_IRQ_NR; - gp.value = &screen->irq; - - ret = drmCommandWriteRead( sPriv->fd, DRM_RADEON_GETPARAM, - &gp, sizeof(gp)); + ret = radeonGetParam( sPriv->fd, RADEON_PARAM_IRQ_NR, + &screen->irq); if (ret) { FREE( screen ); fprintf(stderr, "drm_radeon_getparam_t (RADEON_PARAM_IRQ_NR): %d\n", ret); @@ -425,7 +428,7 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) return NULL; } - screen->gart_texture_offset = dri_priv->gartTexOffset + ( screen->IsPCI + screen->gart_texture_offset = dri_priv->gartTexOffset + (( screen->card_type == RADEON_CARD_PCI) ? INREG( RADEON_AIC_LO_ADDR ) : ( ( INREG( RADEON_MC_AGP_LOCATION ) & 0x0ffffU ) << 16 ) ); } diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.h b/src/mesa/drivers/dri/radeon/radeon_screen.h index 08433c445b8..3e0f9454e7f 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.h +++ b/src/mesa/drivers/dri/radeon/radeon_screen.h @@ -59,7 +59,7 @@ typedef struct { int chip_family; int chip_flags; int cpp; - int IsPCI; /* Current card is a PCI card */ + int card_type; int AGPMode; unsigned int irq; /* IRQ number (0 means none) */