Commit 07e327c9 authored by Tomi Valkeinen's avatar Tomi Valkeinen

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: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
parent 5617ad09
...@@ -398,8 +398,7 @@ void dss_mgr_start_update(struct omap_overlay_manager *mgr) ...@@ -398,8 +398,7 @@ void dss_mgr_start_update(struct omap_overlay_manager *mgr)
{ {
struct manager_cache_data *mc; struct manager_cache_data *mc;
struct overlay_cache_data *oc; struct overlay_cache_data *oc;
const int num_ovls = dss_feat_get_num_ovls(); struct omap_overlay *ovl;
int i;
mc = &dss_cache.manager_cache[mgr->id]; mc = &dss_cache.manager_cache[mgr->id];
...@@ -407,11 +406,8 @@ void dss_mgr_start_update(struct omap_overlay_manager *mgr) ...@@ -407,11 +406,8 @@ void dss_mgr_start_update(struct omap_overlay_manager *mgr)
configure_dispc(); configure_dispc();
mc->do_manual_update = false; mc->do_manual_update = false;
for (i = 0; i < num_ovls; ++i) { list_for_each_entry(ovl, &mgr->overlays, list) {
oc = &dss_cache.overlay_cache[i]; oc = &dss_cache.overlay_cache[ovl->id];
if (oc->channel != mgr->id)
continue;
oc->shadow_dirty = false; oc->shadow_dirty = false;
} }
...@@ -584,8 +580,9 @@ static void omap_dss_mgr_apply_ovl_fifos(struct omap_overlay *ovl) ...@@ -584,8 +580,9 @@ static void omap_dss_mgr_apply_ovl_fifos(struct omap_overlay *ovl)
int omap_dss_mgr_apply(struct omap_overlay_manager *mgr) int omap_dss_mgr_apply(struct omap_overlay_manager *mgr)
{ {
int i, r; int r;
unsigned long flags; unsigned long flags;
struct omap_overlay *ovl;
DSSDBG("omap_dss_mgr_apply(%s)\n", mgr->name); DSSDBG("omap_dss_mgr_apply(%s)\n", mgr->name);
...@@ -596,31 +593,15 @@ int omap_dss_mgr_apply(struct omap_overlay_manager *mgr) ...@@ -596,31 +593,15 @@ int omap_dss_mgr_apply(struct omap_overlay_manager *mgr)
spin_lock_irqsave(&dss_cache.lock, flags); spin_lock_irqsave(&dss_cache.lock, flags);
/* Configure overlays */ /* Configure overlays */
for (i = 0; i < mgr->num_overlays; ++i) { list_for_each_entry(ovl, &mgr->overlays, list)
struct omap_overlay *ovl;
ovl = mgr->overlays[i];
if (ovl->manager != mgr)
continue;
omap_dss_mgr_apply_ovl(ovl); omap_dss_mgr_apply_ovl(ovl);
}
/* Configure manager */ /* Configure manager */
omap_dss_mgr_apply_mgr(mgr); omap_dss_mgr_apply_mgr(mgr);
/* Configure overlay fifos */ /* Configure overlay fifos */
for (i = 0; i < mgr->num_overlays; ++i) { list_for_each_entry(ovl, &mgr->overlays, list)
struct omap_overlay *ovl;
ovl = mgr->overlays[i];
if (ovl->manager != mgr)
continue;
omap_dss_mgr_apply_ovl_fifos(ovl); omap_dss_mgr_apply_ovl_fifos(ovl);
}
r = 0; r = 0;
if (mgr->enabled && !mgr_manual_update(mgr)) { if (mgr->enabled && !mgr_manual_update(mgr)) {
......
...@@ -470,8 +470,8 @@ static struct kobj_type manager_ktype = { ...@@ -470,8 +470,8 @@ static struct kobj_type manager_ktype = {
static int omap_dss_set_device(struct omap_overlay_manager *mgr, static int omap_dss_set_device(struct omap_overlay_manager *mgr,
struct omap_dss_device *dssdev) struct omap_dss_device *dssdev)
{ {
int i;
int r; int r;
struct omap_overlay *ovl;
if (dssdev->manager) { if (dssdev->manager) {
DSSERR("display '%s' already has a manager '%s'\n", 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,10 +485,8 @@ static int omap_dss_set_device(struct omap_overlay_manager *mgr,
return -EINVAL; return -EINVAL;
} }
for (i = 0; i < mgr->num_overlays; i++) { list_for_each_entry(ovl, &mgr->overlays, list) {
struct omap_overlay *ovl = mgr->overlays[i]; if (!ovl->info.enabled)
if (ovl->manager != mgr || !ovl->info.enabled)
continue; continue;
r = dss_check_overlay(ovl, dssdev); r = dss_check_overlay(ovl, dssdev);
...@@ -626,7 +624,7 @@ int dss_init_overlay_managers(struct platform_device *pdev) ...@@ -626,7 +624,7 @@ int dss_init_overlay_managers(struct platform_device *pdev)
mgr->supported_displays = mgr->supported_displays =
dss_feat_get_supported_displays(mgr->id); dss_feat_get_supported_displays(mgr->id);
dss_overlay_setup_dispc_manager(mgr); INIT_LIST_HEAD(&mgr->overlays);
r = kobject_init_and_add(&mgr->kobj, &manager_ktype, r = kobject_init_and_add(&mgr->kobj, &manager_ktype,
&pdev->dev.kobj, "manager%d", i); &pdev->dev.kobj, "manager%d", i);
......
...@@ -566,6 +566,7 @@ static int omap_dss_set_manager(struct omap_overlay *ovl, ...@@ -566,6 +566,7 @@ static int omap_dss_set_manager(struct omap_overlay *ovl,
} }
ovl->manager = mgr; ovl->manager = mgr;
list_add_tail(&ovl->list, &mgr->overlays);
ovl->manager_changed = true; ovl->manager_changed = true;
/* XXX: When there is an overlay on a DSI manual update display, and /* 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,6 +598,7 @@ static int omap_dss_unset_manager(struct omap_overlay *ovl)
} }
ovl->manager = NULL; ovl->manager = NULL;
list_del(&ovl->list);
ovl->manager_changed = true; ovl->manager_changed = true;
return 0; return 0;
...@@ -617,14 +619,6 @@ struct omap_overlay *omap_dss_get_overlay(int num) ...@@ -617,14 +619,6 @@ struct omap_overlay *omap_dss_get_overlay(int num)
} }
EXPORT_SYMBOL(omap_dss_get_overlay); EXPORT_SYMBOL(omap_dss_get_overlay);
static struct omap_overlay *dispc_overlays[MAX_DSS_OVERLAYS];
void dss_overlay_setup_dispc_manager(struct omap_overlay_manager *mgr)
{
mgr->num_overlays = dss_feat_get_num_ovls();
mgr->overlays = dispc_overlays;
}
void dss_init_overlays(struct platform_device *pdev) void dss_init_overlays(struct platform_device *pdev)
{ {
int i, r; int i, r;
...@@ -684,8 +678,6 @@ void dss_init_overlays(struct platform_device *pdev) ...@@ -684,8 +678,6 @@ void dss_init_overlays(struct platform_device *pdev)
if (r) if (r)
DSSERR("failed to create sysfs file\n"); DSSERR("failed to create sysfs file\n");
dispc_overlays[i] = ovl;
} }
} }
......
...@@ -423,8 +423,7 @@ struct omap_overlay_manager { ...@@ -423,8 +423,7 @@ struct omap_overlay_manager {
const char *name; const char *name;
enum omap_channel id; enum omap_channel id;
enum omap_overlay_manager_caps caps; enum omap_overlay_manager_caps caps;
int num_overlays; struct list_head overlays;
struct omap_overlay **overlays;
enum omap_display_type supported_displays; enum omap_display_type supported_displays;
/* dynamic fields */ /* dynamic fields */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment