aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2013-05-14 03:55:19 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2013-06-17 07:00:43 -0400
commit04b1fc0291674666110fffd09b30d8304aaa4602 (patch)
tree9213fcba31fffe4f0e932492481480f6653a33ad
parent7f7cdbd6883fd58cfc4e538d451b455ca849bd63 (diff)
OMAPDRM: fix overlay manager handling
Currently omapdrm creates crtcs, which map directly to DSS overlay managers, only on demand at init time. This would make it difficult to manage connecting the display entities in the future, as the code cannot just search for a suitable overlay manager. We cannot fix this the sane way, which would be to create crtcs for each overlay manager, because we need an overlay for each crtc. With limited number of overlays, that's not possible. So the solution for now is to detach the overlay manager from the crtc. crtcs are still created on demand at init time, but all overlay managers are always initialized by the omapdss. This way we can create and connect whole display pipelines from the overlay manager to the display, regardless of which crtcs omapdrm would create. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
-rw-r--r--drivers/gpu/drm/omapdrm/omap_crtc.c22
-rw-r--r--drivers/gpu/drm/omapdrm/omap_drv.c2
-rw-r--r--drivers/gpu/drm/omapdrm/omap_drv.h1
-rw-r--r--drivers/video/omap2/dss/apply.c3
-rw-r--r--drivers/video/omap2/dss/dispc.c4
5 files changed, 22 insertions, 10 deletions
diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
index 79b200aee18a..02075bfcd8fd 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.c
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
@@ -40,7 +40,7 @@ struct omap_crtc {
40 * mgr->id.) Eventually this will be replaced w/ something 40 * mgr->id.) Eventually this will be replaced w/ something
41 * more common-panel-framework-y 41 * more common-panel-framework-y
42 */ 42 */
43 struct omap_overlay_manager mgr; 43 struct omap_overlay_manager *mgr;
44 44
45 struct omap_video_timings timings; 45 struct omap_video_timings timings;
46 bool enabled; 46 bool enabled;
@@ -90,6 +90,9 @@ uint32_t pipe2vbl(struct drm_crtc *crtc)
90 * job of sequencing the setup of the video pipe in the proper order 90 * job of sequencing the setup of the video pipe in the proper order
91 */ 91 */
92 92
93/* ovl-mgr-id -> crtc */
94static struct omap_crtc *omap_crtcs[8];
95
93/* we can probably ignore these until we support command-mode panels: */ 96/* we can probably ignore these until we support command-mode panels: */
94static void omap_crtc_start_update(struct omap_overlay_manager *mgr) 97static void omap_crtc_start_update(struct omap_overlay_manager *mgr)
95{ 98{
@@ -107,7 +110,7 @@ static void omap_crtc_disable(struct omap_overlay_manager *mgr)
107static void omap_crtc_set_timings(struct omap_overlay_manager *mgr, 110static void omap_crtc_set_timings(struct omap_overlay_manager *mgr,
108 const struct omap_video_timings *timings) 111 const struct omap_video_timings *timings)
109{ 112{
110 struct omap_crtc *omap_crtc = container_of(mgr, struct omap_crtc, mgr); 113 struct omap_crtc *omap_crtc = omap_crtcs[mgr->id];
111 DBG("%s", omap_crtc->name); 114 DBG("%s", omap_crtc->name);
112 omap_crtc->timings = *timings; 115 omap_crtc->timings = *timings;
113 omap_crtc->full_update = true; 116 omap_crtc->full_update = true;
@@ -116,7 +119,7 @@ static void omap_crtc_set_timings(struct omap_overlay_manager *mgr,
116static void omap_crtc_set_lcd_config(struct omap_overlay_manager *mgr, 119static void omap_crtc_set_lcd_config(struct omap_overlay_manager *mgr,
117 const struct dss_lcd_mgr_config *config) 120 const struct dss_lcd_mgr_config *config)
118{ 121{
119 struct omap_crtc *omap_crtc = container_of(mgr, struct omap_crtc, mgr); 122 struct omap_crtc *omap_crtc = omap_crtcs[mgr->id];
120 DBG("%s", omap_crtc->name); 123 DBG("%s", omap_crtc->name);
121 dispc_mgr_set_lcd_config(omap_crtc->channel, config); 124 dispc_mgr_set_lcd_config(omap_crtc->channel, config);
122} 125}
@@ -569,7 +572,7 @@ static void omap_crtc_pre_apply(struct omap_drm_apply *apply)
569 } else { 572 } else {
570 if (encoder) { 573 if (encoder) {
571 omap_encoder_set_enabled(encoder, false); 574 omap_encoder_set_enabled(encoder, false);
572 omap_encoder_update(encoder, &omap_crtc->mgr, 575 omap_encoder_update(encoder, omap_crtc->mgr,
573 &omap_crtc->timings); 576 &omap_crtc->timings);
574 omap_encoder_set_enabled(encoder, true); 577 omap_encoder_set_enabled(encoder, true);
575 omap_crtc->full_update = false; 578 omap_crtc->full_update = false;
@@ -595,6 +598,11 @@ static const char *channel_names[] = {
595 [OMAP_DSS_CHANNEL_LCD2] = "lcd2", 598 [OMAP_DSS_CHANNEL_LCD2] = "lcd2",
596}; 599};
597 600
601void omap_crtc_pre_init(void)
602{
603 dss_install_mgr_ops(&mgr_ops);
604}
605
598/* initialize crtc */ 606/* initialize crtc */
599struct drm_crtc *omap_crtc_init(struct drm_device *dev, 607struct drm_crtc *omap_crtc_init(struct drm_device *dev,
600 struct drm_plane *plane, enum omap_channel channel, int id) 608 struct drm_plane *plane, enum omap_channel channel, int id)
@@ -635,9 +643,7 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev,
635 omap_irq_register(dev, &omap_crtc->error_irq); 643 omap_irq_register(dev, &omap_crtc->error_irq);
636 644
637 /* temporary: */ 645 /* temporary: */
638 omap_crtc->mgr.id = channel; 646 omap_crtc->mgr = omap_dss_get_overlay_manager(channel);
639
640 dss_install_mgr_ops(&mgr_ops);
641 647
642 /* TODO: fix hard-coded setup.. add properties! */ 648 /* TODO: fix hard-coded setup.. add properties! */
643 info = &omap_crtc->info; 649 info = &omap_crtc->info;
@@ -651,6 +657,8 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev,
651 657
652 omap_plane_install_properties(omap_crtc->plane, &crtc->base); 658 omap_plane_install_properties(omap_crtc->plane, &crtc->base);
653 659
660 omap_crtcs[channel] = omap_crtc;
661
654 return crtc; 662 return crtc;
655 663
656fail: 664fail:
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index b3577cb367af..ff9b49276b81 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -98,6 +98,8 @@ static int omap_modeset_init(struct drm_device *dev)
98 int num_crtcs; 98 int num_crtcs;
99 int i, id = 0; 99 int i, id = 0;
100 100
101 omap_crtc_pre_init();
102
101 drm_mode_config_init(dev); 103 drm_mode_config_init(dev);
102 104
103 omap_drm_irq_install(dev); 105 omap_drm_irq_install(dev);
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h
index 215a20dd340c..14f17da2ce25 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.h
+++ b/drivers/gpu/drm/omapdrm/omap_drv.h
@@ -157,6 +157,7 @@ const struct omap_video_timings *omap_crtc_timings(struct drm_crtc *crtc);
157enum omap_channel omap_crtc_channel(struct drm_crtc *crtc); 157enum omap_channel omap_crtc_channel(struct drm_crtc *crtc);
158int omap_crtc_apply(struct drm_crtc *crtc, 158int omap_crtc_apply(struct drm_crtc *crtc,
159 struct omap_drm_apply *apply); 159 struct omap_drm_apply *apply);
160void omap_crtc_pre_init(void);
160struct drm_crtc *omap_crtc_init(struct drm_device *dev, 161struct drm_crtc *omap_crtc_init(struct drm_device *dev,
161 struct drm_plane *plane, enum omap_channel channel, int id); 162 struct drm_plane *plane, enum omap_channel channel, int id);
162 163
diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index 74d1d000e92d..c844071e8e28 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -1577,7 +1577,6 @@ int omapdss_compat_init(void)
1577 1577
1578 apply_init_priv(); 1578 apply_init_priv();
1579 1579
1580 dss_init_overlay_managers();
1581 dss_init_overlay_managers_sysfs(pdev); 1580 dss_init_overlay_managers_sysfs(pdev);
1582 dss_init_overlays(pdev); 1581 dss_init_overlays(pdev);
1583 1582
@@ -1642,7 +1641,6 @@ err_disp_sysfs:
1642 1641
1643err_mgr_ops: 1642err_mgr_ops:
1644 dss_uninit_overlay_managers_sysfs(pdev); 1643 dss_uninit_overlay_managers_sysfs(pdev);
1645 dss_uninit_overlay_managers();
1646 dss_uninit_overlays(pdev); 1644 dss_uninit_overlays(pdev);
1647 1645
1648 compat_refcnt--; 1646 compat_refcnt--;
@@ -1671,7 +1669,6 @@ void omapdss_compat_uninit(void)
1671 dss_uninstall_mgr_ops(); 1669 dss_uninstall_mgr_ops();
1672 1670
1673 dss_uninit_overlay_managers_sysfs(pdev); 1671 dss_uninit_overlay_managers_sysfs(pdev);
1674 dss_uninit_overlay_managers();
1675 dss_uninit_overlays(pdev); 1672 dss_uninit_overlays(pdev);
1676out: 1673out:
1677 mutex_unlock(&compat_init_lock); 1674 mutex_unlock(&compat_init_lock);
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index b33b0169bb3b..83d7bb9da609 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -3710,6 +3710,8 @@ static int __init omap_dispchw_probe(struct platform_device *pdev)
3710 3710
3711 dispc_runtime_put(); 3711 dispc_runtime_put();
3712 3712
3713 dss_init_overlay_managers();
3714
3713 dss_debugfs_create_file("dispc", dispc_dump_regs); 3715 dss_debugfs_create_file("dispc", dispc_dump_regs);
3714 3716
3715 return 0; 3717 return 0;
@@ -3723,6 +3725,8 @@ static int __exit omap_dispchw_remove(struct platform_device *pdev)
3723{ 3725{
3724 pm_runtime_disable(&pdev->dev); 3726 pm_runtime_disable(&pdev->dev);
3725 3727
3728 dss_uninit_overlay_managers();
3729
3726 return 0; 3730 return 0;
3727} 3731}
3728 3732