From fbd63543930417f3cefe36bdb9f2cdd20fc3693a Mon Sep 17 00:00:00 2001 From: Vaxry Date: Fri, 30 Aug 2024 15:50:25 +0200 Subject: presentation-feedback: minor fixups --- src/protocols/PresentationTime.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/protocols/PresentationTime.cpp') diff --git a/src/protocols/PresentationTime.cpp b/src/protocols/PresentationTime.cpp index b1108042..e1ff52cd 100644 --- a/src/protocols/PresentationTime.cpp +++ b/src/protocols/PresentationTime.cpp @@ -14,7 +14,7 @@ void CQueuedPresentationData::setPresentationType(bool zeroCopy_) { zeroCopy = zeroCopy_; } -void CQueuedPresentationData::attachMonitor(CMonitor* pMonitor_) { +void CQueuedPresentationData::attachMonitor(SP pMonitor_) { pMonitor = pMonitor_; } @@ -67,12 +67,14 @@ void CPresentationFeedback::sendQueued(SP data, timespe (uint32_t)(seq & 0xFFFFFFFF), (wpPresentationFeedbackKind)flags); else resource->sendDiscarded(); + + done = true; } CPresentationProtocol::CPresentationProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) { static auto P = g_pHookSystem->hookDynamic("monitorRemoved", [this](void* self, SCallbackInfo& info, std::any param) { const auto PMONITOR = std::any_cast(param); - std::erase_if(m_vQueue, [PMONITOR](const auto& other) { return !other->surface || other->pMonitor == PMONITOR; }); + std::erase_if(m_vQueue, [PMONITOR](const auto& other) { return !other->surface || other->pMonitor.get() == PMONITOR; }); }); } @@ -105,7 +107,7 @@ void CPresentationProtocol::onGetFeedback(CWpPresentation* pMgr, wl_resource* su } } -void CPresentationProtocol::onPresented(CMonitor* pMonitor, timespec* when, uint32_t untilRefreshNs, uint64_t seq, uint32_t reportedFlags) { +void CPresentationProtocol::onPresented(SP pMonitor, timespec* when, uint32_t untilRefreshNs, uint64_t seq, uint32_t reportedFlags) { timespec now; timespec* presentedAt = when; if (!presentedAt) { @@ -119,7 +121,7 @@ void CPresentationProtocol::onPresented(CMonitor* pMonitor, timespec* when, uint continue; for (auto const& data : m_vQueue) { - if (!data->surface || data->surface != feedback->surface) + if (!data->surface || data->surface != feedback->surface || (data->pMonitor && data->pMonitor != pMonitor)) continue; feedback->sendQueued(data, when, untilRefreshNs, seq, reportedFlags); @@ -129,7 +131,7 @@ void CPresentationProtocol::onPresented(CMonitor* pMonitor, timespec* when, uint } std::erase_if(m_vFeedbacks, [](const auto& other) { return !other->surface || other->done; }); - std::erase_if(m_vQueue, [pMonitor](const auto& other) { return !other->surface || other->pMonitor == pMonitor || !other->pMonitor; }); + std::erase_if(m_vQueue, [pMonitor](const auto& other) { return !other->surface || other->pMonitor == pMonitor || !other->pMonitor || other->done; }); } void CPresentationProtocol::queueData(SP data) { -- cgit v1.2.3