* 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>
this fixes direct scanout glitches by ensuring that attemptDirectScanout doesn't try to recommit the same buffer to AQ
which would cause a pageflip event and the backendRelease to release the same buffer too early
* compositor: reduce amount of window box copies
mousemoveunified can call this very frequently, the cbox copying
actually shows up as an impact in such cases, move it down in the scope
and only do it when necessery.
* core: constify and reference frequent calls
profiling shows these as frequent called functions try to reduce the
amount of copies with references and const the variables.
* pointermgr: remove not used local copy, const ref
remove unneded local copies and const ref cursorsize.
* inputmgr: reduce amount of calls to vectortowindow
the amount of calls to g_pCompositor->vectorToWindowUnified fast ramps
up in cpu usage with enough windows existing and moving the mouse, move
the PWINDOWIDEAL up and reuse it if its already the same.
* protocol: compositor remove unused local copy
remove unused local copy of accumulateCurrentBufferDamage and const
previousBuffer.
* renderer: reduce scope of variables and refactor
move a few variables down in their scopes to reduce the amount of calls
and copies when not needed, also add one more for loop in
renderWorkspaceWindows and store the windows in a vector with
weakpointers that should be rendered, this adds a loop but reduces the
amount of repeated calls to shouldRenderWindow and also makes the rest
of the loops go over way smaller vector when many windows exist.
* deco: reduce local temporars and function calls
profiling shows this is a high used function, reduce the amount of
function calls and local temporar copies and also check if we even need
to add extents at all in the loop.
* popup: optimize bfhelper in popups
pass nodes as const reference and reserve the size of the children node
vector help reduce the reallocations.
* procotol: make compositor bfhelper use const ref
use const ref for nodes and reserve second nodes vector size to reduce
amount of reallocation needed.
this avoids the usage of the unique_ptr PROTO::protocol before it has
been constructed incase one wants to log something inside the
constructor itself, move the logging to macros and print file:linenumber
on ERR,CRIT,WARN and classname on the rest of the levels.
XWayland does not use the regular commit(null) method to unmap, which results in buffers never being released.
release the buffers if present and un-released in the unmap() handler
ref #6584
fixes#6754
This will break if the client uses a transform that is not equal to the display, reverting to old behavior. Combining transforms is left as a todo for the future.
synchronous buffers are read instantly and we can release them, but asynchronous ones have to be locked until they are unref'd from .current to avoid reading from a buffer after .release()