drm/sun4i: Cleanup video/YUV source before enabling a layer
authorPaul Kocialkowski <paul.kocialkowski@bootlin.com>
Fri, 23 Nov 2018 09:24:33 +0000 (10:24 +0100)
committerMaxime Ripard <maxime.ripard@bootlin.com>
Tue, 27 Nov 2018 08:30:42 +0000 (09:30 +0100)
This adds a dedicated function for cleaning the video and YUV source
channel layer enable bits. This function is called first on layer atomic
update to make sure that there are no leftover bits from previous
plane configuration that were not cleaned until now.

It fixes issues when alternating between video and YUV planes, where
both bits would be set eventually, leading to broken plane display.

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181123092515.2511-2-paul.kocialkowski@bootlin.com
drivers/gpu/drm/sun4i/sun4i_backend.c
drivers/gpu/drm/sun4i/sun4i_backend.h
drivers/gpu/drm/sun4i/sun4i_layer.c

index bf49c55b0f2c7de6d62b3ca3dbf34824be512315..67b4bb4f5365ebcb735ceb3fecd5c778a93e7e7b 100644 (file)
@@ -395,6 +395,15 @@ int sun4i_backend_update_layer_zpos(struct sun4i_backend *backend, int layer,
        return 0;
 }
 
+void sun4i_backend_cleanup_layer(struct sun4i_backend *backend,
+                                int layer)
+{
+       regmap_update_bits(backend->engine.regs,
+                          SUN4I_BACKEND_ATTCTL_REG0(layer),
+                          SUN4I_BACKEND_ATTCTL_REG0_LAY_VDOEN |
+                          SUN4I_BACKEND_ATTCTL_REG0_LAY_YUVEN, 0);
+}
+
 static bool sun4i_backend_plane_uses_scaler(struct drm_plane_state *state)
 {
        u16 src_h = state->src_h >> 16;
index e3d4c6035eb2511b32fd8a93f90cc1498a11cb5e..339dbff1cce4b867809eba40b057fb11a427f9ac 100644 (file)
@@ -208,5 +208,7 @@ int sun4i_backend_update_layer_frontend(struct sun4i_backend *backend,
                                        int layer, uint32_t in_fmt);
 int sun4i_backend_update_layer_zpos(struct sun4i_backend *backend,
                                    int layer, struct drm_plane *plane);
+void sun4i_backend_cleanup_layer(struct sun4i_backend *backend,
+                                int layer);
 
 #endif /* _SUN4I_BACKEND_H_ */
index 3f51744b6e897da7dd7faf5de024c77803b0b664..7ba0f5a6f50d792e4fd1f37fe08c099ce4382dc9 100644 (file)
@@ -93,6 +93,8 @@ static void sun4i_backend_layer_atomic_update(struct drm_plane *plane,
        struct sun4i_backend *backend = layer->backend;
        struct sun4i_frontend *frontend = backend->frontend;
 
+       sun4i_backend_cleanup_layer(backend, layer->id);
+
        if (layer_state->uses_frontend) {
                sun4i_frontend_init(frontend);
                sun4i_frontend_update_coord(frontend, plane);