mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-05 10:10:41 +00:00
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>
This commit is contained in:
parent
6f8823abb5
commit
2b0bc61ea7
3 changed files with 39 additions and 2 deletions
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue