protocols: commit and presentation timing fixes (#13174)
* move commit timing fields to surface state * fix toTimespec init * update sendQueued api * update onPresented api * set zero copy flag * send clock id * move presented calcs inside condition * use only CLOCK_MONOTONIC for commit/presentation timings * fix setSetTimestamp * do not wait for commit timing while tearing * proto config * fix config defaults
This commit is contained in:
parent
407a623801
commit
ff061d177e
14 changed files with 107 additions and 64 deletions
|
|
@ -40,7 +40,7 @@ bool CPresentationFeedback::good() {
|
|||
return m_resource->resource();
|
||||
}
|
||||
|
||||
void CPresentationFeedback::sendQueued(WP<CQueuedPresentationData> data, const Time::steady_tp& when, uint32_t untilRefreshNs, uint64_t seq, uint32_t reportedFlags) {
|
||||
void CPresentationFeedback::sendQueued(WP<CQueuedPresentationData> data, const timespec& when, uint32_t untilRefreshNs, uint64_t seq, uint32_t reportedFlags) {
|
||||
auto client = m_resource->client();
|
||||
|
||||
if LIKELY (PROTO::outputs.contains(data->m_monitor->m_name) && data->m_wasPresented) {
|
||||
|
|
@ -48,28 +48,26 @@ void CPresentationFeedback::sendQueued(WP<CQueuedPresentationData> data, const T
|
|||
m_resource->sendSyncOutput(outputResource->getResource()->resource());
|
||||
}
|
||||
|
||||
uint32_t flags = 0;
|
||||
if (!data->m_monitor->m_tearingState.activelyTearing)
|
||||
flags |= WP_PRESENTATION_FEEDBACK_KIND_VSYNC;
|
||||
if (data->m_zeroCopy)
|
||||
flags |= WP_PRESENTATION_FEEDBACK_KIND_ZERO_COPY;
|
||||
if (reportedFlags & Aquamarine::IOutput::AQ_OUTPUT_PRESENT_HW_CLOCK)
|
||||
flags |= WP_PRESENTATION_FEEDBACK_KIND_HW_CLOCK;
|
||||
if (reportedFlags & Aquamarine::IOutput::AQ_OUTPUT_PRESENT_HW_COMPLETION)
|
||||
flags |= WP_PRESENTATION_FEEDBACK_KIND_HW_COMPLETION;
|
||||
if (data->m_wasPresented) {
|
||||
uint32_t flags = 0;
|
||||
if (!data->m_monitor->m_tearingState.activelyTearing)
|
||||
flags |= WP_PRESENTATION_FEEDBACK_KIND_VSYNC;
|
||||
if (data->m_zeroCopy)
|
||||
flags |= WP_PRESENTATION_FEEDBACK_KIND_ZERO_COPY;
|
||||
if (reportedFlags & Aquamarine::IOutput::AQ_OUTPUT_PRESENT_HW_CLOCK)
|
||||
flags |= WP_PRESENTATION_FEEDBACK_KIND_HW_CLOCK;
|
||||
if (reportedFlags & Aquamarine::IOutput::AQ_OUTPUT_PRESENT_HW_COMPLETION)
|
||||
flags |= WP_PRESENTATION_FEEDBACK_KIND_HW_COMPLETION;
|
||||
|
||||
const auto TIMESPEC = Time::toTimespec(when);
|
||||
time_t tv_sec = 0;
|
||||
if (sizeof(time_t) > 4)
|
||||
tv_sec = when.tv_sec >> 32;
|
||||
|
||||
time_t tv_sec = 0;
|
||||
if (sizeof(time_t) > 4)
|
||||
tv_sec = TIMESPEC.tv_sec >> 32;
|
||||
uint32_t refreshNs = m_resource->version() == 1 && data->m_monitor->m_vrrActive && data->m_monitor->m_output->vrrCapable ? 0 : untilRefreshNs;
|
||||
|
||||
uint32_t refreshNs = m_resource->version() == 1 && data->m_monitor->m_vrrActive && data->m_monitor->m_output->vrrCapable ? 0 : untilRefreshNs;
|
||||
|
||||
if (data->m_wasPresented)
|
||||
m_resource->sendPresented(sc<uint32_t>(tv_sec), sc<uint32_t>(TIMESPEC.tv_sec & 0xFFFFFFFF), sc<uint32_t>(TIMESPEC.tv_nsec), refreshNs, sc<uint32_t>(seq >> 32),
|
||||
m_resource->sendPresented(sc<uint32_t>(tv_sec), sc<uint32_t>(when.tv_sec & 0xFFFFFFFF), sc<uint32_t>(when.tv_nsec), refreshNs, sc<uint32_t>(seq >> 32),
|
||||
sc<uint32_t>(seq & 0xFFFFFFFF), sc<wpPresentationFeedbackKind>(flags));
|
||||
else
|
||||
} else
|
||||
m_resource->sendDiscarded();
|
||||
|
||||
m_done = true;
|
||||
|
|
@ -88,6 +86,7 @@ void CPresentationProtocol::bindManager(wl_client* client, void* data, uint32_t
|
|||
|
||||
RESOURCE->setDestroy([this](CWpPresentation* pMgr) { this->onManagerResourceDestroy(pMgr->resource()); });
|
||||
RESOURCE->setFeedback([this](CWpPresentation* pMgr, wl_resource* surf, uint32_t id) { this->onGetFeedback(pMgr, surf, id); });
|
||||
RESOURCE->sendClockId(CLOCK_MONOTONIC);
|
||||
}
|
||||
|
||||
void CPresentationProtocol::onManagerResourceDestroy(wl_resource* res) {
|
||||
|
|
@ -110,7 +109,7 @@ void CPresentationProtocol::onGetFeedback(CWpPresentation* pMgr, wl_resource* su
|
|||
}
|
||||
}
|
||||
|
||||
void CPresentationProtocol::onPresented(PHLMONITOR pMonitor, const Time::steady_tp& when, uint32_t untilRefreshNs, uint64_t seq, uint32_t reportedFlags) {
|
||||
void CPresentationProtocol::onPresented(PHLMONITOR pMonitor, const timespec& when, uint32_t untilRefreshNs, uint64_t seq, uint32_t reportedFlags) {
|
||||
for (auto const& feedback : m_feedbacks) {
|
||||
if (!feedback->m_surface)
|
||||
continue;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue