[PATCH xserver 3/6] modesetting: add DRI2 page flip support

Michel Dänzer michel at daenzer.net
Thu Aug 18 08:12:41 UTC 2016


On 17/08/16 07:29 PM, Qiang Yu wrote:
> 
> +static void
> +ms_dri2_flip_free(struct ms_crtc_pageflip *flip)
> +{
> +    struct ms_flipdata *flipdata = flip->flipdata;
> +
> +    free(flip);
> +    if (--flipdata->flip_count > 0)
> +        return;
> +    free(flipdata);
> +}
> +
> +static void
> +ms_dri2_flip_abort(void *data)
> +{
> +    struct ms_crtc_pageflip *flip = data;
> +    struct ms_flipdata *flipdata = flip->flipdata;
> +
> +    if (flipdata->flip_count == 1)
> +        free(flipdata->event);

This should be moved to ms_dri2_flip_free, or flipdata->event will be
leaked for successful flips?


> +static Bool
> +can_exchange(ScrnInfoPtr scrn, DrawablePtr draw,
> +	     DRI2BufferPtr front, DRI2BufferPtr back)
> +{

[...]

> +    if (!update_front(draw, front))
> +        return FALSE;

I know you just copied this from -ati/amdgpu, but: I don't think
can_exchange should call update_front, or the front buffer may be
updated even though the flip later fails.


> +    /* Post damage on the front buffer so that listeners, such
> +     * as DisplayLink know take a copy and shove it over the USB.
> +     * also for sw cursors.
> +     */

SW cursors cannot work correctly with page flipping. For that reason,
xf86-video-ati/amdgpu disable page flipping while there's an SW cursor.


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


More information about the amd-gfx mailing list