From 765b1a8c6e146c9b3b82861411fbfa5c0bbb3608 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Fri, 3 Jun 2016 12:53:23 +0200 Subject: [PATCH 1/2] Remove the last remaining support for "experimental" features. This code has not been used for quite a while. --- components/util/opts.rs | 9 --------- 1 file changed, 9 deletions(-) diff --git a/components/util/opts.rs b/components/util/opts.rs index fd806491347..fc3262e8b2a 100644 --- a/components/util/opts.rs +++ b/components/util/opts.rs @@ -849,15 +849,6 @@ pub enum ArgumentParsingResult { ContentProcess(String), } -static EXPERIMENTAL_ENABLED: AtomicBool = ATOMIC_BOOL_INIT; - -/// Turn on experimental features globally. Normally this is done -/// during initialization by `set` or `from_cmdline_args`, but -/// tests that require experimental features will also set it. -pub fn set_experimental_enabled(new_value: bool) { - EXPERIMENTAL_ENABLED.store(new_value, Ordering::SeqCst); -} - // Make Opts available globally. This saves having to clone and pass // opts everywhere it is used, which gets particularly cumbersome // when passing through the DOM structures. From 400e1b84285b5993b87f96ded4a94379e4455ce2 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Fri, 3 Jun 2016 13:29:03 +0200 Subject: [PATCH 2/2] Remove support for gpu painting. Fixes #3614. Fixes #4683. Fixes #7366. --- components/gfx/Cargo.toml | 1 - components/gfx/lib.rs | 1 - components/gfx/paint_thread.rs | 68 +++++----------------------------- components/servo/Cargo.lock | 1 - components/util/opts.rs | 16 -------- ports/cef/Cargo.lock | 1 - 6 files changed, 10 insertions(+), 78 deletions(-) diff --git a/components/gfx/Cargo.toml b/components/gfx/Cargo.toml index 37cbaa11dd6..6982ed4a2dd 100644 --- a/components/gfx/Cargo.toml +++ b/components/gfx/Cargo.toml @@ -34,7 +34,6 @@ range = {path = "../range"} rustc-serialize = "0.3" serde = "0.7" serde_macros = "0.7" -servo-skia = "0.20130412.0" smallvec = "0.1" string_cache = {version = "0.2.18", features = ["heap_size"]} style = {path = "../style"} diff --git a/components/gfx/lib.rs b/components/gfx/lib.rs index 450928a6197..e3f3f1d438f 100644 --- a/components/gfx/lib.rs +++ b/components/gfx/lib.rs @@ -71,7 +71,6 @@ extern crate serde; #[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))] extern crate simd; -extern crate skia; extern crate smallvec; #[macro_use] extern crate string_cache; diff --git a/components/gfx/paint_thread.rs b/components/gfx/paint_thread.rs index 3f86acfb4d6..648912b0351 100644 --- a/components/gfx/paint_thread.rs +++ b/components/gfx/paint_thread.rs @@ -25,7 +25,6 @@ use paint_context::PaintContext; use profile_traits::mem::{self, ReportsChan}; use profile_traits::time; use rand::{self, Rng}; -use skia::gl_context::GLContext; use std::borrow::ToOwned; use std::collections::HashMap; use std::mem as std_mem; @@ -592,11 +591,7 @@ impl WorkerThreadProxy { font_cache_thread: FontCacheThread, time_profiler_chan: time::ProfilerChan) -> Vec { - let thread_count = if opts::get().gpu_painting { - 1 - } else { - opts::get().paint_threads - }; + let thread_count = opts::get().paint_threads; (0..thread_count).map(|_| { let (from_worker_sender, from_worker_receiver) = channel(); let (to_worker_sender, to_worker_receiver) = channel(); @@ -650,24 +645,6 @@ struct WorkerThread { native_display: Option, font_context: Box, time_profiler_sender: time::ProfilerChan, - gl_context: Option>, -} - -fn create_gl_context(native_display: Option) -> Option> { - if !opts::get().gpu_painting { - return None; - } - - match native_display { - Some(display) => { - let tile_size = opts::get().tile_size as i32; - GLContext::new(display.platform_display_data(), Size2D::new(tile_size, tile_size)) - } - None => { - warn!("Could not create GLContext, falling back to CPU rasterization"); - None - } - } } impl WorkerThread { @@ -677,14 +654,12 @@ impl WorkerThread { font_cache_thread: FontCacheThread, time_profiler_sender: time::ProfilerChan) -> WorkerThread { - let gl_context = create_gl_context(native_display); WorkerThread { sender: sender, receiver: receiver, native_display: native_display, font_context: box FontContext::new(font_cache_thread.clone()), time_profiler_sender: time_profiler_sender, - gl_context: gl_context, } } @@ -710,27 +685,6 @@ impl WorkerThread { } } - fn create_draw_target_for_layer_buffer(&self, - size: Size2D, - layer_buffer: &mut Box) - -> DrawTarget { - match self.gl_context { - Some(ref gl_context) => { - match layer_buffer.native_surface.gl_rasterization_context(gl_context.clone()) { - Some(rasterization_context) => { - DrawTarget::new_with_gl_rasterization_context(rasterization_context, - SurfaceFormat::B8G8R8A8) - } - None => panic!("Could not create GLRasterizationContext for LayerBuffer"), - } - }, - None => { - // A missing GLContext means we want CPU rasterization. - DrawTarget::new(BackendType::Skia, size, SurfaceFormat::B8G8R8A8) - } - } - } - fn optimize_and_paint_tile(&mut self, thread_id: usize, mut tile: BufferRequest, @@ -742,7 +696,7 @@ impl WorkerThread { let size = Size2D::new(tile.screen_rect.size.width as i32, tile.screen_rect.size.height as i32); let mut buffer = self.create_layer_buffer(&mut tile, scale); - let draw_target = self.create_draw_target_for_layer_buffer(size, &mut buffer); + let draw_target = DrawTarget::new(BackendType::Skia, size, SurfaceFormat::B8G8R8A8); { // Build the paint context. @@ -806,15 +760,13 @@ impl WorkerThread { } } - // Extract the texture from the draw target and place it into its slot in the buffer. If - // using CPU painting, upload it first. - if self.gl_context.is_none() { - draw_target.snapshot().get_data_surface().with_data(|data| { - buffer.native_surface.upload(native_display!(self), data); - debug!("painting worker thread uploading to native surface {}", - buffer.native_surface.get_id()); - }); - } + // Extract the texture from the draw target and place it into its slot in the buffer. + // Upload it first. + draw_target.snapshot().get_data_surface().with_data(|data| { + buffer.native_surface.upload(native_display!(self), data); + debug!("painting worker thread uploading to native surface {}", + buffer.native_surface.get_id()); + }); draw_target.finish(); buffer @@ -838,7 +790,7 @@ impl WorkerThread { rect: tile.page_rect, screen_pos: tile.screen_rect, resolution: scale, - painted_with_cpu: self.gl_context.is_none(), + painted_with_cpu: true, content_age: tile.content_age, } } diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock index 57c0657f55b..1af3b51fe76 100644 --- a/components/servo/Cargo.lock +++ b/components/servo/Cargo.lock @@ -781,7 +781,6 @@ dependencies = [ "serde 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)", "servo-fontconfig 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "servo-skia 0.20130412.9 (registry+https://github.com/rust-lang/crates.io-index)", "simd 0.1.0 (git+https://github.com/huonw/simd)", "smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/components/util/opts.rs b/components/util/opts.rs index fc3262e8b2a..323abc19d62 100644 --- a/components/util/opts.rs +++ b/components/util/opts.rs @@ -35,10 +35,6 @@ pub struct Opts { /// Note that painting is sequentialized when using GPU painting. pub paint_threads: usize, - /// True to use GPU painting via Skia-GL, false to use CPU painting via Skia (`-g`). Note that - /// compositing is always done on the GPU. - pub gpu_painting: bool, - /// The maximum size of each tile in pixels (`-s`). pub tile_size: usize, @@ -396,14 +392,6 @@ fn args_fail(msg: &str) -> ! { process::exit(1) } -// Always use CPU painting on android. - -#[cfg(target_os = "android")] -static FORCE_CPU_PAINTING: bool = true; - -#[cfg(not(target_os = "android"))] -static FORCE_CPU_PAINTING: bool = false; - static MULTIPROCESS: AtomicBool = ATOMIC_BOOL_INIT; #[inline] @@ -466,7 +454,6 @@ pub fn default_opts() -> Opts { is_running_problem_test: false, url: Some(Url::parse("about:blank").unwrap()), paint_threads: 1, - gpu_painting: false, tile_size: 512, device_pixels_per_px: None, time_profiling: None, @@ -679,8 +666,6 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult { period.parse().unwrap_or_else(|err| args_fail(&format!("Error parsing option: -m ({})", err))) }); - let gpu_painting = !FORCE_CPU_PAINTING && opt_match.opt_present("g"); - let mut layout_threads: usize = match opt_match.opt_str("y") { Some(layout_threads_str) => layout_threads_str.parse() .unwrap_or_else(|err| args_fail(&format!("Error parsing option: -y ({})", err))), @@ -769,7 +754,6 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult { is_running_problem_test: is_running_problem_test, url: Some(url), paint_threads: paint_threads, - gpu_painting: gpu_painting, tile_size: tile_size, device_pixels_per_px: device_pixels_per_px, time_profiling: time_profiling, diff --git a/ports/cef/Cargo.lock b/ports/cef/Cargo.lock index f41d0604bf3..ab7ff419b07 100644 --- a/ports/cef/Cargo.lock +++ b/ports/cef/Cargo.lock @@ -702,7 +702,6 @@ dependencies = [ "serde 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)", "servo-fontconfig 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "servo-skia 0.20130412.9 (registry+https://github.com/rust-lang/crates.io-index)", "simd 0.1.0 (git+https://github.com/huonw/simd)", "smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)",