bool HwcComposer2D::TryRenderWithHwc(Layer* aRoot, nsIWidget* aWidget, bool aGeometryChanged) { if (!mHal->HasHwc()) { return false; } nsScreenGonk* screen = static_cast<nsWindow*>(aWidget)->GetScreen(); if (mList) { mList->flags = mHal->GetGeometryChangedFlag(aGeometryChanged); mList->numHwLayers = 0; mHwcLayerMap.Clear(); } if (mPrepared) { mHal->ResetHwc(); mPrepared = false; } // XXX: The clear() below means all rect vectors will be have to be // reallocated. We may want to avoid this if possible mVisibleRegions.clear(); mScreenRect = screen->GetNaturalBounds(); MOZ_ASSERT(mHwcLayerMap.IsEmpty()); if (!PrepareLayerList(aRoot, mScreenRect, gfx::Matrix())) { mHwcLayerMap.Clear(); LOGD("Render aborted. Nothing was drawn to the screen"); return false; } // Send data to LayerScope for debugging SendtoLayerScope(); if (!TryHwComposition(screen)) { LOGD("Full HWC Composition failed. Fallback to GPU Composition or partial OVERLAY Composition"); LayerScope::CleanLayer(); return false; } LOGD("Frame rendered"); return true; }
bool HwcComposer2D::TryRender(Layer* aRoot, bool aGeometryChanged) { MOZ_ASSERT(Initialized()); if (mList) { setHwcGeometry(aGeometryChanged); mList->numHwLayers = 0; mHwcLayerMap.Clear(); } if (mPrepared) { Reset(); } // XXX: The clear() below means all rect vectors will be have to be // reallocated. We may want to avoid this if possible mVisibleRegions.clear(); MOZ_ASSERT(mHwcLayerMap.IsEmpty()); if (!PrepareLayerList(aRoot, mScreenRect, gfx::Matrix())) { mHwcLayerMap.Clear(); LOGD("Render aborted. Nothing was drawn to the screen"); return false; } // Send data to LayerScope for debugging SendtoLayerScope(); if (!TryHwComposition()) { LOGD("H/W Composition failed"); LayerScope::CleanLayer(); return false; } LOGD("Frame rendered"); return true; }