Hyprland/src/protocols
Tom Englund 6ffde36466
syncobj: use eventfd instead of stalling fd checks (#9437)
* syncobj: cleanup and use uniqueptrs

cleanup a bit missing removals if resource not good, erasing from
containers etc. make use of unique ptrs instead. and add default
destructors.

* syncobj: rework syncobj entirerly

remove early buffer release that was breaking explicit sync, the buffer
needs to exist until the surface commit event has been emitted and draw
calls added egl sync points, move to eventfd signaling instead of
stalling sync point checks, and recommit pending commits if waiting on a
signal. add a CDRMSyncPointState helper class. move a few weak pointers
to shared pointers so they dont destruct before we need to use them.

* syncobj: queue pending states for eventfd

eventfd requires us to queue pending stats until ready and then apply to
current, and also when no ready state exist commit the client commit on
the current existing buffer, if there is one.

* syncobj: clear current buffer damage

clear current buffer damage on current buffer commits.

* syncobj: cleanup code and fix hyprlock

remove unused code, and ensure we dont commit a empty texture causing
locksession protocol and gtk4-layer-shell misbehaving.

* syncobj: ensure buffers are cleaned up

ensure the containers having the various buffers actually gets cleaned
up from their containers, incase the CSignal isnt signaled because of
expired smart pointers or just wrong order destruction because mishaps.
also move the acquire/point setting to buffer attaching. instead of on
precommit.

* syncobj: remove unused code, optimize

remove unused code and merge sync fds if fence is valid, remove manual
directscanout buffer dropping that signals release point on pageflip, it
can cause us to signal the release point while still keeping the current
buffer and rendering it yet again causing wrong things.

* syncobj: delay buffer release on non syncobj

delay buffer releases on non syncobj surfaces until next commit, and
check on async buffers if syncobj and drop and signal the release point
on backend buffer release.

* syncobj: ensure we follow protocol

ensure we follow protocol by replacing acquire/release points if they
arrive late and replace already existing ones. also remove unneded
brackets, and dont try to manual lock/release buffers when it comes to
explicit protocol. it doesnt care about buffer releases only about
acquire and release points and signaling them.

* syncobj: lets not complicate things

set points in precommit, before checking protocol errors and we catch
any pending acquire/release points arriving late.

* syncobj: move SSurfaceState to types

remove destructor resource destroying, let resources destroys them on
their events, and move SSurfaceStates to types/SurfaceState.hpp

* syncobj: actually store the merged fd

have to actually store the mergedfd to use it.

* syncobj: cleanup a bit around fences

ensure the current asynchronous buffer is actually released on pageflip
not the previous. cleanup a bit FD handling in
commitPendingAndDoExplicitSync, and reuse the in fence when syncing
surfaces.

* syncobjs: ensure fence FD doesnt leak

calling resetexplicitfence without properly ensuring the FD is closed
before will leak it, store it per monitor and let it close itself with
the CFileDescriptor class.

* syncobj: ensure buffers are actually released

buffers were never being sent released properly.

* types: Defer buffer sync releaser until unlock

* syncobj: store directscanout fence in monitor

ensure the infence fd survives the scope of attemptdirectscanout so it
doesnt close before it should have.

* syncobj: check if if acquire is expired

we might hit a race to finish on exit where the timeline just has
destructed but the buffer waiter is still pending. and such we
removeAllWaiters null dereferences.

* syncobj: code style changes

remove quack comment, change to m_foo and use a std::vector and
weakpointer in the waiter for removal instead of a std::list.

* syncobj: remove unused async buffer drop

remove unused async buffer drop, only related to directscanout and is
handled elsewhere.

---------

Co-authored-by: Lee Bousfield <ljbousfield@gmail.com>
2025-03-14 15:08:20 +01:00
..
core syncobj: use eventfd instead of stalling fd checks (#9437) 2025-03-14 15:08:20 +01:00
types syncobj: use eventfd instead of stalling fd checks (#9437) 2025-03-14 15:08:20 +01:00
AlphaModifier.cpp renderer/internal: stop using box pointers 2025-01-26 15:05:34 +00:00
AlphaModifier.hpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
ColorManagement.cpp renderer: add simple color management (#9506) 2025-03-14 00:15:18 +01:00
ColorManagement.hpp protocols: Fix blocked color management get_information (#9563) 2025-03-07 23:54:56 +01:00
ContentType.cpp protocols: Support content-type-v1 proto (#9226) 2025-02-02 20:25:29 +01:00
ContentType.hpp config: fix includes 2025-02-02 22:20:28 +00:00
CTMControl.cpp protocols: implement hyprland-ctm-control rev 2 (#9267) 2025-02-02 18:31:04 +01:00
CTMControl.hpp protocols: implement hyprland-ctm-control rev 2 (#9267) 2025-02-02 18:31:04 +01:00
CursorShape.cpp protocols: Fix cursor shape protocol valid shape check (#9547) 2025-03-06 16:54:47 +01:00
CursorShape.hpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
DataDeviceWlr.cpp core: begin using CFileDescriptor from hyprutils (#9122) 2025-01-30 11:30:12 +00:00
DataDeviceWlr.hpp core: begin using CFileDescriptor from hyprutils (#9122) 2025-01-30 11:30:12 +00:00
DRMLease.cpp core: begin using CFileDescriptor from hyprutils (#9122) 2025-01-30 11:30:12 +00:00
DRMLease.hpp core: begin using CFileDescriptor from hyprutils (#9122) 2025-01-30 11:30:12 +00:00
DRMSyncobj.cpp syncobj: use eventfd instead of stalling fd checks (#9437) 2025-03-14 15:08:20 +01:00
DRMSyncobj.hpp syncobj: use eventfd instead of stalling fd checks (#9437) 2025-03-14 15:08:20 +01:00
FocusGrab.cpp core,hyprctl: clang, clang-tidy, typo fixes and dtors changes (#9233) 2025-01-30 11:07:06 +00:00
FocusGrab.hpp core,hyprctl: clang, clang-tidy, typo fixes and dtors changes (#9233) 2025-01-30 11:07:06 +00:00
ForeignToplevel.cpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
ForeignToplevel.hpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
ForeignToplevelWlr.cpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
ForeignToplevelWlr.hpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
FractionalScale.cpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
FractionalScale.hpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
FrogColorManagement.cpp protocols: Support wp color management proto (#9444) 2025-02-26 15:56:37 +01:00
FrogColorManagement.hpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
GammaControl.cpp core: begin using CFileDescriptor from hyprutils (#9122) 2025-01-30 11:30:12 +00:00
GammaControl.hpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
GlobalShortcuts.cpp core: reserve vector sizes as much as we can (#9118) 2025-01-19 10:38:42 +00:00
GlobalShortcuts.hpp protocols: Move globalshortcuts impl (#7102) 2024-07-30 23:33:56 +02:00
HyprlandSurface.cpp renderer/internal: stop using box pointers 2025-01-26 15:05:34 +00:00
HyprlandSurface.hpp protocols: add hyprland_surface_v1.set_visible_region implementation (#9120) 2025-01-23 22:57:33 +01:00
IdleInhibit.cpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
IdleInhibit.hpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
IdleNotify.cpp protocols: add version 2 of ext-idle-notify-v1 protocol (#8959) 2025-02-11 15:58:43 +01:00
IdleNotify.hpp protocols: add version 2 of ext-idle-notify-v1 protocol (#8959) 2025-02-11 15:58:43 +01:00
InputMethodV2.cpp core: begin using CFileDescriptor from hyprutils (#9122) 2025-01-30 11:30:12 +00:00
InputMethodV2.hpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
LayerShell.cpp layershell: check if layer is valid (#9156) 2025-01-24 16:51:31 +01:00
LayerShell.hpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
LinuxDMABUF.cpp syncobj: use eventfd instead of stalling fd checks (#9437) 2025-03-14 15:08:20 +01:00
LinuxDMABUF.hpp syncobj: use eventfd instead of stalling fd checks (#9437) 2025-03-14 15:08:20 +01:00
LockNotify.cpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
LockNotify.hpp protocols: add hyprland_lock_notify_v1 implementation (#9092) 2025-01-19 18:21:36 +00:00
MesaDRM.cpp core: add LIKELY and UNLIKELY macros 2025-01-17 18:56:39 +01:00
MesaDRM.hpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
OutputManagement.cpp core: add LIKELY and UNLIKELY macros 2025-01-17 18:56:39 +01:00
OutputManagement.hpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
OutputPower.cpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
OutputPower.hpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
PointerConstraints.cpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
PointerConstraints.hpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
PointerGestures.cpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
PointerGestures.hpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
PresentationTime.cpp presentation: log a fixme when there is a feedback leak 2025-01-28 23:43:31 +00:00
PresentationTime.hpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
PrimarySelection.cpp core: begin using CFileDescriptor from hyprutils (#9122) 2025-01-30 11:30:12 +00:00
PrimarySelection.hpp core: begin using CFileDescriptor from hyprutils (#9122) 2025-01-30 11:30:12 +00:00
RelativePointer.cpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
RelativePointer.hpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
Screencopy.cpp renderer: various fixes towards improving gpu calls robustness (#9188) 2025-02-08 01:46:26 +01:00
Screencopy.hpp internal: Move CMonitor to SP (#8178) 2024-10-19 23:03:29 +01:00
SecurityContext.cpp core: begin using CFileDescriptor from hyprutils (#9122) 2025-01-30 11:30:12 +00:00
SecurityContext.hpp core: begin using CFileDescriptor from hyprutils (#9122) 2025-01-30 11:30:12 +00:00
ServerDecorationKDE.cpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
ServerDecorationKDE.hpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
SessionLock.cpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
SessionLock.hpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
ShortcutsInhibit.cpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
ShortcutsInhibit.hpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
SinglePixel.cpp syncobj: use eventfd instead of stalling fd checks (#9437) 2025-03-14 15:08:20 +01:00
SinglePixel.hpp syncobj: use eventfd instead of stalling fd checks (#9437) 2025-03-14 15:08:20 +01:00
Tablet.cpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
Tablet.hpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
TearingControl.cpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
TearingControl.hpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
TextInputV1.cpp core: add LIKELY and UNLIKELY macros 2025-01-17 18:56:39 +01:00
TextInputV1.hpp security-context: implement protocol 2024-10-06 14:07:07 +01:00
TextInputV3.cpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
TextInputV3.hpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
ToplevelExport.cpp renderer: various fixes towards improving gpu calls robustness (#9188) 2025-02-08 01:46:26 +01:00
ToplevelExport.hpp protocols: immediately copy toplevel content when ignoreDamage set (#9049) 2025-01-14 16:44:09 +00:00
Viewporter.cpp core: add LIKELY and UNLIKELY macros 2025-01-17 18:56:39 +01:00
Viewporter.hpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
VirtualKeyboard.cpp core: begin using CFileDescriptor from hyprutils (#9122) 2025-01-30 11:30:12 +00:00
VirtualKeyboard.hpp core: begin using CFileDescriptor from hyprutils (#9122) 2025-01-30 11:30:12 +00:00
VirtualPointer.cpp input: add flip_x and flip_y for touchpad (#9481) 2025-03-03 21:56:01 +01:00
VirtualPointer.hpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
WaylandProtocol.cpp protocols: Fix IWaylandProtocol onDisplayDestroy m_pGlobal double-free (#9507) 2025-02-28 02:52:31 +01:00
WaylandProtocol.hpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
XDGActivation.cpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
XDGActivation.hpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
XDGDecoration.cpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
XDGDecoration.hpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
XDGDialog.cpp core: add LIKELY and UNLIKELY macros 2025-01-17 18:56:39 +01:00
XDGDialog.hpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
XDGOutput.cpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
XDGOutput.hpp internal: cleanup CMonitor usage and fix a few ref hogs 2024-10-26 02:06:13 +01:00
XDGShell.cpp core: add an ANR dialog 2025-02-18 15:13:56 +00:00
XDGShell.hpp core: add an ANR dialog 2025-02-18 15:13:56 +00:00
XWaylandShell.cpp core: add LIKELY and UNLIKELY macros 2025-01-17 18:56:39 +01:00
XWaylandShell.hpp core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
XXColorManagement.cpp renderer: add simple color management (#9506) 2025-03-14 00:15:18 +01:00
XXColorManagement.hpp protocols: Fix blocked color management get_information (#9563) 2025-03-07 23:54:56 +01:00