Skip to content

Commit 8f6dcc4

Browse files
pcercueigregkh
authored andcommitted
drm/ingenic: Fix non-OSD mode
commit 7b49576 upstream. Even though the JZ4740 did not have the OSD mode, it had (according to the documentation) two DMA channels, but there is absolutely no information about how to select the second DMA channel. Make the ingenic-drm driver work in non-OSD mode by using the foreground0 plane (which is bound to the DMA0 channel) as the primary plane, instead of the foreground1 plane, which is the primary plane when in OSD mode. Fixes: 3c9bea4 ("drm/ingenic: Add support for OSD mode") Cc: <stable@vger.kernel.org> # v5.8+ Signed-off-by: Paul Cercueil <paul@crapouillou.net> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Tested-by: H. Nikolaus Schaller <hns@goldelico.com> Link: https://patchwork.freedesktop.org/patch/msgid/20210124085552.29146-5-paul@crapouillou.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent cae871b commit 8f6dcc4

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

‎drivers/gpu/drm/ingenic/ingenic-drm-drv.c‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ static void ingenic_drm_plane_atomic_update(struct drm_plane *plane,
455455
height = state->src_h >> 16;
456456
cpp = state->fb->format->cpp[0];
457457

458-
if (priv->soc_info->has_osd && plane->type == DRM_PLANE_TYPE_OVERLAY)
458+
if (!priv->soc_info->has_osd || plane->type == DRM_PLANE_TYPE_OVERLAY)
459459
hwdesc = priv->dma_hwdesc_f0;
460460
else
461461
hwdesc = priv->dma_hwdesc_f1;
@@ -692,6 +692,7 @@ static int ingenic_drm_bind(struct device *dev, bool has_components)
692692
const struct jz_soc_info *soc_info;
693693
struct ingenic_drm *priv;
694694
struct clk *parent_clk;
695+
struct drm_plane *primary;
695696
struct drm_bridge *bridge;
696697
struct drm_panel *panel;
697698
struct drm_encoder *encoder;
@@ -784,9 +785,11 @@ static int ingenic_drm_bind(struct device *dev, bool has_components)
784785
if (soc_info->has_osd)
785786
priv->ipu_plane = drm_plane_from_index(drm, 0);
786787

787-
drm_plane_helper_add(&priv->f1, &ingenic_drm_plane_helper_funcs);
788+
primary = priv->soc_info->has_osd ? &priv->f1 : &priv->f0;
788789

789-
ret = drm_universal_plane_init(drm, &priv->f1, 1,
790+
drm_plane_helper_add(primary, &ingenic_drm_plane_helper_funcs);
791+
792+
ret = drm_universal_plane_init(drm, primary, 1,
790793
&ingenic_drm_primary_plane_funcs,
791794
ingenic_drm_primary_formats,
792795
ARRAY_SIZE(ingenic_drm_primary_formats),
@@ -798,7 +801,7 @@ static int ingenic_drm_bind(struct device *dev, bool has_components)
798801

799802
drm_crtc_helper_add(&priv->crtc, &ingenic_drm_crtc_helper_funcs);
800803

801-
ret = drm_crtc_init_with_planes(drm, &priv->crtc, &priv->f1,
804+
ret = drm_crtc_init_with_planes(drm, &priv->crtc, primary,
802805
NULL, &ingenic_drm_crtc_funcs, NULL);
803806
if (ret) {
804807
dev_err(dev, "Failed to init CRTC: %i\n", ret);

0 commit comments

Comments
 (0)