diff options
author | Liu Ying <Ying.Liu@freescale.com> | 2013-09-22 12:37:39 +0800 |
---|---|---|
committer | Peng Fushi <fushi.peng@freescale.com> | 2014-08-28 16:50:42 +0800 |
commit | e981dc5973778ba260011662464269b8d3870bb0 (patch) | |
tree | 37ff078c4f76a703d6d950a6a4431e8d2e8583c5 | |
parent | 267695f5b9db21a1fcdf1145c791c1f28b444e4d (diff) |
ENGR00280663-2 IPUv3 device: check downsize ratio overflow
IPUv3 IC task downsize scaling ratio cannot exceed or be
equal to 8:1. This patch makes the code return error code
if the ratio overflows.
Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
-rw-r--r-- | drivers/mxc/ipu3/ipu_device.c | 16 | ||||
-rw-r--r-- | include/linux/ipu.h | 4 |
2 files changed, 19 insertions, 1 deletions
diff --git a/drivers/mxc/ipu3/ipu_device.c b/drivers/mxc/ipu3/ipu_device.c index 384feeb60db1..0506038b0d4a 100644 --- a/drivers/mxc/ipu3/ipu_device.c +++ b/drivers/mxc/ipu3/ipu_device.c @@ -664,6 +664,12 @@ static void dump_check_err(struct device *dev, int err) case IPU_CHECK_ERR_SPLIT_WITH_ROT: dev_err(dev, "not support split mode with rotation\n"); break; + case IPU_CHECK_ERR_W_DOWNSIZE_OVER: + dev_err(dev, "horizontal downsizing ratio overflow\n"); + break; + case IPU_CHECK_ERR_H_DOWNSIZE_OVER: + dev_err(dev, "vertical downsizing ratio overflow\n"); + break; default: break; } @@ -965,6 +971,16 @@ static int check_task(struct ipu_task_entry *t) &t->set.o_off, &t->set.o_uoff, &t->set.o_voff, &t->set.ostride); + if (t->output.crop.w * 8 <= t->input.crop.w) { + ret = IPU_CHECK_ERR_W_DOWNSIZE_OVER; + goto done; + } + + if (t->output.crop.h * 8 <= t->input.crop.h) { + ret = IPU_CHECK_ERR_H_DOWNSIZE_OVER; + goto done; + } + if ((IPU_PIX_FMT_TILED_NV12 == t->input.format) || (IPU_PIX_FMT_TILED_NV12F == t->input.format)) { if ((t->input.crop.w > soc_max_in_width(1)) || diff --git a/include/linux/ipu.h b/include/linux/ipu.h index 358d315b1194..b1270d6e80b0 100644 --- a/include/linux/ipu.h +++ b/include/linux/ipu.h @@ -1,5 +1,5 @@ /* - * Copyright 2005-2013 Freescale Semiconductor, Inc. + * Copyright 2005-2014 Freescale Semiconductor, Inc. */ /* @@ -263,6 +263,8 @@ enum { IPU_CHECK_ERR_SPLIT_WITH_ROT, IPU_CHECK_ERR_NOT_SUPPORT, IPU_CHECK_ERR_NOT16ALIGN, + IPU_CHECK_ERR_W_DOWNSIZE_OVER, + IPU_CHECK_ERR_H_DOWNSIZE_OVER, }; /* IOCTL commands */ |