Bug 1531196 - Add a "small-screen" debug pref to shrink the overlay a bit. r=gw
authorBobby Holley <bobbyholley@gmail.com>
Wed, 06 Mar 2019 20:32:32 +0000
changeset 520574 690713aece131e39b8539ecd206d4295ab1f1879
parent 520573 1f0368105e07f22633e4ea0d0dfe8becccb8bdc0
child 520575 3f3edac03d480e1257be14f503675768a21e60c3
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgw
bugs1531196
milestone67.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 1531196 - Add a "small-screen" debug pref to shrink the overlay a bit. r=gw Adaptive sizing would be better, but this is the simplest path to victory. Differential Revision: https://phabricator.services.mozilla.com/D21757
gfx/thebes/gfxPlatform.cpp
gfx/wr/webrender/src/debug_render.rs
gfx/wr/webrender/src/renderer.rs
gfx/wr/webrender_api/src/api.rs
modules/libpref/init/all.js
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -561,16 +561,19 @@ static void WebRenderDebugPrefChangeCall
   GFX_WEBRENDER_DEBUG(".new-scene-indicator", 1 << 10)
   GFX_WEBRENDER_DEBUG(".show-overdraw", 1 << 11)
   GFX_WEBRENDER_DEBUG(".gpu-cache", 1 << 12)
   GFX_WEBRENDER_DEBUG(".slow-frame-indicator", 1 << 13)
   GFX_WEBRENDER_DEBUG(".texture-cache.clear-evicted", 1 << 14)
   GFX_WEBRENDER_DEBUG(".picture-caching", 1 << 15)
   GFX_WEBRENDER_DEBUG(".texture-cache.disable-shrink", 1 << 16)
   GFX_WEBRENDER_DEBUG(".primitives", 1 << 17)
+  // Bit 18 is for the zoom display, which requires the mouse position and thus
+  // currently only works in wrench.
+  GFX_WEBRENDER_DEBUG(".small-screen", 1 << 19)
 #undef GFX_WEBRENDER_DEBUG
 
   gfx::gfxVars::SetWebRenderDebugFlags(flags);
 }
 
 #if defined(USE_SKIA)
 static uint32_t GetSkiaGlyphCacheSize() {
   // Only increase font cache size on non-android to save memory.
--- a/gfx/wr/webrender/src/debug_render.rs
+++ b/gfx/wr/webrender/src/debug_render.rs
@@ -308,26 +308,27 @@ impl DebugRenderer {
         self.add_line(p1.x, p1.y, color, p0.x, p1.y, color);
         self.add_line(p0.x, p1.y, color, p0.x, p0.y, color);
     }
 
     pub fn render(
         &mut self,
         device: &mut Device,
         viewport_size: Option<FramebufferIntSize>,
+        scale: f32,
     ) {
         if let Some(viewport_size) = viewport_size {
             device.disable_depth();
             device.set_blend(true);
             device.set_blend_mode_premultiplied_alpha();
 
             let projection = Transform3D::ortho(
                 0.0,
-                viewport_size.width as f32,
-                viewport_size.height as f32,
+                viewport_size.width as f32 * scale,
+                viewport_size.height as f32 * scale,
                 0.0,
                 ORTHO_NEAR_PLANE,
                 ORTHO_FAR_PLANE,
             );
 
             // Triangles
             if !self.tri_vertices.is_empty() {
                 device.bind_program(&self.color_program);
--- a/gfx/wr/webrender/src/renderer.rs
+++ b/gfx/wr/webrender/src/renderer.rs
@@ -2777,17 +2777,19 @@ impl Renderer {
         self.resource_upload_time = 0;
         results.stats.gpu_cache_upload_time = self.gpu_cache_upload_time;
         self.gpu_cache_upload_time = 0;
 
         profile_timers.cpu_time.profile(|| {
             let _gm = self.gpu_profile.start_marker("end frame");
             self.gpu_profile.end_frame();
             if let Some(debug_renderer) = self.debug.try_get_mut() {
-                debug_renderer.render(&mut self.device, framebuffer_size);
+                let small_screen = self.debug_flags.contains(DebugFlags::SMALL_SCREEN);
+                let scale = if small_screen { 1.6 } else { 1.0 };
+                debug_renderer.render(&mut self.device, framebuffer_size, scale);
             }
             // See comment for texture_resolver.begin_frame() for explanation
             // of why this must be done after all rendering, including debug
             // overlays. The end_frame() call implicitly calls end_pass(), which
             // should ensure any left over render targets get invalidated and
             // returned to the pool correctly.
             self.texture_resolver.end_frame(&mut self.device, cpu_frame_id);
             self.device.end_frame();
--- a/gfx/wr/webrender_api/src/api.rs
+++ b/gfx/wr/webrender_api/src/api.rs
@@ -1035,16 +1035,20 @@ bitflags! {
         const TEXTURE_CACHE_DBG_CLEAR_EVICTED = 1 << 14;
         /// Show picture caching debug overlay
         const PICTURE_CACHING_DBG   = 1 << 15;
         const TEXTURE_CACHE_DBG_DISABLE_SHRINK = 1 << 16;
         /// Highlight all primitives with colors based on kind.
         const PRIMITIVE_DBG = 1 << 17;
         /// Draw a zoom widget showing part of the framebuffer zoomed in.
         const ZOOM_DBG = 1 << 18;
+        /// 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 << 19;
     }
 }
 
 pub struct RenderApi {
     api_sender: MsgSender<ApiMsg>,
     payload_sender: PayloadSender,
     namespace_id: IdNamespace,
     next_id: Cell<ResourceId>,
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -960,16 +960,17 @@ pref("gfx.webrender.debug.epochs", false
 pref("gfx.webrender.debug.compact-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);
 pref("gfx.webrender.debug.primitives", false);
+pref("gfx.webrender.debug.small-screen", false);
 pref("gfx.webrender.dl.dump-parent", false);
 pref("gfx.webrender.dl.dump-content", false);
 pref("gfx.webrender.picture-caching", true);
 
 #ifdef NIGHTLY_BUILD
 pref("performance.adjust_to_machine", true);
 #else
 pref("performance.adjust_to_machine", false);