Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

session/logind: keep active for pause_device gone #1696

Merged
merged 1 commit into from
May 15, 2019

Conversation

RedSoxFan
Copy link
Member

This appears to be a quick fix for compositors freezing when a dock is
disconnected. Disconnection of the dock is causing pause_device for
the DRM devices associated with the dock. Since these devices major
number is DRM_MAJOR, the session was being set to inactive. This just
makes it so the session is not set to inactive when the device's state
is gone.

This appears to be a quick fix for compositors freezing when a dock is
disconnected. Disconnection of the dock is causing `pause_device` for
the DRM devices associated with the dock. Since these devices major
number is `DRM_MAJOR`, the session was being set to inactive. This just
makes it so the session is not set to inactive when the device's state
is `gone`.
@ddevault ddevault requested a review from ascent12 May 13, 2019 14:49
@@ -274,7 +274,7 @@ static int pause_device(sd_bus_message *msg, void *userdata,
goto error;
}

if (major == DRM_MAJOR) {
if (major == DRM_MAJOR && strcmp(type, "gone") != 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should only set active = false if strcmp(type, "pause") == 0?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can test that tonight if you want

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, please do.

We might want to destroy the sub-backend if the device is gone.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your way seems to work as well, the following log has some debug code from @RedSoxFan as well.

https://mthode.org/dist/logs/tb-disconnect-working.log.xz

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should only set active = false if strcmp(type, "pause") == 0?

Looking at the documentation at https://www.freedesktop.org/wiki/Software/systemd/logind/ (sorry can't link to an anchor since the id's are not unique...), it looks like there are three values: force, pause, and gone. force is an asynchronous notification that the device was paused, pause is a synchronous notification the device is being paused, and gone is a notification that the device has been removed.

Based on that, I think that the condition is correct as-is. Thoughts?

We might want to destroy the sub-backend if the device is gone.

How would I go about doing that? I haven't really touched wlroots much

Copy link
Member

@emersion emersion May 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on that, I think that the condition is correct as-is. Thoughts?

Indeed, you're right!

How would I go about doing that? I haven't really touched wlroots much

wlr_backend_destroy will probably do the trick. Ah, expect we don't have access to the sub-backend here?

Let's just leave it for another PR then.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, this pr is invalid because it's correct as is? What should be done to address the lock up issue then?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this PR LGTM.

@ascent12 ascent12 merged commit 522ddd9 into swaywm:master May 15, 2019
@RedSoxFan RedSoxFan deleted the logind-stay-active-on-gone branch April 14, 2020 03:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants