Loading services/surfaceflinger/BufferLayer.cpp +6 −6 Original line number Original line Diff line number Diff line Loading @@ -615,14 +615,14 @@ void BufferLayer::setPerFrameData(const sp<const DisplayDevice>& displayDevice) auto hwcId = displayDevice->getHwcDisplayId(); auto hwcId = displayDevice->getHwcDisplayId(); auto& hwcInfo = getBE().mHwcLayers[hwcId]; auto& hwcInfo = getBE().mHwcLayers[hwcId]; auto& hwcLayer = hwcInfo.layer; auto& hwcLayer = hwcInfo.layer; auto error = (*hwcLayer)->setVisibleRegion(visible); auto error = hwcLayer->setVisibleRegion(visible); if (error != HWC2::Error::None) { if (error != HWC2::Error::None) { ALOGE("[%s] Failed to set visible region: %s (%d)", mName.string(), ALOGE("[%s] Failed to set visible region: %s (%d)", mName.string(), to_string(error).c_str(), static_cast<int32_t>(error)); to_string(error).c_str(), static_cast<int32_t>(error)); visible.dump(LOG_TAG); visible.dump(LOG_TAG); } } error = (*hwcLayer)->setSurfaceDamage(surfaceDamageRegion); error = hwcLayer->setSurfaceDamage(surfaceDamageRegion); if (error != HWC2::Error::None) { if (error != HWC2::Error::None) { ALOGE("[%s] Failed to set surface damage: %s (%d)", mName.string(), ALOGE("[%s] Failed to set surface damage: %s (%d)", mName.string(), to_string(error).c_str(), static_cast<int32_t>(error)); to_string(error).c_str(), static_cast<int32_t>(error)); Loading @@ -633,7 +633,7 @@ void BufferLayer::setPerFrameData(const sp<const DisplayDevice>& displayDevice) if (getBE().compositionInfo.hwc.sidebandStream.get()) { if (getBE().compositionInfo.hwc.sidebandStream.get()) { setCompositionType(hwcId, HWC2::Composition::Sideband); setCompositionType(hwcId, HWC2::Composition::Sideband); ALOGV("[%s] Requesting Sideband composition", mName.string()); ALOGV("[%s] Requesting Sideband composition", mName.string()); error = (*hwcLayer)->setSidebandStream(getBE().compositionInfo.hwc.sidebandStream->handle()); error = hwcLayer->setSidebandStream(getBE().compositionInfo.hwc.sidebandStream->handle()); if (error != HWC2::Error::None) { if (error != HWC2::Error::None) { ALOGE("[%s] Failed to set sideband stream %p: %s (%d)", mName.string(), ALOGE("[%s] Failed to set sideband stream %p: %s (%d)", mName.string(), getBE().compositionInfo.hwc.sidebandStream->handle(), to_string(error).c_str(), getBE().compositionInfo.hwc.sidebandStream->handle(), to_string(error).c_str(), Loading @@ -652,14 +652,14 @@ void BufferLayer::setPerFrameData(const sp<const DisplayDevice>& displayDevice) } } ALOGV("setPerFrameData: dataspace = %d", mCurrentDataSpace); ALOGV("setPerFrameData: dataspace = %d", mCurrentDataSpace); error = (*hwcLayer)->setDataspace(mCurrentDataSpace); error = hwcLayer->setDataspace(mCurrentDataSpace); if (error != HWC2::Error::None) { if (error != HWC2::Error::None) { ALOGE("[%s] Failed to set dataspace %d: %s (%d)", mName.string(), mCurrentDataSpace, ALOGE("[%s] Failed to set dataspace %d: %s (%d)", mName.string(), mCurrentDataSpace, to_string(error).c_str(), static_cast<int32_t>(error)); to_string(error).c_str(), static_cast<int32_t>(error)); } } const HdrMetadata& metadata = mConsumer->getCurrentHdrMetadata(); const HdrMetadata& metadata = mConsumer->getCurrentHdrMetadata(); error = (*hwcLayer)->setPerFrameMetadata(displayDevice->getSupportedPerFrameMetadata(), metadata); error = hwcLayer->setPerFrameMetadata(displayDevice->getSupportedPerFrameMetadata(), metadata); if (error != HWC2::Error::None && error != HWC2::Error::Unsupported) { if (error != HWC2::Error::None && error != HWC2::Error::Unsupported) { ALOGE("[%s] Failed to set hdrMetadata: %s (%d)", mName.string(), ALOGE("[%s] Failed to set hdrMetadata: %s (%d)", mName.string(), to_string(error).c_str(), static_cast<int32_t>(error)); to_string(error).c_str(), static_cast<int32_t>(error)); Loading @@ -671,7 +671,7 @@ void BufferLayer::setPerFrameData(const sp<const DisplayDevice>& displayDevice) &hwcBuffer); &hwcBuffer); auto acquireFence = mConsumer->getCurrentFence(); auto acquireFence = mConsumer->getCurrentFence(); error = (*hwcLayer)->setBuffer(hwcSlot, hwcBuffer, acquireFence); error = hwcLayer->setBuffer(hwcSlot, hwcBuffer, acquireFence); if (error != HWC2::Error::None) { if (error != HWC2::Error::None) { ALOGE("[%s] Failed to set buffer %p: %s (%d)", mName.string(), ALOGE("[%s] Failed to set buffer %p: %s (%d)", mName.string(), getBE().compositionInfo.mBuffer->handle, to_string(error).c_str(), getBE().compositionInfo.mBuffer->handle, to_string(error).c_str(), Loading services/surfaceflinger/ColorLayer.cpp +4 −4 Original line number Original line Diff line number Diff line Loading @@ -68,7 +68,7 @@ void ColorLayer::setPerFrameData(const sp<const DisplayDevice>& displayDevice) { auto hwcId = displayDevice->getHwcDisplayId(); auto hwcId = displayDevice->getHwcDisplayId(); auto& hwcInfo = getBE().mHwcLayers[hwcId]; auto& hwcInfo = getBE().mHwcLayers[hwcId]; auto& hwcLayer = hwcInfo.layer; auto& hwcLayer = hwcInfo.layer; auto error = (*hwcLayer)->setVisibleRegion(visible); auto error = hwcLayer->setVisibleRegion(visible); if (error != HWC2::Error::None) { if (error != HWC2::Error::None) { ALOGE("[%s] Failed to set visible region: %s (%d)", mName.string(), ALOGE("[%s] Failed to set visible region: %s (%d)", mName.string(), to_string(error).c_str(), static_cast<int32_t>(error)); to_string(error).c_str(), static_cast<int32_t>(error)); Loading @@ -77,14 +77,14 @@ void ColorLayer::setPerFrameData(const sp<const DisplayDevice>& displayDevice) { setCompositionType(hwcId, HWC2::Composition::SolidColor); setCompositionType(hwcId, HWC2::Composition::SolidColor); error = (*hwcLayer)->setDataspace(mCurrentDataSpace); error = hwcLayer->setDataspace(mCurrentDataSpace); if (error != HWC2::Error::None) { if (error != HWC2::Error::None) { ALOGE("[%s] Failed to set dataspace %d: %s (%d)", mName.string(), mCurrentDataSpace, ALOGE("[%s] Failed to set dataspace %d: %s (%d)", mName.string(), mCurrentDataSpace, to_string(error).c_str(), static_cast<int32_t>(error)); to_string(error).c_str(), static_cast<int32_t>(error)); } } half4 color = getColor(); half4 color = getColor(); error = (*hwcLayer)->setColor({static_cast<uint8_t>(std::round(255.0f * color.r)), error = hwcLayer->setColor({static_cast<uint8_t>(std::round(255.0f * color.r)), static_cast<uint8_t>(std::round(255.0f * color.g)), static_cast<uint8_t>(std::round(255.0f * color.g)), static_cast<uint8_t>(std::round(255.0f * color.b)), 255}); static_cast<uint8_t>(std::round(255.0f * color.b)), 255}); if (error != HWC2::Error::None) { if (error != HWC2::Error::None) { Loading @@ -93,7 +93,7 @@ void ColorLayer::setPerFrameData(const sp<const DisplayDevice>& displayDevice) { } } // Clear out the transform, because it doesn't make sense absent a source buffer // Clear out the transform, because it doesn't make sense absent a source buffer error = (*hwcLayer)->setTransform(HWC2::Transform::None); error = hwcLayer->setTransform(HWC2::Transform::None); if (error != HWC2::Error::None) { if (error != HWC2::Error::None) { ALOGE("[%s] Failed to clear transform: %s (%d)", mName.string(), to_string(error).c_str(), ALOGE("[%s] Failed to clear transform: %s (%d)", mName.string(), to_string(error).c_str(), static_cast<int32_t>(error)); static_cast<int32_t>(error)); Loading services/surfaceflinger/Layer.cpp +18 −18 Original line number Original line Diff line number Diff line Loading @@ -218,14 +218,15 @@ sp<IBinder> Layer::getHandle() { bool Layer::createHwcLayer(HWComposer* hwc, int32_t hwcId) { bool Layer::createHwcLayer(HWComposer* hwc, int32_t hwcId) { LOG_ALWAYS_FATAL_IF(getBE().mHwcLayers.count(hwcId) != 0, LOG_ALWAYS_FATAL_IF(getBE().mHwcLayers.count(hwcId) != 0, "Already have a layer for hwcId %d", hwcId); "Already have a layer for hwcId %d", hwcId); HWC2::Layer* layer = hwc->createLayer(hwcId); std::shared_ptr<LayerContainer> layer(new LayerContainer(hwc, hwcId)); if (!layer) { if (!layer) { return false; return false; } } LayerBE::HWCInfo& hwcInfo = getBE().mHwcLayers[hwcId]; LayerBE::HWCInfo& hwcInfo = getBE().mHwcLayers[hwcId]; hwcInfo.hwc = hwc; hwcInfo.hwc = hwc; hwcInfo.layer = layer; hwcInfo.layer = layer; layer->setLayerDestroyedListener( [this, hwcId](HWC2::Layer* /*layer*/) { getBE().mHwcLayers.erase(hwcId); }); return true; return true; } } Loading @@ -236,12 +237,11 @@ bool Layer::destroyHwcLayer(int32_t hwcId) { auto& hwcInfo = getBE().mHwcLayers[hwcId]; auto& hwcInfo = getBE().mHwcLayers[hwcId]; LOG_ALWAYS_FATAL_IF(hwcInfo.layer == nullptr, "Attempt to destroy null layer"); LOG_ALWAYS_FATAL_IF(hwcInfo.layer == nullptr, "Attempt to destroy null layer"); LOG_ALWAYS_FATAL_IF(hwcInfo.hwc == nullptr, "Missing HWComposer"); LOG_ALWAYS_FATAL_IF(hwcInfo.hwc == nullptr, "Missing HWComposer"); hwcInfo.layer = nullptr; hwcInfo.hwc->destroyLayer(hwcId, hwcInfo.layer); // The layer destroyed listener should have cleared the entry from if (getBE().mHwcLayers.count(hwcId) == 1) { // mHwcLayers. Verify that. getBE().mHwcLayers.erase(hwcId); LOG_ALWAYS_FATAL_IF(getBE().mHwcLayers.count(hwcId) != 0, } "Stale layer entry in getBE().mHwcLayers"); return true; return true; } } Loading Loading @@ -500,7 +500,7 @@ void Layer::setGeometry(const sp<const DisplayDevice>& displayDevice, uint32_t z blendMode = blendMode = mPremultipliedAlpha ? HWC2::BlendMode::Premultiplied : HWC2::BlendMode::Coverage; mPremultipliedAlpha ? HWC2::BlendMode::Premultiplied : HWC2::BlendMode::Coverage; } } auto error = (*hwcLayer)->setBlendMode(blendMode); auto error = hwcLayer->setBlendMode(blendMode); ALOGE_IF(error != HWC2::Error::None, ALOGE_IF(error != HWC2::Error::None, "[%s] Failed to set blend mode %s:" "[%s] Failed to set blend mode %s:" " %s (%d)", " %s (%d)", Loading Loading @@ -548,7 +548,7 @@ void Layer::setGeometry(const sp<const DisplayDevice>& displayDevice, uint32_t z } } const Transform& tr(displayDevice->getTransform()); const Transform& tr(displayDevice->getTransform()); Rect transformedFrame = tr.transform(frame); Rect transformedFrame = tr.transform(frame); error = (*hwcLayer)->setDisplayFrame(transformedFrame); error = hwcLayer->setDisplayFrame(transformedFrame); if (error != HWC2::Error::None) { if (error != HWC2::Error::None) { ALOGE("[%s] Failed to set display frame [%d, %d, %d, %d]: %s (%d)", mName.string(), ALOGE("[%s] Failed to set display frame [%d, %d, %d, %d]: %s (%d)", mName.string(), transformedFrame.left, transformedFrame.top, transformedFrame.right, transformedFrame.left, transformedFrame.top, transformedFrame.right, Loading @@ -558,7 +558,7 @@ void Layer::setGeometry(const sp<const DisplayDevice>& displayDevice, uint32_t z } } FloatRect sourceCrop = computeCrop(displayDevice); FloatRect sourceCrop = computeCrop(displayDevice); error = (*hwcLayer)->setSourceCrop(sourceCrop); error = hwcLayer->setSourceCrop(sourceCrop); if (error != HWC2::Error::None) { if (error != HWC2::Error::None) { ALOGE("[%s] Failed to set source crop [%.3f, %.3f, %.3f, %.3f]: " ALOGE("[%s] Failed to set source crop [%.3f, %.3f, %.3f, %.3f]: " "%s (%d)", "%s (%d)", Loading @@ -569,13 +569,13 @@ void Layer::setGeometry(const sp<const DisplayDevice>& displayDevice, uint32_t z } } float alpha = static_cast<float>(getAlpha()); float alpha = static_cast<float>(getAlpha()); error = (*hwcLayer)->setPlaneAlpha(alpha); error = hwcLayer->setPlaneAlpha(alpha); ALOGE_IF(error != HWC2::Error::None, ALOGE_IF(error != HWC2::Error::None, "[%s] Failed to set plane alpha %.3f: " "[%s] Failed to set plane alpha %.3f: " "%s (%d)", "%s (%d)", mName.string(), alpha, to_string(error).c_str(), static_cast<int32_t>(error)); mName.string(), alpha, to_string(error).c_str(), static_cast<int32_t>(error)); error = (*hwcLayer)->setZOrder(z); error = hwcLayer->setZOrder(z); ALOGE_IF(error != HWC2::Error::None, "[%s] Failed to set Z %u: %s (%d)", mName.string(), z, ALOGE_IF(error != HWC2::Error::None, "[%s] Failed to set Z %u: %s (%d)", mName.string(), z, to_string(error).c_str(), static_cast<int32_t>(error)); to_string(error).c_str(), static_cast<int32_t>(error)); Loading @@ -590,7 +590,7 @@ void Layer::setGeometry(const sp<const DisplayDevice>& displayDevice, uint32_t z } } } } error = (*hwcLayer)->setInfo(type, appId); error = hwcLayer->setInfo(type, appId); ALOGE_IF(error != HWC2::Error::None, "[%s] Failed to set info (%d)", mName.string(), ALOGE_IF(error != HWC2::Error::None, "[%s] Failed to set info (%d)", mName.string(), static_cast<int32_t>(error)); static_cast<int32_t>(error)); Loading Loading @@ -633,7 +633,7 @@ void Layer::setGeometry(const sp<const DisplayDevice>& displayDevice, uint32_t z } else { } else { auto transform = static_cast<HWC2::Transform>(orientation); auto transform = static_cast<HWC2::Transform>(orientation); hwcInfo.transform = transform; hwcInfo.transform = transform; auto error = (*hwcLayer)->setTransform(transform); auto error = hwcLayer->setTransform(transform); ALOGE_IF(error != HWC2::Error::None, ALOGE_IF(error != HWC2::Error::None, "[%s] Failed to set transform %s: " "[%s] Failed to set transform %s: " "%s (%d)", "%s (%d)", Loading Loading @@ -686,7 +686,7 @@ void Layer::updateCursorPosition(const sp<const DisplayDevice>& displayDevice) { auto& displayTransform(displayDevice->getTransform()); auto& displayTransform(displayDevice->getTransform()); auto position = displayTransform.transform(frame); auto position = displayTransform.transform(frame); auto error = (*getBE().mHwcLayers[hwcId].layer)->setCursorPosition(position.left, auto error = getBE().mHwcLayers[hwcId].layer->setCursorPosition(position.left, position.top); position.top); ALOGE_IF(error != HWC2::Error::None, ALOGE_IF(error != HWC2::Error::None, "[%s] Failed to set cursor position " "[%s] Failed to set cursor position " Loading Loading @@ -730,13 +730,13 @@ void Layer::setCompositionType(int32_t hwcId, HWC2::Composition type, bool callI } } auto& hwcInfo = getBE().mHwcLayers[hwcId]; auto& hwcInfo = getBE().mHwcLayers[hwcId]; auto& hwcLayer = hwcInfo.layer; auto& hwcLayer = hwcInfo.layer; ALOGV("setCompositionType(%" PRIx64 ", %s, %d)", (*hwcLayer)->getId(), to_string(type).c_str(), ALOGV("setCompositionType(%" PRIx64 ", %s, %d)", hwcLayer->getId(), to_string(type).c_str(), static_cast<int>(callIntoHwc)); static_cast<int>(callIntoHwc)); if (hwcInfo.compositionType != type) { if (hwcInfo.compositionType != type) { ALOGV(" actually setting"); ALOGV(" actually setting"); hwcInfo.compositionType = type; hwcInfo.compositionType = type; if (callIntoHwc) { if (callIntoHwc) { auto error = (*hwcLayer)->setCompositionType(type); auto error = hwcLayer->setCompositionType(type); ALOGE_IF(error != HWC2::Error::None, ALOGE_IF(error != HWC2::Error::None, "[%s] Failed to set " "[%s] Failed to set " "composition type %s: %s (%d)", "composition type %s: %s (%d)", Loading services/surfaceflinger/Layer.h +1 −9 Original line number Original line Diff line number Diff line Loading @@ -455,15 +455,7 @@ public: if (getBE().mHwcLayers.count(hwcId) == 0) { if (getBE().mHwcLayers.count(hwcId) == 0) { return nullptr; return nullptr; } } return *(getBE().mHwcLayers[hwcId].layer.get()); return getBE().mHwcLayers[hwcId].layer; } bool setHwcLayer(int32_t hwcId) { if (getBE().mHwcLayers.count(hwcId) == 0) { return false; } getBE().compositionInfo.hwc.hwcLayer = getBE().mHwcLayers[hwcId].layer; return true; } } // ----------------------------------------------------------------------- // ----------------------------------------------------------------------- Loading services/surfaceflinger/LayerBE.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -35,7 +35,7 @@ void LayerBE::onLayerDisplayed(const sp<Fence>& releaseFence) { } } void CompositionInfo::dumpHwc(const char* tag) const { void CompositionInfo::dumpHwc(const char* tag) const { ALOGV("[%s]\thwcLayer=%p", tag, static_cast<HWC2::Layer*>(*hwc.hwcLayer)); ALOGV("[%s]\thwcLayer=%p", tag, hwc.hwcLayer); ALOGV("[%s]\tfence=%p", tag, hwc.fence.get()); ALOGV("[%s]\tfence=%p", tag, hwc.fence.get()); ALOGV("[%s]\ttransform=%d", tag, hwc.transform); ALOGV("[%s]\ttransform=%d", tag, hwc.transform); ALOGV("[%s]\tz=%d", tag, hwc.z); ALOGV("[%s]\tz=%d", tag, hwc.z); Loading Loading
services/surfaceflinger/BufferLayer.cpp +6 −6 Original line number Original line Diff line number Diff line Loading @@ -615,14 +615,14 @@ void BufferLayer::setPerFrameData(const sp<const DisplayDevice>& displayDevice) auto hwcId = displayDevice->getHwcDisplayId(); auto hwcId = displayDevice->getHwcDisplayId(); auto& hwcInfo = getBE().mHwcLayers[hwcId]; auto& hwcInfo = getBE().mHwcLayers[hwcId]; auto& hwcLayer = hwcInfo.layer; auto& hwcLayer = hwcInfo.layer; auto error = (*hwcLayer)->setVisibleRegion(visible); auto error = hwcLayer->setVisibleRegion(visible); if (error != HWC2::Error::None) { if (error != HWC2::Error::None) { ALOGE("[%s] Failed to set visible region: %s (%d)", mName.string(), ALOGE("[%s] Failed to set visible region: %s (%d)", mName.string(), to_string(error).c_str(), static_cast<int32_t>(error)); to_string(error).c_str(), static_cast<int32_t>(error)); visible.dump(LOG_TAG); visible.dump(LOG_TAG); } } error = (*hwcLayer)->setSurfaceDamage(surfaceDamageRegion); error = hwcLayer->setSurfaceDamage(surfaceDamageRegion); if (error != HWC2::Error::None) { if (error != HWC2::Error::None) { ALOGE("[%s] Failed to set surface damage: %s (%d)", mName.string(), ALOGE("[%s] Failed to set surface damage: %s (%d)", mName.string(), to_string(error).c_str(), static_cast<int32_t>(error)); to_string(error).c_str(), static_cast<int32_t>(error)); Loading @@ -633,7 +633,7 @@ void BufferLayer::setPerFrameData(const sp<const DisplayDevice>& displayDevice) if (getBE().compositionInfo.hwc.sidebandStream.get()) { if (getBE().compositionInfo.hwc.sidebandStream.get()) { setCompositionType(hwcId, HWC2::Composition::Sideband); setCompositionType(hwcId, HWC2::Composition::Sideband); ALOGV("[%s] Requesting Sideband composition", mName.string()); ALOGV("[%s] Requesting Sideband composition", mName.string()); error = (*hwcLayer)->setSidebandStream(getBE().compositionInfo.hwc.sidebandStream->handle()); error = hwcLayer->setSidebandStream(getBE().compositionInfo.hwc.sidebandStream->handle()); if (error != HWC2::Error::None) { if (error != HWC2::Error::None) { ALOGE("[%s] Failed to set sideband stream %p: %s (%d)", mName.string(), ALOGE("[%s] Failed to set sideband stream %p: %s (%d)", mName.string(), getBE().compositionInfo.hwc.sidebandStream->handle(), to_string(error).c_str(), getBE().compositionInfo.hwc.sidebandStream->handle(), to_string(error).c_str(), Loading @@ -652,14 +652,14 @@ void BufferLayer::setPerFrameData(const sp<const DisplayDevice>& displayDevice) } } ALOGV("setPerFrameData: dataspace = %d", mCurrentDataSpace); ALOGV("setPerFrameData: dataspace = %d", mCurrentDataSpace); error = (*hwcLayer)->setDataspace(mCurrentDataSpace); error = hwcLayer->setDataspace(mCurrentDataSpace); if (error != HWC2::Error::None) { if (error != HWC2::Error::None) { ALOGE("[%s] Failed to set dataspace %d: %s (%d)", mName.string(), mCurrentDataSpace, ALOGE("[%s] Failed to set dataspace %d: %s (%d)", mName.string(), mCurrentDataSpace, to_string(error).c_str(), static_cast<int32_t>(error)); to_string(error).c_str(), static_cast<int32_t>(error)); } } const HdrMetadata& metadata = mConsumer->getCurrentHdrMetadata(); const HdrMetadata& metadata = mConsumer->getCurrentHdrMetadata(); error = (*hwcLayer)->setPerFrameMetadata(displayDevice->getSupportedPerFrameMetadata(), metadata); error = hwcLayer->setPerFrameMetadata(displayDevice->getSupportedPerFrameMetadata(), metadata); if (error != HWC2::Error::None && error != HWC2::Error::Unsupported) { if (error != HWC2::Error::None && error != HWC2::Error::Unsupported) { ALOGE("[%s] Failed to set hdrMetadata: %s (%d)", mName.string(), ALOGE("[%s] Failed to set hdrMetadata: %s (%d)", mName.string(), to_string(error).c_str(), static_cast<int32_t>(error)); to_string(error).c_str(), static_cast<int32_t>(error)); Loading @@ -671,7 +671,7 @@ void BufferLayer::setPerFrameData(const sp<const DisplayDevice>& displayDevice) &hwcBuffer); &hwcBuffer); auto acquireFence = mConsumer->getCurrentFence(); auto acquireFence = mConsumer->getCurrentFence(); error = (*hwcLayer)->setBuffer(hwcSlot, hwcBuffer, acquireFence); error = hwcLayer->setBuffer(hwcSlot, hwcBuffer, acquireFence); if (error != HWC2::Error::None) { if (error != HWC2::Error::None) { ALOGE("[%s] Failed to set buffer %p: %s (%d)", mName.string(), ALOGE("[%s] Failed to set buffer %p: %s (%d)", mName.string(), getBE().compositionInfo.mBuffer->handle, to_string(error).c_str(), getBE().compositionInfo.mBuffer->handle, to_string(error).c_str(), Loading
services/surfaceflinger/ColorLayer.cpp +4 −4 Original line number Original line Diff line number Diff line Loading @@ -68,7 +68,7 @@ void ColorLayer::setPerFrameData(const sp<const DisplayDevice>& displayDevice) { auto hwcId = displayDevice->getHwcDisplayId(); auto hwcId = displayDevice->getHwcDisplayId(); auto& hwcInfo = getBE().mHwcLayers[hwcId]; auto& hwcInfo = getBE().mHwcLayers[hwcId]; auto& hwcLayer = hwcInfo.layer; auto& hwcLayer = hwcInfo.layer; auto error = (*hwcLayer)->setVisibleRegion(visible); auto error = hwcLayer->setVisibleRegion(visible); if (error != HWC2::Error::None) { if (error != HWC2::Error::None) { ALOGE("[%s] Failed to set visible region: %s (%d)", mName.string(), ALOGE("[%s] Failed to set visible region: %s (%d)", mName.string(), to_string(error).c_str(), static_cast<int32_t>(error)); to_string(error).c_str(), static_cast<int32_t>(error)); Loading @@ -77,14 +77,14 @@ void ColorLayer::setPerFrameData(const sp<const DisplayDevice>& displayDevice) { setCompositionType(hwcId, HWC2::Composition::SolidColor); setCompositionType(hwcId, HWC2::Composition::SolidColor); error = (*hwcLayer)->setDataspace(mCurrentDataSpace); error = hwcLayer->setDataspace(mCurrentDataSpace); if (error != HWC2::Error::None) { if (error != HWC2::Error::None) { ALOGE("[%s] Failed to set dataspace %d: %s (%d)", mName.string(), mCurrentDataSpace, ALOGE("[%s] Failed to set dataspace %d: %s (%d)", mName.string(), mCurrentDataSpace, to_string(error).c_str(), static_cast<int32_t>(error)); to_string(error).c_str(), static_cast<int32_t>(error)); } } half4 color = getColor(); half4 color = getColor(); error = (*hwcLayer)->setColor({static_cast<uint8_t>(std::round(255.0f * color.r)), error = hwcLayer->setColor({static_cast<uint8_t>(std::round(255.0f * color.r)), static_cast<uint8_t>(std::round(255.0f * color.g)), static_cast<uint8_t>(std::round(255.0f * color.g)), static_cast<uint8_t>(std::round(255.0f * color.b)), 255}); static_cast<uint8_t>(std::round(255.0f * color.b)), 255}); if (error != HWC2::Error::None) { if (error != HWC2::Error::None) { Loading @@ -93,7 +93,7 @@ void ColorLayer::setPerFrameData(const sp<const DisplayDevice>& displayDevice) { } } // Clear out the transform, because it doesn't make sense absent a source buffer // Clear out the transform, because it doesn't make sense absent a source buffer error = (*hwcLayer)->setTransform(HWC2::Transform::None); error = hwcLayer->setTransform(HWC2::Transform::None); if (error != HWC2::Error::None) { if (error != HWC2::Error::None) { ALOGE("[%s] Failed to clear transform: %s (%d)", mName.string(), to_string(error).c_str(), ALOGE("[%s] Failed to clear transform: %s (%d)", mName.string(), to_string(error).c_str(), static_cast<int32_t>(error)); static_cast<int32_t>(error)); Loading
services/surfaceflinger/Layer.cpp +18 −18 Original line number Original line Diff line number Diff line Loading @@ -218,14 +218,15 @@ sp<IBinder> Layer::getHandle() { bool Layer::createHwcLayer(HWComposer* hwc, int32_t hwcId) { bool Layer::createHwcLayer(HWComposer* hwc, int32_t hwcId) { LOG_ALWAYS_FATAL_IF(getBE().mHwcLayers.count(hwcId) != 0, LOG_ALWAYS_FATAL_IF(getBE().mHwcLayers.count(hwcId) != 0, "Already have a layer for hwcId %d", hwcId); "Already have a layer for hwcId %d", hwcId); HWC2::Layer* layer = hwc->createLayer(hwcId); std::shared_ptr<LayerContainer> layer(new LayerContainer(hwc, hwcId)); if (!layer) { if (!layer) { return false; return false; } } LayerBE::HWCInfo& hwcInfo = getBE().mHwcLayers[hwcId]; LayerBE::HWCInfo& hwcInfo = getBE().mHwcLayers[hwcId]; hwcInfo.hwc = hwc; hwcInfo.hwc = hwc; hwcInfo.layer = layer; hwcInfo.layer = layer; layer->setLayerDestroyedListener( [this, hwcId](HWC2::Layer* /*layer*/) { getBE().mHwcLayers.erase(hwcId); }); return true; return true; } } Loading @@ -236,12 +237,11 @@ bool Layer::destroyHwcLayer(int32_t hwcId) { auto& hwcInfo = getBE().mHwcLayers[hwcId]; auto& hwcInfo = getBE().mHwcLayers[hwcId]; LOG_ALWAYS_FATAL_IF(hwcInfo.layer == nullptr, "Attempt to destroy null layer"); LOG_ALWAYS_FATAL_IF(hwcInfo.layer == nullptr, "Attempt to destroy null layer"); LOG_ALWAYS_FATAL_IF(hwcInfo.hwc == nullptr, "Missing HWComposer"); LOG_ALWAYS_FATAL_IF(hwcInfo.hwc == nullptr, "Missing HWComposer"); hwcInfo.layer = nullptr; hwcInfo.hwc->destroyLayer(hwcId, hwcInfo.layer); // The layer destroyed listener should have cleared the entry from if (getBE().mHwcLayers.count(hwcId) == 1) { // mHwcLayers. Verify that. getBE().mHwcLayers.erase(hwcId); LOG_ALWAYS_FATAL_IF(getBE().mHwcLayers.count(hwcId) != 0, } "Stale layer entry in getBE().mHwcLayers"); return true; return true; } } Loading Loading @@ -500,7 +500,7 @@ void Layer::setGeometry(const sp<const DisplayDevice>& displayDevice, uint32_t z blendMode = blendMode = mPremultipliedAlpha ? HWC2::BlendMode::Premultiplied : HWC2::BlendMode::Coverage; mPremultipliedAlpha ? HWC2::BlendMode::Premultiplied : HWC2::BlendMode::Coverage; } } auto error = (*hwcLayer)->setBlendMode(blendMode); auto error = hwcLayer->setBlendMode(blendMode); ALOGE_IF(error != HWC2::Error::None, ALOGE_IF(error != HWC2::Error::None, "[%s] Failed to set blend mode %s:" "[%s] Failed to set blend mode %s:" " %s (%d)", " %s (%d)", Loading Loading @@ -548,7 +548,7 @@ void Layer::setGeometry(const sp<const DisplayDevice>& displayDevice, uint32_t z } } const Transform& tr(displayDevice->getTransform()); const Transform& tr(displayDevice->getTransform()); Rect transformedFrame = tr.transform(frame); Rect transformedFrame = tr.transform(frame); error = (*hwcLayer)->setDisplayFrame(transformedFrame); error = hwcLayer->setDisplayFrame(transformedFrame); if (error != HWC2::Error::None) { if (error != HWC2::Error::None) { ALOGE("[%s] Failed to set display frame [%d, %d, %d, %d]: %s (%d)", mName.string(), ALOGE("[%s] Failed to set display frame [%d, %d, %d, %d]: %s (%d)", mName.string(), transformedFrame.left, transformedFrame.top, transformedFrame.right, transformedFrame.left, transformedFrame.top, transformedFrame.right, Loading @@ -558,7 +558,7 @@ void Layer::setGeometry(const sp<const DisplayDevice>& displayDevice, uint32_t z } } FloatRect sourceCrop = computeCrop(displayDevice); FloatRect sourceCrop = computeCrop(displayDevice); error = (*hwcLayer)->setSourceCrop(sourceCrop); error = hwcLayer->setSourceCrop(sourceCrop); if (error != HWC2::Error::None) { if (error != HWC2::Error::None) { ALOGE("[%s] Failed to set source crop [%.3f, %.3f, %.3f, %.3f]: " ALOGE("[%s] Failed to set source crop [%.3f, %.3f, %.3f, %.3f]: " "%s (%d)", "%s (%d)", Loading @@ -569,13 +569,13 @@ void Layer::setGeometry(const sp<const DisplayDevice>& displayDevice, uint32_t z } } float alpha = static_cast<float>(getAlpha()); float alpha = static_cast<float>(getAlpha()); error = (*hwcLayer)->setPlaneAlpha(alpha); error = hwcLayer->setPlaneAlpha(alpha); ALOGE_IF(error != HWC2::Error::None, ALOGE_IF(error != HWC2::Error::None, "[%s] Failed to set plane alpha %.3f: " "[%s] Failed to set plane alpha %.3f: " "%s (%d)", "%s (%d)", mName.string(), alpha, to_string(error).c_str(), static_cast<int32_t>(error)); mName.string(), alpha, to_string(error).c_str(), static_cast<int32_t>(error)); error = (*hwcLayer)->setZOrder(z); error = hwcLayer->setZOrder(z); ALOGE_IF(error != HWC2::Error::None, "[%s] Failed to set Z %u: %s (%d)", mName.string(), z, ALOGE_IF(error != HWC2::Error::None, "[%s] Failed to set Z %u: %s (%d)", mName.string(), z, to_string(error).c_str(), static_cast<int32_t>(error)); to_string(error).c_str(), static_cast<int32_t>(error)); Loading @@ -590,7 +590,7 @@ void Layer::setGeometry(const sp<const DisplayDevice>& displayDevice, uint32_t z } } } } error = (*hwcLayer)->setInfo(type, appId); error = hwcLayer->setInfo(type, appId); ALOGE_IF(error != HWC2::Error::None, "[%s] Failed to set info (%d)", mName.string(), ALOGE_IF(error != HWC2::Error::None, "[%s] Failed to set info (%d)", mName.string(), static_cast<int32_t>(error)); static_cast<int32_t>(error)); Loading Loading @@ -633,7 +633,7 @@ void Layer::setGeometry(const sp<const DisplayDevice>& displayDevice, uint32_t z } else { } else { auto transform = static_cast<HWC2::Transform>(orientation); auto transform = static_cast<HWC2::Transform>(orientation); hwcInfo.transform = transform; hwcInfo.transform = transform; auto error = (*hwcLayer)->setTransform(transform); auto error = hwcLayer->setTransform(transform); ALOGE_IF(error != HWC2::Error::None, ALOGE_IF(error != HWC2::Error::None, "[%s] Failed to set transform %s: " "[%s] Failed to set transform %s: " "%s (%d)", "%s (%d)", Loading Loading @@ -686,7 +686,7 @@ void Layer::updateCursorPosition(const sp<const DisplayDevice>& displayDevice) { auto& displayTransform(displayDevice->getTransform()); auto& displayTransform(displayDevice->getTransform()); auto position = displayTransform.transform(frame); auto position = displayTransform.transform(frame); auto error = (*getBE().mHwcLayers[hwcId].layer)->setCursorPosition(position.left, auto error = getBE().mHwcLayers[hwcId].layer->setCursorPosition(position.left, position.top); position.top); ALOGE_IF(error != HWC2::Error::None, ALOGE_IF(error != HWC2::Error::None, "[%s] Failed to set cursor position " "[%s] Failed to set cursor position " Loading Loading @@ -730,13 +730,13 @@ void Layer::setCompositionType(int32_t hwcId, HWC2::Composition type, bool callI } } auto& hwcInfo = getBE().mHwcLayers[hwcId]; auto& hwcInfo = getBE().mHwcLayers[hwcId]; auto& hwcLayer = hwcInfo.layer; auto& hwcLayer = hwcInfo.layer; ALOGV("setCompositionType(%" PRIx64 ", %s, %d)", (*hwcLayer)->getId(), to_string(type).c_str(), ALOGV("setCompositionType(%" PRIx64 ", %s, %d)", hwcLayer->getId(), to_string(type).c_str(), static_cast<int>(callIntoHwc)); static_cast<int>(callIntoHwc)); if (hwcInfo.compositionType != type) { if (hwcInfo.compositionType != type) { ALOGV(" actually setting"); ALOGV(" actually setting"); hwcInfo.compositionType = type; hwcInfo.compositionType = type; if (callIntoHwc) { if (callIntoHwc) { auto error = (*hwcLayer)->setCompositionType(type); auto error = hwcLayer->setCompositionType(type); ALOGE_IF(error != HWC2::Error::None, ALOGE_IF(error != HWC2::Error::None, "[%s] Failed to set " "[%s] Failed to set " "composition type %s: %s (%d)", "composition type %s: %s (%d)", Loading
services/surfaceflinger/Layer.h +1 −9 Original line number Original line Diff line number Diff line Loading @@ -455,15 +455,7 @@ public: if (getBE().mHwcLayers.count(hwcId) == 0) { if (getBE().mHwcLayers.count(hwcId) == 0) { return nullptr; return nullptr; } } return *(getBE().mHwcLayers[hwcId].layer.get()); return getBE().mHwcLayers[hwcId].layer; } bool setHwcLayer(int32_t hwcId) { if (getBE().mHwcLayers.count(hwcId) == 0) { return false; } getBE().compositionInfo.hwc.hwcLayer = getBE().mHwcLayers[hwcId].layer; return true; } } // ----------------------------------------------------------------------- // ----------------------------------------------------------------------- Loading
services/surfaceflinger/LayerBE.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -35,7 +35,7 @@ void LayerBE::onLayerDisplayed(const sp<Fence>& releaseFence) { } } void CompositionInfo::dumpHwc(const char* tag) const { void CompositionInfo::dumpHwc(const char* tag) const { ALOGV("[%s]\thwcLayer=%p", tag, static_cast<HWC2::Layer*>(*hwc.hwcLayer)); ALOGV("[%s]\thwcLayer=%p", tag, hwc.hwcLayer); ALOGV("[%s]\tfence=%p", tag, hwc.fence.get()); ALOGV("[%s]\tfence=%p", tag, hwc.fence.get()); ALOGV("[%s]\ttransform=%d", tag, hwc.transform); ALOGV("[%s]\ttransform=%d", tag, hwc.transform); ALOGV("[%s]\tz=%d", tag, hwc.z); ALOGV("[%s]\tz=%d", tag, hwc.z); Loading