Skip to content
Snippets Groups Projects
Commit 3b86e3c9 authored by Zhizhou Yang's avatar Zhizhou Yang Committed by android-build-merger
Browse files

Merge "Fix bugs caused by Hwui and Skia syncing" am: a168e370

am: a69712a8

Change-Id: I0137a37ab05e52410bc2db65123bffeebaacffa3
parents bf696111 a69712a8
Branches
No related tags found
No related merge requests found
diff --git a/libs/hwui/Android.bp b/libs/hwui/Android.bp
index 558cdc0faf3..1565be5b201 100644
index ae4eabf94d0..b7f758f1ca5 100644
--- a/libs/hwui/Android.bp
+++ b/libs/hwui/Android.bp
@@ -24,12 +24,15 @@ cc_defaults {
"-Werror",
"-fvisibility=hidden",
"-DHWUI_NEW_OPS",
@@ -33,8 +33,11 @@ cc_defaults {
// TODO: Linear blending should be enabled by default, but we are
// TODO: making it an opt-in while it's a work in progress
//"-DANDROID_ENABLE_LINEAR_BLENDING",
+ CFLAGS_FOR_BENCH_SUITE
// GCC false-positives on this warning, and since we -Werror that's
// a problem
"-Wno-free-nonheap-object",
],
+ ldflags: [LDFLAGS_FOR_BENCH_SUITE],
......@@ -18,7 +14,7 @@ index 558cdc0faf3..1565be5b201 100644
include_dirs: [
"external/skia/include/private",
"external/skia/src/core",
@@ -214,6 +217,9 @@ cc_defaults {
@@ -236,6 +239,9 @@ cc_defaults {
export_proto_headers: true,
},
......@@ -26,25 +22,27 @@ index 558cdc0faf3..1565be5b201 100644
+ ldflags: [LDFLAGS_FOR_BENCH_SUITE],
+
export_include_dirs: ["."],
export_shared_lib_headers: ["libRScpp"],
}
@@ -350,6 +356,9 @@ cc_benchmark {
whole_static_libs: ["libhwui"],
shared_libs: ["libmemunreachable"],
@@ -229,7 +235,8 @@ cc_library {
cc_library_static {
name: "libhwui_static_null_gpu",
defaults: ["libhwui_defaults"],
- cflags: ["-DHWUI_NULL_GPU"],
+ cflags: ["-DHWUI_NULL_GPU", CFLAGS_FOR_BENCH_SUITE],
+ cflags: [CFLAGS_FOR_BENCH_SUITE],
+ ldflags: [LDFLAGS_FOR_BENCH_SUITE],
+
srcs: [
"debug/nullegl.cpp",
"debug/nullgles.cpp",
@@ -319,7 +326,8 @@ cc_benchmark {
name: "hwuimicro",
defaults: ["hwui_test_defaults"],
"tests/macrobench/TestSceneRunner.cpp",
"tests/macrobench/main.cpp",
@@ -367,8 +376,11 @@ cc_benchmark {
cflags: [
"-include debug/wrap_gles.h",
"-DHWUI_NULL_GPU",
+ CFLAGS_FOR_BENCH_SUITE
],
- cflags: ["-DHWUI_NULL_GPU"],
+ cflags: ["-DHWUI_NULL_GPU", CFLAGS_FOR_BENCH_SUITE],
+ ldflags: [LDFLAGS_FOR_BENCH_SUITE],
whole_static_libs: ["libhwui_static_null_gpu"],
+
whole_static_libs: ["libhwui_static_debug"],
shared_libs: ["libmemunreachable"],
diff --git a/libs/hwui/Android.bp b/libs/hwui/Android.bp
index 303d05f084a..946aa9bb754 100644
index ae4eabf94d0..23c95465221 100644
--- a/libs/hwui/Android.bp
+++ b/libs/hwui/Android.bp
@@ -17,6 +17,7 @@ cc_defaults {
"-Wunreachable-code",
"-Werror",
"-fvisibility=hidden",
+ CFLAGS_FOR_BENCH_SUITE
// GCC false-positives on this warning, and since we -Werror that's
// a problem
@@ -30,6 +31,8 @@ cc_defaults {
@@ -33,8 +33,11 @@ cc_defaults {
// TODO: Linear blending should be enabled by default, but we are
// TODO: making it an opt-in while it's a work in progress
//"-DANDROID_ENABLE_LINEAR_BLENDING",
+ CFLAGS_FOR_BENCH_SUITE
],
+ ldflags: [LDFLAGS_FOR_BENCH_SUITE],
......@@ -19,7 +14,7 @@ index 303d05f084a..946aa9bb754 100644
include_dirs: [
"external/skia/include/private",
"external/skia/src/core",
@@ -231,6 +234,9 @@ cc_defaults {
@@ -236,6 +239,9 @@ cc_defaults {
export_proto_headers: true,
},
......@@ -29,26 +24,7 @@ index 303d05f084a..946aa9bb754 100644
export_include_dirs: ["."],
export_shared_lib_headers: ["libRScpp"],
}
@@ -240,7 +246,7 @@ cc_library {
defaults: [
"libhwui_defaults",
- // Enables fine-grained GLES error checking
+ // Enables fine-grained GLES error checking
// If enabled, every GLES call is wrapped & error checked
// Has moderate overhead
"hwui_enable_opengl_validation",
@@ -257,7 +263,8 @@ cc_library_static {
"libhwui_defaults",
"hwui_debug",
],
- cflags: ["-DHWUI_NULL_GPU"],
+ cflags: ["-DHWUI_NULL_GPU", CFLAGS_FOR_BENCH_SUITE],
+ ldflags: [LDFLAGS_FOR_BENCH_SUITE],
srcs: [
"debug/nullegl.cpp",
],
@@ -354,6 +361,9 @@ cc_benchmark {
@@ -350,6 +356,9 @@ cc_benchmark {
whole_static_libs: ["libhwui"],
shared_libs: ["libmemunreachable"],
......@@ -58,7 +34,7 @@ index 303d05f084a..946aa9bb754 100644
srcs: [
"tests/macrobench/TestSceneRunner.cpp",
"tests/macrobench/main.cpp",
@@ -371,8 +381,11 @@ cc_benchmark {
@@ -367,8 +376,11 @@ cc_benchmark {
cflags: [
"-include debug/wrap_gles.h",
"-DHWUI_NULL_GPU",
......
diff --git a/Android.bp b/Android.bp
index a581b0a53..36159c5ae 100644
index d259f8f13e..b87fccc7b6 100644
--- a/Android.bp
+++ b/Android.bp
@@ -40,8 +40,11 @@ cc_library {
"-Wno-clobbered",
"-Wno-error",
"-fexceptions",
@@ -9,8 +9,11 @@ cc_library {
"-D_FORTIFY_SOURCE=1",
"-DSKIA_IMPLEMENTATION=1",
"-DATRACE_TAG=ATRACE_TAG_VIEW",
+ CFLAGS_FOR_BENCH_SUITE
],
+ ldflags: [LDFLAGS_FOR_BENCH_SUITE],
+
cppflags: [
"-std=c++11",
"-fno-threadsafe-statics",
@@ -1470,8 +1473,11 @@ cc_test {
"-U_FORTIFY_SOURCE",
"-D_FORTIFY_SOURCE=1",
"-DSKIA_IMPLEMENTATION=1",
export_include_dirs: [
"include/android/",
"include/c/",
@@ -845,8 +848,11 @@ cc_test {
cflags: [
"-Wno-unused-parameter",
+ CFLAGS_FOR_BENCH_SUITE
],
+ ldflags: [LDFLAGS_FOR_BENCH_SUITE],
+
local_include_dirs: [
"experimental/svg/model/",
"gm/",
@@ -1602,8 +1608,11 @@ cc_test {
cflags: [
"-Wno-unused-parameter",
+ CFLAGS_FOR_BENCH_SUITE
],
+ ldflags: [LDFLAGS_FOR_BENCH_SUITE],
+
cppflags: [
"-std=c++11",
"-fno-threadsafe-statics",
local_include_dirs: [
"bench/",
"experimental/svg/model/",
......@@ -16,27 +16,6 @@ import subprocess
# The patches to be added to the android repo.
# An error may occur if it is already patched, or meets some error.
# FIXME: Needs to be FIXED in the future.
def try_patch_skia():
skia_dir = os.path.join(config.android_home, config.bench_dict['Skia'])
# You may want to change the file based on aosp or internal
if config.android_type == 'internal':
print('No need to patch skia for internal repo.')
return
elif config.android_type == 'aosp':
skia_patch = os.path.join(
os.path.dirname(os.path.realpath(__file__)), 'skia_aosp.diff')
else:
raise ValueError('Adnroid source type should be either aosp or '
'internal.')
# FIXME: A quick hack, need to handle errors and check whether has been
# applied in the future.
try:
subprocess.check_call(['git', '-C', skia_dir, 'apply', skia_patch])
print('Skia patched successfully!')
except subprocess.CalledProcessError:
print('Skia patch not applied, error or already patched.')
def try_patch_autotest():
# Patch autotest, which includes all the testcases on device,
# setting device, and running the benchmarks
......@@ -101,7 +80,6 @@ def try_patch_synthmark():
def main():
try_patch_skia()
try_patch_panorama()
try_patch_autotest()
try_patch_synthmark()
......
......@@ -22,11 +22,6 @@ def discard_git(path):
print('Error while removing patch in %s' % path)
def dispatch_skia():
skia_dir = os.path.join(config.android_home, config.bench_dict['Skia'])
discard_git(skia_dir)
def dispatch_autotest():
autotest_dir = os.path.join(config.android_home, config.autotest_dir)
discard_git(autotest_dir)
......@@ -55,7 +50,6 @@ def dispatch_synthmark():
def main():
dispatch_skia()
dispatch_autotest()
dispatch_panorama()
dispatch_synthmark()
......
diff --git a/bench/ResultsWriter.h b/bench/ResultsWriter.h
index f56deae..69a84c7 100644
--- a/bench/ResultsWriter.h
+++ b/bench/ResultsWriter.h
@@ -46,6 +46,9 @@ public:
// Record a single test metric.
virtual void metric(const char name[], double ms) {}
+ // Record a list of test metrics.
+ virtual void metrics(const char name[], const SkTArray<double> &array) {}
+
// Flush to storage now please.
virtual void flush() {}
};
@@ -113,6 +116,17 @@ public:
SkASSERT(fConfig);
(*fConfig)[name] = ms;
}
+ void metrics(const char name[], const SkTArray<double> &array) override {
+ // The user who wrote this feature prefers NaNs over not having results.
+ // Hence, this ignores whether we have NaNs.
+ SkASSERT(fConfig);
+ Json::Value value = Json::Value(Json::arrayValue);
+ value.resize(array.count());
+ for (unsigned i = 0, e = array.count(); i != e; ++i) {
+ value[i] = array[i];
+ }
+ (*fConfig)[name] = value;
+ }
// Flush to storage now please.
void flush() override {
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index ae415fa..22011cd 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -42,6 +42,7 @@
#include "SkSurface.h"
#include "SkTaskGroup.h"
#include "SkThreadUtils.h"
+#include "SkTypes.h"
#include "ThermalManager.h"
#include <stdlib.h>
@@ -1173,7 +1174,7 @@ int nanobench_main() {
target->setup();
bench->perCanvasPreDraw(canvas);
- int maxFrameLag;
+ int maxFrameLag = 0;
int loops = target->needsFrameTiming(&maxFrameLag)
? setup_gpu_bench(target, bench.get(), maxFrameLag)
: setup_cpu_bench(overhead, target, bench.get());
@@ -1197,6 +1198,7 @@ int nanobench_main() {
benchStream.fillCurrentOptions(log.get());
target->fillOptions(log.get());
log->metric("min_ms", stats.min);
log->metric("median_ms", stats.median);
+ log->metrics("samples", samples);
#if SK_SUPPORT_GPU
if (gpuStatsDump) {
// dump to json, only SKPBench currently returns valid keys / values
diff --git a/bench/ResultsWriter.h b/bench/ResultsWriter.h
index f56deae..69a84c7 100644
--- a/bench/ResultsWriter.h
+++ b/bench/ResultsWriter.h
@@ -46,6 +46,9 @@ public:
// Record a single test metric.
virtual void metric(const char name[], double ms) {}
+ // Record a list of test metrics.
+ virtual void metrics(const char name[], const SkTArray<double> &array) {}
+
// Flush to storage now please.
virtual void flush() {}
};
@@ -113,6 +116,17 @@ public:
SkASSERT(fConfig);
(*fConfig)[name] = ms;
}
+ void metrics(const char name[], const SkTArray<double> &array) override {
+ // The user who wrote this feature prefers NaNs over not having results.
+ // Hence, this ignores whether we have NaNs.
+ SkASSERT(fConfig);
+ Json::Value value = Json::Value(Json::arrayValue);
+ value.resize(array.count());
+ for (unsigned i = 0, e = array.count(); i != e; ++i) {
+ value[i] = array[i];
+ }
+ (*fConfig)[name] = value;
+ }
// Flush to storage now please.
void flush() override {
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index 0651302..0623d61 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -43,6 +43,7 @@
#include "SkSVGDOM.h"
#include "SkTaskGroup.h"
#include "SkThreadUtils.h"
+#include "SkTypes.h"
#include "ThermalManager.h"
#include "SkScan.h"
@@ -1240,7 +1241,7 @@ int nanobench_main() {
target->setup();
bench->perCanvasPreDraw(canvas);
- int maxFrameLag;
+ int maxFrameLag = 0;
int loops = target->needsFrameTiming(&maxFrameLag)
? setup_gpu_bench(target, bench.get(), maxFrameLag)
: setup_cpu_bench(overhead, target, bench.get());
@@ -1290,6 +1291,7 @@ int nanobench_main() {
benchStream.fillCurrentOptions(log.get());
target->fillOptions(log.get());
log->metric("min_ms", stats.min);
+ log->metrics("samples", samples);
#if SK_SUPPORT_GPU
if (gpuStatsDump) {
// dump to json, only SKPBench currently returns valid keys / values
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment