mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-16 08:38:26 +00:00
Merge pull request #885 from betrusted-io/dry-run
add dry-run api to gfx
This commit is contained in:
commit
8dd5e5ec00
3 changed files with 36 additions and 6 deletions
|
|
@ -117,6 +117,10 @@ pub enum GfxOpcode {
|
||||||
Brightness,
|
Brightness,
|
||||||
#[cfg(feature = "board-baosec")]
|
#[cfg(feature = "board-baosec")]
|
||||||
FlipScreen,
|
FlipScreen,
|
||||||
|
/// This is used to toggle DryRun mode. The purpose of this mode is to
|
||||||
|
/// warm up UI routines from swap memory to improve UI latency.
|
||||||
|
#[cfg(feature = "board-baosec")]
|
||||||
|
DryRun,
|
||||||
|
|
||||||
/// Gutter for invalid calls
|
/// Gutter for invalid calls
|
||||||
InvalidCall,
|
InvalidCall,
|
||||||
|
|
|
||||||
|
|
@ -848,6 +848,21 @@ impl Gfx {
|
||||||
.map(|_| ())
|
.map(|_| ())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "board-baosec")]
|
||||||
|
pub fn dry_run(&self, dry_run: bool) -> Result<(), xous::Error> {
|
||||||
|
send_message(
|
||||||
|
self.conn,
|
||||||
|
Message::new_blocking_scalar(
|
||||||
|
GfxOpcode::DryRun.to_usize().unwrap(),
|
||||||
|
if dry_run { 1 } else { 0 },
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.map(|_| ())
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(feature = "hosted-baosec")]
|
#[cfg(feature = "hosted-baosec")]
|
||||||
pub fn acquire_qr(&self) -> Result<QrAcquisition, xous::Error> {
|
pub fn acquire_qr(&self) -> Result<QrAcquisition, xous::Error> {
|
||||||
let dummy = "otpauth://totp/ACME%20Co:john.doe@email.com?secret=HXDMVJECJJWSRB3HWIZR4IFUGFTMXBOZ&issuer=ACME%20Co&algorithm=SHA1&digits=6&period=30".to_string();
|
let dummy = "otpauth://totp/ACME%20Co:john.doe@email.com?secret=HXDMVJECJJWSRB3HWIZR4IFUGFTMXBOZ&issuer=ACME%20Co&algorithm=SHA1&digits=6&period=30".to_string();
|
||||||
|
|
|
||||||
|
|
@ -433,6 +433,7 @@ pub fn wrapped_main(main_thread_token: MainThreadToken) -> ! {
|
||||||
let mut qr_request: Option<xous::MessageEnvelope> = None;
|
let mut qr_request: Option<xous::MessageEnvelope> = None;
|
||||||
let mut kbd_listeners: Vec<(CID, usize)> = Vec::new();
|
let mut kbd_listeners: Vec<(CID, usize)> = Vec::new();
|
||||||
let cam_started = Arc::new(AtomicBool::new(false));
|
let cam_started = Arc::new(AtomicBool::new(false));
|
||||||
|
let mut dry_run = false;
|
||||||
#[allow(unused_mut)]
|
#[allow(unused_mut)]
|
||||||
let mut orientation = DisplayOrientation::Normal;
|
let mut orientation = DisplayOrientation::Normal;
|
||||||
loop {
|
loop {
|
||||||
|
|
@ -851,9 +852,11 @@ pub fn wrapped_main(main_thread_token: MainThreadToken) -> ! {
|
||||||
GfxOpcode::Flush => {
|
GfxOpcode::Flush => {
|
||||||
if qr_request.is_none() {
|
if qr_request.is_none() {
|
||||||
log::trace!("***gfx flush*** redraw##");
|
log::trace!("***gfx flush*** redraw##");
|
||||||
display
|
if !dry_run {
|
||||||
.redraw()
|
display
|
||||||
.unwrap_or_else(|_| display_timeout_handler(&udma_global, &mut display));
|
.redraw()
|
||||||
|
.unwrap_or_else(|_| display_timeout_handler(&udma_global, &mut display));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GfxOpcode::Clear => {
|
GfxOpcode::Clear => {
|
||||||
|
|
@ -1001,12 +1004,20 @@ pub fn wrapped_main(main_thread_token: MainThreadToken) -> ! {
|
||||||
display
|
display
|
||||||
.flip_vertical(scalar.arg1 != 0)
|
.flip_vertical(scalar.arg1 != 0)
|
||||||
.unwrap_or_else(|_| display_timeout_handler(&udma_global, &mut display));
|
.unwrap_or_else(|_| display_timeout_handler(&udma_global, &mut display));
|
||||||
display
|
if !dry_run {
|
||||||
.redraw()
|
display
|
||||||
.unwrap_or_else(|_| display_timeout_handler(&udma_global, &mut display));
|
.redraw()
|
||||||
|
.unwrap_or_else(|_| display_timeout_handler(&udma_global, &mut display));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[cfg(feature = "board-baosec")]
|
||||||
|
GfxOpcode::DryRun => {
|
||||||
|
if let Some(scalar) = msg.body.scalar_message_mut() {
|
||||||
|
dry_run = scalar.arg1 != 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
GfxOpcode::Quit => {
|
GfxOpcode::Quit => {
|
||||||
log::info!("refusing to quit, this operation is not supported on this platform!");
|
log::info!("refusing to quit, this operation is not supported on this platform!");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue