aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2011-11-17 07:26:48 -0500
committerTomi Valkeinen <tomi.valkeinen@ti.com>2011-12-02 01:54:52 -0500
commitfcc764dca80ead39b7391ff2c67a6b78de16d7a9 (patch)
treead3fcbf422681bad0700d36ba1affb1db7b3a154
parent9d11c321a84266db2dba82cfb0d9d3bc17c326a8 (diff)
OMAPDSS: APPLY: add dss_ovl_simple_check()
Add dss_ovl_simple_check() which is used to check the validity of certain overlay attributes. Only attributes that can be checked independently, without knowing the display being used, is done here (thus "simple"). We can use this function in dss_ovl_set_info(). Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
-rw-r--r--drivers/video/omap2/dss/apply.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index 4cc7c37acbb4..dccddd264436 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -928,12 +928,52 @@ err:
928} 928}
929 929
930 930
931static int dss_ovl_simple_check(struct omap_overlay *ovl,
932 const struct omap_overlay_info *info)
933{
934 if (info->paddr == 0) {
935 DSSERR("check_overlay: paddr cannot be 0\n");
936 return -EINVAL;
937 }
938
939 if ((ovl->caps & OMAP_DSS_OVL_CAP_SCALE) == 0) {
940 if (info->out_width != 0 && info->width != info->out_width) {
941 DSSERR("check_overlay: overlay %d doesn't support "
942 "scaling\n", ovl->id);
943 return -EINVAL;
944 }
945
946 if (info->out_height != 0 && info->height != info->out_height) {
947 DSSERR("check_overlay: overlay %d doesn't support "
948 "scaling\n", ovl->id);
949 return -EINVAL;
950 }
951 }
952
953 if ((ovl->supported_modes & info->color_mode) == 0) {
954 DSSERR("check_overlay: overlay %d doesn't support mode %d\n",
955 ovl->id, info->color_mode);
956 return -EINVAL;
957 }
958
959 if (info->zorder >= omap_dss_get_num_overlays()) {
960 DSSERR("check_overlay: zorder %d too high\n", info->zorder);
961 return -EINVAL;
962 }
963
964 return 0;
965}
931 966
932int dss_ovl_set_info(struct omap_overlay *ovl, 967int dss_ovl_set_info(struct omap_overlay *ovl,
933 struct omap_overlay_info *info) 968 struct omap_overlay_info *info)
934{ 969{
935 struct ovl_priv_data *op = get_ovl_priv(ovl); 970 struct ovl_priv_data *op = get_ovl_priv(ovl);
936 unsigned long flags; 971 unsigned long flags;
972 int r;
973
974 r = dss_ovl_simple_check(ovl, info);
975 if (r)
976 return r;
937 977
938 spin_lock_irqsave(&data_lock, flags); 978 spin_lock_irqsave(&data_lock, flags);
939 979