diff options
author | Android Merger <noreply-android-build-merger@google.com> | 2019-02-11 22:42:47 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2019-02-11 22:42:47 +0000 |
commit | ec31d5155d9040dd0813ec98ac35f8732785d861 (patch) | |
tree | 946a90c1a4bbc2179ffcf626b5914f46b484e180 | |
parent | 82fc86b84fc47f38c44508e9e4fb28a72d6b3195 (diff) | |
parent | aa8d59b528e33507dab07b84928bffac068159af (diff) | |
download | native-ec31d5155d9040dd0813ec98ac35f8732785d861.tar.gz |
Merge "Snap for 5180536 from cb5531e3576fec2be6e366f16dd85696a20552b3 to pi-platform-release am: a4514a36b5" into pie-cuttlefish-testing
-rw-r--r-- | cmds/dumpstate/dumpstate.cpp | 6 | ||||
-rw-r--r-- | libs/input/VelocityTracker.cpp | 8 | ||||
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 10 | ||||
-rw-r--r-- | services/surfaceflinger/SurfaceTracing.cpp | 46 | ||||
-rw-r--r-- | services/surfaceflinger/SurfaceTracing.h | 9 | ||||
-rw-r--r-- | services/surfaceflinger/tests/SurfaceFlinger_test.filter | 2 | ||||
-rw-r--r-- | services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp | 3 |
7 files changed, 61 insertions, 23 deletions
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp index 9d897f523d..1d951bed23 100644 --- a/cmds/dumpstate/dumpstate.cpp +++ b/cmds/dumpstate/dumpstate.cpp @@ -1537,6 +1537,12 @@ static void DumpstateTelephonyOnly() { DUMPSYS_COMPONENTS_OPTIONS); printf("========================================================\n"); + printf("== Checkins\n"); + printf("========================================================\n"); + + RunDumpsys("CHECKIN BATTERYSTATS", {"batterystats", "-c"}); + + printf("========================================================\n"); printf("== dumpstate: done (id %d)\n", ds.id_); printf("========================================================\n"); } diff --git a/libs/input/VelocityTracker.cpp b/libs/input/VelocityTracker.cpp index c07a81245a..c70ace0fbd 100644 --- a/libs/input/VelocityTracker.cpp +++ b/libs/input/VelocityTracker.cpp @@ -325,8 +325,8 @@ void VelocityTracker::addMovement(const MotionEvent* event) { eventTime = event->getHistoricalEventTime(h); for (size_t i = 0; i < pointerCount; i++) { uint32_t index = pointerIndex[i]; - positions[index].x = event->getHistoricalRawX(i, h); - positions[index].y = event->getHistoricalRawY(i, h); + positions[index].x = event->getHistoricalX(i, h); + positions[index].y = event->getHistoricalY(i, h); } addMovement(eventTime, idBits, positions); } @@ -334,8 +334,8 @@ void VelocityTracker::addMovement(const MotionEvent* event) { eventTime = event->getEventTime(); for (size_t i = 0; i < pointerCount; i++) { uint32_t index = pointerIndex[i]; - positions[index].x = event->getRawX(i); - positions[index].y = event->getRawY(i); + positions[index].x = event->getX(i); + positions[index].y = event->getY(i); } addMovement(eventTime, idBits, positions); } diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 28b447f7aa..11e7ff0f68 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -4418,6 +4418,12 @@ void SurfaceFlinger::dumpAllLocked(const Vector<String16>& args, size_t& index, result.append("\n"); /* + * Tracing state + */ + mTracing.dump(result); + result.append("\n"); + + /* * HWC layer minidump */ for (size_t d = 0; d < mDisplays.size(); d++) { @@ -4764,12 +4770,12 @@ status_t SurfaceFlinger::onTransact( case 1025: { // Set layer tracing n = data.readInt32(); if (n) { - ALOGV("LayerTracing enabled"); + ALOGD("LayerTracing enabled"); mTracing.enable(); doTracing("tracing.enable"); reply->writeInt32(NO_ERROR); } else { - ALOGV("LayerTracing disabled"); + ALOGD("LayerTracing disabled"); status_t err = mTracing.disable(); reply->writeInt32(err); } diff --git a/services/surfaceflinger/SurfaceTracing.cpp b/services/surfaceflinger/SurfaceTracing.cpp index f8c466ea19..67dcd06187 100644 --- a/services/surfaceflinger/SurfaceTracing.cpp +++ b/services/surfaceflinger/SurfaceTracing.cpp @@ -27,52 +27,67 @@ namespace android { void SurfaceTracing::enable() { + ATRACE_CALL(); + std::lock_guard<std::mutex> protoGuard(mTraceMutex); + if (mEnabled) { return; } - ATRACE_CALL(); mEnabled = true; - std::lock_guard<std::mutex> protoGuard(mTraceMutex); - mTrace.set_magic_number(uint64_t(LayersTraceFileProto_MagicNumber_MAGIC_NUMBER_H) << 32 | - LayersTraceFileProto_MagicNumber_MAGIC_NUMBER_L); + mTrace = std::make_unique<LayersTraceFileProto>(); + mTrace->set_magic_number(uint64_t(LayersTraceFileProto_MagicNumber_MAGIC_NUMBER_H) << 32 | + LayersTraceFileProto_MagicNumber_MAGIC_NUMBER_L); } status_t SurfaceTracing::disable() { + ATRACE_CALL(); + std::lock_guard<std::mutex> protoGuard(mTraceMutex); + if (!mEnabled) { return NO_ERROR; } - ATRACE_CALL(); - std::lock_guard<std::mutex> protoGuard(mTraceMutex); mEnabled = false; status_t err(writeProtoFileLocked()); ALOGE_IF(err == PERMISSION_DENIED, "Could not save the proto file! Permission denied"); ALOGE_IF(err == NOT_ENOUGH_DATA, "Could not save the proto file! There are missing fields"); - mTrace.Clear(); + mTrace.reset(); return err; } -bool SurfaceTracing::isEnabled() { +bool SurfaceTracing::isEnabled() const { + std::lock_guard<std::mutex> protoGuard(mTraceMutex); return mEnabled; } void SurfaceTracing::traceLayers(const char* where, LayersProto layers) { std::lock_guard<std::mutex> protoGuard(mTraceMutex); - - LayersTraceProto* entry = mTrace.add_entry(); + if (!mEnabled) { + return; + } + LayersTraceProto* entry = mTrace->add_entry(); entry->set_elapsed_realtime_nanos(elapsedRealtimeNano()); entry->set_where(where); entry->mutable_layers()->Swap(&layers); + + constexpr int maxBufferedEntryCount = 3600; + if (mTrace->entry_size() >= maxBufferedEntryCount) { + // TODO: flush buffered entries without disabling tracing + ALOGE("too many buffered frames; force disable tracing"); + mEnabled = false; + writeProtoFileLocked(); + mTrace.reset(); + } } status_t SurfaceTracing::writeProtoFileLocked() { ATRACE_CALL(); - if (!mTrace.IsInitialized()) { + if (!mTrace->IsInitialized()) { return NOT_ENOUGH_DATA; } std::string output; - if (!mTrace.SerializeToString(&output)) { + if (!mTrace->SerializeToString(&output)) { return PERMISSION_DENIED; } if (!android::base::WriteStringToFile(output, mOutputFileName, true)) { @@ -82,4 +97,11 @@ status_t SurfaceTracing::writeProtoFileLocked() { return NO_ERROR; } +void SurfaceTracing::dump(String8& result) const { + std::lock_guard<std::mutex> protoGuard(mTraceMutex); + + result.appendFormat("Tracing state: %s\n", mEnabled ? "enabled" : "disabled"); + result.appendFormat(" number of entries: %d\n", mTrace ? mTrace->entry_size() : 0); +} + } // namespace android diff --git a/services/surfaceflinger/SurfaceTracing.h b/services/surfaceflinger/SurfaceTracing.h index 590ab9680f..fd8cb82a9b 100644 --- a/services/surfaceflinger/SurfaceTracing.h +++ b/services/surfaceflinger/SurfaceTracing.h @@ -18,7 +18,9 @@ #include <layerproto/LayerProtoHeader.h> #include <utils/Errors.h> +#include <utils/String8.h> +#include <memory> #include <mutex> using namespace android::surfaceflinger; @@ -32,9 +34,10 @@ class SurfaceTracing { public: void enable(); status_t disable(); - bool isEnabled(); + bool isEnabled() const; void traceLayers(const char* where, LayersProto); + void dump(String8& result) const; private: static constexpr auto DEFAULT_FILENAME = "/data/misc/wmtrace/layers_trace.pb"; @@ -43,8 +46,8 @@ private: bool mEnabled = false; std::string mOutputFileName = DEFAULT_FILENAME; - std::mutex mTraceMutex; - LayersTraceFileProto mTrace; + mutable std::mutex mTraceMutex; + std::unique_ptr<LayersTraceFileProto> mTrace; }; } // namespace android diff --git a/services/surfaceflinger/tests/SurfaceFlinger_test.filter b/services/surfaceflinger/tests/SurfaceFlinger_test.filter index 36424b9c5e..cca84e552f 100644 --- a/services/surfaceflinger/tests/SurfaceFlinger_test.filter +++ b/services/surfaceflinger/tests/SurfaceFlinger_test.filter @@ -1,5 +1,5 @@ { "presubmit": { - "filter": "LayerTransactionTest.*:LayerUpdateTest.*:ChildLayerTest.*:SurfaceFlingerStress.*:CropLatchingTest.*:GeometryLatchingTest.*:ScreenCaptureTest.*:DereferenceSurfaceControlTest.*" + "filter": "LayerTransactionTest.*:LayerUpdateTest.*:ChildLayerTest.*:SurfaceFlingerStress.*:CropLatchingTest.*:GeometryLatchingTest.*:ScreenCaptureTest.*:DereferenceSurfaceControlTest.*:-CropLatchingTest.FinalCropLatchingBufferOldSize" } } diff --git a/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp b/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp index 9ac5f3b73e..9b308bfcc8 100644 --- a/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp +++ b/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp @@ -658,7 +658,8 @@ using NonHwcVirtualDisplayCase = using SimpleHwcVirtualDisplayVariant = HwcVirtualDisplayVariant<1024, 768, Secure::TRUE>; using HwcVirtualDisplayCase = Case<SimpleHwcVirtualDisplayVariant, WideColorSupportNotConfiguredVariant, - NonHwcDisplayHdrSupportVariant, NonHwcPerFrameMetadataSupportVariant>; + HdrNotSupportedVariant<SimpleHwcVirtualDisplayVariant>, + NoPerFrameMetadataSupportVariant<SimpleHwcVirtualDisplayVariant>>; using WideColorP3ColorimetricDisplayCase = Case<PrimaryDisplayVariant, WideColorP3ColorimetricSupportedVariant<PrimaryDisplayVariant>, HdrNotSupportedVariant<PrimaryDisplayVariant>, |