* opengl: use two VAO's for custom UV
instead of overwriting the same VAO only to reset it later and
glBufferData orphaningm etc. just have two VAO's one static, one for
customUV's.
* renderer: dont only rely max rects to get extents
getting extents for over 8 rects is fine when its local and small, but
scattered across the monitor it means full size damage for a few
different tiled windows. so keep rects unless extents are at most 2
times their area.
* compositor: merge ready states in the surface queue
each waiter was previously added to wl_event_loop. but the
wl_event_loop has no order guarantee, so it could mean fence
A, B, C sits in the queue ready but processes B first then C, then A,
and now we commit A -> B -> C, change waiters to return a WP to the
SReadableWaiter so we can easily track them, iterate in reverse order
check if readable. then later in tryprocess merge all ready states into
one commit. meaning A merges B and C, now we commit C.
fifo is untouched because its FIFO. this is only for fences and mailbox
rendering.
* fifo: with states merging we dont want empty fifo commits
with states merging, we really dont want empty fifo commits that early
returns, just makes it a 3 place if else guard for no gain. move it all
into the fifo protocol instead. now we only fifo lock if both setSet and
setWait is called. the client wants it locked for presentation.
however we can only lock it if previous fifo barrier has been satisfied.
otherwise its going to wait for a presentation that never comes meaning we
never commit the new state that waits for the rendererer to catch it in
the render pass.
* presentation: discard directly instead of queueing
discard presentation directly instead of queuing for a presentation
event that might never come.
* syncobj: remove a O(n) resource lookup
seen in profiling as a big cpu spender
use what other protocols uses for fromResource
* fifo: dont fifo lock synced subsurfaces
The constraint must be ignored if the surface is a subsurface in synchronized mode.
also use setBarrier for setting waitingonpresentation because. protocol
states this. so any client abusing this has only itself to blame.
when the content update containing "set_barrier" was made active at a latching deadline,
it will be active for at least one refresh cycle
* renderer: ensure only one buffer reference is added
not only does snapshots, hit endRender and add the buffer to
m_usedAsyncBuffers but the first real frame does it too, we might have duplicate
buffers added pointing to the same IHLBuffer and fences merging with themself.
so use a std::pair inside the vector to ensure uniquness
this also means we can skip buffers for surfaces that has expired. when
adding fences.
* renderer: move m_usedAsyncBuffers to CMonitor
if showing on two or more monitors, they get a surfacepass per monitor.
and both needs to add its fence.
* lua: support workspace selectors in `hl.get_workspace()`
* tests: lua `hl.get_workspace()` with selectors
* lua: don't change focus in `hl.get_workspace()`
That results in an expired workspace being returned, when it should just
be `nil` for nonexistent spaces.
* compositor: fix wl_surface.attach proto violations
When the bound wl_surface version is 5 or higher, passing any
non-zero x or y is a protocol violation, and will result in an
'invalid_offset' error being raised. The x and y arguments are ignored
and do not change the pending state. To achieve equivalent semantics,
use wl_surface.offset.
at commit time the supplied
buffer size must be an integer multiple of the buffer_scale. If
that's not the case, an invalid_size error is sent.
however viewport changes this slightly so only honor it in non viewport
cases.
* compositor: fix scale and transform violations
If scale is not greater than 0 the invalid_scale protocol error is
raised.
If transform is not one of the values from the
wl_output.transform enum the invalid_transform protocol error
is raised.
* subcompositor: fix spec violations
use enums that exist, add the bad_parent error.
The parent surface must not be one of the child surface's descendants,
and the parent must be different from the child surface, otherwise the
bad_parent protocol error is raised.
* shm: fix spec violations
use existing wayland enum values instead of bogus -1, validate size
before adding to m_pools also validate that size is not 0 in shmIsSizeValid.
* seat: fix protocol violations
use enum instead of bogus -1, axis_discreete states
This event is deprecated with wl_pointer version 8 - this event is not
sent to clients supporting version 8 or later.
m_scale is float, and with fractional scaling and float precision we end
up with things like 1600 * 1.8f = 2879.99992 , we need to round to not
loose 1 pixel.
* monitor: fix transform logical pixels
seems to have vanished in old refactor, without setting m_size the
logical pixels are wrong if you start in non rotation, change config and
apply rotation. m_size still refers to no transformed position.
* monitor: fix added unavailable mirror workspace
applyMonitorRule moved away workspaces and m_activeWorkspace before this with setMirror(),
but onConnect then reassigned one. if guard it.
The edgeBottom branch read delta.y instead of the axis-swapped
modDelta.y, so horizontal resizeactive deltas were ignored for the
first window of a shared band on vertical scrollers.
* windowstate/layerstate: don't dynamic_cast a view's self-ptr during destruction
The view.destroy listeners erase_if'd their containers by evaluating
dynamicPointerCast<IView>(x->m_self). Since the event is emitted from
~IView, the matching view's derived member m_self is already destroyed
by then, so reading it is UB. Compare control-block identity via
PHLVIEWREF{x} instead, which never dereferences the dying object.
* iview: remove pointless destroy listener
CWindow/Layers calls removeSafe in their own onDestroy,
the best way to avoid buggy code is by simply not doing it at all :)
earlier codex complaint, if empty fifo commit happend but contained
feedbacks it was silently dropped. also at the same time the only time
we should discard current feedbacks if there are any is when a new
buffer appears.
add a presentation bit flag, set it in onGetFeedback.
* Revert "presentation: revert "associate feedback with committed surface state (#15243)""
This reverts commit 4a753eaa03.
* presentation: fix WP locks and discard failed draws
the reason it stopped working is last change that PR
did was moving from raw ptrs to UP's with WP's but tried to .lock() the
WP, we cant lock a WP that points to a UP.
also ensure all draws that isnt visible or simply failed creating
texture or invalid sizes discard in elementrenderer. and all others
present.
* frame: fix frame scheduling being skipped or one vblank off
in renderer we need to check if we have pending damage, needsFrame can
be cleared by commits that was done while pageflip was in flight.
m_renderingActive also needs to be set after actually comitting.
add a commitTimingTarget that we check against on presentation otherwise
the committiming timer runs only on duration and might miss the upcoming
vblank period as in always being one vblank late. and use the timespec
we get from presentation.
* frame: skip early release on invalid timestamp
skip early release on invalid timestamp, and rely on the timer timeout
if missing.
makes the presented signal emit a std::optional timestamp instead.
* frame: only early release for single output
if the surface entered multiple outputs, we cant early release it
because they flip at different times and might make it release way
before the flip of the other monitor.
* frame: anchor commitTimingTarget to the client timestamp
get the absolute target directly from the requested timestamp.
reset commitTimingTarget if delay is 0, and reset it in SSurfaceState
reset.
* frame: fix codex complaints
use fromTimespec so "C++ steady-clock epoch does not exactly match
CLOCK_MONOTONIC" doesnt occur. unify the timespec code in both
monitor and commit timing protocol. always send the timespec on monitor
presented signal.