[Mesa-dev] [PATCH] egl/wayland: Support for KHR_partial_update

Eric Engestrom eric.engestrom at imgtec.com
Fri Oct 20 14:01:08 UTC 2017


On Wednesday, 2017-10-18 10:20:01 +0000, Harish Krupo wrote:
> Hi Eric,
> 
> Eric Engestrom <eric.engestrom at imgtec.com> writes:
> 
> > On Wednesday, 2017-10-18 06:06:45 +0000, Harish Krupo wrote:
> >> Hi Eric,
> >> 
> >> Eric Engestrom <eric at engestrom.ch> writes:
> >> > I might need to double check the spec, but I thought "no damage hint"
> >> > meant "no way to reduce the update, redraw the whole screen"?
> >> >
> >> > If that's the case, then SwapBuffers() and SwapBuffersWithDamages(NULL, 0)
> >> > should have the same effect: not setting any damage region.
> >> >
> >> > You can therefore drop the `with_damage` bool and just use `n_rects > 0`.
> >> >
> >> 
> >> Quoting from the swap buffers with damage spec:
> >>    If <n_rects> is 0 then <rects> is ignored and the entire
> >>    surface is implicitly damaged and the behaviour is equivalent
> >>    to calling eglSwapBuffers.
> >> 
> >> If we were to use n_rects, then the code would be something like this:
> >>    if (n_rects > 0) { // with_damage case
> >>       if (!try_damage_buffer(dri2_surf, rects, n_rects))
> >>          wl_surface_damage(dri2_surf->wl_surface_wrapper,
> >>                            0, 0, INT32_MAX, INT32_MAX);
> >>    }
> >>    else {
> >>       // if (!dri2_surf->base.SetDamageRegionCalled)
> >>          wl_surface_damage(dri2_surf->wl_surface_wrapper,
> >>                            0, 0, INT32_MAX, INT32_MAX);
> >>    }
> >> 
> >> The problem here is when n_rects is zero, then according the
> >> swap_buffers spec the damage should be set to maximum which it will.
> >> This code will also be executed by SwapBuffers. In this case the maximum
> >> damage should be set only when no previous damage has already been set by
> >> SetDamageRegion otherwise the previous SetDamageRegion call would be in
> >> vain. (Also wayland requires that some buffer damage is set otherwise
> >> there will be no damage at all.)
> >
> > That last sentence is the bit I was missing: I thought if no damage
> > was set in WL it meant the whole screen was damaged, ie. the same way
> > it's defined in EGL.
> >
> > Can you point me to the WL spec where this is mentioned, or some
> > documentation?
> > If I can confirm this, then I was wrong and I apologise :]
> >
> 
> Ok, here is the documentation from wayland.xml.
> https://cgit.freedesktop.org/wayland/wayland/tree/protocol/wayland.xml#n1389

Perfect, thanks! So, I was wrong, damage in wayland does indeed need to be
specified when the whole surface should be redrawn :)

I have a couple comments I'll post on the new patch.

> 
> >> 
> >> Thank you
> >> 
> >> Regards
> >> Harish Krupo
> 


More information about the mesa-dev mailing list