Fix silent failure in hwcomposer initialization
Also add a check in the vsync thread for a similar error check.
BUG: 133011914
Test: Local build and boot
Change-Id: Ib913cb863266603c214bd19e94bbacf472a757c2
diff --git a/guest/hals/hwcomposer/common/hwcomposer.cpp b/guest/hals/hwcomposer/common/hwcomposer.cpp
index f18534b..56b2315 100644
--- a/guest/hals/hwcomposer/common/hwcomposer.cpp
+++ b/guest/hals/hwcomposer/common/hwcomposer.cpp
@@ -44,9 +44,10 @@
while (true) {
struct timespec rt;
if (clock_gettime(CLOCK_MONOTONIC, &rt) == -1) {
- ALOGE("%s:%d error in vsync thread clock_gettime: %s", __FILE__, __LINE__,
- strerror(errno));
+ LOG_ALWAYS_FATAL("%s:%d error in vsync thread clock_gettime: %s",
+ __FILE__, __LINE__, strerror(errno));
}
+
int64_t timestamp = int64_t(rt.tv_sec) * 1e9 + rt.tv_nsec;
// Given now's timestamp calculate the time of the next timestamp.
timestamp += pdev->vsync_period_ns -
diff --git a/guest/hals/hwcomposer/vsoc/hwcomposer.cpp b/guest/hals/hwcomposer/vsoc/hwcomposer.cpp
index 16b63ba..2aaedd9 100644
--- a/guest/hals/hwcomposer/vsoc/hwcomposer.cpp
+++ b/guest/hals/hwcomposer/vsoc/hwcomposer.cpp
@@ -440,8 +440,8 @@
dev->vsync_data.vsync_period_ns = 1000000000 / refreshRate;
struct timespec rt;
if (clock_gettime(CLOCK_MONOTONIC, &rt) == -1) {
- ALOGE("%s:%d error in vsync thread clock_gettime: %s", __FILE__, __LINE__,
- strerror(errno));
+ LOG_ALWAYS_FATAL("%s:%d error in vsync thread clock_gettime: %s", __FILE__,
+ __LINE__, strerror(errno));
}
dev->vsync_data.vsync_base_timestamp = int64_t(rt.tv_sec) * 1e9 + rt.tv_nsec;