<p dir="ltr"><br>
On Nov 13, 2015 10:43 AM, "Derek Foreman" <<a href="mailto:derekf@osg.samsung.com">derekf@osg.samsung.com</a>> wrote:<br>
><br>
> On 13/11/15 02:03 AM, Pekka Paalanen wrote:<br>
> > On Thu, 12 Nov 2015 13:48:10 -0600<br>
> > Derek Foreman <<a href="mailto:derekf@osg.samsung.com">derekf@osg.samsung.com</a>> wrote:<br>
> ><br>
> >> On 12/11/15 01:27 PM, Jason Ekstrand wrote:<br>
> >>> Thanks for picking this up! Also, thanks for posting this on the bug,<br>
> >>> I would have missed it otherwise!<br>
> >><br>
> >> Thanks to Pekka for prodding me to do so. :)<br>
> >><br>
> >>> On Thu, Nov 12, 2015 at 11:16 AM, Derek Foreman <<a href="mailto:derekf@osg.samsung.com">derekf@osg.samsung.com</a>> wrote:<br>
> >>>> On 09/11/15 09:06 AM, Pekka Paalanen wrote:<br>
> >>>>> On Fri, 6 Nov 2015 12:55:19 -0600<br>
> >>>>> Derek Foreman <<a href="mailto:derekf@osg.samsung.com">derekf@osg.samsung.com</a>> wrote:<br>
> >>>>><br>
><br>
> <elided some context><br>
><br>
> >>>>>> + Mixing wl_surface.buffer_damage and wl_surface.damage requests<br>
> >>>>>> + on the same surface will result in undefined behaviour.<br>
> >>>>><br>
> >>>>> Why undefined? The compositor will always transform between surface and<br>
> >>>>> buffer coordinate systems: surface to buffer for texture updates, and<br>
> >>>>> buffer to surface for repaint damage.<br>
> >>>>><br>
> >>>>> I suppose you can avoid accumulating two different regions depending on<br>
> >>>>> the coordinate space until wl_surface.commit by saying only one<br>
> >>>>> coordinate space is guaranteed to work at a time. Is that reason<br>
> >>>>> enough, or the only reason?<br>
> >>>><br>
> >>>> Just lazy. I don't want to care about it or have to test it. Saying<br>
> >>>> not to mix them within a commit is just fine too, I think.<br>
> >>>><br>
> >>>> Realistically, I can't imagine anyone wanting to do this in the first<br>
> >>>> place, so I didn't see much point in spending any time verifying the two<br>
> >>>> requests worked well together.<br>
> >>>><br>
> >>>> I suppose it'd be possible to slaughter clients trying to mix them -<br>
> >>>> would that be preferably to undefined?<br>
> >>><br>
> >>> We could say that it's the union of the two but I kind of like "don't<br>
> >>> do this" better.<br>
> ><br>
> > Don't do this indeed, but should it be a fatal error, or just<br>
> > undefined? Or defined as whole-surface damage? :-)<br>
> ><br>
> > I have hard time making my mind. If it's not a fatal error, I am sure<br>
> > someone will do it even if by accident. When someone does it, I'd<br>
> > expect the undefined behaviour to be practically damaging the whole<br>
> > surface, so you wouldn't easily notice it.<br>
> ><br>
> > So... for the sake of forcing programs to be more correct, make it a<br>
> > fatal error? In which case we need a new error code in wl_surface.<br>
><br>
> Interesting problem just occurred to me... I don't think just not<br>
> mixing damage/buffer_damage within a commit is good enough.<br>
><br>
> What if a client commits faster than the screen refresh rate? Then<br>
> we're expected to accumulate the damage inside the compositor, right?<br>
><br>
> So a client could use damage exclusively in one commit, damage_buffer<br>
> exclusively in another, and the compositor still has to mix the result...<br>
><br>
> Is it too heavy handed to allow the first damage/damage_buffer to set<br>
> what must be used on the surface for its lifetime?</p>
<p dir="ltr">I think it's better to just let the client damage however it wants and highly recommend they pick one and stick with it. It's perfectly well-defined to damage in both and trying to come up with a precise condition for a protocol error is, as you pointed out, rather difficult. The only sane condition I can think of is "don't use both in the same commit" but, as you pointed out, that doesn't actually help the compositor. Compositors that don't want to deal with it can just stomp to full damage as soon as things get complicated.<br>
--Jason<br>
</p>