Skip to content

Commit 57bf6bd

Browse files
committed
Enable display MULTI_THREADED_PRESENT capability
Tracked-On: No Signed-off-by: manxiaoliang <[email protected]>
1 parent dbb7f33 commit 57bf6bd

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

hwc2_device/HwcDisplay.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)