<p dir="ltr"><br>
On Nov 27, 2015 1:35 AM, "Pekka Paalanen" <<a href="mailto:ppaalanen@gmail.com">ppaalanen@gmail.com</a>> wrote:<br>
><br>
> On Fri, 27 Nov 2015 16:47:19 +0800<br>
> Jonas Ådahl <<a href="mailto:jadahl@gmail.com">jadahl@gmail.com</a>> wrote:<br>
><br>
> > On Thu, Nov 26, 2015 at 03:44:12PM -0600, Derek Foreman wrote:<br>
> > > wl_surface.damage uses surface local co-ordinates.<br>
> > ><br>
> > > Buffer scale and buffer transforms came along, and EGL surfaces<br>
> > > have no understanding of them.<br>
> > ><br>
> > > Theoretically, clients pass damage rectangles - in Y-inverted surface<br>
> > > co-ordinates) to EGLSwapBuffersWithDamage, and the EGL implementation<br>
> > > passed them on to wayland. However, for this to work the EGL<br>
> > > implementation must be able to flip those rectangles into the space<br>
> > > the compositor is expecting, but it's unable to do so because it<br>
> > > doesn't know the height of the transformed buffer.<br>
> > ><br>
> > > So, currently, EGLSwapBuffersWithDamage is unusable and EGLSwapBuffers<br>
> > > has to pass (0,0) - (INT32_MAX, INT32_MAX) damage to function.<br>
> > ><br>
> > > wl_surface.damage_buffer allows damage to be registered on a surface<br>
> > > in buffer co-ordinates, avoiding this problem.<br>
> > ><br>
> > > Credit where it's due, these ideas are not entirely my own:<br>
> > > Over a year ago the idea of changing damage co-ordinates to buffer<br>
> > > co-ordinates was suggested (by Jason Ekstrand), and it was at least<br>
> > > partially rejected and abandoned. At the time it was also suggested<br>
> > > (by Pekka Paalanen) that adding a new wl_surface.damage_buffer request<br>
> > > was another option.<br>
> > ><br>
> > > This will eventually resolve:<br>
> > ><a href="https://bugs.freedesktop.org/show_bug.cgi?id=78190"> https://bugs.freedesktop.org/show_bug.cgi?id=78190</a><br>
> > > by making the problem irrelevant.<br>
> > ><br>
> > > Signed-off-by: Derek Foreman <<a href="mailto:derekf@osg.samsung.com">derekf@osg.samsung.com</a>><br>
> ><br>
> > Reviewed-by: Jonas Ådahl <<a href="mailto:jadahl@gmail.com">jadahl@gmail.com</a>>, with a couple of comments<br>
> > below.<br>
><br>
> Reviewed-by: Pekka Paalanen <<a href="mailto:pekka.paalanen@collabora.co.uk">pekka.paalanen@collabora.co.uk</a>><br>
><br>
> ...<br>
><br>
> > > ---<br>
> > ><br>
> > > Changes from v3:<br>
> > > replaced the last paragraph with Pekka's version<br>
> > > (with one tiny grammar change)<br>
> > ><br>
> > > protocol/wayland.xml | 49 +++++++++++++++++++++++++++++++++++++++++++++++--<br>
> > > 1 file changed, 47 insertions(+), 2 deletions(-)<br>
> > ><br>
> > > diff --git a/protocol/wayland.xml b/protocol/wayland.xml<br>
> > > index f9e6d76..4e97bb9 100644<br>
> > > --- a/protocol/wayland.xml<br>
> > > +++ b/protocol/wayland.xml<br>
> > > @@ -176,7 +176,7 @@<br>
> > > </event><br>
> > > </interface><br>
> > ><br>
> > > - <interface name="wl_compositor" version="3"><br>
> > > + <interface name="wl_compositor" version="4"><br>
> > > <description summary="the compositor singleton"><br>
> > > A compositor. This object is a singleton global. The<br>
> > > compositor is in charge of combining the contents of multiple<br>
> > > @@ -986,7 +986,7 @@<br>
> > > </event><br>
> > > </interface><br>
> > ><br>
> > > - <interface name="wl_surface" version="3"><br>
> > > + <interface name="wl_surface" version="4"><br>
> > > <description summary="an onscreen surface"><br>
> > > A surface is a rectangular area that is displayed on the screen.<br>
> > > It has a location, size and pixel contents.<br>
> > > @@ -1109,6 +1109,10 @@<br>
> > > wl_surface.commit assigns pending damage as the current damage,<br>
> > > and clears pending damage. The server will clear the current<br>
> > > damage as it repaints the surface.<br>
> > > +<br>
> > > + Alternatively, damage can be posted with wl_surface.damage_buffer<br>
> > > + which uses buffer co-ordinates instead of surface co-ordinates,<br>
> > > + and is probably the preferred and intuitive way of doing this.<br>
> > > </description><br>
> > ><br>
> > > <arg name="x" type="int"/><br>
> > > @@ -1325,6 +1329,47 @@<br>
> > > </description><br>
> > > <arg name="scale" type="int"/><br>
> > > </request><br>
> > > +<br>
> > > + <!-- Version 4 additions --><br>
> ><br>
> > Bikeshed mode enabled: missing empty line between "Version N additions"<br>
> > and actual additions.<br>
> ><br>
> > > + <request name="damage_buffer" since="4"><br>
> > > + <description summary="mark part of the surface damaged using buffer co-ordinates"><br>
> > > + This request is used to describe the regions where the pending<br>
> > > + buffer is different from the current surface contents, and where<br>
> > > + the surface therefore needs to be repainted. The compositor<br>
> > > + ignores the parts of the damage that fall outside of the surface.<br>
> > > +<br>
> > > + Damage is double-buffered state, see wl_surface.commit.<br>
> > > +<br>
> > > + The damage rectangle is specified in buffer coordinates.<br>
> > > +<br>
> > > + The initial value for pending damage is empty: no damage.<br>
> > > + wl_surface.damage_buffer adds pending damage: the new pending<br>
> > > + damage is the union of old pending damage and the given rectangle.<br>
> > > +<br>
> > > + wl_surface.commit assigns pending damage as the current damage,<br>
> > > + and clears pending damage. The server will clear the current<br>
> > > + damage as it repaints the surface.<br>
> > > +<br>
> > > + This request differs from wl_surface.damage in only one way - it<br>
> > > + takes damage in buffer co-ordinates instead of surface local<br>
> > > + co-ordinates. While this generally is more intuitive than surface<br>
> > > + co-ordinates, it is especially desirable when using wp_viewport<br>
> > > + or when a drawing library (like EGL) is unaware of buffer scale<br>
> > > + and buffer transform.<br>
> > > +<br>
> > > + Since it is impossible to convert between buffer and surface<br>
> > > + co-ordinates until all the possible parameters affecting the<br>
> > > + surface size and the buffer-surface mapping are known at<br>
> > > + wl_surface.commit time, damage from wl_surface.damage and<br>
> > > + wl_surface.damage_buffer must be accumulated separately in a<br>
> > > + compositor and combined during wl_surface.commit at the earliest.<br>
> ><br>
> > As Jason already pointed out, this looks out of place. With some<br>
> > imagination, it might also not entirely true. A compositor may put<br>
> > damage "together" in a single list, with "transform this way" flags next<br>
> > to regions in different coordinate spaces, and then later process and<br>
> > combine at commit when all information is available. Sure, it makes<br>
> > little sense to do things this way, but it wouldn't be wrong while<br>
> > still, depending on how interpreted, not really doing what the above<br>
> > paragraph said.<br>
><br>
> Yeah. It's implementation guideline for compositor writers. Maybe it<br>
> should have started by stating that, so that client writers don't get<br>
> confused.<br>
><br>
> I suppose we all agree that in lack of better wording for the moment,<br>
> this is good to land. If someone comes up with a better wording, we can<br>
> patch that later.</p>
<p dir="ltr">How about something like this:</p>
<p dir="ltr">Note: Because buffer transformation changes and damage requests may be interleaved in the protocol stream, It is impossible to determine the actual mapping between surface and buffer damage until wl_surface.commit time. Therefore, compositors wishing to take both kinds of damage into account will have to accumulate damage from the two requests separately and only transform from one to the other after receiving the wl_surface.attach.</p>
<p dir="ltr">That says more or less the same thing but puts the focus on the protocol rather than implantation. It also leaves open the possibility of different compositor implementations that don't bother trying to combine the two.</p>
<p dir="ltr">--Jason</p>
<p dir="ltr">> I restored a couple of CCs, and since 26th was thanksgiving in the US,<br>
> maybe this should land early next week if no-one objects.<br>
><br>
><br>
> Thanks,<br>
> pq<br>
><br>
> > > + </description><br>
> > > +<br>
> > > + <arg name="x" type="int"/><br>
> > > + <arg name="y" type="int"/><br>
> > > + <arg name="width" type="int"/><br>
> > > + <arg name="height" type="int"/><br>
> > > + </request><br>
> > > </interface><br>
> > ><br>
> > > <interface name="wl_seat" version="5"><br>
> > > --<br>
> > > 2.6.2<br>
> > ><br>
> > > _______________________________________________<br>
> > > wayland-devel mailing list<br>
> > ><a href="mailto:wayland-devel@lists.freedesktop.org"> wayland-devel@lists.freedesktop.org</a><br>
> > ><a href="http://lists.freedesktop.org/mailman/listinfo/wayland-devel"> http://lists.freedesktop.org/mailman/listinfo/wayland-devel</a><br>
><br>
</p>