Re: [PATCH 06/10] drm/msm: add kms->flush_commit()

From: Sean Paul
Date: Tue Sep 03 2019 - 16:35:32 EST


On Thu, Aug 29, 2019 at 09:45:14AM -0700, Rob Clark wrote:
> From: Rob Clark <robdclark@xxxxxxxxxxxx>
>
> Add ->flush_commit(crtc_mask). Currently a no-op, but kms backends
> should migrate writing flush registers to this hook, so we can decouple
> pushing updates to hardware, and flushing the updates.
>
> Once we add async commit support, the hw updates will be pushed down to
> the hw synchronously, but flushing the updates will be deferred until as
> close to vblank as possible, so that multiple updates can be combined in
> a single frame.
>
> Signed-off-by: Rob Clark <robdclark@xxxxxxxxxxxx>
> ---
> drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 6 ++++
> drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c | 6 ++++
> drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 6 ++++
> drivers/gpu/drm/msm/msm_atomic.c | 9 ++++--
> drivers/gpu/drm/msm/msm_kms.h | 40 ++++++++++++++++++++++--
> 5 files changed, 63 insertions(+), 4 deletions(-)
>

/snip

> diff --git a/drivers/gpu/drm/msm/msm_kms.h b/drivers/gpu/drm/msm/msm_kms.h
> index 10dd171b43f8..bb70c1758c72 100644
> --- a/drivers/gpu/drm/msm/msm_kms.h
> +++ b/drivers/gpu/drm/msm/msm_kms.h
> @@ -30,12 +30,47 @@ struct msm_kms_funcs {
> irqreturn_t (*irq)(struct msm_kms *kms);
> int (*enable_vblank)(struct msm_kms *kms, struct drm_crtc *crtc);
> void (*disable_vblank)(struct msm_kms *kms, struct drm_crtc *crtc);
> - /* modeset, bracketing atomic_commit(): */
> +
> + /*
> + * Atomic commit handling:
> + */
> +
> + /**
> + * Prepare for atomic commit. This is called after any previous
> + * (async or otherwise) commit has completed.
> + */
> void (*prepare_commit)(struct msm_kms *kms, struct drm_atomic_state *state);
> +
> + /**
> + * Flush an atomic commit. This is called after the hardware
> + * updates have already been pushed down to effected planes/
> + * crtcs/encoders/connectors.
> + */
> + void (*flush_commit)(struct msm_kms *kms, unsigned crtc_mask);
> +
> + /* TODO remove ->commit(), use ->flush_commit() instead: */
> void (*commit)(struct msm_kms *kms, struct drm_atomic_state *state);
> - void (*complete_commit)(struct msm_kms *kms, unsigned crtc_mask);
> +
> + /**
> + * Wait for any in-progress flush to complete on the specified
> + * crtcs. This should not block if there is no in-progress
> + * commit (ie. don't just wait for a vblank), as it will also
> + * be called before ->prepare_commit() to ensure any potential
> + * "async" commit has completed.
> + */
> void (*wait_flush)(struct msm_kms *kms, unsigned crtc_mask);
>
> + /**
> + * Clean up are commit is completed. This is called after

s/are/our/?

With that fixed,

Reviewed-by: Sean Paul <sean@xxxxxxxxxx>



> + * ->wait_flush(), to give the backend a chance to do any
> + * post-commit cleanup.
> + */
> + void (*complete_commit)(struct msm_kms *kms, unsigned crtc_mask);
> +
> + /*
> + * Format handling:
> + */
> +
> /* get msm_format w/ optional format modifiers from drm_mode_fb_cmd2 */
> const struct msm_format *(*get_format)(struct msm_kms *kms,
> const uint32_t format,
> @@ -45,6 +80,7 @@ struct msm_kms_funcs {
> const struct msm_format *msm_fmt,
> const struct drm_mode_fb_cmd2 *cmd,
> struct drm_gem_object **bos);
> +
> /* misc: */
> long (*round_pixclk)(struct msm_kms *kms, unsigned long rate,
> struct drm_encoder *encoder);
> --
> 2.21.0
>

--
Sean Paul, Software Engineer, Google / Chromium OS