Add media (WindowGLContext) module in canvas_trait

This module adds a structure (WindowGLContext) which holds the
OpenGL parameters that are going to be used by servo-media player
to render video frames using OpenGL.

In order to fill this structure, three new methods were added to
WindowMethods trait. In this patch only the Glutin-based
implementation provides a simple boilerplate.

The WindowGLContext is created in the entry point of libservo, when
the application window is created, and later passed to the
constellation, the pipeline and to the window element in dom, thus
htmlmediaelement has a mean to obtain these parameters via its
window.
This commit is contained in:
Víctor Manuel Jáquez Leal 2019-06-18 17:45:56 +02:00 committed by Fernando Jiménez Moreno
parent e9f46f9d72
commit 9f4f9dc750
16 changed files with 133 additions and 26 deletions

View file

@ -107,6 +107,7 @@ use canvas::canvas_paint_thread::CanvasPaintThread;
use canvas::webgl_thread::WebGLThreads;
use canvas_traits::canvas::CanvasId;
use canvas_traits::canvas::CanvasMsg;
use canvas_traits::media::WindowGLContext;
use compositing::compositor_thread::CompositorProxy;
use compositing::compositor_thread::Msg as ToCompositorMsg;
use compositing::SendableFrameTree;
@ -409,6 +410,9 @@ pub struct Constellation<Message, LTF, STF> {
/// Like --disable-text-aa, this is useful for reftests where pixel perfect
/// results are required.
enable_canvas_antialiasing: bool,
/// Application window's GL Context for Media player
player_context: WindowGLContext,
}
/// State needed to construct a constellation.
@ -457,6 +461,9 @@ pub struct InitialConstellationState {
/// The XR device registry
pub webxr_registry: webxr_api::Registry,
/// Application window's GL Context for Media player
pub player_context: WindowGLContext,
}
/// Data needed for webdriver
@ -753,6 +760,7 @@ where
is_running_problem_test,
hard_fail,
enable_canvas_antialiasing,
player_context: state.player_context,
};
constellation.run();
@ -994,6 +1002,7 @@ where
.map(|threads| threads.pipeline()),
webvr_chan: self.webvr_chan.clone(),
webxr_registry: self.webxr_registry.clone(),
player_context: self.player_context.clone(),
});
let pipeline = match result {

View file

@ -5,6 +5,7 @@
use crate::event_loop::EventLoop;
use background_hang_monitor::HangMonitorRegister;
use bluetooth_traits::BluetoothRequest;
use canvas_traits::media::WindowGLContext;
use canvas_traits::webgl::WebGLPipeline;
use compositing::compositor_thread::Msg as CompositorMsg;
use compositing::CompositionPipeline;
@ -191,6 +192,9 @@ pub struct InitialPipelineState {
/// The XR device registry
pub webxr_registry: webxr_api::Registry,
/// Application window's GL Context for Media player
pub player_context: WindowGLContext,
}
pub struct NewPipeline {
@ -309,6 +313,7 @@ impl Pipeline {
webgl_chan: state.webgl_chan,
webvr_chan: state.webvr_chan,
webxr_registry: state.webxr_registry,
player_context: state.player_context,
};
// Spawn the child process.
@ -515,6 +520,7 @@ pub struct UnprivilegedPipelineContent {
webgl_chan: Option<WebGLPipeline>,
webvr_chan: Option<IpcSender<WebVRMsg>>,
webxr_registry: webxr_api::Registry,
player_context: WindowGLContext,
}
impl UnprivilegedPipelineContent {
@ -563,6 +569,7 @@ impl UnprivilegedPipelineContent {
webrender_document: self.webrender_document,
webrender_api_sender: self.webrender_api_sender.clone(),
layout_is_busy: layout_thread_busy_flag.clone(),
player_context: self.player_context.clone(),
},
self.load_data.clone(),
self.opts.profile_script_events,