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

ui: display: display a background image on all screens #35

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

hnez
Copy link
Member

@hnez hnez commented Aug 31, 2023

The LXA TAC display looks quite boring due to the tacd only displaying black and white text.
As a first step to fixing that we can display a background image behind all screens.

lcd

The background image is included in the tacd binary as uncompressed bitmap. This has a couple of benefits but also some drawbacks:

  • 👍 Loading the background can never fail
  • 👍 The background is available instantly
  • 👍 We do not have to keep the decompressed background in RAM, as it is backed by the binary file.
  • 👎 The tacd binary size increases by 240 * 240 * 3 = 172800 bytes
  • 👎 The build.rs becomes more complex

TODO:

  • Test on real hardware and make sure readability stays okay

hnez added 2 commits August 31, 2023 16:00
While the display itself is 16bpp the emulated framebuffer device is not.
Make sure the demo_mode and png-ification code match this expectation.

Signed-off-by: Leonard Göhrs <[email protected]>
This makes the screen a bit less boring while still requiring minimal
implementation effort.

The background image is included in the tacd binary as uncompressed bitmap.
This has a couple of benefits and drawbacks:

 + Loading the background can never fail
 + The background is available instantly
 + We do not have to keep the decompressed background in RAM,
   as it is backed by the binary file.
 - The tacd binary size increases by 240 * 240 * 3 = 172800 bytes
 - The build.rs becomes more complex

Signed-off-by: Leonard Göhrs <[email protected]>
@Emantor
Copy link
Member

Emantor commented Sep 25, 2023

I'd favor a solution where we don't embed the image inside the binary. This takes >100KiB of space, while we don't gain any system memory since the decoded picture needs to be available for framebuffer display anyway. I'd rather ship an asset and decode the picture during startup.

let xres = fb.var_screen_info.xres;
let yres = fb.var_screen_info.yres;
let res = (xres as usize) * (yres as usize);
assert!(fb.var_screen_info.bits_per_pixel == 32);
Copy link
Member

Choose a reason for hiding this comment

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

Instead of a potential panic please return an appropriate error in this case.

@@ -144,7 +153,7 @@ impl DrawTarget for DisplayExclusive {
where
I: IntoIterator<Item = Pixel<Self::Color>>,
{
let bpp = self.0.var_screen_info.bits_per_pixel / 8;
assert!(self.0.var_screen_info.bits_per_pixel == 32);
Copy link
Member

Choose a reason for hiding this comment

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

Instead of a potential panic please return an appropriate error in this case.

@hnez hnez marked this pull request as draft September 27, 2023 12:27
@hnez
Copy link
Member Author

hnez commented Sep 27, 2023

I've coverted the PR back to a draft because (in addition to the technical discussion above) not everyone liked the way the backgrounds look on screen, as they can make text harder to read.

@hnez hnez self-assigned this Nov 23, 2023
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.

3 participants