virtio-gpu: update orbital patch

Signed-off-by: Anhad Singh <andypython@protonmail.com>
This commit is contained in:
Anhad Singh
2023-07-05 13:44:35 +10:00
parent 07039e8321
commit 30146fa81d
2 changed files with 45 additions and 1 deletions
+45
View File
@@ -1,3 +1,48 @@
diff --git a/src/core/mod.rs b/src/core/mod.rs
index 85337dd..a454579 100644
--- a/src/core/mod.rs
+++ b/src/core/mod.rs
@@ -160,6 +160,9 @@ pub struct Orbital {
pub todo: Vec<Packet>,
pub displays: Vec<Display>,
pub maps: BTreeMap<usize, (usize, usize)>,
+
+ /// Handle to "input:consumer" to recieve input events.
+ pub input: File,
}
impl Orbital {
@@ -259,6 +262,7 @@ impl Orbital {
todo: Vec::new(),
displays,
maps: BTreeMap::new(),
+ input: File::open("input:consumer")?,
})
}
@@ -294,6 +298,7 @@ impl Orbital {
let scheme_fd = self.scheme.as_raw_fd();
let display_fd = self.displays[0].file.as_raw_fd();
+ let input_fd = self.input.as_raw_fd();
handler.handle_startup(&mut self)?;
@@ -337,12 +342,12 @@ impl Orbital {
Ok(result)
})?;
- event_queue.add(display_fd, move |_| -> io::Result<Option<()>> {
+ event_queue.add(input_fd, move |_| -> io::Result<Option<()>> {
let mut me = me2.borrow_mut();
let me = &mut *me;
let mut events = [Event::new(); 16];
loop {
- match read_to_slice(&mut me.orb.displays[0].file, &mut events)? {
+ match read_to_slice(&mut me.orb.input, &mut events)? {
0 => break,
count => {
let events = &mut events[..count];
diff --git a/src/main.rs b/src/main.rs
index 1cdf9cf..3859ac0 100644
--- a/src/main.rs
-1
View File
@@ -6,7 +6,6 @@ use std::{
},
};
use orbclient::Event;
use syscall::{Dma, Error as SysError, SchemeMut, EINVAL, EPERM};
use virtio_core::{
spec::{Buffer, ChainBuilder, DescriptorFlags},