crosvm/gpu_display/examples/simple.rs
Gurchetan Singh 41daa354c7 gpu_display: refactor event loop
There is a desire for Wayland and possibly other display backends to
reasonably handle input.  Move the event device logic inside the X11
backend up to the common layer to prevent duplication.

The common layer also keeps track of surfaces and external memory
objects to make this easier.  The GpuDisplaySurface/GpuDisplayMemory
traits are  introduced in case the common layer needs to perform
compositor specific operation.

BUG=b:173630595
TEST=compile and run with X11

Change-Id: Ied060a7cc216ac6c084030aad1fc839c022a3395
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2852523
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
2021-06-08 22:07:17 +00:00

15 lines
499 B
Rust

// Copyright 2019 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use gpu_display::*;
fn main() {
let mut disp = GpuDisplay::open_wayland(None::<&str>).unwrap();
let surface_id = disp.create_surface(None, 1280, 1024).unwrap();
disp.flip(surface_id);
disp.commit(surface_id).unwrap();
while !disp.close_requested(surface_id) {
disp.dispatch_events().unwrap();
}
}