[PATCH 5/5] modesetting: Implement page flipping support for Present.

Michel Dänzer michel at daenzer.net
Thu Apr 30 20:34:01 PDT 2015


On 22.04.2015 09:58, Kenneth Graunke wrote:
> +/*
> + * Test to see if page flipping is possible on the target crtc
> + */
> +static Bool
> +ms_present_check_flip(RRCrtcPtr crtc,
> +                      WindowPtr window,
> +                      PixmapPtr pixmap,
> +                      Bool sync_flip)
> +{
> +    ScreenPtr screen = window->drawable.pScreen;
> +    ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
> +    modesettingPtr ms = modesettingPTR(scrn);
> +    xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
> +    int num_crtcs_on;
> +    int i;
> +
> +    if (!ms->drmmode.pageflip)
> +        return FALSE;
> +
> +    if (!scrn->vtSema)
> +        return FALSE;
> +
> +    for (i = 0; i < config->num_crtc; i++) {
> +        drmmode_crtc_private_ptr drmmode_crtc = config->crtc[i]->driver_private;
> +
> +        /* Don't do pageflipping if CRTCs are rotated. */
> +        if (drmmode_crtc->rotate_bo.gbm)
> +            return FALSE;
> +
> +        if (ms_crtc_on(config->crtc[i]))
> +            num_crtcs_on++;
> +    }
> +
> +    /* We can't do pageflipping if all the CRTCs are off. */
> +    if (num_crtcs_on == 0)
> +        return FALSE;
> +
> +    /* Check stride, can't change that on flip */
> +    if (pixmap->devKind != drmmode_bo_get_pitch(&ms->drmmode.front_bo))
> +        return FALSE;
> +
> +    /* Make sure there's a bo we can get to */
> +    /* XXX: actually do this.  also...is it sufficient?
> +     * if (!glamor_get_pixmap_private(pixmap))
> +     *     return FALSE;
> +     */
> +
> +    return TRUE;
> +}

num_crtcs_on is used uninitialized.


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


More information about the xorg-devel mailing list