[PATCH] present: Fix Async swap logic

Axel Davy axel.davy at ens.fr
Tue Nov 3 23:45:59 PST 2015


On 04/11/2015 08:26, Axel Davy wrote:
> On 04/11/2015 04:17, Michel Dänzer wrote:
>> On 03.11.2015 17:14, Axel Davy wrote:
>>
>>
>>> +        } else if (target_msc == crtc_msc &&
>>> +            (options & PresentOptionAsync) &&
>>> +            (screen_priv->info->capabilities & 
>>> PresentCapabilityAsync) &&
>>> +            present_check_flip (target_crtc, window, pixmap, FALSE, 
>>> valid, x_off, y_off))
>>> +        {
>>> +          vblank->flip = TRUE;
>>> +        }
>> Why only take this case if target_msc == crtc_msc?
> At this point of the code, when we have (option & PresentOptionAsync), 
> target_msc >= crtc_msc
>
> If target_msc > crtc_msc, then we want to use a sync flip (An async 
> flip can cause tears),
> and we use the previous if statement.
> But in the case target_msc == crtc_msc, we want to copy immediately 
> (via an async flip, or a copy).
>
> I realize that the "(option & PresentOptionAsync)" part of the check 
> is unneccessary.
>
I guess in the case the driver has disabled sync swaps, we want to use 
async swaps instead of copies.
Thus the target_msc == crtc_msc can be replaced by target_msc >= 
crtc_msc (always true)

in that case the if check becomes:

else if ((screen_priv->info->capabilities & PresentCapabilityAsync) &&
             present_check_flip (target_crtc, window, pixmap, FALSE, 
valid, x_off, y_off)

Yours,

Axel


More information about the xorg-devel mailing list