bool HwcLayerList::update(hwc_display_contents_1_t *list) { bool ret; bool updateError = false; log.v("HwcLayerList::update"); // basic check to make sure the consistance if (!list) { log.e("update: null layer list"); return false; } if (list->numHwLayers != mLayerCount || list->numHwLayers != mLayers.size()) { log.e("update: update layer count doesn't match (%d, %d, %d)", list->numHwLayers, mLayerCount, mLayers.size()); return false; } // update list mList = list; do { updateError = false; // update all layers, call each layer's update() for (size_t i = 0; i < list->numHwLayers; i++) { HwcLayer *hwcLayer = mLayers.itemAt(i); if (!hwcLayer) { log.e("update: no HWC layer for layer %d", i); continue; } ret = hwcLayer->update(&list->hwLayers[i], mDisplayIndex); if (ret == false) { log.i("update: failed to update layer %d", i); updateError = true; // set layer to FB layer hwcLayer->setType(HwcLayer::LAYER_FB); // remove layer from overlay layer list mOverlayLayers.remove(hwcLayer); // add layer to FB layer list mFBLayers.add(hwcLayer); // revisit the overlay assignment. revisit(); } } } while (updateError && mOverlayLayers.size()); return true; }
void CloningVisitor::visitArithmeticValueNode(const ArithmeticValueNode &expr) { expr.getLeft().visit(*this); bool lhsConstVal = _constVal; int lhsPriority = _priority; std::unique_ptr<ValueNode> lhs(std::move(_valueNode)); revisit(); expr.getRight().visit(*this); bool rhsConstVal = _constVal; int rhsPriority = _priority; std::unique_ptr<ValueNode> rhs(std::move(_valueNode)); setArithmeticValueNode(expr, std::move(lhs), lhsPriority, lhsConstVal, std::move(rhs), rhsPriority, rhsConstVal); }
void CloningVisitor::visitOrBranch(const Or &expr) { int priority = OrPriority; expr.getLeft().visit(*this); bool lhsConstVal = _constVal; ResultSet lhsSet(_resultSet); setNodeParentheses(priority); std::unique_ptr<Node> lhs(std::move(_node)); revisit(); expr.getRight().visit(*this); _constVal &= lhsConstVal; _resultSet.calcOr(lhsSet); setNodeParentheses(priority); std::unique_ptr<Node> rhs(std::move(_node)); _priority = priority; _node.reset(new Or(std::move(lhs), std::move(rhs), "or")); };
/** * This is the SOSI depart code for propagating a change upward */ void depart_internal(qc32s_node_t* first, int32_t n) { qc32s_node_t * curr = first; while (true) { // compute the min value of children bool changed = revisit(curr, n); // return if revisit do not change the current node if (!changed) return; // Propagate the depart up to the parent if (!curr->my_parent) return; curr = curr->my_parent; } }
void CloningVisitor::visitComparison(const Compare &expr) { int priority = ComparePriority; expr.getLeft().visit(*this); bool lhsConstVal = _constVal; setValueNodeParentheses(priority); std::unique_ptr<ValueNode> lhs(std::move(_valueNode)); revisit(); expr.getRight().visit(*this); _constVal &= lhsConstVal; setValueNodeParentheses(priority); std::unique_ptr<ValueNode> rhs(std::move(_valueNode)); const Operator &op(expr.getOperator()); _priority = priority; _resultSet.fill(); // should be less if const _node.reset(new Compare(std::move(lhs), op, std::move(rhs), expr.getBucketIdFactory())); };
void HwcLayerList::analyzeFrom(uint32_t index) { int freeSpriteCount = 0; int freeOverlayCount = 0; bool primaryAvailable = true; int supportExtendVideo = 0; IDisplayPlane *plane; if (!mList || index >= mLayerCount) return; // load prop HwcConfig::getInstance().extendVideo(supportExtendVideo); freeSpriteCount = mDisplayPlaneManager.getFreeSpriteCount(); freeOverlayCount = mDisplayPlaneManager.getFreeOverlayCount(); // if no primary plane if (!mPrimaryPlane) primaryAvailable = false; // if the number of layers > the number of all free planes if (mLayerCount > (freeSpriteCount + freeOverlayCount + 1)) primaryAvailable = false; // go through layer list from top to bottom for (int i = index; i >= 0; i--) { hwc_layer_1_t *layer = &mList->hwLayers[i]; if (!layer) continue; // new hwc layer HwcLayer *hwcLayer = new HwcLayer(i, layer); if (!hwcLayer) { log.e("failed to allocate hwc layer"); continue; } // insert layer to layers mLayers.add(hwcLayer); // if a HWC_FRAMEBUFFER_TARGET layer, save it to the last if (layer->compositionType & HWC_FRAMEBUFFER_TARGET) { mFramebufferTarget = hwcLayer; continue; } // check whether the layer can be handled by sprite plane if (freeSpriteCount) { plane = mDisplayPlaneManager.getDummySpritePlane(); if (!plane) log.e("failed to get dummy sprite plane"); else if (check(*plane, *layer)) { log.v("sprite check passed for layer %d", i); plane = mDisplayPlaneManager.getSpritePlane(); if (plane) { // attach plane to hwc layer hwcLayer->attachPlane(plane); // set the layer type to sprite hwcLayer->setType(HwcLayer::LAYER_SPRITE); } } } // check whether the layer can be handled by overlay plane if (freeOverlayCount) { plane = mDisplayPlaneManager.getDummyOverlayPlane(); if (!plane) { log.e("failed to get dummy sprite plane"); } else if (check(*plane, *layer)) { log.v("overlay check passed for layer %d", i); plane = mDisplayPlaneManager.getOverlayPlane(); if (plane) { // attach plane to hwc layer hwcLayer->attachPlane(plane); // set the layer type to overlay hwcLayer->setType(HwcLayer::LAYER_OVERLAY); } // check wheter we are supporting extend video mode if (supportExtendVideo) { bool extConnected = Drm::getInstance().outputConnected(Drm::OUTPUT_HDMI); if (extConnected && plane && !mDisplayIndex) { hwcLayer->detachPlane(); mDisplayPlaneManager.putOverlayPlane(*plane); } hwcLayer->setType(HwcLayer::LAYER_OVERLAY); } } } // if still FB layer if (!hwcLayer->getType()) mFBLayers.add(hwcLayer); else mOverlayLayers.add(hwcLayer); } // for (ssize_t i = index; i >= 0; i--) // revisit the plane assignments revisit(); }