presentation-feedback: fix invalid values sent after aq merge

This commit is contained in:
Vaxry 2024-07-21 19:25:01 +02:00
parent e6fc9873b5
commit 3b6bcd6ddc
2 changed files with 10 additions and 2 deletions

View file

@ -60,7 +60,7 @@ void CPresentationFeedback::sendQueued(SP<CQueuedPresentationData> data, timespe
if (reportedFlags & Aquamarine::IOutput::AQ_OUTPUT_PRESENT_HW_COMPLETION)
flags |= WP_PRESENTATION_FEEDBACK_KIND_HW_COMPLETION;
if (data->wasPresented && when)
if (data->wasPresented)
resource->sendPresented((uint32_t)(when->tv_sec >> 32), (uint32_t)(when->tv_sec & 0xFFFFFFFF), (uint32_t)(when->tv_nsec), untilRefreshNs, (uint32_t)(seq >> 32),
(uint32_t)(seq & 0xFFFFFFFF), (wpPresentationFeedbackKind)flags);
else
@ -104,6 +104,14 @@ void CPresentationProtocol::onGetFeedback(CWpPresentation* pMgr, wl_resource* su
}
void CPresentationProtocol::onPresented(CMonitor* 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;
}
for (auto& feedback : m_vFeedbacks) {
if (!feedback->surface)
continue;

View file

@ -463,7 +463,7 @@ void CWLSurfaceResource::presentFeedback(timespec* when, CMonitor* pMonitor, boo
frame(when);
auto FEEDBACK = makeShared<CQueuedPresentationData>(self.lock());
FEEDBACK->attachMonitor(pMonitor);
FEEDBACK->discarded();
FEEDBACK->presented();
PROTO::presentation->queueData(FEEDBACK);
if (!pMonitor || !pMonitor->outTimeline || !syncobj || !needsExplicitSync)