diff options
author | Dave Airlie <airliedfreedesktop.org> | 2006-04-04 11:04:30 +0000 |
---|---|---|
committer | Dave Airlie <airliedfreedesktop.org> | 2006-04-04 11:04:30 +0000 |
commit | 6a9f0a27c3853738e4bbfb33e8b20464a7d92923 (patch) | |
tree | e531720019e0352c8c0601eb668d5a17ab87d869 /src/mesa/drivers/dri/radeon | |
parent | 7473d172682a229d2463d0a9ae2ae638453bc6e3 (diff) |
switch to card_type rather than IsPCI, doesn't change any functionality yet
Diffstat (limited to 'src/mesa/drivers/dri/radeon')
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_context.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_screen.c | 43 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_screen.h | 2 |
3 files changed, 25 insertions, 22 deletions
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) */ |