public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Paul Cercueil <paul@crapouillou.net>
Cc: David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
	"H . Nikolaus Schaller" <hns@goldelico.com>,
	Paul Boddie <paul@boddie.org.uk>,
	list@opendingux.net, Sam Ravnborg <sam@ravnborg.org>,
	linux-mips@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/8] drm/ingenic: Use standard drm_atomic_helper_commit_tail
Date: Tue, 10 Aug 2021 12:20:38 +0200	[thread overview]
Message-ID: <YRJS9kZt5jUe5Z3r@phenom.ffwll.local> (raw)
In-Reply-To: <20210808134526.119198-4-paul@crapouillou.net>

On Sun, Aug 08, 2021 at 03:45:21PM +0200, Paul Cercueil wrote:
> By making the CRTC's .vblank_enable() function return an error when it
> is known that the hardware won't deliver a VBLANK, we can drop the
> ingenic_drm_atomic_helper_commit_tail() function and use the standard
> drm_atomic_helper_commit_tail() function instead.
> 
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
>  drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 28 ++++-------------------
>  1 file changed, 4 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> index bc71ba44ccf4..3ed7c27a8dde 100644
> --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> @@ -706,29 +706,6 @@ static int ingenic_drm_encoder_atomic_check(struct drm_encoder *encoder,
>  	}
>  }
>  
> -static void ingenic_drm_atomic_helper_commit_tail(struct drm_atomic_state *old_state)
> -{
> -	/*
> -	 * Just your regular drm_atomic_helper_commit_tail(), but only calls
> -	 * drm_atomic_helper_wait_for_vblanks() if priv->no_vblank.
> -	 */
> -	struct drm_device *dev = old_state->dev;
> -	struct ingenic_drm *priv = drm_device_get_priv(dev);
> -
> -	drm_atomic_helper_commit_modeset_disables(dev, old_state);
> -
> -	drm_atomic_helper_commit_planes(dev, old_state, 0);
> -
> -	drm_atomic_helper_commit_modeset_enables(dev, old_state);
> -
> -	drm_atomic_helper_commit_hw_done(old_state);
> -
> -	if (!priv->no_vblank)
> -		drm_atomic_helper_wait_for_vblanks(dev, old_state);
> -
> -	drm_atomic_helper_cleanup_planes(dev, old_state);
> -}
> -
>  static irqreturn_t ingenic_drm_irq_handler(int irq, void *arg)
>  {
>  	struct ingenic_drm *priv = drm_device_get_priv(arg);
> @@ -749,6 +726,9 @@ static int ingenic_drm_enable_vblank(struct drm_crtc *crtc)
>  {
>  	struct ingenic_drm *priv = drm_crtc_get_priv(crtc);
>  
> +	if (priv->no_vblank)
> +		return -EWOULDBLOCK;

I think other drivers return EINVAL here. I'm not sure exactly this is
specified, but the errno here is visible to userspace.

Maybe would be good to update the kerneldoc for this hook?

Anyway this is great, with the errno fixed:

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> +
>  	regmap_update_bits(priv->map, JZ_REG_LCD_CTRL,
>  			   JZ_LCD_CTRL_EOF_IRQ, JZ_LCD_CTRL_EOF_IRQ);
>  
> @@ -856,7 +836,7 @@ static const struct drm_mode_config_funcs ingenic_drm_mode_config_funcs = {
>  };
>  
>  static struct drm_mode_config_helper_funcs ingenic_drm_mode_config_helpers = {
> -	.atomic_commit_tail = ingenic_drm_atomic_helper_commit_tail,
> +	.atomic_commit_tail = drm_atomic_helper_commit_tail,
>  };
>  
>  static void ingenic_drm_unbind_all(void *d)
> -- 
> 2.30.2
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

  parent reply	other threads:[~2021-08-10 10:20 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-08 13:45 [PATCH 0/8] gpu/drm: ingenic-drm: Various improvements Paul Cercueil
2021-08-08 13:45 ` [PATCH 1/8] drm/ingenic: Remove dead code Paul Cercueil
2021-08-08 17:58   ` Thomas Zimmermann
2021-08-08 18:27     ` Joe Perches
2021-08-08 18:33       ` Paul Cercueil
2021-08-08 13:45 ` [PATCH 2/8] drm/ingenic: Simplify code by using hwdescs array Paul Cercueil
2021-08-08 18:42   ` Thomas Zimmermann
2021-08-08 22:22     ` Paul Cercueil
2021-08-08 13:45 ` [PATCH 3/8] drm/ingenic: Use standard drm_atomic_helper_commit_tail Paul Cercueil
2021-08-08 19:50   ` Christophe JAILLET
2021-08-08 20:09     ` Paul Cercueil
2021-08-08 20:15       ` Christophe JAILLET
2021-08-10 10:20   ` Daniel Vetter [this message]
2021-08-10 10:46     ` Paul Cercueil
2021-08-08 13:45 ` [PATCH 4/8] drm/ingenic: Add support for private objects Paul Cercueil
2021-08-08 13:45 ` [PATCH 5/8] drm/ingenic: Move IPU scale settings to private state Paul Cercueil
2021-08-08 13:45 ` [PATCH 6/8] drm/ingenic: Set DMA descriptor chain register when starting CRTC Paul Cercueil
2021-08-08 13:45 ` [PATCH 7/8] drm/ingenic: Upload palette before frame Paul Cercueil
2021-08-08 13:45 ` [PATCH 8/8] drm/ingenic: Attach bridge chain to encoders Paul Cercueil
2021-08-08 18:57   ` H. Nikolaus Schaller
2021-08-08 19:04     ` Paul Cercueil
2021-08-08 19:06       ` H. Nikolaus Schaller
2021-08-08 19:12         ` H. Nikolaus Schaller
2021-08-09 11:14           ` [Letux-kernel] " H. Nikolaus Schaller
2021-08-09 16:22             ` Paul Cercueil
2021-08-09 23:17               ` Paul Boddie
2021-08-10  7:52                 ` Paul Cercueil
2021-08-10 21:15                   ` Paul Boddie
2021-08-10 21:54                     ` Paul Cercueil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YRJS9kZt5jUe5Z3r@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hns@goldelico.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=list@opendingux.net \
    --cc=paul@boddie.org.uk \
    --cc=paul@crapouillou.net \
    --cc=sam@ravnborg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox