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

@ -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<WorkerThreadProxy> {
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<NativeDisplay>,
font_context: Box<FontContext>,
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 {
@ -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<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,
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,
}
}