mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1134762 - Clean-up UseFastPath logic to avoid OOM error. r=kats
This commit is contained in:
parent
0c64c8efab
commit
e4e94088d9
@ -219,6 +219,12 @@ ClientTiledPaintedLayer::IsScrollingOnCompositor(const FrameMetrics& aParentMetr
|
|||||||
bool
|
bool
|
||||||
ClientTiledPaintedLayer::UseFastPath()
|
ClientTiledPaintedLayer::UseFastPath()
|
||||||
{
|
{
|
||||||
|
// The fast path doesn't allow rendering at low resolution. It will draw the low-res
|
||||||
|
// area at full resolution and cause OOM.
|
||||||
|
if (gfxPrefs::UseLowPrecisionBuffer()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
LayerMetricsWrapper scrollAncestor;
|
LayerMetricsWrapper scrollAncestor;
|
||||||
GetAncestorLayers(&scrollAncestor, nullptr);
|
GetAncestorLayers(&scrollAncestor, nullptr);
|
||||||
if (!scrollAncestor) {
|
if (!scrollAncestor) {
|
||||||
@ -227,16 +233,35 @@ ClientTiledPaintedLayer::UseFastPath()
|
|||||||
const FrameMetrics& parentMetrics = scrollAncestor.Metrics();
|
const FrameMetrics& parentMetrics = scrollAncestor.Metrics();
|
||||||
|
|
||||||
bool multipleTransactionsNeeded = gfxPlatform::GetPlatform()->UseProgressivePaint()
|
bool multipleTransactionsNeeded = gfxPlatform::GetPlatform()->UseProgressivePaint()
|
||||||
|| gfxPrefs::UseLowPrecisionBuffer()
|
|
||||||
|| !parentMetrics.GetCriticalDisplayPort().IsEmpty();
|
|| !parentMetrics.GetCriticalDisplayPort().IsEmpty();
|
||||||
bool isFixed = GetIsFixedPosition() || GetParent()->GetIsFixedPosition();
|
bool isFixed = GetIsFixedPosition() || GetParent()->GetIsFixedPosition();
|
||||||
bool isScrollable = parentMetrics.IsScrollable();
|
bool isScrollable = parentMetrics.IsScrollable();
|
||||||
|
|
||||||
return !multipleTransactionsNeeded || isFixed || !isScrollable
|
return !multipleTransactionsNeeded || isFixed || !isScrollable;
|
||||||
#if !defined(MOZ_WIDGET_ANDROID) || defined(MOZ_ANDROID_APZ)
|
}
|
||||||
|| !IsScrollingOnCompositor(parentMetrics)
|
|
||||||
|
bool
|
||||||
|
ClientTiledPaintedLayer::UseProgressiveDraw() {
|
||||||
|
// Don't draw progressively in a reftest scenario (that's what the HasShadowTarget() check is for).
|
||||||
|
if (!gfxPlatform::GetPlatform()->UseProgressivePaint() || ClientManager()->HasShadowTarget()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// XXX We probably want to disable progressive drawing for non active APZ layers in the future
|
||||||
|
// but we should wait for a proper test case before making this change.
|
||||||
|
|
||||||
|
#if 0 //!defined(MOZ_WIDGET_ANDROID) || defined(MOZ_ANDROID_APZ)
|
||||||
|
LayerMetricsWrapper scrollAncestor;
|
||||||
|
GetAncestorLayers(&scrollAncestor, nullptr);
|
||||||
|
if (!scrollAncestor) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
const FrameMetrics& parentMetrics = scrollAncestor.Metrics();
|
||||||
|
|
||||||
|
return !IsScrollingOnCompositor(parentMetrics);
|
||||||
|
#else
|
||||||
|
return true;
|
||||||
#endif
|
#endif
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@ -251,10 +276,8 @@ ClientTiledPaintedLayer::RenderHighPrecision(nsIntRegion& aInvalidRegion,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only draw progressively when the resolution is unchanged, and we're not
|
// Only draw progressively when the resolution is unchanged
|
||||||
// in a reftest scenario (that's what the HasShadowManager() check is for).
|
if (UseProgressiveDraw() &&
|
||||||
if (gfxPlatform::GetPlatform()->UseProgressivePaint() &&
|
|
||||||
!ClientManager()->HasShadowTarget() &&
|
|
||||||
mContentClient->mTiledBuffer.GetFrameResolution() == mPaintData.mResolution) {
|
mContentClient->mTiledBuffer.GetFrameResolution() == mPaintData.mResolution) {
|
||||||
// Store the old valid region, then clear it before painting.
|
// Store the old valid region, then clear it before painting.
|
||||||
// We clip the old valid region to the visible region, as it only gets
|
// We clip the old valid region to the visible region, as it only gets
|
||||||
@ -418,36 +441,20 @@ ClientTiledPaintedLayer::RenderLayer()
|
|||||||
ToClientLayer(GetMaskLayer())->RenderLayer();
|
ToClientLayer(GetMaskLayer())->RenderLayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
// For more complex cases we need to calculate a bunch of metrics before we
|
|
||||||
// can do the paint.
|
|
||||||
BeginPaint();
|
|
||||||
if (mPaintData.mPaintFinished) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// In some cases we can take a fast path and just be done with it.
|
// In some cases we can take a fast path and just be done with it.
|
||||||
if (UseFastPath()) {
|
if (UseFastPath()) {
|
||||||
TILING_LOG("TILING %p: Taking fast-path\n", this);
|
TILING_LOG("TILING %p: Taking fast-path\n", this);
|
||||||
mValidRegion = neededRegion;
|
mValidRegion = neededRegion;
|
||||||
|
|
||||||
// Make sure that tiles that fall outside of the visible region or outside of the
|
|
||||||
// critical displayport are discarded on the first update. Also make sure that we
|
|
||||||
// only draw stuff inside the critical displayport on the first update.
|
|
||||||
if (!mPaintData.mCriticalDisplayPort.IsEmpty()) {
|
|
||||||
mValidRegion.And(mValidRegion, LayerIntRect::ToUntyped(mPaintData.mCriticalDisplayPort));
|
|
||||||
invalidRegion.And(invalidRegion, LayerIntRect::ToUntyped(mPaintData.mCriticalDisplayPort));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (invalidRegion.IsEmpty()) {
|
|
||||||
EndPaint();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
mContentClient->mTiledBuffer.SetFrameResolution(mPaintData.mResolution);
|
|
||||||
mContentClient->mTiledBuffer.PaintThebes(mValidRegion, invalidRegion, callback, data);
|
mContentClient->mTiledBuffer.PaintThebes(mValidRegion, invalidRegion, callback, data);
|
||||||
ClientManager()->Hold(this);
|
ClientManager()->Hold(this);
|
||||||
mContentClient->UseTiledLayerBuffer(TiledContentClient::TILED_BUFFER);
|
mContentClient->UseTiledLayerBuffer(TiledContentClient::TILED_BUFFER);
|
||||||
EndPaint();
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// For more complex cases we need to calculate a bunch of metrics before we
|
||||||
|
// can do the paint.
|
||||||
|
BeginPaint();
|
||||||
|
if (mPaintData.mPaintFinished) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,6 +106,13 @@ private:
|
|||||||
*/
|
*/
|
||||||
bool IsScrollingOnCompositor(const FrameMetrics& aParentMetrics);
|
bool IsScrollingOnCompositor(const FrameMetrics& aParentMetrics);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if we should use progressive draw on this layer. We will
|
||||||
|
* disable progressive draw based on a preference or if the layer
|
||||||
|
* is not being scrolled.
|
||||||
|
*/
|
||||||
|
bool UseProgressiveDraw();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper function to do the high-precision paint.
|
* Helper function to do the high-precision paint.
|
||||||
* This function returns true if it updated the paint buffer.
|
* This function returns true if it updated the paint buffer.
|
||||||
|
@ -312,7 +312,7 @@ private:
|
|||||||
DECL_GFX_PREF(Once, "layers.d3d11.force-warp", LayersD3D11ForceWARP, bool, false);
|
DECL_GFX_PREF(Once, "layers.d3d11.force-warp", LayersD3D11ForceWARP, bool, false);
|
||||||
DECL_GFX_PREF(Once, "layers.prefer-d3d9", LayersPreferD3D9, bool, false);
|
DECL_GFX_PREF(Once, "layers.prefer-d3d9", LayersPreferD3D9, bool, false);
|
||||||
DECL_GFX_PREF(Once, "layers.prefer-opengl", LayersPreferOpenGL, bool, false);
|
DECL_GFX_PREF(Once, "layers.prefer-opengl", LayersPreferOpenGL, bool, false);
|
||||||
DECL_GFX_PREF(Once, "layers.progressive-paint", ProgressivePaintDoNotUseDirectly, bool, false);
|
DECL_GFX_PREF(Live, "layers.progressive-paint", ProgressivePaintDoNotUseDirectly, bool, false);
|
||||||
DECL_GFX_PREF(Once, "layers.uniformity-info", UniformityInfo, bool, false);
|
DECL_GFX_PREF(Once, "layers.uniformity-info", UniformityInfo, bool, false);
|
||||||
DECL_GFX_PREF(Once, "layers.gralloc.disable", DisableGralloc, bool, false);
|
DECL_GFX_PREF(Once, "layers.gralloc.disable", DisableGralloc, bool, false);
|
||||||
|
|
||||||
|
@ -433,7 +433,7 @@ load 835056.html
|
|||||||
load 836990-1.html
|
load 836990-1.html
|
||||||
load 840480.html
|
load 840480.html
|
||||||
load 847242.html
|
load 847242.html
|
||||||
load 852293.html
|
pref(layers.progressive-paint,false) pref(layers.low-precision-buffer,false) load 852293.html
|
||||||
load 860579-1.html
|
load 860579-1.html
|
||||||
pref(layers.force-active,true) load 859526-1.html
|
pref(layers.force-active,true) load 859526-1.html
|
||||||
pref(layers.force-active,true) load 859630-1.html
|
pref(layers.force-active,true) load 859630-1.html
|
||||||
|
Loading…
Reference in New Issue
Block a user