diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2011-12-08 03:32:37 -0500 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2012-01-02 01:51:25 -0500 |
commit | 6ac48d1e3ac788ad1d54895acd83be26cefb4fe9 (patch) | |
tree | 511d3080a4c3964095da524af8404493285e80bf | |
parent | 5af661ce1a8c7672364c2c911b76186589db0f0e (diff) |
OMAPDSS: APPLY: move check functions
The functions dss_ovl_check, dss_mgr_check_zorder, dss_mgr_check in
apply.c are not really part of the apply mechanism, and can be moved to
overlay.c and manager.c.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
-rw-r--r-- | drivers/video/omap2/dss/apply.c | 107 | ||||
-rw-r--r-- | drivers/video/omap2/dss/dss.h | 6 | ||||
-rw-r--r-- | drivers/video/omap2/dss/manager.c | 63 | ||||
-rw-r--r-- | drivers/video/omap2/dss/overlay.c | 42 |
4 files changed, 111 insertions, 107 deletions
diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c index f8506d79a7f9..12f2cdb65704 100644 --- a/drivers/video/omap2/dss/apply.c +++ b/drivers/video/omap2/dss/apply.c | |||
@@ -172,113 +172,6 @@ static bool mgr_manual_update(struct omap_overlay_manager *mgr) | |||
172 | return mgr->device->caps & OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE; | 172 | return mgr->device->caps & OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE; |
173 | } | 173 | } |
174 | 174 | ||
175 | /* Check if overlay parameters are compatible with display */ | ||
176 | static int dss_ovl_check(struct omap_overlay *ovl, | ||
177 | struct omap_overlay_info *info, struct omap_dss_device *dssdev) | ||
178 | { | ||
179 | u16 outw, outh; | ||
180 | u16 dw, dh; | ||
181 | |||
182 | if (dssdev == NULL) | ||
183 | return 0; | ||
184 | |||
185 | dssdev->driver->get_resolution(dssdev, &dw, &dh); | ||
186 | |||
187 | if ((ovl->caps & OMAP_DSS_OVL_CAP_SCALE) == 0) { | ||
188 | outw = info->width; | ||
189 | outh = info->height; | ||
190 | } else { | ||
191 | if (info->out_width == 0) | ||
192 | outw = info->width; | ||
193 | else | ||
194 | outw = info->out_width; | ||
195 | |||
196 | if (info->out_height == 0) | ||
197 | outh = info->height; | ||
198 | else | ||
199 | outh = info->out_height; | ||
200 | } | ||
201 | |||
202 | if (dw < info->pos_x + outw) { | ||
203 | DSSERR("overlay %d horizontally not inside the display area " | ||
204 | "(%d + %d >= %d)\n", | ||
205 | ovl->id, info->pos_x, outw, dw); | ||
206 | return -EINVAL; | ||
207 | } | ||
208 | |||
209 | if (dh < info->pos_y + outh) { | ||
210 | DSSERR("overlay %d vertically not inside the display area " | ||
211 | "(%d + %d >= %d)\n", | ||
212 | ovl->id, info->pos_y, outh, dh); | ||
213 | return -EINVAL; | ||
214 | } | ||
215 | |||
216 | return 0; | ||
217 | } | ||
218 | |||
219 | static int dss_mgr_check_zorder(struct omap_overlay_manager *mgr, | ||
220 | struct omap_overlay_info **overlay_infos) | ||
221 | { | ||
222 | struct omap_overlay *ovl1, *ovl2; | ||
223 | struct omap_overlay_info *info1, *info2; | ||
224 | |||
225 | list_for_each_entry(ovl1, &mgr->overlays, list) { | ||
226 | info1 = overlay_infos[ovl1->id]; | ||
227 | |||
228 | if (info1 == NULL) | ||
229 | continue; | ||
230 | |||
231 | list_for_each_entry(ovl2, &mgr->overlays, list) { | ||
232 | if (ovl1 == ovl2) | ||
233 | continue; | ||
234 | |||
235 | info2 = overlay_infos[ovl2->id]; | ||
236 | |||
237 | if (info2 == NULL) | ||
238 | continue; | ||
239 | |||
240 | if (info1->zorder == info2->zorder) { | ||
241 | DSSERR("overlays %d and %d have the same " | ||
242 | "zorder %d\n", | ||
243 | ovl1->id, ovl2->id, info1->zorder); | ||
244 | return -EINVAL; | ||
245 | } | ||
246 | } | ||
247 | } | ||
248 | |||
249 | return 0; | ||
250 | } | ||
251 | |||
252 | static int dss_mgr_check(struct omap_overlay_manager *mgr, | ||
253 | struct omap_dss_device *dssdev, | ||
254 | struct omap_overlay_manager_info *info, | ||
255 | struct omap_overlay_info **overlay_infos) | ||
256 | { | ||
257 | struct omap_overlay *ovl; | ||
258 | int r; | ||
259 | |||
260 | if (dss_has_feature(FEAT_ALPHA_FREE_ZORDER)) { | ||
261 | r = dss_mgr_check_zorder(mgr, overlay_infos); | ||
262 | if (r) | ||
263 | return r; | ||
264 | } | ||
265 | |||
266 | list_for_each_entry(ovl, &mgr->overlays, list) { | ||
267 | struct omap_overlay_info *oi; | ||
268 | int r; | ||
269 | |||
270 | oi = overlay_infos[ovl->id]; | ||
271 | |||
272 | if (oi == NULL) | ||
273 | continue; | ||
274 | |||
275 | r = dss_ovl_check(ovl, oi, dssdev); | ||
276 | if (r) | ||
277 | return r; | ||
278 | } | ||
279 | |||
280 | return 0; | ||
281 | } | ||
282 | static int dss_check_settings_low(struct omap_overlay_manager *mgr, | 175 | static int dss_check_settings_low(struct omap_overlay_manager *mgr, |
283 | struct omap_dss_device *dssdev, bool applying) | 176 | struct omap_dss_device *dssdev, bool applying) |
284 | { | 177 | { |
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h index 45b724ae04fe..20a88392ed24 100644 --- a/drivers/video/omap2/dss/dss.h +++ b/drivers/video/omap2/dss/dss.h | |||
@@ -209,12 +209,18 @@ void default_get_overlay_fifo_thresholds(enum omap_plane plane, | |||
209 | /* manager */ | 209 | /* manager */ |
210 | int dss_init_overlay_managers(struct platform_device *pdev); | 210 | int dss_init_overlay_managers(struct platform_device *pdev); |
211 | void dss_uninit_overlay_managers(struct platform_device *pdev); | 211 | void dss_uninit_overlay_managers(struct platform_device *pdev); |
212 | int dss_mgr_check(struct omap_overlay_manager *mgr, | ||
213 | struct omap_dss_device *dssdev, | ||
214 | struct omap_overlay_manager_info *info, | ||
215 | struct omap_overlay_info **overlay_infos); | ||
212 | 216 | ||
213 | /* overlay */ | 217 | /* overlay */ |
214 | void dss_init_overlays(struct platform_device *pdev); | 218 | void dss_init_overlays(struct platform_device *pdev); |
215 | void dss_uninit_overlays(struct platform_device *pdev); | 219 | void dss_uninit_overlays(struct platform_device *pdev); |
216 | void dss_overlay_setup_dispc_manager(struct omap_overlay_manager *mgr); | 220 | void dss_overlay_setup_dispc_manager(struct omap_overlay_manager *mgr); |
217 | void dss_recheck_connections(struct omap_dss_device *dssdev, bool force); | 221 | void dss_recheck_connections(struct omap_dss_device *dssdev, bool force); |
222 | int dss_ovl_check(struct omap_overlay *ovl, | ||
223 | struct omap_overlay_info *info, struct omap_dss_device *dssdev); | ||
218 | 224 | ||
219 | /* DSS */ | 225 | /* DSS */ |
220 | int dss_init_platform_driver(void); | 226 | int dss_init_platform_driver(void); |
diff --git a/drivers/video/omap2/dss/manager.c b/drivers/video/omap2/dss/manager.c index 8c967ef2ae98..542258dbdccc 100644 --- a/drivers/video/omap2/dss/manager.c +++ b/drivers/video/omap2/dss/manager.c | |||
@@ -592,3 +592,66 @@ struct omap_overlay_manager *omap_dss_get_overlay_manager(int num) | |||
592 | } | 592 | } |
593 | EXPORT_SYMBOL(omap_dss_get_overlay_manager); | 593 | EXPORT_SYMBOL(omap_dss_get_overlay_manager); |
594 | 594 | ||
595 | static int dss_mgr_check_zorder(struct omap_overlay_manager *mgr, | ||
596 | struct omap_overlay_info **overlay_infos) | ||
597 | { | ||
598 | struct omap_overlay *ovl1, *ovl2; | ||
599 | struct omap_overlay_info *info1, *info2; | ||
600 | |||
601 | list_for_each_entry(ovl1, &mgr->overlays, list) { | ||
602 | info1 = overlay_infos[ovl1->id]; | ||
603 | |||
604 | if (info1 == NULL) | ||
605 | continue; | ||
606 | |||
607 | list_for_each_entry(ovl2, &mgr->overlays, list) { | ||
608 | if (ovl1 == ovl2) | ||
609 | continue; | ||
610 | |||
611 | info2 = overlay_infos[ovl2->id]; | ||
612 | |||
613 | if (info2 == NULL) | ||
614 | continue; | ||
615 | |||
616 | if (info1->zorder == info2->zorder) { | ||
617 | DSSERR("overlays %d and %d have the same " | ||
618 | "zorder %d\n", | ||
619 | ovl1->id, ovl2->id, info1->zorder); | ||
620 | return -EINVAL; | ||
621 | } | ||
622 | } | ||
623 | } | ||
624 | |||
625 | return 0; | ||
626 | } | ||
627 | |||
628 | int dss_mgr_check(struct omap_overlay_manager *mgr, | ||
629 | struct omap_dss_device *dssdev, | ||
630 | struct omap_overlay_manager_info *info, | ||
631 | struct omap_overlay_info **overlay_infos) | ||
632 | { | ||
633 | struct omap_overlay *ovl; | ||
634 | int r; | ||
635 | |||
636 | if (dss_has_feature(FEAT_ALPHA_FREE_ZORDER)) { | ||
637 | r = dss_mgr_check_zorder(mgr, overlay_infos); | ||
638 | if (r) | ||
639 | return r; | ||
640 | } | ||
641 | |||
642 | list_for_each_entry(ovl, &mgr->overlays, list) { | ||
643 | struct omap_overlay_info *oi; | ||
644 | int r; | ||
645 | |||
646 | oi = overlay_infos[ovl->id]; | ||
647 | |||
648 | if (oi == NULL) | ||
649 | continue; | ||
650 | |||
651 | r = dss_ovl_check(ovl, oi, dssdev); | ||
652 | if (r) | ||
653 | return r; | ||
654 | } | ||
655 | |||
656 | return 0; | ||
657 | } | ||
diff --git a/drivers/video/omap2/dss/overlay.c b/drivers/video/omap2/dss/overlay.c index 8d036e661a26..c91babfc44ca 100644 --- a/drivers/video/omap2/dss/overlay.c +++ b/drivers/video/omap2/dss/overlay.c | |||
@@ -595,3 +595,45 @@ void dss_uninit_overlays(struct platform_device *pdev) | |||
595 | num_overlays = 0; | 595 | num_overlays = 0; |
596 | } | 596 | } |
597 | 597 | ||
598 | int dss_ovl_check(struct omap_overlay *ovl, | ||
599 | struct omap_overlay_info *info, struct omap_dss_device *dssdev) | ||
600 | { | ||
601 | u16 outw, outh; | ||
602 | u16 dw, dh; | ||
603 | |||
604 | if (dssdev == NULL) | ||
605 | return 0; | ||
606 | |||
607 | dssdev->driver->get_resolution(dssdev, &dw, &dh); | ||
608 | |||
609 | if ((ovl->caps & OMAP_DSS_OVL_CAP_SCALE) == 0) { | ||
610 | outw = info->width; | ||
611 | outh = info->height; | ||
612 | } else { | ||
613 | if (info->out_width == 0) | ||
614 | outw = info->width; | ||
615 | else | ||
616 | outw = info->out_width; | ||
617 | |||
618 | if (info->out_height == 0) | ||
619 | outh = info->height; | ||
620 | else | ||
621 | outh = info->out_height; | ||
622 | } | ||
623 | |||
624 | if (dw < info->pos_x + outw) { | ||
625 | DSSERR("overlay %d horizontally not inside the display area " | ||
626 | "(%d + %d >= %d)\n", | ||
627 | ovl->id, info->pos_x, outw, dw); | ||
628 | return -EINVAL; | ||
629 | } | ||
630 | |||
631 | if (dh < info->pos_y + outh) { | ||
632 | DSSERR("overlay %d vertically not inside the display area " | ||
633 | "(%d + %d >= %d)\n", | ||
634 | ovl->id, info->pos_y, outh, dh); | ||
635 | return -EINVAL; | ||
636 | } | ||
637 | |||
638 | return 0; | ||
639 | } | ||