diff mbox

[2/2] nouveau: wrap the output poll execution and wakeup gpu

Message ID 20170110021232.15389-3-airlied@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dave Airlie Jan. 10, 2017, 2:12 a.m. UTC
From: Dave Airlie <airlied@redhat.com>

This wraps the output poll and fixes a problem where
pm resume would try and take the mode config mutex
but the output poll thread would already have taken it.

I found this while looking for another bug, I've no idea
yet if this fixes that problem.

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/nouveau/nv50_display.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
diff mbox

Patch

diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
index cb85cb7..75502cd 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.c
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
@@ -4323,10 +4323,26 @@  nv50_disp_atomic_state_alloc(struct drm_device *dev)
 	return &atom->state;
 }
 
+static bool
+nv50_disp_output_poll_execute(struct drm_device *dev)
+{
+	int ret;
+	bool repoll;
+	ret = pm_runtime_get_sync(dev->dev);
+	if (ret < 0 && ret != -EACCES)
+		return true;
+
+	repoll = drm_kms_helper_poll_outputs(dev);
+	pm_runtime_mark_last_busy(dev->dev);
+	pm_runtime_put_autosuspend(dev->dev);
+	return repoll;
+}
+
 static const struct drm_mode_config_funcs
 nv50_disp_func = {
 	.fb_create = nouveau_user_framebuffer_create,
 	.output_poll_changed = nouveau_fbcon_output_poll_changed,
+	.output_poll_execute = nv50_disp_output_poll_execute,
 	.atomic_check = nv50_disp_atomic_check,
 	.atomic_commit = nv50_disp_atomic_commit,
 	.atomic_state_alloc = nv50_disp_atomic_state_alloc,