chore: cargo update

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
Marc-André Lureau 2024-12-03 16:00:44 +04:00
parent 1927fffb21
commit 56378e14b0
4 changed files with 622 additions and 355 deletions

956
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -26,7 +26,7 @@ usbredirhost = "0.2"
async-broadcast = "0.7" async-broadcast = "0.7"
async-trait = "0.1" async-trait = "0.1"
async-lock = "3.4" async-lock = "3.4"
qapi = { version = "0.14", features = ["qmp"], optional = true } qapi = { version = "0.15", features = ["qmp"], optional = true }
base64 = { version = "0.22", optional = true } base64 = { version = "0.22", optional = true }
memmap2 = "0.9.5" memmap2 = "0.9.5"

View File

@ -13,7 +13,7 @@ vnc = "0.4.0"
clap = { version = "4.5", features = ["derive"] } clap = { version = "4.5", features = ["derive"] }
zbus.workspace = true zbus.workspace = true
libc = "0.2.155" libc = "0.2.155"
image = "0.23" image = "0.25"
derivative = "2.2.0" derivative = "2.2.0"
async-io = "2.3" async-io = "2.3"
async-trait = "0.1.81" async-trait = "0.1.81"

View File

@ -50,7 +50,7 @@ enum Event {
} }
const PIXMAN_X8R8G8B8: u32 = 0x20020888; const PIXMAN_X8R8G8B8: u32 = 0x20020888;
type BgraImage = image::ImageBuffer<image::Bgra<u8>, Vec<u8>>; type RgbaImage = image::ImageBuffer<image::Rgba<u8>, Vec<u8>>;
#[derive(derivative::Derivative)] #[derive(derivative::Derivative)]
#[derivative(Debug)] #[derivative(Debug)]
@ -252,6 +252,7 @@ impl ConsoleListenerHandler for ConsoleListener {
} }
async fn update(&mut self, u: qemu_display::Update) { async fn update(&mut self, u: qemu_display::Update) {
dbg!(&u);
let mut inner = self.server.inner.lock().unwrap(); let mut inner = self.server.inner.lock().unwrap();
let update = image_from_vec(u.format, u.w as _, u.h as _, u.stride, u.data); let update = image_from_vec(u.format, u.w as _, u.h as _, u.stride, u.data);
if (u.x, u.y) == (0, 0) && update.dimensions() == inner.image.dimensions() { if (u.x, u.y) == (0, 0) && update.dimensions() == inner.image.dimensions() {
@ -296,7 +297,7 @@ impl ConsoleListenerHandler for ConsoleListener {
#[derive(Debug)] #[derive(Debug)]
struct ServerInner { struct ServerInner {
console: Console, console: Console,
image: BgraImage, image: RgbaImage,
tx: mpsc::Sender<Event>, tx: mpsc::Sender<Event>,
} }
@ -311,7 +312,7 @@ impl Server {
async fn new(vm_name: String, console: Console) -> Result<Self, Box<dyn Error>> { async fn new(vm_name: String, console: Console) -> Result<Self, Box<dyn Error>> {
let width = console.width().await?; let width = console.width().await?;
let height = console.height().await?; let height = console.height().await?;
let image = BgraImage::new(width as _, height as _); let image = RgbaImage::new(width as _, height as _);
let (tx, rx) = mpsc::channel(); let (tx, rx) = mpsc::channel();
Ok(Self { Ok(Self {
vm_name, vm_name,
@ -442,7 +443,7 @@ pub fn pixman_xrgb() -> PixelFormat {
} }
} }
fn image_from_vec(format: u32, width: u32, height: u32, stride: u32, data: Vec<u8>) -> BgraImage { fn image_from_vec(format: u32, width: u32, height: u32, stride: u32, data: Vec<u8>) -> RgbaImage {
if format != PIXMAN_X8R8G8B8 { if format != PIXMAN_X8R8G8B8 {
todo!("unhandled pixman format: {}", format) todo!("unhandled pixman format: {}", format)
} }
@ -463,11 +464,11 @@ fn image_from_vec(format: u32, width: u32, height: u32, stride: u32, data: Vec<u
color_hint: None, color_hint: None,
}; };
samples samples
.try_into_buffer::<image::Bgra<u8>>() .try_into_buffer::<image::Rgba<u8>>()
.or_else::<&str, _>(|(err, samples)| { .or_else::<&str, _>(|(err, samples)| {
eprintln!("failed to convert image: {}", err); eprintln!("failed to convert image: {}", err);
let view = samples.as_view::<image::Bgra<u8>>().unwrap(); let view = samples.as_view::<image::Rgba<u8>>().unwrap();
let mut img = BgraImage::new(width, height); let mut img = RgbaImage::new(width, height);
img.copy_from(&view, 0, 0).unwrap(); img.copy_from(&view, 0, 0).unwrap();
Ok(img) Ok(img)
}) })
@ -479,7 +480,7 @@ async fn run() -> Result<(), Box<dyn Error>> {
let listener = TcpListener::bind::<std::net::SocketAddr>(args.address.into()).unwrap(); let listener = TcpListener::bind::<std::net::SocketAddr>(args.address.into()).unwrap();
let dbus = if let Some(addr) = args.dbus_address { let dbus = if let Some(addr) = args.dbus_address {
zbus::ConnectionBuilder::address(addr.borrow())? zbus::connection::Builder::address(addr.borrow())?
.build() .build()
.await .await
} else { } else {