Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1687164

Re: [PATCH 4/4] drm/sun4i: make sure we don't have a commit pending

From Chen-Yu Tsai <wens@csie.org>
Newsgroups linux.kernel
Subject Re: [PATCH 4/4] drm/sun4i: make sure we don't have a commit pending
Date 2017-07-14 11:00 +0200
Message-ID <u34C6-Xc-13@gated-at.bofh.it> (permalink)
References <u2NBf-6SY-1@gated-at.bofh.it> <u2NBf-6SY-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi,

On Thu, Jul 13, 2017 at 10:41 PM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> In the earlier display engine designs, any register access while a commit
> is pending is forbidden.
>
> One of the symptoms is that reading a register will return another, random,
> register value which can lead to register corruptions if we ever do a
> read/modify/write cycle.

Alternatively, if changes to the backend (layers) are guaranteed to happen
while the CRTC is disabled (which seems to be the case after looking at
drm_atomic_helper_commit_planes and drm_atomic_helper_commit_tail), we
could just turn on register auto-commit all the time and not deal with
this.

ChenYu

>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> ---
>  drivers/gpu/drm/sun4i/sun4i_backend.c | 14 ++++++++++++++
>  drivers/gpu/drm/sun4i/sun4i_crtc.c    |  1 +
>  2 files changed, 15 insertions(+)
>
> diff --git a/drivers/gpu/drm/sun4i/sun4i_backend.c b/drivers/gpu/drm/sun4i/sun4i_backend.c
> index cf480218daa5..ce1f40f7511e 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_backend.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_backend.c
> @@ -67,6 +67,19 @@ static void sun4i_backend_commit(struct sunxi_engine *engine)
>                      SUN4I_BACKEND_REGBUFFCTL_LOADCTL);
>  }
>
> +static int sun4i_backend_commit_poll(struct sunxi_engine *engine)
> +{
> +       u32 val;
> +
> +       DRM_DEBUG_DRIVER("Polling for the commit to end\n");
> +
> +       return regmap_read_poll_timeout(engine->regs,
> +                                       SUN4I_BACKEND_REGBUFFCTL_REG,
> +                                       val,
> +                                       !(val & SUN4I_BACKEND_REGBUFFCTL_LOADCTL),
> +                                       100, 50000);
> +}
> +
>  void sun4i_backend_layer_enable(struct sun4i_backend *backend,
>                                 int layer, bool enable)
>  {
> @@ -330,6 +343,7 @@ static int sun4i_backend_of_get_id(struct device_node *node)
>
>  static const struct sunxi_engine_ops sun4i_backend_engine_ops = {
>         .commit                         = sun4i_backend_commit,
> +       .commit_poll                    = sun4i_backend_commit_poll,
>         .layers_init                    = sun4i_layers_init,
>         .apply_color_correction         = sun4i_backend_apply_color_correction,
>         .disable_color_correction       = sun4i_backend_disable_color_correction,
> diff --git a/drivers/gpu/drm/sun4i/sun4i_crtc.c b/drivers/gpu/drm/sun4i/sun4i_crtc.c
> index 2eba1d8639d8..31550493fa1d 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_crtc.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_crtc.c
> @@ -34,6 +34,7 @@ static void sun4i_crtc_atomic_begin(struct drm_crtc *crtc,
>                                     struct drm_crtc_state *old_state)
>  {
>         struct sun4i_crtc *scrtc = drm_crtc_to_sun4i_crtc(crtc);
> +       struct sunxi_engine *engine = scrtc->engine;
>         struct drm_device *dev = crtc->dev;
>         unsigned long flags;
>
> --
> git-series 0.9.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/4] drm/sun4i: Fix a register access bug Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-07-13 16:50 +0200
  [PATCH 4/4] drm/sun4i: make sure we don't have a commit pending Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-07-13 16:50 +0200
    Re: [PATCH 4/4] drm/sun4i: make sure we don't have a commit pending Chen-Yu Tsai <wens@csie.org> - 2017-07-14 11:00 +0200
      Re: [PATCH 4/4] drm/sun4i: make sure we don't have a commit pending Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-07-17 09:00 +0200
        Re: [PATCH 4/4] drm/sun4i: make sure we don't have a commit pending Chen-Yu Tsai <wens@csie.org> - 2017-07-17 09:00 +0200
          Re: [PATCH 4/4] drm/sun4i: make sure we don't have a commit pending Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-07-18 09:10 +0200
            Re: [PATCH 4/4] drm/sun4i: make sure we don't have a commit pending Daniel Vetter <daniel@ffwll.ch> - 2017-07-18 09:40 +0200
  [PATCH 3/4] drm/sun4i: engine: Add commit_poll function Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-07-13 16:50 +0200
  [PATCH 2/4] drm/sun4i: Use the runtime_pm commit_tail variant Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-07-13 16:50 +0200
  [PATCH 1/4] drm/atomic: implement drm_atomic_helper_commit_tail for runtime_pm users Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-07-13 16:50 +0200
    Re: [PATCH 1/4] drm/atomic: implement drm_atomic_helper_commit_tail  for runtime_pm users Daniel Vetter <daniel@ffwll.ch> - 2017-07-13 21:40 +0200
    Re: [PATCH 1/4] drm/atomic: implement drm_atomic_helper_commit_tail for runtime_pm users Laurent Pinchart <laurent.pinchart@ideasonboard.com> - 2017-07-14 01:50 +0200
      Re: [PATCH 1/4] drm/atomic: implement drm_atomic_helper_commit_tail  for runtime_pm users Daniel Vetter <daniel@ffwll.ch> - 2017-07-14 07:40 +0200
      Re: [PATCH 1/4] drm/atomic: implement drm_atomic_helper_commit_tail  for runtime_pm users Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-07-18 09:10 +0200

csiph-web