mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 08:15:31 +00:00
Bug 1624016 - Memory report WebRender display list and display item cache r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D68279 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
c7b55e1d51
commit
fa3904e234
@ -766,6 +766,7 @@ WebRenderMemoryReporter::CollectReports(nsIHandleReportCallback* aHandleReport,
|
||||
helper.Report(aReport.rasterized_blobs,
|
||||
"resource-cache/rasterized-blobs");
|
||||
helper.Report(aReport.shader_cache, "shader-cache");
|
||||
helper.Report(aReport.display_list, "display-list");
|
||||
|
||||
WEBRENDER_FOR_EACH_INTERNER(REPORT_INTERNER);
|
||||
WEBRENDER_FOR_EACH_INTERNER(REPORT_DATA_STORE);
|
||||
|
@ -4,7 +4,9 @@
|
||||
|
||||
use api::{BuiltDisplayList, DisplayListWithCache, ColorF, DynamicProperties, Epoch, FontRenderMode};
|
||||
use api::{PipelineId, PropertyBinding, PropertyBindingId, PropertyValue, MixBlendMode, StackingContext};
|
||||
use api::MemoryReport;
|
||||
use api::units::*;
|
||||
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
|
||||
use crate::composite::CompositorKind;
|
||||
use crate::clip::{ClipStore, ClipDataStore};
|
||||
use crate::spatial_tree::{SpatialTree, SpatialNodeIndex};
|
||||
@ -236,6 +238,16 @@ impl Scene {
|
||||
|
||||
false
|
||||
}
|
||||
|
||||
pub fn report_memory(
|
||||
&self,
|
||||
ops: &mut MallocSizeOfOps,
|
||||
report: &mut MemoryReport
|
||||
) {
|
||||
for (_, pipeline) in &self.pipelines {
|
||||
report.display_list += pipeline.display_list.size_of(ops)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub trait StackingContextHelpers {
|
||||
|
@ -694,6 +694,7 @@ impl SceneBuilderThread {
|
||||
let mut report = MemoryReport::default();
|
||||
for doc in self.documents.values() {
|
||||
doc.interners.report_memory(ops, &mut report);
|
||||
doc.scene.report_memory(ops, &mut report);
|
||||
}
|
||||
|
||||
report
|
||||
|
@ -1242,6 +1242,7 @@ pub struct MemoryReport {
|
||||
pub rasterized_blobs: usize,
|
||||
pub shader_cache: usize,
|
||||
pub interning: InterningMemoryReport,
|
||||
pub display_list: usize,
|
||||
|
||||
//
|
||||
// GPU memory.
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
use crate::display_item::*;
|
||||
use crate::display_list::*;
|
||||
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct CachedDisplayItem {
|
||||
@ -21,6 +22,12 @@ impl CachedDisplayItem {
|
||||
}
|
||||
}
|
||||
|
||||
impl MallocSizeOf for CachedDisplayItem {
|
||||
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
|
||||
self.data.size_of(ops)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<DisplayItemRef<'_, '_>> for CachedDisplayItem {
|
||||
fn from(item_ref: DisplayItemRef) -> Self {
|
||||
let item = item_ref.item();
|
||||
@ -38,13 +45,13 @@ impl From<DisplayItemRef<'_, '_>> for CachedDisplayItem {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Deserialize, Serialize)]
|
||||
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
|
||||
struct CacheEntry {
|
||||
items: Vec<CachedDisplayItem>,
|
||||
occupied: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, Deserialize, Serialize)]
|
||||
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
|
||||
pub struct DisplayItemCache {
|
||||
entries: Vec<CacheEntry>,
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ use std::ops::Range;
|
||||
use std::mem;
|
||||
use std::collections::HashMap;
|
||||
use time::precise_time_ns;
|
||||
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
|
||||
// local imports
|
||||
use crate::display_item as di;
|
||||
use crate::display_item_cache::*;
|
||||
@ -172,6 +173,12 @@ impl DisplayListWithCache {
|
||||
}
|
||||
}
|
||||
|
||||
impl MallocSizeOf for DisplayListWithCache {
|
||||
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
|
||||
self.display_list.data.size_of(ops) + self.cache.size_of(ops)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "serialize")]
|
||||
impl Serialize for DisplayListWithCache {
|
||||
fn serialize<S: Serializer>(
|
||||
|
Loading…
Reference in New Issue
Block a user