mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-11-24 20:48:55 +00:00
083dcf75f4
BUG=None TEST=tools/fmt --nightly Change-Id: Ifb08dd55ccf2a74ef739d7517a64970d24a82405 Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4375640 Auto-Submit: Daniel Verkamp <dverkamp@chromium.org> Reviewed-by: Dennis Kempin <denniskempin@google.com> Commit-Queue: Dennis Kempin <denniskempin@google.com> Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
42 lines
1 KiB
Rust
42 lines
1 KiB
Rust
// Copyright 2019 The ChromiumOS Authors
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
use std::process::exit;
|
|
|
|
#[cfg(unix)]
|
|
mod platform {
|
|
use anyhow::Context;
|
|
use anyhow::Result;
|
|
use gpu_display::*;
|
|
|
|
pub fn run() -> Result<()> {
|
|
let mut disp = GpuDisplay::open_wayland(None::<&str>).context("open_wayland")?;
|
|
let surface_id = disp
|
|
.create_surface(None, 1280, 1024, SurfaceType::Scanout)
|
|
.context("create_surface")?;
|
|
disp.flip(surface_id);
|
|
disp.commit(surface_id).context("commit")?;
|
|
while !disp.close_requested(surface_id) {
|
|
disp.dispatch_events().context("dispatch_events")?;
|
|
}
|
|
Ok(())
|
|
}
|
|
}
|
|
|
|
#[cfg(not(unix))]
|
|
mod platform {
|
|
use anyhow::anyhow;
|
|
use anyhow::Result;
|
|
|
|
pub fn run() -> Result<()> {
|
|
Err(anyhow!("Only supported on unix targets"))
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
if let Err(e) = platform::run() {
|
|
eprintln!("error: {:#}", e);
|
|
exit(1);
|
|
}
|
|
}
|