EGL partial_update vs. swap_buffers_with_damage and amdgpu support
Pekka Paalanen
pekka.paalanen at haloniitty.fi
Sun Jan 26 15:28:42 UTC 2025
On Sun, 26 Jan 2025 08:52:31 -0600
Charlie McMackin <charliemac at endparen.com> wrote:
> Hello,
>
> I am writing a Wayland+EGL+OpenGL app and am beginning my foray into
> rendering only the areas that need updating. I am a little perplexed
> trying to figure out which extension(s) my GPU supports.
>
> 1. When I run `eglinfo` should I see "EGL_KHR_partial_update" in the
> extension list if partial update is supported?
I believe so, yes.
> All the symbols mentioned in the registry for extension 83 seem to
> refer to BUFFER_AGE_KHR or eglSwapBuffersWithDamageKHR... and is very
> similarly worded to extension 84. So I'm not sure if I need to see
> this specific extension or if having EGL_EXT_buffer_age and
> EGL_KHR_swap_buffers_with_damage is enough.
We need to distinguish two fundamental "damage" areas:
- the areas of a buffer that you will draw, and
- the areas of a buffer that will be different from the current
contents of the window (wl_surface)
This distinction is the key to understanding, and the EGL extension
docs try to make it clear.
Usually applications, and EGL internally, will use a pool of
buffers, around two to four in most cases. In Wayland, once EGL
has posted a buffer to the display, (E)GL is not allowed to draw
into that buffer util the Wayland compositor says it won't need it
anymore. Often, you need to draw and post again before the previous
buffer is released. Therefore EGL needs another buffer to draw into
in the meanwhile. EGL hides all these details from you, you cannot
observe buffers on the EGL Wayland platform yourself.
buffer_age is the EGL extension that tells you how many swaps ago
this buffer was last posted, IOW, how old contents does it have.
The application needs to keep account on the history of the changes
(damage) to the window, so that it knows exactly which areas of the
buffer need to be drawn to make it fully up-to-date. This is usually
more than just the change you want to draw for the next frame.
In summary, you need to draw more areas than you actully want to
update on screen.
Partial_update extension allows you to tell EGL which areas of the
buffer you are going to draw. Regardless of whether partial_update
is supported, you need to track that damage anyway to know what to
draw.
swap_buffers_with_damage extension tells the window system which
areas of the window are being updated. The window system may save
some effort and skip processing areas that you say are not updated.
However, on Wayland the buffer must be fully up-to-date regardless
of what you draw or what you claim changed, because the Wayland
compositor is always allowed to read the full contents.
>
> 2. If "yes" is the answer to 1, is there a known reason why an AMD
> Renoir level graphics chip wouldn't show support for
> EGL_KHR_partial_update ?
Not all GPUs benefit from the partial_update information, it
depends on the GPU hardware design. Usually so called "tiler" GPUs
can benefit from it, while "immediate mode" GPUs don't (I hope I
got the term right). AMD tends to be in the latter group.
Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/mesa-users/attachments/20250126/f84cd80b/attachment.sig>
More information about the mesa-users
mailing list