Commit graph

215 commits

Author SHA1 Message Date
bunnie
8d8dd2bd2f fix typo in unwrap message 2022-12-11 16:41:25 +08:00
bunnie
e240ca6499 refactor the hardware boot screen
- remove a blanking operation. this makes the transision from
loader to runtime almost imperceptably smoother
- add the ability to summon the logo screen earlier in the process

Note that only GAM can call GFX, so, it's alright to expose that
API, since GAM should gate-keep and prevent abuse of that function.
2022-11-06 03:10:00 +08:00
bunnie
30ea893c74
Merge branch 'main' into xous-rs-os-selection 2022-10-25 17:28:33 +08:00
bunnie
67fc21fbdd harmonize hosted mode selection, but retain an explicit hosted flag
In general, hosted mode is assumed "by default" if the target
is not Xous. This allows packages to be built cleanly on command
lines that don't know to pass a --feature flag to specify a target.

However, an explicit "hosted" flag is still retained so that we
can confirm the build system intent. This saves us from the failure
mode that we thought we were building for target A, but accidentally
ommitted the flag, and instead we've been silently building for
"hosted" mode without any warning. The main consumer of the "hosted"
flag is now just the build.rs script inside of the utralib.
2022-10-25 17:21:02 +08:00
bunnie
359da58cd2 rename "testing" flag to gfx-testing so as to avoid namespace collision 2022-10-24 00:36:30 +08:00
Gianguido Sorà
8eab76de33 fix: make hosted mode work on macos again
When ditherpunk flag is enabled, graphics-server cannot start.
I suspect macOS doesn't tranfer thread-local variables when a new one
is spawned, and this makes xous-names, logs crash.

This commit adds a compile setting that will bypass ditherpunk thread
settings on macOS as well, allowing developers who happen to run this OS
to develop and prototype for betrusted again.
2022-10-19 14:20:12 +02:00
Jean-Pierre De Jesus DIAZ
136aec042b
services/graphics-server: Implement From instead of Into
Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
2022-10-12 15:38:40 +02:00
bunnie
4e40ae6c5d move from target selectors to feature selectors for back-ends
This will allow for e.g. xous on riscv32-imac but not a precursor
target, for example: by using feature selectors we get to have
a bigger range of targets that we support, such as for implementations
that haven't been upstreamed or have official target-triples.

The downsides are:

- patch override libraries don't absorb feature flags. so, for
example, the AES crate that is used to patch other crates won't
be aware of the target features without modifying the referencing
crates.

- features are normally meant to be additive, but target features
are mutually exclusive. The mutex is enforced by a check in
utralib that throws a panic on build if two targets are accidentally
selected at the same time.
2022-10-02 02:56:44 +08:00
bunnie
7248f47ca8 fix self-signing to reflect extra data for semvers
the loader is a little funky, and requires some maintainer hand-holding
due to the split of the page ownership between the root-keys
crate and the graphics-server crate.

Improved docs so I don't forget this detail in the future.
2022-07-11 16:11:32 +08:00
bunnie
148bf71a94 modify the fb pop routine so it doesn't overwrite the status bar
this eliminates a small glitch in the time display/security infos
whenever transitioning between foreground/background contexts
2022-07-05 03:24:15 +08:00
bunnie
147ec8594c add stash/pop of FB; fix suspend/resume buffering
The `ManagedMem` thing for the suspend/resume crate is simply
a disaster. It tries to be fancy and Rusty and really it just fails
in non-obvious ways. This is one of the places where it simply
does not pay to make things seem so simple.

Why? because in reality, memory is complicated. It comes in pages.
There's initialization. There's caching. There's volatility.
I haven't encountered a single situation where the assumptions
of page-alignment and memory layout have really lined up well enough
for this primitive to make sense. The "idea" was hey, since
you allocate a peripheral MemoryRegion, why not just use its attributes
as a marker to a suspend/resume thing that automatically handled
stashing that MemoryRegion to a backing store inside RAM? Seems
simple right? wrong. Every time I've tried to use it, it's failed
in non-obvious ways.

In this most recent incarnation, it turns out that for whatever
reason, it seems to be just stashing about the first 4-8k of the
framebuffer to the SR backup region, and then somehow grabbing
a future(?) copy of the memory? or maybe just a wrong copy? I don't
know. The code seems simple enough but it goes through some
traits and some type transformations and then there's some unsafe
code to make it volatile and it doesn't work.

Instead, we just use a damn [u32; FB_SIZE] slice to store the
frame buffer. This is so obvious and easy. The only price is
you have an "ugly" `fb[..FB_SIZE].copy_from_slice(&self.srfb)`
line instead of an "elegant" `srfb.suspend()` invocation.
Stashing into it is a bit uglier, because we have to cast the
slice to an unsafe pointer in order to access the `write_volatile()`
method. But, it works! It. Just. Works. And you can see what's going
on. Really, I should stop trying to be fancy and just be readable.

OK anyways, that was that rant. This commit also adds some
calls that allow us to re-use the suspend/resume frame buffer during
"normal" times as a stash/pop for the application image. This is
nice because the memory is normally idle/overhead when not
in suspend, so now we're repurposing some already-allocated memory
to accelerate some drawing operations, and it also makes, crucially,
a multi-step blocking modal dialog interaction less cosmetically
jarring, because the application thread can be fully blocked and
not responding to redraw commands but the stash/pop mechanism
creates the illusion of "everything is moving along".
2022-07-05 02:44:13 +08:00
nworbnhoj
e7d5c11cbc
Merge branch 'main' into iter 2022-06-29 10:54:06 +10:00
nworbnhoj
29925a5caa implement Dither adaptor iterator 2022-06-28 07:31:18 +10:00
bunnie
78ea80f809 remove main() thread-wrapping for non-ditherpunk configs
saves a bit of memory
2022-06-19 21:39:29 +08:00
bunnie
c46579117b add the "trusted init" check to hosted mode
need to debug a problem with the IMEF connecting/disconnecting
causing trusted init to fail when there is more than one
plugin in the system.
2022-06-18 01:30:49 +08:00
bunnie
d829839c28
Merge pull request #190 from nworbnhoj/main
fix gam::Tile render RHS
2022-06-17 21:40:28 +08:00
nworbnhoj
346847104a
Merge branch 'betrusted-io:main' into main 2022-06-17 21:17:52 +10:00
nworbnhoj
39815cc596 fix gam::Tile render RHS 2022-06-17 21:16:25 +10:00
bunnie
7eac66b373 add centered text layout modes
top-aligned has been tested. bottom aligned has yet to be tested.
2022-06-17 19:15:02 +08:00
bunnie
cf89ebe5f5 add wrapper around main functions that need bigger stacks
This allows for `ditherpunk` config to have a much larger
stack size on select processes only.

The cost comes at a 4k fixed overhead for the sacrificial
wrapper thread, so we lose about 20k of runtime RAM, even
when ditherpunk is *not* activated (because we're
always wrapping the threads).

There is no impact on scheduling or CPU utilization, as the
wrapper thread blocks and is never scheduled once the real
main starts. However, it does subtract one thread from the
total available thread pool.
2022-06-16 03:40:19 +08:00
bunnie
b31c727f81 clean up some warnings 2022-06-15 03:55:03 +08:00
bunnie
5421a20050 add some debugging info to graphics-server 2022-06-15 01:31:21 +08:00
Sean Cross
d342d7a885 apps/services: remove xous::xous_main macro usage
This macro will be removed, since it is no longer necessary. Remove this
macro across the project and replace it with a standard `main()`
function.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-06-01 11:54:24 +10:00
bunnie
116015dff8 fixups and debug 2022-05-27 22:45:23 +08:00
bunnie
a8e7809087 fixup feature fest 2022-05-27 17:41:22 +08:00
bunnie
7d020182d4 integrate ditherpunk as a feature 2022-05-27 17:28:15 +08:00
nworbnhoj
345659be44 replace cast with try_into in graphics-server api shapes 2022-05-22 10:30:05 +10:00
nworbnhoj
7f66291a38 implement Image modal
Now you can:
let mut input = std::env::current_dir().unwrap();
input.push("../services/modals/src/tests/bunny.png");
let img = Img::<RGB<u8>>::load(&input).unwrap();
modals.show_image(img).expect("image failed");
2022-05-21 06:42:27 +10:00
nworbnhoj
61d6a4b853 implement graphics-server Tile 2022-05-18 18:27:30 +10:00
bunnie
5d2c65cb6c fix missing update to display in panic handler 2022-04-10 16:57:04 +08:00
bunnie
46624addd0 clean up comments and review panic handler before push 2022-04-10 15:52:57 +08:00
bunnie
9254d6830a your host desires not your guru meditations
ommmmmmmmm
2022-04-10 04:47:34 +08:00
bunnie
7353c3ab9c add guru meditations 2022-04-10 04:42:02 +08:00
bunnie
c503316c3d refactor suspend/resume ordering
Add a "Later" stage, and have exactly one "Last" stage.

"Last" to suspend is the ticktimer -- this is crucial for
basically everything else to work. The other really
low level stuff that needs to work to the last minute is
now in the "Later" bin.
2022-03-30 02:30:39 +08:00
bunnie
04d074de1b fix hosted mode build 2022-03-29 22:55:27 +08:00
bunnie
1455ea6d8b clean up the suspend/resume path for the screen and enforce redraw 2022-03-29 22:50:25 +08:00
Alex Tibbles
f6030fe213
build fix for 5452fae33c 2022-03-28 17:01:25 -04:00
bunnie
5452fae33c harmonize blitstr2 and graphics-server to an i16 pixel representation
previously blitstr2 is using usize for x/y coords, which means that
for layout purposes points could not go to the top or left boundary
without causing arithmetic overflow. Of course, you want to render
everything on-screen, but, as we have multi-line text with overflow
possibility, it's reasonable to be able to use negative coordinates
to locate text boxes that flow into the visible region.

This of course means that occassionally you can come out with
things like "negative widths", but even then, there can be reasonable
uses for this as an intermediate in calculations that ultimately
arrive at a positive result.
2022-03-28 23:17:18 +08:00
Blake Smith
77b5e7a2bb During sleep, clear the rest of the screen, to avoid
any secrets being persistently visible on the display.
2022-03-20 15:35:02 -05:00
bunnie
c44f794dfe baseline before moving onto the next stage 2022-03-11 00:03:31 +08:00
bunnie
2b33371a36 add emoji back into the tts set
this is helpful for debugging
2022-03-10 18:08:56 +08:00
bunnie
21ad8d9283 change en-audio to en-tts 2022-03-10 15:38:55 +08:00
bunnie
4df39797c1 fix issue #101 based on @xobs changes 2022-02-15 17:36:53 +08:00
bunnie
32c3f03609 prevent double-injections on windows 2022-02-10 03:04:05 +08:00
bunnie
feec219070 fix bs/del/enter on posix platforms 2022-02-10 02:59:47 +08:00
bunnie
fd5c6568d1 trim out some excess redraw calls that are slowing down boot 2022-02-05 18:55:46 +08:00
bunnie
a7c9027d05 make the COM reset no longer open loop; unblock as soon as EC responds 2022-02-05 15:44:47 +08:00
bunnie
827888ccbb fix up the REFCOUNT on connections
Was doing disjoint loads and stores on an Atomic, really, should
be using the fetch_add, fetch_sub variants to be proper.

Didn't seem to impact anything but maybe there's a future version
of me that high fives me for doing this.
2022-01-31 23:13:10 +08:00
bunnie
2db96e17b0 modify minifb integration to use host keymaps for most printable characters
this allows e.g. dvorak key maps to work while still picking up
all of the special keys that don't correspond to to any unicode
characters
2022-01-25 23:03:57 +08:00
bunnie
8e13d6bcdf add drawlists to the GAM and gfx abstractions
this helps to prevent race conditions and improves performance
2022-01-24 16:33:01 +08:00