[PATCH 09/11] modesetting: Implement PRIME syncing as a sink

Michel Dänzer michel at daenzer.net
Thu Nov 26 17:33:34 PST 2015


On 26.11.2015 11:39, Alex Goins wrote:
> 
> +        /* Safe to present on backTarget, no longer displayed */
> +        if (master->PresentTrackedFlippingPixmap(args->backTarget)) {
> +            /* Queue flip to back target */
> +            drmmode_SharedPixmapFlip(args->backTarget, args->frontTarget,
> +                                     args->crtc, args->drmmode, FALSE);
> +        } else {
> +            /* Failed to present, try again on next vblank */
> +            drmmode_SharedPixmapFlip(args->frontTarget, args->backTarget,
> +                                     args->crtc, args->drmmode, TRUE);
> +        }

Always scheduling an event for the next vblank means that the vblank
interrupt can never be disabled, right? Might be better to trigger the
next update when getting new damage if there's currently none.


> +    if (!noflip &&
> +        drmModePageFlip(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id,
> +                        ppriv_front->fb_id, DRM_MODE_PAGE_FLIP_EVENT,
> +                        (void *)(intptr_t) ppriv_front->flipSeq) >= 0) {
> +        return TRUE;
> +    }
> +
> +    /* Didn't actually flip, just wait for vblank instead */
> +    {
> +        drmVBlank vbl;
> +
> +        vbl.request.type =
> +            DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT | drmmode_crtc->vblank_pipe;
> +        vbl.request.sequence = 1;
> +        vbl.request.signal = (unsigned long) ppriv_front->flipSeq;
> +
> +        if (drmWaitVBlank(drmmode->fd, &vbl) >= 0)
> +            return TRUE;
> +    }

In the !noflip case (BTW, double negatives are kind of bad), silently
falling back from drmModePageFlip failure to drmWaitVBlank could result
in a frozen display with no indication what's wrong, couldn't it?


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


More information about the xorg-devel mailing list