Loading libs/gralloc/OWNERS +3 −0 Original line number Diff line number Diff line # Graphics team alecmouri@google.com chrisforbes@google.com jreck@google.com No newline at end of file libs/gui/LayerState.cpp +18 −6 Original line number Diff line number Diff line Loading @@ -35,7 +35,9 @@ using gui::FocusRequest; using gui::WindowInfoHandle; layer_state_t::layer_state_t() : what(0), : surface(nullptr), layerId(-1), what(0), x(0), y(0), z(0), Loading Loading @@ -153,8 +155,12 @@ status_t layer_state_t::write(Parcel& output) const SAFE_PARCEL(output.writeBool, isTrustedOverlay); SAFE_PARCEL(output.writeUint32, static_cast<uint32_t>(dropInputMode)); SAFE_PARCEL(output.writeNullableParcelable, bufferData ? std::make_optional<BufferData>(*bufferData) : std::nullopt); const bool hasBufferData = (bufferData != nullptr); SAFE_PARCEL(output.writeBool, hasBufferData); if (hasBufferData) { SAFE_PARCEL(output.writeParcelable, *bufferData); } return NO_ERROR; } Loading Loading @@ -264,9 +270,15 @@ status_t layer_state_t::read(const Parcel& input) uint32_t mode; SAFE_PARCEL(input.readUint32, &mode); dropInputMode = static_cast<gui::DropInputMode>(mode); std::optional<BufferData> tmpBufferData; SAFE_PARCEL(input.readParcelable, &tmpBufferData); bufferData = tmpBufferData ? std::make_shared<BufferData>(*tmpBufferData) : nullptr; bool hasBufferData; SAFE_PARCEL(input.readBool, &hasBufferData); if (hasBufferData) { bufferData = std::make_shared<BufferData>(); SAFE_PARCEL(input.readParcelable, bufferData.get()); } else { bufferData = nullptr; } return NO_ERROR; } Loading services/surfaceflinger/Layer.cpp +8 −10 Original line number Diff line number Diff line Loading @@ -1993,29 +1993,31 @@ void Layer::setInputInfo(const WindowInfo& info) { setTransactionFlags(eTransactionNeeded); } LayerProto* Layer::writeToProto(LayersProto& layersProto, uint32_t traceFlags, const DisplayDevice* display) { LayerProto* Layer::writeToProto(LayersProto& layersProto, uint32_t traceFlags) { LayerProto* layerProto = layersProto.add_layers(); writeToProtoDrawingState(layerProto, traceFlags, display); writeToProtoDrawingState(layerProto); writeToProtoCommonState(layerProto, LayerVector::StateSet::Drawing, traceFlags); if (traceFlags & LayerTracing::TRACE_COMPOSITION) { // Only populate for the primary display. UnnecessaryLock assumeLocked(mFlinger->mStateLock); // called from the main thread. const auto display = mFlinger->getDefaultDisplayDeviceLocked(); if (display) { const auto compositionType = getCompositionType(*display); layerProto->set_hwc_composition_type(static_cast<HwcCompositionType>(compositionType)); LayerProtoHelper::writeToProto(getVisibleRegion(display.get()), [&]() { return layerProto->mutable_visible_region(); }); } } for (const sp<Layer>& layer : mDrawingChildren) { layer->writeToProto(layersProto, traceFlags, display); layer->writeToProto(layersProto, traceFlags); } return layerProto; } void Layer::writeToProtoDrawingState(LayerProto* layerInfo, uint32_t traceFlags, const DisplayDevice* display) { void Layer::writeToProtoDrawingState(LayerProto* layerInfo) { const ui::Transform transform = getTransform(); auto buffer = getExternalTexture(); if (buffer != nullptr) { Loading @@ -2039,10 +2041,6 @@ void Layer::writeToProtoDrawingState(LayerProto* layerInfo, uint32_t traceFlags, LayerProtoHelper::writePositionToProto(transform.tx(), transform.ty(), [&]() { return layerInfo->mutable_position(); }); LayerProtoHelper::writeToProto(mBounds, [&]() { return layerInfo->mutable_bounds(); }); if (traceFlags & LayerTracing::TRACE_COMPOSITION) { LayerProtoHelper::writeToProto(getVisibleRegion(display), [&]() { return layerInfo->mutable_visible_region(); }); } LayerProtoHelper::writeToProto(surfaceDamageRegion, [&]() { return layerInfo->mutable_damage_region(); }); Loading services/surfaceflinger/Layer.h +2 −2 Original line number Diff line number Diff line Loading @@ -686,12 +686,12 @@ public: bool isRemovedFromCurrentState() const; LayerProto* writeToProto(LayersProto& layersProto, uint32_t traceFlags, const DisplayDevice*); LayerProto* writeToProto(LayersProto& layersProto, uint32_t traceFlags); // Write states that are modified by the main thread. This includes drawing // state as well as buffer data. This should be called in the main or tracing // thread. void writeToProtoDrawingState(LayerProto* layerInfo, uint32_t traceFlags, const DisplayDevice*); void writeToProtoDrawingState(LayerProto* layerInfo); // Write drawing or current state. If writing current state, the caller should hold the // external mStateLock. If writing drawing state, this function should be called on the // main or tracing thread. Loading services/surfaceflinger/LayerProtoHelper.cpp +6 −6 Original line number Diff line number Diff line Loading @@ -156,14 +156,14 @@ void LayerProtoHelper::writeTransformToProto(const ui::Transform& transform, void LayerProtoHelper::writeToProto(const renderengine::ExternalTexture& buffer, std::function<ActiveBufferProto*()> getActiveBufferProto) { if (buffer.getBuffer()->getWidth() != 0 || buffer.getBuffer()->getHeight() != 0 || buffer.getBuffer()->getUsage() != 0 || buffer.getBuffer()->getPixelFormat() != 0) { if (buffer.getWidth() != 0 || buffer.getHeight() != 0 || buffer.getUsage() != 0 || buffer.getPixelFormat() != 0) { // Use a lambda do avoid writing the object header when the object is empty ActiveBufferProto* activeBufferProto = getActiveBufferProto(); activeBufferProto->set_width(buffer.getBuffer()->getWidth()); activeBufferProto->set_height(buffer.getBuffer()->getHeight()); activeBufferProto->set_format(buffer.getBuffer()->getPixelFormat()); activeBufferProto->set_usage(buffer.getBuffer()->getUsage()); activeBufferProto->set_width(buffer.getWidth()); activeBufferProto->set_height(buffer.getHeight()); activeBufferProto->set_stride(buffer.getUsage()); activeBufferProto->set_format(buffer.getPixelFormat()); } } Loading Loading
libs/gralloc/OWNERS +3 −0 Original line number Diff line number Diff line # Graphics team alecmouri@google.com chrisforbes@google.com jreck@google.com No newline at end of file
libs/gui/LayerState.cpp +18 −6 Original line number Diff line number Diff line Loading @@ -35,7 +35,9 @@ using gui::FocusRequest; using gui::WindowInfoHandle; layer_state_t::layer_state_t() : what(0), : surface(nullptr), layerId(-1), what(0), x(0), y(0), z(0), Loading Loading @@ -153,8 +155,12 @@ status_t layer_state_t::write(Parcel& output) const SAFE_PARCEL(output.writeBool, isTrustedOverlay); SAFE_PARCEL(output.writeUint32, static_cast<uint32_t>(dropInputMode)); SAFE_PARCEL(output.writeNullableParcelable, bufferData ? std::make_optional<BufferData>(*bufferData) : std::nullopt); const bool hasBufferData = (bufferData != nullptr); SAFE_PARCEL(output.writeBool, hasBufferData); if (hasBufferData) { SAFE_PARCEL(output.writeParcelable, *bufferData); } return NO_ERROR; } Loading Loading @@ -264,9 +270,15 @@ status_t layer_state_t::read(const Parcel& input) uint32_t mode; SAFE_PARCEL(input.readUint32, &mode); dropInputMode = static_cast<gui::DropInputMode>(mode); std::optional<BufferData> tmpBufferData; SAFE_PARCEL(input.readParcelable, &tmpBufferData); bufferData = tmpBufferData ? std::make_shared<BufferData>(*tmpBufferData) : nullptr; bool hasBufferData; SAFE_PARCEL(input.readBool, &hasBufferData); if (hasBufferData) { bufferData = std::make_shared<BufferData>(); SAFE_PARCEL(input.readParcelable, bufferData.get()); } else { bufferData = nullptr; } return NO_ERROR; } Loading
services/surfaceflinger/Layer.cpp +8 −10 Original line number Diff line number Diff line Loading @@ -1993,29 +1993,31 @@ void Layer::setInputInfo(const WindowInfo& info) { setTransactionFlags(eTransactionNeeded); } LayerProto* Layer::writeToProto(LayersProto& layersProto, uint32_t traceFlags, const DisplayDevice* display) { LayerProto* Layer::writeToProto(LayersProto& layersProto, uint32_t traceFlags) { LayerProto* layerProto = layersProto.add_layers(); writeToProtoDrawingState(layerProto, traceFlags, display); writeToProtoDrawingState(layerProto); writeToProtoCommonState(layerProto, LayerVector::StateSet::Drawing, traceFlags); if (traceFlags & LayerTracing::TRACE_COMPOSITION) { // Only populate for the primary display. UnnecessaryLock assumeLocked(mFlinger->mStateLock); // called from the main thread. const auto display = mFlinger->getDefaultDisplayDeviceLocked(); if (display) { const auto compositionType = getCompositionType(*display); layerProto->set_hwc_composition_type(static_cast<HwcCompositionType>(compositionType)); LayerProtoHelper::writeToProto(getVisibleRegion(display.get()), [&]() { return layerProto->mutable_visible_region(); }); } } for (const sp<Layer>& layer : mDrawingChildren) { layer->writeToProto(layersProto, traceFlags, display); layer->writeToProto(layersProto, traceFlags); } return layerProto; } void Layer::writeToProtoDrawingState(LayerProto* layerInfo, uint32_t traceFlags, const DisplayDevice* display) { void Layer::writeToProtoDrawingState(LayerProto* layerInfo) { const ui::Transform transform = getTransform(); auto buffer = getExternalTexture(); if (buffer != nullptr) { Loading @@ -2039,10 +2041,6 @@ void Layer::writeToProtoDrawingState(LayerProto* layerInfo, uint32_t traceFlags, LayerProtoHelper::writePositionToProto(transform.tx(), transform.ty(), [&]() { return layerInfo->mutable_position(); }); LayerProtoHelper::writeToProto(mBounds, [&]() { return layerInfo->mutable_bounds(); }); if (traceFlags & LayerTracing::TRACE_COMPOSITION) { LayerProtoHelper::writeToProto(getVisibleRegion(display), [&]() { return layerInfo->mutable_visible_region(); }); } LayerProtoHelper::writeToProto(surfaceDamageRegion, [&]() { return layerInfo->mutable_damage_region(); }); Loading
services/surfaceflinger/Layer.h +2 −2 Original line number Diff line number Diff line Loading @@ -686,12 +686,12 @@ public: bool isRemovedFromCurrentState() const; LayerProto* writeToProto(LayersProto& layersProto, uint32_t traceFlags, const DisplayDevice*); LayerProto* writeToProto(LayersProto& layersProto, uint32_t traceFlags); // Write states that are modified by the main thread. This includes drawing // state as well as buffer data. This should be called in the main or tracing // thread. void writeToProtoDrawingState(LayerProto* layerInfo, uint32_t traceFlags, const DisplayDevice*); void writeToProtoDrawingState(LayerProto* layerInfo); // Write drawing or current state. If writing current state, the caller should hold the // external mStateLock. If writing drawing state, this function should be called on the // main or tracing thread. Loading
services/surfaceflinger/LayerProtoHelper.cpp +6 −6 Original line number Diff line number Diff line Loading @@ -156,14 +156,14 @@ void LayerProtoHelper::writeTransformToProto(const ui::Transform& transform, void LayerProtoHelper::writeToProto(const renderengine::ExternalTexture& buffer, std::function<ActiveBufferProto*()> getActiveBufferProto) { if (buffer.getBuffer()->getWidth() != 0 || buffer.getBuffer()->getHeight() != 0 || buffer.getBuffer()->getUsage() != 0 || buffer.getBuffer()->getPixelFormat() != 0) { if (buffer.getWidth() != 0 || buffer.getHeight() != 0 || buffer.getUsage() != 0 || buffer.getPixelFormat() != 0) { // Use a lambda do avoid writing the object header when the object is empty ActiveBufferProto* activeBufferProto = getActiveBufferProto(); activeBufferProto->set_width(buffer.getBuffer()->getWidth()); activeBufferProto->set_height(buffer.getBuffer()->getHeight()); activeBufferProto->set_format(buffer.getBuffer()->getPixelFormat()); activeBufferProto->set_usage(buffer.getBuffer()->getUsage()); activeBufferProto->set_width(buffer.getWidth()); activeBufferProto->set_height(buffer.getHeight()); activeBufferProto->set_stride(buffer.getUsage()); activeBufferProto->set_format(buffer.getPixelFormat()); } } Loading