Merge branch 'drm-intel-fixes' into HEAD
Chris Wilson [Tue, 21 Sep 2010 10:19:32 +0000 (11:19 +0100)]
Conflicts:
drivers/char/agp/intel-agp.c
drivers/gpu/drm/i915/intel_crt.c

14 files changed:
1  2 
drivers/char/agp/intel-agp.h
drivers/char/agp/intel-gtt.c
drivers/gpu/drm/i915/i915_drv.c
drivers/gpu/drm/i915/i915_gem.c
drivers/gpu/drm/i915/i915_gem_evict.c
drivers/gpu/drm/i915/i915_suspend.c
drivers/gpu/drm/i915/intel_crt.c
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_dp.c
drivers/gpu/drm/i915/intel_dvo.c
drivers/gpu/drm/i915/intel_hdmi.c
drivers/gpu/drm/i915/intel_lvds.c
drivers/gpu/drm/i915/intel_sdvo.c
drivers/gpu/drm/i915/intel_tv.c

Simple merge
@@@ -1522,215 -1648,3 +1522,217 @@@ static const struct agp_bridge_driver i
        .agp_unmap_memory       = intel_agp_unmap_memory,
  #endif
  };
 +
 +static const struct intel_gtt_driver i8xx_gtt_driver = {
 +      .gen = 2,
 +      .setup = i830_setup,
 +};
 +static const struct intel_gtt_driver i915_gtt_driver = {
 +      .gen = 3,
 +      .setup = i9xx_setup,
 +};
 +static const struct intel_gtt_driver g33_gtt_driver = {
 +      .gen = 3,
 +      .is_g33 = 1,
 +      .setup = i9xx_setup,
 +};
 +static const struct intel_gtt_driver pineview_gtt_driver = {
 +      .gen = 3,
 +      .is_pineview = 1, .is_g33 = 1,
 +      .setup = i9xx_setup,
 +};
 +static const struct intel_gtt_driver i965_gtt_driver = {
 +      .gen = 4,
 +      .setup = i9xx_setup,
 +};
 +static const struct intel_gtt_driver g4x_gtt_driver = {
 +      .gen = 5,
 +      .setup = i9xx_setup,
 +};
 +static const struct intel_gtt_driver ironlake_gtt_driver = {
 +      .gen = 5,
 +      .is_ironlake = 1,
 +      .setup = i9xx_setup,
 +};
 +static const struct intel_gtt_driver sandybridge_gtt_driver = {
 +      .gen = 6,
 +      .setup = i9xx_setup,
 +};
 +
 +/* Table to describe Intel GMCH and AGP/PCIE GART drivers.  At least one of
 + * driver and gmch_driver must be non-null, and find_gmch will determine
 + * which one should be used if a gmch_chip_id is present.
 + */
 +static const struct intel_gtt_driver_description {
 +      unsigned int gmch_chip_id;
 +      char *name;
 +      const struct agp_bridge_driver *gmch_driver;
 +      const struct intel_gtt_driver *gtt_driver;
 +} intel_gtt_chipsets[] = {
 +      { PCI_DEVICE_ID_INTEL_82810_IG1, "i810", &intel_810_driver , NULL},
 +      { PCI_DEVICE_ID_INTEL_82810_IG3, "i810", &intel_810_driver , NULL},
 +      { PCI_DEVICE_ID_INTEL_82810E_IG, "i810", &intel_810_driver , NULL},
 +      { PCI_DEVICE_ID_INTEL_82815_CGC, "i815", &intel_810_driver , NULL},
 +      { PCI_DEVICE_ID_INTEL_82830_CGC, "830M",
 +              &intel_830_driver , &i8xx_gtt_driver},
 +      { PCI_DEVICE_ID_INTEL_82845G_IG, "830M",
 +              &intel_830_driver , &i8xx_gtt_driver},
 +      { PCI_DEVICE_ID_INTEL_82854_IG, "854",
 +              &intel_830_driver , &i8xx_gtt_driver},
 +      { PCI_DEVICE_ID_INTEL_82855GM_IG, "855GM",
 +              &intel_830_driver , &i8xx_gtt_driver},
 +      { PCI_DEVICE_ID_INTEL_82865_IG, "865",
 +              &intel_830_driver , &i8xx_gtt_driver},
 +      { PCI_DEVICE_ID_INTEL_E7221_IG, "E7221 (i915)",
 +              &intel_915_driver , &i915_gtt_driver },
 +      { PCI_DEVICE_ID_INTEL_82915G_IG, "915G",
 +              &intel_915_driver , &i915_gtt_driver },
 +      { PCI_DEVICE_ID_INTEL_82915GM_IG, "915GM",
 +              &intel_915_driver , &i915_gtt_driver },
 +      { PCI_DEVICE_ID_INTEL_82945G_IG, "945G",
 +              &intel_915_driver , &i915_gtt_driver },
 +      { PCI_DEVICE_ID_INTEL_82945GM_IG, "945GM",
 +              &intel_915_driver , &i915_gtt_driver },
 +      { PCI_DEVICE_ID_INTEL_82945GME_IG, "945GME",
 +              &intel_915_driver , &i915_gtt_driver },
 +      { PCI_DEVICE_ID_INTEL_82946GZ_IG, "946GZ",
 +              &intel_i965_driver , &i965_gtt_driver },
 +      { PCI_DEVICE_ID_INTEL_82G35_IG, "G35",
 +              &intel_i965_driver , &i965_gtt_driver },
 +      { PCI_DEVICE_ID_INTEL_82965Q_IG, "965Q",
 +              &intel_i965_driver , &i965_gtt_driver },
 +      { PCI_DEVICE_ID_INTEL_82965G_IG, "965G",
 +              &intel_i965_driver , &i965_gtt_driver },
 +      { PCI_DEVICE_ID_INTEL_82965GM_IG, "965GM",
 +              &intel_i965_driver , &i965_gtt_driver },
 +      { PCI_DEVICE_ID_INTEL_82965GME_IG, "965GME/GLE",
 +              &intel_i965_driver , &i965_gtt_driver },
 +      { PCI_DEVICE_ID_INTEL_G33_IG, "G33",
 +              &intel_g33_driver , &g33_gtt_driver },
 +      { PCI_DEVICE_ID_INTEL_Q35_IG, "Q35",
 +              &intel_g33_driver , &g33_gtt_driver },
 +      { PCI_DEVICE_ID_INTEL_Q33_IG, "Q33",
 +              &intel_g33_driver , &g33_gtt_driver },
 +      { PCI_DEVICE_ID_INTEL_PINEVIEW_M_IG, "GMA3150",
 +              &intel_g33_driver , &pineview_gtt_driver },
 +      { PCI_DEVICE_ID_INTEL_PINEVIEW_IG, "GMA3150",
 +              &intel_g33_driver , &pineview_gtt_driver },
 +      { PCI_DEVICE_ID_INTEL_GM45_IG, "GM45",
 +              &intel_i965_driver , &g4x_gtt_driver },
 +      { PCI_DEVICE_ID_INTEL_EAGLELAKE_IG, "Eaglelake",
 +              &intel_i965_driver , &g4x_gtt_driver },
 +      { PCI_DEVICE_ID_INTEL_Q45_IG, "Q45/Q43",
 +              &intel_i965_driver , &g4x_gtt_driver },
 +      { PCI_DEVICE_ID_INTEL_G45_IG, "G45/G43",
 +              &intel_i965_driver , &g4x_gtt_driver },
 +      { PCI_DEVICE_ID_INTEL_B43_IG, "B43",
 +              &intel_i965_driver , &g4x_gtt_driver },
++      { PCI_DEVICE_ID_INTEL_B43_1_IG, "B43",
++              &intel_i965_driver , &g4x_gtt_driver },
 +      { PCI_DEVICE_ID_INTEL_G41_IG, "G41",
 +              &intel_i965_driver , &g4x_gtt_driver },
 +      { PCI_DEVICE_ID_INTEL_IRONLAKE_D_IG,
 +          "HD Graphics", &intel_i965_driver , &ironlake_gtt_driver },
 +      { PCI_DEVICE_ID_INTEL_IRONLAKE_M_IG,
 +          "HD Graphics", &intel_i965_driver , &ironlake_gtt_driver },
 +      { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_GT1_IG,
 +          "Sandybridge", &intel_gen6_driver , &sandybridge_gtt_driver },
 +      { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_GT2_IG,
 +          "Sandybridge", &intel_gen6_driver , &sandybridge_gtt_driver },
 +      { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_GT2_PLUS_IG,
 +          "Sandybridge", &intel_gen6_driver , &sandybridge_gtt_driver },
 +      { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_GT1_IG,
 +          "Sandybridge", &intel_gen6_driver , &sandybridge_gtt_driver },
 +      { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_GT2_IG,
 +          "Sandybridge", &intel_gen6_driver , &sandybridge_gtt_driver },
 +      { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_GT2_PLUS_IG,
 +          "Sandybridge", &intel_gen6_driver , &sandybridge_gtt_driver },
 +      { PCI_DEVICE_ID_INTEL_SANDYBRIDGE_S_IG,
 +          "Sandybridge", &intel_gen6_driver , &sandybridge_gtt_driver },
 +      { 0, NULL, NULL }
 +};
 +
 +static int find_gmch(u16 device)
 +{
 +      struct pci_dev *gmch_device;
 +
 +      gmch_device = pci_get_device(PCI_VENDOR_ID_INTEL, device, NULL);
 +      if (gmch_device && PCI_FUNC(gmch_device->devfn) != 0) {
 +              gmch_device = pci_get_device(PCI_VENDOR_ID_INTEL,
 +                                           device, gmch_device);
 +      }
 +
 +      if (!gmch_device)
 +              return 0;
 +
 +      intel_private.pcidev = gmch_device;
 +      return 1;
 +}
 +
 +int intel_gmch_probe(struct pci_dev *pdev,
 +                                    struct agp_bridge_data *bridge)
 +{
 +      int i, mask;
 +      bridge->driver = NULL;
 +
 +      for (i = 0; intel_gtt_chipsets[i].name != NULL; i++) {
 +              if (find_gmch(intel_gtt_chipsets[i].gmch_chip_id)) {
 +                      bridge->driver =
 +                              intel_gtt_chipsets[i].gmch_driver;
 +                      intel_private.driver = 
 +                              intel_gtt_chipsets[i].gtt_driver;
 +                      break;
 +              }
 +      }
 +
 +      if (!bridge->driver)
 +              return 0;
 +
 +      bridge->dev_private_data = &intel_private;
 +      bridge->dev = pdev;
 +
 +      intel_private.bridge_dev = pci_dev_get(pdev);
 +
 +      dev_info(&pdev->dev, "Intel %s Chipset\n", intel_gtt_chipsets[i].name);
 +
 +      if (bridge->driver->mask_memory == intel_gen6_mask_memory)
 +              mask = 40;
 +      else if (bridge->driver->mask_memory == intel_i965_mask_memory)
 +              mask = 36;
 +      else
 +              mask = 32;
 +
 +      if (pci_set_dma_mask(intel_private.pcidev, DMA_BIT_MASK(mask)))
 +              dev_err(&intel_private.pcidev->dev,
 +                      "set gfx device dma mask %d-bit failed!\n", mask);
 +      else
 +              pci_set_consistent_dma_mask(intel_private.pcidev,
 +                                          DMA_BIT_MASK(mask));
 +
 +      if (bridge->driver == &intel_810_driver)
 +              return 1;
 +
 +      if (intel_gtt_init() != 0)
 +              return 0;
 +
 +      return 1;
 +}
 +EXPORT_SYMBOL(intel_gmch_probe);
 +
 +struct intel_gtt *intel_gtt_get(void)
 +{
 +      return &intel_private.base;
 +}
 +EXPORT_SYMBOL(intel_gtt_get);
 +
 +void intel_gmch_remove(struct pci_dev *pdev)
 +{
 +      if (intel_private.pcidev)
 +              pci_dev_put(intel_private.pcidev);
 +      if (intel_private.bridge_dev)
 +              pci_dev_put(intel_private.bridge_dev);
 +}
 +EXPORT_SYMBOL(intel_gmch_remove);
 +
 +MODULE_AUTHOR("Dave Jones <davej@redhat.com>");
 +MODULE_LICENSE("GPL and additional rights");
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -187,8 -187,8 +187,8 @@@ static bool intel_ironlake_crt_detect_h
        I915_WRITE(PCH_ADPA, adpa);
  
        if (wait_for((I915_READ(PCH_ADPA) & ADPA_CRT_HOTPLUG_FORCE_TRIGGER) == 0,
 -                   1000, 1))
 +                   1000))
-               DRM_ERROR("timed out waiting for FORCE_TRIGGER");
+               DRM_DEBUG_KMS("timed out waiting for FORCE_TRIGGER");
  
        if (turn_off_dac) {
                I915_WRITE(PCH_ADPA, temp);
@@@ -244,8 -244,8 +244,8 @@@ static bool intel_crt_detect_hotplug(st
                /* wait for FORCE_DETECT to go off */
                if (wait_for((I915_READ(PORT_HOTPLUG_EN) &
                              CRT_HOTPLUG_FORCE_DETECT) == 0,
 -                           1000, 1))
 +                           1000))
-                       DRM_ERROR("timed out waiting for FORCE_DETECT to go off");
+                       DRM_DEBUG_KMS("timed out waiting for FORCE_DETECT to go off");
        }
  
        stat = I915_READ(PORT_HOTPLUG_STAT);
@@@ -402,10 -400,12 +402,11 @@@ intel_crt_load_detect(struct drm_crtc *
        return status;
  }
  
- static enum drm_connector_status intel_crt_detect(struct drm_connector *connector)
+ static enum drm_connector_status
+ intel_crt_detect(struct drm_connector *connector, bool force)
  {
        struct drm_device *dev = connector->dev;
 -      struct drm_encoder *encoder = intel_attached_encoder(connector);
 -      struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
 +      struct intel_encoder *encoder = intel_attached_encoder(connector);
        struct drm_crtc *crtc;
        int dpms_mode;
        enum drm_connector_status status;
                        return connector_status_disconnected;
        }
  
 -      if (intel_crt_detect_ddc(encoder))
 +      if (intel_crt_detect_ddc(&encoder->base))
                return connector_status_connected;
  
+       if (!force)
+               return connector->status;
        /* for pre-945g platforms use load detect */
 -      if (encoder->crtc && encoder->crtc->enabled) {
 -              status = intel_crt_load_detect(encoder->crtc, intel_encoder);
 +      if (encoder->base.crtc && encoder->base.crtc->enabled) {
 +              status = intel_crt_load_detect(encoder->base.crtc, encoder);
        } else {
 -              crtc = intel_get_load_detect_pipe(intel_encoder, connector,
 +              crtc = intel_get_load_detect_pipe(encoder, connector,
                                                  NULL, &dpms_mode);
                if (crtc) {
 -                      status = intel_crt_load_detect(crtc, intel_encoder);
 -                      intel_release_load_detect_pipe(intel_encoder,
 +                      status = intel_crt_load_detect(crtc, encoder);
 +                      intel_release_load_detect_pipe(encoder,
                                                       connector, dpms_mode);
                } else
                        status = connector_status_unknown;
Simple merge
@@@ -1437,10 -1386,11 +1437,10 @@@ ironlake_dp_detect(struct drm_connecto
   * \return false if DP port is disconnected.
   */
  static enum drm_connector_status
- intel_dp_detect(struct drm_connector *connector)
+ intel_dp_detect(struct drm_connector *connector, bool force)
  {
 -      struct drm_encoder *encoder = intel_attached_encoder(connector);
 -      struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
 -      struct drm_device *dev = intel_dp->base.enc.dev;
 +      struct intel_dp *intel_dp = intel_attached_dp(connector);
 +      struct drm_device *dev = intel_dp->base.base.dev;
        struct drm_i915_private *dev_priv = dev->dev_private;
        uint32_t temp, bit;
        enum drm_connector_status status;
@@@ -227,9 -221,12 +227,10 @@@ static void intel_dvo_mode_set(struct d
   *
   * Unimplemented.
   */
- static enum drm_connector_status intel_dvo_detect(struct drm_connector *connector)
+ static enum drm_connector_status
+ intel_dvo_detect(struct drm_connector *connector, bool force)
  {
 -      struct drm_encoder *encoder = intel_attached_encoder(connector);
 -      struct intel_dvo *intel_dvo = enc_to_intel_dvo(encoder);
 -
 +      struct intel_dvo *intel_dvo = intel_attached_dvo(connector);
        return intel_dvo->dev.dev_ops->detect(&intel_dvo->dev);
  }
  
@@@ -146,11 -139,11 +146,11 @@@ static bool intel_hdmi_mode_fixup(struc
  }
  
  static enum drm_connector_status
- intel_hdmi_detect(struct drm_connector *connector)
+ intel_hdmi_detect(struct drm_connector *connector, bool force)
  {
 -      struct drm_encoder *encoder = intel_attached_encoder(connector);
 -      struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
 -      struct edid *edid = NULL;
 +      struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
 +      struct drm_i915_private *dev_priv = connector->dev->dev_private;
 +      struct edid *edid;
        enum drm_connector_status status = connector_status_disconnected;
  
        intel_hdmi->has_hdmi_sink = false;
Simple merge
@@@ -1490,10 -1484,14 +1490,11 @@@ intel_sdvo_hdmi_sink_detect(struct drm_
        return status;
  }
  
- static enum drm_connector_status intel_sdvo_detect(struct drm_connector *connector)
+ static enum drm_connector_status
+ intel_sdvo_detect(struct drm_connector *connector, bool force)
  {
        uint16_t response;
 -      struct drm_encoder *encoder = intel_attached_encoder(connector);
 -      struct intel_sdvo *intel_sdvo = enc_to_intel_sdvo(encoder);
 +      struct intel_sdvo *intel_sdvo = intel_attached_sdvo(connector);
        struct intel_sdvo_connector *intel_sdvo_connector = to_intel_sdvo_connector(connector);
        enum drm_connector_status ret;
  
@@@ -1341,18 -1341,19 +1341,18 @@@ static void intel_tv_find_better_format
   * we have a pipe programmed in order to probe the TV.
   */
  static enum drm_connector_status
- intel_tv_detect(struct drm_connector *connector)
+ intel_tv_detect(struct drm_connector *connector, bool force)
  {
        struct drm_display_mode mode;
 -      struct drm_encoder *encoder = intel_attached_encoder(connector);
 -      struct intel_tv *intel_tv = enc_to_intel_tv(encoder);
 +      struct intel_tv *intel_tv = intel_attached_tv(connector);
        int type;
  
        mode = reported_modes[0];
        drm_mode_set_crtcinfo(&mode, CRTC_INTERLACE_HALVE_V);
  
 -      if (encoder->crtc && encoder->crtc->enabled) {
 +      if (intel_tv->base.base.crtc && intel_tv->base.base.crtc->enabled) {
                type = intel_tv_detect_type(intel_tv);
-       } else {
+       } else if (force) {
                struct drm_crtc *crtc;
                int dpms_mode;