Bug 1850056. Disable willReadFrequently on Windows until perf issues can be sorted out. r=gfx-reviewers,lsalzman

Differential Revision: https://phabricator.services.mozilla.com/D186830
This commit is contained in:
Timothy Nikkel 2023-08-25 00:46:03 +00:00
parent 00923a3aff
commit 7dced51441
3 changed files with 20 additions and 3 deletions

View File

@ -1425,7 +1425,7 @@ bool CanvasRenderingContext2D::BorrowTarget(const IntRect& aPersistedRect,
// acceleration, then we skip trying to use this provider so that it will be
// recreated by EnsureTarget later.
if (!mBufferProvider || mBufferProvider->RequiresRefresh() ||
(mBufferProvider->IsAccelerated() && mWillReadFrequently)) {
(mBufferProvider->IsAccelerated() && GetEffectiveWillReadFrequently())) {
return false;
}
mTarget = mBufferProvider->BorrowDrawTarget(aPersistedRect);
@ -1647,7 +1647,7 @@ bool CanvasRenderingContext2D::TryAcceleratedTarget(
}
// Don't try creating an accelerate DrawTarget if either acceleration failed
// previously or if the application expects acceleration to be slow.
if (!mAllowAcceleration || mWillReadFrequently) {
if (!mAllowAcceleration || GetEffectiveWillReadFrequently()) {
return false;
}
aOutDT = DrawTargetWebgl::Create(GetSize(), GetSurfaceFormat());
@ -1685,7 +1685,7 @@ bool CanvasRenderingContext2D::TrySharedTarget(
aOutProvider = renderer->CreatePersistentBufferProvider(
GetSize(), GetSurfaceFormat(),
!mAllowAcceleration || mWillReadFrequently);
!mAllowAcceleration || GetEffectiveWillReadFrequently());
if (!aOutProvider) {
return false;
@ -6340,6 +6340,11 @@ void CanvasRenderingContext2D::SetWriteOnly() {
}
}
bool CanvasRenderingContext2D::GetEffectiveWillReadFrequently() const {
return StaticPrefs::gfx_canvas_willreadfrequently_enabled_AtStartup() &&
mWillReadFrequently;
}
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(CanvasPath, mParent)
CanvasPath::CanvasPath(nsISupports* aParent) : mParent(aParent) {

View File

@ -779,6 +779,8 @@ class CanvasRenderingContext2D : public nsICanvasRenderingContextInternal,
return CurrentState().font;
}
bool GetEffectiveWillReadFrequently() const;
// Member vars
int32_t mWidth, mHeight;

View File

@ -5694,6 +5694,16 @@
#endif
mirror: always
- name: gfx.canvas.willreadfrequently.enabled
type: bool
#if defined(XP_WIN)
value: false
#else
value: true
#endif
mirror: once
- name: gfx.color_management.display_profile
type: DataMutexString
value: ""