Loading services/surfaceflinger/BufferLayer.cpp +9 −49 Original line number Diff line number Diff line Loading @@ -633,37 +633,14 @@ void BufferLayer::setPerFrameData(const sp<const DisplayDevice>& display) { const auto& viewport = display->getViewport(); Region visible = tr.transform(visibleRegion.intersect(viewport)); const auto displayId = display->getId(); if (!hasHwcLayer(displayId)) { ALOGE("[%s] failed to setPerFrameData: no HWC layer found (%d)", mName.string(), displayId); return; } auto& hwcInfo = getBE().mHwcLayers[displayId]; auto& hwcLayer = hwcInfo.layer; auto error = hwcLayer->setVisibleRegion(visible); if (error != HWC2::Error::None) { ALOGE("[%s] Failed to set visible region: %s (%d)", mName.string(), to_string(error).c_str(), static_cast<int32_t>(error)); visible.dump(LOG_TAG); } error = hwcLayer->setSurfaceDamage(surfaceDamageRegion); if (error != HWC2::Error::None) { ALOGE("[%s] Failed to set surface damage: %s (%d)", mName.string(), to_string(error).c_str(), static_cast<int32_t>(error)); surfaceDamageRegion.dump(LOG_TAG); } getBE().compositionInfo.hwc.visibleRegion = visible; getBE().compositionInfo.hwc.surfaceDamage = surfaceDamageRegion; // Sideband layers if (getBE().compositionInfo.hwc.sidebandStream.get()) { setCompositionType(displayId, HWC2::Composition::Sideband); ALOGV("[%s] Requesting Sideband composition", mName.string()); error = hwcLayer->setSidebandStream(getBE().compositionInfo.hwc.sidebandStream->handle()); if (error != HWC2::Error::None) { ALOGE("[%s] Failed to set sideband stream %p: %s (%d)", mName.string(), getBE().compositionInfo.hwc.sidebandStream->handle(), to_string(error).c_str(), static_cast<int32_t>(error)); } getBE().compositionInfo.compositionType = HWC2::Composition::Sideband; return; } Loading @@ -676,31 +653,14 @@ void BufferLayer::setPerFrameData(const sp<const DisplayDevice>& display) { setCompositionType(displayId, HWC2::Composition::Device); } ALOGV("setPerFrameData: dataspace = %d", mCurrentDataSpace); error = hwcLayer->setDataspace(mCurrentDataSpace); if (error != HWC2::Error::None) { ALOGE("[%s] Failed to set dataspace %d: %s (%d)", mName.string(), mCurrentDataSpace, to_string(error).c_str(), static_cast<int32_t>(error)); } const HdrMetadata& metadata = mConsumer->getCurrentHdrMetadata(); error = hwcLayer->setPerFrameMetadata(display->getSupportedPerFrameMetadata(), metadata); if (error != HWC2::Error::None && error != HWC2::Error::Unsupported) { ALOGE("[%s] Failed to set hdrMetadata: %s (%d)", mName.string(), to_string(error).c_str(), static_cast<int32_t>(error)); } uint32_t hwcSlot = 0; sp<GraphicBuffer> hwcBuffer; hwcInfo.bufferCache.getHwcBuffer(mActiveBufferSlot, mActiveBuffer, &hwcSlot, &hwcBuffer); getBE().compositionInfo.hwc.dataspace = mCurrentDataSpace; getBE().compositionInfo.hwc.hdrMetadata = mConsumer->getCurrentHdrMetadata(); getBE().compositionInfo.hwc.supportedPerFrameMetadata = display->getSupportedPerFrameMetadata(); auto acquireFence = mConsumer->getCurrentFence(); error = hwcLayer->setBuffer(hwcSlot, hwcBuffer, acquireFence); if (error != HWC2::Error::None) { ALOGE("[%s] Failed to set buffer %p: %s (%d)", mName.string(), getBE().compositionInfo.mBuffer->handle, to_string(error).c_str(), static_cast<int32_t>(error)); } getBE().compositionInfo.mBufferSlot = mActiveBufferSlot; getBE().compositionInfo.mBuffer = mActiveBuffer; getBE().compositionInfo.hwc.fence = acquireFence; } bool BufferLayer::isOpaque(const Layer::State& s) const { Loading services/surfaceflinger/ColorLayer.cpp +6 −31 Original line number Diff line number Diff line Loading @@ -77,43 +77,18 @@ void ColorLayer::setPerFrameData(const sp<const DisplayDevice>& display) { const auto& viewport = display->getViewport(); Region visible = tr.transform(visibleRegion.intersect(viewport)); const auto displayId = display->getId(); if (!hasHwcLayer(displayId)) { ALOGE("[%s] failed to setPerFrameData: no HWC layer found (%d)", mName.string(), displayId); return; } auto& hwcInfo = getBE().mHwcLayers[displayId]; auto& hwcLayer = hwcInfo.layer; auto error = hwcLayer->setVisibleRegion(visible); if (error != HWC2::Error::None) { ALOGE("[%s] Failed to set visible region: %s (%d)", mName.string(), to_string(error).c_str(), static_cast<int32_t>(error)); visible.dump(LOG_TAG); } getBE().compositionInfo.hwc.visibleRegion = visible; getBE().compositionInfo.hwc.dataspace = mCurrentDataSpace; setCompositionType(displayId, HWC2::Composition::SolidColor); error = hwcLayer->setDataspace(mCurrentDataSpace); if (error != HWC2::Error::None) { ALOGE("[%s] Failed to set dataspace %d: %s (%d)", mName.string(), mCurrentDataSpace, to_string(error).c_str(), static_cast<int32_t>(error)); } half4 color = getColor(); error = hwcLayer->setColor({static_cast<uint8_t>(std::round(255.0f * color.r)), getBE().compositionInfo.hwc.color = { 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.b)), 255}); if (error != HWC2::Error::None) { ALOGE("[%s] Failed to set color: %s (%d)", mName.string(), to_string(error).c_str(), static_cast<int32_t>(error)); } static_cast<uint8_t>(std::round(255.0f * color.b)), 255 }; // Clear out the transform, because it doesn't make sense absent a source buffer error = hwcLayer->setTransform(HWC2::Transform::None); if (error != HWC2::Error::None) { ALOGE("[%s] Failed to clear transform: %s (%d)", mName.string(), to_string(error).c_str(), static_cast<int32_t>(error)); } getBE().compositionInfo.hwc.transform = HWC2::Transform::None; } // --------------------------------------------------------------------------- Loading services/surfaceflinger/Layer.cpp +15 −47 Original line number Diff line number Diff line Loading @@ -503,6 +503,9 @@ void Layer::setGeometry(const sp<const DisplayDevice>& display, uint32_t z) { } auto& hwcInfo = getBE().mHwcLayers[displayId]; // Need to program geometry parts getBE().compositionInfo.hwc.skipGeometry = false; // enable this layer hwcInfo.forceClientComposition = false; Loading @@ -510,8 +513,6 @@ void Layer::setGeometry(const sp<const DisplayDevice>& display, uint32_t z) { hwcInfo.forceClientComposition = true; } auto& hwcLayer = hwcInfo.layer; // this gives us only the "orientation" component of the transform const State& s(getDrawingState()); auto blendMode = HWC2::BlendMode::None; Loading @@ -519,12 +520,7 @@ void Layer::setGeometry(const sp<const DisplayDevice>& display, uint32_t z) { blendMode = mPremultipliedAlpha ? HWC2::BlendMode::Premultiplied : HWC2::BlendMode::Coverage; } auto error = hwcLayer->setBlendMode(blendMode); ALOGE_IF(error != HWC2::Error::None, "[%s] Failed to set blend mode %s:" " %s (%d)", mName.string(), to_string(blendMode).c_str(), to_string(error).c_str(), static_cast<int32_t>(error)); getBE().compositionInfo.hwc.blendMode = blendMode; // apply the layer's transform, followed by the display's global transform // here we're guaranteed that the layer's transform preserves rects Loading Loading @@ -567,36 +563,15 @@ void Layer::setGeometry(const sp<const DisplayDevice>& display, uint32_t z) { } const Transform& tr = display->getTransform(); Rect transformedFrame = tr.transform(frame); error = hwcLayer->setDisplayFrame(transformedFrame); if (error != HWC2::Error::None) { ALOGE("[%s] Failed to set display frame [%d, %d, %d, %d]: %s (%d)", mName.string(), transformedFrame.left, transformedFrame.top, transformedFrame.right, transformedFrame.bottom, to_string(error).c_str(), static_cast<int32_t>(error)); } else { hwcInfo.displayFrame = transformedFrame; } getBE().compositionInfo.hwc.displayFrame = transformedFrame; FloatRect sourceCrop = computeCrop(display); error = hwcLayer->setSourceCrop(sourceCrop); if (error != HWC2::Error::None) { ALOGE("[%s] Failed to set source crop [%.3f, %.3f, %.3f, %.3f]: " "%s (%d)", mName.string(), sourceCrop.left, sourceCrop.top, sourceCrop.right, sourceCrop.bottom, to_string(error).c_str(), static_cast<int32_t>(error)); } else { hwcInfo.sourceCrop = sourceCrop; } getBE().compositionInfo.hwc.sourceCrop = sourceCrop; float alpha = static_cast<float>(getAlpha()); error = hwcLayer->setPlaneAlpha(alpha); ALOGE_IF(error != HWC2::Error::None, "[%s] Failed to set plane alpha %.3f: " "%s (%d)", mName.string(), alpha, to_string(error).c_str(), static_cast<int32_t>(error)); getBE().compositionInfo.hwc.alpha = alpha; error = hwcLayer->setZOrder(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)); getBE().compositionInfo.hwc.z = z; int type = s.type; int appId = s.appId; Loading @@ -609,9 +584,8 @@ void Layer::setGeometry(const sp<const DisplayDevice>& display, uint32_t z) { } } error = hwcLayer->setInfo(type, appId); ALOGE_IF(error != HWC2::Error::None, "[%s] Failed to set info (%d)", mName.string(), static_cast<int32_t>(error)); getBE().compositionInfo.hwc.type = type; getBE().compositionInfo.hwc.appId = appId; /* * Transformations are applied in this order: Loading Loading @@ -648,16 +622,11 @@ void Layer::setGeometry(const sp<const DisplayDevice>& display, uint32_t z) { const uint32_t orientation = transform.getOrientation(); if (orientation & Transform::ROT_INVALID) { // we can only handle simple transformation hwcInfo.forceClientComposition = true; getBE().mHwcLayers[displayId].compositionType = HWC2::Composition::Client; } else { auto transform = static_cast<HWC2::Transform>(orientation); hwcInfo.transform = transform; auto error = hwcLayer->setTransform(transform); ALOGE_IF(error != HWC2::Error::None, "[%s] Failed to set transform %s: " "%s (%d)", mName.string(), to_string(transform).c_str(), to_string(error).c_str(), static_cast<int32_t>(error)); getBE().compositionInfo.hwc.transform = transform; } } Loading Loading @@ -1498,17 +1467,16 @@ void Layer::miniDump(String8& result, int32_t displayId) const { result.appendFormat(" %s\n", name.string()); const Layer::State& layerState(getDrawingState()); const LayerBE::HWCInfo& hwcInfo = getBE().mHwcLayers.at(displayId); if (layerState.zOrderRelativeOf != nullptr || mDrawingParent != nullptr) { result.appendFormat(" rel %6d | ", layerState.z); } else { result.appendFormat(" %10d | ", layerState.z); } result.appendFormat("%10s | ", to_string(getCompositionType(displayId)).c_str()); result.appendFormat("%10s | ", to_string(hwcInfo.transform).c_str()); const Rect& frame = hwcInfo.displayFrame; result.appendFormat("%10s | ", to_string(getBE().mHwcLayers[displayId].transform).c_str()); const Rect& frame = getBE().compositionInfo.hwc.displayFrame; result.appendFormat("%4d %4d %4d %4d | ", frame.left, frame.top, frame.right, frame.bottom); const FloatRect& crop = hwcInfo.sourceCrop; const FloatRect& crop = getBE().compositionInfo.hwc.sourceCrop; result.appendFormat("%6.1f %6.1f %6.1f %6.1f\n", crop.left, crop.top, crop.right, crop.bottom); result.append("- - - - - - - - - - - - - - - -"); Loading services/surfaceflinger/Layer.h +8 −0 Original line number Diff line number Diff line Loading @@ -472,6 +472,14 @@ public: return getBE().mHwcLayers[displayId].layer; } bool setHwcLayer(int32_t hwcId) { if (getBE().mHwcLayers.count(hwcId) == 0) { return false; } getBE().compositionInfo.hwc.hwcLayer = getBE().mHwcLayers[hwcId].layer; return true; } // ----------------------------------------------------------------------- void clearWithOpenGL(const RenderArea& renderArea) const; Loading services/surfaceflinger/LayerBE.h +4 −2 Original line number Diff line number Diff line Loading @@ -19,10 +19,9 @@ #include <stdint.h> #include <sys/types.h> #include <gui/HdrMetadata.h> #include <ui/Region.h> #include "SurfaceFlinger.h" #include "DisplayHardware/HWComposer.h" #include "DisplayHardware/HWComposerBufferCache.h" #include "RenderEngine/Mesh.h" Loading @@ -40,6 +39,7 @@ struct CompositionInfo { LayerBE* layer = nullptr; struct { HWC2::Layer* hwcLayer; bool skipGeometry = true; sp<Fence> fence; HWC2::BlendMode blendMode = HWC2::BlendMode::Invalid; Rect displayFrame; Loading @@ -54,6 +54,8 @@ struct CompositionInfo { sp<NativeHandle> sidebandStream; ui::Dataspace dataspace; hwc_color_t color; bool supportedPerFrameMetadata = false; HdrMetadata hdrMetadata; } hwc; struct { Mesh* mesh; Loading Loading
services/surfaceflinger/BufferLayer.cpp +9 −49 Original line number Diff line number Diff line Loading @@ -633,37 +633,14 @@ void BufferLayer::setPerFrameData(const sp<const DisplayDevice>& display) { const auto& viewport = display->getViewport(); Region visible = tr.transform(visibleRegion.intersect(viewport)); const auto displayId = display->getId(); if (!hasHwcLayer(displayId)) { ALOGE("[%s] failed to setPerFrameData: no HWC layer found (%d)", mName.string(), displayId); return; } auto& hwcInfo = getBE().mHwcLayers[displayId]; auto& hwcLayer = hwcInfo.layer; auto error = hwcLayer->setVisibleRegion(visible); if (error != HWC2::Error::None) { ALOGE("[%s] Failed to set visible region: %s (%d)", mName.string(), to_string(error).c_str(), static_cast<int32_t>(error)); visible.dump(LOG_TAG); } error = hwcLayer->setSurfaceDamage(surfaceDamageRegion); if (error != HWC2::Error::None) { ALOGE("[%s] Failed to set surface damage: %s (%d)", mName.string(), to_string(error).c_str(), static_cast<int32_t>(error)); surfaceDamageRegion.dump(LOG_TAG); } getBE().compositionInfo.hwc.visibleRegion = visible; getBE().compositionInfo.hwc.surfaceDamage = surfaceDamageRegion; // Sideband layers if (getBE().compositionInfo.hwc.sidebandStream.get()) { setCompositionType(displayId, HWC2::Composition::Sideband); ALOGV("[%s] Requesting Sideband composition", mName.string()); error = hwcLayer->setSidebandStream(getBE().compositionInfo.hwc.sidebandStream->handle()); if (error != HWC2::Error::None) { ALOGE("[%s] Failed to set sideband stream %p: %s (%d)", mName.string(), getBE().compositionInfo.hwc.sidebandStream->handle(), to_string(error).c_str(), static_cast<int32_t>(error)); } getBE().compositionInfo.compositionType = HWC2::Composition::Sideband; return; } Loading @@ -676,31 +653,14 @@ void BufferLayer::setPerFrameData(const sp<const DisplayDevice>& display) { setCompositionType(displayId, HWC2::Composition::Device); } ALOGV("setPerFrameData: dataspace = %d", mCurrentDataSpace); error = hwcLayer->setDataspace(mCurrentDataSpace); if (error != HWC2::Error::None) { ALOGE("[%s] Failed to set dataspace %d: %s (%d)", mName.string(), mCurrentDataSpace, to_string(error).c_str(), static_cast<int32_t>(error)); } const HdrMetadata& metadata = mConsumer->getCurrentHdrMetadata(); error = hwcLayer->setPerFrameMetadata(display->getSupportedPerFrameMetadata(), metadata); if (error != HWC2::Error::None && error != HWC2::Error::Unsupported) { ALOGE("[%s] Failed to set hdrMetadata: %s (%d)", mName.string(), to_string(error).c_str(), static_cast<int32_t>(error)); } uint32_t hwcSlot = 0; sp<GraphicBuffer> hwcBuffer; hwcInfo.bufferCache.getHwcBuffer(mActiveBufferSlot, mActiveBuffer, &hwcSlot, &hwcBuffer); getBE().compositionInfo.hwc.dataspace = mCurrentDataSpace; getBE().compositionInfo.hwc.hdrMetadata = mConsumer->getCurrentHdrMetadata(); getBE().compositionInfo.hwc.supportedPerFrameMetadata = display->getSupportedPerFrameMetadata(); auto acquireFence = mConsumer->getCurrentFence(); error = hwcLayer->setBuffer(hwcSlot, hwcBuffer, acquireFence); if (error != HWC2::Error::None) { ALOGE("[%s] Failed to set buffer %p: %s (%d)", mName.string(), getBE().compositionInfo.mBuffer->handle, to_string(error).c_str(), static_cast<int32_t>(error)); } getBE().compositionInfo.mBufferSlot = mActiveBufferSlot; getBE().compositionInfo.mBuffer = mActiveBuffer; getBE().compositionInfo.hwc.fence = acquireFence; } bool BufferLayer::isOpaque(const Layer::State& s) const { Loading
services/surfaceflinger/ColorLayer.cpp +6 −31 Original line number Diff line number Diff line Loading @@ -77,43 +77,18 @@ void ColorLayer::setPerFrameData(const sp<const DisplayDevice>& display) { const auto& viewport = display->getViewport(); Region visible = tr.transform(visibleRegion.intersect(viewport)); const auto displayId = display->getId(); if (!hasHwcLayer(displayId)) { ALOGE("[%s] failed to setPerFrameData: no HWC layer found (%d)", mName.string(), displayId); return; } auto& hwcInfo = getBE().mHwcLayers[displayId]; auto& hwcLayer = hwcInfo.layer; auto error = hwcLayer->setVisibleRegion(visible); if (error != HWC2::Error::None) { ALOGE("[%s] Failed to set visible region: %s (%d)", mName.string(), to_string(error).c_str(), static_cast<int32_t>(error)); visible.dump(LOG_TAG); } getBE().compositionInfo.hwc.visibleRegion = visible; getBE().compositionInfo.hwc.dataspace = mCurrentDataSpace; setCompositionType(displayId, HWC2::Composition::SolidColor); error = hwcLayer->setDataspace(mCurrentDataSpace); if (error != HWC2::Error::None) { ALOGE("[%s] Failed to set dataspace %d: %s (%d)", mName.string(), mCurrentDataSpace, to_string(error).c_str(), static_cast<int32_t>(error)); } half4 color = getColor(); error = hwcLayer->setColor({static_cast<uint8_t>(std::round(255.0f * color.r)), getBE().compositionInfo.hwc.color = { 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.b)), 255}); if (error != HWC2::Error::None) { ALOGE("[%s] Failed to set color: %s (%d)", mName.string(), to_string(error).c_str(), static_cast<int32_t>(error)); } static_cast<uint8_t>(std::round(255.0f * color.b)), 255 }; // Clear out the transform, because it doesn't make sense absent a source buffer error = hwcLayer->setTransform(HWC2::Transform::None); if (error != HWC2::Error::None) { ALOGE("[%s] Failed to clear transform: %s (%d)", mName.string(), to_string(error).c_str(), static_cast<int32_t>(error)); } getBE().compositionInfo.hwc.transform = HWC2::Transform::None; } // --------------------------------------------------------------------------- Loading
services/surfaceflinger/Layer.cpp +15 −47 Original line number Diff line number Diff line Loading @@ -503,6 +503,9 @@ void Layer::setGeometry(const sp<const DisplayDevice>& display, uint32_t z) { } auto& hwcInfo = getBE().mHwcLayers[displayId]; // Need to program geometry parts getBE().compositionInfo.hwc.skipGeometry = false; // enable this layer hwcInfo.forceClientComposition = false; Loading @@ -510,8 +513,6 @@ void Layer::setGeometry(const sp<const DisplayDevice>& display, uint32_t z) { hwcInfo.forceClientComposition = true; } auto& hwcLayer = hwcInfo.layer; // this gives us only the "orientation" component of the transform const State& s(getDrawingState()); auto blendMode = HWC2::BlendMode::None; Loading @@ -519,12 +520,7 @@ void Layer::setGeometry(const sp<const DisplayDevice>& display, uint32_t z) { blendMode = mPremultipliedAlpha ? HWC2::BlendMode::Premultiplied : HWC2::BlendMode::Coverage; } auto error = hwcLayer->setBlendMode(blendMode); ALOGE_IF(error != HWC2::Error::None, "[%s] Failed to set blend mode %s:" " %s (%d)", mName.string(), to_string(blendMode).c_str(), to_string(error).c_str(), static_cast<int32_t>(error)); getBE().compositionInfo.hwc.blendMode = blendMode; // apply the layer's transform, followed by the display's global transform // here we're guaranteed that the layer's transform preserves rects Loading Loading @@ -567,36 +563,15 @@ void Layer::setGeometry(const sp<const DisplayDevice>& display, uint32_t z) { } const Transform& tr = display->getTransform(); Rect transformedFrame = tr.transform(frame); error = hwcLayer->setDisplayFrame(transformedFrame); if (error != HWC2::Error::None) { ALOGE("[%s] Failed to set display frame [%d, %d, %d, %d]: %s (%d)", mName.string(), transformedFrame.left, transformedFrame.top, transformedFrame.right, transformedFrame.bottom, to_string(error).c_str(), static_cast<int32_t>(error)); } else { hwcInfo.displayFrame = transformedFrame; } getBE().compositionInfo.hwc.displayFrame = transformedFrame; FloatRect sourceCrop = computeCrop(display); error = hwcLayer->setSourceCrop(sourceCrop); if (error != HWC2::Error::None) { ALOGE("[%s] Failed to set source crop [%.3f, %.3f, %.3f, %.3f]: " "%s (%d)", mName.string(), sourceCrop.left, sourceCrop.top, sourceCrop.right, sourceCrop.bottom, to_string(error).c_str(), static_cast<int32_t>(error)); } else { hwcInfo.sourceCrop = sourceCrop; } getBE().compositionInfo.hwc.sourceCrop = sourceCrop; float alpha = static_cast<float>(getAlpha()); error = hwcLayer->setPlaneAlpha(alpha); ALOGE_IF(error != HWC2::Error::None, "[%s] Failed to set plane alpha %.3f: " "%s (%d)", mName.string(), alpha, to_string(error).c_str(), static_cast<int32_t>(error)); getBE().compositionInfo.hwc.alpha = alpha; error = hwcLayer->setZOrder(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)); getBE().compositionInfo.hwc.z = z; int type = s.type; int appId = s.appId; Loading @@ -609,9 +584,8 @@ void Layer::setGeometry(const sp<const DisplayDevice>& display, uint32_t z) { } } error = hwcLayer->setInfo(type, appId); ALOGE_IF(error != HWC2::Error::None, "[%s] Failed to set info (%d)", mName.string(), static_cast<int32_t>(error)); getBE().compositionInfo.hwc.type = type; getBE().compositionInfo.hwc.appId = appId; /* * Transformations are applied in this order: Loading Loading @@ -648,16 +622,11 @@ void Layer::setGeometry(const sp<const DisplayDevice>& display, uint32_t z) { const uint32_t orientation = transform.getOrientation(); if (orientation & Transform::ROT_INVALID) { // we can only handle simple transformation hwcInfo.forceClientComposition = true; getBE().mHwcLayers[displayId].compositionType = HWC2::Composition::Client; } else { auto transform = static_cast<HWC2::Transform>(orientation); hwcInfo.transform = transform; auto error = hwcLayer->setTransform(transform); ALOGE_IF(error != HWC2::Error::None, "[%s] Failed to set transform %s: " "%s (%d)", mName.string(), to_string(transform).c_str(), to_string(error).c_str(), static_cast<int32_t>(error)); getBE().compositionInfo.hwc.transform = transform; } } Loading Loading @@ -1498,17 +1467,16 @@ void Layer::miniDump(String8& result, int32_t displayId) const { result.appendFormat(" %s\n", name.string()); const Layer::State& layerState(getDrawingState()); const LayerBE::HWCInfo& hwcInfo = getBE().mHwcLayers.at(displayId); if (layerState.zOrderRelativeOf != nullptr || mDrawingParent != nullptr) { result.appendFormat(" rel %6d | ", layerState.z); } else { result.appendFormat(" %10d | ", layerState.z); } result.appendFormat("%10s | ", to_string(getCompositionType(displayId)).c_str()); result.appendFormat("%10s | ", to_string(hwcInfo.transform).c_str()); const Rect& frame = hwcInfo.displayFrame; result.appendFormat("%10s | ", to_string(getBE().mHwcLayers[displayId].transform).c_str()); const Rect& frame = getBE().compositionInfo.hwc.displayFrame; result.appendFormat("%4d %4d %4d %4d | ", frame.left, frame.top, frame.right, frame.bottom); const FloatRect& crop = hwcInfo.sourceCrop; const FloatRect& crop = getBE().compositionInfo.hwc.sourceCrop; result.appendFormat("%6.1f %6.1f %6.1f %6.1f\n", crop.left, crop.top, crop.right, crop.bottom); result.append("- - - - - - - - - - - - - - - -"); Loading
services/surfaceflinger/Layer.h +8 −0 Original line number Diff line number Diff line Loading @@ -472,6 +472,14 @@ public: return getBE().mHwcLayers[displayId].layer; } bool setHwcLayer(int32_t hwcId) { if (getBE().mHwcLayers.count(hwcId) == 0) { return false; } getBE().compositionInfo.hwc.hwcLayer = getBE().mHwcLayers[hwcId].layer; return true; } // ----------------------------------------------------------------------- void clearWithOpenGL(const RenderArea& renderArea) const; Loading
services/surfaceflinger/LayerBE.h +4 −2 Original line number Diff line number Diff line Loading @@ -19,10 +19,9 @@ #include <stdint.h> #include <sys/types.h> #include <gui/HdrMetadata.h> #include <ui/Region.h> #include "SurfaceFlinger.h" #include "DisplayHardware/HWComposer.h" #include "DisplayHardware/HWComposerBufferCache.h" #include "RenderEngine/Mesh.h" Loading @@ -40,6 +39,7 @@ struct CompositionInfo { LayerBE* layer = nullptr; struct { HWC2::Layer* hwcLayer; bool skipGeometry = true; sp<Fence> fence; HWC2::BlendMode blendMode = HWC2::BlendMode::Invalid; Rect displayFrame; Loading @@ -54,6 +54,8 @@ struct CompositionInfo { sp<NativeHandle> sidebandStream; ui::Dataspace dataspace; hwc_color_t color; bool supportedPerFrameMetadata = false; HdrMetadata hdrMetadata; } hwc; struct { Mesh* mesh; Loading