drm/meson: fix primary plane disabling
PATCH 1/2 drm/meson: fix primary plane disabling
In reply to Neil ArmstrongThe 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.
--- 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
@@ -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
@@ -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
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
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.
--- 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
@@ -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
@@ -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
@@ -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
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")Signed-off-by Neil Armstrong <[email protected]>
Re: [PATCH 2/2] drm/meson: fix G12A primary plane disabling
In reply to Neil ArmstrongQuoted 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")Signed-off-by Neil Armstrong <[email protected]>
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
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")Signed-off-by Neil Armstrong <[email protected]>
Quoted 7 lines
Reviewed-by Kevin Hilman <[email protected]>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
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")Signed-off-by Neil Armstrong <[email protected]>Reviewed-by Kevin Hilman <[email protected]>
Applying to drm-misc-fixes
Thanks,
Neil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel