зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 1 changesets (bug 1671289) for wrench bustages on profiler.rs . CLOSED TREE
Backed out changeset db80ac24d32f (bug 1671289)
This commit is contained in:
Родитель
b19f066d1c
Коммит
1fa351142a
|
@ -53,7 +53,6 @@ class gfxVarReceiver;
|
|||
_(UseWebRenderOptimizedShaders, bool, false) \
|
||||
_(UseWebRenderMultithreading, bool, false) \
|
||||
_(UseWebRenderScissoredCacheClears, bool, true) \
|
||||
_(WebRenderProfilerUI, nsCString, nsCString()) \
|
||||
_(WebglAllowCoreProfile, bool, true) \
|
||||
_(WebglAllowWindowsNativeGl, bool, false) \
|
||||
_(WebRenderMaxPartialPresentRects, int32_t, 0) \
|
||||
|
|
|
@ -2044,7 +2044,6 @@ void CompositorBridgeParent::InitializeStatics() {
|
|||
&UpdateWebRenderMultithreading);
|
||||
gfxVars::SetWebRenderBatchingLookbackListener(
|
||||
&UpdateWebRenderBatchingParameters);
|
||||
gfxVars::SetWebRenderProfilerUIListener(&UpdateWebRenderProfilerUI);
|
||||
}
|
||||
|
||||
/*static*/
|
||||
|
@ -2123,17 +2122,6 @@ void CompositorBridgeParent::UpdateWebRenderBatchingParameters() {
|
|||
});
|
||||
}
|
||||
|
||||
/*static*/
|
||||
void CompositorBridgeParent::UpdateWebRenderProfilerUI() {
|
||||
if (!sIndirectLayerTreesLock) {
|
||||
return;
|
||||
}
|
||||
MonitorAutoLock lock(*sIndirectLayerTreesLock);
|
||||
ForEachWebRenderBridgeParent([&](WebRenderBridgeParent* wrBridge) -> void {
|
||||
wrBridge->UpdateProfilerUI();
|
||||
});
|
||||
}
|
||||
|
||||
RefPtr<WebRenderBridgeParent> CompositorBridgeParent::GetWebRenderBridgeParent()
|
||||
const {
|
||||
return mWrBridge;
|
||||
|
|
|
@ -735,11 +735,6 @@ class CompositorBridgeParent final : public CompositorBridgeParentBase,
|
|||
*/
|
||||
static void UpdateWebRenderBatchingParameters();
|
||||
|
||||
/**
|
||||
* Notify the compositor webrender profiler UI string has been updated.
|
||||
*/
|
||||
static void UpdateWebRenderProfilerUI();
|
||||
|
||||
/**
|
||||
* Wrap the data structure to be sent over IPC.
|
||||
*/
|
||||
|
|
|
@ -362,9 +362,9 @@ WebRenderBridgeParent::WebRenderBridgeParent(
|
|||
MOZ_ASSERT(!mCompositorScheduler);
|
||||
mCompositorScheduler = new CompositorVsyncScheduler(this, mWidget);
|
||||
}
|
||||
|
||||
UpdateDebugFlags();
|
||||
UpdateQualitySettings();
|
||||
UpdateProfilerUI();
|
||||
}
|
||||
|
||||
WebRenderBridgeParent::WebRenderBridgeParent(const wr::PipelineId& aPipelineId,
|
||||
|
@ -1500,11 +1500,6 @@ void WebRenderBridgeParent::UpdateDebugFlags() {
|
|||
mApi->UpdateDebugFlags(gfxVars::WebRenderDebugFlags());
|
||||
}
|
||||
|
||||
void WebRenderBridgeParent::UpdateProfilerUI() {
|
||||
nsCString uiString = gfxVars::GetWebRenderProfilerUIOrDefault();
|
||||
mApi->SetProfilerUI(uiString);
|
||||
}
|
||||
|
||||
void WebRenderBridgeParent::UpdateMultithreading() {
|
||||
mApi->EnableMultithreading(gfxVars::UseWebRenderMultithreading());
|
||||
}
|
||||
|
|
|
@ -130,7 +130,6 @@ class WebRenderBridgeParent final : public PWebRenderBridgeParent,
|
|||
void UpdateDebugFlags();
|
||||
void UpdateMultithreading();
|
||||
void UpdateBatchingParameters();
|
||||
void UpdateProfilerUI();
|
||||
|
||||
mozilla::ipc::IPCResult RecvEnsureConnected(
|
||||
TextureFactoryIdentifier* aTextureFactoryIdentifier,
|
||||
|
|
|
@ -570,14 +570,6 @@ void RecordingPrefChanged(const char* aPrefName, void* aClosure) {
|
|||
|
||||
#define WR_DEBUG_PREF "gfx.webrender.debug"
|
||||
|
||||
static void WebRendeProfilerUIPrefChangeCallback(const char* aPrefName, void*) {
|
||||
nsCString uiString;
|
||||
if (NS_SUCCEEDED(Preferences::GetCString("gfx.webrender.debug.profiler-ui",
|
||||
uiString))) {
|
||||
gfxVars::SetWebRenderProfilerUI(uiString);
|
||||
}
|
||||
}
|
||||
|
||||
static void WebRenderDebugPrefChangeCallback(const char* aPrefName, void*) {
|
||||
wr::DebugFlags flags{0};
|
||||
#define GFX_WEBRENDER_DEBUG(suffix, bit) \
|
||||
|
@ -592,11 +584,18 @@ static void WebRenderDebugPrefChangeCallback(const char* aPrefName, void*) {
|
|||
GFX_WEBRENDER_DEBUG(".gpu-sample-queries", wr::DebugFlags::GPU_SAMPLE_QUERIES)
|
||||
GFX_WEBRENDER_DEBUG(".disable-batching", wr::DebugFlags::DISABLE_BATCHING)
|
||||
GFX_WEBRENDER_DEBUG(".epochs", wr::DebugFlags::EPOCHS)
|
||||
GFX_WEBRENDER_DEBUG(".compact-profiler", wr::DebugFlags::COMPACT_PROFILER)
|
||||
GFX_WEBRENDER_DEBUG(".smart-profiler", wr::DebugFlags::SMART_PROFILER)
|
||||
GFX_WEBRENDER_DEBUG(".echo-driver-messages",
|
||||
wr::DebugFlags::ECHO_DRIVER_MESSAGES)
|
||||
GFX_WEBRENDER_DEBUG(".new-frame-indicator",
|
||||
wr::DebugFlags::NEW_FRAME_INDICATOR)
|
||||
GFX_WEBRENDER_DEBUG(".new-scene-indicator",
|
||||
wr::DebugFlags::NEW_SCENE_INDICATOR)
|
||||
GFX_WEBRENDER_DEBUG(".show-overdraw", wr::DebugFlags::SHOW_OVERDRAW)
|
||||
GFX_WEBRENDER_DEBUG(".gpu-cache", wr::DebugFlags::GPU_CACHE_DBG)
|
||||
GFX_WEBRENDER_DEBUG(".slow-frame-indicator",
|
||||
wr::DebugFlags::SLOW_FRAME_INDICATOR)
|
||||
GFX_WEBRENDER_DEBUG(".texture-cache.clear-evicted",
|
||||
wr::DebugFlags::TEXTURE_CACHE_DBG_CLEAR_EVICTED)
|
||||
GFX_WEBRENDER_DEBUG(".picture-caching", wr::DebugFlags::PICTURE_CACHING_DBG)
|
||||
|
@ -1386,8 +1385,6 @@ void gfxPlatform::ShutdownLayersIPC() {
|
|||
|
||||
Preferences::UnregisterCallback(WebRenderDebugPrefChangeCallback,
|
||||
WR_DEBUG_PREF);
|
||||
Preferences::UnregisterCallback(WebRendeProfilerUIPrefChangeCallback,
|
||||
"gfx.webrender.debug.profiler-ui");
|
||||
}
|
||||
|
||||
} else {
|
||||
|
@ -2799,9 +2796,6 @@ void gfxPlatform::InitWebRenderConfig() {
|
|||
|
||||
Preferences::RegisterPrefixCallbackAndCall(WebRenderDebugPrefChangeCallback,
|
||||
WR_DEBUG_PREF);
|
||||
Preferences::RegisterPrefixCallbackAndCall(
|
||||
WebRendeProfilerUIPrefChangeCallback,
|
||||
"gfx.webrender.debug.profiler-ui");
|
||||
Preferences::RegisterCallback(
|
||||
WebRenderQualityPrefChangeCallback,
|
||||
nsDependentCString(
|
||||
|
|
|
@ -394,24 +394,6 @@ void RenderThread::SetClearColor(wr::WindowId aWindowId, wr::ColorF aColor) {
|
|||
}
|
||||
}
|
||||
|
||||
void RenderThread::SetProfilerUI(wr::WindowId aWindowId, nsCString aUI) {
|
||||
if (mHasShutdown) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IsInRenderThread()) {
|
||||
Loop()->PostTask(NewRunnableMethod<wr::WindowId, nsCString>(
|
||||
"wr::RenderThread::SetProfilerUI", this, &RenderThread::SetProfilerUI,
|
||||
aWindowId, aUI));
|
||||
return;
|
||||
}
|
||||
|
||||
auto it = mRenderers.find(aWindowId);
|
||||
if (it != mRenderers.end()) {
|
||||
it->second->SetProfilerUI(aUI);
|
||||
}
|
||||
}
|
||||
|
||||
void RenderThread::RunEvent(wr::WindowId aWindowId,
|
||||
UniquePtr<RendererEvent> aEvent) {
|
||||
if (!IsInRenderThread()) {
|
||||
|
|
|
@ -179,9 +179,6 @@ class RenderThread final {
|
|||
/// Automatically forwarded to the render thread.
|
||||
void SetClearColor(wr::WindowId aWindowId, wr::ColorF aColor);
|
||||
|
||||
/// Automatically forwarded to the render thread.
|
||||
void SetProfilerUI(wr::WindowId aWindowId, nsCString aUI);
|
||||
|
||||
/// Automatically forwarded to the render thread.
|
||||
void PipelineSizeChanged(wr::WindowId aWindowId, uint64_t aPipelineId,
|
||||
float aWidth, float aHeight);
|
||||
|
|
|
@ -436,10 +436,5 @@ void RendererOGL::AccumulateMemoryReport(MemoryReport* aReport) {
|
|||
aReport->swap_chain += swapChainSize;
|
||||
}
|
||||
|
||||
void RendererOGL::SetProfilerUI(const nsCString& aUI) {
|
||||
wr_renderer_set_profiler_ui(GetRenderer(), (const uint8_t*)aUI.get(),
|
||||
aUI.Length());
|
||||
}
|
||||
|
||||
} // namespace wr
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -115,8 +115,6 @@ class RendererOGL {
|
|||
|
||||
void AccumulateMemoryReport(MemoryReport* aReport);
|
||||
|
||||
void SetProfilerUI(const nsCString& aUI);
|
||||
|
||||
wr::Renderer* GetRenderer() { return mRenderer; }
|
||||
|
||||
gl::GLContext* gl() const;
|
||||
|
|
|
@ -542,10 +542,6 @@ void WebRenderAPI::SetClearColor(const gfx::DeviceColor& aColor) {
|
|||
RenderThread::Get()->SetClearColor(mId, ToColorF(aColor));
|
||||
}
|
||||
|
||||
void WebRenderAPI::SetProfilerUI(const nsCString& aUIString) {
|
||||
RenderThread::Get()->SetProfilerUI(mId, aUIString);
|
||||
}
|
||||
|
||||
void WebRenderAPI::Pause() {
|
||||
class PauseEvent : public RendererEvent {
|
||||
public:
|
||||
|
|
|
@ -258,7 +258,6 @@ class WebRenderAPI final {
|
|||
void SetBatchingLookback(uint32_t aCount);
|
||||
|
||||
void SetClearColor(const gfx::DeviceColor& aColor);
|
||||
void SetProfilerUI(const nsCString& aUIString);
|
||||
|
||||
void Pause();
|
||||
bool Resume();
|
||||
|
|
|
@ -743,14 +743,6 @@ pub unsafe extern "C" fn wr_renderer_readback(
|
|||
renderer.read_pixels_into(FramebufferIntSize::new(width, height).into(), format, &mut slice);
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn wr_renderer_set_profiler_ui(renderer: &mut Renderer, ui_str: *const u8, ui_str_len: usize) {
|
||||
let slice = std::slice::from_raw_parts(ui_str, ui_str_len);
|
||||
if let Ok(ui_str) = std::str::from_utf8(slice) {
|
||||
renderer.set_profiler_ui(ui_str);
|
||||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn wr_renderer_delete(renderer: *mut Renderer) {
|
||||
let renderer = Box::from_raw(renderer);
|
||||
|
|
|
@ -254,10 +254,14 @@ pub fn main_wrapper<E: Example>(
|
|||
winit::VirtualKeyCode::P => debug_flags.toggle(DebugFlags::PROFILER_DBG),
|
||||
winit::VirtualKeyCode::O => debug_flags.toggle(DebugFlags::RENDER_TARGET_DBG),
|
||||
winit::VirtualKeyCode::I => debug_flags.toggle(DebugFlags::TEXTURE_CACHE_DBG),
|
||||
winit::VirtualKeyCode::S => debug_flags.toggle(DebugFlags::COMPACT_PROFILER),
|
||||
winit::VirtualKeyCode::T => debug_flags.toggle(DebugFlags::PICTURE_CACHING_DBG),
|
||||
winit::VirtualKeyCode::Q => debug_flags.toggle(
|
||||
DebugFlags::GPU_TIME_QUERIES | DebugFlags::GPU_SAMPLE_QUERIES
|
||||
),
|
||||
winit::VirtualKeyCode::F => debug_flags.toggle(
|
||||
DebugFlags::NEW_FRAME_INDICATOR | DebugFlags::NEW_SCENE_INDICATOR
|
||||
),
|
||||
winit::VirtualKeyCode::G => debug_flags.toggle(DebugFlags::GPU_CACHE_DBG),
|
||||
winit::VirtualKeyCode::Key1 => txn.set_document_view(
|
||||
device_size.into(),
|
||||
|
|
|
@ -218,6 +218,7 @@ fn main() {
|
|||
};
|
||||
|
||||
let opts = webrender::RendererOptions {
|
||||
debug_flags: webrender::DebugFlags::NEW_FRAME_INDICATOR | webrender::DebugFlags::NEW_SCENE_INDICATOR,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ use crate::api::SharedFontInstanceMap;
|
|||
use crate::api::units::*;
|
||||
use crate::render_api::{ResourceUpdate, TransactionMsg, AddFont};
|
||||
use crate::image_tiling::*;
|
||||
use crate::profiler;
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
|
@ -165,8 +164,6 @@ impl ApiResources {
|
|||
}
|
||||
|
||||
let (rasterizer, requests) = self.create_blob_scene_builder_requests(&blobs_to_rasterize);
|
||||
transaction.profile.set(profiler::RASTERIZED_BLOBS, blobs_to_rasterize.len());
|
||||
transaction.profile.set(profiler::RASTERIZED_BLOB_TILES, requests.len());
|
||||
transaction.use_scene_builder_thread |= !requests.is_empty();
|
||||
transaction.use_scene_builder_thread |= !transaction.scene_ops.is_empty();
|
||||
transaction.blob_rasterizer = rasterizer;
|
||||
|
|
|
@ -1400,7 +1400,6 @@ impl intern::Internable for ClipIntern {
|
|||
type Key = ClipItemKey;
|
||||
type StoreData = ClipNode;
|
||||
type InternData = ClipInternData;
|
||||
const PROFILE_COUNTER: usize = crate::profiler::INTERNED_CLIPS;
|
||||
}
|
||||
|
||||
#[derive(Debug, MallocSizeOf)]
|
||||
|
|
|
@ -162,7 +162,6 @@ impl intern::Internable for FilterDataIntern {
|
|||
type Key = SFilterDataKey;
|
||||
type StoreData = SFilterDataTemplate;
|
||||
type InternData = ();
|
||||
const PROFILE_COUNTER: usize = crate::profiler::INTERNED_FILTER_DATA;
|
||||
}
|
||||
|
||||
fn push_component_transfer_data(
|
||||
|
|
|
@ -19,7 +19,7 @@ use crate::picture::{BackdropKind, SubpixelMode, TileCacheLogger, RasterConfig,
|
|||
use crate::prepare::prepare_primitives;
|
||||
use crate::prim_store::{PictureIndex, PrimitiveDebugId};
|
||||
use crate::prim_store::{DeferredResolve};
|
||||
use crate::profiler::{self, TransactionProfile};
|
||||
use crate::profiler::{FrameProfileCounters, TextureCacheProfileCounters, ResourceProfileCounters};
|
||||
use crate::render_backend::{DataStores, FrameStamp, FrameId, ScratchBuffer};
|
||||
use crate::render_target::{RenderTarget, PictureCacheTarget, TextureCacheRenderTarget};
|
||||
use crate::render_target::{RenderTargetContext, RenderTargetKind};
|
||||
|
@ -176,6 +176,7 @@ pub struct FrameBuildingContext<'a> {
|
|||
|
||||
pub struct FrameBuildingState<'a> {
|
||||
pub render_tasks: &'a mut RenderTaskGraph,
|
||||
pub profile_counters: &'a mut FrameProfileCounters,
|
||||
pub clip_store: &'a mut ClipStore,
|
||||
pub resource_cache: &'a mut ResourceCache,
|
||||
pub gpu_cache: &'a mut GpuCache,
|
||||
|
@ -184,7 +185,6 @@ pub struct FrameBuildingState<'a> {
|
|||
pub surfaces: &'a mut Vec<SurfaceInfo>,
|
||||
pub dirty_region_stack: Vec<DirtyRegion>,
|
||||
pub composite_state: &'a mut CompositeState,
|
||||
pub num_visible_primitives: u32,
|
||||
}
|
||||
|
||||
impl<'a> FrameBuildingState<'a> {
|
||||
|
@ -248,16 +248,17 @@ impl FrameBuilder {
|
|||
resource_cache: &mut ResourceCache,
|
||||
gpu_cache: &mut GpuCache,
|
||||
render_tasks: &mut RenderTaskGraph,
|
||||
profile_counters: &mut FrameProfileCounters,
|
||||
global_device_pixel_scale: DevicePixelScale,
|
||||
scene_properties: &SceneProperties,
|
||||
transform_palette: &mut TransformPalette,
|
||||
data_stores: &mut DataStores,
|
||||
scratch: &mut ScratchBuffer,
|
||||
debug_flags: DebugFlags,
|
||||
texture_cache_profile: &mut TextureCacheProfileCounters,
|
||||
composite_state: &mut CompositeState,
|
||||
tile_cache_logger: &mut TileCacheLogger,
|
||||
tile_caches: &mut FastHashMap<SliceId, Box<TileCacheInstance>>,
|
||||
profile: &mut TransactionProfile,
|
||||
) -> Option<RenderTaskId> {
|
||||
profile_scope!("build_layer_screen_rects_and_cull_layers");
|
||||
|
||||
|
@ -334,7 +335,6 @@ impl FrameBuilder {
|
|||
{
|
||||
profile_scope!("UpdateVisibility");
|
||||
profile_marker!("UpdateVisibility");
|
||||
profile.start_time(profiler::FRAME_VISIBILITY_TIME);
|
||||
|
||||
let visibility_context = FrameVisibilityContext {
|
||||
global_device_pixel_scale,
|
||||
|
@ -371,14 +371,11 @@ impl FrameBuilder {
|
|||
|
||||
visibility_state.scratch.frame.clip_chain_stack = visibility_state.clip_chain_stack.take();
|
||||
visibility_state.scratch.frame.surface_stack = visibility_state.surface_stack.take();
|
||||
|
||||
profile.end_time(profiler::FRAME_VISIBILITY_TIME);
|
||||
}
|
||||
|
||||
profile.start_time(profiler::FRAME_PREPARE_TIME);
|
||||
|
||||
let mut frame_state = FrameBuildingState {
|
||||
render_tasks,
|
||||
profile_counters,
|
||||
clip_store: &mut scene.clip_store,
|
||||
resource_cache,
|
||||
gpu_cache,
|
||||
|
@ -387,7 +384,6 @@ impl FrameBuilder {
|
|||
surfaces: &mut surfaces,
|
||||
dirty_region_stack: scratch.frame.dirty_region_stack.take(),
|
||||
composite_state,
|
||||
num_visible_primitives: 0,
|
||||
};
|
||||
|
||||
frame_state
|
||||
|
@ -457,8 +453,6 @@ impl FrameBuilder {
|
|||
);
|
||||
|
||||
frame_state.pop_dirty_region();
|
||||
profile.end_time(profiler::FRAME_PREPARE_TIME);
|
||||
profile.set(profiler::VISIBLE_PRIMITIVES, frame_state.num_visible_primitives);
|
||||
|
||||
scratch.frame.dirty_region_stack = frame_state.dirty_region_stack.take();
|
||||
scratch.frame.surfaces = surfaces.take();
|
||||
|
@ -466,11 +460,9 @@ impl FrameBuilder {
|
|||
{
|
||||
profile_marker!("BlockOnResources");
|
||||
|
||||
resource_cache.block_until_all_resources_added(
|
||||
gpu_cache,
|
||||
render_tasks,
|
||||
profile,
|
||||
);
|
||||
resource_cache.block_until_all_resources_added(gpu_cache,
|
||||
render_tasks,
|
||||
texture_cache_profile);
|
||||
}
|
||||
|
||||
Some(root_render_task_id)
|
||||
|
@ -486,6 +478,7 @@ impl FrameBuilder {
|
|||
layer: DocumentLayer,
|
||||
device_origin: DeviceIntPoint,
|
||||
pan: WorldPoint,
|
||||
resource_profile: &mut ResourceProfileCounters,
|
||||
scene_properties: &SceneProperties,
|
||||
data_stores: &mut DataStores,
|
||||
scratch: &mut ScratchBuffer,
|
||||
|
@ -494,13 +487,15 @@ impl FrameBuilder {
|
|||
tile_cache_logger: &mut TileCacheLogger,
|
||||
tile_caches: &mut FastHashMap<SliceId, Box<TileCacheInstance>>,
|
||||
dirty_rects_are_valid: bool,
|
||||
profile: &mut TransactionProfile,
|
||||
) -> Frame {
|
||||
profile_scope!("build");
|
||||
profile_marker!("BuildFrame");
|
||||
|
||||
profile.set(profiler::PRIMITIVES, scene.prim_store.prim_count());
|
||||
profile.set(profiler::PICTURE_CACHE_SLICES, scene.tile_cache_config.picture_cache_slice_count);
|
||||
let mut profile_counters = FrameProfileCounters::new();
|
||||
profile_counters
|
||||
.total_primitives
|
||||
.set(scene.prim_store.prim_count());
|
||||
resource_profile.picture_cache_slices.set(scene.tile_cache_config.picture_cache_slice_count);
|
||||
resource_cache.begin_frame(stamp);
|
||||
gpu_cache.begin_frame(stamp);
|
||||
|
||||
|
@ -537,20 +532,19 @@ impl FrameBuilder {
|
|||
resource_cache,
|
||||
gpu_cache,
|
||||
&mut render_tasks,
|
||||
&mut profile_counters,
|
||||
global_device_pixel_scale,
|
||||
scene_properties,
|
||||
&mut transform_palette,
|
||||
data_stores,
|
||||
scratch,
|
||||
debug_flags,
|
||||
&mut resource_profile.texture_cache,
|
||||
&mut composite_state,
|
||||
tile_cache_logger,
|
||||
tile_caches,
|
||||
profile,
|
||||
);
|
||||
|
||||
profile.start_time(profiler::FRAME_BATCHING_TIME);
|
||||
|
||||
let mut passes;
|
||||
let mut deferred_resolves = vec![];
|
||||
let mut has_texture_cache_tasks = false;
|
||||
|
@ -617,13 +611,11 @@ impl FrameBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
profile.end_time(profiler::FRAME_BATCHING_TIME);
|
||||
|
||||
let gpu_cache_frame_id = gpu_cache.end_frame(profile).frame_id();
|
||||
let gpu_cache_frame_id = gpu_cache.end_frame(&mut resource_profile.gpu_cache).frame_id();
|
||||
|
||||
render_tasks.write_task_data();
|
||||
*render_task_counters = render_tasks.counters();
|
||||
resource_cache.end_frame(profile);
|
||||
resource_cache.end_frame(&mut resource_profile.texture_cache);
|
||||
|
||||
self.prim_headers_prealloc.record_vec(&mut prim_headers.headers_int);
|
||||
self.composite_state_prealloc.record(&composite_state);
|
||||
|
@ -635,6 +627,7 @@ impl FrameBuilder {
|
|||
scene.output_rect.size,
|
||||
),
|
||||
layer,
|
||||
profile_counters,
|
||||
passes,
|
||||
transform_palette: transform_palette.finish(),
|
||||
render_tasks,
|
||||
|
@ -995,6 +988,8 @@ pub struct Frame {
|
|||
pub device_rect: DeviceIntRect,
|
||||
pub layer: DocumentLayer,
|
||||
pub passes: Vec<RenderPass>,
|
||||
#[cfg_attr(any(feature = "capture", feature = "replay"), serde(default = "FrameProfileCounters::new", skip))]
|
||||
pub profile_counters: FrameProfileCounters,
|
||||
|
||||
pub transform_palette: Vec<TransformData>,
|
||||
pub render_tasks: RenderTaskGraph,
|
||||
|
|
|
@ -19,7 +19,7 @@ use crate::texture_cache::{TextureCache, TextureCacheHandle, Eviction};
|
|||
use crate::gpu_cache::GpuCache;
|
||||
use crate::render_task_graph::RenderTaskGraph;
|
||||
use crate::render_task_cache::RenderTaskCache;
|
||||
use crate::profiler::{self, TransactionProfile};
|
||||
use crate::profiler::TextureCacheProfileCounters;
|
||||
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
|
||||
use rayon::ThreadPool;
|
||||
use rayon::prelude::*;
|
||||
|
@ -100,7 +100,6 @@ impl GlyphRasterizer {
|
|||
// Increment the total number of glyphs that are pending. This is used to determine
|
||||
// later whether to use worker threads for the remaining glyphs during resolve time.
|
||||
self.pending_glyph_count += 1;
|
||||
self.glyph_request_count += 1;
|
||||
|
||||
// Find a batch container for the font instance for this glyph. Use get_mut to avoid
|
||||
// cloning the font instance, since this is the common path.
|
||||
|
@ -220,10 +219,8 @@ impl GlyphRasterizer {
|
|||
gpu_cache: &mut GpuCache,
|
||||
_: &mut RenderTaskCache,
|
||||
_: &mut RenderTaskGraph,
|
||||
profile: &mut TransactionProfile,
|
||||
_: &mut TextureCacheProfileCounters,
|
||||
) {
|
||||
profile.start_time(profiler::GLYPH_RESOLVE_TIME);
|
||||
|
||||
// Work around the borrow checker, since we call flush_glyph_requests below
|
||||
let mut pending_glyph_requests = mem::replace(
|
||||
&mut self.pending_glyph_requests,
|
||||
|
@ -244,11 +241,6 @@ impl GlyphRasterizer {
|
|||
debug_assert_eq!(self.pending_glyph_count, 0);
|
||||
debug_assert!(self.pending_glyph_requests.is_empty());
|
||||
|
||||
if self.glyph_request_count > 0 {
|
||||
profile.set(profiler::RASTERIZED_GLYPHS, self.glyph_request_count);
|
||||
self.glyph_request_count = 0;
|
||||
}
|
||||
|
||||
profile_scope!("resolve_glyphs");
|
||||
// Pull rasterized glyphs from the queue and update the caches.
|
||||
while self.pending_glyph_jobs > 0 {
|
||||
|
@ -315,8 +307,6 @@ impl GlyphRasterizer {
|
|||
// Now that we are done with the critical path (rendering the glyphs),
|
||||
// we can schedule removing the fonts if needed.
|
||||
self.remove_dead_fonts();
|
||||
|
||||
profile.end_time(profiler::GLYPH_RESOLVE_TIME);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -946,9 +936,6 @@ pub struct GlyphRasterizer {
|
|||
/// The current number of glyph request jobs that have been kicked to worker threads.
|
||||
pending_glyph_jobs: usize,
|
||||
|
||||
/// The number of glyphs requested this frame.
|
||||
glyph_request_count: usize,
|
||||
|
||||
/// A map of current glyph request batches.
|
||||
pending_glyph_requests: FastHashMap<FontInstance, SmallVec<[GlyphKey; 16]>>,
|
||||
|
||||
|
@ -993,7 +980,6 @@ impl GlyphRasterizer {
|
|||
font_contexts: Arc::new(font_context),
|
||||
pending_glyph_jobs: 0,
|
||||
pending_glyph_count: 0,
|
||||
glyph_request_count: 0,
|
||||
glyph_rx,
|
||||
glyph_tx,
|
||||
workers,
|
||||
|
@ -1074,7 +1060,6 @@ impl GlyphRasterizer {
|
|||
//TODO: any signals need to be sent to the workers?
|
||||
self.pending_glyph_jobs = 0;
|
||||
self.pending_glyph_count = 0;
|
||||
self.glyph_request_count = 0;
|
||||
self.fonts_to_remove.clear();
|
||||
self.font_instances_to_remove.clear();
|
||||
}
|
||||
|
@ -1137,7 +1122,7 @@ mod test_glyph_rasterizer {
|
|||
use crate::gpu_cache::GpuCache;
|
||||
use crate::render_task_cache::RenderTaskCache;
|
||||
use crate::render_task_graph::{RenderTaskGraph, RenderTaskGraphCounters};
|
||||
use crate::profiler::TransactionProfile;
|
||||
use crate::profiler::TextureCacheProfileCounters;
|
||||
use api::{FontKey, FontInstanceKey, FontSize, FontTemplate, FontRenderMode,
|
||||
IdNamespace, ColorU};
|
||||
use api::units::DevicePoint;
|
||||
|
@ -1208,7 +1193,7 @@ mod test_glyph_rasterizer {
|
|||
&mut gpu_cache,
|
||||
&mut render_task_cache,
|
||||
&mut render_task_tree,
|
||||
&mut TransactionProfile::new(),
|
||||
&mut TextureCacheProfileCounters::new(),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ use api::IdNamespace;
|
|||
use api::units::*;
|
||||
use euclid::{HomogeneousVector, Rect};
|
||||
use crate::internal_types::{FastHashMap, FastHashSet};
|
||||
use crate::profiler::{self, TransactionProfile};
|
||||
use crate::profiler::GpuCacheProfileCounters;
|
||||
use crate::render_backend::{FrameStamp, FrameId};
|
||||
use crate::prim_store::VECS_PER_SEGMENT;
|
||||
use crate::renderer::MAX_VERTEX_TEXTURE_WIDTH;
|
||||
|
@ -865,12 +865,18 @@ impl GpuCache {
|
|||
/// device specific cache texture.
|
||||
pub fn end_frame(
|
||||
&mut self,
|
||||
profile: &mut TransactionProfile,
|
||||
profile_counters: &mut GpuCacheProfileCounters,
|
||||
) -> FrameStamp {
|
||||
profile_scope!("end_frame");
|
||||
profile.set(profiler::GPU_CACHE_ROWS_TOTAL, self.texture.rows.len());
|
||||
profile.set(profiler::GPU_CACHE_BLOCKS_TOTAL, self.texture.allocated_block_count);
|
||||
profile.set(profiler::GPU_CACHE_BLOCKS_SAVED, self.saved_block_count);
|
||||
profile_counters
|
||||
.allocated_rows
|
||||
.set(self.texture.rows.len());
|
||||
profile_counters
|
||||
.allocated_blocks
|
||||
.set(self.texture.allocated_block_count);
|
||||
profile_counters
|
||||
.saved_blocks
|
||||
.set(self.saved_block_count);
|
||||
|
||||
let reached_threshold =
|
||||
self.texture.rows.len() > (GPU_CACHE_INITIAL_HEIGHT as usize) &&
|
||||
|
|
|
@ -35,12 +35,12 @@
|
|||
|
||||
use crate::internal_types::FastHashMap;
|
||||
use malloc_size_of::MallocSizeOf;
|
||||
use crate::profiler::ResourceProfileCounter;
|
||||
use std::fmt::Debug;
|
||||
use std::hash::Hash;
|
||||
use std::marker::PhantomData;
|
||||
use std::{ops, u64};
|
||||
use std::{mem, ops, u64};
|
||||
use crate::util::VecHelper;
|
||||
use crate::profiler::TransactionProfile;
|
||||
|
||||
#[cfg_attr(feature = "capture", derive(Serialize))]
|
||||
#[cfg_attr(feature = "replay", derive(Deserialize))]
|
||||
|
@ -166,7 +166,7 @@ impl<I: Internable> DataStore<I> {
|
|||
pub fn apply_updates(
|
||||
&mut self,
|
||||
update_list: UpdateList<I::Key>,
|
||||
profile: &mut TransactionProfile,
|
||||
profile_counter: &mut ResourceProfileCounter,
|
||||
) {
|
||||
for insertion in update_list.insertions {
|
||||
self.items
|
||||
|
@ -178,7 +178,8 @@ impl<I: Internable> DataStore<I> {
|
|||
self.items[removal.index] = None;
|
||||
}
|
||||
|
||||
profile.set(I::PROFILE_COUNTER, self.items.len());
|
||||
let per_item_size = mem::size_of::<I::Key>() + mem::size_of::<I::StoreData>();
|
||||
profile_counter.set(self.items.len(), per_item_size * self.items.len());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -459,7 +460,4 @@ pub trait Internable: MallocSizeOf {
|
|||
type Key: Eq + Hash + Clone + Debug + MallocSizeOf + InternDebug + InternSerialize + for<'a> InternDeserialize<'a>;
|
||||
type StoreData: From<Self::Key> + MallocSizeOf + InternSerialize + for<'a> InternDeserialize<'a>;
|
||||
type InternData: MallocSizeOf + InternSerialize + for<'a> InternDeserialize<'a>;
|
||||
|
||||
// Profile counter indices, see the list in profiler.rs
|
||||
const PROFILE_COUNTER: usize;
|
||||
}
|
||||
|
|
|
@ -12,9 +12,9 @@ use crate::device::TextureFilter;
|
|||
use crate::renderer::PipelineInfo;
|
||||
use crate::gpu_cache::GpuCacheUpdateList;
|
||||
use crate::frame_builder::Frame;
|
||||
use crate::profiler::TransactionProfile;
|
||||
use fxhash::FxHasher;
|
||||
use plane_split::BspSplitter;
|
||||
use crate::profiler::BackendProfileCounters;
|
||||
use smallvec::SmallVec;
|
||||
use std::{usize, i32};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
|
@ -539,7 +539,6 @@ impl ResourceUpdateList {
|
|||
pub struct RenderedDocument {
|
||||
pub frame: Frame,
|
||||
pub is_new_scene: bool,
|
||||
pub profile: TransactionProfile,
|
||||
}
|
||||
|
||||
pub enum DebugOutput {
|
||||
|
@ -566,6 +565,7 @@ pub enum ResultMsg {
|
|||
DocumentId,
|
||||
RenderedDocument,
|
||||
ResourceUpdateList,
|
||||
BackendProfileCounters,
|
||||
),
|
||||
AppendNotificationRequests(Vec<NotificationRequest>),
|
||||
ForceRedraw,
|
||||
|
|
|
@ -128,7 +128,7 @@ pub fn prepare_primitives(
|
|||
tile_cache_log,
|
||||
tile_caches,
|
||||
) {
|
||||
frame_state.num_visible_primitives += 1;
|
||||
frame_state.profile_counters.visible_primitives.inc();
|
||||
} else {
|
||||
prim_instance.clear_visibility();
|
||||
}
|
||||
|
|
|
@ -74,7 +74,6 @@ impl Internable for Backdrop {
|
|||
type Key = BackdropKey;
|
||||
type StoreData = BackdropTemplate;
|
||||
type InternData = ();
|
||||
const PROFILE_COUNTER: usize = crate::profiler::INTERNED_BACKDROPS;
|
||||
}
|
||||
|
||||
impl InternablePrimitive for Backdrop {
|
||||
|
|
|
@ -145,7 +145,6 @@ impl intern::Internable for NormalBorderPrim {
|
|||
type Key = NormalBorderKey;
|
||||
type StoreData = NormalBorderTemplate;
|
||||
type InternData = ();
|
||||
const PROFILE_COUNTER: usize = crate::profiler::INTERNED_NORMAL_BORDERS;
|
||||
}
|
||||
|
||||
impl InternablePrimitive for NormalBorderPrim {
|
||||
|
@ -319,7 +318,6 @@ impl intern::Internable for ImageBorder {
|
|||
type Key = ImageBorderKey;
|
||||
type StoreData = ImageBorderTemplate;
|
||||
type InternData = ();
|
||||
const PROFILE_COUNTER: usize = crate::profiler::INTERNED_IMAGE_BORDERS;
|
||||
}
|
||||
|
||||
impl InternablePrimitive for ImageBorder {
|
||||
|
|
|
@ -321,7 +321,6 @@ impl Internable for LinearGradient {
|
|||
type Key = LinearGradientKey;
|
||||
type StoreData = LinearGradientTemplate;
|
||||
type InternData = ();
|
||||
const PROFILE_COUNTER: usize = crate::profiler::INTERNED_LINEAR_GRADIENTS;
|
||||
}
|
||||
|
||||
impl InternablePrimitive for LinearGradient {
|
||||
|
@ -551,7 +550,6 @@ impl Internable for RadialGradient {
|
|||
type Key = RadialGradientKey;
|
||||
type StoreData = RadialGradientTemplate;
|
||||
type InternData = ();
|
||||
const PROFILE_COUNTER: usize = crate::profiler::INTERNED_RADIAL_GRADIENTS;
|
||||
}
|
||||
|
||||
impl InternablePrimitive for RadialGradient {
|
||||
|
@ -771,7 +769,6 @@ impl Internable for ConicGradient {
|
|||
type Key = ConicGradientKey;
|
||||
type StoreData = ConicGradientTemplate;
|
||||
type InternData = ();
|
||||
const PROFILE_COUNTER: usize = crate::profiler::INTERNED_CONIC_GRADIENTS;
|
||||
}
|
||||
|
||||
impl InternablePrimitive for ConicGradient {
|
||||
|
|
|
@ -288,7 +288,6 @@ impl Internable for Image {
|
|||
type Key = ImageKey;
|
||||
type StoreData = ImageTemplate;
|
||||
type InternData = ();
|
||||
const PROFILE_COUNTER: usize = crate::profiler::INTERNED_IMAGES;
|
||||
}
|
||||
|
||||
impl InternablePrimitive for Image {
|
||||
|
@ -461,7 +460,6 @@ impl Internable for YuvImage {
|
|||
type Key = YuvImageKey;
|
||||
type StoreData = YuvImageTemplate;
|
||||
type InternData = ();
|
||||
const PROFILE_COUNTER: usize = crate::profiler::INTERNED_YUV_IMAGES;
|
||||
}
|
||||
|
||||
impl InternablePrimitive for YuvImage {
|
||||
|
|
|
@ -126,7 +126,6 @@ impl intern::Internable for LineDecoration {
|
|||
type Key = LineDecorationKey;
|
||||
type StoreData = LineDecorationTemplate;
|
||||
type InternData = ();
|
||||
const PROFILE_COUNTER: usize = crate::profiler::INTERNED_LINE_DECORATIONS;
|
||||
}
|
||||
|
||||
impl InternablePrimitive for LineDecoration {
|
||||
|
|
|
@ -577,7 +577,6 @@ impl intern::Internable for PrimitiveKeyKind {
|
|||
type Key = PrimitiveKey;
|
||||
type StoreData = PrimitiveTemplate;
|
||||
type InternData = ();
|
||||
const PROFILE_COUNTER: usize = crate::profiler::INTERNED_PRIMITIVES;
|
||||
}
|
||||
|
||||
impl InternablePrimitive for PrimitiveKeyKind {
|
||||
|
|
|
@ -277,7 +277,6 @@ impl Internable for Picture {
|
|||
type Key = PictureKey;
|
||||
type StoreData = PictureTemplate;
|
||||
type InternData = ();
|
||||
const PROFILE_COUNTER: usize = crate::profiler::INTERNED_PICTURES;
|
||||
}
|
||||
|
||||
impl InternablePrimitive for Picture {
|
||||
|
|
|
@ -151,7 +151,6 @@ impl intern::Internable for TextRun {
|
|||
type Key = TextRunKey;
|
||||
type StoreData = TextRunTemplate;
|
||||
type InternData = ();
|
||||
const PROFILE_COUNTER: usize = crate::profiler::INTERNED_TEXT_RUNS;
|
||||
}
|
||||
|
||||
impl InternablePrimitive for TextRun {
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -27,7 +27,6 @@ use crate::api::units::*;
|
|||
use crate::api_resources::ApiResources;
|
||||
use crate::scene_builder_thread::{SceneBuilderRequest, SceneBuilderResult};
|
||||
use crate::intern::InterningMemoryReport;
|
||||
use crate::profiler::{self, TransactionProfile};
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
|
@ -389,7 +388,6 @@ impl Transaction {
|
|||
blob_rasterizer: None,
|
||||
blob_requests: Vec::new(),
|
||||
rasterized_blobs: Vec::new(),
|
||||
profile: TransactionProfile::new(),
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -573,8 +571,6 @@ pub struct TransactionMsg {
|
|||
pub blob_requests: Vec<BlobImageParams>,
|
||||
///
|
||||
pub rasterized_blobs: Vec<(BlobImageRequest, BlobImageResult)>,
|
||||
/// Collect various data along the rendering pipeline to display it in the embedded profiler.
|
||||
pub profile: TransactionProfile,
|
||||
}
|
||||
|
||||
impl fmt::Debug for TransactionMsg {
|
||||
|
@ -1236,7 +1232,6 @@ impl RenderApi {
|
|||
blob_rasterizer: None,
|
||||
blob_requests: Vec::new(),
|
||||
rasterized_blobs: Vec::new(),
|
||||
profile: TransactionProfile::new(),
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -1255,7 +1250,6 @@ impl RenderApi {
|
|||
blob_rasterizer: None,
|
||||
blob_requests: Vec::new(),
|
||||
rasterized_blobs: Vec::new(),
|
||||
profile: TransactionProfile::new(),
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -1286,10 +1280,6 @@ impl RenderApi {
|
|||
self.resources.update(&mut transaction);
|
||||
|
||||
transaction.use_scene_builder_thread |= !transaction.scene_ops.is_empty();
|
||||
if transaction.generate_frame {
|
||||
transaction.profile.start_time(profiler::API_SEND_TIME);
|
||||
transaction.profile.start_time(profiler::TOTAL_FRAME_CPU_TIME);
|
||||
}
|
||||
|
||||
if transaction.use_scene_builder_thread {
|
||||
let sender = if transaction.low_priority {
|
||||
|
@ -1311,10 +1301,6 @@ impl RenderApi {
|
|||
.map(|(txn, id)| {
|
||||
let mut txn = txn.finalize(id);
|
||||
self.resources.update(&mut txn);
|
||||
if txn.generate_frame {
|
||||
txn.profile.start_time(profiler::API_SEND_TIME);
|
||||
txn.profile.start_time(profiler::TOTAL_FRAME_CPU_TIME);
|
||||
}
|
||||
|
||||
txn
|
||||
})
|
||||
|
|
|
@ -38,7 +38,7 @@ use crate::picture::{TileCacheLogger, PictureScratchBuffer, SliceId, TileCacheIn
|
|||
use crate::prim_store::{PrimitiveScratchBuffer, PrimitiveInstance};
|
||||
use crate::prim_store::{PrimitiveInstanceKind, PrimTemplateCommonData, PrimitiveStore};
|
||||
use crate::prim_store::interned::*;
|
||||
use crate::profiler::{self, TransactionProfile};
|
||||
use crate::profiler::{BackendProfileCounters, ResourceProfileCounters};
|
||||
use crate::render_task_graph::RenderTaskGraphCounters;
|
||||
use crate::renderer::{AsyncPropertySampler, PipelineInfo};
|
||||
use crate::resource_cache::ResourceCache;
|
||||
|
@ -274,12 +274,12 @@ macro_rules! declare_data_stores {
|
|||
fn apply_updates(
|
||||
&mut self,
|
||||
updates: InternerUpdates,
|
||||
profile: &mut TransactionProfile,
|
||||
profile_counters: &mut BackendProfileCounters,
|
||||
) {
|
||||
$(
|
||||
self.$name.apply_updates(
|
||||
updates.$name,
|
||||
profile,
|
||||
&mut profile_counters.intern.$name,
|
||||
);
|
||||
)+
|
||||
}
|
||||
|
@ -470,8 +470,6 @@ struct Document {
|
|||
/// Tracks if we need to invalidate dirty rects for this document, due to the picture
|
||||
/// cache slice configuration having changed when a new scene is swapped in.
|
||||
dirty_rects_are_valid: bool,
|
||||
|
||||
profile: TransactionProfile,
|
||||
}
|
||||
|
||||
impl Document {
|
||||
|
@ -514,7 +512,6 @@ impl Document {
|
|||
loaded_scene: Scene::new(),
|
||||
prev_composite_descriptor: CompositeDescriptor::empty(),
|
||||
dirty_rects_are_valid: true,
|
||||
profile: TransactionProfile::new(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -606,12 +603,11 @@ impl Document {
|
|||
&mut self,
|
||||
resource_cache: &mut ResourceCache,
|
||||
gpu_cache: &mut GpuCache,
|
||||
resource_profile: &mut ResourceProfileCounters,
|
||||
debug_flags: DebugFlags,
|
||||
tile_cache_logger: &mut TileCacheLogger,
|
||||
tile_caches: &mut FastHashMap<SliceId, Box<TileCacheInstance>>,
|
||||
) -> RenderedDocument {
|
||||
self.profile.start_time(profiler::FRAME_BUILDING_TIME);
|
||||
|
||||
let accumulated_scale_factor = self.view.accumulated_scale_factor();
|
||||
let pan = self.view.frame.pan.to_f32() / accumulated_scale_factor;
|
||||
|
||||
|
@ -631,6 +627,7 @@ impl Document {
|
|||
self.view.scene.layer,
|
||||
self.view.scene.device_rect.origin,
|
||||
pan,
|
||||
resource_profile,
|
||||
&self.dynamic_properties,
|
||||
&mut self.data_stores,
|
||||
&mut self.scratch,
|
||||
|
@ -639,7 +636,6 @@ impl Document {
|
|||
tile_cache_logger,
|
||||
tile_caches,
|
||||
self.dirty_rects_are_valid,
|
||||
&mut self.profile,
|
||||
);
|
||||
|
||||
frame
|
||||
|
@ -651,12 +647,9 @@ impl Document {
|
|||
let is_new_scene = self.has_built_scene;
|
||||
self.has_built_scene = false;
|
||||
|
||||
self.profile.end_time(profiler::FRAME_BUILDING_TIME);
|
||||
|
||||
RenderedDocument {
|
||||
frame,
|
||||
is_new_scene,
|
||||
profile: self.profile.take_and_reset(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -882,7 +875,7 @@ impl RenderBackend {
|
|||
IdNamespace(NEXT_NAMESPACE_ID.fetch_add(1, Ordering::Relaxed) as u32)
|
||||
}
|
||||
|
||||
pub fn run(&mut self) {
|
||||
pub fn run(&mut self, mut profile_counters: BackendProfileCounters) {
|
||||
let mut frame_counter: u32 = 0;
|
||||
let mut status = RenderBackendStatus::Continue;
|
||||
|
||||
|
@ -893,7 +886,7 @@ impl RenderBackend {
|
|||
while let RenderBackendStatus::Continue = status {
|
||||
status = match self.api_rx.recv() {
|
||||
Ok(msg) => {
|
||||
self.process_api_msg(msg, &mut frame_counter)
|
||||
self.process_api_msg(msg, &mut profile_counters, &mut frame_counter)
|
||||
}
|
||||
Err(..) => { RenderBackendStatus::ShutDown(None) }
|
||||
};
|
||||
|
@ -933,21 +926,36 @@ impl RenderBackend {
|
|||
mut txns: Vec<Box<BuiltTransaction>>,
|
||||
result_tx: Option<Sender<SceneSwapResult>>,
|
||||
frame_counter: &mut u32,
|
||||
profile_counters: &mut BackendProfileCounters,
|
||||
) -> bool {
|
||||
self.prepare_for_frames();
|
||||
self.maybe_force_nop_documents(
|
||||
frame_counter,
|
||||
profile_counters,
|
||||
|document_id| txns.iter().any(|txn| txn.document_id == document_id));
|
||||
|
||||
let mut built_frame = false;
|
||||
for mut txn in txns.drain(..) {
|
||||
let has_built_scene = txn.built_scene.is_some();
|
||||
|
||||
if let Some(doc) = self.documents.get_mut(&txn.document_id) {
|
||||
if let Some(timings) = txn.timings {
|
||||
if has_built_scene {
|
||||
profile_counters.scene_changed = true;
|
||||
}
|
||||
|
||||
profile_counters.txn.set(
|
||||
timings.builder_start_time_ns,
|
||||
timings.builder_end_time_ns,
|
||||
timings.send_time_ns,
|
||||
timings.scene_build_start_time_ns,
|
||||
timings.scene_build_end_time_ns,
|
||||
timings.display_list_len,
|
||||
);
|
||||
}
|
||||
|
||||
if let Some(doc) = self.documents.get_mut(&txn.document_id) {
|
||||
doc.removed_pipelines.append(&mut txn.removed_pipelines);
|
||||
doc.view.scene = txn.view;
|
||||
doc.profile.merge(&mut txn.profile);
|
||||
|
||||
if let Some(built_scene) = txn.built_scene.take() {
|
||||
doc.new_async_scene_ready(
|
||||
|
@ -968,7 +976,7 @@ impl RenderBackend {
|
|||
self.tile_cache_logger.serialize_updates(&updates);
|
||||
}
|
||||
}
|
||||
doc.data_stores.apply_updates(updates, &mut doc.profile);
|
||||
doc.data_stores.apply_updates(updates, profile_counters);
|
||||
}
|
||||
|
||||
// Build the hit tester while the APZ lock is held so that its content
|
||||
|
@ -992,12 +1000,6 @@ impl RenderBackend {
|
|||
.spatial_tree
|
||||
.discard_frame_state_for_pipeline(*pipeline_id);
|
||||
}
|
||||
|
||||
self.resource_cache.add_rasterized_blob_images(
|
||||
txn.rasterized_blobs.take(),
|
||||
&mut doc.profile,
|
||||
);
|
||||
|
||||
} else {
|
||||
// The document was removed while we were building it, skip it.
|
||||
// TODO: we might want to just ensure that removed documents are
|
||||
|
@ -1008,6 +1010,11 @@ impl RenderBackend {
|
|||
continue;
|
||||
}
|
||||
|
||||
self.resource_cache.add_rasterized_blob_images(
|
||||
txn.rasterized_blobs.take(),
|
||||
&mut profile_counters.resources.texture_cache,
|
||||
);
|
||||
|
||||
built_frame |= self.update_document(
|
||||
txn.document_id,
|
||||
txn.resource_updates.take(),
|
||||
|
@ -1016,6 +1023,7 @@ impl RenderBackend {
|
|||
txn.render_frame,
|
||||
txn.invalidate_rendered_frame,
|
||||
frame_counter,
|
||||
profile_counters,
|
||||
has_built_scene,
|
||||
);
|
||||
}
|
||||
|
@ -1026,6 +1034,7 @@ impl RenderBackend {
|
|||
fn process_api_msg(
|
||||
&mut self,
|
||||
msg: ApiMsg,
|
||||
profile_counters: &mut BackendProfileCounters,
|
||||
frame_counter: &mut u32,
|
||||
) -> RenderBackendStatus {
|
||||
match msg {
|
||||
|
@ -1106,7 +1115,7 @@ impl RenderBackend {
|
|||
}
|
||||
#[cfg(feature = "capture")]
|
||||
DebugCommand::SaveCapture(root, bits) => {
|
||||
let output = self.save_capture(root, bits);
|
||||
let output = self.save_capture(root, bits, profile_counters);
|
||||
ResultMsg::DebugOutput(output)
|
||||
},
|
||||
#[cfg(feature = "capture")]
|
||||
|
@ -1130,7 +1139,7 @@ impl RenderBackend {
|
|||
config.frame_id = frame_id;
|
||||
}
|
||||
|
||||
self.load_capture(config);
|
||||
self.load_capture(config, profile_counters);
|
||||
|
||||
for (id, doc) in &self.documents {
|
||||
let captured = CapturedDocument {
|
||||
|
@ -1221,10 +1230,11 @@ impl RenderBackend {
|
|||
self.prepare_transactions(
|
||||
transaction_msgs,
|
||||
frame_counter,
|
||||
profile_counters,
|
||||
);
|
||||
}
|
||||
ApiMsg::SceneBuilderResult(msg) => {
|
||||
return self.process_scene_builder_result(msg, frame_counter);
|
||||
return self.process_scene_builder_result(msg, profile_counters, frame_counter);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1234,6 +1244,7 @@ impl RenderBackend {
|
|||
fn process_scene_builder_result(
|
||||
&mut self,
|
||||
msg: SceneBuilderResult,
|
||||
profile_counters: &mut BackendProfileCounters,
|
||||
frame_counter: &mut u32,
|
||||
) -> RenderBackendStatus {
|
||||
profile_scope!("sb_msg");
|
||||
|
@ -1244,6 +1255,7 @@ impl RenderBackend {
|
|||
txns,
|
||||
result_tx,
|
||||
frame_counter,
|
||||
profile_counters,
|
||||
);
|
||||
self.bookkeep_after_frames();
|
||||
},
|
||||
|
@ -1263,6 +1275,7 @@ impl RenderBackend {
|
|||
txns,
|
||||
result_tx,
|
||||
frame_counter,
|
||||
profile_counters,
|
||||
);
|
||||
|
||||
if built_frame {
|
||||
|
@ -1344,20 +1357,16 @@ impl RenderBackend {
|
|||
&mut self,
|
||||
txns: Vec<Box<TransactionMsg>>,
|
||||
frame_counter: &mut u32,
|
||||
profile_counters: &mut BackendProfileCounters,
|
||||
) {
|
||||
self.prepare_for_frames();
|
||||
self.maybe_force_nop_documents(
|
||||
frame_counter,
|
||||
profile_counters,
|
||||
|document_id| txns.iter().any(|txn| txn.document_id == document_id));
|
||||
|
||||
let mut built_frame = false;
|
||||
for mut txn in txns {
|
||||
if txn.generate_frame {
|
||||
txn.profile.end_time(profiler::API_SEND_TIME);
|
||||
}
|
||||
|
||||
self.documents.get_mut(&txn.document_id).unwrap().profile.merge(&mut txn.profile);
|
||||
|
||||
built_frame |= self.update_document(
|
||||
txn.document_id,
|
||||
txn.resource_updates.take(),
|
||||
|
@ -1366,6 +1375,7 @@ impl RenderBackend {
|
|||
txn.generate_frame,
|
||||
txn.invalidate_rendered_frame,
|
||||
frame_counter,
|
||||
profile_counters,
|
||||
false
|
||||
);
|
||||
}
|
||||
|
@ -1384,6 +1394,7 @@ impl RenderBackend {
|
|||
/// to force a frame build.
|
||||
fn maybe_force_nop_documents<F>(&mut self,
|
||||
frame_counter: &mut u32,
|
||||
profile_counters: &mut BackendProfileCounters,
|
||||
document_already_present: F) where
|
||||
F: Fn(DocumentId) -> bool {
|
||||
if self.requires_frame_build() {
|
||||
|
@ -1402,6 +1413,7 @@ impl RenderBackend {
|
|||
false,
|
||||
false,
|
||||
frame_counter,
|
||||
profile_counters,
|
||||
false);
|
||||
}
|
||||
#[cfg(feature = "capture")]
|
||||
|
@ -1421,13 +1433,13 @@ impl RenderBackend {
|
|||
mut render_frame: bool,
|
||||
invalidate_rendered_frame: bool,
|
||||
frame_counter: &mut u32,
|
||||
profile_counters: &mut BackendProfileCounters,
|
||||
has_built_scene: bool,
|
||||
) -> bool {
|
||||
let requested_frame = render_frame;
|
||||
|
||||
let requires_frame_build = self.requires_frame_build();
|
||||
let doc = self.documents.get_mut(&document_id).unwrap();
|
||||
|
||||
// If we have a sampler, get more frame ops from it and add them
|
||||
// to the transaction. This is a hook to allow the WR user code to
|
||||
// fiddle with things after a potentially long scene build, but just
|
||||
|
@ -1446,6 +1458,7 @@ impl RenderBackend {
|
|||
// for something wrench specific and we should remove it.
|
||||
let mut scroll = false;
|
||||
for frame_msg in frame_ops {
|
||||
let _timer = profile_counters.total_time.timer();
|
||||
let op = doc.process_frame_msg(frame_msg);
|
||||
scroll |= op.scroll;
|
||||
}
|
||||
|
@ -1458,7 +1471,7 @@ impl RenderBackend {
|
|||
|
||||
self.resource_cache.post_scene_building_update(
|
||||
resource_updates,
|
||||
&mut doc.profile,
|
||||
&mut profile_counters.resources,
|
||||
);
|
||||
|
||||
if doc.dynamic_properties.flush_pending_updates() {
|
||||
|
@ -1504,11 +1517,13 @@ impl RenderBackend {
|
|||
|
||||
// borrow ck hack for profile_counters
|
||||
let (pending_update, rendered_document) = {
|
||||
let _timer = profile_counters.total_time.timer();
|
||||
let frame_build_start_time = precise_time_ns();
|
||||
|
||||
let rendered_document = doc.build_frame(
|
||||
&mut self.resource_cache,
|
||||
&mut self.gpu_cache,
|
||||
&mut profile_counters.resources,
|
||||
self.debug_flags,
|
||||
&mut self.tile_cache_logger,
|
||||
&mut self.tile_caches,
|
||||
|
@ -1571,8 +1586,10 @@ impl RenderBackend {
|
|||
document_id,
|
||||
rendered_document,
|
||||
pending_update,
|
||||
profile_counters.clone()
|
||||
);
|
||||
self.result_tx.send(msg).unwrap();
|
||||
profile_counters.reset();
|
||||
} else if requested_frame {
|
||||
// WR-internal optimization to avoid doing a bunch of render work if
|
||||
// there's no pixels. We still want to pretend to render and request
|
||||
|
@ -1695,6 +1712,7 @@ impl RenderBackend {
|
|||
&mut self,
|
||||
root: PathBuf,
|
||||
bits: CaptureBits,
|
||||
profile_counters: &mut BackendProfileCounters,
|
||||
) -> DebugOutput {
|
||||
use std::fs;
|
||||
use crate::render_task_graph::dump_render_tasks_as_svg;
|
||||
|
@ -1717,6 +1735,7 @@ impl RenderBackend {
|
|||
let rendered_document = doc.build_frame(
|
||||
&mut self.resource_cache,
|
||||
&mut self.gpu_cache,
|
||||
&mut profile_counters.resources,
|
||||
self.debug_flags,
|
||||
&mut self.tile_cache_logger,
|
||||
&mut self.tile_caches,
|
||||
|
@ -1832,6 +1851,7 @@ impl RenderBackend {
|
|||
fn load_capture(
|
||||
&mut self,
|
||||
mut config: CaptureConfig,
|
||||
profile_counters: &mut BackendProfileCounters,
|
||||
) {
|
||||
debug!("capture: loading {:?}", config.frame_root());
|
||||
let backend = config.deserialize_for_frame::<PlainRenderBackend, _>("backend")
|
||||
|
@ -1942,7 +1962,6 @@ impl RenderBackend {
|
|||
loaded_scene: scene.clone(),
|
||||
prev_composite_descriptor: CompositeDescriptor::empty(),
|
||||
dirty_rects_are_valid: false,
|
||||
profile: TransactionProfile::new(),
|
||||
};
|
||||
entry.insert(doc);
|
||||
}
|
||||
|
@ -1959,10 +1978,12 @@ impl RenderBackend {
|
|||
|
||||
let msg_publish = ResultMsg::PublishDocument(
|
||||
id,
|
||||
RenderedDocument { frame, is_new_scene: true, profile: TransactionProfile::new() },
|
||||
RenderedDocument { frame, is_new_scene: true },
|
||||
self.resource_cache.pending_updates(),
|
||||
profile_counters.clone(),
|
||||
);
|
||||
self.result_tx.send(msg_publish).unwrap();
|
||||
profile_counters.reset();
|
||||
|
||||
self.notifier.new_frame_ready(id, false, true, None);
|
||||
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -26,7 +26,7 @@ use crate::glyph_rasterizer::{GLYPH_FLASHING, FontInstance, GlyphFormat, GlyphKe
|
|||
use crate::gpu_cache::{GpuCache, GpuCacheAddress, GpuCacheHandle};
|
||||
use crate::gpu_types::UvRectKind;
|
||||
use crate::internal_types::{FastHashMap, FastHashSet, TextureSource, ResourceUpdateList};
|
||||
use crate::profiler::{self, TransactionProfile, bytes_to_mb};
|
||||
use crate::profiler::{ResourceProfileCounters, TextureCacheProfileCounters};
|
||||
use crate::render_backend::{FrameId, FrameStamp};
|
||||
use crate::render_task_graph::{RenderTaskGraph, RenderTaskId};
|
||||
use crate::render_task_cache::{RenderTaskCache, RenderTaskCacheKey};
|
||||
|
@ -461,9 +461,6 @@ pub struct ResourceCache {
|
|||
|
||||
/// A list of queued compositor surface updates to apply next frame.
|
||||
pending_native_surface_updates: Vec<NativeSurfaceOperation>,
|
||||
|
||||
image_templates_memory: usize,
|
||||
font_templates_memory: usize,
|
||||
}
|
||||
|
||||
impl ResourceCache {
|
||||
|
@ -495,8 +492,6 @@ impl ResourceCache {
|
|||
pending_native_surface_updates: Vec::new(),
|
||||
#[cfg(feature = "capture")]
|
||||
capture_dirty: true,
|
||||
image_templates_memory: 0,
|
||||
font_templates_memory: 0,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -551,7 +546,7 @@ impl ResourceCache {
|
|||
pub fn post_scene_building_update(
|
||||
&mut self,
|
||||
updates: Vec<ResourceUpdate>,
|
||||
profile: &mut TransactionProfile,
|
||||
profile_counters: &mut ResourceProfileCounters,
|
||||
) {
|
||||
// TODO, there is potential for optimization here, by processing updates in
|
||||
// bulk rather than one by one (for example by sorting allocations by size or
|
||||
|
@ -566,8 +561,7 @@ impl ResourceCache {
|
|||
match update {
|
||||
ResourceUpdate::AddImage(img) => {
|
||||
if let ImageData::Raw(ref bytes) = img.data {
|
||||
self.image_templates_memory += bytes.len();
|
||||
profile.set(profiler::IMAGE_TEMPLATES_MEM, bytes_to_mb(self.image_templates_memory));
|
||||
profile_counters.image_templates.inc(bytes.len());
|
||||
}
|
||||
self.add_image_template(
|
||||
img.key,
|
||||
|
@ -576,7 +570,6 @@ impl ResourceCache {
|
|||
&img.descriptor.size.into(),
|
||||
img.tiling,
|
||||
);
|
||||
profile.set(profiler::IMAGE_TEMPLATES, self.resources.image_templates.images.len());
|
||||
}
|
||||
ResourceUpdate::UpdateImage(img) => {
|
||||
self.update_image_template(img.key, img.descriptor, img.data.into(), &img.dirty_rect);
|
||||
|
@ -604,16 +597,12 @@ impl ResourceCache {
|
|||
}
|
||||
ResourceUpdate::DeleteImage(img) => {
|
||||
self.delete_image_template(img);
|
||||
profile.set(profiler::IMAGE_TEMPLATES, self.resources.image_templates.images.len());
|
||||
profile.set(profiler::IMAGE_TEMPLATES_MEM, bytes_to_mb(self.image_templates_memory));
|
||||
}
|
||||
ResourceUpdate::DeleteBlobImage(img) => {
|
||||
self.delete_image_template(img.as_image());
|
||||
}
|
||||
ResourceUpdate::DeleteFont(font) => {
|
||||
self.delete_font_template(font);
|
||||
profile.set(profiler::FONT_TEMPLATES, self.resources.font_templates.len());
|
||||
profile.set(profiler::FONT_TEMPLATES_MEM, bytes_to_mb(self.font_templates_memory));
|
||||
}
|
||||
ResourceUpdate::DeleteFontInstance(font) => {
|
||||
self.delete_font_instance(font);
|
||||
|
@ -625,15 +614,13 @@ impl ResourceCache {
|
|||
ResourceUpdate::AddFont(font) => {
|
||||
match font {
|
||||
AddFont::Raw(id, bytes, index) => {
|
||||
self.font_templates_memory += bytes.len();
|
||||
profile.set(profiler::FONT_TEMPLATES_MEM, bytes_to_mb(self.font_templates_memory));
|
||||
profile_counters.font_templates.inc(bytes.len());
|
||||
self.add_font_template(id, FontTemplate::Raw(bytes, index));
|
||||
}
|
||||
AddFont::Native(id, native_font_handle) => {
|
||||
self.add_font_template(id, FontTemplate::Native(native_font_handle));
|
||||
}
|
||||
}
|
||||
profile.set(profiler::FONT_TEMPLATES, self.resources.font_templates.len());
|
||||
}
|
||||
ResourceUpdate::AddFontInstance(..) => {
|
||||
// Already added in ApiResources.
|
||||
|
@ -645,7 +632,7 @@ impl ResourceCache {
|
|||
pub fn add_rasterized_blob_images(
|
||||
&mut self,
|
||||
images: Vec<(BlobImageRequest, BlobImageResult)>,
|
||||
profile: &mut TransactionProfile,
|
||||
texture_cache_profile: &mut TextureCacheProfileCounters,
|
||||
) {
|
||||
for (request, result) in images {
|
||||
let data = match result {
|
||||
|
@ -656,7 +643,7 @@ impl ResourceCache {
|
|||
}
|
||||
};
|
||||
|
||||
profile.add(profiler::RASTERIZED_BLOBS_PX, data.rasterized_rect.area());
|
||||
texture_cache_profile.rasterized_blob_pixels.inc(data.rasterized_rect.area() as usize);
|
||||
|
||||
// First make sure we have an entry for this key (using a placeholder
|
||||
// if need be).
|
||||
|
@ -693,9 +680,7 @@ impl ResourceCache {
|
|||
|
||||
pub fn delete_font_template(&mut self, font_key: FontKey) {
|
||||
self.glyph_rasterizer.delete_font(font_key);
|
||||
if let Some(FontTemplate::Raw(data, _)) = self.resources.font_templates.remove(&font_key) {
|
||||
self.font_templates_memory -= data.len();
|
||||
}
|
||||
self.resources.font_templates.remove(&font_key);
|
||||
self.cached_glyphs
|
||||
.clear_fonts(|font| font.font_key == font_key);
|
||||
}
|
||||
|
@ -815,10 +800,6 @@ impl ResourceCache {
|
|||
|
||||
match value {
|
||||
Some(image) => if image.data.is_blob() {
|
||||
if let CachedImageData::Raw(data) = image.data {
|
||||
self.image_templates_memory -= data.len();
|
||||
}
|
||||
|
||||
let blob_key = BlobImageKey(image_key);
|
||||
self.deleted_blob_keys.back_mut().unwrap().push(blob_key);
|
||||
self.rasterized_blob_images.remove(&blob_key);
|
||||
|
@ -1169,7 +1150,7 @@ impl ResourceCache {
|
|||
&mut self,
|
||||
gpu_cache: &mut GpuCache,
|
||||
render_tasks: &mut RenderTaskGraph,
|
||||
profile: &mut TransactionProfile,
|
||||
texture_cache_profile: &mut TextureCacheProfileCounters,
|
||||
) {
|
||||
profile_scope!("block_until_all_resources_added");
|
||||
|
||||
|
@ -1182,7 +1163,7 @@ impl ResourceCache {
|
|||
gpu_cache,
|
||||
&mut self.cached_render_tasks,
|
||||
render_tasks,
|
||||
profile,
|
||||
texture_cache_profile,
|
||||
);
|
||||
|
||||
// Apply any updates of new / updated images (incl. blobs) to the texture cache.
|
||||
|
@ -1403,11 +1384,11 @@ impl ResourceCache {
|
|||
}
|
||||
|
||||
|
||||
pub fn end_frame(&mut self, profile: &mut TransactionProfile) {
|
||||
pub fn end_frame(&mut self, texture_cache_profile: &mut TextureCacheProfileCounters) {
|
||||
debug_assert_eq!(self.state, State::QueryResources);
|
||||
profile_scope!("end_frame");
|
||||
self.state = State::Idle;
|
||||
self.texture_cache.end_frame(profile);
|
||||
self.texture_cache.end_frame(texture_cache_profile);
|
||||
}
|
||||
|
||||
pub fn set_debug_flags(&mut self, flags: DebugFlags) {
|
||||
|
|
|
@ -26,7 +26,6 @@ use crate::prim_store::image::{Image, YuvImage};
|
|||
use crate::prim_store::line_dec::LineDecoration;
|
||||
use crate::prim_store::picture::Picture;
|
||||
use crate::prim_store::text_run::TextRun;
|
||||
use crate::profiler::{self, TransactionProfile};
|
||||
use crate::render_backend::SceneView;
|
||||
use crate::renderer::{PipelineInfo, SceneBuilderHooks};
|
||||
use crate::scene::{Scene, BuiltScene, SceneStats};
|
||||
|
@ -42,6 +41,19 @@ use crate::debug_server;
|
|||
#[cfg(feature = "debugger")]
|
||||
use api::{BuiltDisplayListIter, DisplayItem};
|
||||
|
||||
/// Various timing information that will be turned into
|
||||
/// TransactionProfileCounters later down the pipeline.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct TransactionTimings {
|
||||
pub builder_start_time_ns: u64,
|
||||
pub builder_end_time_ns: u64,
|
||||
pub send_time_ns: u64,
|
||||
pub scene_build_start_time_ns: u64,
|
||||
pub scene_build_end_time_ns: u64,
|
||||
pub blob_rasterization_end_time_ns: u64,
|
||||
pub display_list_len: usize,
|
||||
}
|
||||
|
||||
fn rasterize_blobs(txn: &mut TransactionMsg, is_low_priority: bool) {
|
||||
profile_scope!("rasterize_blobs");
|
||||
|
||||
|
@ -69,10 +81,12 @@ pub struct BuiltTransaction {
|
|||
pub removed_pipelines: Vec<(PipelineId, DocumentId)>,
|
||||
pub notifications: Vec<NotificationRequest>,
|
||||
pub interner_updates: Option<InternerUpdates>,
|
||||
pub scene_build_start_time: u64,
|
||||
pub scene_build_end_time: u64,
|
||||
pub render_frame: bool,
|
||||
pub invalidate_rendered_frame: bool,
|
||||
pub discard_frame_state_for_pipelines: Vec<PipelineId>,
|
||||
pub profile: TransactionProfile,
|
||||
pub timings: Option<TransactionTimings>,
|
||||
}
|
||||
|
||||
#[cfg(feature = "replay")]
|
||||
|
@ -413,6 +427,8 @@ impl SceneBuilderThread {
|
|||
for mut item in scenes {
|
||||
self.config = item.config;
|
||||
|
||||
let scene_build_start_time = precise_time_ns();
|
||||
|
||||
let mut built_scene = None;
|
||||
let mut interner_updates = None;
|
||||
|
||||
|
@ -454,8 +470,10 @@ impl SceneBuilderThread {
|
|||
removed_pipelines: Vec::new(),
|
||||
discard_frame_state_for_pipelines: Vec::new(),
|
||||
notifications: Vec::new(),
|
||||
scene_build_start_time,
|
||||
scene_build_end_time: precise_time_ns(),
|
||||
interner_updates,
|
||||
profile: TransactionProfile::new(),
|
||||
timings: None,
|
||||
})];
|
||||
|
||||
self.forward_built_transactions(txns);
|
||||
|
@ -562,12 +580,12 @@ impl SceneBuilderThread {
|
|||
hooks.pre_scene_build();
|
||||
}
|
||||
|
||||
let scene_build_start_time = precise_time_ns();
|
||||
|
||||
let doc = self.documents.get_mut(&txn.document_id).unwrap();
|
||||
let scene = &mut doc.scene;
|
||||
|
||||
let mut profile = txn.profile.take();
|
||||
|
||||
profile.start_time(profiler::SCENE_BUILD_TIME);
|
||||
let mut timings = None;
|
||||
|
||||
let mut discard_frame_state_for_pipelines = Vec::new();
|
||||
let mut removed_pipelines = Vec::new();
|
||||
|
@ -595,15 +613,11 @@ impl SceneBuilderThread {
|
|||
display_list,
|
||||
preserve_frame_state,
|
||||
} => {
|
||||
let display_list_len = display_list.data().len();
|
||||
|
||||
let (builder_start_time_ns, builder_end_time_ns, send_time_ns) =
|
||||
display_list.times();
|
||||
|
||||
let content_send_time = profiler::ns_to_ms(precise_time_ns() - send_time_ns);
|
||||
let dl_build_time = profiler::ns_to_ms(builder_end_time_ns - builder_start_time_ns);
|
||||
profile.set(profiler::CONTENT_SEND_TIME, content_send_time);
|
||||
profile.set(profiler::DISPLAY_LIST_BUILD_TIME, dl_build_time);
|
||||
profile.set(profiler::DISPLAY_LIST_MEM, profiler::bytes_to_mb(display_list.data().len()));
|
||||
|
||||
if self.removed_pipelines.contains(&pipeline_id) {
|
||||
continue;
|
||||
}
|
||||
|
@ -621,6 +635,16 @@ impl SceneBuilderThread {
|
|||
viewport_size,
|
||||
);
|
||||
|
||||
timings = Some(TransactionTimings {
|
||||
builder_start_time_ns,
|
||||
builder_end_time_ns,
|
||||
send_time_ns,
|
||||
scene_build_start_time_ns: 0,
|
||||
scene_build_end_time_ns: 0,
|
||||
blob_rasterization_end_time_ns: 0,
|
||||
display_list_len,
|
||||
});
|
||||
|
||||
if !preserve_frame_state {
|
||||
discard_frame_state_for_pipelines.push(pipeline_id);
|
||||
}
|
||||
|
@ -665,16 +689,15 @@ impl SceneBuilderThread {
|
|||
built_scene = Some(built);
|
||||
}
|
||||
|
||||
profile.end_time(profiler::SCENE_BUILD_TIME);
|
||||
let scene_build_end_time = precise_time_ns();
|
||||
|
||||
let is_low_priority = false;
|
||||
rasterize_blobs(txn, is_low_priority);
|
||||
|
||||
if !txn.blob_requests.is_empty() {
|
||||
profile.start_time(profiler::BLOB_RASTERIZATION_TIME);
|
||||
|
||||
let is_low_priority = false;
|
||||
rasterize_blobs(txn, is_low_priority);
|
||||
|
||||
profile.end_time(profiler::BLOB_RASTERIZATION_TIME);
|
||||
if let Some(timings) = timings.as_mut() {
|
||||
timings.blob_rasterization_end_time_ns = precise_time_ns();
|
||||
timings.scene_build_start_time_ns = scene_build_start_time;
|
||||
timings.scene_build_end_time_ns = scene_build_end_time;
|
||||
}
|
||||
|
||||
drain_filter(
|
||||
|
@ -701,7 +724,9 @@ impl SceneBuilderThread {
|
|||
discard_frame_state_for_pipelines,
|
||||
notifications: replace(&mut txn.notifications, Vec::new()),
|
||||
interner_updates,
|
||||
profile,
|
||||
scene_build_start_time,
|
||||
scene_build_end_time,
|
||||
timings,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -726,7 +751,7 @@ impl SceneBuilderThread {
|
|||
|
||||
let (tx, rx) = single_msg_channel();
|
||||
let txn = txns.iter().find(|txn| txn.built_scene.is_some()).unwrap();
|
||||
hooks.pre_scene_swap((txn.profile.get(profiler::SCENE_BUILD_TIME).unwrap() * 1000000.0) as u64);
|
||||
hooks.pre_scene_swap(txn.scene_build_end_time - txn.scene_build_start_time);
|
||||
|
||||
(Some(info), Some(tx), Some(rx))
|
||||
} else {
|
||||
|
|
|
@ -17,7 +17,7 @@ use crate::internal_types::{
|
|||
TextureCacheAllocInfo, TextureCacheUpdate,
|
||||
};
|
||||
use crate::lru_cache::LRUCache;
|
||||
use crate::profiler::{self, TransactionProfile};
|
||||
use crate::profiler::{ResourceProfileCounter, TextureCacheProfileCounters};
|
||||
use crate::render_backend::FrameStamp;
|
||||
use crate::resource_cache::{CacheItem, CachedImageData};
|
||||
use smallvec::SmallVec;
|
||||
|
@ -376,7 +376,7 @@ impl PictureTextures {
|
|||
}
|
||||
}
|
||||
|
||||
fn update_profile(&self, profile: &mut TransactionProfile) {
|
||||
fn update_profile(&self, profile: &mut ResourceProfileCounter) {
|
||||
// For now, this profile counter just accumulates the slices and bytes
|
||||
// from all picture cache texture arrays.
|
||||
let mut picture_slices = 0;
|
||||
|
@ -385,8 +385,7 @@ impl PictureTextures {
|
|||
picture_slices += texture.slices.len();
|
||||
picture_bytes += texture.size_in_bytes();
|
||||
}
|
||||
profile.set(profiler::PICTURE_TILES, picture_slices);
|
||||
profile.set(profiler::PICTURE_TILES_MEM, profiler::bytes_to_mb(picture_bytes));
|
||||
profile.set(picture_slices, picture_bytes);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -616,7 +615,7 @@ impl TextureCache {
|
|||
self.evict_items_from_cache_if_required();
|
||||
}
|
||||
|
||||
pub fn end_frame(&mut self, profile: &mut TransactionProfile) {
|
||||
pub fn end_frame(&mut self, texture_cache_profile: &mut TextureCacheProfileCounters) {
|
||||
debug_assert!(self.now.is_valid());
|
||||
self.expire_old_picture_cache_tiles();
|
||||
|
||||
|
@ -628,30 +627,18 @@ impl TextureCache {
|
|||
self.shared_textures.array_color8_linear.release_empty_textures(&mut self.pending_updates);
|
||||
self.shared_textures.array_color8_nearest.release_empty_textures(&mut self.pending_updates);
|
||||
|
||||
self.shared_textures.array_alpha8_linear.update_profile(
|
||||
profiler::TEXTURE_CACHE_A8_REGIONS,
|
||||
profiler::TEXTURE_CACHE_A8_MEM,
|
||||
profile,
|
||||
);
|
||||
self.shared_textures.array_alpha16_linear.update_profile(
|
||||
profiler::TEXTURE_CACHE_A16_REGIONS,
|
||||
profiler::TEXTURE_CACHE_A16_MEM,
|
||||
profile,
|
||||
);
|
||||
self.shared_textures.array_color8_linear.update_profile(
|
||||
profiler::TEXTURE_CACHE_RGBA8_LINEAR_REGIONS,
|
||||
profiler::TEXTURE_CACHE_RGBA8_LINEAR_MEM,
|
||||
profile,
|
||||
);
|
||||
self.shared_textures.array_color8_nearest.update_profile(
|
||||
profiler::TEXTURE_CACHE_RGBA8_NEAREST_REGIONS,
|
||||
profiler::TEXTURE_CACHE_RGBA8_NEAREST_MEM,
|
||||
profile,
|
||||
);
|
||||
self.picture_textures.update_profile(profile);
|
||||
|
||||
profile.set(profiler::TEXTURE_CACHE_SHARED_MEM, self.shared_bytes_allocated);
|
||||
profile.set(profiler::TEXTURE_CACHE_STANDALONE_MEM, self.standalone_bytes_allocated);
|
||||
self.shared_textures.array_alpha8_linear
|
||||
.update_profile(&mut texture_cache_profile.pages_alpha8_linear);
|
||||
self.shared_textures.array_alpha16_linear
|
||||
.update_profile(&mut texture_cache_profile.pages_alpha16_linear);
|
||||
self.shared_textures.array_color8_linear
|
||||
.update_profile(&mut texture_cache_profile.pages_color8_linear);
|
||||
self.shared_textures.array_color8_nearest
|
||||
.update_profile(&mut texture_cache_profile.pages_color8_nearest);
|
||||
self.picture_textures
|
||||
.update_profile(&mut texture_cache_profile.pages_picture);
|
||||
texture_cache_profile.shared_bytes.set(self.shared_bytes_allocated);
|
||||
texture_cache_profile.standalone_bytes.set(self.standalone_bytes_allocated);
|
||||
|
||||
self.now = FrameStamp::INVALID;
|
||||
}
|
||||
|
@ -1474,10 +1461,9 @@ impl TextureArray {
|
|||
});
|
||||
}
|
||||
|
||||
fn update_profile(&self, count_idx: usize, mem_idx: usize, profile: &mut TransactionProfile) {
|
||||
fn update_profile(&self, counter: &mut ResourceProfileCounter) {
|
||||
let num_regions: usize = self.units.iter().map(|u| u.regions.len()).sum();
|
||||
profile.set(count_idx, num_regions);
|
||||
profile.set(mem_idx, profiler::bytes_to_mb(self.size_in_bytes()));
|
||||
counter.set(num_regions, self.size_in_bytes());
|
||||
}
|
||||
|
||||
/// Allocate space in this texture array.
|
||||
|
|
|
@ -513,48 +513,57 @@ bitflags! {
|
|||
const DISABLE_BATCHING = 1 << 5;
|
||||
/// Display the pipeline epochs.
|
||||
const EPOCHS = 1 << 6;
|
||||
/// Reduce the amount of information displayed by the profiler so that
|
||||
/// it occupies less screen real-estate.
|
||||
const COMPACT_PROFILER = 1 << 7;
|
||||
/// Print driver messages to stdout.
|
||||
const ECHO_DRIVER_MESSAGES = 1 << 7;
|
||||
const ECHO_DRIVER_MESSAGES = 1 << 8;
|
||||
/// Show an indicator that moves every time a frame is rendered.
|
||||
const NEW_FRAME_INDICATOR = 1 << 9;
|
||||
/// Show an indicator that moves every time a scene is built.
|
||||
const NEW_SCENE_INDICATOR = 1 << 10;
|
||||
/// Show an overlay displaying overdraw amount.
|
||||
const SHOW_OVERDRAW = 1 << 8;
|
||||
const SHOW_OVERDRAW = 1 << 11;
|
||||
/// Display the contents of GPU cache.
|
||||
const GPU_CACHE_DBG = 1 << 9;
|
||||
const GPU_CACHE_DBG = 1 << 12;
|
||||
/// Show a red bar that moves each time a slow frame is detected.
|
||||
const SLOW_FRAME_INDICATOR = 1 << 13;
|
||||
/// Clear evicted parts of the texture cache for debugging purposes.
|
||||
const TEXTURE_CACHE_DBG_CLEAR_EVICTED = 1 << 10;
|
||||
const TEXTURE_CACHE_DBG_CLEAR_EVICTED = 1 << 14;
|
||||
/// Show picture caching debug overlay
|
||||
const PICTURE_CACHING_DBG = 1 << 11;
|
||||
const PICTURE_CACHING_DBG = 1 << 15;
|
||||
/// Highlight all primitives with colors based on kind.
|
||||
const PRIMITIVE_DBG = 1 << 12;
|
||||
const PRIMITIVE_DBG = 1 << 16;
|
||||
/// Draw a zoom widget showing part of the framebuffer zoomed in.
|
||||
const ZOOM_DBG = 1 << 13;
|
||||
const ZOOM_DBG = 1 << 17;
|
||||
/// Scale the debug renderer down for a smaller screen. This will disrupt
|
||||
/// any mapping between debug display items and page content, so shouldn't
|
||||
/// be used with overlays like the picture caching or primitive display.
|
||||
const SMALL_SCREEN = 1 << 14;
|
||||
const SMALL_SCREEN = 1 << 18;
|
||||
/// Disable various bits of the WebRender pipeline, to help narrow
|
||||
/// down where slowness might be coming from.
|
||||
const DISABLE_OPAQUE_PASS = 1 << 15;
|
||||
const DISABLE_OPAQUE_PASS = 1 << 19;
|
||||
///
|
||||
const DISABLE_ALPHA_PASS = 1 << 16;
|
||||
const DISABLE_ALPHA_PASS = 1 << 20;
|
||||
///
|
||||
const DISABLE_CLIP_MASKS = 1 << 17;
|
||||
const DISABLE_CLIP_MASKS = 1 << 21;
|
||||
///
|
||||
const DISABLE_TEXT_PRIMS = 1 << 18;
|
||||
const DISABLE_TEXT_PRIMS = 1 << 22;
|
||||
///
|
||||
const DISABLE_GRADIENT_PRIMS = 1 << 19;
|
||||
const DISABLE_GRADIENT_PRIMS = 1 << 23;
|
||||
///
|
||||
const OBSCURE_IMAGES = 1 << 20;
|
||||
const OBSCURE_IMAGES = 1 << 24;
|
||||
/// Taint the transparent area of the glyphs with a random opacity to easily
|
||||
/// see when glyphs are re-rasterized.
|
||||
const GLYPH_FLASHING = 1 << 21;
|
||||
const GLYPH_FLASHING = 1 << 25;
|
||||
/// The profiler only displays information that is out of the ordinary.
|
||||
const SMART_PROFILER = 1 << 22;
|
||||
const SMART_PROFILER = 1 << 26;
|
||||
/// If set, dump picture cache invalidation debug to console.
|
||||
const INVALIDATION_DBG = 1 << 23;
|
||||
const INVALIDATION_DBG = 1 << 27;
|
||||
/// Log tile cache to memory for later saving as part of wr-capture
|
||||
const TILE_CACHE_LOGGING_DBG = 1 << 24;
|
||||
const TILE_CACHE_LOGGING_DBG = 1 << 28;
|
||||
/// Collect and dump profiler statistics to captures.
|
||||
const PROFILER_CAPTURE = (1 as u32) << 25; // need "as u32" until we have cbindgen#556
|
||||
const PROFILER_CAPTURE = (1 as u32) << 31; // need "as u32" until we have cbindgen#556
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -80,10 +80,6 @@ args:
|
|||
- no_block:
|
||||
long: no-block
|
||||
help: Don't block on UI events - run event loop as fast as possible.
|
||||
- profiler_ui:
|
||||
long: profiler-ui
|
||||
takes_value: true
|
||||
help: A string describing what to show on in the profiler HUD (See https://github.com/servo/webrender/wiki/Debugging-WebRender#anchor_6).
|
||||
|
||||
subcommands:
|
||||
- png:
|
||||
|
|
|
@ -666,11 +666,6 @@ fn main() {
|
|||
dump_shader_source,
|
||||
notifier,
|
||||
);
|
||||
|
||||
if let Some(ui_str) = args.value_of("profiler_ui") {
|
||||
wrench.renderer.set_profiler_ui(&ui_str);
|
||||
}
|
||||
|
||||
window.update(&mut wrench);
|
||||
|
||||
if let Some(window_title) = wrench.take_title() {
|
||||
|
@ -807,7 +802,7 @@ fn render<'a>(
|
|||
|
||||
// Default the profile overlay on for android.
|
||||
if cfg!(target_os = "android") {
|
||||
debug_flags.toggle(DebugFlags::PROFILER_DBG);
|
||||
debug_flags.toggle(DebugFlags::PROFILER_DBG | DebugFlags::COMPACT_PROFILER);
|
||||
wrench.api.send_debug_cmd(DebugCommand::SetFlags(debug_flags));
|
||||
}
|
||||
|
||||
|
@ -869,6 +864,11 @@ fn render<'a>(
|
|||
wrench.api.send_debug_cmd(DebugCommand::SetFlags(debug_flags));
|
||||
do_render = true;
|
||||
}
|
||||
VirtualKeyCode::S => {
|
||||
debug_flags.toggle(DebugFlags::COMPACT_PROFILER);
|
||||
wrench.api.send_debug_cmd(DebugCommand::SetFlags(debug_flags));
|
||||
do_render = true;
|
||||
}
|
||||
VirtualKeyCode::D => {
|
||||
debug_flags.toggle(DebugFlags::PICTURE_CACHING_DBG);
|
||||
wrench.api.send_debug_cmd(DebugCommand::SetFlags(debug_flags));
|
||||
|
|
|
@ -665,7 +665,11 @@ pref("gfx.webrender.debug.gpu-time-queries", false);
|
|||
pref("gfx.webrender.debug.gpu-sample-queries", false);
|
||||
pref("gfx.webrender.debug.disable-batching", false);
|
||||
pref("gfx.webrender.debug.epochs", false);
|
||||
pref("gfx.webrender.debug.compact-profiler", false);
|
||||
pref("gfx.webrender.debug.smart-profiler", false);
|
||||
pref("gfx.webrender.debug.echo-driver-messages", false);
|
||||
pref("gfx.webrender.debug.new-frame-indicator", false);
|
||||
pref("gfx.webrender.debug.new-scene-indicator", false);
|
||||
pref("gfx.webrender.debug.show-overdraw", false);
|
||||
pref("gfx.webrender.debug.slow-frame-indicator", false);
|
||||
pref("gfx.webrender.debug.picture-caching", false);
|
||||
|
@ -675,7 +679,6 @@ pref("gfx.webrender.debug.small-screen", false);
|
|||
pref("gfx.webrender.debug.obscure-images", false);
|
||||
pref("gfx.webrender.debug.glyph-flashing", false);
|
||||
pref("gfx.webrender.debug.capture-profiler", false);
|
||||
pref("gfx.webrender.debug.profiler-ui", "Default");
|
||||
|
||||
|
||||
pref("accessibility.warn_on_browsewithcaret", true);
|
||||
|
|
Загрузка…
Ссылка в новой задаче