mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: Javier Martinez Canillas <javierm@redhat.com>,
	linux-kernel@vger.kernel.org
Cc: Daniel Vetter <daniel@ffwll.ch>, David Airlie <airlied@linux.ie>,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/simpledrm: Drop superfluous primary plane .atomic_check return logic
Date: Mon, 5 Sep 2022 12:57:58 +0200	[thread overview]
Message-ID: <43e3dead-6089-c342-5050-34d7325bcb24@suse.de> (raw)
In-Reply-To: <20220831111243.1530620-1-javierm@redhat.com>


[-- Attachment #1.1: Type: text/plain, Size: 2488 bytes --]

Hi Javier

Am 31.08.22 um 13:12 schrieb Javier Martinez Canillas:
> The simpledrm_primary_plane_helper_atomic_check() function is more complex
> than needed. It first checks drm_atomic_helper_check_plane_state() returns
> value to decide whether to return this or zero.
> 
> But it could just return that function return value directly. It also does
> a check if new_plane_state->visible isn't set, but returns zero regardless.
> 
> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
> ---
> 
>   drivers/gpu/drm/tiny/simpledrm.c | 15 ++++-----------
>   1 file changed, 4 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/tiny/simpledrm.c b/drivers/gpu/drm/tiny/simpledrm.c
> index a81f91814595..0be47f40247a 100644
> --- a/drivers/gpu/drm/tiny/simpledrm.c
> +++ b/drivers/gpu/drm/tiny/simpledrm.c
> @@ -485,21 +485,14 @@ static int simpledrm_primary_plane_helper_atomic_check(struct drm_plane *plane,
>   	struct drm_plane_state *new_plane_state = drm_atomic_get_new_plane_state(new_state, plane);
>   	struct drm_crtc *new_crtc = new_plane_state->crtc;
>   	struct drm_crtc_state *new_crtc_state = NULL;
> -	int ret;
>   
>   	if (new_crtc)
>   		new_crtc_state = drm_atomic_get_new_crtc_state(new_state, new_crtc);
>   
> -	ret = drm_atomic_helper_check_plane_state(new_plane_state, new_crtc_state,
> -						  DRM_PLANE_NO_SCALING,
> -						  DRM_PLANE_NO_SCALING,
> -						  false, false);
> -	if (ret)
> -		return ret;
> -	else if (!new_plane_state->visible)
> -		return 0;
> -
> -	return 0;
> +	return drm_atomic_helper_check_plane_state(new_plane_state, new_crtc_state,
> +						   DRM_PLANE_NO_SCALING,
> +						   DRM_PLANE_NO_SCALING,
> +						   false, false);

I'm undecided on this change. I know it's correct and more to the point. 
But the call's logic is non-intuitive: the call either returns an error 
or we have to test ->visible afterwards. So I wrote it explicitly.

I saw that your change to ssd130x also uses the pattern. If we find more 
such drivers, we could implement the atomic check as a helper. I suggest 
drm_plane_helper_atomic_check_fixed() in drm_plane_helper.c

Best regards
Thomas

>   }
>   
>   static void simpledrm_primary_plane_helper_atomic_update(struct drm_plane *plane,

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

  reply	other threads:[~2022-09-05 10:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-31 11:12 Javier Martinez Canillas
2022-09-05 10:57 ` Thomas Zimmermann [this message]
2022-09-05 11:06   ` Javier Martinez Canillas
2022-09-05 11:37     ` Thomas Zimmermann
2022-09-05 11:45       ` Javier Martinez Canillas

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=43e3dead-6089-c342-5050-34d7325bcb24@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=javierm@redhat.com \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®