Loading include/layerproto 0 → 120000 +1 −0 Original line number Diff line number Diff line ../services/surfaceflinger/layerproto/include/layerproto/ No newline at end of file services/surfaceflinger/Android.bp +1 −1 Original line number Diff line number Diff line Loading @@ -5,4 +5,4 @@ cc_library_static { export_static_lib_headers = ["libserviceutils"], } subdirs = ["tests/fakehwc"] No newline at end of file subdirs = ["tests/fakehwc", "layerproto"] No newline at end of file services/surfaceflinger/Android.mk +5 −2 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ LOCAL_SRC_FILES := \ RenderEngine/RenderEngine.cpp \ RenderEngine/Texture.cpp \ RenderEngine/GLES20RenderEngine.cpp \ LayerProtoHelper.cpp \ LOCAL_MODULE := libsurfaceflinger LOCAL_C_INCLUDES := \ Loading Loading @@ -98,7 +99,8 @@ LOCAL_SHARED_LIBRARIES := \ libsync \ libprotobuf-cpp-lite \ libbase \ android.hardware.power@1.0 android.hardware.power@1.0 \ liblayers_proto LOCAL_EXPORT_SHARED_LIBRARY_HEADERS := \ android.hardware.graphics.allocator@2.0 \ Loading Loading @@ -145,7 +147,8 @@ LOCAL_SHARED_LIBRARIES := \ libutils \ libui \ libgui \ libdl libdl \ liblayers_proto LOCAL_WHOLE_STATIC_LIBRARIES := libsigchain LOCAL_STATIC_LIBRARIES := libtrace_proto \ Loading services/surfaceflinger/Layer.cpp +77 −0 Original line number Diff line number Diff line Loading @@ -56,6 +56,7 @@ #include "RenderEngine/RenderEngine.h" #include <mutex> #include "LayerProtoHelper.h" #define DEBUG_RESIZE 0 Loading Loading @@ -2826,6 +2827,82 @@ void Layer::commitChildList() { mDrawingParent = mCurrentParent; } void Layer::writeToProto(LayerProto* layerInfo, LayerVector::StateSet stateSet) { const bool useDrawing = stateSet == LayerVector::StateSet::Drawing; const LayerVector& children = useDrawing ? mDrawingChildren : mCurrentChildren; const State& state = useDrawing ? mDrawingState : mCurrentState; Transform requestedTransform = state.active.transform; Transform transform = getTransform(); layerInfo->set_id(sequence); layerInfo->set_name(getName().c_str()); layerInfo->set_type(String8(getTypeId())); for (const auto& child : children) { layerInfo->add_children(child->sequence); } for (const wp<Layer>& weakRelative : state.zOrderRelatives) { sp<Layer> strongRelative = weakRelative.promote(); if (strongRelative != nullptr) { layerInfo->add_relatives(strongRelative->sequence); } } LayerProtoHelper::writeToProto(state.activeTransparentRegion, layerInfo->mutable_transparent_region()); LayerProtoHelper::writeToProto(visibleRegion, layerInfo->mutable_visible_region()); LayerProtoHelper::writeToProto(surfaceDamageRegion, layerInfo->mutable_damage_region()); layerInfo->set_layer_stack(getLayerStack()); layerInfo->set_z(state.z); PositionProto* position = layerInfo->mutable_position(); position->set_x(transform.tx()); position->set_y(transform.ty()); PositionProto* requestedPosition = layerInfo->mutable_requested_position(); requestedPosition->set_x(requestedTransform.tx()); requestedPosition->set_y(requestedTransform.ty()); SizeProto* size = layerInfo->mutable_size(); size->set_w(state.active.w); size->set_h(state.active.h); LayerProtoHelper::writeToProto(state.crop, layerInfo->mutable_crop()); LayerProtoHelper::writeToProto(state.finalCrop, layerInfo->mutable_final_crop()); layerInfo->set_is_opaque(isOpaque(state)); layerInfo->set_invalidate(contentDirty); layerInfo->set_dataspace(dataspaceDetails(getDataSpace())); layerInfo->set_pixel_format(decodePixelFormat(getPixelFormat())); LayerProtoHelper::writeToProto(getColor(), layerInfo->mutable_color()); LayerProtoHelper::writeToProto(state.color, layerInfo->mutable_requested_color()); layerInfo->set_flags(state.flags); LayerProtoHelper::writeToProto(transform, layerInfo->mutable_transform()); LayerProtoHelper::writeToProto(requestedTransform, layerInfo->mutable_requested_transform()); auto parent = getParent(); if (parent != nullptr) { layerInfo->set_parent(parent->sequence); } auto zOrderRelativeOf = state.zOrderRelativeOf.promote(); if (zOrderRelativeOf != nullptr) { layerInfo->set_z_order_relative_of(zOrderRelativeOf->sequence); } auto activeBuffer = getActiveBuffer(); if (activeBuffer != nullptr) { LayerProtoHelper::writeToProto(activeBuffer, layerInfo->mutable_active_buffer()); } layerInfo->set_queued_frames(getQueuedFrameCount()); layerInfo->set_refresh_pending(isBufferLatched()); } // --------------------------------------------------------------------------- }; // namespace android Loading services/surfaceflinger/Layer.h +5 −0 Original line number Diff line number Diff line Loading @@ -49,9 +49,12 @@ #include "DisplayHardware/HWComposerBufferCache.h" #include "RenderEngine/Mesh.h" #include "RenderEngine/Texture.h" #include <layerproto/LayerProtoHeader.h> #include <math/vec4.h> using namespace android::surfaceflinger; namespace android { // --------------------------------------------------------------------------- Loading Loading @@ -303,6 +306,8 @@ public: */ virtual bool isFixedSize() const; void writeToProto(LayerProto* layerInfo, LayerVector::StateSet stateSet = LayerVector::StateSet::Drawing); protected: /* * onDraw - draws the surface. Loading Loading
include/layerproto 0 → 120000 +1 −0 Original line number Diff line number Diff line ../services/surfaceflinger/layerproto/include/layerproto/ No newline at end of file
services/surfaceflinger/Android.bp +1 −1 Original line number Diff line number Diff line Loading @@ -5,4 +5,4 @@ cc_library_static { export_static_lib_headers = ["libserviceutils"], } subdirs = ["tests/fakehwc"] No newline at end of file subdirs = ["tests/fakehwc", "layerproto"] No newline at end of file
services/surfaceflinger/Android.mk +5 −2 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ LOCAL_SRC_FILES := \ RenderEngine/RenderEngine.cpp \ RenderEngine/Texture.cpp \ RenderEngine/GLES20RenderEngine.cpp \ LayerProtoHelper.cpp \ LOCAL_MODULE := libsurfaceflinger LOCAL_C_INCLUDES := \ Loading Loading @@ -98,7 +99,8 @@ LOCAL_SHARED_LIBRARIES := \ libsync \ libprotobuf-cpp-lite \ libbase \ android.hardware.power@1.0 android.hardware.power@1.0 \ liblayers_proto LOCAL_EXPORT_SHARED_LIBRARY_HEADERS := \ android.hardware.graphics.allocator@2.0 \ Loading Loading @@ -145,7 +147,8 @@ LOCAL_SHARED_LIBRARIES := \ libutils \ libui \ libgui \ libdl libdl \ liblayers_proto LOCAL_WHOLE_STATIC_LIBRARIES := libsigchain LOCAL_STATIC_LIBRARIES := libtrace_proto \ Loading
services/surfaceflinger/Layer.cpp +77 −0 Original line number Diff line number Diff line Loading @@ -56,6 +56,7 @@ #include "RenderEngine/RenderEngine.h" #include <mutex> #include "LayerProtoHelper.h" #define DEBUG_RESIZE 0 Loading Loading @@ -2826,6 +2827,82 @@ void Layer::commitChildList() { mDrawingParent = mCurrentParent; } void Layer::writeToProto(LayerProto* layerInfo, LayerVector::StateSet stateSet) { const bool useDrawing = stateSet == LayerVector::StateSet::Drawing; const LayerVector& children = useDrawing ? mDrawingChildren : mCurrentChildren; const State& state = useDrawing ? mDrawingState : mCurrentState; Transform requestedTransform = state.active.transform; Transform transform = getTransform(); layerInfo->set_id(sequence); layerInfo->set_name(getName().c_str()); layerInfo->set_type(String8(getTypeId())); for (const auto& child : children) { layerInfo->add_children(child->sequence); } for (const wp<Layer>& weakRelative : state.zOrderRelatives) { sp<Layer> strongRelative = weakRelative.promote(); if (strongRelative != nullptr) { layerInfo->add_relatives(strongRelative->sequence); } } LayerProtoHelper::writeToProto(state.activeTransparentRegion, layerInfo->mutable_transparent_region()); LayerProtoHelper::writeToProto(visibleRegion, layerInfo->mutable_visible_region()); LayerProtoHelper::writeToProto(surfaceDamageRegion, layerInfo->mutable_damage_region()); layerInfo->set_layer_stack(getLayerStack()); layerInfo->set_z(state.z); PositionProto* position = layerInfo->mutable_position(); position->set_x(transform.tx()); position->set_y(transform.ty()); PositionProto* requestedPosition = layerInfo->mutable_requested_position(); requestedPosition->set_x(requestedTransform.tx()); requestedPosition->set_y(requestedTransform.ty()); SizeProto* size = layerInfo->mutable_size(); size->set_w(state.active.w); size->set_h(state.active.h); LayerProtoHelper::writeToProto(state.crop, layerInfo->mutable_crop()); LayerProtoHelper::writeToProto(state.finalCrop, layerInfo->mutable_final_crop()); layerInfo->set_is_opaque(isOpaque(state)); layerInfo->set_invalidate(contentDirty); layerInfo->set_dataspace(dataspaceDetails(getDataSpace())); layerInfo->set_pixel_format(decodePixelFormat(getPixelFormat())); LayerProtoHelper::writeToProto(getColor(), layerInfo->mutable_color()); LayerProtoHelper::writeToProto(state.color, layerInfo->mutable_requested_color()); layerInfo->set_flags(state.flags); LayerProtoHelper::writeToProto(transform, layerInfo->mutable_transform()); LayerProtoHelper::writeToProto(requestedTransform, layerInfo->mutable_requested_transform()); auto parent = getParent(); if (parent != nullptr) { layerInfo->set_parent(parent->sequence); } auto zOrderRelativeOf = state.zOrderRelativeOf.promote(); if (zOrderRelativeOf != nullptr) { layerInfo->set_z_order_relative_of(zOrderRelativeOf->sequence); } auto activeBuffer = getActiveBuffer(); if (activeBuffer != nullptr) { LayerProtoHelper::writeToProto(activeBuffer, layerInfo->mutable_active_buffer()); } layerInfo->set_queued_frames(getQueuedFrameCount()); layerInfo->set_refresh_pending(isBufferLatched()); } // --------------------------------------------------------------------------- }; // namespace android Loading
services/surfaceflinger/Layer.h +5 −0 Original line number Diff line number Diff line Loading @@ -49,9 +49,12 @@ #include "DisplayHardware/HWComposerBufferCache.h" #include "RenderEngine/Mesh.h" #include "RenderEngine/Texture.h" #include <layerproto/LayerProtoHeader.h> #include <math/vec4.h> using namespace android::surfaceflinger; namespace android { // --------------------------------------------------------------------------- Loading Loading @@ -303,6 +306,8 @@ public: */ virtual bool isFixedSize() const; void writeToProto(LayerProto* layerInfo, LayerVector::StateSet stateSet = LayerVector::StateSet::Drawing); protected: /* * onDraw - draws the surface. Loading