Skip to content
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

Force fullscreen when using the KMSDRM video driver #4645

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

LHLaurini
Copy link
Contributor

@LHLaurini LHLaurini commented Feb 3, 2024

When running from a virtual console on a Raspberry Pi Zero 2W, SDL will use the KMSDRM video driver. Without any extra options, it automatically switches to 800x600 640x480, while the --fullscreen flag keeps the current resolution.

This patch automatically enables fullscreen (and prevents it from being disabled) if the KMSDRM driver is used.

PS: I couldn't test on other systems at the moment, so I'd also like some help in testing whether this behavior is present on other systems and whether this patch fixes it.

The KMSDRM video driver switches to a low resolution unless fullscreen
is enabled - so we force it in that case. We also ignore any requests to
switch to "windowed" mode.
@rom1v
Copy link
Collaborator

rom1v commented Feb 4, 2024

I couldn't test on other systems at the moment

On my laptop, if I switch to a console (Ctrl+Alt+F1), and I run scrcpy, it does not change the resolution (but I can't control anything, keyboard and mouse input are not captured).

it automatically switches to 800x600

What if you start fullscreen then disable fullscreen, does it switch to 800x600?

@LHLaurini
Copy link
Contributor Author

Note: it seems I misremembered, it actually switches to 640x480, which is the smallest resolution supported by my monitor.

I just tried testing stock scrcpy again, it seems to be pretty hit or miss. On my first test, it changed the resolution, but worked fine otherwise. After that, it would always get stuck at INFO: Initial texture: .... Adding -V debug made it work again, for some reason (maybe some race condition in SDL2?). The patched version seems to always work, however.

On my laptop, if I switch to a console (Ctrl+Alt+F1), and I run scrcpy, it does not change the resolution

This could be specific to some systems then... Maybe just Raspberry Pis? Would be great if somebody could help us test that hypothesis.

but I can't control anything, keyboard and mouse input are not captured

For me, whether the resolution changes or not, input is still captured. When running in a virtual console SDL2 uses evdev for input, so the user must be in the input group (or have equivalent permissions) for that to work.

What if you start fullscreen then disable fullscreen, does it switch to 800x600?

Yes, it does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants