Remove support for gpu painting.

Fixes #3614.
Fixes #4683.
Fixes #7366.
This commit is contained in:
Ms2ger 2016-06-03 13:29:03 +02:00
parent 765b1a8c6e
commit 400e1b8428
6 changed files with 10 additions and 78 deletions

View file

@ -34,7 +34,6 @@ range = {path = "../range"}
rustc-serialize = "0.3" rustc-serialize = "0.3"
serde = "0.7" serde = "0.7"
serde_macros = "0.7" serde_macros = "0.7"
servo-skia = "0.20130412.0"
smallvec = "0.1" smallvec = "0.1"
string_cache = {version = "0.2.18", features = ["heap_size"]} string_cache = {version = "0.2.18", features = ["heap_size"]}
style = {path = "../style"} style = {path = "../style"}

View file

@ -71,7 +71,6 @@ extern crate serde;
#[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))] #[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))]
extern crate simd; extern crate simd;
extern crate skia;
extern crate smallvec; extern crate smallvec;
#[macro_use] #[macro_use]
extern crate string_cache; extern crate string_cache;

View file

@ -25,7 +25,6 @@ use paint_context::PaintContext;
use profile_traits::mem::{self, ReportsChan}; use profile_traits::mem::{self, ReportsChan};
use profile_traits::time; use profile_traits::time;
use rand::{self, Rng}; use rand::{self, Rng};
use skia::gl_context::GLContext;
use std::borrow::ToOwned; use std::borrow::ToOwned;
use std::collections::HashMap; use std::collections::HashMap;
use std::mem as std_mem; use std::mem as std_mem;
@ -592,11 +591,7 @@ impl WorkerThreadProxy {
font_cache_thread: FontCacheThread, font_cache_thread: FontCacheThread,
time_profiler_chan: time::ProfilerChan) time_profiler_chan: time::ProfilerChan)
-> Vec<WorkerThreadProxy> { -> Vec<WorkerThreadProxy> {
let thread_count = if opts::get().gpu_painting { let thread_count = opts::get().paint_threads;
1
} else {
opts::get().paint_threads
};
(0..thread_count).map(|_| { (0..thread_count).map(|_| {
let (from_worker_sender, from_worker_receiver) = channel(); let (from_worker_sender, from_worker_receiver) = channel();
let (to_worker_sender, to_worker_receiver) = channel(); let (to_worker_sender, to_worker_receiver) = channel();
@ -650,24 +645,6 @@ struct WorkerThread {
native_display: Option<NativeDisplay>, native_display: Option<NativeDisplay>,
font_context: Box<FontContext>, font_context: Box<FontContext>,
time_profiler_sender: time::ProfilerChan, time_profiler_sender: time::ProfilerChan,
gl_context: Option<Arc<GLContext>>,
}
fn create_gl_context(native_display: Option<NativeDisplay>) -> Option<Arc<GLContext>> {
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 { impl WorkerThread {
@ -677,14 +654,12 @@ impl WorkerThread {
font_cache_thread: FontCacheThread, font_cache_thread: FontCacheThread,
time_profiler_sender: time::ProfilerChan) time_profiler_sender: time::ProfilerChan)
-> WorkerThread { -> WorkerThread {
let gl_context = create_gl_context(native_display);
WorkerThread { WorkerThread {
sender: sender, sender: sender,
receiver: receiver, receiver: receiver,
native_display: native_display, native_display: native_display,
font_context: box FontContext::new(font_cache_thread.clone()), font_context: box FontContext::new(font_cache_thread.clone()),
time_profiler_sender: time_profiler_sender, 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<i32>,
layer_buffer: &mut Box<LayerBuffer>)
-> 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, fn optimize_and_paint_tile(&mut self,
thread_id: usize, thread_id: usize,
mut tile: BufferRequest, mut tile: BufferRequest,
@ -742,7 +696,7 @@ impl WorkerThread {
let size = Size2D::new(tile.screen_rect.size.width as i32, let size = Size2D::new(tile.screen_rect.size.width as i32,
tile.screen_rect.size.height as i32); tile.screen_rect.size.height as i32);
let mut buffer = self.create_layer_buffer(&mut tile, scale); 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. // 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 // Extract the texture from the draw target and place it into its slot in the buffer.
// using CPU painting, upload it first. // Upload it first.
if self.gl_context.is_none() { draw_target.snapshot().get_data_surface().with_data(|data| {
draw_target.snapshot().get_data_surface().with_data(|data| { buffer.native_surface.upload(native_display!(self), data);
buffer.native_surface.upload(native_display!(self), data); debug!("painting worker thread uploading to native surface {}",
debug!("painting worker thread uploading to native surface {}", buffer.native_surface.get_id());
buffer.native_surface.get_id()); });
});
}
draw_target.finish(); draw_target.finish();
buffer buffer
@ -838,7 +790,7 @@ impl WorkerThread {
rect: tile.page_rect, rect: tile.page_rect,
screen_pos: tile.screen_rect, screen_pos: tile.screen_rect,
resolution: scale, resolution: scale,
painted_with_cpu: self.gl_context.is_none(), painted_with_cpu: true,
content_age: tile.content_age, content_age: tile.content_age,
} }
} }

View file

@ -781,7 +781,6 @@ dependencies = [
"serde 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)", "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)", "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-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)", "simd 0.1.0 (git+https://github.com/huonw/simd)",
"smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "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)", "string_cache 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)",

View file

@ -35,10 +35,6 @@ pub struct Opts {
/// Note that painting is sequentialized when using GPU painting. /// Note that painting is sequentialized when using GPU painting.
pub paint_threads: usize, 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`). /// The maximum size of each tile in pixels (`-s`).
pub tile_size: usize, pub tile_size: usize,
@ -396,14 +392,6 @@ fn args_fail(msg: &str) -> ! {
process::exit(1) 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; static MULTIPROCESS: AtomicBool = ATOMIC_BOOL_INIT;
#[inline] #[inline]
@ -466,7 +454,6 @@ pub fn default_opts() -> Opts {
is_running_problem_test: false, is_running_problem_test: false,
url: Some(Url::parse("about:blank").unwrap()), url: Some(Url::parse("about:blank").unwrap()),
paint_threads: 1, paint_threads: 1,
gpu_painting: false,
tile_size: 512, tile_size: 512,
device_pixels_per_px: None, device_pixels_per_px: None,
time_profiling: 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))) 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") { let mut layout_threads: usize = match opt_match.opt_str("y") {
Some(layout_threads_str) => layout_threads_str.parse() Some(layout_threads_str) => layout_threads_str.parse()
.unwrap_or_else(|err| args_fail(&format!("Error parsing option: -y ({})", err))), .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, is_running_problem_test: is_running_problem_test,
url: Some(url), url: Some(url),
paint_threads: paint_threads, paint_threads: paint_threads,
gpu_painting: gpu_painting,
tile_size: tile_size, tile_size: tile_size,
device_pixels_per_px: device_pixels_per_px, device_pixels_per_px: device_pixels_per_px,
time_profiling: time_profiling, time_profiling: time_profiling,

1
ports/cef/Cargo.lock generated
View file

@ -702,7 +702,6 @@ dependencies = [
"serde 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)", "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)", "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-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)", "simd 0.1.0 (git+https://github.com/huonw/simd)",
"smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "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)", "string_cache 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)",