diff options
author | Zach Reizner <zachr@google.com> | 2019-11-22 17:26:46 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-11-26 21:05:44 +0000 |
commit | 2b0bc61ea718f468b570676225df96a40be3164a (patch) | |
tree | 91bb68880ec3461d8f2737d15e773748cfc29d1f /gpu_display | |
parent | 6f8823abb55e2d9f65cf7abe5635c59280fcf172 (diff) | |
download | crosvm-2b0bc61ea718f468b570676225df96a40be3164a.tar crosvm-2b0bc61ea718f468b570676225df96a40be3164a.tar.gz crosvm-2b0bc61ea718f468b570676225df96a40be3164a.tar.bz2 crosvm-2b0bc61ea718f468b570676225df96a40be3164a.tar.lz crosvm-2b0bc61ea718f468b570676225df96a40be3164a.tar.xz crosvm-2b0bc61ea718f468b570676225df96a40be3164a.tar.zst crosvm-2b0bc61ea718f468b570676225df96a40be3164a.zip |
gpu_display: amend GpuDisplay to import and attach EventDevices
This change also includes stubs for the wayland and x11 impls. TEST=compiles BUG=chromium:1023975 Change-Id: Ia2bcb5c2ed75ea47071dd77e149e60901a56595c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1930407 Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-by: Stephen Barber <smbarber@chromium.org> Reviewed-by: Noah Gold <nkgold@google.com> Tested-by: Daniel Verkamp <dverkamp@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Diffstat (limited to 'gpu_display')
-rw-r--r-- | gpu_display/src/gpu_display_wl.rs | 12 | ||||
-rw-r--r-- | gpu_display/src/gpu_display_x.rs | 11 | ||||
-rw-r--r-- | gpu_display/src/lib.rs | 18 |
3 files changed, 39 insertions, 2 deletions
diff --git a/gpu_display/src/gpu_display_wl.rs b/gpu_display/src/gpu_display_wl.rs index 3e1fe92..04ddb54 100644 --- a/gpu_display/src/gpu_display_wl.rs +++ b/gpu_display/src/gpu_display_wl.rs @@ -12,7 +12,7 @@ mod dwl; use dwl::*; -use crate::{DisplayT, GpuDisplayError, GpuDisplayFramebuffer}; +use crate::{DisplayT, EventDevice, GpuDisplayError, GpuDisplayFramebuffer}; use std::cell::Cell; use std::collections::HashMap; @@ -341,6 +341,16 @@ impl DisplayT for DisplayWl { None => debug_assert!(false, "invalid surface_id {}", surface_id), } } + + fn import_event_device(&mut self, _event_device: EventDevice) -> Result<u32, GpuDisplayError> { + Err(GpuDisplayError::Unsupported) + } + fn release_event_device(&mut self, _event_device_id: u32) { + // unsupported + } + fn attach_event_device(&mut self, surface_id: u32, event_device_id: u32) { + // unsupported + } } impl AsRawFd for DisplayWl { diff --git a/gpu_display/src/gpu_display_x.rs b/gpu_display/src/gpu_display_x.rs index 837a151..1df7fc2 100644 --- a/gpu_display/src/gpu_display_x.rs +++ b/gpu_display/src/gpu_display_x.rs @@ -22,7 +22,7 @@ use std::rc::Rc; use libc::{shmat, shmctl, shmdt, shmget, IPC_CREAT, IPC_PRIVATE, IPC_RMID}; -use crate::{DisplayT, GpuDisplayError, GpuDisplayFramebuffer}; +use crate::{DisplayT, EventDevice, GpuDisplayError, GpuDisplayFramebuffer}; use data_model::VolatileSlice; @@ -638,6 +638,15 @@ impl DisplayT for DisplayX { fn set_position(&mut self, surface_id: u32, x: u32, y: u32) { // unsupported } + fn import_event_device(&mut self, _event_device: EventDevice) -> Result<u32, GpuDisplayError> { + Err(GpuDisplayError::Unsupported) + } + fn release_event_device(&mut self, _event_device_id: u32) { + // unsupported + } + fn attach_event_device(&mut self, surface_id: u32, event_device_id: u32) { + // unsupported + } } impl AsRawFd for DisplayX { diff --git a/gpu_display/src/lib.rs b/gpu_display/src/lib.rs index 5c243d6..8cc018a 100644 --- a/gpu_display/src/lib.rs +++ b/gpu_display/src/lib.rs @@ -155,6 +155,9 @@ trait DisplayT: AsRawFd { fn flip_to(&mut self, surface_id: u32, import_id: u32); fn close_requested(&self, surface_id: u32) -> bool; fn set_position(&mut self, surface_id: u32, x: u32, y: u32); + fn import_event_device(&mut self, event_device: EventDevice) -> Result<u32, GpuDisplayError>; + fn release_event_device(&mut self, event_device_id: u32); + fn attach_event_device(&mut self, surface_id: u32, event_device_id: u32); } /// A connection to the compositor and associated collection of state. @@ -291,6 +294,21 @@ impl GpuDisplay { pub fn set_position(&mut self, surface_id: u32, x: u32, y: u32) { self.inner.set_position(surface_id, x, y) } + + pub fn import_event_device( + &mut self, + event_device: EventDevice, + ) -> Result<u32, GpuDisplayError> { + self.inner.import_event_device(event_device) + } + + pub fn release_event_device(&mut self, event_device_id: u32) { + self.inner.release_event_device(event_device_id) + } + + pub fn attach_event_device(&mut self, surface_id: u32, event_device_id: u32) { + self.inner.attach_event_device(surface_id, event_device_id); + } } impl AsRawFd for GpuDisplay { |