Bug 1955005 - Make the old state transaction render immediately and offscreen. r=emilio
The main goal of this patch is to ensure that we render the snapshots as soon as the transaction is received on the WebRender to prevent another transaction within the same vsync interval from replacing the old state's transaction before it has had a chance to produce the snapshots. In addition, we produce the snapshots by generating a frame that isn't presented to the window. This is to avoid potential vsync issues from trying to present multiple times in the same interval and avoids a fair amount of wasted work. Differential Revision: https://phabricator.services.mozilla.com/D242358
This commit is contained in:
@@ -6544,6 +6544,9 @@ void PresShell::PaintAndRequestComposite(nsView* aView, PaintFlags aFlags) {
|
||||
if (aFlags & PaintFlags::PaintSyncDecodeImages) {
|
||||
flags |= PaintInternalFlags::PaintSyncDecodeImages;
|
||||
}
|
||||
if (aFlags & PaintFlags::PaintCompositeOffscreen) {
|
||||
flags |= PaintInternalFlags::PaintCompositeOffscreen;
|
||||
}
|
||||
PaintInternal(aView, flags);
|
||||
}
|
||||
|
||||
@@ -6634,6 +6637,9 @@ void PresShell::PaintInternal(nsView* aViewToPaint, PaintInternalFlags aFlags) {
|
||||
mIsFirstPaint = false;
|
||||
}
|
||||
|
||||
const bool offscreen =
|
||||
bool(aFlags & PaintInternalFlags::PaintCompositeOffscreen);
|
||||
|
||||
if (!renderer->BeginTransaction(url)) {
|
||||
return;
|
||||
}
|
||||
@@ -6673,6 +6679,9 @@ void PresShell::PaintInternal(nsView* aViewToPaint, PaintInternalFlags aFlags) {
|
||||
StaticPrefs::image_testing_decode_sync_enabled()) {
|
||||
flags |= PaintFrameFlags::SyncDecodeImages;
|
||||
}
|
||||
if (aFlags & PaintInternalFlags::PaintCompositeOffscreen) {
|
||||
flags |= PaintFrameFlags::CompositeOffscreen;
|
||||
}
|
||||
if (renderer->GetBackendType() == layers::LayersBackend::LAYERS_WR) {
|
||||
flags |= PaintFrameFlags::ForWebRender;
|
||||
}
|
||||
@@ -6695,8 +6704,8 @@ void PresShell::PaintInternal(nsView* aViewToPaint, PaintInternalFlags aFlags) {
|
||||
WrFiltersHolder wrFilters;
|
||||
|
||||
layerManager->SetTransactionIdAllocator(presContext->RefreshDriver());
|
||||
layerManager->EndTransactionWithoutLayer(nullptr, nullptr,
|
||||
std::move(wrFilters), &data, 0);
|
||||
layerManager->EndTransactionWithoutLayer(
|
||||
nullptr, nullptr, std::move(wrFilters), &data, 0, offscreen);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user