Loading libs/binder/Parcel.cpp +17 −3 Original line number Diff line number Diff line Loading @@ -1535,7 +1535,12 @@ status_t Parcel::read(void* outData, size_t len) const && len <= pad_size(len)) { if (mObjectsSize > 0) { status_t err = validateReadData(mDataPos + pad_size(len)); if(err != NO_ERROR) return err; if(err != NO_ERROR) { // Still increment the data position by the expected length mDataPos += pad_size(len); ALOGV("read Setting data pos of %p to %zu", this, mDataPos); return err; } } memcpy(outData, mData+mDataPos, len); mDataPos += pad_size(len); Loading @@ -1557,7 +1562,12 @@ const void* Parcel::readInplace(size_t len) const && len <= pad_size(len)) { if (mObjectsSize > 0) { status_t err = validateReadData(mDataPos + pad_size(len)); if(err != NO_ERROR) return NULL; if(err != NO_ERROR) { // Still increment the data position by the expected length mDataPos += pad_size(len); ALOGV("readInplace Setting data pos of %p to %zu", this, mDataPos); return NULL; } } const void* data = mData+mDataPos; Loading @@ -1575,7 +1585,11 @@ status_t Parcel::readAligned(T *pArg) const { if ((mDataPos+sizeof(T)) <= mDataSize) { if (mObjectsSize > 0) { status_t err = validateReadData(mDataPos + sizeof(T)); if(err != NO_ERROR) return err; if(err != NO_ERROR) { // Still increment the data position by the expected length mDataPos += sizeof(T); return err; } } const void* data = mData+mDataPos; Loading libs/dumputils/dump_utils.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ static const char* hal_interfaces_to_dump[] { "android.hardware.drm@1.0::IDrmFactory", "android.hardware.graphics.composer@2.1::IComposer", "android.hardware.media.omx@1.0::IOmx", "android.hardware.media.omx@1.0::IOmxStore", "android.hardware.sensors@1.0::ISensors", "android.hardware.vr@1.0::IVr", NULL, Loading libs/nativewindow/include/android/hardware_buffer.h +5 −5 Original line number Diff line number Diff line Loading @@ -214,7 +214,7 @@ typedef struct AHardwareBuffer AHardwareBuffer; * Allocates a buffer that backs an AHardwareBuffer using the passed * AHardwareBuffer_Desc. * * \return NO_ERROR on success, or an error number of the allocation fails for * \return 0 on success, or an error number of the allocation fails for * any reason. The returned buffer has a reference count of 1. */ int AHardwareBuffer_allocate(const AHardwareBuffer_Desc* desc, Loading Loading @@ -267,7 +267,7 @@ void AHardwareBuffer_describe(const AHardwareBuffer* buffer, * may return an error or leave the buffer's content into an indeterminate * state. * * \return NO_ERROR on success, BAD_VALUE if \a buffer is NULL or if the usage * \return 0 on success, -EINVAL if \a buffer is NULL or if the usage * flags are not a combination of AHARDWAREBUFFER_USAGE_CPU_*, or an error * number of the lock fails for any reason. */ Loading @@ -281,7 +281,7 @@ int AHardwareBuffer_lock(AHardwareBuffer* buffer, uint64_t usage, * completed. The caller is responsible for closing the fence when it is no * longer needed. * * \return NO_ERROR on success, BAD_VALUE if \a buffer is NULL, or an error * \return 0 on success, -EINVAL if \a buffer is NULL, or an error * number if the unlock fails for any reason. */ int AHardwareBuffer_unlock(AHardwareBuffer* buffer, int32_t* fence); Loading @@ -289,7 +289,7 @@ int AHardwareBuffer_unlock(AHardwareBuffer* buffer, int32_t* fence); /** * Send the AHardwareBuffer to an AF_UNIX socket. * * \return NO_ERROR on success, BAD_VALUE if \a buffer is NULL, or an error * \return 0 on success, -EINVAL if \a buffer is NULL, or an error * number if the operation fails for any reason. */ int AHardwareBuffer_sendHandleToUnixSocket(const AHardwareBuffer* buffer, int socketFd); Loading @@ -297,7 +297,7 @@ int AHardwareBuffer_sendHandleToUnixSocket(const AHardwareBuffer* buffer, int so /** * Receive the AHardwareBuffer from an AF_UNIX socket. * * \return NO_ERROR on success, BAD_VALUE if \a outBuffer is NULL, or an error * \return 0 on success, -EINVAL if \a outBuffer is NULL, or an error * number if the operation fails for any reason. */ int AHardwareBuffer_recvHandleFromUnixSocket(int socketFd, AHardwareBuffer** outBuffer); Loading services/surfaceflinger/Layer.cpp +64 −11 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ #include <stdint.h> #include <stdlib.h> #include <sys/types.h> #include <algorithm> #include <cutils/compiler.h> #include <cutils/native_handle.h> Loading Loading @@ -1777,27 +1778,79 @@ void Layer::traverseInReverseZOrder(LayerVector::StateSet stateSet, } } /** * Traverse only children in z order, ignoring relative layers. */ void Layer::traverseChildrenInZOrder(LayerVector::StateSet stateSet, const LayerVector::Visitor& visitor) { LayerVector Layer::makeChildrenTraversalList(LayerVector::StateSet stateSet, const std::vector<Layer*>& layersInTree) { LOG_ALWAYS_FATAL_IF(stateSet == LayerVector::StateSet::Invalid, "makeTraversalList received invalid stateSet"); const bool useDrawing = stateSet == LayerVector::StateSet::Drawing; const LayerVector& children = useDrawing ? mDrawingChildren : mCurrentChildren; const State& state = useDrawing ? mDrawingState : mCurrentState; LayerVector traverse; for (const wp<Layer>& weakRelative : state.zOrderRelatives) { sp<Layer> strongRelative = weakRelative.promote(); // Only add relative layers that are also descendents of the top most parent of the tree. // If a relative layer is not a descendent, then it should be ignored. if (std::binary_search(layersInTree.begin(), layersInTree.end(), strongRelative.get())) { traverse.add(strongRelative); } } for (const sp<Layer>& child : children) { const State& childState = useDrawing ? child->mDrawingState : child->mCurrentState; // If a layer has a relativeOf layer, only ignore if the layer it's relative to is a // descendent of the top most parent of the tree. If it's not a descendent, then just add // the child here since it won't be added later as a relative. if (std::binary_search(layersInTree.begin(), layersInTree.end(), childState.zOrderRelativeOf.promote().get())) { continue; } traverse.add(child); } return traverse; } void Layer::traverseChildrenInZOrderInner(const std::vector<Layer*>& layersInTree, LayerVector::StateSet stateSet, const LayerVector::Visitor& visitor) { const LayerVector list = makeChildrenTraversalList(stateSet, layersInTree); size_t i = 0; for (; i < children.size(); i++) { const auto& relative = children[i]; for (; i < list.size(); i++) { const auto& relative = list[i]; if (relative->getZ() >= 0) { break; } relative->traverseChildrenInZOrder(stateSet, visitor); relative->traverseChildrenInZOrderInner(layersInTree, stateSet, visitor); } visitor(this); for (; i < children.size(); i++) { const auto& relative = children[i]; relative->traverseChildrenInZOrder(stateSet, visitor); for (; i < list.size(); i++) { const auto& relative = list[i]; relative->traverseChildrenInZOrderInner(layersInTree, stateSet, visitor); } } std::vector<Layer*> Layer::getLayersInTree(LayerVector::StateSet stateSet) { const bool useDrawing = stateSet == LayerVector::StateSet::Drawing; const LayerVector& children = useDrawing ? mDrawingChildren : mCurrentChildren; std::vector<Layer*> layersInTree = {this}; for (size_t i = 0; i < children.size(); i++) { const auto& child = children[i]; std::vector<Layer*> childLayers = child->getLayersInTree(stateSet); layersInTree.insert(layersInTree.end(), childLayers.cbegin(), childLayers.cend()); } return layersInTree; } void Layer::traverseChildrenInZOrder(LayerVector::StateSet stateSet, const LayerVector::Visitor& visitor) { std::vector<Layer*> layersInTree = getLayersInTree(stateSet); std::sort(layersInTree.begin(), layersInTree.end()); traverseChildrenInZOrderInner(layersInTree, stateSet, visitor); } Transform Layer::getTransform() const { Loading services/surfaceflinger/Layer.h +21 −0 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ #include "RenderEngine/Texture.h" #include <math/vec4.h> #include <vector> using namespace android::surfaceflinger; Loading Loading @@ -564,6 +565,10 @@ public: const LayerVector::Visitor& visitor); void traverseInZOrder(LayerVector::StateSet stateSet, const LayerVector::Visitor& visitor); /** * Traverse only children in z order, ignoring relative layers that are not children of the * parent. */ void traverseChildrenInZOrder(LayerVector::StateSet stateSet, const LayerVector::Visitor& visitor); Loading Loading @@ -778,6 +783,22 @@ protected: wp<Layer> mDrawingParent; mutable LayerBE mBE; private: /** * Returns an unsorted vector of all layers that are part of this tree. * That includes the current layer and all its descendants. */ std::vector<Layer*> getLayersInTree(LayerVector::StateSet stateSet); /** * Traverses layers that are part of this tree in the correct z order. * layersInTree must be sorted before calling this method. */ void traverseChildrenInZOrderInner(const std::vector<Layer*>& layersInTree, LayerVector::StateSet stateSet, const LayerVector::Visitor& visitor); LayerVector makeChildrenTraversalList(LayerVector::StateSet stateSet, const std::vector<Layer*>& layersInTree); }; // --------------------------------------------------------------------------- Loading Loading
libs/binder/Parcel.cpp +17 −3 Original line number Diff line number Diff line Loading @@ -1535,7 +1535,12 @@ status_t Parcel::read(void* outData, size_t len) const && len <= pad_size(len)) { if (mObjectsSize > 0) { status_t err = validateReadData(mDataPos + pad_size(len)); if(err != NO_ERROR) return err; if(err != NO_ERROR) { // Still increment the data position by the expected length mDataPos += pad_size(len); ALOGV("read Setting data pos of %p to %zu", this, mDataPos); return err; } } memcpy(outData, mData+mDataPos, len); mDataPos += pad_size(len); Loading @@ -1557,7 +1562,12 @@ const void* Parcel::readInplace(size_t len) const && len <= pad_size(len)) { if (mObjectsSize > 0) { status_t err = validateReadData(mDataPos + pad_size(len)); if(err != NO_ERROR) return NULL; if(err != NO_ERROR) { // Still increment the data position by the expected length mDataPos += pad_size(len); ALOGV("readInplace Setting data pos of %p to %zu", this, mDataPos); return NULL; } } const void* data = mData+mDataPos; Loading @@ -1575,7 +1585,11 @@ status_t Parcel::readAligned(T *pArg) const { if ((mDataPos+sizeof(T)) <= mDataSize) { if (mObjectsSize > 0) { status_t err = validateReadData(mDataPos + sizeof(T)); if(err != NO_ERROR) return err; if(err != NO_ERROR) { // Still increment the data position by the expected length mDataPos += sizeof(T); return err; } } const void* data = mData+mDataPos; Loading
libs/dumputils/dump_utils.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ static const char* hal_interfaces_to_dump[] { "android.hardware.drm@1.0::IDrmFactory", "android.hardware.graphics.composer@2.1::IComposer", "android.hardware.media.omx@1.0::IOmx", "android.hardware.media.omx@1.0::IOmxStore", "android.hardware.sensors@1.0::ISensors", "android.hardware.vr@1.0::IVr", NULL, Loading
libs/nativewindow/include/android/hardware_buffer.h +5 −5 Original line number Diff line number Diff line Loading @@ -214,7 +214,7 @@ typedef struct AHardwareBuffer AHardwareBuffer; * Allocates a buffer that backs an AHardwareBuffer using the passed * AHardwareBuffer_Desc. * * \return NO_ERROR on success, or an error number of the allocation fails for * \return 0 on success, or an error number of the allocation fails for * any reason. The returned buffer has a reference count of 1. */ int AHardwareBuffer_allocate(const AHardwareBuffer_Desc* desc, Loading Loading @@ -267,7 +267,7 @@ void AHardwareBuffer_describe(const AHardwareBuffer* buffer, * may return an error or leave the buffer's content into an indeterminate * state. * * \return NO_ERROR on success, BAD_VALUE if \a buffer is NULL or if the usage * \return 0 on success, -EINVAL if \a buffer is NULL or if the usage * flags are not a combination of AHARDWAREBUFFER_USAGE_CPU_*, or an error * number of the lock fails for any reason. */ Loading @@ -281,7 +281,7 @@ int AHardwareBuffer_lock(AHardwareBuffer* buffer, uint64_t usage, * completed. The caller is responsible for closing the fence when it is no * longer needed. * * \return NO_ERROR on success, BAD_VALUE if \a buffer is NULL, or an error * \return 0 on success, -EINVAL if \a buffer is NULL, or an error * number if the unlock fails for any reason. */ int AHardwareBuffer_unlock(AHardwareBuffer* buffer, int32_t* fence); Loading @@ -289,7 +289,7 @@ int AHardwareBuffer_unlock(AHardwareBuffer* buffer, int32_t* fence); /** * Send the AHardwareBuffer to an AF_UNIX socket. * * \return NO_ERROR on success, BAD_VALUE if \a buffer is NULL, or an error * \return 0 on success, -EINVAL if \a buffer is NULL, or an error * number if the operation fails for any reason. */ int AHardwareBuffer_sendHandleToUnixSocket(const AHardwareBuffer* buffer, int socketFd); Loading @@ -297,7 +297,7 @@ int AHardwareBuffer_sendHandleToUnixSocket(const AHardwareBuffer* buffer, int so /** * Receive the AHardwareBuffer from an AF_UNIX socket. * * \return NO_ERROR on success, BAD_VALUE if \a outBuffer is NULL, or an error * \return 0 on success, -EINVAL if \a outBuffer is NULL, or an error * number if the operation fails for any reason. */ int AHardwareBuffer_recvHandleFromUnixSocket(int socketFd, AHardwareBuffer** outBuffer); Loading
services/surfaceflinger/Layer.cpp +64 −11 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ #include <stdint.h> #include <stdlib.h> #include <sys/types.h> #include <algorithm> #include <cutils/compiler.h> #include <cutils/native_handle.h> Loading Loading @@ -1777,27 +1778,79 @@ void Layer::traverseInReverseZOrder(LayerVector::StateSet stateSet, } } /** * Traverse only children in z order, ignoring relative layers. */ void Layer::traverseChildrenInZOrder(LayerVector::StateSet stateSet, const LayerVector::Visitor& visitor) { LayerVector Layer::makeChildrenTraversalList(LayerVector::StateSet stateSet, const std::vector<Layer*>& layersInTree) { LOG_ALWAYS_FATAL_IF(stateSet == LayerVector::StateSet::Invalid, "makeTraversalList received invalid stateSet"); const bool useDrawing = stateSet == LayerVector::StateSet::Drawing; const LayerVector& children = useDrawing ? mDrawingChildren : mCurrentChildren; const State& state = useDrawing ? mDrawingState : mCurrentState; LayerVector traverse; for (const wp<Layer>& weakRelative : state.zOrderRelatives) { sp<Layer> strongRelative = weakRelative.promote(); // Only add relative layers that are also descendents of the top most parent of the tree. // If a relative layer is not a descendent, then it should be ignored. if (std::binary_search(layersInTree.begin(), layersInTree.end(), strongRelative.get())) { traverse.add(strongRelative); } } for (const sp<Layer>& child : children) { const State& childState = useDrawing ? child->mDrawingState : child->mCurrentState; // If a layer has a relativeOf layer, only ignore if the layer it's relative to is a // descendent of the top most parent of the tree. If it's not a descendent, then just add // the child here since it won't be added later as a relative. if (std::binary_search(layersInTree.begin(), layersInTree.end(), childState.zOrderRelativeOf.promote().get())) { continue; } traverse.add(child); } return traverse; } void Layer::traverseChildrenInZOrderInner(const std::vector<Layer*>& layersInTree, LayerVector::StateSet stateSet, const LayerVector::Visitor& visitor) { const LayerVector list = makeChildrenTraversalList(stateSet, layersInTree); size_t i = 0; for (; i < children.size(); i++) { const auto& relative = children[i]; for (; i < list.size(); i++) { const auto& relative = list[i]; if (relative->getZ() >= 0) { break; } relative->traverseChildrenInZOrder(stateSet, visitor); relative->traverseChildrenInZOrderInner(layersInTree, stateSet, visitor); } visitor(this); for (; i < children.size(); i++) { const auto& relative = children[i]; relative->traverseChildrenInZOrder(stateSet, visitor); for (; i < list.size(); i++) { const auto& relative = list[i]; relative->traverseChildrenInZOrderInner(layersInTree, stateSet, visitor); } } std::vector<Layer*> Layer::getLayersInTree(LayerVector::StateSet stateSet) { const bool useDrawing = stateSet == LayerVector::StateSet::Drawing; const LayerVector& children = useDrawing ? mDrawingChildren : mCurrentChildren; std::vector<Layer*> layersInTree = {this}; for (size_t i = 0; i < children.size(); i++) { const auto& child = children[i]; std::vector<Layer*> childLayers = child->getLayersInTree(stateSet); layersInTree.insert(layersInTree.end(), childLayers.cbegin(), childLayers.cend()); } return layersInTree; } void Layer::traverseChildrenInZOrder(LayerVector::StateSet stateSet, const LayerVector::Visitor& visitor) { std::vector<Layer*> layersInTree = getLayersInTree(stateSet); std::sort(layersInTree.begin(), layersInTree.end()); traverseChildrenInZOrderInner(layersInTree, stateSet, visitor); } Transform Layer::getTransform() const { Loading
services/surfaceflinger/Layer.h +21 −0 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ #include "RenderEngine/Texture.h" #include <math/vec4.h> #include <vector> using namespace android::surfaceflinger; Loading Loading @@ -564,6 +565,10 @@ public: const LayerVector::Visitor& visitor); void traverseInZOrder(LayerVector::StateSet stateSet, const LayerVector::Visitor& visitor); /** * Traverse only children in z order, ignoring relative layers that are not children of the * parent. */ void traverseChildrenInZOrder(LayerVector::StateSet stateSet, const LayerVector::Visitor& visitor); Loading Loading @@ -778,6 +783,22 @@ protected: wp<Layer> mDrawingParent; mutable LayerBE mBE; private: /** * Returns an unsorted vector of all layers that are part of this tree. * That includes the current layer and all its descendants. */ std::vector<Layer*> getLayersInTree(LayerVector::StateSet stateSet); /** * Traverses layers that are part of this tree in the correct z order. * layersInTree must be sorted before calling this method. */ void traverseChildrenInZOrderInner(const std::vector<Layer*>& layersInTree, LayerVector::StateSet stateSet, const LayerVector::Visitor& visitor); LayerVector makeChildrenTraversalList(LayerVector::StateSet stateSet, const std::vector<Layer*>& layersInTree); }; // --------------------------------------------------------------------------- Loading