[automerger skipped] DO NOT MERGE - Merge pie-platform-release (PPRL.181205.001) into stage-aosp-master
am: 7d0eb60ead -s ours
Change-Id: If02c87ee5b8bcb230ff026cec1e79df33473d617
diff --git a/cmds/installd/dexopt.cpp b/cmds/installd/dexopt.cpp
index 645e211..25e5247 100644
--- a/cmds/installd/dexopt.cpp
+++ b/cmds/installd/dexopt.cpp
@@ -332,8 +332,8 @@
MapPropertyToArg("dalvik.vm.dex2oat-very-large", "--very-large-app-threshold=%s");
// If the runtime was requested to use libartd.so, we'll run dex2oatd, otherwise dex2oat.
- const char* dex2oat_bin = "/apex/com.android.runtime/bin/dex2oat";
- constexpr const char* kDex2oatDebugPath = "/apex/com.android.runtime/bin/dex2oatd";
+ const char* dex2oat_bin = "/system/bin/dex2oat";
+ constexpr const char* kDex2oatDebugPath = "/system/bin/dex2oatd";
// Do not use dex2oatd for release candidates (give dex2oat more soak time).
bool is_release = android::base::GetProperty("ro.build.version.codename", "") == "REL";
if (is_debug_runtime() ||
@@ -662,9 +662,7 @@
const std::vector<std::string>& dex_locations,
bool copy_and_update) {
const char* profman_bin =
- is_debug_runtime()
- ? "/apex/com.android.runtime/bin/profmand"
- : "/apex/com.android.runtime/bin/profman";
+ is_debug_runtime() ? "/system/bin/profmand" : "/system/bin/profman";
if (copy_and_update) {
CHECK_EQ(1u, profile_fds.size());
@@ -1466,9 +1464,9 @@
const char* class_loader_context) {
CHECK_GE(zip_fd, 0);
const char* dexoptanalyzer_bin =
- is_debug_runtime()
- ? "/apex/com.android.runtime/bin/dexoptanalyzerd"
- : "/apex/com.android.runtime/bin/dexoptanalyzer";
+ is_debug_runtime()
+ ? "/system/bin/dexoptanalyzerd"
+ : "/system/bin/dexoptanalyzer";
std::string dex_file_arg = "--dex-file=" + dex_file;
std::string oat_fd_arg = "--oat-fd=" + std::to_string(oat_fd);
diff --git a/cmds/installd/otapreopt.cpp b/cmds/installd/otapreopt.cpp
index d161407..b2e7047 100644
--- a/cmds/installd/otapreopt.cpp
+++ b/cmds/installd/otapreopt.cpp
@@ -440,7 +440,7 @@
const char* isa) const {
// This needs to be kept in sync with ART, see art/runtime/gc/space/image_space.cc.
std::vector<std::string> cmd;
- cmd.push_back("/apex/com.android.runtime/bin/dex2oat");
+ cmd.push_back("/system/bin/dex2oat");
cmd.push_back(StringPrintf("--image=%s", art_path.c_str()));
for (const std::string& boot_part : Split(boot_cp, ":")) {
cmd.push_back(StringPrintf("--dex-file=%s", boot_part.c_str()));
diff --git a/services/surfaceflinger/RenderEngine/ProgramCache.cpp b/services/surfaceflinger/RenderEngine/ProgramCache.cpp
index fe992f1..2073b05 100644
--- a/services/surfaceflinger/RenderEngine/ProgramCache.cpp
+++ b/services/surfaceflinger/RenderEngine/ProgramCache.cpp
@@ -220,7 +220,7 @@
const highp float c2 = (2413.0 / 4096.0) * 32.0;
const highp float c3 = (2392.0 / 4096.0) * 32.0;
- highp vec3 tmp = pow(color, 1.0 / vec3(m2));
+ highp vec3 tmp = pow(clamp(color, 0.0, 1.0), 1.0 / vec3(m2));
tmp = max(tmp - c1, 0.0) / (c2 - c3 * tmp);
return pow(tmp, 1.0 / vec3(m1));
}
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 28b447f..11e7ff0 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -4418,6 +4418,12 @@
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 @@
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 f8c466e..67dcd06 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 @@
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 590ab96..fd8cb82 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 @@
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 @@
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/unittests/DisplayTransactionTest.cpp b/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp
index 9ac5f3b..9b308bf 100644
--- a/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp
+++ b/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp
@@ -658,7 +658,8 @@
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>,
diff --git a/vulkan/libvulkan/Android.bp b/vulkan/libvulkan/Android.bp
index 7eaf7b2..fed8481 100644
--- a/vulkan/libvulkan/Android.bp
+++ b/vulkan/libvulkan/Android.bp
@@ -39,6 +39,9 @@
"-Wno-switch-enum",
"-Wno-undef",
+ // Have clang emit complete debug_info.
+ "-fstandalone-debug",
+
//"-DLOG_NDEBUG=0",
],