]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
drm/i915: Enable hotplug polling after registering the outputs
authorChris Wilson <chris@chris-wilson.co.uk>
Tue, 28 Nov 2017 11:01:47 +0000 (11:01 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Tue, 28 Nov 2017 14:31:44 +0000 (14:31 +0000)
Previously we would enable hotplug polling on the outputs immediately
upon construction. This would allow a very early hotplug event to
trigger before we had finishing setting up the driver to handle it.
Instead, move the output polling to the last step of registration, after
we have set up all handlers, including the fbdev configuration.

v2: Symmetrically turnoff the hotplug helper in unregister after the
fbdev is first synchronised then finalized. This stops a late hotplug
event being processed after the interrupts are disabled.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> #v1
Link: https://patchwork.freedesktop.org/patch/msgid/20171128110147.28654-1-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/i915_drv.c
drivers/gpu/drm/i915/intel_display.c

index 9c519aa4f550d0f2d79044cd908fe9a3e922531e..1c419893e3a9de2e649d26231d53ec0fa98b5fe4 100644 (file)
@@ -693,8 +693,6 @@ static int i915_load_modeset_init(struct drm_device *dev)
        /* Only enable hotplug handling once the fbdev is fully set up. */
        intel_hpd_init(dev_priv);
 
-       drm_kms_helper_poll_init(dev);
-
        return 0;
 
 cleanup_gem:
@@ -1255,6 +1253,13 @@ static void i915_driver_register(struct drm_i915_private *dev_priv)
         * cannot run before the connectors are registered.
         */
        intel_fbdev_initial_config_async(dev);
+
+       /*
+        * We need to coordinate the hotplugs with the asynchronous fbdev
+        * configuration, for which we use the fbdev->async_cookie.
+        */
+       if (INTEL_INFO(dev_priv)->num_pipes)
+               drm_kms_helper_poll_init(dev);
 }
 
 /**
@@ -1266,6 +1271,13 @@ static void i915_driver_unregister(struct drm_i915_private *dev_priv)
        intel_fbdev_unregister(dev_priv);
        intel_audio_deinit(dev_priv);
 
+       /*
+        * After flushing the fbdev (incl. a late async config which will
+        * have delayed queuing of a hotplug event), then flush the hotplug
+        * events.
+        */
+       drm_kms_helper_poll_fini(&dev_priv->drm);
+
        intel_gpu_ips_teardown();
        acpi_video_unregister();
        intel_opregion_unregister(dev_priv);
index fec267dfc06230f10fe483cb25076b0098b1e240..76c75d34e799b52b48101c4a1870679d90ae52fd 100644 (file)
@@ -15276,10 +15276,7 @@ static void intel_hpd_poll_fini(struct drm_device *dev)
        struct intel_connector *connector;
        struct drm_connector_list_iter conn_iter;
 
-       /* First disable polling... */
-       drm_kms_helper_poll_fini(dev);
-
-       /* Then kill the work that may have been queued by hpd. */
+       /* Kill all the work that may have been queued by hpd. */
        drm_connector_list_iter_begin(dev, &conn_iter);
        for_each_intel_connector_iter(connector, &conn_iter) {
                if (connector->modeset_retry_work.func)