Skip to content

Commit 7b49576

Browse files
committed
drm/ingenic: Fix non-OSD mode
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: <[email protected]> # v5.8+ Signed-off-by: Paul Cercueil <[email protected]> Acked-by: Daniel Vetter <[email protected]> Tested-by: H. Nikolaus Schaller <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent d0c5ac0 commit 7b49576

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ static void ingenic_drm_plane_atomic_update(struct drm_plane *plane,
561561
height = newstate->src_h >> 16;
562562
cpp = newstate->fb->format->cpp[0];
563563

564-
if (priv->soc_info->has_osd && plane->type == DRM_PLANE_TYPE_OVERLAY)
564+
if (!priv->soc_info->has_osd || plane->type == DRM_PLANE_TYPE_OVERLAY)
565565
hwdesc = &priv->dma_hwdescs->hwdesc_f0;
566566
else
567567
hwdesc = &priv->dma_hwdescs->hwdesc_f1;
@@ -833,6 +833,7 @@ static int ingenic_drm_bind(struct device *dev, bool has_components)
833833
const struct jz_soc_info *soc_info;
834834
struct ingenic_drm *priv;
835835
struct clk *parent_clk;
836+
struct drm_plane *primary;
836837
struct drm_bridge *bridge;
837838
struct drm_panel *panel;
838839
struct drm_encoder *encoder;
@@ -947,9 +948,11 @@ static int ingenic_drm_bind(struct device *dev, bool has_components)
947948
if (soc_info->has_osd)
948949
priv->ipu_plane = drm_plane_from_index(drm, 0);
949950

950-
drm_plane_helper_add(&priv->f1, &ingenic_drm_plane_helper_funcs);
951+
primary = priv->soc_info->has_osd ? &priv->f1 : &priv->f0;
951952

952-
ret = drm_universal_plane_init(drm, &priv->f1, 1,
953+
drm_plane_helper_add(primary, &ingenic_drm_plane_helper_funcs);
954+
955+
ret = drm_universal_plane_init(drm, primary, 1,
953956
&ingenic_drm_primary_plane_funcs,
954957
priv->soc_info->formats_f1,
955958
priv->soc_info->num_formats_f1,
@@ -961,7 +964,7 @@ static int ingenic_drm_bind(struct device *dev, bool has_components)
961964

962965
drm_crtc_helper_add(&priv->crtc, &ingenic_drm_crtc_helper_funcs);
963966

964-
ret = drm_crtc_init_with_planes(drm, &priv->crtc, &priv->f1,
967+
ret = drm_crtc_init_with_planes(drm, &priv->crtc, primary,
965968
NULL, &ingenic_drm_crtc_funcs, NULL);
966969
if (ret) {
967970
dev_err(dev, "Failed to init CRTC: %i\n", ret);

0 commit comments

Comments
 (0)