From da86db43d47141b9d7332d3cb756ff7c05dbb39a Mon Sep 17 00:00:00 2001 From: Ikalco <73481042+ikalco@users.noreply.github.com> Date: Mon, 7 Apr 2025 14:03:27 -0500 Subject: core: refactor and improve surface commit (#9805) * make CHLBufferReference not a SP anymore * copy over release and acquire points in CHLBufferReference * use CHLBufferReference in screencopy and toplevel export TODO: use CHLBufferReference in direct scanout properly the only problem is the scanout buffer release timing, specifically the onBackendRelease mechanism * cleanup SSurfaceState and surface pending commit tracking * move surface code from DRMSyncobj, and move acquire to SSurfaceState * use queue for comitted pending surface states like proto says "The content update is placed in a queue until it becomes active." - wl_surface::commit * drop, not release, prev buffer if 2nd buffer wl_surface.attach is sent "A wl_buffer that has been attached and then replaced by another attach instead of committed will not receive a release event, and is not used by the compositor." - wl_surface::attach --- src/protocols/DRMSyncobj.hpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/protocols/DRMSyncobj.hpp') diff --git a/src/protocols/DRMSyncobj.hpp b/src/protocols/DRMSyncobj.hpp index d2259a34..a724258b 100644 --- a/src/protocols/DRMSyncobj.hpp +++ b/src/protocols/DRMSyncobj.hpp @@ -5,14 +5,11 @@ #include "../helpers/sync/SyncReleaser.hpp" #include "linux-drm-syncobj-v1.hpp" #include "../helpers/signal/Signal.hpp" -#include "types/SurfaceState.hpp" #include -#include class CWLSurfaceResource; class CDRMSyncobjTimelineResource; class CSyncTimeline; -struct SSurfaceState; class CDRMSyncPointState { public: @@ -28,6 +25,10 @@ class CDRMSyncPointState { Hyprutils::OS::CFileDescriptor exportAsFD(); void signal(); + operator bool() const { + return m_timeline; + } + private: SP m_timeline = {}; uint64_t m_point = 0; @@ -38,19 +39,15 @@ class CDRMSyncPointState { class CDRMSyncobjSurfaceResource { public: CDRMSyncobjSurfaceResource(UP&& resource_, SP surface_); - ~CDRMSyncobjSurfaceResource(); - bool protocolError(); bool good(); private: - void removeAllWaiters(); WP surface; UP resource; CDRMSyncPointState pendingAcquire; CDRMSyncPointState pendingRelease; - std::vector> pendingStates; struct { CHyprSignalListener surfacePrecommit; -- cgit v1.2.3