Bug 1758217 - Clamp maximum size of AndroidCompositorWidget. r=gfx-reviewers,nical

In bug 1756700 we added size constraints to the size of the android
nsWindow. This avoided hitting webrender's window_size_sanity_check
assertion during the geckoview giantScreenshot test when initializing
the webrender renderer.

However, the sanity check occurs whenever the webrender document size
is updated, which can occur when a new display list is sent in
addition to renderer initialization. In
WebrenderBridgeParent::SetDisplayList we take the window size from
CompositorWidget::GetClientSize rather than
nsWindow::GetClientSize. On Android, AndroidCompositorWidget
calculates its size directly from the Surface/ANativeWindow to avoid
having to pass through the main thread when a ResumeAndResize message
is sent from the UI thread to the compositor thread. This means the
nsWindow size constraints have no effect on the compositor widget
size.

This patch additionally clamps the max size of
AndroidCompositorWidget, meaning we never send too large a size to
webrender and therefore avoid the assertion.

Differential Revision: https://phabricator.services.mozilla.com/D140492
This commit is contained in:
Jamie Nicol 2022-03-08 21:00:30 +00:00
parent cefe196784
commit 8f6be81f59

View File

@ -93,7 +93,8 @@ bool AndroidCompositorWidget::OnResumeComposition() {
const int32_t width = ANativeWindow_getWidth(nativeWindow);
const int32_t height = ANativeWindow_getHeight(nativeWindow);
mClientSize = LayoutDeviceIntSize(width, height);
mClientSize = LayoutDeviceIntSize(std::min(width, MOZ_WIDGET_MAX_SIZE),
std::min(height, MOZ_WIDGET_MAX_SIZE));
ANativeWindow_release(nativeWindow);