mirror of
https://github.com/servo/servo.git
synced 2025-07-22 14:53:49 +01:00
Pass GLPlayerThreads to constellation
Create the thread only if the GL context is known.
This commit is contained in:
parent
43467b4290
commit
dd01728d53
3 changed files with 28 additions and 1 deletions
|
@ -66,6 +66,8 @@ pub struct WindowGLContext {
|
||||||
pub gl_api: GlApi,
|
pub gl_api: GlApi,
|
||||||
/// Application's native display
|
/// Application's native display
|
||||||
pub native_display: NativeDisplay,
|
pub native_display: NativeDisplay,
|
||||||
|
/// A channel to the GLPlayer thread.
|
||||||
|
pub glplayer_chan: Option<GLPlayerPipeline>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PlayerGLContext for WindowGLContext {
|
impl PlayerGLContext for WindowGLContext {
|
||||||
|
|
|
@ -104,6 +104,7 @@ use background_hang_monitor::HangMonitorRegister;
|
||||||
use backtrace::Backtrace;
|
use backtrace::Backtrace;
|
||||||
use bluetooth_traits::BluetoothRequest;
|
use bluetooth_traits::BluetoothRequest;
|
||||||
use canvas::canvas_paint_thread::CanvasPaintThread;
|
use canvas::canvas_paint_thread::CanvasPaintThread;
|
||||||
|
use canvas::media_thread::GLPlayerThreads;
|
||||||
use canvas::webgl_thread::WebGLThreads;
|
use canvas::webgl_thread::WebGLThreads;
|
||||||
use canvas_traits::canvas::CanvasId;
|
use canvas_traits::canvas::CanvasId;
|
||||||
use canvas_traits::canvas::CanvasMsg;
|
use canvas_traits::canvas::CanvasMsg;
|
||||||
|
@ -411,6 +412,9 @@ pub struct Constellation<Message, LTF, STF> {
|
||||||
/// results are required.
|
/// results are required.
|
||||||
enable_canvas_antialiasing: bool,
|
enable_canvas_antialiasing: bool,
|
||||||
|
|
||||||
|
/// Entry point to create and get channels to a GLPlayerThread.
|
||||||
|
glplayer_threads: Option<GLPlayerThreads>,
|
||||||
|
|
||||||
/// Application window's GL Context for Media player
|
/// Application window's GL Context for Media player
|
||||||
player_context: WindowGLContext,
|
player_context: WindowGLContext,
|
||||||
}
|
}
|
||||||
|
@ -461,6 +465,8 @@ pub struct InitialConstellationState {
|
||||||
|
|
||||||
/// The XR device registry
|
/// The XR device registry
|
||||||
pub webxr_registry: webxr_api::Registry,
|
pub webxr_registry: webxr_api::Registry,
|
||||||
|
|
||||||
|
pub glplayer_threads: Option<GLPlayerThreads>,
|
||||||
|
|
||||||
/// Application window's GL Context for Media player
|
/// Application window's GL Context for Media player
|
||||||
pub player_context: WindowGLContext,
|
pub player_context: WindowGLContext,
|
||||||
|
@ -760,6 +766,7 @@ where
|
||||||
is_running_problem_test,
|
is_running_problem_test,
|
||||||
hard_fail,
|
hard_fail,
|
||||||
enable_canvas_antialiasing,
|
enable_canvas_antialiasing,
|
||||||
|
glplayer_threads: state.glplayer_threads,
|
||||||
player_context: state.player_context,
|
player_context: state.player_context,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1804,6 +1811,13 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
debug!("Exiting GLPlayer thread.");
|
||||||
|
if let Some(glplayer_threads) = self.glplayer_threads.as_ref() {
|
||||||
|
if let Err(e) = glplayer_threads.exit() {
|
||||||
|
warn!("Exit GLPlayer Thread failed ({})", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
debug!("Exiting timer scheduler.");
|
debug!("Exiting timer scheduler.");
|
||||||
if let Err(e) = self.scheduler_chan.send(TimerSchedulerMsg::Exit) {
|
if let Err(e) = self.scheduler_chan.send(TimerSchedulerMsg::Exit) {
|
||||||
warn!("Exit timer scheduler failed ({})", e);
|
warn!("Exit timer scheduler failed ({})", e);
|
||||||
|
|
|
@ -63,6 +63,7 @@ fn webdriver(_port: u16, _constellation: Sender<ConstellationMsg>) {}
|
||||||
use bluetooth::BluetoothThreadFactory;
|
use bluetooth::BluetoothThreadFactory;
|
||||||
use bluetooth_traits::BluetoothRequest;
|
use bluetooth_traits::BluetoothRequest;
|
||||||
use canvas::gl_context::GLContextFactory;
|
use canvas::gl_context::GLContextFactory;
|
||||||
|
use canvas::media_thread::GLPlayerThreads;
|
||||||
use canvas::webgl_thread::WebGLThreads;
|
use canvas::webgl_thread::WebGLThreads;
|
||||||
use canvas_traits::media::WindowGLContext;
|
use canvas_traits::media::WindowGLContext;
|
||||||
use compositing::compositor_thread::{
|
use compositing::compositor_thread::{
|
||||||
|
@ -104,6 +105,7 @@ use profile_traits::time;
|
||||||
use script_traits::{ConstellationMsg, SWManagerSenders, ScriptToConstellationChan};
|
use script_traits::{ConstellationMsg, SWManagerSenders, ScriptToConstellationChan};
|
||||||
use servo_config::opts;
|
use servo_config::opts;
|
||||||
use servo_config::{pref, prefs};
|
use servo_config::{pref, prefs};
|
||||||
|
use servo_media::player::context::GlContext;
|
||||||
use servo_media::ServoMedia;
|
use servo_media::ServoMedia;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::cmp::max;
|
use std::cmp::max;
|
||||||
|
@ -304,10 +306,16 @@ where
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let gl_context = window.get_gl_context();
|
||||||
|
let glplayer_threads = match gl_context {
|
||||||
|
GlContext::Unknown => None,
|
||||||
|
_ => Some(GLPlayerThreads::new()),
|
||||||
|
};
|
||||||
let player_context = WindowGLContext {
|
let player_context = WindowGLContext {
|
||||||
gl_context: window.get_gl_context(),
|
gl_context,
|
||||||
native_display: window.get_native_display(),
|
native_display: window.get_native_display(),
|
||||||
gl_api: window.get_gl_api(),
|
gl_api: window.get_gl_api(),
|
||||||
|
glplayer_chan: glplayer_threads.as_ref().map(|threads| threads.pipeline()),
|
||||||
};
|
};
|
||||||
|
|
||||||
// Create the constellation, which maintains the engine
|
// Create the constellation, which maintains the engine
|
||||||
|
@ -328,6 +336,7 @@ where
|
||||||
window.gl(),
|
window.gl(),
|
||||||
webvr_services,
|
webvr_services,
|
||||||
webxr_registry,
|
webxr_registry,
|
||||||
|
glplayer_threads,
|
||||||
player_context,
|
player_context,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -639,6 +648,7 @@ fn create_constellation(
|
||||||
window_gl: Rc<dyn gl::Gl>,
|
window_gl: Rc<dyn gl::Gl>,
|
||||||
webvr_services: Option<VRServiceManager>,
|
webvr_services: Option<VRServiceManager>,
|
||||||
webxr_registry: webxr_api::Registry,
|
webxr_registry: webxr_api::Registry,
|
||||||
|
glplayer_threads: Option<GLPlayerThreads>,
|
||||||
player_context: WindowGLContext,
|
player_context: WindowGLContext,
|
||||||
) -> (Sender<ConstellationMsg>, SWManagerSenders) {
|
) -> (Sender<ConstellationMsg>, SWManagerSenders) {
|
||||||
// Global configuration options, parsed from the command line.
|
// Global configuration options, parsed from the command line.
|
||||||
|
@ -721,6 +731,7 @@ fn create_constellation(
|
||||||
webgl_threads,
|
webgl_threads,
|
||||||
webvr_chan,
|
webvr_chan,
|
||||||
webxr_registry,
|
webxr_registry,
|
||||||
|
glplayer_threads,
|
||||||
player_context,
|
player_context,
|
||||||
};
|
};
|
||||||
let (constellation_chan, from_swmanager_sender) = Constellation::<
|
let (constellation_chan, from_swmanager_sender) = Constellation::<
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue