-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Display monitor hotplugging v2 #199
Conversation
Squashed earlier attempts for easier rebasing + added bits from guyonvarch (85f5efa): guyonvarch@85f5efa Co-authored-by: Joris <joris@guyonvarch.me> Co-authored-by: Ignas Vyšniauskas <i.vysniauskas@gmail.com>
application/select-display.sh
Outdated
if [ -z "$CONNECTED_OUTPUTS" ]; then | ||
|
||
echo "No connected outputs found. Attempting to apply xrandr globally." | ||
xrandr --auto # this is kind of useless? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From xrandr man pages:
For disconnected but enabled outputs, this will disable them.
So if all are disconnected, this will simply disable them. I suggest to replace this with a warning, unless there's some reason to do this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed this in b1d2db7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Working well when unplugging the HDMI cable, and re-plugging it. But starting the system without any plugged screen, and plugging it afterward, it connects to the screen, but it doesn’t use all the available space:
I built PlayOS with ./build lab-key
, installed playos-live
to a USB stick, then booted from it.
I was just writing the same report as @guyonvarch. I SSH'd into a machine running 0b4145b, and late plugging works, the screen is used, with a tiny kiosk taking up less than a quarter of the screen, and the rest of the screen black. I then killed the kiosk process and when it restarted, it filled the entire screen. We should set you up with an option for doing this, @yfyf. You can add an SSH pubkey and enable SSHing in from origins other than ZeroTier, of course.
Yes, that's the purpose. It is a bit daring to default to full HD, but we have not had issues with it so far. I guess we could abstain from adjusting the resolution if full HD is not supported at all.
I would leave a multi-screen scenario as "undefined", or do the simplest thing that's unlikely to blow up. It's not supported. Either mirror or leave all but one blank if multiple are detected. |
Thank you for the bug reports @guyonvarch and @knuton! Will look for a work-around, I have various suspects in mind. |
You did it! 👏 |
This ensures that if other functions are connected to the same signal, they don't get disconnected.
Fails up-to-this commit, fixed by next commit
@knuton @guyonvarch: pushed changes that make kiosk aware of display output changes. It seems to work, and hopefully resolves a split-brain situation between xrandr and kiosk in terms of which output is considered to be primary (that existed before). This PR makes However, based on my testing the docs seem to not be entirelly true, Qt is more proactive with determining the primary screen:
Previously, Along the way I had to resolve an annoying race-condition - Chromium (and hence all of kiosk) was crashing when both the mode/geometry and the available screens change simultaneously. I created a test to reproduce it, the crash log is attached if you're curious. Chromium would attempt to resize before it had updated the available screens and would trigger this assert failure. I fixed it in 4212df8 by changing to a non-blocking (queue'd) signal connection. I threw in a precautionary sleep as well. The test seems to pass without it, but I don't think anything guarantees the current ordering of events. On the other hand, in the worst case the kiosk just crashes and restarts, so it's not awfully horrible and the sleep could be emitted. Note that this is not a synthetic scenario: this could in practice happen if scaling is set to Could one of you maybe test this on hardware, if you have screens like that? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My previous test is now passing, well done!
The test with 2 screens needs to be run manually, but can we have an (or many) automatic test for that would only require one screen?
For example:
- power on with one screen pluged in, store pixels,
- unplug screen,
- plug screen again,
- check pixels are ≃ equal,
- shutdown,
- power on with screen unpluged,
- wait for browser window,
- plug screen, check pixels are ≃ equal.
Also, at first, I didn’t read the note on top of the test, and thought the test had been misplaced. Could it be moved to a manual
directory for example?
Yes, but...
There is no way to "unplug" screen in QEMU drivers, so best you can do is "xrandr --off", like I am currently doing in the tests, which is not the same.
This can be done, but note that this test would pass even if the kiosk did not do anything at all. So not very useful.
As stated earlier, this is impossible, or at least very difficult to do without introducing significant workarounds.
Again, this would pass even if kiosk did not do anything. How about a slightly different single-output automated test which is maybe a bit more useful?
Sure, can do that. |
Looks good! |
@guyonvarch added an additional integration test that can be run non-interactively: 35eb638. Took me much longer than I expected, because resampling the different resolution screenshots led to pixel noise, so had to rework the background into something slightly more complex that proportionally scales under different resolutions. Going back to my earlier comment:
Do you maybe have displays like that to attempt to test the fix in 4212df8 on real hardware? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job! A lot of comments are nitpick.
Do you maybe have displays like that to attempt to test the fix in 4212df8 on real hardware?
I unfortunately only have full hd screens.
Nice! What do you think about the last open comment? |
A revamped version of #155.
I tested the following:
./build vm
with QEMU options modified to-device vga,max_outputs=2
displays output on both monitorsWhat I didn't manage to test:
DISPLAY=:0 XAUTHORITY=<..> xrandr --output <secondary> --off
from the xsession, it works, but if I Ctrl+Alt+F1 and run the same command from the virtual console it errors out withConfigure crtc 0 failed
. This would be critical for testing how the kiosk responds to screen resolution changes.Some discussion points:
--mode 1920x1080
) default in the scaling preferences? If the screen doesn't support it, xrandr will fail without a fallback, which is not great. Is it to scale down 4K screens down to 1080p?--auto
or at least a check that 1080p is actually a supported mode.xrandr
issues mentioned above.Checklist