Bug 1946361 - Add debug prefs for missing snapshots. r=gw
Differential Revision: https://phabricator.services.mozilla.com/D237008
This commit is contained in:
@@ -51,7 +51,7 @@ class gfxVarReceiver;
|
|||||||
_(WebglAllowCoreProfile, bool, true) \
|
_(WebglAllowCoreProfile, bool, true) \
|
||||||
_(WebglAllowWindowsNativeGl, bool, false) \
|
_(WebglAllowWindowsNativeGl, bool, false) \
|
||||||
_(WebRenderMaxPartialPresentRects, int32_t, 0) \
|
_(WebRenderMaxPartialPresentRects, int32_t, 0) \
|
||||||
_(WebRenderDebugFlags, int32_t, 0) \
|
_(WebRenderDebugFlags, uint64_t, 0) \
|
||||||
_(WebRenderBoolParameters, int32_t, 0) \
|
_(WebRenderBoolParameters, int32_t, 0) \
|
||||||
_(WebRenderBatchingLookback, int32_t, 10) \
|
_(WebRenderBatchingLookback, int32_t, 10) \
|
||||||
_(WebRenderBlobTileSize, int32_t, 256) \
|
_(WebRenderBlobTileSize, int32_t, 256) \
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ union GfxVarValue
|
|||||||
nsCString;
|
nsCString;
|
||||||
nsString;
|
nsString;
|
||||||
int32_t;
|
int32_t;
|
||||||
|
uint64_t;
|
||||||
float;
|
float;
|
||||||
uint64_t[];
|
uint64_t[];
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -556,6 +556,10 @@ static void WebRenderDebugPrefChangeCallback(const char* aPrefName, void*) {
|
|||||||
GFX_WEBRENDER_DEBUG(".restrict-blob-size", wr::DebugFlags::RESTRICT_BLOB_SIZE)
|
GFX_WEBRENDER_DEBUG(".restrict-blob-size", wr::DebugFlags::RESTRICT_BLOB_SIZE)
|
||||||
GFX_WEBRENDER_DEBUG(".surface-promotion-logging",
|
GFX_WEBRENDER_DEBUG(".surface-promotion-logging",
|
||||||
wr::DebugFlags::SURFACE_PROMOTION_LOGGING)
|
wr::DebugFlags::SURFACE_PROMOTION_LOGGING)
|
||||||
|
GFX_WEBRENDER_DEBUG(".missing-snapshot-panic",
|
||||||
|
wr::DebugFlags::MISSING_SNAPSHOT_PANIC)
|
||||||
|
GFX_WEBRENDER_DEBUG(".missing-snapshot-pink",
|
||||||
|
wr::DebugFlags::MISSING_SNAPSHOT_PINK)
|
||||||
#undef GFX_WEBRENDER_DEBUG
|
#undef GFX_WEBRENDER_DEBUG
|
||||||
gfx::gfxVars::SetWebRenderDebugFlags(flags._0);
|
gfx::gfxVars::SetWebRenderDebugFlags(flags._0);
|
||||||
|
|
||||||
|
|||||||
@@ -516,6 +516,8 @@ pub struct ResourceCache {
|
|||||||
/// Over time it would be better to handle each of these cases explicitly
|
/// Over time it would be better to handle each of these cases explicitly
|
||||||
/// and make it a hard error to fail to snapshot a stacking context.
|
/// and make it a hard error to fail to snapshot a stacking context.
|
||||||
fallback_handle: TextureCacheHandle,
|
fallback_handle: TextureCacheHandle,
|
||||||
|
debug_fallback_panic: bool,
|
||||||
|
debug_fallback_pink: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ResourceCache {
|
impl ResourceCache {
|
||||||
@@ -554,6 +556,8 @@ impl ResourceCache {
|
|||||||
font_templates_memory: 0,
|
font_templates_memory: 0,
|
||||||
render_target_pool: Vec::new(),
|
render_target_pool: Vec::new(),
|
||||||
fallback_handle: TextureCacheHandle::invalid(),
|
fallback_handle: TextureCacheHandle::invalid(),
|
||||||
|
debug_fallback_panic: false,
|
||||||
|
debug_fallback_pink: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1367,6 +1371,9 @@ impl ResourceCache {
|
|||||||
if self.resources.image_templates
|
if self.resources.image_templates
|
||||||
.get(request.key)
|
.get(request.key)
|
||||||
.map_or(false, |img| img.data.is_snapshot()) {
|
.map_or(false, |img| img.data.is_snapshot()) {
|
||||||
|
if self.debug_fallback_panic {
|
||||||
|
panic!("Missing snapshot image");
|
||||||
|
}
|
||||||
return self.get_texture_cache_item(&self.fallback_handle);
|
return self.get_texture_cache_item(&self.fallback_handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1514,6 +1521,11 @@ impl ResourceCache {
|
|||||||
profile_scope!("update_texture_cache");
|
profile_scope!("update_texture_cache");
|
||||||
|
|
||||||
if self.fallback_handle == TextureCacheHandle::invalid() {
|
if self.fallback_handle == TextureCacheHandle::invalid() {
|
||||||
|
let fallback_color = if self.debug_fallback_pink {
|
||||||
|
vec![255, 0, 255, 255]
|
||||||
|
} else {
|
||||||
|
vec![0, 0, 0, 0]
|
||||||
|
};
|
||||||
self.texture_cache.update(
|
self.texture_cache.update(
|
||||||
&mut self.fallback_handle,
|
&mut self.fallback_handle,
|
||||||
ImageDescriptor {
|
ImageDescriptor {
|
||||||
@@ -1524,7 +1536,7 @@ impl ResourceCache {
|
|||||||
offset: 0,
|
offset: 0,
|
||||||
},
|
},
|
||||||
TextureFilter::Linear,
|
TextureFilter::Linear,
|
||||||
Some(CachedImageData::Raw(Arc::new(vec![0, 0, 0, 0]))),
|
Some(CachedImageData::Raw(Arc::new(fallback_color))),
|
||||||
[0.0; 4],
|
[0.0; 4],
|
||||||
DirtyRect::All,
|
DirtyRect::All,
|
||||||
gpu_cache,
|
gpu_cache,
|
||||||
@@ -1808,6 +1820,13 @@ impl ResourceCache {
|
|||||||
GLYPH_FLASHING.store(flags.contains(DebugFlags::GLYPH_FLASHING), std::sync::atomic::Ordering::Relaxed);
|
GLYPH_FLASHING.store(flags.contains(DebugFlags::GLYPH_FLASHING), std::sync::atomic::Ordering::Relaxed);
|
||||||
self.texture_cache.set_debug_flags(flags);
|
self.texture_cache.set_debug_flags(flags);
|
||||||
self.picture_textures.set_debug_flags(flags);
|
self.picture_textures.set_debug_flags(flags);
|
||||||
|
self.debug_fallback_panic = flags.contains(DebugFlags::MISSING_SNAPSHOT_PANIC);
|
||||||
|
let fallback_pink = flags.contains(DebugFlags::MISSING_SNAPSHOT_PINK);
|
||||||
|
|
||||||
|
if fallback_pink != self.debug_fallback_pink && self.fallback_handle != TextureCacheHandle::invalid() {
|
||||||
|
self.texture_cache.evict_handle(&self.fallback_handle);
|
||||||
|
}
|
||||||
|
self.debug_fallback_pink = fallback_pink;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn clear(&mut self, what: ClearCache) {
|
pub fn clear(&mut self, what: ClearCache) {
|
||||||
|
|||||||
@@ -663,10 +663,10 @@ impl RenderReasons {
|
|||||||
/// Flags to enable/disable various builtin debugging tools.
|
/// Flags to enable/disable various builtin debugging tools.
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash, Default, Deserialize, MallocSizeOf, Serialize)]
|
#[derive(Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash, Default, Deserialize, MallocSizeOf, Serialize)]
|
||||||
pub struct DebugFlags(u32);
|
pub struct DebugFlags(u64);
|
||||||
|
|
||||||
bitflags! {
|
bitflags! {
|
||||||
impl DebugFlags: u32 {
|
impl DebugFlags: u64 {
|
||||||
/// Display the frame profiler on screen.
|
/// Display the frame profiler on screen.
|
||||||
const PROFILER_DBG = 1 << 0;
|
const PROFILER_DBG = 1 << 0;
|
||||||
/// Display intermediate render targets on screen.
|
/// Display intermediate render targets on screen.
|
||||||
@@ -725,9 +725,9 @@ bitflags! {
|
|||||||
/// If set, dump picture cache invalidation debug to console.
|
/// If set, dump picture cache invalidation debug to console.
|
||||||
const INVALIDATION_DBG = 1 << 23;
|
const INVALIDATION_DBG = 1 << 23;
|
||||||
/// Collect and dump profiler statistics to captures.
|
/// 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 << 25;
|
||||||
/// Invalidate picture tiles every frames (useful when inspecting GPU work in external tools).
|
/// Invalidate picture tiles every frames (useful when inspecting GPU work in external tools).
|
||||||
const FORCE_PICTURE_INVALIDATION = (1 as u32) << 26;
|
const FORCE_PICTURE_INVALIDATION = 1 << 26;
|
||||||
/// Display window visibility on screen.
|
/// Display window visibility on screen.
|
||||||
const WINDOW_VISIBILITY_DBG = 1 << 27;
|
const WINDOW_VISIBILITY_DBG = 1 << 27;
|
||||||
/// Render large blobs with at a smaller size (incorrectly). This is a temporary workaround for
|
/// Render large blobs with at a smaller size (incorrectly). This is a temporary workaround for
|
||||||
@@ -735,8 +735,12 @@ bitflags! {
|
|||||||
const RESTRICT_BLOB_SIZE = 1 << 28;
|
const RESTRICT_BLOB_SIZE = 1 << 28;
|
||||||
/// Enable surface promotion logging.
|
/// Enable surface promotion logging.
|
||||||
const SURFACE_PROMOTION_LOGGING = 1 << 29;
|
const SURFACE_PROMOTION_LOGGING = 1 << 29;
|
||||||
/// Show picture caching debug overlay
|
/// Show picture caching debug overlay.
|
||||||
const PICTURE_BORDERS = 1 << 30;
|
const PICTURE_BORDERS = 1 << 30;
|
||||||
|
/// Panic when a attempting to display a missing stacking context snapshot.
|
||||||
|
const MISSING_SNAPSHOT_PANIC = (1 as u64) << 31; // need "as u32" until we have cbindgen#556
|
||||||
|
/// Panic when a attempting to display a missing stacking context snapshot.
|
||||||
|
const MISSING_SNAPSHOT_PINK = (1 as u64) << 32;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7155,6 +7155,20 @@
|
|||||||
value: false
|
value: false
|
||||||
mirror: always
|
mirror: always
|
||||||
|
|
||||||
|
# When true, missing stacking context snapshots will crash the GPU or Parent
|
||||||
|
# process.
|
||||||
|
- name: gfx.webrender.debug.missing-snapshot-panic
|
||||||
|
type: RelaxedAtomicBool
|
||||||
|
value: false
|
||||||
|
mirror: always
|
||||||
|
|
||||||
|
# When true, missing stacking context snapshots will render as an opaque
|
||||||
|
# pink image.
|
||||||
|
- name: gfx.webrender.debug.missing-snapshot-pink
|
||||||
|
type: RelaxedAtomicBool
|
||||||
|
value: false
|
||||||
|
mirror: always
|
||||||
|
|
||||||
#ifdef MOZ_WIDGET_GTK
|
#ifdef MOZ_WIDGET_GTK
|
||||||
- name: gfx.webrender.reject-software-driver
|
- name: gfx.webrender.reject-software-driver
|
||||||
type: bool
|
type: bool
|
||||||
|
|||||||
Reference in New Issue
Block a user