Hyprland/src/protocols/CommitTiming.hpp
UjinT34 ff061d177e
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
2026-02-10 14:55:21 +00:00

62 lines
1.5 KiB
C++

#pragma once
#include <vector>
#include "WaylandProtocol.hpp"
#include "commit-timing-v1.hpp"
#include "../helpers/signal/Signal.hpp"
#include "helpers/time/Time.hpp"
class CWLSurfaceResource;
class CEventLoopTimer;
class CCommitTimerResource {
public:
CCommitTimerResource(UP<CWpCommitTimerV1>&& resource_, SP<CWLSurfaceResource> surface);
bool good();
private:
UP<CWpCommitTimerV1> m_resource;
WP<CWLSurfaceResource> m_surface;
struct {
CHyprSignalListener surfaceStateCommit;
} m_listeners;
friend class CCommitTimingProtocol;
friend class CCommitTimingManagerResource;
};
class CCommitTimingManagerResource {
public:
CCommitTimingManagerResource(UP<CWpCommitTimingManagerV1>&& resource_);
~CCommitTimingManagerResource();
bool good();
private:
UP<CWpCommitTimingManagerV1> m_resource;
};
class CCommitTimingProtocol : public IWaylandProtocol {
public:
CCommitTimingProtocol(const wl_interface* iface, const int& ver, const std::string& name);
virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id);
private:
void destroyResource(CCommitTimingManagerResource* resource);
void destroyResource(CCommitTimerResource* resource);
//
std::vector<UP<CCommitTimingManagerResource>> m_managers;
std::vector<UP<CCommitTimerResource>> m_timers;
friend class CCommitTimingManagerResource;
friend class CCommitTimerResource;
};
namespace PROTO {
inline UP<CCommitTimingProtocol> commitTiming;
};