radeon: make atom on r4xx a module option
authorAlex Deucher <alexdeucher@gmail.com>
Fri, 26 Sep 2008 21:20:04 +0000 (17:20 -0400)
committerAlex Deucher <alexdeucher@gmail.com>
Fri, 26 Sep 2008 21:20:04 +0000 (17:20 -0400)
default is legacy modesetting.  pass module option r4xx_atom
to try using atom on r4xx.

linux-core/atombios_crtc.c
linux-core/radeon_atombios.c
linux-core/radeon_display.c
linux-core/radeon_drv.c
linux-core/radeon_legacy_crtc.c
linux-core/radeon_mode.h
shared-core/radeon_drv.h

index 922cc7e..3856f8c 100644 (file)
@@ -419,6 +419,7 @@ void atombios_crtc_mode_set(struct drm_crtc *crtc,
                        atombios_set_crtc_dtd_timing(crtc, &crtc_dtd_timing);
                }
                radeon_crtc_set_base(crtc, x, y);
+               radeon_legacy_atom_set_surface(crtc);
        }
 
 }
index 90a367a..a763e76 100644 (file)
@@ -277,8 +277,10 @@ bool radeon_get_atom_connector_info_from_bios_connector_table(struct drm_device
        union atom_supported_devices *supported_devices;
        int i,j;
 
-       if (radeon_get_atom_connector_info_from_bios_object_table(dev))
-               return true;
+       if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
+               // FIXME this should return false for pre-r6xx chips
+               if (radeon_get_atom_connector_info_from_bios_object_table(dev))
+                       return true;
 
        atom_parse_data_header(ctx, index, &size, &frev, &crev, &data_offset);
 
index 5c86f74..ddc933c 100644 (file)
@@ -195,7 +195,7 @@ static void radeon_crtc_init(struct drm_device *dev, int index)
                radeon_crtc->lut_b[i] = i;
        }
 
-       if (dev_priv->is_atom_bios)
+       if (dev_priv->is_atom_bios && (radeon_is_avivo(dev_priv) || radeon_r4xx_atom))
                radeon_atombios_init_crtc(dev, radeon_crtc);
        else
                radeon_legacy_init_crtc(dev, radeon_crtc);
@@ -237,7 +237,10 @@ bool radeon_setup_enc_conn(struct drm_device *dev)
                encoder = NULL;
                /* if we find an LVDS connector */
                if (mode_info->bios_connector[i].connector_type == CONNECTOR_LVDS) {
-                       encoder = radeon_encoder_lvtma_add(dev, i);
+                       if (radeon_is_avivo(dev_priv) || radeon_r4xx_atom)
+                               encoder = radeon_encoder_lvtma_add(dev, i);
+                       else
+                               encoder = radeon_encoder_legacy_lvds_add(dev, i);
                        if (encoder)
                                drm_mode_connector_attach_encoder(connector, encoder);
                }
@@ -246,7 +249,14 @@ bool radeon_setup_enc_conn(struct drm_device *dev)
                if ((mode_info->bios_connector[i].connector_type == CONNECTOR_DVI_I) ||
                    (mode_info->bios_connector[i].connector_type == CONNECTOR_DVI_A) ||
                    (mode_info->bios_connector[i].connector_type == CONNECTOR_VGA)) {
-                       encoder = radeon_encoder_atom_dac_add(dev, i, mode_info->bios_connector[i].dac_type, 0);
+                       if (radeon_is_avivo(dev_priv) || radeon_r4xx_atom)
+                               encoder = radeon_encoder_atom_dac_add(dev, i, mode_info->bios_connector[i].dac_type, 0);
+                       else {
+                               if (mode_info->bios_connector[i].dac_type == DAC_PRIMARY)
+                                       encoder = radeon_encoder_legacy_primary_dac_add(dev, i, 0);
+                               else if (mode_info->bios_connector[i].dac_type == DAC_TVDAC)
+                                       encoder = radeon_encoder_legacy_tv_dac_add(dev, i, 0);
+                       }
                        if (encoder)
                                drm_mode_connector_attach_encoder(connector, encoder);
                }
@@ -254,14 +264,26 @@ bool radeon_setup_enc_conn(struct drm_device *dev)
                /* TMDS on DVI */
                if ((mode_info->bios_connector[i].connector_type == CONNECTOR_DVI_I) ||
                    (mode_info->bios_connector[i].connector_type == CONNECTOR_DVI_D)) {
-                       encoder = radeon_encoder_atom_tmds_add(dev, i, mode_info->bios_connector[i].tmds_type);
+                       if (radeon_is_avivo(dev_priv) || radeon_r4xx_atom)
+                               encoder = radeon_encoder_atom_tmds_add(dev, i, mode_info->bios_connector[i].tmds_type);
+                       else {
+                               if (mode_info->bios_connector[i].tmds_type == TMDS_INT)
+                                       encoder = radeon_encoder_legacy_tmds_int_add(dev, i);
+                               else if (mode_info->bios_connector[i].tmds_type == TMDS_EXT)
+                                       encoder = radeon_encoder_legacy_tmds_ext_add(dev, i);
+                       }
                        if (encoder)
                                drm_mode_connector_attach_encoder(connector, encoder);
                }
 
                /* TVDAC on DIN */
                if (mode_info->bios_connector[i].connector_type == CONNECTOR_DIN) {
-                       encoder = radeon_encoder_atom_dac_add(dev, i, mode_info->bios_connector[i].dac_type, 1);
+                       if (radeon_is_avivo(dev_priv) || radeon_r4xx_atom)
+                               encoder = radeon_encoder_atom_dac_add(dev, i, mode_info->bios_connector[i].dac_type, 1);
+                       else {
+                               if (mode_info->bios_connector[i].dac_type == DAC_TVDAC)
+                                       encoder = radeon_encoder_legacy_tv_dac_add(dev, i, 0);
+                       }
                        if (encoder)
                                drm_mode_connector_attach_encoder(connector, encoder);
                }
index 9b3397c..79bcc3e 100644 (file)
@@ -38,6 +38,7 @@
 
 int radeon_no_wb;
 int radeon_dynclks = 1;
+int radeon_r4xx_atom = 0;
 
 MODULE_PARM_DESC(no_wb, "Disable AGP writeback for scratch registers\n");
 module_param_named(no_wb, radeon_no_wb, int, 0444);
@@ -48,6 +49,9 @@ module_param_named(modeset, radeon_modeset, int, 0400);
 MODULE_PARM_DESC(dynclks, "Disable/Enable dynamic clocks");
 module_param_named(dynclks, radeon_dynclks, int, 0444);
 
+MODULE_PARM_DESC(r4xx_atom, "Enable ATOMBIOS modesetting for R4xx");
+module_param_named(r4xx_atom, radeon_r4xx_atom, int, 0444);
+
 static int dri_library_name(struct drm_device * dev, char * buf)
 {
        drm_radeon_private_t *dev_priv = dev->dev_private;
index f99cbda..820bd54 100644 (file)
@@ -172,7 +172,7 @@ void radeon_crtc_dpms(struct drm_crtc *crtc, int mode)
 }
 
 /* properly set crtc bpp when using atombios */
-static void radeon_legacy_atom_set_surface(struct drm_crtc *crtc)
+void radeon_legacy_atom_set_surface(struct drm_crtc *crtc)
 {
        struct drm_device *dev = crtc->dev;
        struct drm_radeon_private *dev_priv = dev->dev_private;
@@ -312,9 +312,6 @@ static bool radeon_set_crtc1_base(struct drm_crtc *crtc, int x, int y)
        disp_merge_cntl &= ~RADEON_DISP_RGB_OFFSET_EN;
        RADEON_WRITE(RADEON_DISP_MERGE_CNTL, disp_merge_cntl);
 
-       if (dev_priv->is_atom_bios)
-               radeon_legacy_atom_set_surface(crtc);
-
        return true;
 }
 
@@ -736,9 +733,6 @@ static bool radeon_set_crtc2_base(struct drm_crtc *crtc, int x, int y)
        disp2_merge_cntl &= ~RADEON_DISP2_RGB_OFFSET_EN;
        RADEON_WRITE(RADEON_DISP2_MERGE_CNTL,      disp2_merge_cntl);
 
-       if (dev_priv->is_atom_bios)
-               radeon_legacy_atom_set_surface(crtc);
-
        return true;
 }
 
index 577c3cf..8074eb7 100644 (file)
@@ -287,6 +287,7 @@ extern void atombios_crtc_mode_set(struct drm_crtc *crtc,
 extern void atombios_crtc_dpms(struct drm_crtc *crtc, int mode);
 
 extern void radeon_crtc_set_base(struct drm_crtc *crtc, int x, int y);
+extern void radeon_legacy_atom_set_surface(struct drm_crtc *crtc);
 
 extern int radeon_crtc_cursor_set(struct drm_crtc *crtc,
                                  struct drm_file *file_priv,
index 25a07e3..3490ddb 100644 (file)
@@ -456,6 +456,7 @@ typedef struct drm_radeon_kcmd_buffer {
 
 extern int radeon_no_wb;
 extern int radeon_dynclks;
+extern int radeon_r4xx_atom;
 extern struct drm_ioctl_desc radeon_ioctls[];
 extern int radeon_max_ioctl;