[PATCH xf86-video-amdgpu 1/2] Add support for async flips to radeon_do_pageflip

Alex Deucher alexdeucher at gmail.com
Tue May 10 14:38:45 UTC 2016


On Tue, May 10, 2016 at 3:36 AM, Michel Dänzer <michel at daenzer.net> wrote:
> From: Michel Dänzer <michel.daenzer at amd.com>
>
> Will be used by the next change. No functional change here.
>
> (Ported from radeon commit 90a915c62d012e99193833aecc93974e68880c60)
>
> Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>

For the series:
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>


> ---
>  src/amdgpu_dri2.c     |  2 +-
>  src/amdgpu_present.c  |  5 +++--
>  src/drmmode_display.c |  9 +++++++--
>  src/drmmode_display.h | 10 +++++++++-
>  4 files changed, 20 insertions(+), 6 deletions(-)
>
> diff --git a/src/amdgpu_dri2.c b/src/amdgpu_dri2.c
> index 29f60ba..27a0c1a 100644
> --- a/src/amdgpu_dri2.c
> +++ b/src/amdgpu_dri2.c
> @@ -615,7 +615,7 @@ amdgpu_dri2_schedule_flip(xf86CrtcPtr crtc, ClientPtr client,
>                                AMDGPU_DRM_QUEUE_ID_DEFAULT, flip_info,
>                                ref_crtc_hw_id,
>                                amdgpu_dri2_flip_event_handler,
> -                              amdgpu_dri2_flip_event_abort)) {
> +                              amdgpu_dri2_flip_event_abort, FLIP_VSYNC)) {
>                 info->drmmode.dri2_flipping = TRUE;
>                 return TRUE;
>         }
> diff --git a/src/amdgpu_present.c b/src/amdgpu_present.c
> index 4aa0708..e39b2d2 100644
> --- a/src/amdgpu_present.c
> +++ b/src/amdgpu_present.c
> @@ -311,7 +311,8 @@ amdgpu_present_flip(RRCrtcPtr crtc, uint64_t event_id, uint64_t target_msc,
>         ret = amdgpu_do_pageflip(scrn, AMDGPU_DRM_QUEUE_CLIENT_DEFAULT,
>                                  pixmap, event_id, event, crtc_id,
>                                  amdgpu_present_flip_event,
> -                                amdgpu_present_flip_abort);
> +                                amdgpu_present_flip_abort,
> +                                FLIP_VSYNC);
>         if (!ret)
>                 xf86DrvMsg(scrn->scrnIndex, X_ERROR, "present flip failed\n");
>         else
> @@ -348,7 +349,7 @@ amdgpu_present_unflip(ScreenPtr screen, uint64_t event_id)
>
>         if (amdgpu_do_pageflip(scrn, AMDGPU_DRM_QUEUE_CLIENT_DEFAULT, pixmap,
>                                event_id, event, -1, amdgpu_present_flip_event,
> -                              amdgpu_present_flip_abort))
> +                              amdgpu_present_flip_abort, FLIP_VSYNC))
>                 return;
>
>  modeset:
> diff --git a/src/drmmode_display.c b/src/drmmode_display.c
> index 07ae9b2..64ee489 100644
> --- a/src/drmmode_display.c
> +++ b/src/drmmode_display.c
> @@ -2495,7 +2495,8 @@ void drmmode_uevent_fini(ScrnInfoPtr scrn, drmmode_ptr drmmode)
>  Bool amdgpu_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
>                         PixmapPtr new_front, uint64_t id, void *data,
>                         int ref_crtc_hw_id, amdgpu_drm_handler_proc handler,
> -                       amdgpu_drm_abort_proc abort)
> +                       amdgpu_drm_abort_proc abort,
> +                       enum drmmode_flip_sync flip_sync)
>  {
>         AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(scrn);
>         xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
> @@ -2503,6 +2504,7 @@ Bool amdgpu_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
>         drmmode_crtc_private_ptr drmmode_crtc = config->crtc[0]->driver_private;
>         drmmode_ptr drmmode = drmmode_crtc->drmmode;
>         int i;
> +       uint32_t flip_flags = DRM_MODE_PAGE_FLIP_EVENT;
>         drmmode_flipdata_ptr flipdata;
>         uintptr_t drm_queue_seq = 0;
>         uint32_t new_front_handle;
> @@ -2544,6 +2546,9 @@ Bool amdgpu_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
>         flipdata->handler = handler;
>         flipdata->abort = abort;
>
> +       if (flip_sync == FLIP_ASYNC)
> +               flip_flags |= DRM_MODE_PAGE_FLIP_ASYNC;
> +
>         for (i = 0; i < config->num_crtc; i++) {
>                 crtc = config->crtc[i];
>
> @@ -2570,7 +2575,7 @@ Bool amdgpu_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
>                 }
>
>                 if (drmModePageFlip(pAMDGPUEnt->fd, drmmode_crtc->mode_crtc->crtc_id,
> -                                   drmmode->fb_id, DRM_MODE_PAGE_FLIP_EVENT,
> +                                   drmmode->fb_id, flip_flags,
>                                     (void*)drm_queue_seq)) {
>                         xf86DrvMsg(scrn->scrnIndex, X_WARNING,
>                                    "flip queue failed: %s\n", strerror(errno));
> diff --git a/src/drmmode_display.h b/src/drmmode_display.h
> index 24d517d..617f2bc 100644
> --- a/src/drmmode_display.h
> +++ b/src/drmmode_display.h
> @@ -121,6 +121,13 @@ typedef struct {
>         int enc_clone_mask;
>  } drmmode_output_private_rec, *drmmode_output_private_ptr;
>
> +
> +enum drmmode_flip_sync {
> +    FLIP_VSYNC,
> +    FLIP_ASYNC,
> +};
> +
> +
>  extern Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp);
>  extern void drmmode_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode);
>  extern void drmmode_fini(ScrnInfoPtr pScrn, drmmode_ptr drmmode);
> @@ -144,7 +151,8 @@ extern int drmmode_get_pitch_align(ScrnInfoPtr scrn, int bpe);
>  Bool amdgpu_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
>                         PixmapPtr new_front, uint64_t id, void *data,
>                         int ref_crtc_hw_id, amdgpu_drm_handler_proc handler,
> -                       amdgpu_drm_abort_proc abort);
> +                       amdgpu_drm_abort_proc abort,
> +                       enum drmmode_flip_sync flip_sync);
>  int drmmode_crtc_get_ust_msc(xf86CrtcPtr crtc, CARD64 *ust, CARD64 *msc);
>  int drmmode_get_current_ust(int drm_fd, CARD64 * ust);
>
> --
> 2.8.1
>
> _______________________________________________
> xorg-driver-ati mailing list
> xorg-driver-ati at lists.x.org
> https://lists.x.org/mailman/listinfo/xorg-driver-ati


More information about the xorg-driver-ati mailing list