WayVR: Fix process launching calling create_display two times
This commit is contained in:
@@ -31,6 +31,7 @@ fn generate_auth_key() -> String {
|
|||||||
uuid.to_string()
|
uuid.to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct DisplayWindow {
|
pub struct DisplayWindow {
|
||||||
pub window_handle: window::WindowHandle,
|
pub window_handle: window::WindowHandle,
|
||||||
pub toplevel: ToplevelSurface,
|
pub toplevel: ToplevelSurface,
|
||||||
@@ -42,12 +43,14 @@ pub struct SpawnProcessResult {
|
|||||||
pub child: std::process::Child,
|
pub child: std::process::Child,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
pub enum DisplayTask {
|
pub enum DisplayTask {
|
||||||
ProcessCleanup(process::ProcessHandle),
|
ProcessCleanup(process::ProcessHandle),
|
||||||
}
|
}
|
||||||
|
|
||||||
const MAX_DISPLAY_SIZE: u16 = 8192;
|
const MAX_DISPLAY_SIZE: u16 = 8192;
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct Display {
|
pub struct Display {
|
||||||
// Display info stuff
|
// Display info stuff
|
||||||
pub width: u16,
|
pub width: u16,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
use super::egl_ex;
|
use super::egl_ex;
|
||||||
use anyhow::anyhow;
|
use anyhow::anyhow;
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct EGLData {
|
pub struct EGLData {
|
||||||
pub egl: khronos_egl::Instance<khronos_egl::Static>,
|
pub egl: khronos_egl::Instance<khronos_egl::Static>,
|
||||||
pub display: khronos_egl::Display,
|
pub display: khronos_egl::Display,
|
||||||
@@ -15,13 +16,13 @@ macro_rules! bind_egl_function {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct DMAbufModifierInfo {
|
pub struct DMAbufModifierInfo {
|
||||||
pub modifiers: Vec<u64>,
|
pub modifiers: Vec<u64>,
|
||||||
pub fourcc: u32,
|
pub fourcc: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct DMAbufData {
|
pub struct DMAbufData {
|
||||||
pub fd: i32,
|
pub fd: i32,
|
||||||
pub stride: i32,
|
pub stride: i32,
|
||||||
|
|||||||
@@ -2,11 +2,12 @@
|
|||||||
|
|
||||||
use std::{cell::RefCell, collections::VecDeque, rc::Rc};
|
use std::{cell::RefCell, collections::VecDeque, rc::Rc};
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
struct Data<DataType> {
|
struct Data<DataType> {
|
||||||
queue: VecDeque<DataType>,
|
queue: VecDeque<DataType>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct SyncEventQueue<DataType> {
|
pub struct SyncEventQueue<DataType> {
|
||||||
data: Rc<RefCell<Data<DataType>>>,
|
data: Rc<RefCell<Data<DataType>>>,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,12 +6,14 @@ macro_rules! gen_id {
|
|||||||
$cell_name:ident,
|
$cell_name:ident,
|
||||||
$handle_name:ident) => {
|
$handle_name:ident) => {
|
||||||
//ThingCell
|
//ThingCell
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct $cell_name {
|
pub struct $cell_name {
|
||||||
pub obj: $instance_name,
|
pub obj: $instance_name,
|
||||||
pub generation: u64,
|
pub generation: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
//ThingVec
|
//ThingVec
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct $container_name {
|
pub struct $container_name {
|
||||||
// Vec<Option<ThingCell>>
|
// Vec<Option<ThingCell>>
|
||||||
pub vec: Vec<Option<$cell_name>>,
|
pub vec: Vec<Option<$cell_name>>,
|
||||||
@@ -20,7 +22,7 @@ macro_rules! gen_id {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//ThingHandle
|
//ThingHandle
|
||||||
#[derive(Default, Clone, Copy, PartialEq, Hash, Eq)]
|
#[derive(Default, Debug, Clone, Copy, PartialEq, Hash, Eq)]
|
||||||
pub struct $handle_name {
|
pub struct $handle_name {
|
||||||
idx: u32,
|
idx: u32,
|
||||||
generation: u64,
|
generation: u64,
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ use wayvr_ipc::packet_client;
|
|||||||
const STR_INVALID_HANDLE_DISP: &str = "Invalid display handle";
|
const STR_INVALID_HANDLE_DISP: &str = "Invalid display handle";
|
||||||
const STR_INVALID_HANDLE_PROCESS: &str = "Invalid process handle";
|
const STR_INVALID_HANDLE_PROCESS: &str = "Invalid process handle";
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct WaylandEnv {
|
pub struct WaylandEnv {
|
||||||
pub display_num: u32,
|
pub display_num: u32,
|
||||||
}
|
}
|
||||||
@@ -106,7 +106,10 @@ pub enum MouseIndex {
|
|||||||
|
|
||||||
pub enum TickTask {
|
pub enum TickTask {
|
||||||
NewExternalProcess(ExternalProcessRequest), // Call WayVRCompositor::add_client after receiving this message
|
NewExternalProcess(ExternalProcessRequest), // Call WayVRCompositor::add_client after receiving this message
|
||||||
NewDisplay(packet_client::WvrDisplayCreateParams),
|
NewDisplay(
|
||||||
|
packet_client::WvrDisplayCreateParams,
|
||||||
|
Option<display::DisplayHandle>, /* existing handle? */
|
||||||
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl WayVR {
|
impl WayVR {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ use crate::gen_id;
|
|||||||
|
|
||||||
use super::display;
|
use super::display;
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct WayVRProcess {
|
pub struct WayVRProcess {
|
||||||
pub auth_key: String,
|
pub auth_key: String,
|
||||||
pub child: std::process::Child,
|
pub child: std::process::Child,
|
||||||
@@ -14,11 +15,13 @@ pub struct WayVRProcess {
|
|||||||
pub env: Vec<(String, String)>,
|
pub env: Vec<(String, String)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct ExternalProcess {
|
pub struct ExternalProcess {
|
||||||
pub pid: u32,
|
pub pid: u32,
|
||||||
pub display_handle: display::DisplayHandle,
|
pub display_handle: display::DisplayHandle,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
pub enum Process {
|
pub enum Process {
|
||||||
Managed(WayVRProcess), // Process spawned by WayVR
|
Managed(WayVRProcess), // Process spawned by WayVR
|
||||||
External(ExternalProcess), // External process not directly controlled by us
|
External(ExternalProcess), // External process not directly controlled by us
|
||||||
|
|||||||
@@ -158,9 +158,10 @@ impl Connection {
|
|||||||
false,
|
false,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
params
|
params.tasks.push(TickTask::NewDisplay(
|
||||||
.tasks
|
packet_params.clone(),
|
||||||
.push(TickTask::NewDisplay(packet_params.clone()));
|
Some(display_handle),
|
||||||
|
));
|
||||||
|
|
||||||
send_packet(
|
send_packet(
|
||||||
&mut self.conn,
|
&mut self.conn,
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ use smithay::wayland::shell::xdg::ToplevelSurface;
|
|||||||
|
|
||||||
use crate::gen_id;
|
use crate::gen_id;
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct Window {
|
pub struct Window {
|
||||||
pub pos_x: i32,
|
pub pos_x: i32,
|
||||||
pub pos_y: i32,
|
pub pos_y: i32,
|
||||||
@@ -38,6 +39,7 @@ impl Window {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct WindowManager {
|
pub struct WindowManager {
|
||||||
pub windows: WindowVec,
|
pub windows: WindowVec,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -440,19 +440,22 @@ where
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wayvr::TickTask::NewDisplay(cpar) => {
|
wayvr::TickTask::NewDisplay(cpar, disp_handle) => {
|
||||||
log::info!("Creating new display with name \"{}\"", cpar.name);
|
log::info!("Creating new display with name \"{}\"", cpar.name);
|
||||||
|
|
||||||
let mut wayvr = r_wayvr.borrow_mut();
|
let mut wayvr = r_wayvr.borrow_mut();
|
||||||
|
|
||||||
let unique_name = wayvr.get_unique_display_name(cpar.name);
|
let unique_name = wayvr.get_unique_display_name(cpar.name);
|
||||||
|
|
||||||
let disp_handle = wayvr.data.state.create_display(
|
let disp_handle = match disp_handle {
|
||||||
|
Some(d) => d,
|
||||||
|
None => wayvr.data.state.create_display(
|
||||||
cpar.width,
|
cpar.width,
|
||||||
cpar.height,
|
cpar.height,
|
||||||
&unique_name,
|
&unique_name,
|
||||||
false,
|
false,
|
||||||
)?;
|
)?,
|
||||||
|
};
|
||||||
|
|
||||||
wayvr.overlays_to_create.push(OverlayToCreate {
|
wayvr.overlays_to_create.push(OverlayToCreate {
|
||||||
disp_handle,
|
disp_handle,
|
||||||
|
|||||||
Reference in New Issue
Block a user