Bug 1410777 - Force a full transaction for WR when the window overlay changes. r=mstange

The window buttons are drawn as part of the AddWindowOverlayWebRenderCommands
function which is invoked in the full-transaction codepath. It should be possible
to have the empty transaction codepath simply update the image (without building
a full WR display list) and do a recomposite. That would be more performant but
it requires some plumbing to build and ship across a IpcResourceUpdateQueue on
empty transactions.

MozReview-Commit-ID: 2Mrb0wELD6E

--HG--
extra : rebase_source : 9a94c32f94403050835bf3445176f4fe2c1579fa
This commit is contained in:
Kartikaya Gupta 2017-10-26 14:17:19 -04:00
parent 75717cb048
commit b7e231bc45
3 changed files with 18 additions and 0 deletions

View File

@ -28,6 +28,7 @@ namespace layers {
WebRenderLayerManager::WebRenderLayerManager(nsIWidget* aWidget)
: mWidget(aWidget)
, mLatestTransactionId(0)
, mWindowOverlayChanged(false)
, mNeedsComposite(false)
, mIsFirstPaint(false)
, mTarget(nullptr)
@ -174,6 +175,16 @@ WebRenderLayerManager::BeginTransaction()
bool
WebRenderLayerManager::EndEmptyTransaction(EndTransactionFlags aFlags)
{
if (mWindowOverlayChanged) {
// If the window overlay changed then we can't do an empty transaction
// because we need to repaint the window overlay which we only currently
// support in a full transaction.
// XXX If we end up hitting this branch a lot we can probably optimize it
// by just sending an updated window overlay image instead of rebuilding
// the entire WR display list.
return false;
}
// With the WebRenderLayerManager we reject attempts to set most kind of
// "pending data" for empty transactions. Any place that attempts to update
// transforms or scroll offset, for example, will get failure return values
@ -275,6 +286,8 @@ WebRenderLayerManager::EndTransactionWithoutLayer(nsDisplayList* aDisplayList,
contentSize);
mWidget->AddWindowOverlayWebRenderCommands(WrBridge(), builder, resourceUpdates);
mWindowOverlayChanged = false;
WrBridge()->ClearReadLocks();
if (AsyncPanZoomEnabled()) {

View File

@ -154,6 +154,7 @@ public:
WebRenderScrollData& GetScrollData() { return mScrollData; }
void WrUpdated();
void WindowOverlayChanged() { mWindowOverlayChanged = true; }
private:
/**
@ -191,6 +192,7 @@ private:
// APZ to do it's job
WebRenderScrollData mScrollData;
bool mWindowOverlayChanged;
bool mNeedsComposite;
bool mIsFirstPaint;
FocusTarget mFocusTarget;

View File

@ -71,6 +71,7 @@
#include "mozilla/layers/InputAPZContext.h"
#include "mozilla/layers/IpcResourceUpdateQueue.h"
#include "mozilla/layers/WebRenderBridgeChild.h"
#include "mozilla/layers/WebRenderLayerManager.h"
#include "mozilla/webrender/WebRenderAPI.h"
#include "mozilla/widget/CompositorWidget.h"
#include "gfxUtils.h"
@ -4021,6 +4022,8 @@ NSEvent* gLastDragMouseDownEvent = nil;
if ([self isUsingOpenGL]) {
if (ShadowLayerForwarder* slf = mGeckoChild->GetLayerManager()->AsShadowForwarder()) {
slf->WindowOverlayChanged();
} else if (WebRenderLayerManager* wrlm = mGeckoChild->GetLayerManager()->AsWebRenderLayerManager()) {
wrlm->WindowOverlayChanged();
}
}