summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/drm/i915/i915_dma.c41
-rw-r--r--sys/dev/pci/drm/i915/i915_drv.c13
-rw-r--r--sys/dev/pci/drm/i915/i915_drv.h1
-rw-r--r--sys/dev/pci/drm/i915/i915_irq.c4
-rw-r--r--sys/dev/pci/drm/i915/intel_crt.c2
-rw-r--r--sys/dev/pci/drm/i915/intel_pm.c2
6 files changed, 51 insertions, 12 deletions
diff --git a/sys/dev/pci/drm/i915/i915_dma.c b/sys/dev/pci/drm/i915/i915_dma.c
index 415508b5a62..1e0dbdb3a99 100644
--- a/sys/dev/pci/drm/i915/i915_dma.c
+++ b/sys/dev/pci/drm/i915/i915_dma.c
@@ -289,23 +289,42 @@ i915_load_modeset_init(struct drm_device *dev)
if (IS_GEN3(dev) && (I915_READ(ECOSKPD) & ECO_FLIP_DONE))
dev_priv->flip_pending_is_done = true;
+#ifdef notyet
+ ret = vga_switcheroo_register_client(dev->pdev, &i915_switcheroo_ops);
+ if (ret)
+ goto cleanup_vga_client;
+
+ /* Initialise stolen first so that we may reserve preallocated
+ * objects for the BIOS to KMS transition.
+ */
+ ret = i915_gem_init_stolen(dev);
+ if (ret)
+ goto cleanup_vga_switcheroo;
+#endif
+ ret = drm_irq_install(dev);
+ if (ret)
+ goto cleanup_gem_stolen;
+
+ /* Important: The output setup functions called by modeset_init need
+ * working irqs for e.g. gmbus and dp aux transfers. */
intel_modeset_init(dev);
ret = i915_gem_init(dev);
- if (ret != 0)
- goto cleanup_gem;
+ if (ret)
+ goto cleanup_irq;
intel_modeset_gem_init(dev);
- ret = drm_irq_install(dev);
- if (ret)
- goto cleanup_gem;
-
+ /* Always safe in the mode setting case. */
+ /* FIXME: do pre/post-mode set stuff in core KMS code */
dev->vblank_disable_allowed = 1;
ret = intel_fbdev_init(dev);
if (ret)
- goto cleanup_irq;
+ goto cleanup_gem;
+
+ /* Only enable hotplug handling once the fbdev is fully set up. */
+ dev_priv->enable_hotplug_processing = true;
drm_kms_helper_poll_init(dev);
@@ -314,13 +333,17 @@ i915_load_modeset_init(struct drm_device *dev)
return (0);
-cleanup_irq:
- drm_irq_uninstall(dev);
cleanup_gem:
DRM_LOCK();
i915_gem_cleanup_ringbuffer(dev);
DRM_UNLOCK();
i915_gem_cleanup_aliasing_ppgtt(dev);
+cleanup_irq:
+ drm_irq_uninstall(dev);
+cleanup_gem_stolen:
+#ifdef notyet
+ i915_gem_cleanup_stolen(dev);
+#endif
return (ret);
}
diff --git a/sys/dev/pci/drm/i915/i915_drv.c b/sys/dev/pci/drm/i915/i915_drv.c
index f09895c5cee..608ac579af5 100644
--- a/sys/dev/pci/drm/i915/i915_drv.c
+++ b/sys/dev/pci/drm/i915/i915_drv.c
@@ -528,6 +528,7 @@ i915_drm_freeze(struct drm_device *dev)
intel_modeset_disable(dev);
drm_irq_uninstall(dev);
+ dev_priv->enable_hotplug_processing = false;
}
i915_save_state(dev);
@@ -559,9 +560,19 @@ __i915_drm_thaw(struct drm_device *dev)
error = i915_gem_init_hw(dev);
DRM_UNLOCK();
+ /* We need working interrupts for modeset enabling ... */
+ drm_irq_install(dev);
+
intel_modeset_init_hw(dev);
intel_modeset_setup_hw_state(dev, false);
- drm_irq_install(dev);
+
+ /*
+ * ... but also need to make sure that hotplug processing
+ * doesn't cause havoc. Like in the driver load code we don't
+ * bother with the tiny race here where we might loose hotplug
+ * notifications.
+ * */
+ dev_priv->enable_hotplug_processing = true;
}
intel_opregion_init(dev);
diff --git a/sys/dev/pci/drm/i915/i915_drv.h b/sys/dev/pci/drm/i915/i915_drv.h
index 042e3ad87d9..b671825a4d8 100644
--- a/sys/dev/pci/drm/i915/i915_drv.h
+++ b/sys/dev/pci/drm/i915/i915_drv.h
@@ -560,6 +560,7 @@ struct inteldrm_softc {
u_int32_t hotplug_supported_mask;
struct workq_task hotplug_task;
+ bool enable_hotplug_processing;
int num_pipe;
int num_pch_pll;
diff --git a/sys/dev/pci/drm/i915/i915_irq.c b/sys/dev/pci/drm/i915/i915_irq.c
index f550d346774..460e6219a27 100644
--- a/sys/dev/pci/drm/i915/i915_irq.c
+++ b/sys/dev/pci/drm/i915/i915_irq.c
@@ -348,6 +348,10 @@ i915_hotplug_work_func(void *arg1, void *arg2)
struct drm_mode_config *mode_config = &dev->mode_config;
struct intel_encoder *encoder;
+ /* HPD irq before everything is fully set up. */
+ if (!dev_priv->enable_hotplug_processing)
+ return;
+
rw_enter_write(&mode_config->rwl);
DRM_DEBUG_KMS("running encoder hotplug functions\n");
diff --git a/sys/dev/pci/drm/i915/intel_crt.c b/sys/dev/pci/drm/i915/intel_crt.c
index e5569712658..3f25ad0254b 100644
--- a/sys/dev/pci/drm/i915/intel_crt.c
+++ b/sys/dev/pci/drm/i915/intel_crt.c
@@ -121,7 +121,7 @@ intel_disable_crt(struct intel_encoder *encoder)
u32 temp;
temp = I915_READ(crt->adpa_reg);
- temp &= ~(ADPA_HSYNC_CNTL_DISABLE | ADPA_VSYNC_CNTL_DISABLE);
+ temp |= ADPA_HSYNC_CNTL_DISABLE | ADPA_VSYNC_CNTL_DISABLE;
temp &= ~ADPA_DAC_ENABLE;
I915_WRITE(crt->adpa_reg, temp);
}
diff --git a/sys/dev/pci/drm/i915/intel_pm.c b/sys/dev/pci/drm/i915/intel_pm.c
index 95b42a29256..9830f2bd03e 100644
--- a/sys/dev/pci/drm/i915/intel_pm.c
+++ b/sys/dev/pci/drm/i915/intel_pm.c
@@ -2755,7 +2755,7 @@ gen6_enable_rps(struct drm_device *dev)
I915_WRITE(GEN6_RC_SLEEP, 0);
I915_WRITE(GEN6_RC1e_THRESHOLD, 1000);
I915_WRITE(GEN6_RC6_THRESHOLD, 50000);
- I915_WRITE(GEN6_RC6p_THRESHOLD, 100000);
+ I915_WRITE(GEN6_RC6p_THRESHOLD, 150000);
I915_WRITE(GEN6_RC6pp_THRESHOLD, 64000); /* unused */
/* Check if we are enabling RC6 */