switch to card_type rather than IsPCI, doesn't change any functionality yet
authorDave Airlie <airliedfreedesktop.org>
Tue, 4 Apr 2006 11:04:30 +0000 (11:04 +0000)
committerDave Airlie <airliedfreedesktop.org>
Tue, 4 Apr 2006 11:04:30 +0000 (11:04 +0000)
src/mesa/drivers/dri/r200/r200_context.c
src/mesa/drivers/dri/r300/radeon_context.c
src/mesa/drivers/dri/radeon/radeon_context.c
src/mesa/drivers/dri/radeon/radeon_screen.c
src/mesa/drivers/dri/radeon/radeon_screen.h

index e4d9e264bf9bacc0daf6a84488e035091a1415e6..210feddb6a9072678900ea8b2896eb0b02ee4790 100644 (file)
@@ -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 ) {
index 4e351dd66b093898251179473bf12780913f78ce..0147c6492e537c23342729f6bcf3d9f6049e178a 100644 (file)
@@ -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;
 
index 791d1a37bc01533f05cc329bd1d2937464bc29fc..4c7730485b73cc9881d2de7f78282191bdb0433b 100644 (file)
@@ -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 ) {
index 5257e541e5f4e0e7c5450a9a7ef2668673d1611e..8cc5aeff5ea38fdf7a9846a317ce4bb7f6ea99d7 100644 (file)
@@ -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 ) );
    }
index 08433c445b859f57216c57f99af5202eb9099a41..3e0f9454e7f5324805b0c86c3c09dbc0e5612200 100644 (file)
@@ -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) */