perf(display): present copies window rows as-is (scanout R8G8B8X8 = window byte order, Host hands out row bytes, Framebuffer::write_rgba_row); Window copy_from/copy_to one fenced memcpy; full present ~65ms -> ~3ms
This commit is contained in:
@@ -21,6 +21,21 @@ pub trait Framebuffer {
|
||||
}
|
||||
}
|
||||
|
||||
/// A run of a window's pixels from (x, y) rightwards, each the bytes
|
||||
/// R, G, B, A (see `types::display::window::BUFFER`).
|
||||
fn write_rgba_row(&mut self, x: ScreenCoord, y: ScreenCoord, bytes: &[u8]) {
|
||||
let mut run = [Color::from_raw(0); 64];
|
||||
let mut at = x;
|
||||
for chunk in bytes.chunks(4 * run.len()) {
|
||||
let n = chunk.len() / 4;
|
||||
for (c, px) in run.iter_mut().zip(chunk.as_chunks::<4>().0) {
|
||||
*c = Color::from_rgba(*px);
|
||||
}
|
||||
self.write_row(at, y, &run[..n]);
|
||||
at = ScreenCoord::new(at.raw().saturating_add(n as u16));
|
||||
}
|
||||
}
|
||||
|
||||
/// Moves the band of rows from `top`, `height` tall, up by `by` rows,
|
||||
/// and fills the `by` rows left at its bottom with `fill`.
|
||||
fn scroll_up(&mut self, top: ScreenCoord, height: Dimension, by: Dimension, fill: Color);
|
||||
|
||||
Reference in New Issue
Block a user