Commit graph

10340 commits

Author SHA1 Message Date
bunnie
91530a16e7 Merge branch 'main' into vault 2022-06-20 14:16:33 +08:00
bunnie
8bf36f98a4 partial progress on #168
at least we're off a fork and back onto the main repo.
2022-06-20 14:15:53 +08:00
nworbnhoj
0f971fcc33 implement 3xU8 RGB to U8 Greyscale adapter iterator 2022-06-20 08:03:03 +10:00
bunnie
8544961cb1 fix backspace during dynamic list updates 2022-06-20 04:10:34 +08:00
bunnie
b310967cf2 strip out excess redraws 2022-06-20 03:09:24 +08:00
bunnie
5f4678ca6a fix concurrency issue in predictor/redraw loop
So there's a bit of a nasty bug that arises from the GAM
both handling drawing primitives and context swaps.

In particular, because the GAM handles both of these in a
single thread, context swaps can't block, because the redraws
triggered by the context swap would be blocked, causing a deadlock.

When the API token for the predictor was introduced, this added
a blocking operation inside the context swap. This would cause
a deadlock under certain conditions.

This patch refactors the API token so that it's not a return
result of swapping the predictors. Instead, the predictors
return the API token as a non-blocking message to the GAM. This
API token is correlated with the *GAM* token (not the app token).
Present me thanks past me for adding the GAM token, which was
as of yet unused, but now, there is a very sensible role for it--
exactly what it was made for, e.g. handling GAM-local API calls
without disclosing the application token.

Anyways, hopefully this patch puts the race condition to
rest, while allowing us to have per-context prediction histories.
2022-06-20 03:05:16 +08: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
5a72076768 add dynamic search as text is typed 2022-06-19 19:04:25 +08:00
bunnie
72e6be8679 add some initial selectable list framework 2022-06-19 17:33:26 +08:00
bunnie
b945a085b0 more prototyping of the list browser UI 2022-06-19 03:17:12 +08:00
bunnie
2d40c3f1dc fix xtask rebuild issue
the inclusion of a custom rustflags in the .cargo/config
causes rust-analyzer in vscode to always trigger a rebuild of
xtask.

add a custom "check" directory for vscode. This grows the
size of the target directory :( but at least we're not
constantly rebuilding xtask.
2022-06-19 02:53:37 +08:00
bunnie
6c28ee9642 strip some debug messages 2022-06-19 02:04:08 +08:00
bunnie
9acab60018 strip out some debug statements 2022-06-19 01:56:58 +08:00
bunnie
770f7e1f53 add tracking allocator
has to be instrumented on functions of interest, but there is one
e.g. in shellchat now for tracking allocations to display a PNG.
2022-06-19 01:55:16 +08:00
bunnie
b7453b627e add API tokens to prediction API
The prediction API now takes an API token. This is a 128-bit
number that gets passed to the prediction engine, and it's meant
to be unique for every context that requires a predictor.

It's up to the prediction engine to do anything with the token.
For the "null" engines (such as the icontray for `vault` and
`tts`) the token is just ignored. But for example, in `shellchat`,
the API token is used to store a history record in a HashMap on
a per-token basis. This means that every app that uses the
`shellchat` history function gets their own history that can only
be read out by that app.

The actual token itself is mostly passed through the API. The
token storage is in the Context layer (each Context has a record
for a token, that starts as `None`), and is passed down to
the predictor every time the context swaps, and the predictor
receives the token and passes it back if the token was `Some`,
or allocates a new random token if it was `None`.

Note that everything is a Context, including, for example, menus and
modal dialog boxes, but not all contexts have predictors. Only
Contexts that ask for a predictor have them. This mechanism
works smoothly in this model (as opposed to other hacks and work-arounds
previously tried getting to this solution).
2022-06-19 01:01:25 +08:00
bunnie
14e22d07b9 allow management token returns on servers with more than one connection
Mangement tokens were added to xous-names for the special case of
servers that had exactly 1 connection, so they could explicitly
control when they are disconnected (preventing e.g. griefing by
rogue processes).

This was a good idea except it also conflicts with the "eager TOFU"
model of Xous security when you have servers that act as plugins to
each other. Eager TOFU means Xous has a "trust on first use" model
for capabilities, and eager implies that anyone who will use
anything will claim it early on. This gives the important property
that one can ask, "has everyone eaten their TOFU?" before doing
anything really sensitive. If all the TOFU slots are used, then
you can conclude that no new rogue servers can inject themselves
into sensitive APIs and you can move forward.

In the case of a plugin API with multiple plug options, when
you unplug something, the previously eagerly occupied slot
now becomes unoccopied -- and this becomes a flag against
the TOFU check, disallowing sensitive operations to proceed.

This is *particularly* a problem with the predictive history
plugins for the IME. The architecture was created to allow
for multiple histories to be used. Up until now, only the shellchat
plugin was ever used, so, the eager TOFU check always passed.

However, in creating more applications, this flaw was uncovered
once we introduced a second plugin.

This means predictors can not delegate their security to Xous-names.
They must individually implement API tokens to control access
to the prediction history (to prevent rogue apps from e.g. connecting
to the predictor and then reading out the prediction history to
figure out what the most recent words were typed).

A subsequent commit will add the API tokens, but this commit simply
has xous-names return a mangament token even if servers with
more than 1 connection are created. The main downside of doing
this is the management token lose meaning in the context of
multiple servers; but, so long as the tokens aren't used for
anything in those situations, it's fine (cue burning building
meme).

More importantly, it allows the existing code to manage the xous-names
count to function even on a server that sets no explicit limit
on connection count, which is now going to be the case for the
prediction engines going forward.
2022-06-19 00:51:02 +08:00
nworbnhoj
b346099ebc Merge branch 'main' of github.com:nworbnhoj/xous-core into main 2022-06-18 21:02:50 +10:00
nworbnhoj
5c48439a66 reduce memory footprint of Dither::dither() 2022-06-18 21:02:21 +10:00
bunnie
9bc9811472 modify the bloat message to help enforce some discipline on binary size 2022-06-18 15:19:48 +08:00
bunnie
7cf8ec0e69 Merge branch 'main' into vault 2022-06-18 14:22:54 +08:00
bunnie
e504e9b89c attempt to limit memory size used by PNG decoder
still getting a heap allocation failure, something is
looking for 256k and even when the heap is increased
to a couple megabytes we get heap allocation failures.
2022-06-18 14:21:56 +08:00
bunnie
fdcadf35dd
Merge pull request #192 from nworbnhoj/main
Image processing optimisations
2022-06-18 14:00:30 +08:00
bunnie
d874e50030 stash the latest changes 2022-06-18 13:59:26 +08:00
nworbnhoj
2dbdb10704 remove dependency on fast-image-resize crate 2022-06-18 12:07:58 +10:00
nworbnhoj
81ebb74b58 simplify clifford test image to greyscale U8 2022-06-18 09:00:36 +10:00
nworbnhoj
e9224cf4ae Merge branch 'main' of github.com:nworbnhoj/xous-core into main 2022-06-18 08:47:40 +10:00
nworbnhoj
409f696fde Implement gam::PixelType
enables gam::Img to import different image formats: U8 & U8x3 for now
2022-06-18 08:43:32 +10:00
nworbnhoj
9b8c4e063f
Merge branch 'betrusted-io:main' into main 2022-06-18 07:10:33 +10:00
nworbnhoj
f7e216bb25 convert RGB image immediately to greyscale on import
code simplification/reduction, and memory/processing saving
2022-06-18 07:07:15 +10: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
11932898ac oops, broke CI with something in *this* code
push a fix that will get CI running, but breaks this dev flow
2022-06-18 01:16:39 +08:00
bunnie
82919637d8 remove TODO (@gsora confirmed everything is OK!) 2022-06-18 00:42:50 +08:00
bunnie
9eec4436ea some comment bookkeeping and whitespace cleanup 2022-06-18 00:17:35 +08:00
bunnie
a91292509e only allow the observer of the key presses to be registered once 2022-06-18 00:15:00 +08:00
bunnie
cd8b539557 bump release notes 2022-06-18 00:08:46 +08:00
bunnie
ed555b8b7a add translations/modify wording 2022-06-18 00:02:40 +08:00
bunnie
6d2531804b
Merge pull request #191 from gsora/gsora/backlight-on-keypress
Automatic backlight on keypress
2022-06-17 23:55:44 +08:00
bunnie
2777939a15 Merge branch 'vault' into main 2022-06-17 23:52:38 +08:00
bunnie
645fcf46fd refactor file locations so the structure is more scalable 2022-06-17 23:52:04 +08:00
Gianguido Sorà
754a0d20da
Merge pull request #2 from bunnie/backlight-on-keypress
Backlight on keypress
2022-06-17 17:41:37 +02:00
bunnie
1e266b3389 adjust image modal size to match the target size for image centering 2022-06-17 22:01:07 +08:00
bunnie
d829839c28
Merge pull request #190 from nworbnhoj/main
fix gam::Tile render RHS
2022-06-17 21:40:28 +08:00
bunnie
e5b4f4ad7f clean up a minor warning for a merge to main
let's put these GAM changes into production so others can use
them, even though the app is still coming together.
2022-06-17 21:38:45 +08:00
bunnie
f77324a4e5 add some test text 2022-06-17 21:37:39 +08:00
nworbnhoj
d75c333888 remove unnecessary Tile clone 2022-06-17 23:22:29 +10:00
nworbnhoj
d33d7958f2 Merge branch 'main' of github.com:nworbnhoj/xous-core into main 2022-06-17 23:08:37 +10:00
nworbnhoj
148e0fdd99 remove unnecessary Img clone 2022-06-17 23:06:39 +10: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