From c283400aa5898279dbae0fe00a2ce8e0f61eb22c Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Thu, 5 Nov 2015 19:54:33 +0200 Subject: drm/omap: move dispc related dss-feat funcs to dispc omapdrm still uses a few non-dispc functions: dss_feat_get_num_mgrs(), dss_feat_get_num_ovls() and dss_feat_get_supported_color_modes(). We want to provide omapdrm a single dispc_ops function pointer struct so that omapdrm will use either the current omapdss or the new omapdss6 driver depending on the platform. Those three functions are really dispc functions, but are located in the dss_features.c for legacy reasons. This patch adds similar functionss to the dispc, and changes omapdrm to use those new functions. Underneath the functions still call the functions from dss_feature.c. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/omap_plane.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/gpu/drm/omapdrm/omap_plane.c') diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c index 386d90af70f7..1067695af401 100644 --- a/drivers/gpu/drm/omapdrm/omap_plane.c +++ b/drivers/gpu/drm/omapdrm/omap_plane.c @@ -352,7 +352,7 @@ struct drm_plane *omap_plane_init(struct drm_device *dev, omap_plane->nformats = omap_framebuffer_get_formats( omap_plane->formats, ARRAY_SIZE(omap_plane->formats), - dss_feat_get_supported_color_modes(id)); + dispc_ovl_get_color_modes(id)); omap_plane->id = id; omap_plane->name = plane_names[id]; -- cgit From 9f759225e42b00ad0c5a55907f443b388e8960f4 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Thu, 5 Nov 2015 18:39:52 +0200 Subject: drm/omap: use dispc_ops Change omapdrm to get dispc_ops and use that to call the dispc functions instead or direct function calls. The change is very straightforward. The only problem was in omap_crtc_init() which calls pipe2vbl(crtc), and at that point of time the crtc->dev link, which is used to get the dispc_ops, has not been set up yet. This patch makes omap_crtc_init() skip the call to pipe2vbl() and instead calls dispc_ops->mgr_get_vsync_irq() directly. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/omap_plane.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'drivers/gpu/drm/omapdrm/omap_plane.c') diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c index 1067695af401..bdd74692e0cd 100644 --- a/drivers/gpu/drm/omapdrm/omap_plane.c +++ b/drivers/gpu/drm/omapdrm/omap_plane.c @@ -76,6 +76,7 @@ static void omap_plane_cleanup_fb(struct drm_plane *plane, static void omap_plane_atomic_update(struct drm_plane *plane, struct drm_plane_state *old_state) { + struct omap_drm_private *priv = plane->dev->dev_private; struct omap_plane *omap_plane = to_omap_plane(plane); struct drm_plane_state *state = plane->state; struct omap_plane_state *omap_state = to_omap_plane_state(state); @@ -123,25 +124,26 @@ static void omap_plane_atomic_update(struct drm_plane *plane, DBG("%d,%d %pad %pad", info.pos_x, info.pos_y, &info.paddr, &info.p_uv_addr); - dispc_ovl_set_channel_out(omap_plane->id, + priv->dispc_ops->ovl_set_channel_out(omap_plane->id, omap_crtc_channel(state->crtc)); /* and finally, update omapdss: */ - ret = dispc_ovl_setup(omap_plane->id, &info, false, + ret = priv->dispc_ops->ovl_setup(omap_plane->id, &info, false, omap_crtc_timings(state->crtc), false); if (ret) { dev_err(plane->dev->dev, "Failed to setup plane %s\n", omap_plane->name); - dispc_ovl_enable(omap_plane->id, false); + priv->dispc_ops->ovl_enable(omap_plane->id, false); return; } - dispc_ovl_enable(omap_plane->id, true); + priv->dispc_ops->ovl_enable(omap_plane->id, true); } static void omap_plane_atomic_disable(struct drm_plane *plane, struct drm_plane_state *old_state) { + struct omap_drm_private *priv = plane->dev->dev_private; struct omap_plane_state *omap_state = to_omap_plane_state(plane->state); struct omap_plane *omap_plane = to_omap_plane(plane); @@ -149,7 +151,7 @@ static void omap_plane_atomic_disable(struct drm_plane *plane, omap_state->zorder = plane->type == DRM_PLANE_TYPE_PRIMARY ? 0 : omap_plane->id; - dispc_ovl_enable(omap_plane->id, false); + priv->dispc_ops->ovl_enable(omap_plane->id, false); } static int omap_plane_atomic_check(struct drm_plane *plane, @@ -340,6 +342,7 @@ struct drm_plane *omap_plane_init(struct drm_device *dev, int id, enum drm_plane_type type, u32 possible_crtcs) { + struct omap_drm_private *priv = dev->dev_private; struct drm_plane *plane; struct omap_plane *omap_plane; int ret; @@ -352,7 +355,7 @@ struct drm_plane *omap_plane_init(struct drm_device *dev, omap_plane->nformats = omap_framebuffer_get_formats( omap_plane->formats, ARRAY_SIZE(omap_plane->formats), - dispc_ovl_get_color_modes(id)); + priv->dispc_ops->ovl_get_color_modes(id)); omap_plane->id = id; omap_plane->name = plane_names[id]; -- cgit From be2d68c69e5c5a54cd2179aa6971d42cc3a49375 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Mon, 29 Aug 2016 13:15:02 +0300 Subject: drm/omap: fix replication logic DSS uses "replication logic" to convert color components from smaller bit widths to bigger bit widths. Without replication logic, the color component would be shifted and the least significant bits would be left at 0, whereas with replication logic, the least significat bits will be filled with the most significant bit. For some reason omapdrm leaves replication logic always to off, which, in the most common case, means that showing 16-bit RGB colors on 24-bit display gives a bit darker colors than expected. The reset value of the replication logic bit is enabled, and it should always be set, as there's no practical reason to disable it. This patch removes the option to disable it from omapdrm, and always sets it to enabled in dispc. Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart --- drivers/gpu/drm/omapdrm/omap_plane.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/gpu/drm/omapdrm/omap_plane.c') diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c index bdd74692e0cd..78a92422ede1 100644 --- a/drivers/gpu/drm/omapdrm/omap_plane.c +++ b/drivers/gpu/drm/omapdrm/omap_plane.c @@ -128,7 +128,7 @@ static void omap_plane_atomic_update(struct drm_plane *plane, omap_crtc_channel(state->crtc)); /* and finally, update omapdss: */ - ret = priv->dispc_ops->ovl_setup(omap_plane->id, &info, false, + ret = priv->dispc_ops->ovl_setup(omap_plane->id, &info, omap_crtc_timings(state->crtc), false); if (ret) { dev_err(plane->dev->dev, "Failed to setup plane %s\n", -- cgit From 694c99cf6f5a13774bbdbf5becdbf59451b955f0 Mon Sep 17 00:00:00 2001 From: Jyri Sarha Date: Fri, 24 Mar 2017 16:47:54 +0200 Subject: drm/omap: Remove the obsolete #define omap_plane _omap_plane hack Remove the obsolete "#define omap_plane _omap_plane" hack and other related hacks to get around the enum omap_plane colliding with struct omap_plane. Signed-off-by: Jyri Sarha Reviewed-by: Laurent Pinchart Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/omap_plane.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'drivers/gpu/drm/omapdrm/omap_plane.c') diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c index 78a92422ede1..7abb49b7d606 100644 --- a/drivers/gpu/drm/omapdrm/omap_plane.c +++ b/drivers/gpu/drm/omapdrm/omap_plane.c @@ -24,12 +24,6 @@ #include "omap_dmm_tiler.h" #include "omap_drv.h" -/* some hackery because omapdss has an 'enum omap_plane' (which would be - * better named omap_plane_id).. and compiler seems unhappy about having - * both a 'struct omap_plane' and 'enum omap_plane' - */ -#define omap_plane _omap_plane - /* * plane funcs */ @@ -38,7 +32,7 @@ struct omap_plane { struct drm_plane base; - int id; /* TODO rename omap_plane -> omap_plane_id in omapdss so I can use the enum */ + enum omap_plane_id id; const char *name; uint32_t nformats; -- cgit From e8e13b1521678af0df7b07f30745d77e8de1820a Mon Sep 17 00:00:00 2001 From: Jyri Sarha Date: Fri, 24 Mar 2017 16:47:55 +0200 Subject: drm/omap: Major omap_modeset_init() cleanup Cleanup overly complex omap_modeset_init(). The function is trying to support many unusual configuration, that have never been tested and are not supported by other parts of the dirver. After cleanup the init function creates exactly one connector, encoder, crtc, and primary plane per each connected dss-device. Each connector->encoder->crtc chain is expected to be separate and each crtc is connect to a single dss-channel. If the configuration does not match the expectations or exceeds the available resources, the configuration is rejected. Signed-off-by: Jyri Sarha Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/omap_plane.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'drivers/gpu/drm/omapdrm/omap_plane.c') diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c index 7abb49b7d606..9168154d749e 100644 --- a/drivers/gpu/drm/omapdrm/omap_plane.c +++ b/drivers/gpu/drm/omapdrm/omap_plane.c @@ -324,24 +324,37 @@ static const struct drm_plane_funcs omap_plane_funcs = { .atomic_get_property = omap_plane_atomic_get_property, }; -static const char *plane_names[] = { +static const char *plane_id_to_name[] = { [OMAP_DSS_GFX] = "gfx", [OMAP_DSS_VIDEO1] = "vid1", [OMAP_DSS_VIDEO2] = "vid2", [OMAP_DSS_VIDEO3] = "vid3", }; +static const enum omap_plane_id plane_idx_to_id[] = { + OMAP_DSS_GFX, + OMAP_DSS_VIDEO1, + OMAP_DSS_VIDEO2, + OMAP_DSS_VIDEO3, +}; + /* initialize plane */ struct drm_plane *omap_plane_init(struct drm_device *dev, - int id, enum drm_plane_type type, + int idx, enum drm_plane_type type, u32 possible_crtcs) { struct omap_drm_private *priv = dev->dev_private; struct drm_plane *plane; struct omap_plane *omap_plane; + enum omap_plane_id id; int ret; - DBG("%s: type=%d", plane_names[id], type); + if (WARN_ON(idx >= ARRAY_SIZE(plane_idx_to_id))) + return ERR_PTR(-EINVAL); + + id = plane_idx_to_id[idx]; + + DBG("%s: type=%d", plane_id_to_name[id], type); omap_plane = kzalloc(sizeof(*omap_plane), GFP_KERNEL); if (!omap_plane) @@ -351,7 +364,7 @@ struct drm_plane *omap_plane_init(struct drm_device *dev, omap_plane->formats, ARRAY_SIZE(omap_plane->formats), priv->dispc_ops->ovl_get_color_modes(id)); omap_plane->id = id; - omap_plane->name = plane_names[id]; + omap_plane->name = plane_id_to_name[id]; plane = &omap_plane->base; @@ -368,6 +381,9 @@ struct drm_plane *omap_plane_init(struct drm_device *dev, return plane; error: + dev_err(dev->dev, "%s(): could not create plane: %s\n", + __func__, plane_id_to_name[id]); + kfree(omap_plane); return NULL; } -- cgit