EGL partial_update vs. swap_buffers_with_damage and amdgpu support
Charlie McMackin
charliemac at endparen.com
Sun Jan 26 16:37:39 UTC 2025
On Sun, Jan 26, 2025 at 9:28 AM Pekka Paalanen
<pekka.paalanen at haloniitty.fi> wrote:
>
> 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.
>
Ok, thank you for the timely and detailed response! I think this gives
me idea where to experiment next.
> >
> > 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.
>
Ah, this is definitely one key I didn't know. So, I shouldn't be
missing out on any ability to only update damaged areas of a
framebuffer without the partial_update extension...the main key is
using buffer_age to determine what my render loop should draw and the
other two are more for hinting to compositors that support it / are
more nice-if-you-have-it?
Thanks again!
More information about the mesa-users
mailing list