OSDN Git Service

OMAPDSS: APPLY: move check functions
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Thu, 8 Dec 2011 08:32:37 +0000 (10:32 +0200)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Mon, 2 Jan 2012 06:51:25 +0000 (08:51 +0200)
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>
drivers/video/omap2/dss/apply.c
drivers/video/omap2/dss/dss.h
drivers/video/omap2/dss/manager.c
drivers/video/omap2/dss/overlay.c

index f8506d7..12f2cdb 100644 (file)
@@ -172,113 +172,6 @@ static bool mgr_manual_update(struct omap_overlay_manager *mgr)
        return mgr->device->caps & OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE;
 }
 
-/* Check if overlay parameters are compatible with display */
-static int dss_ovl_check(struct omap_overlay *ovl,
-               struct omap_overlay_info *info, struct omap_dss_device *dssdev)
-{
-       u16 outw, outh;
-       u16 dw, dh;
-
-       if (dssdev == NULL)
-               return 0;
-
-       dssdev->driver->get_resolution(dssdev, &dw, &dh);
-
-       if ((ovl->caps & OMAP_DSS_OVL_CAP_SCALE) == 0) {
-               outw = info->width;
-               outh = info->height;
-       } else {
-               if (info->out_width == 0)
-                       outw = info->width;
-               else
-                       outw = info->out_width;
-
-               if (info->out_height == 0)
-                       outh = info->height;
-               else
-                       outh = info->out_height;
-       }
-
-       if (dw < info->pos_x + outw) {
-               DSSERR("overlay %d horizontally not inside the display area "
-                               "(%d + %d >= %d)\n",
-                               ovl->id, info->pos_x, outw, dw);
-               return -EINVAL;
-       }
-
-       if (dh < info->pos_y + outh) {
-               DSSERR("overlay %d vertically not inside the display area "
-                               "(%d + %d >= %d)\n",
-                               ovl->id, info->pos_y, outh, dh);
-               return -EINVAL;
-       }
-
-       return 0;
-}
-
-static int dss_mgr_check_zorder(struct omap_overlay_manager *mgr,
-               struct omap_overlay_info **overlay_infos)
-{
-       struct omap_overlay *ovl1, *ovl2;
-       struct omap_overlay_info *info1, *info2;
-
-       list_for_each_entry(ovl1, &mgr->overlays, list) {
-               info1 = overlay_infos[ovl1->id];
-
-               if (info1 == NULL)
-                       continue;
-
-               list_for_each_entry(ovl2, &mgr->overlays, list) {
-                       if (ovl1 == ovl2)
-                               continue;
-
-                       info2 = overlay_infos[ovl2->id];
-
-                       if (info2 == NULL)
-                               continue;
-
-                       if (info1->zorder == info2->zorder) {
-                               DSSERR("overlays %d and %d have the same "
-                                               "zorder %d\n",
-                                       ovl1->id, ovl2->id, info1->zorder);
-                               return -EINVAL;
-                       }
-               }
-       }
-
-       return 0;
-}
-
-static int dss_mgr_check(struct omap_overlay_manager *mgr,
-               struct omap_dss_device *dssdev,
-               struct omap_overlay_manager_info *info,
-               struct omap_overlay_info **overlay_infos)
-{
-       struct omap_overlay *ovl;
-       int r;
-
-       if (dss_has_feature(FEAT_ALPHA_FREE_ZORDER)) {
-               r = dss_mgr_check_zorder(mgr, overlay_infos);
-               if (r)
-                       return r;
-       }
-
-       list_for_each_entry(ovl, &mgr->overlays, list) {
-               struct omap_overlay_info *oi;
-               int r;
-
-               oi = overlay_infos[ovl->id];
-
-               if (oi == NULL)
-                       continue;
-
-               r = dss_ovl_check(ovl, oi, dssdev);
-               if (r)
-                       return r;
-       }
-
-       return 0;
-}
 static int dss_check_settings_low(struct omap_overlay_manager *mgr,
                struct omap_dss_device *dssdev, bool applying)
 {
index 45b724a..20a8839 100644 (file)
@@ -209,12 +209,18 @@ void default_get_overlay_fifo_thresholds(enum omap_plane plane,
 /* manager */
 int dss_init_overlay_managers(struct platform_device *pdev);
 void dss_uninit_overlay_managers(struct platform_device *pdev);
+int dss_mgr_check(struct omap_overlay_manager *mgr,
+               struct omap_dss_device *dssdev,
+               struct omap_overlay_manager_info *info,
+               struct omap_overlay_info **overlay_infos);
 
 /* overlay */
 void dss_init_overlays(struct platform_device *pdev);
 void dss_uninit_overlays(struct platform_device *pdev);
 void dss_overlay_setup_dispc_manager(struct omap_overlay_manager *mgr);
 void dss_recheck_connections(struct omap_dss_device *dssdev, bool force);
+int dss_ovl_check(struct omap_overlay *ovl,
+               struct omap_overlay_info *info, struct omap_dss_device *dssdev);
 
 /* DSS */
 int dss_init_platform_driver(void);
index 8c967ef..542258d 100644 (file)
@@ -592,3 +592,66 @@ struct omap_overlay_manager *omap_dss_get_overlay_manager(int num)
 }
 EXPORT_SYMBOL(omap_dss_get_overlay_manager);
 
+static int dss_mgr_check_zorder(struct omap_overlay_manager *mgr,
+               struct omap_overlay_info **overlay_infos)
+{
+       struct omap_overlay *ovl1, *ovl2;
+       struct omap_overlay_info *info1, *info2;
+
+       list_for_each_entry(ovl1, &mgr->overlays, list) {
+               info1 = overlay_infos[ovl1->id];
+
+               if (info1 == NULL)
+                       continue;
+
+               list_for_each_entry(ovl2, &mgr->overlays, list) {
+                       if (ovl1 == ovl2)
+                               continue;
+
+                       info2 = overlay_infos[ovl2->id];
+
+                       if (info2 == NULL)
+                               continue;
+
+                       if (info1->zorder == info2->zorder) {
+                               DSSERR("overlays %d and %d have the same "
+                                               "zorder %d\n",
+                                       ovl1->id, ovl2->id, info1->zorder);
+                               return -EINVAL;
+                       }
+               }
+       }
+
+       return 0;
+}
+
+int dss_mgr_check(struct omap_overlay_manager *mgr,
+               struct omap_dss_device *dssdev,
+               struct omap_overlay_manager_info *info,
+               struct omap_overlay_info **overlay_infos)
+{
+       struct omap_overlay *ovl;
+       int r;
+
+       if (dss_has_feature(FEAT_ALPHA_FREE_ZORDER)) {
+               r = dss_mgr_check_zorder(mgr, overlay_infos);
+               if (r)
+                       return r;
+       }
+
+       list_for_each_entry(ovl, &mgr->overlays, list) {
+               struct omap_overlay_info *oi;
+               int r;
+
+               oi = overlay_infos[ovl->id];
+
+               if (oi == NULL)
+                       continue;
+
+               r = dss_ovl_check(ovl, oi, dssdev);
+               if (r)
+                       return r;
+       }
+
+       return 0;
+}
index 8d036e6..c91babf 100644 (file)
@@ -595,3 +595,45 @@ void dss_uninit_overlays(struct platform_device *pdev)
        num_overlays = 0;
 }
 
+int dss_ovl_check(struct omap_overlay *ovl,
+               struct omap_overlay_info *info, struct omap_dss_device *dssdev)
+{
+       u16 outw, outh;
+       u16 dw, dh;
+
+       if (dssdev == NULL)
+               return 0;
+
+       dssdev->driver->get_resolution(dssdev, &dw, &dh);
+
+       if ((ovl->caps & OMAP_DSS_OVL_CAP_SCALE) == 0) {
+               outw = info->width;
+               outh = info->height;
+       } else {
+               if (info->out_width == 0)
+                       outw = info->width;
+               else
+                       outw = info->out_width;
+
+               if (info->out_height == 0)
+                       outh = info->height;
+               else
+                       outh = info->out_height;
+       }
+
+       if (dw < info->pos_x + outw) {
+               DSSERR("overlay %d horizontally not inside the display area "
+                               "(%d + %d >= %d)\n",
+                               ovl->id, info->pos_x, outw, dw);
+               return -EINVAL;
+       }
+
+       if (dh < info->pos_y + outh) {
+               DSSERR("overlay %d vertically not inside the display area "
+                               "(%d + %d >= %d)\n",
+                               ovl->id, info->pos_y, outh, dh);
+               return -EINVAL;
+       }
+
+       return 0;
+}