summaryrefslogtreecommitdiff
path: root/src/protocols/PresentationTime.cpp
diff options
context:
space:
mode:
authorVaxry <vaxry@vaxry.net>2025-04-16 01:37:48 +0100
committerVaxry <vaxry@vaxry.net>2025-04-16 01:37:48 +0100
commit877fb5b93ada9b25b4d2f5ca5f69370fa345f1ac (patch)
tree5b52ad19c695590ae50c7adae06b8e3aeccf34c1 /src/protocols/PresentationTime.cpp
parent0e521788bcc414c9cf81648d3167757d83deb60f (diff)
time: move to stl's clocks and move timer
Diffstat (limited to 'src/protocols/PresentationTime.cpp')
-rw-r--r--src/protocols/PresentationTime.cpp20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/protocols/PresentationTime.cpp b/src/protocols/PresentationTime.cpp
index 05fda8ea..b8f06cd3 100644
--- a/src/protocols/PresentationTime.cpp
+++ b/src/protocols/PresentationTime.cpp
@@ -40,7 +40,7 @@ bool CPresentationFeedback::good() {
return resource->resource();
}
-void CPresentationFeedback::sendQueued(SP<CQueuedPresentationData> data, timespec* when, uint32_t untilRefreshNs, uint64_t seq, uint32_t reportedFlags) {
+void CPresentationFeedback::sendQueued(SP<CQueuedPresentationData> data, const Time::steady_tp& when, uint32_t untilRefreshNs, uint64_t seq, uint32_t reportedFlags) {
auto client = resource->client();
if LIKELY (PROTO::outputs.contains(data->pMonitor->szName)) {
@@ -58,12 +58,14 @@ void CPresentationFeedback::sendQueued(SP<CQueuedPresentationData> data, timespe
if (reportedFlags & Aquamarine::IOutput::AQ_OUTPUT_PRESENT_HW_COMPLETION)
flags |= WP_PRESENTATION_FEEDBACK_KIND_HW_COMPLETION;
- time_t tv_sec = 0;
+ const auto TIMESPEC = Time::toTimespec(when);
+
+ time_t tv_sec = 0;
if (sizeof(time_t) > 4)
- tv_sec = when->tv_sec >> 32;
+ tv_sec = TIMESPEC.tv_sec >> 32;
if (data->wasPresented)
- resource->sendPresented((uint32_t)tv_sec, (uint32_t)(when->tv_sec & 0xFFFFFFFF), (uint32_t)(when->tv_nsec), untilRefreshNs, (uint32_t)(seq >> 32),
+ resource->sendPresented((uint32_t)tv_sec, (uint32_t)(TIMESPEC.tv_sec & 0xFFFFFFFF), (uint32_t)(TIMESPEC.tv_nsec), untilRefreshNs, (uint32_t)(seq >> 32),
(uint32_t)(seq & 0xFFFFFFFF), (wpPresentationFeedbackKind)flags);
else
resource->sendDiscarded();
@@ -107,15 +109,7 @@ void CPresentationProtocol::onGetFeedback(CWpPresentation* pMgr, wl_resource* su
}
}
-void CPresentationProtocol::onPresented(PHLMONITOR pMonitor, timespec* when, uint32_t untilRefreshNs, uint64_t seq, uint32_t reportedFlags) {
- timespec now;
- timespec* presentedAt = when;
- if (!presentedAt) {
- // just put the current time, we don't have anything better
- clock_gettime(CLOCK_MONOTONIC, &now);
- when = &now;
- }
-
+void CPresentationProtocol::onPresented(PHLMONITOR pMonitor, const Time::steady_tp& when, uint32_t untilRefreshNs, uint64_t seq, uint32_t reportedFlags) {
for (auto const& feedback : m_vFeedbacks) {
if (!feedback->surface)
continue;