diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2011-11-05 04:59:59 -0400 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2011-12-02 01:54:35 -0500 |
commit | 07e327c9c18b382656bf455051759be8182627ae (patch) | |
tree | 2f9988c87a01df6cd231a598160b334634247e0f | |
parent | 5617ad097959cb39b96d08af0a9b3d51215deaba (diff) |
OMAPDSS: store overlays in a list for each manager
Current way of handling overlay-manager links is a bit strange: each
manager has a static array, containing pointers to all the overlays
(even those used by other managers). The overlays contain a pointer to
the manager being used.
This patch makes the system a bit saner: each manager has a linked list
of overlays, and only the overlays linked to that manager are in the
list.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
-rw-r--r-- | drivers/video/omap2/dss/apply.c | 33 | ||||
-rw-r--r-- | drivers/video/omap2/dss/manager.c | 10 | ||||
-rw-r--r-- | drivers/video/omap2/dss/overlay.c | 12 | ||||
-rw-r--r-- | include/video/omapdss.h | 3 |
4 files changed, 14 insertions, 44 deletions
diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c index ba1f73c136ce..34879d0628bd 100644 --- a/drivers/video/omap2/dss/apply.c +++ b/drivers/video/omap2/dss/apply.c | |||
@@ -398,8 +398,7 @@ void dss_mgr_start_update(struct omap_overlay_manager *mgr) | |||
398 | { | 398 | { |
399 | struct manager_cache_data *mc; | 399 | struct manager_cache_data *mc; |
400 | struct overlay_cache_data *oc; | 400 | struct overlay_cache_data *oc; |
401 | const int num_ovls = dss_feat_get_num_ovls(); | 401 | struct omap_overlay *ovl; |
402 | int i; | ||
403 | 402 | ||
404 | mc = &dss_cache.manager_cache[mgr->id]; | 403 | mc = &dss_cache.manager_cache[mgr->id]; |
405 | 404 | ||
@@ -407,11 +406,8 @@ void dss_mgr_start_update(struct omap_overlay_manager *mgr) | |||
407 | configure_dispc(); | 406 | configure_dispc(); |
408 | mc->do_manual_update = false; | 407 | mc->do_manual_update = false; |
409 | 408 | ||
410 | for (i = 0; i < num_ovls; ++i) { | 409 | list_for_each_entry(ovl, &mgr->overlays, list) { |
411 | oc = &dss_cache.overlay_cache[i]; | 410 | oc = &dss_cache.overlay_cache[ovl->id]; |
412 | if (oc->channel != mgr->id) | ||
413 | continue; | ||
414 | |||
415 | oc->shadow_dirty = false; | 411 | oc->shadow_dirty = false; |
416 | } | 412 | } |
417 | 413 | ||
@@ -584,8 +580,9 @@ static void omap_dss_mgr_apply_ovl_fifos(struct omap_overlay *ovl) | |||
584 | 580 | ||
585 | int omap_dss_mgr_apply(struct omap_overlay_manager *mgr) | 581 | int omap_dss_mgr_apply(struct omap_overlay_manager *mgr) |
586 | { | 582 | { |
587 | int i, r; | 583 | int r; |
588 | unsigned long flags; | 584 | unsigned long flags; |
585 | struct omap_overlay *ovl; | ||
589 | 586 | ||
590 | DSSDBG("omap_dss_mgr_apply(%s)\n", mgr->name); | 587 | DSSDBG("omap_dss_mgr_apply(%s)\n", mgr->name); |
591 | 588 | ||
@@ -596,31 +593,15 @@ int omap_dss_mgr_apply(struct omap_overlay_manager *mgr) | |||
596 | spin_lock_irqsave(&dss_cache.lock, flags); | 593 | spin_lock_irqsave(&dss_cache.lock, flags); |
597 | 594 | ||
598 | /* Configure overlays */ | 595 | /* Configure overlays */ |
599 | for (i = 0; i < mgr->num_overlays; ++i) { | 596 | list_for_each_entry(ovl, &mgr->overlays, list) |
600 | struct omap_overlay *ovl; | ||
601 | |||
602 | ovl = mgr->overlays[i]; | ||
603 | |||
604 | if (ovl->manager != mgr) | ||
605 | continue; | ||
606 | |||
607 | omap_dss_mgr_apply_ovl(ovl); | 597 | omap_dss_mgr_apply_ovl(ovl); |
608 | } | ||
609 | 598 | ||
610 | /* Configure manager */ | 599 | /* Configure manager */ |
611 | omap_dss_mgr_apply_mgr(mgr); | 600 | omap_dss_mgr_apply_mgr(mgr); |
612 | 601 | ||
613 | /* Configure overlay fifos */ | 602 | /* Configure overlay fifos */ |
614 | for (i = 0; i < mgr->num_overlays; ++i) { | 603 | list_for_each_entry(ovl, &mgr->overlays, list) |
615 | struct omap_overlay *ovl; | ||
616 | |||
617 | ovl = mgr->overlays[i]; | ||
618 | |||
619 | if (ovl->manager != mgr) | ||
620 | continue; | ||
621 | |||
622 | omap_dss_mgr_apply_ovl_fifos(ovl); | 604 | omap_dss_mgr_apply_ovl_fifos(ovl); |
623 | } | ||
624 | 605 | ||
625 | r = 0; | 606 | r = 0; |
626 | if (mgr->enabled && !mgr_manual_update(mgr)) { | 607 | if (mgr->enabled && !mgr_manual_update(mgr)) { |
diff --git a/drivers/video/omap2/dss/manager.c b/drivers/video/omap2/dss/manager.c index a08cc6e7f5ca..62bcc384e7ae 100644 --- a/drivers/video/omap2/dss/manager.c +++ b/drivers/video/omap2/dss/manager.c | |||
@@ -470,8 +470,8 @@ static struct kobj_type manager_ktype = { | |||
470 | static int omap_dss_set_device(struct omap_overlay_manager *mgr, | 470 | static int omap_dss_set_device(struct omap_overlay_manager *mgr, |
471 | struct omap_dss_device *dssdev) | 471 | struct omap_dss_device *dssdev) |
472 | { | 472 | { |
473 | int i; | ||
474 | int r; | 473 | int r; |
474 | struct omap_overlay *ovl; | ||
475 | 475 | ||
476 | if (dssdev->manager) { | 476 | if (dssdev->manager) { |
477 | DSSERR("display '%s' already has a manager '%s'\n", | 477 | DSSERR("display '%s' already has a manager '%s'\n", |
@@ -485,10 +485,8 @@ static int omap_dss_set_device(struct omap_overlay_manager *mgr, | |||
485 | return -EINVAL; | 485 | return -EINVAL; |
486 | } | 486 | } |
487 | 487 | ||
488 | for (i = 0; i < mgr->num_overlays; i++) { | 488 | list_for_each_entry(ovl, &mgr->overlays, list) { |
489 | struct omap_overlay *ovl = mgr->overlays[i]; | 489 | if (!ovl->info.enabled) |
490 | |||
491 | if (ovl->manager != mgr || !ovl->info.enabled) | ||
492 | continue; | 490 | continue; |
493 | 491 | ||
494 | r = dss_check_overlay(ovl, dssdev); | 492 | r = dss_check_overlay(ovl, dssdev); |
@@ -626,7 +624,7 @@ int dss_init_overlay_managers(struct platform_device *pdev) | |||
626 | mgr->supported_displays = | 624 | mgr->supported_displays = |
627 | dss_feat_get_supported_displays(mgr->id); | 625 | dss_feat_get_supported_displays(mgr->id); |
628 | 626 | ||
629 | dss_overlay_setup_dispc_manager(mgr); | 627 | INIT_LIST_HEAD(&mgr->overlays); |
630 | 628 | ||
631 | r = kobject_init_and_add(&mgr->kobj, &manager_ktype, | 629 | r = kobject_init_and_add(&mgr->kobj, &manager_ktype, |
632 | &pdev->dev.kobj, "manager%d", i); | 630 | &pdev->dev.kobj, "manager%d", i); |
diff --git a/drivers/video/omap2/dss/overlay.c b/drivers/video/omap2/dss/overlay.c index ccd6127d2eef..3c940654ef91 100644 --- a/drivers/video/omap2/dss/overlay.c +++ b/drivers/video/omap2/dss/overlay.c | |||
@@ -566,6 +566,7 @@ static int omap_dss_set_manager(struct omap_overlay *ovl, | |||
566 | } | 566 | } |
567 | 567 | ||
568 | ovl->manager = mgr; | 568 | ovl->manager = mgr; |
569 | list_add_tail(&ovl->list, &mgr->overlays); | ||
569 | ovl->manager_changed = true; | 570 | ovl->manager_changed = true; |
570 | 571 | ||
571 | /* XXX: When there is an overlay on a DSI manual update display, and | 572 | /* XXX: When there is an overlay on a DSI manual update display, and |
@@ -597,6 +598,7 @@ static int omap_dss_unset_manager(struct omap_overlay *ovl) | |||
597 | } | 598 | } |
598 | 599 | ||
599 | ovl->manager = NULL; | 600 | ovl->manager = NULL; |
601 | list_del(&ovl->list); | ||
600 | ovl->manager_changed = true; | 602 | ovl->manager_changed = true; |
601 | 603 | ||
602 | return 0; | 604 | return 0; |
@@ -617,14 +619,6 @@ struct omap_overlay *omap_dss_get_overlay(int num) | |||
617 | } | 619 | } |
618 | EXPORT_SYMBOL(omap_dss_get_overlay); | 620 | EXPORT_SYMBOL(omap_dss_get_overlay); |
619 | 621 | ||
620 | static struct omap_overlay *dispc_overlays[MAX_DSS_OVERLAYS]; | ||
621 | |||
622 | void dss_overlay_setup_dispc_manager(struct omap_overlay_manager *mgr) | ||
623 | { | ||
624 | mgr->num_overlays = dss_feat_get_num_ovls(); | ||
625 | mgr->overlays = dispc_overlays; | ||
626 | } | ||
627 | |||
628 | void dss_init_overlays(struct platform_device *pdev) | 622 | void dss_init_overlays(struct platform_device *pdev) |
629 | { | 623 | { |
630 | int i, r; | 624 | int i, r; |
@@ -684,8 +678,6 @@ void dss_init_overlays(struct platform_device *pdev) | |||
684 | 678 | ||
685 | if (r) | 679 | if (r) |
686 | DSSERR("failed to create sysfs file\n"); | 680 | DSSERR("failed to create sysfs file\n"); |
687 | |||
688 | dispc_overlays[i] = ovl; | ||
689 | } | 681 | } |
690 | } | 682 | } |
691 | 683 | ||
diff --git a/include/video/omapdss.h b/include/video/omapdss.h index fd5a96c5ecc5..eaeca89de152 100644 --- a/include/video/omapdss.h +++ b/include/video/omapdss.h | |||
@@ -423,8 +423,7 @@ struct omap_overlay_manager { | |||
423 | const char *name; | 423 | const char *name; |
424 | enum omap_channel id; | 424 | enum omap_channel id; |
425 | enum omap_overlay_manager_caps caps; | 425 | enum omap_overlay_manager_caps caps; |
426 | int num_overlays; | 426 | struct list_head overlays; |
427 | struct omap_overlay **overlays; | ||
428 | enum omap_display_type supported_displays; | 427 | enum omap_display_type supported_displays; |
429 | 428 | ||
430 | /* dynamic fields */ | 429 | /* dynamic fields */ |