@@ -623,15 +623,16 @@ HWC2::Error HwcDisplay::PresentDisplay(int32_t *out_present_fence) {
623623 struct timespec vsync {};
624624 clock_gettime (CLOCK_MONOTONIC, &vsync);
625625 int64_t timestamp = (int64_t )vsync.tv_sec * kOneSecondNs + (int64_t )vsync.tv_nsec ;
626- int64_t half_period = (1E9 / staged_mode_->v_refresh ()) / 2 ;
627- if ((expectedPresentTime_->timestampNanos - timestamp) > half_period) {
628- int64_t sleep_ms = (expectedPresentTime_->timestampNanos - timestamp - half_period) / (1000 * 1000 );
626+
627+ int64_t period = (1E9 / staged_mode_->v_refresh ());
628+ if ((expectedPresentTime_->timestampNanos - timestamp) > period) {
629+ ATRACE_NAME (" Wait for expected present time" );
630+ int64_t sleep_ms = (expectedPresentTime_->timestampNanos - timestamp - period) / (1000 * 1000 );
629631 std::this_thread::sleep_for (std::chrono::milliseconds (sleep_ms));
630632 }
631633 expectedPresentTime_ = std::nullopt ;
632- } else {
633- std::this_thread::sleep_for (std::chrono::nanoseconds ((int64_t )(1E9 / staged_mode_->v_refresh ()) / 2 ));
634- }
634+ }
635+
635636 if (IsInHeadlessMode ()) {
636637 *out_present_fence = -1 ;
637638 return HWC2::Error::None;
@@ -962,7 +963,11 @@ HWC2::Error HwcDisplay::GetDisplayCapabilities(uint32_t *outNumCapabilities,
962963 return HWC2::Error::BadParameter;
963964 }
964965
965- *outNumCapabilities = 0 ;
966+ *outNumCapabilities = 1 ;
967+
968+ if (outCapabilities != nullptr ) {
969+ outCapabilities[0 ] = 8 ;
970+ }
966971
967972 return HWC2::Error::None;
968973}
0 commit comments