[PATCH] drm: rcar-du: do not restart rcar-du groups on gen3

From: Michael Rodin
Date: Tue Nov 23 2021 - 10:20:23 EST


Restarting a display unit group can cause a visible flicker on the display.
Particularly when a LVDS display is connected to a Salvator board and an
HDMI display is (re)connected, then there will be 2 visible flickers on the
LVDS display:

1. during atomic_flush (The need_restart flag is set in this case by
rcar_du_vsp_enable.):
rcar_du_crtc_atomic_flush
rcar_du_crtc_update_planes
...
...
/* Restart the group if plane sources have changed. */
if (rcrtc->group->need_restart)
rcar_du_group_restart(rcrtc->group);
2. during atomic_enable:
rcar_du_crtc_atomic_enable
rcar_du_crtc_start
rcar_du_group_start_stop(rcrtc->group, true);

To avoid flickers in all use cases, do not restart DU groups on the Gen3
SoCs at all, since it is not required any more.

Signed-off-by: Michael Rodin <mrodin@xxxxxxxxxxxxxx>
---
drivers/gpu/drm/rcar-du/rcar_du_group.c | 5 ++++-
drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 2 --
2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_group.c b/drivers/gpu/drm/rcar-du/rcar_du_group.c
index 8665a1d..ff0a1c8 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_group.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_group.c
@@ -250,7 +250,7 @@ void rcar_du_group_start_stop(struct rcar_du_group *rgrp, bool start)
* when the display controller will have to be restarted.
*/
if (start) {
- if (rgrp->used_crtcs++ != 0)
+ if (rgrp->used_crtcs++ != 0 && rgrp->dev->info->gen != 3)
__rcar_du_group_start_stop(rgrp, false);
__rcar_du_group_start_stop(rgrp, true);
} else {
@@ -263,6 +263,9 @@ void rcar_du_group_restart(struct rcar_du_group *rgrp)
{
rgrp->need_restart = false;

+ if (rgrp->dev->info->gen == 3)
+ return;
+
__rcar_du_group_start_stop(rgrp, false);
__rcar_du_group_start_stop(rgrp, true);
}
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
index b7fc5b0..a652c06 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
@@ -88,8 +88,6 @@ void rcar_du_vsp_enable(struct rcar_du_crtc *crtc)
* Ensure that the plane source configuration takes effect by requesting
* a restart of the group. See rcar_du_plane_atomic_update() for a more
* detailed explanation.
- *
- * TODO: Check whether this is still needed on Gen3.
*/
crtc->group->need_restart = true;

--
2.7.4