[PATCH] radeon/kms: fallback to vesa if GPU is not supported by UMS

j.glisse at gmail.com j.glisse at gmail.com
Thu Oct 20 11:23:31 PDT 2011


From: Jerome Glisse <jglisse at redhat.com>

For GPU not supported by UMS, test in probe so that we properly
fallback to vesa.

Signed-off-by: Jerome Glisse <jglisse at redhat.com>
---
 src/radeon.h       |   66 ----------------------------------------------------
 src/radeon_probe.c |   29 ++++++++++++++++++++++-
 src/radeon_probe.h |   66 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 94 insertions(+), 67 deletions(-)

diff --git a/src/radeon.h b/src/radeon.h
index f66ffd0..50ce62f 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -313,62 +313,6 @@ typedef struct {
     DisplayModePtr    mode;
 } RADEONFBLayout;
 
-typedef enum {
-    CHIP_FAMILY_UNKNOW,
-    CHIP_FAMILY_LEGACY,
-    CHIP_FAMILY_RADEON,
-    CHIP_FAMILY_RV100,
-    CHIP_FAMILY_RS100,    /* U1 (IGP320M) or A3 (IGP320)*/
-    CHIP_FAMILY_RV200,
-    CHIP_FAMILY_RS200,    /* U2 (IGP330M/340M/350M) or A4 (IGP330/340/345/350), RS250 (IGP 7000) */
-    CHIP_FAMILY_R200,
-    CHIP_FAMILY_RV250,
-    CHIP_FAMILY_RS300,    /* RS300/RS350 */
-    CHIP_FAMILY_RV280,
-    CHIP_FAMILY_R300,
-    CHIP_FAMILY_R350,
-    CHIP_FAMILY_RV350,
-    CHIP_FAMILY_RV380,    /* RV370/RV380/M22/M24 */
-    CHIP_FAMILY_R420,     /* R420/R423/M18 */
-    CHIP_FAMILY_RV410,    /* RV410, M26 */
-    CHIP_FAMILY_RS400,    /* xpress 200, 200m (RS400) Intel */
-    CHIP_FAMILY_RS480,    /* xpress 200, 200m (RS410/480/482/485) AMD */
-    CHIP_FAMILY_RV515,    /* rv515 */
-    CHIP_FAMILY_R520,    /* r520 */
-    CHIP_FAMILY_RV530,    /* rv530 */
-    CHIP_FAMILY_R580,    /* r580 */
-    CHIP_FAMILY_RV560,   /* rv560 */
-    CHIP_FAMILY_RV570,   /* rv570 */
-    CHIP_FAMILY_RS600,
-    CHIP_FAMILY_RS690,
-    CHIP_FAMILY_RS740,
-    CHIP_FAMILY_R600,    /* r600 */
-    CHIP_FAMILY_RV610,
-    CHIP_FAMILY_RV630,
-    CHIP_FAMILY_RV670,
-    CHIP_FAMILY_RV620,
-    CHIP_FAMILY_RV635,
-    CHIP_FAMILY_RS780,
-    CHIP_FAMILY_RS880,
-    CHIP_FAMILY_RV770,   /* r700 */
-    CHIP_FAMILY_RV730,
-    CHIP_FAMILY_RV710,
-    CHIP_FAMILY_RV740,
-    CHIP_FAMILY_CEDAR,   /* evergreen */
-    CHIP_FAMILY_REDWOOD,
-    CHIP_FAMILY_JUNIPER,
-    CHIP_FAMILY_CYPRESS,
-    CHIP_FAMILY_HEMLOCK,
-    CHIP_FAMILY_PALM,
-    CHIP_FAMILY_SUMO,
-    CHIP_FAMILY_SUMO2,
-    CHIP_FAMILY_BARTS,
-    CHIP_FAMILY_TURKS,
-    CHIP_FAMILY_CAICOS,
-    CHIP_FAMILY_CAYMAN,
-    CHIP_FAMILY_LAST
-} RADEONChipFamily;
-
 #define IS_RV100_VARIANT ((info->ChipFamily == CHIP_FAMILY_RV100)  ||  \
         (info->ChipFamily == CHIP_FAMILY_RV200)  ||  \
         (info->ChipFamily == CHIP_FAMILY_RS100)  ||  \
@@ -501,16 +445,6 @@ struct radeon_exa_pixmap_priv {
     Bool bo_mapped;
 };
 
-typedef struct {
-    uint32_t pci_device_id;
-    RADEONChipFamily chip_family;
-    int mobility;
-    int igp;
-    int nocrtc2;
-    int nointtvout;
-    int singledac;
-} RADEONCardInfo;
-
 #define RADEON_2D_EXA_COPY 1
 #define RADEON_2D_EXA_SOLID 2
 
diff --git a/src/radeon_probe.c b/src/radeon_probe.c
index 7819027..26dec28 100644
--- a/src/radeon_probe.c
+++ b/src/radeon_probe.c
@@ -59,9 +59,31 @@
 
 #include "radeon_pci_chipset_gen.h"
 
+#include "radeon_chipinfo_gen.h"
 
 #ifdef XSERVER_LIBPCIACCESS
 #include "radeon_pci_device_match_gen.h"
+
+static Bool radeon_ums_supported(ScrnInfoPtr pScrn, struct pci_device *pci_dev)
+{
+    unsigned family = 0, i;
+
+    for (i = 0; i < sizeof(RADEONCards) / sizeof(RADEONCardInfo); i++) {
+        if (pci_dev->device_id == RADEONCards[i].pci_device_id) {
+            family = RADEONCards[i].chip_family;
+            break;
+        }
+    }
+
+    if (family >= CHIP_FAMILY_SUMO) {
+        xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 0,
+                       "GPU only supported with KMS, using vesa instead.\n");
+        return FALSE;
+    }
+    return TRUE;
+}
+#else
+#define radeon_ums_supported(x, y) TRUE
 #endif
 
 #ifndef XSERVER_LIBPCIACCESS
@@ -131,8 +153,13 @@ radeon_get_scrninfo(int entity_num, void *pci_dev)
         return FALSE;
 
     if (pci_dev) {
-      if (radeon_kernel_mode_enabled(pScrn, pci_dev))
+      if (radeon_kernel_mode_enabled(pScrn, pci_dev)) {
 	kms = 1;
+      } else {
+        if (!radeon_ums_supported(pScrn, pci_dev)) {
+          return FALSE;
+        }
+      }
     }
 
     pScrn->driverVersion = RADEON_VERSION_CURRENT;
diff --git a/src/radeon_probe.h b/src/radeon_probe.h
index d97bb06..94f6d7d 100644
--- a/src/radeon_probe.h
+++ b/src/radeon_probe.h
@@ -55,6 +55,72 @@ extern DriverRec RADEON;
 #define RADEON_MAX_CRTC 6
 #define RADEON_MAX_BIOS_CONNECTOR 16
 
+typedef enum {
+    CHIP_FAMILY_UNKNOW,
+    CHIP_FAMILY_LEGACY,
+    CHIP_FAMILY_RADEON,
+    CHIP_FAMILY_RV100,
+    CHIP_FAMILY_RS100,    /* U1 (IGP320M) or A3 (IGP320)*/
+    CHIP_FAMILY_RV200,
+    CHIP_FAMILY_RS200,    /* U2 (IGP330M/340M/350M) or A4 (IGP330/340/345/350), RS250 (IGP 7000) */
+    CHIP_FAMILY_R200,
+    CHIP_FAMILY_RV250,
+    CHIP_FAMILY_RS300,    /* RS300/RS350 */
+    CHIP_FAMILY_RV280,
+    CHIP_FAMILY_R300,
+    CHIP_FAMILY_R350,
+    CHIP_FAMILY_RV350,
+    CHIP_FAMILY_RV380,    /* RV370/RV380/M22/M24 */
+    CHIP_FAMILY_R420,     /* R420/R423/M18 */
+    CHIP_FAMILY_RV410,    /* RV410, M26 */
+    CHIP_FAMILY_RS400,    /* xpress 200, 200m (RS400) Intel */
+    CHIP_FAMILY_RS480,    /* xpress 200, 200m (RS410/480/482/485) AMD */
+    CHIP_FAMILY_RV515,    /* rv515 */
+    CHIP_FAMILY_R520,    /* r520 */
+    CHIP_FAMILY_RV530,    /* rv530 */
+    CHIP_FAMILY_R580,    /* r580 */
+    CHIP_FAMILY_RV560,   /* rv560 */
+    CHIP_FAMILY_RV570,   /* rv570 */
+    CHIP_FAMILY_RS600,
+    CHIP_FAMILY_RS690,
+    CHIP_FAMILY_RS740,
+    CHIP_FAMILY_R600,    /* r600 */
+    CHIP_FAMILY_RV610,
+    CHIP_FAMILY_RV630,
+    CHIP_FAMILY_RV670,
+    CHIP_FAMILY_RV620,
+    CHIP_FAMILY_RV635,
+    CHIP_FAMILY_RS780,
+    CHIP_FAMILY_RS880,
+    CHIP_FAMILY_RV770,   /* r700 */
+    CHIP_FAMILY_RV730,
+    CHIP_FAMILY_RV710,
+    CHIP_FAMILY_RV740,
+    CHIP_FAMILY_CEDAR,   /* evergreen */
+    CHIP_FAMILY_REDWOOD,
+    CHIP_FAMILY_JUNIPER,
+    CHIP_FAMILY_CYPRESS,
+    CHIP_FAMILY_HEMLOCK,
+    CHIP_FAMILY_PALM,
+    CHIP_FAMILY_SUMO,
+    CHIP_FAMILY_SUMO2,
+    CHIP_FAMILY_BARTS,
+    CHIP_FAMILY_TURKS,
+    CHIP_FAMILY_CAICOS,
+    CHIP_FAMILY_CAYMAN,
+    CHIP_FAMILY_LAST
+} RADEONChipFamily;
+
+typedef struct {
+    uint32_t pci_device_id;
+    RADEONChipFamily chip_family;
+    int mobility;
+    int igp;
+    int nocrtc2;
+    int nointtvout;
+    int singledac;
+} RADEONCardInfo;
+
 typedef enum
 {
     MT_UNKNOWN = -1,
-- 
1.7.1



More information about the xorg-driver-ati mailing list