PLayerTransactionParent* CrossProcessCompositorParent::AllocPLayerTransactionParent(const nsTArray<LayersBackend>&, const uint64_t& aId, TextureFactoryIdentifier* aTextureFactoryIdentifier, bool *aSuccess) { MOZ_ASSERT(aId != 0); CompositorParent::LayerTreeState* state = nullptr; LayerTreeMap::iterator itr = sIndirectLayerTrees.find(aId); if (sIndirectLayerTrees.end() != itr) { state = &itr->second; } if (state && state->mLayerManager) { state->mCrossProcessParent = this; LayerManagerComposite* lm = state->mLayerManager; *aTextureFactoryIdentifier = lm->GetCompositor()->GetTextureFactoryIdentifier(); *aSuccess = true; LayerTransactionParent* p = new LayerTransactionParent(lm, this, aId, mChildProcessId); p->AddIPDLReference(); sIndirectLayerTrees[aId].mLayerTree = p; return p; } NS_WARNING("Created child without a matching parent?"); // XXX: should be false, but that causes us to fail some tests on Mac w/ OMTC. // Bug 900745. change *aSuccess to false to see test failures. *aSuccess = true; LayerTransactionParent* p = new LayerTransactionParent(nullptr, this, aId, mChildProcessId); p->AddIPDLReference(); return p; }
void CompositorParent::NotifyShadowTreeTransaction() { if (mLayerManager) { LayerManagerComposite* managerComposite = mLayerManager->AsLayerManagerComposite(); if (managerComposite) { managerComposite->NotifyShadowTreeTransaction(); } } ScheduleComposition(); }
gfxRect ThebesLayerComposite::GetDisplayPort() { // We use GetTransform instead of GetEffectiveTransform in this function // as we want the transform of the shadowable layers and not that of the // shadow layers, which may have been modified due to async scrolling/ // zooming. gfx3DMatrix transform = GetTransform(); // Find out the area of the nearest display-port to invalidate retained // tiles. gfxRect displayPort; gfxSize parentResolution = GetEffectiveResolution(); for (ContainerLayer* parent = GetParent(); parent; parent = parent->GetParent()) { const FrameMetrics& metrics = parent->GetFrameMetrics(); if (displayPort.IsEmpty()) { if (!metrics.mDisplayPort.IsEmpty()) { // We use the bounds to cut down on complication/computation time. // This will be incorrect when the transform involves rotation, but // it'd be quite hard to retain invalid tiles correctly in this // situation anyway. displayPort = gfxRect(metrics.mDisplayPort.x, metrics.mDisplayPort.y, metrics.mDisplayPort.width, metrics.mDisplayPort.height); displayPort.ScaleRoundOut(parentResolution.width, parentResolution.height); } parentResolution.width /= metrics.mResolution.scale; parentResolution.height /= metrics.mResolution.scale; } if (parent->UseIntermediateSurface()) { transform.PreMultiply(parent->GetTransform()); } } // If no display port was found, use the widget size from the layer manager. if (displayPort.IsEmpty()) { LayerManagerComposite* manager = static_cast<LayerManagerComposite*>(Manager()); const nsIntSize& widgetSize = manager->GetWidgetSize(); displayPort.width = widgetSize.width; displayPort.height = widgetSize.height; } // Transform the display port into layer space. displayPort = transform.Inverse().TransformBounds(displayPort); return displayPort; }
bool EmbedLiteCompositorParent::RenderGL() { LOGF(); bool retval = true; NS_ENSURE_TRUE(IsGLBackend(), false); LayerManagerComposite* mgr = GetLayerManager(); if (!mgr->GetRoot()) { retval = false; } if (IsGLBackend()) { mgr->SetWorldTransform(mWorldTransform); } if (!mActiveClipping.IsEmpty() && mgr->GetRoot()) { mgr->GetRoot()->SetClipRect(&mActiveClipping); } CompositorParent::Composite(); return retval; }
void CompositorParent::ShadowLayersUpdated(LayerTransactionParent* aLayerTree, const TargetConfig& aTargetConfig, bool isFirstPaint) { if (!isFirstPaint && !mCompositionManager->IsFirstPaint() && mCompositionManager->RequiresReorientation(aTargetConfig.orientation())) { if (mForceCompositionTask != nullptr) { mForceCompositionTask->Cancel(); } mForceCompositionTask = NewRunnableMethod(this, &CompositorParent::ForceComposition); ScheduleTask(mForceCompositionTask, gfxPlatform::GetPlatform()->GetOrientationSyncMillis()); } // Instruct the LayerManager to update its render bounds now. Since all the orientation // change, dimension change would be done at the stage, update the size here is free of // race condition. mLayerManager->UpdateRenderBounds(aTargetConfig.clientBounds()); mCompositionManager->Updated(isFirstPaint, aTargetConfig); Layer* root = aLayerTree->GetRoot(); mLayerManager->SetRoot(root); if (mApzcTreeManager) { AutoResolveRefLayers resolve(mCompositionManager); mApzcTreeManager->UpdatePanZoomControllerTree(this, root, isFirstPaint, mRootLayerTreeID); } if (root) { SetShadowProperties(root); if (mIsTesting) { mCompositionManager->TransformShadowTree(mTestTime); } } ScheduleComposition(); LayerManagerComposite *layerComposite = mLayerManager->AsLayerManagerComposite(); if (layerComposite) { layerComposite->NotifyShadowTreeTransaction(); } }
PLayerTransactionParent* CrossProcessCompositorBridgeParent::AllocPLayerTransactionParent( const nsTArray<LayersBackend>&, const uint64_t& aId, TextureFactoryIdentifier* aTextureFactoryIdentifier, bool *aSuccess) { MOZ_ASSERT(aId != 0); // Check to see if this child process has access to this layer tree. if (!LayerTreeOwnerTracker::Get()->IsMapped(aId, OtherPid())) { NS_ERROR("Unexpected layers id in AllocPLayerTransactionParent; dropping message..."); return nullptr; } MonitorAutoLock lock(*sIndirectLayerTreesLock); CompositorBridgeParent::LayerTreeState* state = nullptr; LayerTreeMap::iterator itr = sIndirectLayerTrees.find(aId); if (sIndirectLayerTrees.end() != itr) { state = &itr->second; } if (state && state->mLayerManager) { state->mCrossProcessParent = this; LayerManagerComposite* lm = state->mLayerManager; *aTextureFactoryIdentifier = lm->GetCompositor()->GetTextureFactoryIdentifier(); *aSuccess = true; LayerTransactionParent* p = new LayerTransactionParent(lm, this, aId); p->AddIPDLReference(); sIndirectLayerTrees[aId].mLayerTree = p; p->SetPendingCompositorUpdates(state->mPendingCompositorUpdates); return p; } NS_WARNING("Created child without a matching parent?"); *aSuccess = false; LayerTransactionParent* p = new LayerTransactionParent(nullptr, this, aId); p->AddIPDLReference(); return p; }
PLayerTransactionParent* CrossProcessCompositorParent::AllocPLayerTransactionParent(const nsTArray<LayersBackend>&, const uint64_t& aId, TextureFactoryIdentifier* aTextureFactoryIdentifier, bool *aSuccess) { MOZ_ASSERT(aId != 0); if (sIndirectLayerTrees[aId].mParent) { LayerManagerComposite* lm = sIndirectLayerTrees[aId].mParent->GetLayerManager(); *aTextureFactoryIdentifier = lm->GetTextureFactoryIdentifier(); *aSuccess = true; return new LayerTransactionParent(lm, this, aId); } NS_WARNING("Created child without a matching parent?"); // XXX: should be false, but that causes us to fail some tests on Mac w/ OMTC. // Bug 900745. change *aSuccess to false to see test failures. *aSuccess = true; return new LayerTransactionParent(nullptr, this, aId); }