All paths out of `meta_onscreen_native_swap_buffers_with_damage` from
here onward would set the same `CLUTTER_FRAME_RESULT_PENDING_PRESENTED`
(or terminate with `g_assert_not_reached`).
Even failed posts set this result because they will do a
`meta_onscreen_native_notify_frame_complete` in
`page_flip_feedback_discarded`.
(cherry picked from commit 24418b952c5bfd28c3e6bbd6bbc47f2cf37c0a5f)
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1441>
Signed-off-by: Mingi Sung <sungmg@saltyming.net>
Because it soon won't be the maximum. But we do want to verify that the
frame info queue is not empty, to avoid NULL dereferencing and catch logic
errors.
(cherry picked from commit 2076f6e3a91438bf883354888f019931f63dad00)
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1441>
Signed-off-by: Mingi Sung <sungmg@saltyming.net>
It's slightly more efficient, but also we'll soon need it in multiple
functions.
(cherry picked from commit 0fe3c5c29776e87407dadee90edecc6c8ea36960)
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1441>
Signed-off-by: Mingi Sung <sungmg@saltyming.net>
Because a single iteration might also grow the list again.
(cherry picked from commit d3e50cc023acc440cb483604cc82b04778703f52)
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1441>
Signed-off-by: Mingi Sung <sungmg@saltyming.net>
This is a case that triple buffering will encounter. We don't want it
to queue the same onscreen multiple times because that would represent
multiple flips occurring simultaneously.
It's a linear search but the list length is typically only 1 or 2 so
no need for anything fancier yet.
(cherry picked from commit 19e62b1299405d630cb7d8ce1f210f00a4903db5)
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1441>
Signed-off-by: Mingi Sung <sungmg@saltyming.net>
While in double buffering we only care about one previous presentation,
triple buffering will sometimes need to refer to the presentation from
two dispatches prior. So it might help to separate those frame stats
more clearly. This way each frame's dispatch and presentation times are
stored more cohesively such as to not be overwritten during overlapping
frame lifetimes.
Having two types of frame reference (dispatch and presentation) moving
at difference speeds meant that they could not be stored in a ring. Not
all dispatches become presentations and so storing them in a ring would
necessitate very complex conflict avoidance. Instead, a simple reference
counting model was used.
(cherry picked from commit 817a951b246b64fd1c4148e486d24017f71fc4c4)
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3961>
Signed-off-by: Mingi Sung <sungmg@saltyming.net>
So that we maintain a perfectly balanced number of callbacks:
dispatch == notify_ready + notify_presented
Otherwise you can't put any useful logic inside notify_ready and be sure
you're handling all the empty frames.
(cherry picked from commit 85f0f4e227b7f6896fc9fe6d6b9da4d568d2a9e7)
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3961>
Signed-off-by: Mingi Sung <sungmg@saltyming.net>
The stage view color state is not the output color state but usually a
linear version of it. For direct scanout, we need the view color state
to match the output color state instead.
Fixes: 20c7653d49 ("compositor-view/native: Don't scan out surface with color state mismatch")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4196>
(cherry picked from commit aea1aee79e0fff2ff78e1f4fc4b7650c51c8f14f)
It tests both the wl_surface integer scale and fractional scales, for
toplevels, subsurfaces and cursor surfaces. It doesn't yet test DND
surfaces.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4205>
(cherry picked from commit e7ff05632dd3b51169f7d87b95fa150e5f6d7a94)
This makes it easier to create e.g. subsurfaces or cursor surfaces that
inherit generic logic from the WaylandSurface test utility helper type.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4205>
(cherry picked from commit 7273f30234ed03bc6c8f7c48b360d6efb8c0fa87)
It isn't always the highest scale for the surface, so change the
terminology in the common path to reflect this.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4205>
(cherry picked from commit 29571397bc9c23134f9c7e0ea6f6d63d93a17cef)
This consolidates duplicate code in meta_drm_buffer_gbm_blit_to_framebuffer
to use the newly added meta_drm_buffer_gbm_create_native_blit_image, which
also has the side-effect of caching creation of the EGLImage per GBM BO.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4027>
(cherry picked from commit dfa3755f55badd6e58ae4469dbc412f3789a7095)
Creating an EGLImage is rather expensive and is taking the bulk of the
time the secondary GPU copy path is using for each frame. By caching
these per GBM BO we avoid this expensive recreation, which seems to
significantly improve FPS throughput in these scenarios, e.g. an
AMD or Intel iGPU with an NVIDIA dGPU.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4027>
(cherry picked from commit 507409f5d0a7bced42656276e806da6f516ca321)
To swap_buffer_result_feedback from page_flip_feedback_discarded. The
former is where META_KMS_ERROR_DISCARDED from disarm_all_frame_sources
gets handled here.
Fixes: af250506fb ("kms/impl-device: Queue result when discarding submitted update")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3964>
(cherry picked from commit f8524159cc6b1980ae7e2d4894a7cab0d339fc67)
This uses the ref test infrastructure inside the cursor tests screen
cast client, and verifies the content on the screen cast matches the
content of the compositor, both when using the 'embedded' cursor mode,
and the 'metadata' cursor mode.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
(cherry picked from commit a9a4923c03d5a00ccf4d2eece0a4fa98833b324f)
This test doesn't use a separate reference image, but verifies the
result is identical to that of the built in cursor.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
(cherry picked from commit bcb52960dbe8ac2cf944acbadaed1b68e366915b)
It doesn't contain anything screen cast specific, except the
XDG_RUNTIME_DIR, so make it usable from elsewhere. While at it, prepare
it for being able to run the glib test functionality.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
(cherry picked from commit 8cf41761a91b124794aa864c32577c8dd3b3b03c)
This also avoids loosing precision since the float won't be casted to an
int before being used to configure the test output.
Currently there is only one test that expects the scale to be calculated
dynamically, all the other always assume scale ending up being 1.0
unless explicitly configured in some way.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
(cherry picked from commit 228be801640ffc9d3f6210dd3940a48ba4121674)
This will be useful later on when we actually look at the buffer in
places other than when it's actively processed.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
(cherry picked from commit a4380075a69fbe9efdc77a309c84b026b8eb87d7)
Only actively test MemFd, and don't ever ask for or expect MemPtr, since
we don't support those anyway. Also, for convenience, ask the buffers to
be automatically mmap:ed.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
(cherry picked from commit 2386976f5eca488ae597dd7fd01a25aa1f96ce46)
This makes the cursor size match the expectation given by the theme
size. It also means the sprite size now matches GTK4 provided cursor
surfaces using wp_viewport.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
(cherry picked from commit f77d8e2a12a07ef6abe9c9bdfe33bd9d1e1a7ce8)
We create the cursor view data when we update the cursor, but allow the
texture to be realized earlier than that. The texture change listener
invalidates the hw cursor validity state, but since it's initialized to
invalid, the hardware cursor will still be correctly handled.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
(cherry picked from commit 8fc1bddf3bd42533bbb064f699d91f378d30804b)
This makes the overlay code work which is notably used for screen
sharing and recording if the client doesn't support meta-data cursors.
[jadahl] Changed the approach the way coordinates are scaled.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
(cherry picked from commit 35e5ae718ad56210c74f987748697e21ee631530)