diff options
author | Noah Gold <nkgold@google.com> | 2020-02-01 13:01:58 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-03-06 01:00:39 +0000 |
commit | dc7f52bdb76a8f3b3cf6260bc0d861758956991e (patch) | |
tree | abde34b5dc09609981c695f5de5772fe2661358a /src/linux.rs | |
parent | d2a862b41f07d387926f0b984c56dc838003102c (diff) | |
download | crosvm-dc7f52bdb76a8f3b3cf6260bc0d861758956991e.tar crosvm-dc7f52bdb76a8f3b3cf6260bc0d861758956991e.tar.gz crosvm-dc7f52bdb76a8f3b3cf6260bc0d861758956991e.tar.bz2 crosvm-dc7f52bdb76a8f3b3cf6260bc0d861758956991e.tar.lz crosvm-dc7f52bdb76a8f3b3cf6260bc0d861758956991e.tar.xz crosvm-dc7f52bdb76a8f3b3cf6260bc0d861758956991e.tar.zst crosvm-dc7f52bdb76a8f3b3cf6260bc0d861758956991e.zip |
Use simple virtio_input_events where possible.
Previously, all input events in CrosVM were required to be linux input_events, which have a timestamp field that is actually unused by when we send/receive from the guest which are of type virtio_input_event. This CL allows CrosVM to understand both types of input events in a first class manner. It is a follow up on https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1930405. This CL also addresses some bugs with window driven input: 1. attach_event_device was being called before the surface was created, so the devices were never attached. 2. The default touchpad size was not being set to the display window size. Additionally, it removes the unused event "filter" feature on event sources. Breaking change: from this point forward, CrosVM will treat input events sent via a socket (e.g. SocketEventSource) to be virtio_input_events. BUG=None TEST=builds + manual Change-Id: I7fec07c582e5a071a6f116975ba70d6e621bb483 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2034046 Reviewed-by: Zach Reizner <zachr@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Noah Gold <nkgold@google.com>
Diffstat (limited to 'src/linux.rs')
-rw-r--r-- | src/linux.rs | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/linux.rs b/src/linux.rs index 97f691f..10f96b8 100644 --- a/src/linux.rs +++ b/src/linux.rs @@ -63,10 +63,6 @@ use vm_control::{ }; use crate::{Config, DiskOption, Executable, SharedDir, SharedDirKind, TouchDeviceOption}; - -#[cfg(feature = "gpu")] -use crate::{DEFAULT_TOUCH_DEVICE_HEIGHT, DEFAULT_TOUCH_DEVICE_WIDTH}; - use arch::{self, LinuxArch, RunnableLinuxVm, VirtioDeviceStub, VmComponents, VmImage}; #[cfg(any(target_arch = "arm", target_arch = "aarch64"))] @@ -1048,19 +1044,16 @@ fn create_virtio_devices( #[cfg(feature = "gpu")] { - if cfg.gpu_parameters.is_some() { + if let Some(gpu_parameters) = &cfg.gpu_parameters { let mut event_devices = Vec::new(); if cfg.display_window_mouse { let (event_device_socket, virtio_dev_socket) = UnixStream::pair().map_err(Error::CreateSocket)?; - // TODO(nkgold): the width/height here should match the display's height/width. When - // those settings are available as CLI options, we should use the CLI options here - // as well. let (single_touch_width, single_touch_height) = cfg .virtio_single_touch .as_ref() .map(|single_touch_spec| single_touch_spec.get_size()) - .unwrap_or((DEFAULT_TOUCH_DEVICE_WIDTH, DEFAULT_TOUCH_DEVICE_HEIGHT)); + .unwrap_or((gpu_parameters.display_width, gpu_parameters.display_height)); let dev = virtio::new_single_touch( virtio_dev_socket, single_touch_width, |