The atomic_update hooks of both planes are just bailing out early when
the planes are invisible, so it's reasonable to just remove these hooks
and update the enabled state in atomic_update.

This fixes the problem that invisible but enabled planes won't be
shown when made visible, as pointed by Sashiko.

Fixes: dbf21777caa8 ("drm: verisilicon: add a driver for Verisilicon display 
controllers")
Fixes: 8c4ae2189125 ("drm: verisilicon: add support for cursor planes")
Signed-off-by: Icenowy Zheng <[email protected]>
---
 drivers/gpu/drm/verisilicon/vs_cursor_plane.c | 22 +++-------------
 .../gpu/drm/verisilicon/vs_primary_plane.c    | 26 +++++--------------
 2 files changed, 10 insertions(+), 38 deletions(-)

diff --git a/drivers/gpu/drm/verisilicon/vs_cursor_plane.c 
b/drivers/gpu/drm/verisilicon/vs_cursor_plane.c
index 1fa6b7578b27e..1e1805eb88704 100644
--- a/drivers/gpu/drm/verisilicon/vs_cursor_plane.c
+++ b/drivers/gpu/drm/verisilicon/vs_cursor_plane.c
@@ -99,23 +99,6 @@ static void vs_cursor_plane_commit(struct vs_dc *dc, 
unsigned int output)
                        VSDC_CURSOR_CONFIG_IMG_UPDATE);
 }
 
-static void vs_cursor_plane_atomic_enable(struct drm_plane *plane,
-                                          struct drm_atomic_commit 
*atomic_state)
-{
-       struct drm_plane_state *state = 
drm_atomic_get_new_plane_state(atomic_state,
-                                                                      plane);
-       struct drm_crtc *crtc = state->crtc;
-       struct vs_crtc *vcrtc = drm_crtc_to_vs_crtc(crtc);
-       unsigned int output = vcrtc->id;
-       struct vs_dc *dc = vcrtc->dc;
-
-       regmap_update_bits(dc->regs, VSDC_CURSOR_CONFIG(output),
-                          VSDC_CURSOR_CONFIG_FMT_MASK,
-                          VSDC_CURSOR_CONFIG_FMT_ARGB8888);
-
-       vs_cursor_plane_commit(dc, output);
-}
-
 static void vs_cursor_plane_atomic_disable(struct drm_plane *plane,
                                            struct drm_atomic_commit 
*atomic_state)
 {
@@ -154,6 +137,10 @@ static void vs_cursor_plane_atomic_update(struct drm_plane 
*plane,
        output = vcrtc->id;
        dc = vcrtc->dc;
 
+       regmap_update_bits(dc->regs, VSDC_CURSOR_CONFIG(output),
+                          VSDC_CURSOR_CONFIG_FMT_MASK,
+                          VSDC_CURSOR_CONFIG_FMT_ARGB8888);
+
        /* Other sizes should be rejected by atomic_check */
        switch (state->crtc_w) {
        case 32:
@@ -227,7 +214,6 @@ static void vs_cursor_plane_atomic_update(struct drm_plane 
*plane,
 static const struct drm_plane_helper_funcs vs_cursor_plane_helper_funcs = {
        .atomic_check   = vs_cursor_plane_atomic_check,
        .atomic_update  = vs_cursor_plane_atomic_update,
-       .atomic_enable  = vs_cursor_plane_atomic_enable,
        .atomic_disable = vs_cursor_plane_atomic_disable,
 };
 
diff --git a/drivers/gpu/drm/verisilicon/vs_primary_plane.c 
b/drivers/gpu/drm/verisilicon/vs_primary_plane.c
index c12fe54096c33..7add4669f5803 100644
--- a/drivers/gpu/drm/verisilicon/vs_primary_plane.c
+++ b/drivers/gpu/drm/verisilicon/vs_primary_plane.c
@@ -60,25 +60,6 @@ static void vs_primary_plane_commit(struct vs_dc *dc, 
unsigned int output)
                        VSDC_FB_CONFIG_EX_COMMIT);
 }
 
-static void vs_primary_plane_atomic_enable(struct drm_plane *plane,
-                                          struct drm_atomic_commit 
*atomic_state)
-{
-       struct drm_plane_state *state = 
drm_atomic_get_new_plane_state(atomic_state,
-                                                                      plane);
-       struct drm_crtc *crtc = state->crtc;
-       struct vs_crtc *vcrtc = drm_crtc_to_vs_crtc(crtc);
-       unsigned int output = vcrtc->id;
-       struct vs_dc *dc = vcrtc->dc;
-
-       regmap_set_bits(dc->regs, VSDC_FB_CONFIG_EX(output),
-                       VSDC_FB_CONFIG_EX_FB_EN);
-       regmap_update_bits(dc->regs, VSDC_FB_CONFIG_EX(output),
-                          VSDC_FB_CONFIG_EX_DISPLAY_ID_MASK,
-                          VSDC_FB_CONFIG_EX_DISPLAY_ID(output));
-
-       vs_primary_plane_commit(dc, output);
-}
-
 static void vs_primary_plane_atomic_disable(struct drm_plane *plane,
                                            struct drm_atomic_commit 
*atomic_state)
 {
@@ -149,13 +130,18 @@ static void vs_primary_plane_atomic_update(struct 
drm_plane *plane,
        regmap_write(dc->regs, VSDC_FB_BLEND_CONFIG(output),
                     VSDC_FB_BLEND_CONFIG_BLEND_DISABLE);
 
+       regmap_set_bits(dc->regs, VSDC_FB_CONFIG_EX(output),
+                       VSDC_FB_CONFIG_EX_FB_EN);
+       regmap_update_bits(dc->regs, VSDC_FB_CONFIG_EX(output),
+                          VSDC_FB_CONFIG_EX_DISPLAY_ID_MASK,
+                          VSDC_FB_CONFIG_EX_DISPLAY_ID(output));
+
        vs_primary_plane_commit(dc, output);
 }
 
 static const struct drm_plane_helper_funcs vs_primary_plane_helper_funcs = {
        .atomic_check   = vs_primary_plane_atomic_check,
        .atomic_update  = vs_primary_plane_atomic_update,
-       .atomic_enable  = vs_primary_plane_atomic_enable,
        .atomic_disable = vs_primary_plane_atomic_disable,
 };
 
-- 
2.56.0

Reply via email to