r600g: simplify deducing chip family
authorMarek Olšák <maraeo@gmail.com>
Sun, 11 Sep 2011 12:57:55 +0000 (14:57 +0200)
committerMarek Olšák <maraeo@gmail.com>
Mon, 12 Sep 2011 20:03:03 +0000 (22:03 +0200)
src/gallium/winsys/r600/drm/r600_drm.c

index d9eeda9e9f8a3a56322f304c78f0520223f88eb1..8f1fc722f6d686927bae2c846019e67a97e79947 100644 (file)
@@ -92,44 +92,16 @@ struct radeon *radeon_create(struct radeon_winsys *ws)
                fprintf(stderr, "Unknown chipset 0x%04X\n", radeon->info.pci_id);
                return radeon_destroy(radeon);
        }
+
        /* setup class */
-       switch (radeon->family) {
-       case CHIP_R600:
-       case CHIP_RV610:
-       case CHIP_RV630:
-       case CHIP_RV670:
-       case CHIP_RV620:
-       case CHIP_RV635:
-       case CHIP_RS780:
-       case CHIP_RS880:
-               radeon->chip_class = R600;
-               break;
-       case CHIP_RV770:
-       case CHIP_RV730:
-       case CHIP_RV710:
-       case CHIP_RV740:
-               radeon->chip_class = R700;
-               break;
-       case CHIP_CEDAR:
-       case CHIP_REDWOOD:
-       case CHIP_JUNIPER:
-       case CHIP_CYPRESS:
-       case CHIP_HEMLOCK:
-       case CHIP_PALM:
-       case CHIP_SUMO:
-       case CHIP_SUMO2:
-       case CHIP_BARTS:
-       case CHIP_TURKS:
-       case CHIP_CAICOS:
-               radeon->chip_class = EVERGREEN;
-               break;
-       case CHIP_CAYMAN:
+       if (radeon->family == CHIP_CAYMAN) {
                radeon->chip_class = CAYMAN;
-               break;
-       default:
-               fprintf(stderr, "%s unknown or unsupported chipset 0x%04X\n",
-                       __func__, radeon->info.pci_id);
-               break;
+       } else if (radeon->family >= CHIP_CEDAR) {
+               radeon->chip_class = EVERGREEN;
+       } else if (radeon->family >= CHIP_RV730) {
+               radeon->chip_class = R700;
+       } else {
+               radeon->chip_class = R600;
        }
 
        return radeon;