[PATCH 2/3] present: Query the Window's CRTC every time

Michel Dänzer michel at daenzer.net
Thu May 28 02:27:34 PDT 2015


On 28.05.2015 18:07, Chris Wilson wrote:
> On Thu, May 28, 2015 at 05:56:15PM +0900, Michel Dänzer wrote:
>> On 28.05.2015 17:38, Chris Wilson wrote:
>>> On Thu, May 28, 2015 at 04:59:14PM +0900, Michel Dänzer wrote:
>>>> The patch below is an alternative fix for the problem I'm seeing, while
>>>> preserving the window CRTC for MSC waits when possible. Your
>>>> description sounds like it might work for you as well, Chris. Can you
>>>> try it?
>>>>
>>>>
>>>> diff --git a/present/present.c b/present/present.c
>>>> index a634601..dc58f25 100644
>>>> --- a/present/present.c
>>>> +++ b/present/present.c
>>>> @@ -713,6 +713,7 @@ present_pixmap(WindowPtr window,
>>>>      uint64_t                    ust;
>>>>      uint64_t                    target_msc;
>>>>      uint64_t                    crtc_msc;
>>>> +    RRCrtcPtr                   new_crtc;
>>>>      int                         ret;
>>>>      present_vblank_ptr          vblank, tmp;
>>>>      ScreenPtr                   screen = window->drawable.pScreen;
>>>> @@ -734,7 +735,21 @@ present_pixmap(WindowPtr window,
>>>>              target_crtc = present_get_crtc(window);
>>>>      }
>>>>
>>>> -    present_get_ust_msc(screen, target_crtc, &ust, &crtc_msc);
>>>> +    if (present_get_ust_msc(screen, target_crtc, &ust, &crtc_msc) != Success) {
>>>> +        /* Maybe we need to try a different CRTC?
>>>> +         */
>>>> +        new_crtc = present_get_crtc(window);
>>>> +
>>>> +        if (new_crtc != target_crtc &&
>>>> +            present_get_ust_msc(screen, new_crtc, &ust, &crtc_msc) == Success)
>>>> +            target_crtc = new_crtc;
>>>> +        else {
>>>> +            /* Fall back to fake MSC handling
>>>> +             */
>>>> +            target_crtc = NULL;
>>>> +            present_fake_get_ust_msc(screen, &ust, &crtc_msc);
>>>> +        }
>>>> +    }
>>>
>>> It survived for one more CRTC change, but still feeds passed msc into
>>> the wait_vblank.
>>
>> By how much is it off? Does it cause a hang?
> 
> Just a few -1000 msc, which is a pretty long wait (it would be if we
> honoured it at least).

The kernel should immediately return / send the event in that case.


>> What's your test-case? Mine is the GNOME lock screen, i.e. basically
>> DPMS off vs vblank waits and flips.
> 
> xf86-video-intel/test/present-test

Thanks, I'll take a look at that when I get a chance.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer


More information about the xorg-devel mailing list