graphics/fbcond: Use the v2 graphics api
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use graphics_ipc::v1::{Damage, V1GraphicsHandle};
|
||||
use graphics_ipc::v2::{Damage, V2GraphicsHandle};
|
||||
use inputd::ConsumerHandle;
|
||||
use std::io;
|
||||
|
||||
@@ -8,8 +8,9 @@ pub struct Display {
|
||||
}
|
||||
|
||||
pub struct DisplayMap {
|
||||
display_handle: V1GraphicsHandle,
|
||||
pub inner: graphics_ipc::v1::DisplayMap,
|
||||
display_handle: V2GraphicsHandle,
|
||||
fb: usize,
|
||||
pub inner: graphics_ipc::v2::DisplayMap,
|
||||
}
|
||||
|
||||
impl Display {
|
||||
@@ -26,12 +27,17 @@ impl Display {
|
||||
|
||||
/// Re-open the display after a handoff.
|
||||
pub fn reopen_for_handoff(&mut self) {
|
||||
let display_file = self.input_handle.open_display().unwrap();
|
||||
let new_display_handle = V1GraphicsHandle::from_file(display_file).unwrap();
|
||||
let display_file = self.input_handle.open_display_v2().unwrap();
|
||||
let new_display_handle = V2GraphicsHandle::from_file(display_file).unwrap();
|
||||
|
||||
eprintln!("fbcond: Opened new display");
|
||||
|
||||
match new_display_handle.map_display() {
|
||||
let (width, height) = new_display_handle.display_size(0).unwrap();
|
||||
let fb = new_display_handle
|
||||
.create_dumb_framebuffer(width, height)
|
||||
.unwrap();
|
||||
|
||||
match new_display_handle.map_dumb_framebuffer(fb, width, height) {
|
||||
Ok(map) => {
|
||||
eprintln!(
|
||||
"fbcond: Mapped new display with size {}x{}",
|
||||
@@ -41,6 +47,7 @@ impl Display {
|
||||
|
||||
self.map = Some(DisplayMap {
|
||||
display_handle: new_display_handle,
|
||||
fb,
|
||||
inner: map,
|
||||
});
|
||||
}
|
||||
@@ -50,9 +57,9 @@ impl Display {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn sync_rect(&mut self, sync_rect: Damage) {
|
||||
pub fn sync_rect(&mut self, damage: Damage) {
|
||||
if let Some(map) = &self.map {
|
||||
map.display_handle.sync_rect(sync_rect).unwrap();
|
||||
map.display_handle.update_plane(0, map.fb, damage).unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user