[PATCH 2/3] present: When cancelling a pending synchronous flip, requeue it
Michel Dänzer
michel at daenzer.net
Thu Nov 19 01:20:08 PST 2015
On 08.02.2015 18:47, Chris Wilson wrote:
> The vblank event request for a synchronous flip is scheduled for the
> vblank before the target flip msc (so that the flip itself appears at
> the right frame). If we cancel that flip and so wish to schedule a
> copy instead, that copy needs to be postponed by a frame in order for it
> be performed at the requested time.
>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> ---
> present/present.c | 16 +++++++++++++++-
> present/present_priv.h | 1 +
> 2 files changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/present/present.c b/present/present.c
> index ce978f4..a53dc11 100644
> --- a/present/present.c
> +++ b/present/present.c
> @@ -549,8 +549,13 @@ present_check_flip_window (WindowPtr window)
>
> /* Now check any queued vblanks */
> xorg_list_for_each_entry(vblank, &window_priv->vblank, window_list) {
> - if (vblank->queued && vblank->flip && !present_check_flip(vblank->crtc, window, vblank->pixmap, vblank->sync_flip, NULL, 0, 0))
> + if (vblank->queued && vblank->flip && !present_check_flip(vblank->crtc, window, vblank->pixmap, vblank->sync_flip, NULL, 0, 0)) {
> vblank->flip = FALSE;
> + if (vblank->sync_flip) {
> + vblank->requeue = TRUE;
> + vblank->target_msc++;
> + }
> + }
> }
> }
>
> @@ -585,6 +590,15 @@ present_execute(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc)
> present_screen_priv_ptr screen_priv = present_screen_priv(screen);
> uint8_t mode;
>
> + if (vblank->requeue) {
> + vblank->requeue = FALSE;
> + if (Success == present_queue_vblank(screen,
> + vblank->crtc,
> + vblank->event_id,
> + vblank->target_msc))
> + return;
> + }
> +
> if (vblank->wait_fence) {
> if (!present_fence_check_triggered(vblank->wait_fence)) {
> present_fence_set_callback(vblank->wait_fence, present_wait_fence_triggered, vblank);
> diff --git a/present/present_priv.h b/present/present_priv.h
> index 110c925..7db4321 100644
> --- a/present/present_priv.h
> +++ b/present/present_priv.h
> @@ -70,6 +70,7 @@ struct present_vblank {
> present_notify_ptr notifies;
> int num_notifies;
> Bool queued; /* on present_exec_queue */
> + Bool requeue; /* on queue, but target_msc has changed */
> Bool flip; /* planning on using flip */
> Bool flip_ready; /* wants to flip, but waiting for previous flip or unflip */
> Bool sync_flip; /* do flip synchronous to vblank */
>
Reviewed-by: Michel Dänzer <michel.daenzer at amd.com>
--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer
More information about the xorg-devel
mailing list