From 6ac48d1e3ac788ad1d54895acd83be26cefb4fe9 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Thu, 8 Dec 2011 10:32:37 +0200 Subject: 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 --- drivers/video/omap2/dss/overlay.c | 42 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'drivers/video/omap2/dss/overlay.c') diff --git a/drivers/video/omap2/dss/overlay.c b/drivers/video/omap2/dss/overlay.c index 8d036e661a2..c91babfc44c 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) 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; +} -- cgit v1.2.3-70-g09d2