Bug 1594492 - Count the number of color/alpha passes instead of targets in the profiler HUD. r=gw
authorNicolas Silva <nsilva@mozilla.com>
Tue, 12 Nov 2019 22:52:06 +0000
changeset 501731 7ce4cf2b6d61a4241708fec5e22f634192a1fe90
parent 501730 0ec55dcb63d9a141b276bfefb777d150fadd17a4
child 501732 6ece388605bb8696347d1d4202387ae8b043132f
push id100387
push usernsilva@mozilla.com
push dateWed, 13 Nov 2019 08:43:50 +0000
treeherderautoland@7ce4cf2b6d61 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgw
bugs1594492
milestone72.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1594492 - Count the number of color/alpha passes instead of targets in the profiler HUD. r=gw It's a more useful number since we also report the number of existing and rasterized picture cache tiles. Also bump the expected number of alpha passes up to 2 since it is rather common. Differential Revision: https://phabricator.services.mozilla.com/D52134
gfx/wr/webrender/src/profiler.rs
gfx/wr/webrender/src/renderer.rs
--- a/gfx/wr/webrender/src/profiler.rs
+++ b/gfx/wr/webrender/src/profiler.rs
@@ -25,18 +25,18 @@ pub mod expected {
     pub const MAX_IPC_TIME: Range<f64> =            0.0..4.0;
     pub const AVG_GPU_TIME: Range<f64> =            0.0..8.0;
     pub const MAX_GPU_TIME: Range<f64> =            0.0..15.0;
     pub const DRAW_CALLS: Range<u64> =              1..100;
     pub const VERTICES: Range<u64> =                10..25_000;
     pub const TOTAL_PRIMITIVES: Range<u64> =        1..5000;
     pub const VISIBLE_PRIMITIVES: Range<u64> =      1..5000;
     pub const USED_TARGETS: Range<u64> =            1..4;
-    pub const COLOR_TARGETS: Range<u64> =           1..4;
-    pub const ALPHA_TARGETS: Range<u64> =           0..2;
+    pub const COLOR_PASSES: Range<u64> =            1..4;
+    pub const ALPHA_PASSES: Range<u64> =            0..3;
     pub const RENDERED_PICTURE_CACHE_TILES: Range<u64> = 0..5;
     pub const TOTAL_PICTURE_CACHE_TILES: Range<u64> = 0..15;
     pub const CREATED_TARGETS: Range<u64> =         0..3;
     pub const CHANGED_TARGETS: Range<u64> =         0..3;
     pub const TEXTURE_DATA_UPLOADED: Range<u64> =   0..10;
     pub const GPU_CACHE_ROWS_TOTAL: Range<u64> =    1..50;
     pub const GPU_CACHE_ROWS_UPDATED: Range<u64> =  0..25;
     pub const GPU_CACHE_BLOCKS_TOTAL: Range<u64> =  1..65_000;
@@ -827,18 +827,18 @@ impl BackendProfileCounters {
 }
 
 pub struct RendererProfileCounters {
     pub frame_counter: IntProfileCounter,
     pub frame_time: AverageTimeProfileCounter,
     pub draw_calls: AverageIntProfileCounter,
     pub vertices: AverageIntProfileCounter,
     pub vao_count_and_size: ResourceProfileCounter,
-    pub color_targets: AverageIntProfileCounter,
-    pub alpha_targets: AverageIntProfileCounter,
+    pub color_passes: AverageIntProfileCounter,
+    pub alpha_passes: AverageIntProfileCounter,
     pub texture_data_uploaded: AverageIntProfileCounter,
     pub rendered_picture_cache_tiles: AverageIntProfileCounter,
     pub total_picture_cache_tiles: AverageIntProfileCounter,
 }
 
 pub struct RendererProfileTimers {
     pub cpu_time: TimeProfileCounter,
     pub gpu_graph: TimeProfileCounter,
@@ -856,23 +856,23 @@ impl RendererProfileCounters {
                 "Draw Calls",
                 None, Some(expected::DRAW_CALLS),
             ),
             vertices: AverageIntProfileCounter::new(
                 "Vertices",
                 None, Some(expected::VERTICES),
             ),
             vao_count_and_size: ResourceProfileCounter::new("VAO", None, None),
-            color_targets: AverageIntProfileCounter::new(
-                "Color Targets",
-                None, Some(expected::COLOR_TARGETS),
+            color_passes: AverageIntProfileCounter::new(
+                "Color passes",
+                None, Some(expected::COLOR_PASSES),
             ),
-            alpha_targets: AverageIntProfileCounter::new(
-                "Alpha Targets",
-                None, Some(expected::ALPHA_TARGETS),
+            alpha_passes: AverageIntProfileCounter::new(
+                "Alpha passes",
+                None, Some(expected::ALPHA_PASSES),
             ),
             texture_data_uploaded: AverageIntProfileCounter::new(
                 "Texture data, kb",
                 None, Some(expected::TEXTURE_DATA_UPLOADED),
             ),
             rendered_picture_cache_tiles: AverageIntProfileCounter::new(
                 "Rendered tiles",
                 None, Some(expected::RENDERED_PICTURE_CACHE_TILES),
@@ -882,18 +882,18 @@ impl RendererProfileCounters {
                 None, Some(expected::TOTAL_PICTURE_CACHE_TILES),
             ),
         }
     }
 
     pub fn reset(&mut self) {
         self.draw_calls.reset();
         self.vertices.reset();
-        self.color_targets.reset();
-        self.alpha_targets.reset();
+        self.color_passes.reset();
+        self.alpha_passes.reset();
         self.texture_data_uploaded.reset();
         self.rendered_picture_cache_tiles.reset();
         self.total_picture_cache_tiles.reset();
     }
 }
 
 impl RendererProfileTimers {
     pub fn new() -> Self {
@@ -1475,18 +1475,18 @@ impl Profiler {
         &mut self,
         backend_profile: &BackendProfileCounters,
         renderer_profile: &RendererProfileCounters,
         debug_renderer: &mut DebugRenderer,
     ) {
         Profiler::draw_counters(
             &[
                 &renderer_profile.frame_time as &dyn ProfileCounter,
-                &renderer_profile.color_targets,
-                &renderer_profile.alpha_targets,
+                &renderer_profile.color_passes,
+                &renderer_profile.alpha_passes,
                 &renderer_profile.draw_calls,
                 &renderer_profile.vertices,
                 &renderer_profile.rendered_picture_cache_tiles,
                 &renderer_profile.texture_data_uploaded,
                 &backend_profile.resources.content_slices,
                 &self.ipc_time,
                 &self.backend_time,
                 &self.renderer_time,
@@ -1508,18 +1508,18 @@ impl Profiler {
         gpu_samplers: &[GpuSampler<GpuProfileTag>],
         screen_fraction: f32,
         debug_renderer: &mut DebugRenderer,
     ) {
         Profiler::draw_counters(
             &[
                 &renderer_profile.frame_time as &dyn ProfileCounter,
                 &renderer_profile.frame_counter,
-                &renderer_profile.color_targets,
-                &renderer_profile.alpha_targets,
+                &renderer_profile.color_passes,
+                &renderer_profile.alpha_passes,
                 &renderer_profile.rendered_picture_cache_tiles,
                 &renderer_profile.total_picture_cache_tiles,
                 &renderer_profile.texture_data_uploaded,
                 &backend_profile.resources.content_slices,
             ],
             None,
             debug_renderer,
             true,
@@ -1680,18 +1680,18 @@ impl Profiler {
         let mut start = 0;
         let counters: &[&[&dyn ProfileCounter]] = &[
             &[
                 &self.backend_time,
                 &self.renderer_time,
                 &self.gpu_time,
             ],
             &[
-                &renderer_profile.color_targets,
-                &renderer_profile.alpha_targets,
+                &renderer_profile.color_passes,
+                &renderer_profile.alpha_passes,
                 &renderer_profile.draw_calls,
                 &renderer_profile.vertices,
                 &renderer_profile.rendered_picture_cache_tiles,
                 &renderer_profile.total_picture_cache_tiles,
             ],
             &[
                 &backend_profile.resources.gpu_cache.allocated_rows,
                 &backend_profile.resources.gpu_cache.updated_rows,
--- a/gfx/wr/webrender/src/renderer.rs
+++ b/gfx/wr/webrender/src/renderer.rs
@@ -3785,17 +3785,16 @@ impl Renderer {
         target: &PictureCacheTarget,
         draw_target: DrawTarget,
         content_origin: DeviceIntPoint,
         projection: &default::Transform3D<f32>,
         render_tasks: &RenderTaskGraph,
         stats: &mut RendererStats,
     ) {
         self.profile_counters.rendered_picture_cache_tiles.inc();
-        self.profile_counters.color_targets.inc();
         let _gm = self.gpu_profile.start_marker("picture cache target");
         let framebuffer_kind = FramebufferKind::Other;
 
         {
             let _timer = self.gpu_profile.start_timer(GPU_TAG_SETUP_TARGET);
             self.device.bind_draw_target(draw_target);
             self.device.disable_depth();
             self.device.enable_depth_write();
@@ -4255,17 +4254,17 @@ impl Renderer {
         content_origin: DeviceIntPoint,
         clear_color: Option<[f32; 4]>,
         clear_depth: Option<f32>,
         render_tasks: &RenderTaskGraph,
         projection: &default::Transform3D<f32>,
         frame_id: GpuFrameId,
         stats: &mut RendererStats,
     ) {
-        self.profile_counters.color_targets.inc();
+        self.profile_counters.color_passes.inc();
         let _gm = self.gpu_profile.start_marker("color target");
 
         // sanity check for the depth buffer
         if let DrawTarget::Texture { with_depth, .. } = draw_target {
             assert!(with_depth >= target.needs_depth());
         }
 
         let framebuffer_kind = if draw_target.is_default() {
@@ -4516,17 +4515,17 @@ impl Renderer {
     fn draw_alpha_target(
         &mut self,
         draw_target: DrawTarget,
         target: &AlphaRenderTarget,
         projection: &default::Transform3D<f32>,
         render_tasks: &RenderTaskGraph,
         stats: &mut RendererStats,
     ) {
-        self.profile_counters.alpha_targets.inc();
+        self.profile_counters.alpha_passes.inc();
         let _gm = self.gpu_profile.start_marker("alpha target");
         let alpha_sampler = self.gpu_profile.start_sampler(GPU_SAMPLER_TAG_ALPHA);
 
         {
             let _timer = self.gpu_profile.start_timer(GPU_TAG_SETUP_TARGET);
             self.device.bind_draw_target(draw_target);
             self.device.disable_depth();
             self.device.disable_depth_write();
@@ -5180,16 +5179,20 @@ impl Renderer {
                                 &texture_id,
                                 target_index,
                                 target,
                                 &frame.render_tasks,
                                 &mut results.stats,
                             );
                         }
 
+                        if !picture_cache.is_empty() {
+                            self.profile_counters.color_passes.inc();
+                        }
+
                         // Draw picture caching tiles for this pass.
                         for picture_target in picture_cache {
                             results.stats.color_target_count += 1;
 
                             let draw_target = match picture_target.surface {
                                 ResolvedSurfaceTexture::TextureCache { ref texture, layer } => {
                                     let (texture, _) = self.texture_resolver
                                         .resolve(texture)