]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/nouveau: Fix drm poll_helper handling
authorPeter Ujfalusi <peter.ujfalusi@ti.com>
Mon, 15 May 2017 09:04:31 +0000 (12:04 +0300)
committerBen Skeggs <bskeggs@redhat.com>
Tue, 16 May 2017 23:09:41 +0000 (09:09 +1000)
Commit bdc42171548d effectively disabled the drm poll_helper by checking
the wrong flag to see if the driver should enable the poll or not:
mode_config.poll_enabled is only set to true by poll_init and it is not
indicating if the poll is enabled or not.
nouveau_display_create() will initialize the poll and going to disable it
right away. After poll_init() the mode_config.poll_enabled will be true,
but the poll itself is disabled.

To avoid the race caused by calling the poll_enable() from different paths,
this patch will enable the poll from one place, in the
nouveau_display_hpd_work().

In case the pm_runtime is disabled we will enable the poll in
nouveau_drm_load() once.

Fixes: bdc42171548d ("drm/nouveau: Don't enabling polling twice on runtime resume")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Reviewed-by: Lyude <lyude@redhat.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nouveau_display.c
drivers/gpu/drm/nouveau/nouveau_drm.c

index 21b10f9840c95e29cd177e9e36d93b8d6155b48d..549763f5e17d8f3c2de2e5d6dbe460363e98c923 100644 (file)
@@ -360,6 +360,8 @@ nouveau_display_hpd_work(struct work_struct *work)
        pm_runtime_get_sync(drm->dev->dev);
 
        drm_helper_hpd_irq_event(drm->dev);
+       /* enable polling for external displays */
+       drm_kms_helper_poll_enable(drm->dev);
 
        pm_runtime_mark_last_busy(drm->dev->dev);
        pm_runtime_put_sync(drm->dev->dev);
@@ -413,10 +415,6 @@ nouveau_display_init(struct drm_device *dev)
        if (ret)
                return ret;
 
-       /* enable polling for external displays */
-       if (!dev->mode_config.poll_enabled)
-               drm_kms_helper_poll_enable(dev);
-
        /* enable hotplug interrupts */
        list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
                struct nouveau_connector *conn = nouveau_connector(connector);
index 2b6ac24ce6901013fd1dc99b4b4e8b27de6125db..36268e1802b5afcd65c6b3d623b273c4ac60af87 100644 (file)
@@ -502,6 +502,9 @@ nouveau_drm_load(struct drm_device *dev, unsigned long flags)
                pm_runtime_allow(dev->dev);
                pm_runtime_mark_last_busy(dev->dev);
                pm_runtime_put(dev->dev);
+       } else {
+               /* enable polling for external displays */
+               drm_kms_helper_poll_enable(dev);
        }
        return 0;
 
@@ -774,9 +777,6 @@ nouveau_pmops_runtime_resume(struct device *dev)
 
        ret = nouveau_do_resume(drm_dev, true);
 
-       if (!drm_dev->mode_config.poll_enabled)
-               drm_kms_helper_poll_enable(drm_dev);
-
        /* do magic */
        nvif_mask(&device->object, 0x088488, (1 << 25), (1 << 25));
        vga_switcheroo_set_dynamic_switch(pdev, VGA_SWITCHEROO_ON);