[03/39] drm: renesas: shmobile: Fix overlay plane disable

Message ID 9feb39aaab796fc4b59c6c83c3d96757482f714d.1687423204.git.geert+renesas@glider.be
State New
Headers
Series drm: renesas: shmobile: Atomic conversion + DT support |

Commit Message

Geert Uytterhoeven June 22, 2023, 9:21 a.m. UTC
  Merely writing zero to the CHn Source Image Format Register is not
sufficient to disable a plane, as the programmed register value is not
propagated immediately to the current side.  This can be seen when using
the -P option of modetest: the extra plane is displayed correctly, but
does not disappear after exit.

Fix this by doing the full update dance using the Blend Control
Register, like is done when enabling the plane.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/gpu/drm/renesas/shmobile/shmob_drm_plane.c | 3 +++
 1 file changed, 3 insertions(+)
  

Comments

Laurent Pinchart June 23, 2023, 2:59 p.m. UTC | #1
Hi Geert,

Thank you for the patch.

On Thu, Jun 22, 2023 at 11:21:15AM +0200, Geert Uytterhoeven wrote:
> Merely writing zero to the CHn Source Image Format Register is not
> sufficient to disable a plane, as the programmed register value is not
> propagated immediately to the current side.  This can be seen when using
> the -P option of modetest: the extra plane is displayed correctly, but
> does not disappear after exit.
> 
> Fix this by doing the full update dance using the Blend Control
> Register, like is done when enabling the plane.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

> ---
>  drivers/gpu/drm/renesas/shmobile/shmob_drm_plane.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/renesas/shmobile/shmob_drm_plane.c b/drivers/gpu/drm/renesas/shmobile/shmob_drm_plane.c
> index 850986cee848226a..0e34573c3cb3d032 100644
> --- a/drivers/gpu/drm/renesas/shmobile/shmob_drm_plane.c
> +++ b/drivers/gpu/drm/renesas/shmobile/shmob_drm_plane.c
> @@ -215,7 +215,10 @@ static int shmob_drm_plane_disable(struct drm_plane *plane,
>  
>  	splane->format = NULL;
>  
> +	lcdc_write(sdev, LDBCR, LDBCR_UPC(splane->index));
>  	lcdc_write(sdev, LDBnBSIFR(splane->index), 0);
> +	lcdc_write(sdev, LDBCR,
> +		   LDBCR_UPF(splane->index) | LDBCR_UPD(splane->index));
>  	return 0;
>  }
>
  

Patch

diff --git a/drivers/gpu/drm/renesas/shmobile/shmob_drm_plane.c b/drivers/gpu/drm/renesas/shmobile/shmob_drm_plane.c
index 850986cee848226a..0e34573c3cb3d032 100644
--- a/drivers/gpu/drm/renesas/shmobile/shmob_drm_plane.c
+++ b/drivers/gpu/drm/renesas/shmobile/shmob_drm_plane.c
@@ -215,7 +215,10 @@  static int shmob_drm_plane_disable(struct drm_plane *plane,
 
 	splane->format = NULL;
 
+	lcdc_write(sdev, LDBCR, LDBCR_UPC(splane->index));
 	lcdc_write(sdev, LDBnBSIFR(splane->index), 0);
+	lcdc_write(sdev, LDBCR,
+		   LDBCR_UPF(splane->index) | LDBCR_UPD(splane->index));
 	return 0;
 }