[cairo] [PATCH] [cairo-gl] Fix support for gl window surface resizes

Andrea Canciani ranma42 at gmail.com
Tue Jan 11 16:18:40 PST 2011


On Tue, Jan 11, 2011 at 10:23 PM, Alexandros Frantzis
<alexandros.frantzis at linaro.org> wrote:
> On Tue, Jan 11, 2011 at 08:43:51PM +0100, Andrea Canciani wrote:
>>
>> In d7bb8193385ac70c796f645175ddcdb1eeff7adf:
>> ...
>>         if (condition &&
>>             other_condition &&
>>             yet_another)
>>         {
>>             do_something ();
>>         }
>>
>> And note that this last example also shows a situation in which the
>> opening brace really needs to be on its own line. The following looks
>> awful:
>>
>>         if (condition &&
>>             other_condition &&
>>             yet_another) {      /* Yuck! */
>>             do_something ();
>>         }
>> ...
>> The old code and many other places in cairo-gl are not respecting the
>> CODING_STYLE, so fixing all of this might well go in a different commit,
>> but it's still worth knowing (you were adding a similar CODING_STYLE
>> break in 296dd046c36d7e969052e9d9e2c7e88e53db038c).
>>
>
> Hi Andrea!
>
> Thanks for pointing this out.
>
>> >
>> > git://git.linaro.org/people/afrantzis/cairo.git
>> >
>> > The only issue I see with this approach is the case the destination is
>> > set, it is resized UINT_MAX + 1 times (without any other surface being
>> > set as the destination in the meantime) and then set again. In this case
>> > the update will not be detected because the serial will have remained
>> > the same. Of course this is extremely unlikely to happen :)
>>
>> Wouldn't a boolean flag be sufficient to track if it needs updating
>> and solve the wraparound issue?
>>
>> The attachment contains a patch which should implement this idea.
>> I believe it is correct and equivalent to your code (except that it
>> ignores
>> noop set_size()'s and does not suffer from the wraparound issue).
>>
>> Andrea
>
> As Chris pointed out, a boolean flag (my first patch, similar to yours)
> is not sufficient because the surface may be the destination of multiple
> gl contexts. Using a boolean flag will cause an invalidation of only one
> of the contexts but not the rest.

Oops! You're right, I should have read the whole thread. Sorry about it.

>
> Another option (my second patch, branch 'gl-window-surface-resize') is
> to directly track the width/height of the current target to detect
> resizes.

I don't like the wraparound problem (although it won't trigger except in
very peculiar cases), because it makes the code broken "by design", but I
can't find any lightweight solution for it (well, nothing better than
directly tracking width/height in the context).

Maybe Bill can provide some additional details about what is the correct
way to have a serial without the wraparound issue.

Andrea


More information about the cairo mailing list