зеркало из https://github.com/mozilla/gecko-dev.git
Bug 965102 - Gecko changes to set HWC_GEOMETRY_CHANGED flag appropriately. r=mattwoodrow
This commit is contained in:
Родитель
13dce8ce1d
Коммит
3dadf39115
|
@ -108,7 +108,7 @@ struct LayerPropertiesBase : public LayerProperties
|
|||
, mMaskLayer(nullptr)
|
||||
, mVisibleRegion(aLayer->GetVisibleRegion())
|
||||
, mInvalidRegion(aLayer->GetInvalidRegion())
|
||||
, mOpacity(aLayer->GetOpacity())
|
||||
, mOpacity(aLayer->GetLocalOpacity())
|
||||
, mUseClipRect(!!aLayer->GetClipRect())
|
||||
{
|
||||
MOZ_COUNT_CTOR(LayerPropertiesBase);
|
||||
|
@ -132,11 +132,13 @@ struct LayerPropertiesBase : public LayerProperties
|
|||
}
|
||||
|
||||
virtual nsIntRegion ComputeDifferences(Layer* aRoot,
|
||||
NotifySubDocInvalidationFunc aCallback);
|
||||
NotifySubDocInvalidationFunc aCallback,
|
||||
bool* aGeometryChanged);
|
||||
|
||||
virtual void MoveBy(const nsIntPoint& aOffset);
|
||||
|
||||
nsIntRegion ComputeChange(NotifySubDocInvalidationFunc aCallback)
|
||||
nsIntRegion ComputeChange(NotifySubDocInvalidationFunc aCallback,
|
||||
bool& aGeometryChanged)
|
||||
{
|
||||
gfx3DMatrix transform;
|
||||
gfx::To3DMatrix(mLayer->GetTransform(), transform);
|
||||
|
@ -146,9 +148,10 @@ struct LayerPropertiesBase : public LayerProperties
|
|||
nsIntRegion result;
|
||||
if ((mMaskLayer ? mMaskLayer->mLayer : nullptr) != otherMask ||
|
||||
(mUseClipRect != !!otherClip) ||
|
||||
mLayer->GetOpacity() != mOpacity ||
|
||||
mLayer->GetLocalOpacity() != mOpacity ||
|
||||
transformChanged)
|
||||
{
|
||||
aGeometryChanged = true;
|
||||
result = OldTransformedBounds();
|
||||
if (transformChanged) {
|
||||
AddRegion(result, NewTransformedBounds());
|
||||
|
@ -165,13 +168,17 @@ struct LayerPropertiesBase : public LayerProperties
|
|||
|
||||
nsIntRegion visible;
|
||||
visible.Xor(mVisibleRegion, mLayer->GetVisibleRegion());
|
||||
if (!visible.IsEmpty()) {
|
||||
aGeometryChanged = true;
|
||||
}
|
||||
AddTransformedRegion(result, visible, mTransform);
|
||||
|
||||
AddRegion(result, ComputeChangeInternal(aCallback));
|
||||
AddRegion(result, ComputeChangeInternal(aCallback, aGeometryChanged));
|
||||
AddTransformedRegion(result, mLayer->GetInvalidRegion(), mTransform);
|
||||
|
||||
if (mMaskLayer && otherMask) {
|
||||
AddTransformedRegion(result, mMaskLayer->ComputeChange(aCallback), mTransform);
|
||||
AddTransformedRegion(result, mMaskLayer->ComputeChange(aCallback, aGeometryChanged),
|
||||
mTransform);
|
||||
}
|
||||
|
||||
if (mUseClipRect && otherClip) {
|
||||
|
@ -198,7 +205,11 @@ struct LayerPropertiesBase : public LayerProperties
|
|||
return TransformRect(mVisibleRegion.GetBounds(), mTransform);
|
||||
}
|
||||
|
||||
virtual nsIntRegion ComputeChangeInternal(NotifySubDocInvalidationFunc aCallback) { return nsIntRect(); }
|
||||
virtual nsIntRegion ComputeChangeInternal(NotifySubDocInvalidationFunc aCallback,
|
||||
bool& aGeometryChanged)
|
||||
{
|
||||
return nsIntRect();
|
||||
}
|
||||
|
||||
nsRefPtr<Layer> mLayer;
|
||||
nsAutoPtr<LayerPropertiesBase> mMaskLayer;
|
||||
|
@ -220,7 +231,8 @@ struct ContainerLayerProperties : public LayerPropertiesBase
|
|||
}
|
||||
}
|
||||
|
||||
virtual nsIntRegion ComputeChangeInternal(NotifySubDocInvalidationFunc aCallback)
|
||||
virtual nsIntRegion ComputeChangeInternal(NotifySubDocInvalidationFunc aCallback,
|
||||
bool& aGeometryChanged)
|
||||
{
|
||||
ContainerLayer* container = mLayer->AsContainerLayer();
|
||||
nsIntRegion result;
|
||||
|
@ -255,7 +267,7 @@ struct ContainerLayerProperties : public LayerPropertiesBase
|
|||
AddRegion(result, mChildren[j]->OldTransformedBounds());
|
||||
}
|
||||
// Invalidate any regions of the child that have changed:
|
||||
AddRegion(result, mChildren[childsOldIndex]->ComputeChange(aCallback));
|
||||
AddRegion(result, mChildren[childsOldIndex]->ComputeChange(aCallback, aGeometryChanged));
|
||||
i = childsOldIndex + 1;
|
||||
} else {
|
||||
// We've already seen this child in mChildren (which means it must
|
||||
|
@ -309,7 +321,8 @@ struct ColorLayerProperties : public LayerPropertiesBase
|
|||
, mColor(aLayer->GetColor())
|
||||
{ }
|
||||
|
||||
virtual nsIntRegion ComputeChangeInternal(NotifySubDocInvalidationFunc aCallback)
|
||||
virtual nsIntRegion ComputeChangeInternal(NotifySubDocInvalidationFunc aCallback,
|
||||
bool& aGeometryChanged)
|
||||
{
|
||||
ColorLayer* color = static_cast<ColorLayer*>(mLayer.get());
|
||||
|
||||
|
@ -334,7 +347,8 @@ struct ImageLayerProperties : public LayerPropertiesBase
|
|||
{
|
||||
}
|
||||
|
||||
virtual nsIntRegion ComputeChangeInternal(NotifySubDocInvalidationFunc aCallback)
|
||||
virtual nsIntRegion ComputeChangeInternal(NotifySubDocInvalidationFunc aCallback,
|
||||
bool& aGeometryChanged)
|
||||
{
|
||||
ImageLayer* imageLayer = static_cast<ImageLayer*>(mLayer.get());
|
||||
|
||||
|
@ -407,7 +421,8 @@ LayerProperties::ClearInvalidations(Layer *aLayer)
|
|||
}
|
||||
|
||||
nsIntRegion
|
||||
LayerPropertiesBase::ComputeDifferences(Layer* aRoot, NotifySubDocInvalidationFunc aCallback)
|
||||
LayerPropertiesBase::ComputeDifferences(Layer* aRoot, NotifySubDocInvalidationFunc aCallback,
|
||||
bool* aGeometryChanged = nullptr)
|
||||
{
|
||||
NS_ASSERTION(aRoot, "Must have a layer tree to compare against!");
|
||||
if (mLayer != aRoot) {
|
||||
|
@ -420,9 +435,17 @@ LayerPropertiesBase::ComputeDifferences(Layer* aRoot, NotifySubDocInvalidationFu
|
|||
gfx::To3DMatrix(aRoot->GetTransform(), transform);
|
||||
nsIntRect result = TransformRect(aRoot->GetVisibleRegion().GetBounds(), transform);
|
||||
result = result.Union(OldTransformedBounds());
|
||||
if (aGeometryChanged != nullptr) {
|
||||
*aGeometryChanged = true;
|
||||
}
|
||||
return result;
|
||||
} else {
|
||||
return ComputeChange(aCallback);
|
||||
bool geometryChanged = (aGeometryChanged != nullptr) ? *aGeometryChanged : false;
|
||||
nsIntRegion invalid = ComputeChange(aCallback, geometryChanged);
|
||||
if (aGeometryChanged != nullptr) {
|
||||
*aGeometryChanged = geometryChanged;
|
||||
}
|
||||
return invalid;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,8 @@ struct LayerProperties
|
|||
* @return Painted area changed by the layer tree changes.
|
||||
*/
|
||||
virtual nsIntRegion ComputeDifferences(Layer* aRoot,
|
||||
NotifySubDocInvalidationFunc aCallback) = 0;
|
||||
NotifySubDocInvalidationFunc aCallback,
|
||||
bool* aGeometryChanged = nullptr) = 0;
|
||||
|
||||
|
||||
virtual void MoveBy(const nsIntPoint& aOffset) = 0;
|
||||
|
|
|
@ -104,6 +104,7 @@ LayerManagerComposite::LayerManagerComposite(Compositor* aCompositor)
|
|||
, mInTransaction(false)
|
||||
, mIsCompositorReady(false)
|
||||
, mDebugOverlayWantsNextFrame(false)
|
||||
, mGeometryChanged(true)
|
||||
{
|
||||
mTextRenderer = new TextRenderer(aCompositor);
|
||||
MOZ_ASSERT(aCompositor);
|
||||
|
@ -155,7 +156,8 @@ LayerManagerComposite::BeginTransaction()
|
|||
|
||||
mIsCompositorReady = true;
|
||||
|
||||
if (Compositor::GetBackend() == LayersBackend::LAYERS_BASIC) {
|
||||
if (Compositor::GetBackend() == LayersBackend::LAYERS_OPENGL ||
|
||||
Compositor::GetBackend() == LayersBackend::LAYERS_BASIC) {
|
||||
mClonedLayerTreeProperties = LayerProperties::CloneFrom(GetRoot());
|
||||
}
|
||||
}
|
||||
|
@ -223,7 +225,8 @@ LayerManagerComposite::EndTransaction(DrawThebesLayerCallback aCallback,
|
|||
}
|
||||
|
||||
if (mRoot && mClonedLayerTreeProperties) {
|
||||
nsIntRegion invalid = mClonedLayerTreeProperties->ComputeDifferences(mRoot, nullptr);
|
||||
nsIntRegion invalid =
|
||||
mClonedLayerTreeProperties->ComputeDifferences(mRoot, nullptr, &mGeometryChanged);
|
||||
mClonedLayerTreeProperties = nullptr;
|
||||
|
||||
mInvalidRegion.Or(mInvalidRegion, invalid);
|
||||
|
@ -243,6 +246,7 @@ LayerManagerComposite::EndTransaction(DrawThebesLayerCallback aCallback,
|
|||
mRoot->ComputeEffectiveTransforms(gfx::Matrix4x4());
|
||||
|
||||
Render();
|
||||
mGeometryChanged = false;
|
||||
}
|
||||
|
||||
mCompositor->SetTargetContext(nullptr);
|
||||
|
@ -448,7 +452,7 @@ LayerManagerComposite::Render()
|
|||
/** Our more efficient but less powerful alter ego, if one is available. */
|
||||
nsRefPtr<Composer2D> composer2D = mCompositor->GetWidget()->GetComposer2D();
|
||||
|
||||
if (!mTarget && composer2D && composer2D->TryRender(mRoot, mWorldMatrix)) {
|
||||
if (!mTarget && composer2D && composer2D->TryRender(mRoot, mWorldMatrix, mGeometryChanged)) {
|
||||
if (mFPS) {
|
||||
double fps = mFPS->mCompositionFps.AddFrameAndGetFps(TimeStamp::Now());
|
||||
if (gfxPrefs::LayersDrawFPS()) {
|
||||
|
|
|
@ -278,6 +278,7 @@ private:
|
|||
bool mDebugOverlayWantsNextFrame;
|
||||
|
||||
RefPtr<TextRenderer> mTextRenderer;
|
||||
bool mGeometryChanged;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -56,7 +56,8 @@ public:
|
|||
* Currently, when TryRender() returns true, the entire framebuffer
|
||||
* must have been rendered.
|
||||
*/
|
||||
virtual bool TryRender(Layer* aRoot, const gfx::Matrix& aWorldTransform) = 0;
|
||||
virtual bool TryRender(Layer* aRoot, const gfx::Matrix& aWorldTransform,
|
||||
bool aGeometryChanged) = 0;
|
||||
};
|
||||
|
||||
} // namespace layers
|
||||
|
|
|
@ -177,6 +177,16 @@ HwcComposer2D::setCrop(HwcLayer* layer, hwc_rect_t srcCrop)
|
|||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
HwcComposer2D::setHwcGeometry(bool aGeometryChanged)
|
||||
{
|
||||
#if ANDROID_VERSION >= 19
|
||||
mList->flags = aGeometryChanged ? HWC_GEOMETRY_CHANGED : 0;
|
||||
#else
|
||||
mList->flags = HWC_GEOMETRY_CHANGED;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
HwcComposer2D::PrepareLayerList(Layer* aLayer,
|
||||
const nsIntRect& aClip,
|
||||
|
@ -613,6 +623,7 @@ HwcComposer2D::Render(EGLDisplay dpy, EGLSurface sur)
|
|||
mList->hwLayers[mList->numHwLayers - 1].handle = fbsurface->lastHandle;
|
||||
mList->hwLayers[mList->numHwLayers - 1].acquireFenceFd = fbsurface->GetPrevFBAcquireFd();
|
||||
} else {
|
||||
mList->flags = HWC_GEOMETRY_CHANGED;
|
||||
mList->numHwLayers = 2;
|
||||
mList->hwLayers[0].hints = 0;
|
||||
mList->hwLayers[0].compositionType = HWC_FRAMEBUFFER;
|
||||
|
@ -639,7 +650,6 @@ HwcComposer2D::Prepare(buffer_handle_t fbHandle, int fence)
|
|||
hwc_display_contents_1_t *displays[HWC_NUM_DISPLAY_TYPES] = { nullptr };
|
||||
|
||||
displays[HWC_DISPLAY_PRIMARY] = mList;
|
||||
mList->flags = HWC_GEOMETRY_CHANGED;
|
||||
mList->outbufAcquireFenceFd = -1;
|
||||
mList->outbuf = nullptr;
|
||||
mList->retireFenceFd = -1;
|
||||
|
@ -734,7 +744,8 @@ HwcComposer2D::Reset()
|
|||
|
||||
bool
|
||||
HwcComposer2D::TryRender(Layer* aRoot,
|
||||
const gfx::Matrix& GLWorldTransform)
|
||||
const gfx::Matrix& GLWorldTransform,
|
||||
bool aGeometryChanged)
|
||||
{
|
||||
gfxMatrix aGLWorldTransform = ThebesMatrix(GLWorldTransform);
|
||||
if (!aGLWorldTransform.PreservesAxisAlignedRectangles()) {
|
||||
|
@ -744,6 +755,7 @@ HwcComposer2D::TryRender(Layer* aRoot,
|
|||
|
||||
MOZ_ASSERT(Initialized());
|
||||
if (mList) {
|
||||
setHwcGeometry(aGeometryChanged);
|
||||
mList->numHwLayers = 0;
|
||||
mHwcLayerMap.Clear();
|
||||
}
|
||||
|
|
|
@ -78,7 +78,8 @@ public:
|
|||
// Returns TRUE if the container has been succesfully rendered
|
||||
// Returns FALSE if the container cannot be fully rendered
|
||||
// by this composer so nothing was rendered at all
|
||||
bool TryRender(layers::Layer* aRoot, const gfx::Matrix& aGLWorldTransform) MOZ_OVERRIDE;
|
||||
bool TryRender(layers::Layer* aRoot, const gfx::Matrix& aGLWorldTransform,
|
||||
bool aGeometryChanged) MOZ_OVERRIDE;
|
||||
|
||||
bool Render(EGLDisplay dpy, EGLSurface sur);
|
||||
|
||||
|
@ -91,6 +92,7 @@ private:
|
|||
bool PrepareLayerList(layers::Layer* aContainer, const nsIntRect& aClip,
|
||||
const gfxMatrix& aParentTransform, const gfxMatrix& aGLWorldTransform);
|
||||
void setCrop(HwcLayer* layer, hwc_rect_t srcCrop);
|
||||
void setHwcGeometry(bool aGeometryChanged);
|
||||
|
||||
HwcDevice* mHwc;
|
||||
HwcList* mList;
|
||||
|
|
Загрузка…
Ссылка в новой задаче