diff mbox series

[1/3] drm/simpledrm: Do not call drm_atomic_add_affected_planes()

Message ID 20221010170203.274949-2-javierm@redhat.com (mailing list archive)
State Superseded
Headers show
Series Add a drm_crtc_helper_atomic_check() helper | expand

Commit Message

Javier Martinez Canillas Oct. 10, 2022, 5:02 p.m. UTC
There's no need to add planes to the atomic state. Remove the call
to drm_atomic_add_affected_planes() from simpledrm.

On full modesets, the DRM helpers already add a CRTC's planes to the
atomic state; see drm_atomic_helper_check_modeset(). There's no reason
to call drm_atomic_add_affected_planes() unconditionally in the CRTC's
atomic_check() in simpledrm. It's also too late, as the atomic_check()
of the added planes will not be called before the commit.

Suggested-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---

 drivers/gpu/drm/tiny/simpledrm.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

Comments

Thomas Zimmermann Oct. 11, 2022, 1:06 p.m. UTC | #1
Hi

Am 10.10.22 um 19:02 schrieb Javier Martinez Canillas:
> There's no need to add planes to the atomic state. Remove the call
> to drm_atomic_add_affected_planes() from simpledrm.
> 
> On full modesets, the DRM helpers already add a CRTC's planes to the
> atomic state; see drm_atomic_helper_check_modeset(). There's no reason
> to call drm_atomic_add_affected_planes() unconditionally in the CRTC's
> atomic_check() in simpledrm. It's also too late, as the atomic_check()
> of the added planes will not be called before the commit.
> 
> Suggested-by: Thomas Zimmermann <tzimmermann@suse.de>
> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>

Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>

There's also drm_atomic_add_affected_planes() in mgag200. Since you're 
at it, I'd appreciate a patch.

Best regards
Thomas

> ---
> 
>   drivers/gpu/drm/tiny/simpledrm.c | 10 ++--------
>   1 file changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/tiny/simpledrm.c b/drivers/gpu/drm/tiny/simpledrm.c
> index ecd49a8f3334..f03f17f62a56 100644
> --- a/drivers/gpu/drm/tiny/simpledrm.c
> +++ b/drivers/gpu/drm/tiny/simpledrm.c
> @@ -549,17 +549,11 @@ static int simpledrm_crtc_helper_atomic_check(struct drm_crtc *crtc,
>   					      struct drm_atomic_state *new_state)
>   {
>   	struct drm_crtc_state *new_crtc_state = drm_atomic_get_new_crtc_state(new_state, crtc);
> -	int ret;
>   
>   	if (!new_crtc_state->enable)
> -		goto out;
> -
> -	ret = drm_atomic_helper_check_crtc_primary_plane(new_crtc_state);
> -	if (ret)
> -		return ret;
> +		return 0;
>   
> -out:
> -	return drm_atomic_add_affected_planes(new_state, crtc);
> +	return drm_atomic_helper_check_crtc_primary_plane(new_crtc_state);
>   }
>   
>   /*
Javier Martinez Canillas Oct. 11, 2022, 1:09 p.m. UTC | #2
Hello Thomas,

On 10/11/22 15:06, Thomas Zimmermann wrote:
> Hi
> 
> Am 10.10.22 um 19:02 schrieb Javier Martinez Canillas:
>> There's no need to add planes to the atomic state. Remove the call
>> to drm_atomic_add_affected_planes() from simpledrm.
>>
>> On full modesets, the DRM helpers already add a CRTC's planes to the
>> atomic state; see drm_atomic_helper_check_modeset(). There's no reason
>> to call drm_atomic_add_affected_planes() unconditionally in the CRTC's
>> atomic_check() in simpledrm. It's also too late, as the atomic_check()
>> of the added planes will not be called before the commit.
>>
>> Suggested-by: Thomas Zimmermann <tzimmermann@suse.de>
>> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
> 
> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
>

Thanks.
 
> There's also drm_atomic_add_affected_planes() in mgag200. Since you're 
> at it, I'd appreciate a patch.
>

Sure, I'll include in v2. I noticed that but didn't feel like posting
a patch because I'm not familiar with that device nor have HW to test.
diff mbox series

Patch

diff --git a/drivers/gpu/drm/tiny/simpledrm.c b/drivers/gpu/drm/tiny/simpledrm.c
index ecd49a8f3334..f03f17f62a56 100644
--- a/drivers/gpu/drm/tiny/simpledrm.c
+++ b/drivers/gpu/drm/tiny/simpledrm.c
@@ -549,17 +549,11 @@  static int simpledrm_crtc_helper_atomic_check(struct drm_crtc *crtc,
 					      struct drm_atomic_state *new_state)
 {
 	struct drm_crtc_state *new_crtc_state = drm_atomic_get_new_crtc_state(new_state, crtc);
-	int ret;
 
 	if (!new_crtc_state->enable)
-		goto out;
-
-	ret = drm_atomic_helper_check_crtc_primary_plane(new_crtc_state);
-	if (ret)
-		return ret;
+		return 0;
 
-out:
-	return drm_atomic_add_affected_planes(new_state, crtc);
+	return drm_atomic_helper_check_crtc_primary_plane(new_crtc_state);
 }
 
 /*