Bug 1583998 - Implement a pref to obscure images. r=gw
authorBobby Holley <bobbyholley@gmail.com>
Wed, 25 Sep 2019 21:48:35 +0000
changeset 494995 f59ec3966f5f3242b18a188b52217496ec65b42a
parent 494994 90162306864cefa2889b2fe56701c8149ea25433
child 494996 382a41b6d4767b25c4d61196d865eaa1f6a1d0bb
push id114131
push userdluca@mozilla.com
push dateThu, 26 Sep 2019 09:47:34 +0000
treeherdermozilla-inbound@1dc1a755079a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgw
bugs1583998
milestone71.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 1583998 - Implement a pref to obscure images. r=gw This approach does have some stacking issues. The way to fix this would be to instrument the brush_image shader rather than adding debug rects. Something like: #ifdef WR_FEATURE_SFW frag.color = vec4(0,1,1,1); #endif That's slightly more involved though, so I'm going to leave it for now. Differential Revision: https://phabricator.services.mozilla.com/D47155
gfx/thebes/gfxPlatform.cpp
gfx/wr/webrender/src/prim_store/mod.rs
gfx/wr/webrender_api/src/api.rs
modules/libpref/init/all.js
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -592,16 +592,18 @@ static void WebRenderDebugPrefChangeCall
   GFX_WEBRENDER_DEBUG(".small-screen", wr::DebugFlags_SMALL_SCREEN)
   GFX_WEBRENDER_DEBUG(".disable-opaque-pass",
                       wr::DebugFlags_DISABLE_OPAQUE_PASS)
   GFX_WEBRENDER_DEBUG(".disable-alpha-pass", wr::DebugFlags_DISABLE_ALPHA_PASS)
   GFX_WEBRENDER_DEBUG(".disable-clip-masks", wr::DebugFlags_DISABLE_CLIP_MASKS)
   GFX_WEBRENDER_DEBUG(".disable-text-prims", wr::DebugFlags_DISABLE_TEXT_PRIMS)
   GFX_WEBRENDER_DEBUG(".disable-gradient-prims",
                       wr::DebugFlags_DISABLE_GRADIENT_PRIMS)
+  GFX_WEBRENDER_DEBUG(".obscure-images",
+                      wr::DebugFlags_OBSCURE_IMAGES)
 #undef GFX_WEBRENDER_DEBUG
 
   gfx::gfxVars::SetWebRenderDebugFlags(flags.bits);
 }
 
 #if defined(USE_SKIA)
 static uint32_t GetSkiaGlyphCacheSize() {
   // Only increase font cache size on non-android to save memory.
--- a/gfx/wr/webrender/src/prim_store/mod.rs
+++ b/gfx/wr/webrender/src/prim_store/mod.rs
@@ -2225,16 +2225,26 @@ impl PrimitiveStore {
                             PrimitiveInstanceKind::RadialGradient { .. } => debug_colors::PINK,
                             PrimitiveInstanceKind::Clear { .. } => debug_colors::CYAN,
                             PrimitiveInstanceKind::Backdrop { .. } => debug_colors::MEDIUMAQUAMARINE,
                         };
                         if debug_color.a != 0.0 {
                             let debug_rect = clipped_world_rect * frame_context.global_device_pixel_scale;
                             frame_state.scratch.push_debug_rect(debug_rect, debug_color, debug_color.scale_alpha(0.5));
                         }
+                    } else if frame_context.debug_flags.contains(::api::DebugFlags::OBSCURE_IMAGES) {
+                        if matches!(prim_instance.kind, PrimitiveInstanceKind::Image { .. } |
+                                                        PrimitiveInstanceKind::YuvImage { .. })
+                        {
+                            // We allow "small" images, since they're generally UI elements.
+                            let rect = clipped_world_rect * frame_context.global_device_pixel_scale;
+                            if rect.size.width > 70.0 && rect.size.height > 70.0 {
+                                frame_state.scratch.push_debug_rect(rect, debug_colors::PURPLE, debug_colors::PURPLE);
+                            }
+                        }
                     }
 
                     let vis_index = PrimitiveVisibilityIndex(frame_state.scratch.prim_info.len() as u32);
                     if prim_instance.is_chased() {
                         println!("\tvisible {:?} with {:?}", vis_index, combined_local_clip_rect);
                     }
 
                     frame_state.scratch.prim_info.push(
--- a/gfx/wr/webrender_api/src/api.rs
+++ b/gfx/wr/webrender_api/src/api.rs
@@ -1082,16 +1082,17 @@ bitflags! {
         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 << 19;
         const DISABLE_ALPHA_PASS = 1 << 20;
         const DISABLE_CLIP_MASKS = 1 << 21;
         const DISABLE_TEXT_PRIMS = 1 << 22;
         const DISABLE_GRADIENT_PRIMS = 1 << 23;
+        const OBSCURE_IMAGES = 1 << 24;
     }
 }
 
 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
@@ -663,16 +663,17 @@ pref("gfx.webrender.debug.compact-profil
 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.debug.obscure-images", false);
 
 pref("accessibility.warn_on_browsewithcaret", true);
 
 pref("accessibility.browsewithcaret_shortcut.enabled", true);
 
 #ifndef XP_MACOSX
   // Tab focus model bit field:
   // 1 focuses text controls, 2 focuses other form elements, 4 adds links.