Skip to contentSkip to conversation

drm/meson: fix primary plane disabling

PATCH In review Neil Armstrong 2 participants 7 messages Jun 5, 2019 – Jun 7, 2019

Subsystems (4)
lore
Share & tools
lore
#1 lore raw

PATCH 1/2 drm/meson: fix primary plane disabling

In reply to Neil Armstrong

The primary plane disable logic is flawed, when the primary plane is disabled, it is re-enabled in the vsync irq when another plane is updated.

Handle the plane disabling correctly by handling the primary plane enable flag in the primary plane update & disable callbacks.

Fixes 490f50c109d1 ("drm/meson: Add G12A support for OSD1 Plane")
---
 drivers/gpu/drm/meson/meson_crtc.c  | 4 ----
 drivers/gpu/drm/meson/meson_plane.c | 4 +++-
 2 files changed, 3 insertions(+), 5 deletions(-)
drivers/gpu/drm/meson/meson_crtc.c +0 -4
index 685715144156..50a9a96720b9 100644
@@ -107,8 +107,6 @@ static void meson_g12a_crtc_atomic_enable(struct drm_crtc *crtc,
 			priv->io_base + _REG(VPP_OUT_H_V_SIZE));
 
 	drm_crtc_vblank_on(crtc);
-
-	priv->viu.osd1_enabled = true;
 }
 
 static void meson_crtc_atomic_enable(struct drm_crtc *crtc,
@@ -137,8 +135,6 @@ static void meson_crtc_atomic_enable(struct drm_crtc *crtc,
 			    priv->io_base + _REG(VPP_MISC));
 
 	drm_crtc_vblank_on(crtc);
-
-	priv->viu.osd1_enabled = true;
 }
 
 static void meson_g12a_crtc_atomic_disable(struct drm_crtc *crtc,
drivers/gpu/drm/meson/meson_plane.c +3 -1
index 22490047932e..b788280895c6 100644
@@ -305,6 +305,8 @@ static void meson_plane_atomic_update(struct drm_plane *plane,
 		meson_plane->enabled = true;
 	}
 
+	priv->viu.osd1_enabled = true;
+
 	spin_unlock_irqrestore(&priv->drm->event_lock, flags);
 }
 
@@ -323,7 +325,7 @@ static void meson_plane_atomic_disable(struct drm_plane *plane,
 				    priv->io_base + _REG(VPP_MISC));
 
 	meson_plane->enabled = false;
-
+	priv->viu.osd1_enabled = false;
 }
 
 static const struct drm_plane_helper_funcs meson_plane_helper_funcs = {
Signature · 1 line
2.21.0
#0 lore raw

cover drm/meson: fix primary plane disabling

The primary plane disabling logic is broken on all supported Amlogic SoCs, and the G12A primary plane disable register write is wrong.

This patchset solves thse issues, and has been tested with the Baylibre ffmpeg-drm tool and modetest.

Neil Armstrong (2):
drm/meson: fix primary plane disabling
drm/meson: fix G12A primary plane disabling

 drivers/gpu/drm/meson/meson_crtc.c  | 6 ++----
 drivers/gpu/drm/meson/meson_plane.c | 8 +++++---
 drivers/gpu/drm/meson/meson_viu.c   | 3 +--
 3 files changed, 8 insertions(+), 9 deletions(-)
Signature · 6 lines
2.21.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#4 lore raw

PATCH 2/2 drm/meson: fix G12A primary plane disabling

The G12A Primary plane was disabled by writing in the OSD1 configuration registers, but this caused the plane blender to stall instead of continuing blended only the overlay plane.

Fix this by disabling the OSD1 plane in the blender registers, and also enabling it back using the same register.

Fixes 490f50c109d1 ("drm/meson: Add G12A support for OSD1 Plane")
---
 drivers/gpu/drm/meson/meson_crtc.c  | 2 ++
 drivers/gpu/drm/meson/meson_plane.c | 4 ++--
 drivers/gpu/drm/meson/meson_viu.c   | 3 +--
 3 files changed, 5 insertions(+), 4 deletions(-)
drivers/gpu/drm/meson/meson_crtc.c +2 -0
index 50a9a96720b9..aa8ea107524e 100644
@@ -252,6 +252,8 @@ static void meson_g12a_crtc_enable_osd1(struct meson_drm *priv)
 	writel_relaxed(priv->viu.osb_blend1_size,
 		       priv->io_base +
 		       _REG(VIU_OSD_BLEND_BLEND1_SIZE));
+	writel_bits_relaxed(3 << 8, 3 << 8,
+			    priv->io_base + _REG(OSD1_BLEND_SRC_CTRL));
 }
 
 static void meson_crtc_enable_vd1(struct meson_drm *priv)
drivers/gpu/drm/meson/meson_plane.c +2 -2
index b788280895c6..d90427b93a51 100644
@@ -318,8 +318,8 @@ static void meson_plane_atomic_disable(struct drm_plane *plane,
 
 	/* Disable OSD1 */
 	if (meson_vpu_is_compatible(priv, "amlogic,meson-g12a-vpu"))
-		writel_bits_relaxed(BIT(0) | BIT(21), 0,
-			priv->io_base + _REG(VIU_OSD1_CTRL_STAT));
+		writel_bits_relaxed(3 << 8, 0,
+				    priv->io_base + _REG(OSD1_BLEND_SRC_CTRL));
 	else
 		writel_bits_relaxed(VPP_OSD1_POSTBLEND, 0,
 				    priv->io_base + _REG(VPP_MISC));
drivers/gpu/drm/meson/meson_viu.c +1 -2
index 462c7cb3e1bd..4b2b3024d371 100644
@@ -405,8 +405,7 @@ void meson_viu_init(struct meson_drm *priv)
 				0 << 16 |
 				1,
 				priv->io_base + _REG(VIU_OSD_BLEND_CTRL));
-		writel_relaxed(3 << 8 |
-				1 << 20,
+		writel_relaxed(1 << 20,
 				priv->io_base + _REG(OSD1_BLEND_SRC_CTRL));
 		writel_relaxed(1 << 20,
 				priv->io_base + _REG(OSD2_BLEND_SRC_CTRL));
Signature · 6 lines
2.21.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
maintainer Reviewed-by on v1 1/2
#2 lore raw
In reply to Neil Armstrong
Quoted 8 lines · Neil Armstrong

The primary plane disable logic is flawed, when the primary plane is disabled, it is re-enabled in the vsync irq when another plane is updated.

Handle the plane disabling correctly by handling the primary plane enable flag in the primary plane update & disable callbacks.

Fixes 490f50c109d1 ("drm/meson: Add G12A support for OSD1 Plane")
maintainer Reviewed-by on v1 2/2
#5 lore raw

Re: [PATCH 2/2] drm/meson: fix G12A primary plane disabling

In reply to Neil Armstrong
Quoted 3 lines · Neil Armstrong

The G12A Primary plane was disabled by writing in the OSD1 configuration registers, but this caused the plane blender to stall instead of continuing blended only the overlay plane.

grammar nit: "...instead of continuing to blend only the overlay plane."

Quoted 5 lines

Fix this by disabling the OSD1 plane in the blender registers, and also enabling it back using the same register.

Fixes 490f50c109d1 ("drm/meson: Add G12A support for OSD1 Plane")

As noted elsewhere, this driver is also full of magic constants used in register writes which makes reviewing this kind of change for correctness that much more difficult, but since that's already been pointed out elsewhere, and it's already on your TODO list, it should not block this important fix.

Kevin

#6 lore raw

Re: [PATCH 2/2] drm/meson: fix G12A primary plane disabling

Quoted 7 lines · Kevin Hilman
Quoted 3 lines · Neil Armstrong

The G12A Primary plane was disabled by writing in the OSD1 configuration registers, but this caused the plane blender to stall instead of continuing blended only the overlay plane.

grammar nit: "...instead of continuing to blend only the overlay plane."

Fixed while applying on drm-misc-fixes

Quoted 7 lines
Quoted 6 lines

Fix this by disabling the OSD1 plane in the blender registers, and also enabling it back using the same register.

Fixes 490f50c109d1 ("drm/meson: Add G12A support for OSD1 Plane")
Quoted 7 lines

As noted elsewhere, this driver is also full of magic constants used in register writes which makes reviewing this kind of change for correctness that much more difficult, but since that's already been pointed out elsewhere, and it's already on your TODO list, it should not block this important fix.

Yep, it's the top priority now.

Thanks,

Neil

Quoted 3 lines

Kevin

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw
In reply to Kevin Hilman
Quoted 5 lines · Kevin Hilman
Quoted 3 lines · Neil Armstrong

The primary plane disable logic is flawed, when the primary plane is disabled, it is re-enabled in the vsync irq when another plane is updated.

Quoted 8 lines
Quoted 5 lines

Handle the plane disabling correctly by handling the primary plane enable flag in the primary plane update & disable callbacks.

Fixes 490f50c109d1 ("drm/meson: Add G12A support for OSD1 Plane")

Applying to drm-misc-fixes

Thanks,

Neil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel