зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 2 changesets (bug 1711462, bug 1705024) for failures on svg-paint-rect-changes.html. CLOSED TREE
Backed out changeset 40fd0d9fbaa7 (bug 1705024) Backed out changeset 7fe9e5e3e89e (bug 1711462)
This commit is contained in:
Родитель
d40a882a2b
Коммит
35b1f1acc5
|
@ -188,16 +188,6 @@ impl<T, M> LRUCache<T, M> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Manually evict a specific item.
|
||||
pub fn remove(&mut self, handle: &WeakFreeListHandle<M>) -> Option<T> {
|
||||
if let Some(entry) = self.entries.get_opt_mut(handle) {
|
||||
let strong_handle = self.lru[entry.partition_index as usize].remove(entry.lru_index);
|
||||
return Some(self.entries.free(strong_handle).value);
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
|
||||
/// This is used by the calling code to signal that the element that this handle
|
||||
/// references has been used on this frame. Internally, it updates the links in
|
||||
/// the LRU tracking element to move this item to the end of the LRU list. Returns
|
||||
|
|
|
@ -69,7 +69,6 @@ pub struct RenderTaskCacheEntry {
|
|||
user_data: Option<[f32; 4]>,
|
||||
target_kind: RenderTargetKind,
|
||||
is_opaque: bool,
|
||||
frame_id: u64,
|
||||
pub handle: TextureCacheHandle,
|
||||
/// If a render task was generated for this cache entry on _this_ frame,
|
||||
/// we need to track the task id here. This allows us to hook it up as
|
||||
|
@ -90,7 +89,6 @@ pub enum RenderTaskCacheMarker {}
|
|||
pub struct RenderTaskCache {
|
||||
map: FastHashMap<RenderTaskCacheKey, FreeListHandle<RenderTaskCacheMarker>>,
|
||||
cache_entries: FreeList<RenderTaskCacheEntry, RenderTaskCacheMarker>,
|
||||
frame_id: u64,
|
||||
}
|
||||
|
||||
pub type RenderTaskCacheEntryHandle = WeakFreeListHandle<RenderTaskCacheMarker>;
|
||||
|
@ -100,7 +98,6 @@ impl RenderTaskCache {
|
|||
RenderTaskCache {
|
||||
map: FastHashMap::default(),
|
||||
cache_entries: FreeList::new(),
|
||||
frame_id: 0,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -113,7 +110,6 @@ impl RenderTaskCache {
|
|||
&mut self,
|
||||
texture_cache: &mut TextureCache,
|
||||
) {
|
||||
self.frame_id += 1;
|
||||
profile_scope!("begin_frame");
|
||||
// Drop any items from the cache that have been
|
||||
// evicted from the texture cache.
|
||||
|
@ -129,25 +125,15 @@ impl RenderTaskCache {
|
|||
// from here so that this hash map doesn't
|
||||
// grow indefinitely!
|
||||
let cache_entries = &mut self.cache_entries;
|
||||
let frame_id = self.frame_id;
|
||||
|
||||
self.map.retain(|_, handle| {
|
||||
let mut retain = texture_cache.is_allocated(
|
||||
let retain = texture_cache.is_allocated(
|
||||
&cache_entries.get(handle).handle,
|
||||
);
|
||||
if retain {
|
||||
let entry = cache_entries.get_mut(&handle);
|
||||
if frame_id > entry.frame_id + 10 {
|
||||
texture_cache.evict_handle(&entry.handle);
|
||||
retain = false;
|
||||
}
|
||||
}
|
||||
|
||||
if !retain {
|
||||
let handle = mem::replace(handle, FreeListHandle::invalid());
|
||||
cache_entries.free(handle);
|
||||
}
|
||||
|
||||
retain
|
||||
});
|
||||
|
||||
|
@ -237,7 +223,6 @@ impl RenderTaskCache {
|
|||
where
|
||||
F: FnOnce(&mut RenderTaskGraphBuilder) -> Result<RenderTaskId, ()>,
|
||||
{
|
||||
let frame_id = self.frame_id;
|
||||
let size = key.size;
|
||||
// Get the texture cache handle for this cache key,
|
||||
// or create one.
|
||||
|
@ -248,13 +233,11 @@ impl RenderTaskCache {
|
|||
user_data,
|
||||
target_kind: RenderTargetKind::Color, // will be set below.
|
||||
is_opaque,
|
||||
frame_id,
|
||||
render_task_id: None,
|
||||
};
|
||||
cache_entries.insert(entry)
|
||||
});
|
||||
let cache_entry = cache_entries.get_mut(entry_handle);
|
||||
cache_entry.frame_id = self.frame_id;
|
||||
|
||||
// Check if this texture cache handle is valid.
|
||||
if texture_cache.request(&cache_entry.handle, gpu_cache) {
|
||||
|
|
|
@ -228,7 +228,9 @@ struct CachedImageInfo {
|
|||
|
||||
impl CachedImageInfo {
|
||||
fn mark_unused(&mut self, texture_cache: &mut TextureCache) {
|
||||
texture_cache.evict_handle(&self.texture_cache_handle);
|
||||
if self.manual_eviction {
|
||||
texture_cache.evict_manual_handle(&self.texture_cache_handle);
|
||||
}
|
||||
self.manual_eviction = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1217,9 +1217,8 @@ impl TextureCache {
|
|||
|
||||
/// Evict a texture cache handle that was previously set to be in manual
|
||||
/// eviction mode.
|
||||
pub fn evict_handle(&mut self, handle: &TextureCacheHandle) {
|
||||
match handle {
|
||||
TextureCacheHandle::Manual(handle) => {
|
||||
pub fn evict_manual_handle(&mut self, handle: &TextureCacheHandle) {
|
||||
if let TextureCacheHandle::Manual(handle) = handle {
|
||||
// Find the strong handle that matches this weak handle. If this
|
||||
// ever shows up in profiles, we can make it a hash (but the number
|
||||
// of manual eviction handles is typically small).
|
||||
|
@ -1234,13 +1233,6 @@ impl TextureCache {
|
|||
self.evict_impl(entry);
|
||||
}
|
||||
}
|
||||
TextureCacheHandle::Auto(handle) => {
|
||||
if let Some(entry) = self.lru_cache.remove(handle) {
|
||||
self.evict_impl(entry);
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn dump_color8_linear_as_svg(&self, output: &mut dyn std::io::Write) -> std::io::Result<()> {
|
||||
|
@ -1920,7 +1912,7 @@ mod test_texture_cache {
|
|||
assert!(bytes_after_allocating > bytes_at_start);
|
||||
|
||||
for handle in handles {
|
||||
texture_cache.evict_handle(&handle);
|
||||
texture_cache.evict_manual_handle(&handle);
|
||||
}
|
||||
|
||||
let bytes_at_end = texture_cache.total_allocated_bytes_for_testing();
|
||||
|
|
Загрузка…
Ссылка в новой задаче