We have a browser based application running in the browser block and we have a need to cap the max resolution at 1920x1080 even on higher resolutions displays. We also need to support 720 resolution displays so we can’t just hard code the resolution to 1920x1080. Is there any built in way to do this with balena or the browser block specifically? If not, is there a straight forward way to basically do this:
- Determine the native resolution of the attached display at runtime.
- If resolution is higher than 1920x1080, force the display output to a resolution of 1920x1080 at runtime.
Thanks for the great question. I have a few questions and initial thoughts:
- Which version of balenaOS are you using?
- What kind of devices are you using?
- Have you tried using the browser block with stock settings in your use case on both a 1080p and 720p display and to what result?
- What kind of displays are you using?
Have you already tried tinkering with the browser block settings with your fleet/app?
I can’t tell if you’re in investigation mode or if you’ve already prototyped and have results to share. Curious how the displays are scaling stock browser block content natively. Looking forward to more information.
Here are answers to your questions:
- We’ve been testing on balenaOS 2.98.11.
- We are using raspberry pi 4 only.
- Yes, we have tried the browser block on 1080p and 720p displays and things work great there. The problem occurs when we connect to a 4k display. We haven’t had any luck getting reasonable performance for our app at 4k resolution which is why we want to max the res at 1080 and let the display upscale.
- We can’t constrain our app to any displays, it needs to work with pretty much anything. Our app is a digital signage player that customers can connect to whatever display they have.
We have tinkered with lots of stuff and done quite a bit of investigation into getting good 4k performance and for now have just determined that’s not going to be possible in the short term so we need a fall back of forcing 1080p resolution (which is the max resolution of our previous solution so works for us for now).
Thanks for reporting back. Now that I think about it, there are a few paid customers working on similar situations. Their workarounds are also similar (for now): forcing 1080p and letting the displays autoscale. You’re right in that it’s not ideal if you have a 4K display in the mix and want to dynamically set the resolution to that.
I’ll keep an eye on what’s going on in those paid tickets and once we have a generic solution or recommendation I’ll report back in here.
If you come across a breakthrough, please let us know, too!
At a previous company, I also worked on a digital signage product that worked on the Raspberry Pi 4. What we ended up doing was getting a list of the supported modes using
xrandr (only applicable if you’re using X11), then picking the highest resolution under a certain threshold we felt performed reasonably.
This was done at runtime, if that wasn’t clear.
I just wanted to check in with you on this thread. Did you have any additional questions based on the suggestion Joseph provided? Were you able to get the resolution showing correctly on various displays?