From 54278e8b39c230571b79ab70118030626123ddfb Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Tue, 10 Jan 2017 16:08:05 +0200 Subject: [PATCH 1/3] drm: Debug prints for BUG98690 Prints for tracking poll and hpd_work scheduling Signed-off-by: Peter Ujfalusi --- drivers/gpu/drm/drm_probe_helper.c | 9 +++++++++ drivers/gpu/drm/nouveau/nouveau_display.c | 11 +++++++++++ drivers/gpu/drm/nouveau/nouveau_drm.c | 9 +++++++++ 3 files changed, 29 insertions(+) diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c index ac953f037be7..3dac1eb4a51d 100644 --- a/drivers/gpu/drm/drm_probe_helper.c +++ b/drivers/gpu/drm/drm_probe_helper.c @@ -143,6 +143,7 @@ void drm_kms_helper_poll_enable_locked(struct drm_device *dev) } if (dev->mode_config.delayed_event) { + DRM_DEV_DEBUG_KMS(dev->dev, "BUG98690: for delayed_event\n"); poll = true; delay = 0; } @@ -389,6 +390,9 @@ static void output_poll_execute(struct work_struct *work) changed = dev->mode_config.delayed_event; dev->mode_config.delayed_event = false; + if (changed) + DRM_DEV_DEBUG_KMS(dev->dev, "BUG98690: enter\n"); + if (!drm_kms_helper_poll) goto out; @@ -397,6 +401,9 @@ static void output_poll_execute(struct work_struct *work) goto out; } + if (changed) + DRM_DEV_DEBUG_KMS(dev->dev, "BUG98690: proceed\n"); + drm_for_each_connector(connector, dev) { /* Ignore forced connectors. */ @@ -476,6 +483,8 @@ void drm_kms_helper_poll_disable(struct drm_device *dev) { if (!dev->mode_config.poll_enabled) return; + + DRM_DEV_DEBUG_KMS(dev->dev, "BUG98690: cancel work\n"); cancel_delayed_work_sync(&dev->mode_config.output_poll_work); } EXPORT_SYMBOL(drm_kms_helper_poll_disable); diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c index cef08da1da4e..b715647c0623 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c @@ -354,6 +354,8 @@ nouveau_display_hpd_work(struct work_struct *work) { struct nouveau_drm *drm = container_of(work, typeof(*drm), hpd_work); + DRM_DEV_DEBUG_KMS(drm->dev->dev, "BUG98690: enter\n"); + pm_runtime_get_sync(drm->dev->dev); drm_helper_hpd_irq_event(drm->dev); @@ -387,6 +389,8 @@ nouveau_display_acpi_ntfy(struct notifier_block *nb, unsigned long val, * connector hotplug on a runtime suspended GPU, * schedule hpd_work to check. */ + DRM_DEV_DEBUG_KMS(drm->dev->dev, + "BUG98690: schedule hpd_work\n"); schedule_work(&drm->hpd_work); /* acpi-video should not generate keypresses for this */ @@ -406,11 +410,14 @@ nouveau_display_init(struct drm_device *dev) struct drm_connector *connector; int ret; + DRM_DEV_DEBUG_KMS(dev->dev, "BUG98690: enter\n"); + ret = disp->init(dev); if (ret) return ret; /* enable polling for external displays */ + DRM_DEV_DEBUG_KMS(dev->dev, "BUG98690: poll_enable\n"); drm_kms_helper_poll_enable(dev); /* enable hotplug interrupts */ @@ -448,6 +455,7 @@ nouveau_display_fini(struct drm_device *dev, bool suspend) nvif_notify_put(&conn->hpd); } + DRM_DEV_DEBUG_KMS(dev->dev, "BUG98690: poll_disable\n"); drm_kms_helper_poll_disable(dev); disp->fini(dev); } @@ -533,6 +541,7 @@ nouveau_display_create(struct drm_device *dev) else dev->mode_config.async_page_flip = true; + DRM_DEV_DEBUG_KMS(dev->dev, "BUG98690: poll_init/disable\n"); drm_kms_helper_poll_init(dev); drm_kms_helper_poll_disable(dev); @@ -784,6 +793,8 @@ nouveau_display_resume(struct drm_device *dev, bool runtime) struct drm_crtc *crtc; int ret; + DRM_DEV_DEBUG_KMS(dev->dev, "BUG98690: enter\n"); + if (dev->mode_config.funcs->atomic_commit) { nouveau_display_init(dev); if (disp->suspend) { diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index 59348fc41c77..f4c5cea0420e 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -634,6 +634,8 @@ nouveau_do_resume(struct drm_device *dev, bool runtime) struct nouveau_drm *drm = nouveau_drm(dev); struct nouveau_cli *cli; + DRM_DEV_DEBUG_KMS(dev->dev, "BUG98690: enter\n"); + NV_INFO(drm, "resuming kernel object tree...\n"); nvif_client_resume(&drm->client.base); @@ -692,6 +694,8 @@ nouveau_pmops_resume(struct device *dev) drm_dev->switch_power_state == DRM_SWITCH_POWER_DYNAMIC_OFF) return 0; + DRM_DEV_DEBUG_KMS(drm_dev->dev, "BUG98690: enter\n"); + pci_set_power_state(pdev, PCI_D0); pci_restore_state(pdev); ret = pci_enable_device(pdev); @@ -702,6 +706,7 @@ nouveau_pmops_resume(struct device *dev) ret = nouveau_do_resume(drm_dev, false); /* Monitors may have been connected / disconnected during suspend */ + DRM_DEV_DEBUG_KMS(drm_dev->dev, "BUG98690: schedule hpd_work\n"); schedule_work(&nouveau_drm(drm_dev)->hpd_work); return ret; @@ -762,6 +767,8 @@ nouveau_pmops_runtime_resume(struct device *dev) struct nvif_device *device = &nouveau_drm(drm_dev)->device; int ret; + DRM_DEV_DEBUG_KMS(drm_dev->dev, "BUG98690: enter\n"); + if (nouveau_runtime_pm == 0) return -EINVAL; @@ -773,6 +780,7 @@ nouveau_pmops_runtime_resume(struct device *dev) pci_set_master(pdev); ret = nouveau_do_resume(drm_dev, true); + DRM_DEV_DEBUG_KMS(drm_dev->dev, "BUG98690: poll_enable\n"); drm_kms_helper_poll_enable(drm_dev); /* do magic */ nvif_mask(&device->object, 0x088488, (1 << 25), (1 << 25)); @@ -780,6 +788,7 @@ nouveau_pmops_runtime_resume(struct device *dev) drm_dev->switch_power_state = DRM_SWITCH_POWER_ON; /* Monitors may have been connected / disconnected during suspend */ + DRM_DEV_DEBUG_KMS(drm_dev->dev, "BUG98690: schedule hpd_work\n"); schedule_work(&nouveau_drm(drm_dev)->hpd_work); return ret; -- 2.11.0