Backed out changeset bbb6a31ebf07 (bug 1528674) for webrender crashtests and reftests failures.

--HG--
extra : rebase_source : 083b18e419d18de6a13d7a22e482f995adee1b00
This commit is contained in:
Cosmin Sabou 2019-03-27 02:15:39 +02:00
Родитель 3c71fa6b4d
Коммит d3aa170d5a
10 изменённых файлов: 58 добавлений и 109 удалений

Просмотреть файл

@ -69,14 +69,11 @@ class NewRenderer : public RendererEvent {
*mUseDComp = compositor->UseDComp();
*mUseTripleBuffering = compositor->UseTripleBuffering();
bool isMainWindow = true; //TODO!
bool supportLowPriorityTransactions = isMainWindow;
bool supportPictureCaching = isMainWindow;
bool supportLowPriorityTransactions = true; // TODO only for main windows.
wr::Renderer* wrRenderer = nullptr;
if (!wr_window_new(aWindowId, mSize.width, mSize.height,
supportLowPriorityTransactions,
gfxPrefs::WebRenderPictureCaching() && supportPictureCaching,
compositor->gl(),
gfxPrefs::WebRenderPictureCaching(), compositor->gl(),
aRenderThread.GetProgramCache()
? aRenderThread.GetProgramCache()->Raw()
: nullptr,

Просмотреть файл

@ -1159,11 +1159,10 @@ pub extern "C" fn wr_window_new(window_id: WrWindowId,
// Ensure the WR profiler callbacks are hooked up to the Gecko profiler.
set_profiler_hooks(Some(&PROFILER_HOOKS));
let window_size = FramebufferIntSize::new(window_width, window_height);
let notifier = Box::new(CppNotifier {
window_id: window_id,
});
let (renderer, sender) = match Renderer::new(gl, notifier, opts, shaders, window_size) {
let (renderer, sender) = match Renderer::new(gl, notifier, opts, shaders) {
Ok((renderer, sender)) => (renderer, sender),
Err(e) => {
warn!(" Failed to create a Renderer: {:?}", e);
@ -1178,6 +1177,7 @@ pub extern "C" fn wr_window_new(window_id: WrWindowId,
unsafe {
*out_max_texture_size = renderer.get_max_texture_size();
}
let window_size = FramebufferIntSize::new(window_width, window_height);
let layer = 0;
*out_handle = Box::into_raw(Box::new(
DocumentHandle::new_with_id(sender.create_api_by_client(next_namespace_id()),

Просмотреть файл

@ -115,7 +115,6 @@ impl Rectangle {
..webrender::RendererOptions::default()
},
None,
size,
).unwrap();
let api = sender.create_api();

Просмотреть файл

@ -168,13 +168,7 @@ pub fn main_wrapper<E: Example>(
FramebufferIntSize::new(size.width as i32, size.height as i32)
};
let notifier = Box::new(Notifier::new(events_loop.create_proxy()));
let (mut renderer, sender) = webrender::Renderer::new(
gl.clone(),
notifier,
opts,
None,
framebuffer_size,
).unwrap();
let (mut renderer, sender) = webrender::Renderer::new(gl.clone(), notifier, opts, None).unwrap();
let api = sender.create_api();
let document_id = api.add_document(framebuffer_size, 0);

Просмотреть файл

@ -105,7 +105,7 @@ impl Window {
FramebufferIntSize::new(size.width as i32, size.height as i32)
};
let notifier = Box::new(Notifier::new(events_loop.create_proxy()));
let (renderer, sender) = webrender::Renderer::new(gl.clone(), notifier, opts, None, framebuffer_size).unwrap();
let (renderer, sender) = webrender::Renderer::new(gl.clone(), notifier, opts, None).unwrap();
let api = sender.create_api();
let document_id = api.add_document(framebuffer_size, 0);

Просмотреть файл

@ -1715,11 +1715,7 @@ impl RenderBackend {
// rather explicitly on what's used before and after scene building
// so that, for example, we never miss anything in the code below:
let plain_externals = self.resource_cache.load_capture(
backend.resources,
caches_maybe,
root,
);
let plain_externals = self.resource_cache.load_capture(backend.resources, caches_maybe, root);
let msg_load = ResultMsg::DebugOutput(
DebugOutput::LoadCapture(root.clone(), plain_externals)
);

Просмотреть файл

@ -1747,8 +1747,7 @@ impl Renderer {
gl: Rc<gl::Gl>,
notifier: Box<RenderNotifier>,
mut options: RendererOptions,
shaders: Option<&mut WrShaders>,
start_size: FramebufferIntSize,
shaders: Option<&mut WrShaders>
) -> Result<(Self, RenderApiSender), RendererError> {
HAS_BEEN_INITIALIZED.store(true, Ordering::SeqCst);
@ -2051,12 +2050,7 @@ impl Renderer {
let texture_cache = TextureCache::new(
max_texture_size,
max_texture_layers,
if config.enable_picture_caching {
Some(TileCache::tile_dimensions(config.testing))
} else {
None
},
start_size,
TileCache::tile_dimensions(config.testing),
);
let resource_cache = ResourceCache::new(

Просмотреть файл

@ -2201,7 +2201,6 @@ impl ResourceCache {
self.texture_cache.max_texture_size(),
self.texture_cache.max_texture_layers(),
self.texture_cache.picture_tile_size(),
FramebufferIntSize::zero(),
);
}
}

Просмотреть файл

@ -25,8 +25,10 @@ use std::rc::Rc;
/// The size of each region/layer in shared cache texture arrays.
pub const TEXTURE_REGION_DIMENSIONS: i32 = 512;
const PICTURE_TEXTURE_ADD_SLICES: usize = 4;
/// The number of slices for picture caching to allocate at start.
const BASE_PICTURE_TEXTURE_SLICES: usize = 16;
/// The number of slices to add when we grow out of the current range.
const ADD_PICTURE_TEXTURE_SLICES: usize = 8;
/// The chosen image format for picture tiles.
const PICTURE_TILE_FORMAT: ImageFormat = ImageFormat::BGRA8;
@ -473,7 +475,7 @@ pub struct TextureCache {
shared_textures: SharedTextures,
/// A single texture array for picture caching.
picture_texture: Option<WholeTextureArray>,
picture_texture: WholeTextureArray,
/// Maximum texture size supported by hardware.
max_texture_size: i32,
@ -518,8 +520,7 @@ impl TextureCache {
pub fn new(
max_texture_size: i32,
mut max_texture_layers: usize,
picture_tile_size: Option<DeviceIntSize>,
initial_size: FramebufferIntSize,
picture_tile_size: DeviceIntSize,
) -> Self {
if cfg!(target_os = "macos") {
// On MBP integrated Intel GPUs, texture arrays appear to be
@ -547,25 +548,15 @@ impl TextureCache {
max_texture_layers = max_texture_layers.min(32);
}
let mut pending_updates = TextureUpdateList::new();
let picture_texture = if let Some(tile_size) = picture_tile_size{
let picture_texture = WholeTextureArray {
size: tile_size,
filter: TextureFilter::Linear,
format: PICTURE_TILE_FORMAT,
texture_id: CacheTextureId(1),
slices: {
let num_x = (initial_size.width + tile_size.width - 1) / tile_size.width;
let num_y = (initial_size.height + tile_size.height - 1) / tile_size.height;
info!("Initializing picture texture with {}x{} slices", num_x, num_y);
vec![WholeTextureSlice { uv_rect_handle: None }; (num_x * num_y) as usize]
},
};
pending_updates.push_alloc(picture_texture.texture_id, picture_texture.to_info());
Some(picture_texture)
} else {
None
let picture_texture = WholeTextureArray {
size: picture_tile_size,
filter: TextureFilter::Linear,
format: PICTURE_TILE_FORMAT,
texture_id: CacheTextureId(1),
slices: vec![WholeTextureSlice { uv_rect_handle: None }; BASE_PICTURE_TEXTURE_SLICES],
};
let mut pending_updates = TextureUpdateList::new();
pending_updates.push_alloc(picture_texture.texture_id, picture_texture.to_info());
TextureCache {
shared_textures: SharedTextures::new(),
@ -588,7 +579,8 @@ impl TextureCache {
/// directly from unit test code.
#[cfg(test)]
pub fn new_for_testing(max_texture_size: i32, max_texture_layers: usize) -> Self {
let mut cache = Self::new(max_texture_size, max_texture_layers, None, FramebufferIntSize::zero());
let tile_size = DeviceIntSize::new(64, 64);
let mut cache = Self::new(max_texture_size, max_texture_layers, tile_size);
let mut now = FrameStamp::first(DocumentId::new(IdNamespace(1), 1));
now.advance();
cache.begin_frame(now);
@ -631,10 +623,8 @@ impl TextureCache {
fn clear_picture(&mut self) {
self.clear_kind(EntryKind::Picture);
if let Some(ref mut picture_texture) = self.picture_texture {
if let Some(texture_id) = picture_texture.reset(PICTURE_TEXTURE_ADD_SLICES) {
self.pending_updates.push_realloc(texture_id, picture_texture.to_info());
}
if let Some(texture_id) = self.picture_texture.reset(BASE_PICTURE_TEXTURE_SLICES) {
self.pending_updates.push_realloc(texture_id, self.picture_texture.to_info());
}
}
@ -747,10 +737,8 @@ impl TextureCache {
self.shared_textures.array_rgba8_nearest
.update_profile(&mut texture_cache_profile.pages_rgba8_nearest);
if let Some(ref picture_texture) = self.picture_texture {
picture_texture
.update_profile(&mut texture_cache_profile.pages_picture);
}
self.picture_texture
.update_profile(&mut texture_cache_profile.pages_picture);
self.unset_doc_data();
self.now = FrameStamp::INVALID;
@ -794,8 +782,8 @@ impl TextureCache {
}
#[cfg(feature = "replay")]
pub fn picture_tile_size(&self) -> Option<DeviceIntSize> {
self.picture_texture.as_ref().map(|pt| pt.size)
pub fn picture_tile_size(&self) -> DeviceIntSize {
self.picture_texture.size
}
pub fn pending_updates(&mut self) -> TextureUpdateList {
@ -1006,11 +994,12 @@ impl TextureCache {
// Free a cache entry from the standalone list or shared cache.
fn free(&mut self, entry: &CacheEntry) {
match entry.details {
EntryDetails::Standalone => {
// This is a standalone texture allocation. Free it directly.
self.pending_updates.push_free(entry.texture_id);
}
EntryDetails::Picture { layer_index } => {
let picture_texture = self.picture_texture
.as_mut()
.expect("Picture caching is expecte to be ON");
picture_texture.slices[layer_index].uv_rect_handle = None;
self.picture_texture.slices[layer_index].uv_rect_handle = None;
if self.debug_flags.contains(
DebugFlags::TEXTURE_CACHE_DBG |
DebugFlags::TEXTURE_CACHE_DBG_CLEAR_EVICTED)
@ -1018,16 +1007,12 @@ impl TextureCache {
self.pending_updates.push_debug_clear(
entry.texture_id,
DeviceIntPoint::zero(),
picture_texture.size.width,
picture_texture.size.height,
self.picture_texture.size.width,
self.picture_texture.size.height,
layer_index,
);
}
}
EntryDetails::Standalone => {
// This is a standalone texture allocation. Free it directly.
self.pending_updates.push_free(entry.texture_id);
}
EntryDetails::Cache { origin, layer_index } => {
// Free the block in the given region.
let texture_array = self.shared_textures.select(entry.format, entry.filter);
@ -1140,11 +1125,11 @@ impl TextureCache {
};
self.pending_updates.push_alloc(texture_id, info);
CacheEntry::new_standalone(
return CacheEntry::new_standalone(
texture_id,
self.now,
params,
)
);
}
/// Allocates a cache entry appropriate for the given parameters.
@ -1279,21 +1264,17 @@ impl TextureCache {
debug_assert!(self.now.is_valid());
if self.entries.get_opt(handle).is_none() {
let cache_entry = {
let picture_texture = self.picture_texture
.as_mut()
.expect("Picture caching is expecte to be ON");
let layer_index = match picture_texture.find_free() {
Some(index) => index,
None => {
let index = picture_texture.grow(PICTURE_TEXTURE_ADD_SLICES);
let info = picture_texture.to_info();
self.pending_updates.push_realloc(picture_texture.texture_id, info);
index
},
};
picture_texture.occupy(layer_index, self.now)
let layer_index = match self.picture_texture.find_free() {
Some(index) => index,
None => {
let index = self.picture_texture.grow(ADD_PICTURE_TEXTURE_SLICES);
let info = self.picture_texture.to_info();
self.pending_updates.push_realloc(self.picture_texture.texture_id, info);
index
},
};
let cache_entry = self.picture_texture.occupy(layer_index, self.now);
self.upsert_entry(cache_entry, handle)
}
@ -1630,9 +1611,12 @@ impl WholeTextureArray {
index
}
fn cache_entry_impl(
&self, layer_index: usize, now: FrameStamp, uv_rect_handle: GpuCacheHandle, texture_id: CacheTextureId,
) -> CacheEntry {
/// Occupy a specified slice by a cache entry.
fn occupy(&mut self, layer_index: usize, now: FrameStamp) -> CacheEntry {
let uv_rect_handle = GpuCacheHandle::new();
assert!(self.slices[layer_index].uv_rect_handle.is_none());
self.slices[layer_index].uv_rect_handle = Some(uv_rect_handle);
CacheEntry {
size: self.size,
user_data: [0.0; 3],
@ -1643,21 +1627,13 @@ impl WholeTextureArray {
uv_rect_handle,
format: self.format,
filter: self.filter,
texture_id,
texture_id: self.texture_id,
eviction_notice: None,
uv_rect_kind: UvRectKind::Rect,
eviction: Eviction::Eager,
}
}
/// Occupy a specified slice by a cache entry.
fn occupy(&mut self, layer_index: usize, now: FrameStamp) -> CacheEntry {
let uv_rect_handle = GpuCacheHandle::new();
assert!(self.slices[layer_index].uv_rect_handle.is_none());
self.slices[layer_index].uv_rect_handle = Some(uv_rect_handle);
self.cache_entry_impl(layer_index, now, uv_rect_handle, self.texture_id)
}
/// Reset the texture array to the specified number of slices, if it's larger.
fn reset(
&mut self, num_slices: usize

Просмотреть файл

@ -238,13 +238,7 @@ impl Wrench {
Box::new(Notifier(data))
});
let (renderer, sender) = webrender::Renderer::new(
window.clone_gl(),
notifier,
opts,
None,
size,
).unwrap();
let (renderer, sender) = webrender::Renderer::new(window.clone_gl(), notifier, opts, None).unwrap();
let api = sender.create_api();
let document_id = api.add_document(size, 0);