Skip to content

Commit

Permalink
Bug 1410777 - Force a full transaction for WR when the window overlay…
Browse files Browse the repository at this point in the history
… 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
  • Loading branch information
staktrace committed Oct 26, 2017
1 parent 75717cb commit b7e231b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
13 changes: 13 additions & 0 deletions gfx/layers/wr/WebRenderLayerManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ namespace layers {
WebRenderLayerManager::WebRenderLayerManager(nsIWidget* aWidget)
: mWidget(aWidget)
, mLatestTransactionId(0)
, mWindowOverlayChanged(false)
, mNeedsComposite(false)
, mIsFirstPaint(false)
, mTarget(nullptr)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -275,6 +286,8 @@ WebRenderLayerManager::EndTransactionWithoutLayer(nsDisplayList* aDisplayList,
contentSize);

mWidget->AddWindowOverlayWebRenderCommands(WrBridge(), builder, resourceUpdates);
mWindowOverlayChanged = false;

WrBridge()->ClearReadLocks();

if (AsyncPanZoomEnabled()) {
Expand Down
2 changes: 2 additions & 0 deletions gfx/layers/wr/WebRenderLayerManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ class WebRenderLayerManager final : public LayerManager
WebRenderScrollData& GetScrollData() { return mScrollData; }

void WrUpdated();
void WindowOverlayChanged() { mWindowOverlayChanged = true; }

private:
/**
Expand Down Expand Up @@ -191,6 +192,7 @@ class WebRenderLayerManager final : public LayerManager
// APZ to do it's job
WebRenderScrollData mScrollData;

bool mWindowOverlayChanged;
bool mNeedsComposite;
bool mIsFirstPaint;
FocusTarget mFocusTarget;
Expand Down
3 changes: 3 additions & 0 deletions widget/cocoa/nsChildView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -4021,6 +4022,8 @@ - (void)viewWillDraw
if ([self isUsingOpenGL]) {
if (ShadowLayerForwarder* slf = mGeckoChild->GetLayerManager()->AsShadowForwarder()) {
slf->WindowOverlayChanged();
} else if (WebRenderLayerManager* wrlm = mGeckoChild->GetLayerManager()->AsWebRenderLayerManager()) {
wrlm->WindowOverlayChanged();
}
}

Expand Down

0 comments on commit b7e231b

Please sign in to comment.