include: replace linux/module.h with "struct module" wherever possible
[linux-2.6/next.git] / drivers / video / omap2 / dss / manager.c
blob13d72d5c714b10f5aa41e074b0640769989b93b5
1 /*
2 * linux/drivers/video/omap2/dss/manager.c
4 * Copyright (C) 2009 Nokia Corporation
5 * Author: Tomi Valkeinen <tomi.valkeinen@nokia.com>
7 * Some code and ideas taken from drivers/video/omap/ driver
8 * by Imre Deak.
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License version 2 as published by
12 * the Free Software Foundation.
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 * more details.
19 * You should have received a copy of the GNU General Public License along with
20 * this program. If not, see <http://www.gnu.org/licenses/>.
23 #define DSS_SUBSYS_NAME "MANAGER"
25 #include <linux/kernel.h>
26 #include <linux/slab.h>
27 #include <linux/module.h>
28 #include <linux/platform_device.h>
29 #include <linux/spinlock.h>
30 #include <linux/jiffies.h>
32 #include <video/omapdss.h>
33 #include <plat/cpu.h>
35 #include "dss.h"
36 #include "dss_features.h"
38 static int num_managers;
39 static struct list_head manager_list;
41 static ssize_t manager_name_show(struct omap_overlay_manager *mgr, char *buf)
43 return snprintf(buf, PAGE_SIZE, "%s\n", mgr->name);
46 static ssize_t manager_display_show(struct omap_overlay_manager *mgr, char *buf)
48 return snprintf(buf, PAGE_SIZE, "%s\n",
49 mgr->device ? mgr->device->name : "<none>");
52 static ssize_t manager_display_store(struct omap_overlay_manager *mgr,
53 const char *buf, size_t size)
55 int r = 0;
56 size_t len = size;
57 struct omap_dss_device *dssdev = NULL;
59 int match(struct omap_dss_device *dssdev, void *data)
61 const char *str = data;
62 return sysfs_streq(dssdev->name, str);
65 if (buf[size-1] == '\n')
66 --len;
68 if (len > 0)
69 dssdev = omap_dss_find_device((void *)buf, match);
71 if (len > 0 && dssdev == NULL)
72 return -EINVAL;
74 if (dssdev)
75 DSSDBG("display %s found\n", dssdev->name);
77 if (mgr->device) {
78 r = mgr->unset_device(mgr);
79 if (r) {
80 DSSERR("failed to unset display\n");
81 goto put_device;
85 if (dssdev) {
86 r = mgr->set_device(mgr, dssdev);
87 if (r) {
88 DSSERR("failed to set manager\n");
89 goto put_device;
92 r = mgr->apply(mgr);
93 if (r) {
94 DSSERR("failed to apply dispc config\n");
95 goto put_device;
99 put_device:
100 if (dssdev)
101 omap_dss_put_device(dssdev);
103 return r ? r : size;
106 static ssize_t manager_default_color_show(struct omap_overlay_manager *mgr,
107 char *buf)
109 return snprintf(buf, PAGE_SIZE, "%d\n", mgr->info.default_color);
112 static ssize_t manager_default_color_store(struct omap_overlay_manager *mgr,
113 const char *buf, size_t size)
115 struct omap_overlay_manager_info info;
116 u32 color;
117 int r;
119 if (sscanf(buf, "%d", &color) != 1)
120 return -EINVAL;
122 mgr->get_manager_info(mgr, &info);
124 info.default_color = color;
126 r = mgr->set_manager_info(mgr, &info);
127 if (r)
128 return r;
130 r = mgr->apply(mgr);
131 if (r)
132 return r;
134 return size;
137 static const char *trans_key_type_str[] = {
138 "gfx-destination",
139 "video-source",
142 static ssize_t manager_trans_key_type_show(struct omap_overlay_manager *mgr,
143 char *buf)
145 enum omap_dss_trans_key_type key_type;
147 key_type = mgr->info.trans_key_type;
148 BUG_ON(key_type >= ARRAY_SIZE(trans_key_type_str));
150 return snprintf(buf, PAGE_SIZE, "%s\n", trans_key_type_str[key_type]);
153 static ssize_t manager_trans_key_type_store(struct omap_overlay_manager *mgr,
154 const char *buf, size_t size)
156 enum omap_dss_trans_key_type key_type;
157 struct omap_overlay_manager_info info;
158 int r;
160 for (key_type = OMAP_DSS_COLOR_KEY_GFX_DST;
161 key_type < ARRAY_SIZE(trans_key_type_str); key_type++) {
162 if (sysfs_streq(buf, trans_key_type_str[key_type]))
163 break;
166 if (key_type == ARRAY_SIZE(trans_key_type_str))
167 return -EINVAL;
169 mgr->get_manager_info(mgr, &info);
171 info.trans_key_type = key_type;
173 r = mgr->set_manager_info(mgr, &info);
174 if (r)
175 return r;
177 r = mgr->apply(mgr);
178 if (r)
179 return r;
181 return size;
184 static ssize_t manager_trans_key_value_show(struct omap_overlay_manager *mgr,
185 char *buf)
187 return snprintf(buf, PAGE_SIZE, "%d\n", mgr->info.trans_key);
190 static ssize_t manager_trans_key_value_store(struct omap_overlay_manager *mgr,
191 const char *buf, size_t size)
193 struct omap_overlay_manager_info info;
194 u32 key_value;
195 int r;
197 if (sscanf(buf, "%d", &key_value) != 1)
198 return -EINVAL;
200 mgr->get_manager_info(mgr, &info);
202 info.trans_key = key_value;
204 r = mgr->set_manager_info(mgr, &info);
205 if (r)
206 return r;
208 r = mgr->apply(mgr);
209 if (r)
210 return r;
212 return size;
215 static ssize_t manager_trans_key_enabled_show(struct omap_overlay_manager *mgr,
216 char *buf)
218 return snprintf(buf, PAGE_SIZE, "%d\n", mgr->info.trans_enabled);
221 static ssize_t manager_trans_key_enabled_store(struct omap_overlay_manager *mgr,
222 const char *buf, size_t size)
224 struct omap_overlay_manager_info info;
225 int enable;
226 int r;
228 if (sscanf(buf, "%d", &enable) != 1)
229 return -EINVAL;
231 mgr->get_manager_info(mgr, &info);
233 info.trans_enabled = enable ? true : false;
235 r = mgr->set_manager_info(mgr, &info);
236 if (r)
237 return r;
239 r = mgr->apply(mgr);
240 if (r)
241 return r;
243 return size;
246 static ssize_t manager_alpha_blending_enabled_show(
247 struct omap_overlay_manager *mgr, char *buf)
249 return snprintf(buf, PAGE_SIZE, "%d\n", mgr->info.alpha_enabled);
252 static ssize_t manager_alpha_blending_enabled_store(
253 struct omap_overlay_manager *mgr,
254 const char *buf, size_t size)
256 struct omap_overlay_manager_info info;
257 int enable;
258 int r;
260 if (sscanf(buf, "%d", &enable) != 1)
261 return -EINVAL;
263 mgr->get_manager_info(mgr, &info);
265 info.alpha_enabled = enable ? true : false;
267 r = mgr->set_manager_info(mgr, &info);
268 if (r)
269 return r;
271 r = mgr->apply(mgr);
272 if (r)
273 return r;
275 return size;
278 static ssize_t manager_cpr_enable_show(struct omap_overlay_manager *mgr,
279 char *buf)
281 return snprintf(buf, PAGE_SIZE, "%d\n", mgr->info.cpr_enable);
284 static ssize_t manager_cpr_enable_store(struct omap_overlay_manager *mgr,
285 const char *buf, size_t size)
287 struct omap_overlay_manager_info info;
288 int v;
289 int r;
290 bool enable;
292 if (!dss_has_feature(FEAT_CPR))
293 return -ENODEV;
295 r = kstrtoint(buf, 0, &v);
296 if (r)
297 return r;
299 enable = !!v;
301 mgr->get_manager_info(mgr, &info);
303 if (info.cpr_enable == enable)
304 return size;
306 info.cpr_enable = enable;
308 r = mgr->set_manager_info(mgr, &info);
309 if (r)
310 return r;
312 r = mgr->apply(mgr);
313 if (r)
314 return r;
316 return size;
319 static ssize_t manager_cpr_coef_show(struct omap_overlay_manager *mgr,
320 char *buf)
322 struct omap_overlay_manager_info info;
324 mgr->get_manager_info(mgr, &info);
326 return snprintf(buf, PAGE_SIZE,
327 "%d %d %d %d %d %d %d %d %d\n",
328 info.cpr_coefs.rr,
329 info.cpr_coefs.rg,
330 info.cpr_coefs.rb,
331 info.cpr_coefs.gr,
332 info.cpr_coefs.gg,
333 info.cpr_coefs.gb,
334 info.cpr_coefs.br,
335 info.cpr_coefs.bg,
336 info.cpr_coefs.bb);
339 static ssize_t manager_cpr_coef_store(struct omap_overlay_manager *mgr,
340 const char *buf, size_t size)
342 struct omap_overlay_manager_info info;
343 struct omap_dss_cpr_coefs coefs;
344 int r, i;
345 s16 *arr;
347 if (!dss_has_feature(FEAT_CPR))
348 return -ENODEV;
350 if (sscanf(buf, "%hd %hd %hd %hd %hd %hd %hd %hd %hd",
351 &coefs.rr, &coefs.rg, &coefs.rb,
352 &coefs.gr, &coefs.gg, &coefs.gb,
353 &coefs.br, &coefs.bg, &coefs.bb) != 9)
354 return -EINVAL;
356 arr = (s16[]){ coefs.rr, coefs.rg, coefs.rb,
357 coefs.gr, coefs.gg, coefs.gb,
358 coefs.br, coefs.bg, coefs.bb };
360 for (i = 0; i < 9; ++i) {
361 if (arr[i] < -512 || arr[i] > 511)
362 return -EINVAL;
365 mgr->get_manager_info(mgr, &info);
367 info.cpr_coefs = coefs;
369 r = mgr->set_manager_info(mgr, &info);
370 if (r)
371 return r;
373 r = mgr->apply(mgr);
374 if (r)
375 return r;
377 return size;
380 struct manager_attribute {
381 struct attribute attr;
382 ssize_t (*show)(struct omap_overlay_manager *, char *);
383 ssize_t (*store)(struct omap_overlay_manager *, const char *, size_t);
386 #define MANAGER_ATTR(_name, _mode, _show, _store) \
387 struct manager_attribute manager_attr_##_name = \
388 __ATTR(_name, _mode, _show, _store)
390 static MANAGER_ATTR(name, S_IRUGO, manager_name_show, NULL);
391 static MANAGER_ATTR(display, S_IRUGO|S_IWUSR,
392 manager_display_show, manager_display_store);
393 static MANAGER_ATTR(default_color, S_IRUGO|S_IWUSR,
394 manager_default_color_show, manager_default_color_store);
395 static MANAGER_ATTR(trans_key_type, S_IRUGO|S_IWUSR,
396 manager_trans_key_type_show, manager_trans_key_type_store);
397 static MANAGER_ATTR(trans_key_value, S_IRUGO|S_IWUSR,
398 manager_trans_key_value_show, manager_trans_key_value_store);
399 static MANAGER_ATTR(trans_key_enabled, S_IRUGO|S_IWUSR,
400 manager_trans_key_enabled_show,
401 manager_trans_key_enabled_store);
402 static MANAGER_ATTR(alpha_blending_enabled, S_IRUGO|S_IWUSR,
403 manager_alpha_blending_enabled_show,
404 manager_alpha_blending_enabled_store);
405 static MANAGER_ATTR(cpr_enable, S_IRUGO|S_IWUSR,
406 manager_cpr_enable_show,
407 manager_cpr_enable_store);
408 static MANAGER_ATTR(cpr_coef, S_IRUGO|S_IWUSR,
409 manager_cpr_coef_show,
410 manager_cpr_coef_store);
413 static struct attribute *manager_sysfs_attrs[] = {
414 &manager_attr_name.attr,
415 &manager_attr_display.attr,
416 &manager_attr_default_color.attr,
417 &manager_attr_trans_key_type.attr,
418 &manager_attr_trans_key_value.attr,
419 &manager_attr_trans_key_enabled.attr,
420 &manager_attr_alpha_blending_enabled.attr,
421 &manager_attr_cpr_enable.attr,
422 &manager_attr_cpr_coef.attr,
423 NULL
426 static ssize_t manager_attr_show(struct kobject *kobj, struct attribute *attr,
427 char *buf)
429 struct omap_overlay_manager *manager;
430 struct manager_attribute *manager_attr;
432 manager = container_of(kobj, struct omap_overlay_manager, kobj);
433 manager_attr = container_of(attr, struct manager_attribute, attr);
435 if (!manager_attr->show)
436 return -ENOENT;
438 return manager_attr->show(manager, buf);
441 static ssize_t manager_attr_store(struct kobject *kobj, struct attribute *attr,
442 const char *buf, size_t size)
444 struct omap_overlay_manager *manager;
445 struct manager_attribute *manager_attr;
447 manager = container_of(kobj, struct omap_overlay_manager, kobj);
448 manager_attr = container_of(attr, struct manager_attribute, attr);
450 if (!manager_attr->store)
451 return -ENOENT;
453 return manager_attr->store(manager, buf, size);
456 static const struct sysfs_ops manager_sysfs_ops = {
457 .show = manager_attr_show,
458 .store = manager_attr_store,
461 static struct kobj_type manager_ktype = {
462 .sysfs_ops = &manager_sysfs_ops,
463 .default_attrs = manager_sysfs_attrs,
467 * We have 4 levels of cache for the dispc settings. First two are in SW and
468 * the latter two in HW.
470 * +--------------------+
471 * |overlay/manager_info|
472 * +--------------------+
474 * apply()
476 * +--------------------+
477 * | dss_cache |
478 * +--------------------+
480 * configure()
482 * +--------------------+
483 * | shadow registers |
484 * +--------------------+
486 * VFP or lcd/digit_enable
488 * +--------------------+
489 * | registers |
490 * +--------------------+
493 struct overlay_cache_data {
494 /* If true, cache changed, but not written to shadow registers. Set
495 * in apply(), cleared when registers written. */
496 bool dirty;
497 /* If true, shadow registers contain changed values not yet in real
498 * registers. Set when writing to shadow registers, cleared at
499 * VSYNC/EVSYNC */
500 bool shadow_dirty;
502 bool enabled;
504 struct omap_overlay_info info;
506 enum omap_channel channel;
507 bool replication;
508 bool ilace;
510 u32 fifo_low;
511 u32 fifo_high;
514 struct manager_cache_data {
515 /* If true, cache changed, but not written to shadow registers. Set
516 * in apply(), cleared when registers written. */
517 bool dirty;
518 /* If true, shadow registers contain changed values not yet in real
519 * registers. Set when writing to shadow registers, cleared at
520 * VSYNC/EVSYNC */
521 bool shadow_dirty;
523 struct omap_overlay_manager_info info;
525 bool manual_update;
526 bool do_manual_update;
528 /* manual update region */
529 u16 x, y, w, h;
531 /* enlarge the update area if the update area contains scaled
532 * overlays */
533 bool enlarge_update_area;
536 static struct {
537 spinlock_t lock;
538 struct overlay_cache_data overlay_cache[MAX_DSS_OVERLAYS];
539 struct manager_cache_data manager_cache[MAX_DSS_MANAGERS];
541 bool irq_enabled;
542 } dss_cache;
546 static int omap_dss_set_device(struct omap_overlay_manager *mgr,
547 struct omap_dss_device *dssdev)
549 int i;
550 int r;
552 if (dssdev->manager) {
553 DSSERR("display '%s' already has a manager '%s'\n",
554 dssdev->name, dssdev->manager->name);
555 return -EINVAL;
558 if ((mgr->supported_displays & dssdev->type) == 0) {
559 DSSERR("display '%s' does not support manager '%s'\n",
560 dssdev->name, mgr->name);
561 return -EINVAL;
564 for (i = 0; i < mgr->num_overlays; i++) {
565 struct omap_overlay *ovl = mgr->overlays[i];
567 if (ovl->manager != mgr || !ovl->info.enabled)
568 continue;
570 r = dss_check_overlay(ovl, dssdev);
571 if (r)
572 return r;
575 dssdev->manager = mgr;
576 mgr->device = dssdev;
577 mgr->device_changed = true;
579 return 0;
582 static int omap_dss_unset_device(struct omap_overlay_manager *mgr)
584 if (!mgr->device) {
585 DSSERR("failed to unset display, display not set.\n");
586 return -EINVAL;
589 mgr->device->manager = NULL;
590 mgr->device = NULL;
591 mgr->device_changed = true;
593 return 0;
596 static int dss_mgr_wait_for_vsync(struct omap_overlay_manager *mgr)
598 unsigned long timeout = msecs_to_jiffies(500);
599 u32 irq;
601 if (mgr->device->type == OMAP_DISPLAY_TYPE_VENC) {
602 irq = DISPC_IRQ_EVSYNC_ODD;
603 } else if (mgr->device->type == OMAP_DISPLAY_TYPE_HDMI) {
604 irq = DISPC_IRQ_EVSYNC_EVEN;
605 } else {
606 if (mgr->id == OMAP_DSS_CHANNEL_LCD)
607 irq = DISPC_IRQ_VSYNC;
608 else
609 irq = DISPC_IRQ_VSYNC2;
611 return omap_dispc_wait_for_irq_interruptible_timeout(irq, timeout);
614 static int dss_mgr_wait_for_go(struct omap_overlay_manager *mgr)
616 unsigned long timeout = msecs_to_jiffies(500);
617 struct manager_cache_data *mc;
618 u32 irq;
619 int r;
620 int i;
621 struct omap_dss_device *dssdev = mgr->device;
623 if (!dssdev || dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
624 return 0;
626 if (dssdev->caps & OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE)
627 return 0;
629 if (dssdev->type == OMAP_DISPLAY_TYPE_VENC
630 || dssdev->type == OMAP_DISPLAY_TYPE_HDMI) {
631 irq = DISPC_IRQ_EVSYNC_ODD | DISPC_IRQ_EVSYNC_EVEN;
632 } else {
633 irq = (dssdev->manager->id == OMAP_DSS_CHANNEL_LCD) ?
634 DISPC_IRQ_VSYNC : DISPC_IRQ_VSYNC2;
637 mc = &dss_cache.manager_cache[mgr->id];
638 i = 0;
639 while (1) {
640 unsigned long flags;
641 bool shadow_dirty, dirty;
643 spin_lock_irqsave(&dss_cache.lock, flags);
644 dirty = mc->dirty;
645 shadow_dirty = mc->shadow_dirty;
646 spin_unlock_irqrestore(&dss_cache.lock, flags);
648 if (!dirty && !shadow_dirty) {
649 r = 0;
650 break;
653 /* 4 iterations is the worst case:
654 * 1 - initial iteration, dirty = true (between VFP and VSYNC)
655 * 2 - first VSYNC, dirty = true
656 * 3 - dirty = false, shadow_dirty = true
657 * 4 - shadow_dirty = false */
658 if (i++ == 3) {
659 DSSERR("mgr(%d)->wait_for_go() not finishing\n",
660 mgr->id);
661 r = 0;
662 break;
665 r = omap_dispc_wait_for_irq_interruptible_timeout(irq, timeout);
666 if (r == -ERESTARTSYS)
667 break;
669 if (r) {
670 DSSERR("mgr(%d)->wait_for_go() timeout\n", mgr->id);
671 break;
675 return r;
678 int dss_mgr_wait_for_go_ovl(struct omap_overlay *ovl)
680 unsigned long timeout = msecs_to_jiffies(500);
681 struct overlay_cache_data *oc;
682 struct omap_dss_device *dssdev;
683 u32 irq;
684 int r;
685 int i;
687 if (!ovl->manager)
688 return 0;
690 dssdev = ovl->manager->device;
692 if (!dssdev || dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
693 return 0;
695 if (dssdev->caps & OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE)
696 return 0;
698 if (dssdev->type == OMAP_DISPLAY_TYPE_VENC
699 || dssdev->type == OMAP_DISPLAY_TYPE_HDMI) {
700 irq = DISPC_IRQ_EVSYNC_ODD | DISPC_IRQ_EVSYNC_EVEN;
701 } else {
702 irq = (dssdev->manager->id == OMAP_DSS_CHANNEL_LCD) ?
703 DISPC_IRQ_VSYNC : DISPC_IRQ_VSYNC2;
706 oc = &dss_cache.overlay_cache[ovl->id];
707 i = 0;
708 while (1) {
709 unsigned long flags;
710 bool shadow_dirty, dirty;
712 spin_lock_irqsave(&dss_cache.lock, flags);
713 dirty = oc->dirty;
714 shadow_dirty = oc->shadow_dirty;
715 spin_unlock_irqrestore(&dss_cache.lock, flags);
717 if (!dirty && !shadow_dirty) {
718 r = 0;
719 break;
722 /* 4 iterations is the worst case:
723 * 1 - initial iteration, dirty = true (between VFP and VSYNC)
724 * 2 - first VSYNC, dirty = true
725 * 3 - dirty = false, shadow_dirty = true
726 * 4 - shadow_dirty = false */
727 if (i++ == 3) {
728 DSSERR("ovl(%d)->wait_for_go() not finishing\n",
729 ovl->id);
730 r = 0;
731 break;
734 r = omap_dispc_wait_for_irq_interruptible_timeout(irq, timeout);
735 if (r == -ERESTARTSYS)
736 break;
738 if (r) {
739 DSSERR("ovl(%d)->wait_for_go() timeout\n", ovl->id);
740 break;
744 return r;
747 static int overlay_enabled(struct omap_overlay *ovl)
749 return ovl->info.enabled && ovl->manager && ovl->manager->device;
752 /* Is rect1 a subset of rect2? */
753 static bool rectangle_subset(int x1, int y1, int w1, int h1,
754 int x2, int y2, int w2, int h2)
756 if (x1 < x2 || y1 < y2)
757 return false;
759 if (x1 + w1 > x2 + w2)
760 return false;
762 if (y1 + h1 > y2 + h2)
763 return false;
765 return true;
768 /* Do rect1 and rect2 overlap? */
769 static bool rectangle_intersects(int x1, int y1, int w1, int h1,
770 int x2, int y2, int w2, int h2)
772 if (x1 >= x2 + w2)
773 return false;
775 if (x2 >= x1 + w1)
776 return false;
778 if (y1 >= y2 + h2)
779 return false;
781 if (y2 >= y1 + h1)
782 return false;
784 return true;
787 static bool dispc_is_overlay_scaled(struct overlay_cache_data *oc)
789 struct omap_overlay_info *oi = &oc->info;
791 if (oi->out_width != 0 && oi->width != oi->out_width)
792 return true;
794 if (oi->out_height != 0 && oi->height != oi->out_height)
795 return true;
797 return false;
800 static int configure_overlay(enum omap_plane plane)
802 struct overlay_cache_data *c;
803 struct manager_cache_data *mc;
804 struct omap_overlay_info *oi;
805 struct omap_overlay_manager_info *mi;
806 u16 outw, outh;
807 u16 x, y, w, h;
808 u32 paddr;
809 int r;
810 u16 orig_w, orig_h, orig_outw, orig_outh;
812 DSSDBGF("%d", plane);
814 c = &dss_cache.overlay_cache[plane];
815 oi = &c->info;
817 if (!c->enabled) {
818 dispc_enable_plane(plane, 0);
819 return 0;
822 mc = &dss_cache.manager_cache[c->channel];
823 mi = &mc->info;
825 x = oi->pos_x;
826 y = oi->pos_y;
827 w = oi->width;
828 h = oi->height;
829 outw = oi->out_width == 0 ? oi->width : oi->out_width;
830 outh = oi->out_height == 0 ? oi->height : oi->out_height;
831 paddr = oi->paddr;
833 orig_w = w;
834 orig_h = h;
835 orig_outw = outw;
836 orig_outh = outh;
838 if (mc->manual_update && mc->do_manual_update) {
839 unsigned bpp;
840 unsigned scale_x_m = w, scale_x_d = outw;
841 unsigned scale_y_m = h, scale_y_d = outh;
843 /* If the overlay is outside the update region, disable it */
844 if (!rectangle_intersects(mc->x, mc->y, mc->w, mc->h,
845 x, y, outw, outh)) {
846 dispc_enable_plane(plane, 0);
847 return 0;
850 switch (oi->color_mode) {
851 case OMAP_DSS_COLOR_NV12:
852 bpp = 8;
853 break;
854 case OMAP_DSS_COLOR_RGB16:
855 case OMAP_DSS_COLOR_ARGB16:
856 case OMAP_DSS_COLOR_YUV2:
857 case OMAP_DSS_COLOR_UYVY:
858 case OMAP_DSS_COLOR_RGBA16:
859 case OMAP_DSS_COLOR_RGBX16:
860 case OMAP_DSS_COLOR_ARGB16_1555:
861 case OMAP_DSS_COLOR_XRGB16_1555:
862 bpp = 16;
863 break;
865 case OMAP_DSS_COLOR_RGB24P:
866 bpp = 24;
867 break;
869 case OMAP_DSS_COLOR_RGB24U:
870 case OMAP_DSS_COLOR_ARGB32:
871 case OMAP_DSS_COLOR_RGBA32:
872 case OMAP_DSS_COLOR_RGBX32:
873 bpp = 32;
874 break;
876 default:
877 BUG();
880 if (mc->x > oi->pos_x) {
881 x = 0;
882 outw -= (mc->x - oi->pos_x);
883 paddr += (mc->x - oi->pos_x) *
884 scale_x_m / scale_x_d * bpp / 8;
885 } else {
886 x = oi->pos_x - mc->x;
889 if (mc->y > oi->pos_y) {
890 y = 0;
891 outh -= (mc->y - oi->pos_y);
892 paddr += (mc->y - oi->pos_y) *
893 scale_y_m / scale_y_d *
894 oi->screen_width * bpp / 8;
895 } else {
896 y = oi->pos_y - mc->y;
899 if (mc->w < (x + outw))
900 outw -= (x + outw) - (mc->w);
902 if (mc->h < (y + outh))
903 outh -= (y + outh) - (mc->h);
905 w = w * outw / orig_outw;
906 h = h * outh / orig_outh;
908 /* YUV mode overlay's input width has to be even and the
909 * algorithm above may adjust the width to be odd.
911 * Here we adjust the width if needed, preferring to increase
912 * the width if the original width was bigger.
914 if ((w & 1) &&
915 (oi->color_mode == OMAP_DSS_COLOR_YUV2 ||
916 oi->color_mode == OMAP_DSS_COLOR_UYVY)) {
917 if (orig_w > w)
918 w += 1;
919 else
920 w -= 1;
924 r = dispc_setup_plane(plane,
925 paddr,
926 oi->screen_width,
927 x, y,
928 w, h,
929 outw, outh,
930 oi->color_mode,
931 c->ilace,
932 oi->rotation_type,
933 oi->rotation,
934 oi->mirror,
935 oi->global_alpha,
936 oi->pre_mult_alpha,
937 c->channel,
938 oi->p_uv_addr);
940 if (r) {
941 /* this shouldn't happen */
942 DSSERR("dispc_setup_plane failed for ovl %d\n", plane);
943 dispc_enable_plane(plane, 0);
944 return r;
947 dispc_enable_replication(plane, c->replication);
949 dispc_set_fifo_threshold(plane, c->fifo_low, c->fifo_high);
951 dispc_enable_plane(plane, 1);
953 return 0;
956 static void configure_manager(enum omap_channel channel)
958 struct omap_overlay_manager_info *mi;
960 DSSDBGF("%d", channel);
962 /* picking info from the cache */
963 mi = &dss_cache.manager_cache[channel].info;
965 dispc_set_default_color(channel, mi->default_color);
966 dispc_set_trans_key(channel, mi->trans_key_type, mi->trans_key);
967 dispc_enable_trans_key(channel, mi->trans_enabled);
968 dispc_enable_alpha_blending(channel, mi->alpha_enabled);
969 if (dss_has_feature(FEAT_CPR)) {
970 dispc_enable_cpr(channel, mi->cpr_enable);
971 dispc_set_cpr_coef(channel, &mi->cpr_coefs);
975 /* configure_dispc() tries to write values from cache to shadow registers.
976 * It writes only to those managers/overlays that are not busy.
977 * returns 0 if everything could be written to shadow registers.
978 * returns 1 if not everything could be written to shadow registers. */
979 static int configure_dispc(void)
981 struct overlay_cache_data *oc;
982 struct manager_cache_data *mc;
983 const int num_ovls = dss_feat_get_num_ovls();
984 const int num_mgrs = dss_feat_get_num_mgrs();
985 int i;
986 int r;
987 bool mgr_busy[MAX_DSS_MANAGERS];
988 bool mgr_go[MAX_DSS_MANAGERS];
989 bool busy;
991 r = 0;
992 busy = false;
994 for (i = 0; i < num_mgrs; i++) {
995 mgr_busy[i] = dispc_go_busy(i);
996 mgr_go[i] = false;
999 /* Commit overlay settings */
1000 for (i = 0; i < num_ovls; ++i) {
1001 oc = &dss_cache.overlay_cache[i];
1002 mc = &dss_cache.manager_cache[oc->channel];
1004 if (!oc->dirty)
1005 continue;
1007 if (mc->manual_update && !mc->do_manual_update)
1008 continue;
1010 if (mgr_busy[oc->channel]) {
1011 busy = true;
1012 continue;
1015 r = configure_overlay(i);
1016 if (r)
1017 DSSERR("configure_overlay %d failed\n", i);
1019 oc->dirty = false;
1020 oc->shadow_dirty = true;
1021 mgr_go[oc->channel] = true;
1024 /* Commit manager settings */
1025 for (i = 0; i < num_mgrs; ++i) {
1026 mc = &dss_cache.manager_cache[i];
1028 if (!mc->dirty)
1029 continue;
1031 if (mc->manual_update && !mc->do_manual_update)
1032 continue;
1034 if (mgr_busy[i]) {
1035 busy = true;
1036 continue;
1039 configure_manager(i);
1040 mc->dirty = false;
1041 mc->shadow_dirty = true;
1042 mgr_go[i] = true;
1045 /* set GO */
1046 for (i = 0; i < num_mgrs; ++i) {
1047 mc = &dss_cache.manager_cache[i];
1049 if (!mgr_go[i])
1050 continue;
1052 /* We don't need GO with manual update display. LCD iface will
1053 * always be turned off after frame, and new settings will be
1054 * taken in to use at next update */
1055 if (!mc->manual_update)
1056 dispc_go(i);
1059 if (busy)
1060 r = 1;
1061 else
1062 r = 0;
1064 return r;
1067 /* Make the coordinates even. There are some strange problems with OMAP and
1068 * partial DSI update when the update widths are odd. */
1069 static void make_even(u16 *x, u16 *w)
1071 u16 x1, x2;
1073 x1 = *x;
1074 x2 = *x + *w;
1076 x1 &= ~1;
1077 x2 = ALIGN(x2, 2);
1079 *x = x1;
1080 *w = x2 - x1;
1083 /* Configure dispc for partial update. Return possibly modified update
1084 * area */
1085 void dss_setup_partial_planes(struct omap_dss_device *dssdev,
1086 u16 *xi, u16 *yi, u16 *wi, u16 *hi, bool enlarge_update_area)
1088 struct overlay_cache_data *oc;
1089 struct manager_cache_data *mc;
1090 struct omap_overlay_info *oi;
1091 const int num_ovls = dss_feat_get_num_ovls();
1092 struct omap_overlay_manager *mgr;
1093 int i;
1094 u16 x, y, w, h;
1095 unsigned long flags;
1096 bool area_changed;
1098 x = *xi;
1099 y = *yi;
1100 w = *wi;
1101 h = *hi;
1103 DSSDBG("dispc_setup_partial_planes %d,%d %dx%d\n",
1104 *xi, *yi, *wi, *hi);
1106 mgr = dssdev->manager;
1108 if (!mgr) {
1109 DSSDBG("no manager\n");
1110 return;
1113 make_even(&x, &w);
1115 spin_lock_irqsave(&dss_cache.lock, flags);
1118 * Execute the outer loop until the inner loop has completed
1119 * once without increasing the update area. This will ensure that
1120 * all scaled overlays end up completely within the update area.
1122 do {
1123 area_changed = false;
1125 /* We need to show the whole overlay if it is scaled. So look
1126 * for those, and make the update area larger if found.
1127 * Also mark the overlay cache dirty */
1128 for (i = 0; i < num_ovls; ++i) {
1129 unsigned x1, y1, x2, y2;
1130 unsigned outw, outh;
1132 oc = &dss_cache.overlay_cache[i];
1133 oi = &oc->info;
1135 if (oc->channel != mgr->id)
1136 continue;
1138 oc->dirty = true;
1140 if (!enlarge_update_area)
1141 continue;
1143 if (!oc->enabled)
1144 continue;
1146 if (!dispc_is_overlay_scaled(oc))
1147 continue;
1149 outw = oi->out_width == 0 ?
1150 oi->width : oi->out_width;
1151 outh = oi->out_height == 0 ?
1152 oi->height : oi->out_height;
1154 /* is the overlay outside the update region? */
1155 if (!rectangle_intersects(x, y, w, h,
1156 oi->pos_x, oi->pos_y,
1157 outw, outh))
1158 continue;
1160 /* if the overlay totally inside the update region? */
1161 if (rectangle_subset(oi->pos_x, oi->pos_y, outw, outh,
1162 x, y, w, h))
1163 continue;
1165 if (x > oi->pos_x)
1166 x1 = oi->pos_x;
1167 else
1168 x1 = x;
1170 if (y > oi->pos_y)
1171 y1 = oi->pos_y;
1172 else
1173 y1 = y;
1175 if ((x + w) < (oi->pos_x + outw))
1176 x2 = oi->pos_x + outw;
1177 else
1178 x2 = x + w;
1180 if ((y + h) < (oi->pos_y + outh))
1181 y2 = oi->pos_y + outh;
1182 else
1183 y2 = y + h;
1185 x = x1;
1186 y = y1;
1187 w = x2 - x1;
1188 h = y2 - y1;
1190 make_even(&x, &w);
1192 DSSDBG("changing upd area due to ovl(%d) "
1193 "scaling %d,%d %dx%d\n",
1194 i, x, y, w, h);
1196 area_changed = true;
1198 } while (area_changed);
1200 mc = &dss_cache.manager_cache[mgr->id];
1201 mc->do_manual_update = true;
1202 mc->enlarge_update_area = enlarge_update_area;
1203 mc->x = x;
1204 mc->y = y;
1205 mc->w = w;
1206 mc->h = h;
1208 configure_dispc();
1210 mc->do_manual_update = false;
1212 spin_unlock_irqrestore(&dss_cache.lock, flags);
1214 *xi = x;
1215 *yi = y;
1216 *wi = w;
1217 *hi = h;
1220 void dss_start_update(struct omap_dss_device *dssdev)
1222 struct manager_cache_data *mc;
1223 struct overlay_cache_data *oc;
1224 const int num_ovls = dss_feat_get_num_ovls();
1225 const int num_mgrs = dss_feat_get_num_mgrs();
1226 struct omap_overlay_manager *mgr;
1227 int i;
1229 mgr = dssdev->manager;
1231 for (i = 0; i < num_ovls; ++i) {
1232 oc = &dss_cache.overlay_cache[i];
1233 if (oc->channel != mgr->id)
1234 continue;
1236 oc->shadow_dirty = false;
1239 for (i = 0; i < num_mgrs; ++i) {
1240 mc = &dss_cache.manager_cache[i];
1241 if (mgr->id != i)
1242 continue;
1244 mc->shadow_dirty = false;
1247 dssdev->manager->enable(dssdev->manager);
1250 static void dss_apply_irq_handler(void *data, u32 mask)
1252 struct manager_cache_data *mc;
1253 struct overlay_cache_data *oc;
1254 const int num_ovls = dss_feat_get_num_ovls();
1255 const int num_mgrs = dss_feat_get_num_mgrs();
1256 int i, r;
1257 bool mgr_busy[MAX_DSS_MANAGERS];
1258 u32 irq_mask;
1260 for (i = 0; i < num_mgrs; i++)
1261 mgr_busy[i] = dispc_go_busy(i);
1263 spin_lock(&dss_cache.lock);
1265 for (i = 0; i < num_ovls; ++i) {
1266 oc = &dss_cache.overlay_cache[i];
1267 if (!mgr_busy[oc->channel])
1268 oc->shadow_dirty = false;
1271 for (i = 0; i < num_mgrs; ++i) {
1272 mc = &dss_cache.manager_cache[i];
1273 if (!mgr_busy[i])
1274 mc->shadow_dirty = false;
1277 r = configure_dispc();
1278 if (r == 1)
1279 goto end;
1281 /* re-read busy flags */
1282 for (i = 0; i < num_mgrs; i++)
1283 mgr_busy[i] = dispc_go_busy(i);
1285 /* keep running as long as there are busy managers, so that
1286 * we can collect overlay-applied information */
1287 for (i = 0; i < num_mgrs; ++i) {
1288 if (mgr_busy[i])
1289 goto end;
1292 irq_mask = DISPC_IRQ_VSYNC | DISPC_IRQ_EVSYNC_ODD |
1293 DISPC_IRQ_EVSYNC_EVEN;
1294 if (dss_has_feature(FEAT_MGR_LCD2))
1295 irq_mask |= DISPC_IRQ_VSYNC2;
1297 omap_dispc_unregister_isr(dss_apply_irq_handler, NULL, irq_mask);
1298 dss_cache.irq_enabled = false;
1300 end:
1301 spin_unlock(&dss_cache.lock);
1304 static int omap_dss_mgr_apply(struct omap_overlay_manager *mgr)
1306 struct overlay_cache_data *oc;
1307 struct manager_cache_data *mc;
1308 int i;
1309 struct omap_overlay *ovl;
1310 int num_planes_enabled = 0;
1311 bool use_fifomerge;
1312 unsigned long flags;
1313 int r;
1315 DSSDBG("omap_dss_mgr_apply(%s)\n", mgr->name);
1317 r = dispc_runtime_get();
1318 if (r)
1319 return r;
1321 spin_lock_irqsave(&dss_cache.lock, flags);
1323 /* Configure overlays */
1324 for (i = 0; i < omap_dss_get_num_overlays(); ++i) {
1325 struct omap_dss_device *dssdev;
1327 ovl = omap_dss_get_overlay(i);
1329 if (!(ovl->caps & OMAP_DSS_OVL_CAP_DISPC))
1330 continue;
1332 oc = &dss_cache.overlay_cache[ovl->id];
1334 if (!overlay_enabled(ovl)) {
1335 if (oc->enabled) {
1336 oc->enabled = false;
1337 oc->dirty = true;
1339 continue;
1342 if (!ovl->info_dirty) {
1343 if (oc->enabled)
1344 ++num_planes_enabled;
1345 continue;
1348 dssdev = ovl->manager->device;
1350 if (dss_check_overlay(ovl, dssdev)) {
1351 if (oc->enabled) {
1352 oc->enabled = false;
1353 oc->dirty = true;
1355 continue;
1358 ovl->info_dirty = false;
1359 oc->dirty = true;
1360 oc->info = ovl->info;
1362 oc->replication =
1363 dss_use_replication(dssdev, ovl->info.color_mode);
1365 oc->ilace = dssdev->type == OMAP_DISPLAY_TYPE_VENC;
1367 oc->channel = ovl->manager->id;
1369 oc->enabled = true;
1371 ++num_planes_enabled;
1374 /* Configure managers */
1375 list_for_each_entry(mgr, &manager_list, list) {
1376 struct omap_dss_device *dssdev;
1378 if (!(mgr->caps & OMAP_DSS_OVL_MGR_CAP_DISPC))
1379 continue;
1381 mc = &dss_cache.manager_cache[mgr->id];
1383 if (mgr->device_changed) {
1384 mgr->device_changed = false;
1385 mgr->info_dirty = true;
1388 if (!mgr->info_dirty)
1389 continue;
1391 if (!mgr->device)
1392 continue;
1394 dssdev = mgr->device;
1396 mgr->info_dirty = false;
1397 mc->dirty = true;
1398 mc->info = mgr->info;
1400 mc->manual_update =
1401 dssdev->caps & OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE;
1404 /* XXX TODO: Try to get fifomerge working. The problem is that it
1405 * affects both managers, not individually but at the same time. This
1406 * means the change has to be well synchronized. I guess the proper way
1407 * is to have a two step process for fifo merge:
1408 * fifomerge enable:
1409 * 1. disable other planes, leaving one plane enabled
1410 * 2. wait until the planes are disabled on HW
1411 * 3. config merged fifo thresholds, enable fifomerge
1412 * fifomerge disable:
1413 * 1. config unmerged fifo thresholds, disable fifomerge
1414 * 2. wait until fifo changes are in HW
1415 * 3. enable planes
1417 use_fifomerge = false;
1419 /* Configure overlay fifos */
1420 for (i = 0; i < omap_dss_get_num_overlays(); ++i) {
1421 struct omap_dss_device *dssdev;
1422 u32 size, burst_size;
1424 ovl = omap_dss_get_overlay(i);
1426 if (!(ovl->caps & OMAP_DSS_OVL_CAP_DISPC))
1427 continue;
1429 oc = &dss_cache.overlay_cache[ovl->id];
1431 if (!oc->enabled)
1432 continue;
1434 dssdev = ovl->manager->device;
1436 size = dispc_get_plane_fifo_size(ovl->id);
1437 if (use_fifomerge)
1438 size *= 3;
1440 burst_size = dispc_get_burst_size(ovl->id);
1442 switch (dssdev->type) {
1443 case OMAP_DISPLAY_TYPE_DPI:
1444 case OMAP_DISPLAY_TYPE_DBI:
1445 case OMAP_DISPLAY_TYPE_SDI:
1446 case OMAP_DISPLAY_TYPE_VENC:
1447 case OMAP_DISPLAY_TYPE_HDMI:
1448 default_get_overlay_fifo_thresholds(ovl->id, size,
1449 burst_size, &oc->fifo_low,
1450 &oc->fifo_high);
1451 break;
1452 #ifdef CONFIG_OMAP2_DSS_DSI
1453 case OMAP_DISPLAY_TYPE_DSI:
1454 dsi_get_overlay_fifo_thresholds(ovl->id, size,
1455 burst_size, &oc->fifo_low,
1456 &oc->fifo_high);
1457 break;
1458 #endif
1459 default:
1460 BUG();
1464 r = 0;
1465 if (!dss_cache.irq_enabled) {
1466 u32 mask;
1468 mask = DISPC_IRQ_VSYNC | DISPC_IRQ_EVSYNC_ODD |
1469 DISPC_IRQ_EVSYNC_EVEN;
1470 if (dss_has_feature(FEAT_MGR_LCD2))
1471 mask |= DISPC_IRQ_VSYNC2;
1473 r = omap_dispc_register_isr(dss_apply_irq_handler, NULL, mask);
1474 dss_cache.irq_enabled = true;
1476 configure_dispc();
1478 spin_unlock_irqrestore(&dss_cache.lock, flags);
1480 dispc_runtime_put();
1482 return r;
1485 static int dss_check_manager(struct omap_overlay_manager *mgr)
1487 /* OMAP supports only graphics source transparency color key and alpha
1488 * blending simultaneously. See TRM 15.4.2.4.2.2 Alpha Mode */
1490 if (mgr->info.alpha_enabled && mgr->info.trans_enabled &&
1491 mgr->info.trans_key_type != OMAP_DSS_COLOR_KEY_GFX_DST)
1492 return -EINVAL;
1494 return 0;
1497 static int omap_dss_mgr_set_info(struct omap_overlay_manager *mgr,
1498 struct omap_overlay_manager_info *info)
1500 int r;
1501 struct omap_overlay_manager_info old_info;
1503 old_info = mgr->info;
1504 mgr->info = *info;
1506 r = dss_check_manager(mgr);
1507 if (r) {
1508 mgr->info = old_info;
1509 return r;
1512 mgr->info_dirty = true;
1514 return 0;
1517 static void omap_dss_mgr_get_info(struct omap_overlay_manager *mgr,
1518 struct omap_overlay_manager_info *info)
1520 *info = mgr->info;
1523 static int dss_mgr_enable(struct omap_overlay_manager *mgr)
1525 dispc_enable_channel(mgr->id, 1);
1526 return 0;
1529 static int dss_mgr_disable(struct omap_overlay_manager *mgr)
1531 dispc_enable_channel(mgr->id, 0);
1532 return 0;
1535 static void omap_dss_add_overlay_manager(struct omap_overlay_manager *manager)
1537 ++num_managers;
1538 list_add_tail(&manager->list, &manager_list);
1541 int dss_init_overlay_managers(struct platform_device *pdev)
1543 int i, r;
1545 spin_lock_init(&dss_cache.lock);
1547 INIT_LIST_HEAD(&manager_list);
1549 num_managers = 0;
1551 for (i = 0; i < dss_feat_get_num_mgrs(); ++i) {
1552 struct omap_overlay_manager *mgr;
1553 mgr = kzalloc(sizeof(*mgr), GFP_KERNEL);
1555 BUG_ON(mgr == NULL);
1557 switch (i) {
1558 case 0:
1559 mgr->name = "lcd";
1560 mgr->id = OMAP_DSS_CHANNEL_LCD;
1561 break;
1562 case 1:
1563 mgr->name = "tv";
1564 mgr->id = OMAP_DSS_CHANNEL_DIGIT;
1565 break;
1566 case 2:
1567 mgr->name = "lcd2";
1568 mgr->id = OMAP_DSS_CHANNEL_LCD2;
1569 break;
1572 mgr->set_device = &omap_dss_set_device;
1573 mgr->unset_device = &omap_dss_unset_device;
1574 mgr->apply = &omap_dss_mgr_apply;
1575 mgr->set_manager_info = &omap_dss_mgr_set_info;
1576 mgr->get_manager_info = &omap_dss_mgr_get_info;
1577 mgr->wait_for_go = &dss_mgr_wait_for_go;
1578 mgr->wait_for_vsync = &dss_mgr_wait_for_vsync;
1580 mgr->enable = &dss_mgr_enable;
1581 mgr->disable = &dss_mgr_disable;
1583 mgr->caps = OMAP_DSS_OVL_MGR_CAP_DISPC;
1584 mgr->supported_displays =
1585 dss_feat_get_supported_displays(mgr->id);
1587 dss_overlay_setup_dispc_manager(mgr);
1589 omap_dss_add_overlay_manager(mgr);
1591 r = kobject_init_and_add(&mgr->kobj, &manager_ktype,
1592 &pdev->dev.kobj, "manager%d", i);
1594 if (r) {
1595 DSSERR("failed to create sysfs file\n");
1596 continue;
1600 #ifdef L4_EXAMPLE
1602 int omap_dss_mgr_apply_l4(struct omap_overlay_manager *mgr)
1604 DSSDBG("omap_dss_mgr_apply_l4(%s)\n", mgr->name);
1606 return 0;
1609 struct omap_overlay_manager *mgr;
1610 mgr = kzalloc(sizeof(*mgr), GFP_KERNEL);
1612 BUG_ON(mgr == NULL);
1614 mgr->name = "l4";
1615 mgr->supported_displays =
1616 OMAP_DISPLAY_TYPE_DBI | OMAP_DISPLAY_TYPE_DSI;
1618 mgr->set_device = &omap_dss_set_device;
1619 mgr->unset_device = &omap_dss_unset_device;
1620 mgr->apply = &omap_dss_mgr_apply_l4;
1621 mgr->set_manager_info = &omap_dss_mgr_set_info;
1622 mgr->get_manager_info = &omap_dss_mgr_get_info;
1624 dss_overlay_setup_l4_manager(mgr);
1626 omap_dss_add_overlay_manager(mgr);
1628 r = kobject_init_and_add(&mgr->kobj, &manager_ktype,
1629 &pdev->dev.kobj, "managerl4");
1631 if (r)
1632 DSSERR("failed to create sysfs file\n");
1634 #endif
1636 return 0;
1639 void dss_uninit_overlay_managers(struct platform_device *pdev)
1641 struct omap_overlay_manager *mgr;
1643 while (!list_empty(&manager_list)) {
1644 mgr = list_first_entry(&manager_list,
1645 struct omap_overlay_manager, list);
1646 list_del(&mgr->list);
1647 kobject_del(&mgr->kobj);
1648 kobject_put(&mgr->kobj);
1649 kfree(mgr);
1652 num_managers = 0;
1655 int omap_dss_get_num_overlay_managers(void)
1657 return num_managers;
1659 EXPORT_SYMBOL(omap_dss_get_num_overlay_managers);
1661 struct omap_overlay_manager *omap_dss_get_overlay_manager(int num)
1663 int i = 0;
1664 struct omap_overlay_manager *mgr;
1666 list_for_each_entry(mgr, &manager_list, list) {
1667 if (i++ == num)
1668 return mgr;
1671 return NULL;
1673 EXPORT_SYMBOL(omap_dss_get_overlay_manager);