Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ws: Save and expose damaged image regions (v2) #188

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

aperezdc
Copy link
Member

This builds upon #184, with the following additions:

  • Meson will check that the Wayland headers define the needed symbols to use wl_surface_damage_buffer(), erroring if not available. The functionality is now always built-in. This should not be an issue because any reasonable Wayland version should have it.
  • Plugs a leak that would leave stale entries in the unordered_map that associates a buffer with its damaged regions list when a buffer is destroyed.
  • Stores damage regions using a new wpe_fdo_rect type, which makes the code easier to follow, and documents the damage support, explicitly indicating that top-left is used as origin of coordinates for damage.
  • Adds warnings to make developers notice if any of the stubbed methods from wl_surface_interface ends up being used.

Thanks to @lauromoura for the first version of the patch set 🙏🏼

aperezdc and others added 6 commits March 13, 2024 16:38
The wl_surface.damage_buffer request can be used by clients to inform
that a given region (in buffer coordinates) is damaged. This request is
used by eglSwapBuffersWithDamage[EXT|KHR], with one call for each rect.

For more info: https://wayland-book.com/surfaces-in-depth/damaging-surfaces.html

This commit stores this information and exposes it to exported EGL image
clients.

It also bumps the nested compositor interface to version 4, which
provides the damage_buffer support.
Use the wl_surface_interface::damage_buffer member unconditionally,
checking that the definition is available from Meson at configuration
time.
Clear the list of damage rectangles when a surface is destroyed, to
avoid leaking them and slowly filling the damage map with unneeded,
stale entries.
Instead of a series of groups of four integer values, group each damage
entry in a wpe_fdo_rect instance, which defines a rectangle explicitly
documented to use the origin of coordinates at the top-left corner of
exported images.

This approach is more readable, uses the same amount of memory, allows
defining the wpe_fdo_egl_exported_image_get_damage_regions() function in
a more idiomatic way (returning pointer to rect array, and receiving a
pointer where to store the number of entries), simplifies the code that
returns the damage rectangle list, and also the code that stores a
damage rectangle (also improved by using emplace+move).

While at it, document wpe_fdo_egl_exported_image_get_damage_regions()
and the new wpe_fdo_rect type.
@aperezdc aperezdc added the enhancement New feature or request label Mar 16, 2024
@aperezdc aperezdc self-assigned this Mar 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants