[PATCH v3 xserver 4/4] modesetting: add DRI2 page flip support

Daniel Martin consume.noise at gmail.com
Mon Aug 22 06:30:04 UTC 2016


Hi,

On 22 August 2016 at 05:53, Qiang Yu <Qiang.Yu at amd.com> wrote:
> Signed-off-by: Qiang Yu <Qiang.Yu at amd.com>
> ---
>  hw/xfree86/drivers/modesetting/dri2.c            | 237 ++++++++++++++++++++++-
>  hw/xfree86/drivers/modesetting/driver.h          |   5 +-
>  hw/xfree86/drivers/modesetting/drmmode_display.h |   3 +
>  hw/xfree86/drivers/modesetting/pageflip.c        |   7 +-
>  hw/xfree86/drivers/modesetting/present.c         |  20 +-
>  5 files changed, 257 insertions(+), 15 deletions(-)
>
> diff --git a/hw/xfree86/drivers/modesetting/dri2.c b/hw/xfree86/drivers/modesetting/dri2.c
> index 83cb3e0..125c413 100644
> --- a/hw/xfree86/drivers/modesetting/dri2.c
> +++ b/hw/xfree86/drivers/modesetting/dri2.c
...
> +static void
> +ms_dri2_exchange_buffers(DrawablePtr draw, DRI2BufferPtr front,
> +                         DRI2BufferPtr back)
> +{
> +    ms_dri2_buffer_private_ptr front_priv = front->driverPrivate;
> +    ms_dri2_buffer_private_ptr back_priv = back->driverPrivate;
> +    ScreenPtr screen = draw->pScreen;
> +    ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
> +    modesettingPtr ms = modesettingPTR(scrn);
> +    msPixmapPrivPtr front_pix = msGetPixmapPriv(&ms->drmmode, front_priv->pixmap);
> +    msPixmapPrivPtr back_pix = msGetPixmapPriv(&ms->drmmode, back_priv->pixmap);
> +    msPixmapPrivRec tmp_pix;
> +    RegionRec region;
> +    int tmp;
> +
> +    /* Swap BO names so DRI works */
> +    tmp = front->name;
> +    front->name = back->name;
> +    back->name = tmp;
> +
> +    /* Swap pixmap privates */
> +    tmp_pix = *front_pix;
> +    *front_pix = *back_pix;
> +    *back_pix = tmp_pix;
> +
> +    glamor_egl_exchange_buffers(front_priv->pixmap, back_priv->pixmap);
> +
> +    /* Post damage on the front buffer so that listeners, such
> +     * as DisplayLink know take a copy and shove it over the USB.
> +     */
> +    region.extents.x1 = region.extents.y1 = 0;
> +    region.extents.x2 = front_priv->pixmap->drawable.width;
> +    region.extents.y2 = front_priv->pixmap->drawable.width;

this looks like a copy'n'paste mistake.

> +    region.data = NULL;
> +    DamageRegionAppend(&front_priv->pixmap->drawable, &region);
> +    DamageRegionProcessPending(&front_priv->pixmap->drawable);
> +}
> +
>  static void
>  ms_dri2_frame_event_handler(uint64_t msc,
>                              uint64_t usec,

Cheers,
    Daniel Martin


More information about the xorg-devel mailing list