diff mbox series

[2/2] drm/ingenic: Don't request full modeset if property is not modified

Message ID 20210329175046.214629-3-paul@crapouillou.net (mailing list archive)
State New, archived
Headers show
Series drm/ingenic: IPU plane fixes | expand

Commit Message

Paul Cercueil March 29, 2021, 5:50 p.m. UTC
Avoid requesting a full modeset if the sharpness property is not
modified, because then we don't actually need it.

Fixes: fc1acf317b01 ("drm/ingenic: Add support for the IPU")
Cc: <stable@vger.kernel.org> # 5.8+
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/gpu/drm/ingenic/ingenic-ipu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Paul Cercueil April 12, 2021, 2:32 p.m. UTC | #1
Can I have an ACK for this patch?

Cheers,
-Paul

Le lun. 29 mars 2021 à 18:50, Paul Cercueil <paul@crapouillou.net> a 
écrit :
> Avoid requesting a full modeset if the sharpness property is not
> modified, because then we don't actually need it.
> 
> Fixes: fc1acf317b01 ("drm/ingenic: Add support for the IPU")
> Cc: <stable@vger.kernel.org> # 5.8+
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
>  drivers/gpu/drm/ingenic/ingenic-ipu.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/ingenic/ingenic-ipu.c 
> b/drivers/gpu/drm/ingenic/ingenic-ipu.c
> index 3b1091e7c0cd..95b665c4a7b0 100644
> --- a/drivers/gpu/drm/ingenic/ingenic-ipu.c
> +++ b/drivers/gpu/drm/ingenic/ingenic-ipu.c
> @@ -640,10 +640,12 @@ ingenic_ipu_plane_atomic_set_property(struct 
> drm_plane *plane,
>  {
>  	struct ingenic_ipu *ipu = plane_to_ingenic_ipu(plane);
>  	struct drm_crtc_state *crtc_state;
> +	bool mode_changed;
> 
>  	if (property != ipu->sharpness_prop)
>  		return -EINVAL;
> 
> +	mode_changed = val != ipu->sharpness;
>  	ipu->sharpness = val;
> 
>  	if (state->crtc) {
> @@ -651,7 +653,7 @@ ingenic_ipu_plane_atomic_set_property(struct 
> drm_plane *plane,
>  		if (WARN_ON(!crtc_state))
>  			return -EINVAL;
> 
> -		crtc_state->mode_changed = true;
> +		crtc_state->mode_changed |= mode_changed;
>  	}
> 
>  	return 0;
> --
> 2.30.2
>
Maxime Ripard April 15, 2021, 9:26 a.m. UTC | #2
Hi,

On Mon, Mar 29, 2021 at 06:50:46PM +0100, Paul Cercueil wrote:
> Avoid requesting a full modeset if the sharpness property is not
> modified, because then we don't actually need it.
> 
> Fixes: fc1acf317b01 ("drm/ingenic: Add support for the IPU")
> Cc: <stable@vger.kernel.org> # 5.8+
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
>  drivers/gpu/drm/ingenic/ingenic-ipu.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/ingenic/ingenic-ipu.c b/drivers/gpu/drm/ingenic/ingenic-ipu.c
> index 3b1091e7c0cd..95b665c4a7b0 100644
> --- a/drivers/gpu/drm/ingenic/ingenic-ipu.c
> +++ b/drivers/gpu/drm/ingenic/ingenic-ipu.c
> @@ -640,10 +640,12 @@ ingenic_ipu_plane_atomic_set_property(struct drm_plane *plane,
>  {
>  	struct ingenic_ipu *ipu = plane_to_ingenic_ipu(plane);
>  	struct drm_crtc_state *crtc_state;
> +	bool mode_changed;
>  
>  	if (property != ipu->sharpness_prop)
>  		return -EINVAL;
>  
> +	mode_changed = val != ipu->sharpness;
>  	ipu->sharpness = val;
>  
>  	if (state->crtc) {
> @@ -651,7 +653,7 @@ ingenic_ipu_plane_atomic_set_property(struct drm_plane *plane,
>  		if (WARN_ON(!crtc_state))
>  			return -EINVAL;
>  
> -		crtc_state->mode_changed = true;
> +		crtc_state->mode_changed |= mode_changed;
>  	}

I'd just change the condition from

if (state->crtc)

to

if (state->crtc && val != ipu->sharpness)

It's going to be easier to extend if you ever need to. Also, drivers
usually do this in atomic_check, is there a specific reason to do it in
atomic_set_property?

Maxime
diff mbox series

Patch

diff --git a/drivers/gpu/drm/ingenic/ingenic-ipu.c b/drivers/gpu/drm/ingenic/ingenic-ipu.c
index 3b1091e7c0cd..95b665c4a7b0 100644
--- a/drivers/gpu/drm/ingenic/ingenic-ipu.c
+++ b/drivers/gpu/drm/ingenic/ingenic-ipu.c
@@ -640,10 +640,12 @@  ingenic_ipu_plane_atomic_set_property(struct drm_plane *plane,
 {
 	struct ingenic_ipu *ipu = plane_to_ingenic_ipu(plane);
 	struct drm_crtc_state *crtc_state;
+	bool mode_changed;
 
 	if (property != ipu->sharpness_prop)
 		return -EINVAL;
 
+	mode_changed = val != ipu->sharpness;
 	ipu->sharpness = val;
 
 	if (state->crtc) {
@@ -651,7 +653,7 @@  ingenic_ipu_plane_atomic_set_property(struct drm_plane *plane,
 		if (WARN_ON(!crtc_state))
 			return -EINVAL;
 
-		crtc_state->mode_changed = true;
+		crtc_state->mode_changed |= mode_changed;
 	}
 
 	return 0;