msm: sde: Reject 0 size image for SDE rotator

Rotator HW cannot support 0 dimension of input and output image. During
V4L2 validation, it must reject any 0 size image format setting.

CRs-Fixed: 1073633
Change-Id: I503561677271c39894b7a6910fe8d9c5c25e9c28
Signed-off-by: Benjamin Chan <bkchan@codeaurora.org>
This commit is contained in:
Benjamin Chan 2016-10-06 17:36:48 -04:00
parent 3c7400dc73
commit 4b7bbe3ad1

View file

@ -1123,6 +1123,13 @@ static int sde_rotator_try_fmt_vid_cap(struct file *file,
struct sde_rotation_config config; struct sde_rotation_config config;
int ret; int ret;
if ((f->fmt.pix.width == 0) || (f->fmt.pix.height == 0)) {
SDEDEV_WARN(ctx->rot_dev->dev,
"Not supporting 0 width/height: %dx%d\n",
f->fmt.pix.width, f->fmt.pix.height);
return -EINVAL;
}
sde_rot_mgr_lock(rot_dev->mgr); sde_rot_mgr_lock(rot_dev->mgr);
sde_rotator_get_config_from_ctx(ctx, &config); sde_rotator_get_config_from_ctx(ctx, &config);
config.output.format = f->fmt.pix.pixelformat; config.output.format = f->fmt.pix.pixelformat;
@ -1162,6 +1169,13 @@ static int sde_rotator_try_fmt_vid_out(struct file *file,
struct sde_rotation_config config; struct sde_rotation_config config;
int ret; int ret;
if ((f->fmt.pix.width == 0) || (f->fmt.pix.height == 0)) {
SDEDEV_WARN(ctx->rot_dev->dev,
"Not supporting 0 width/height: %dx%d\n",
f->fmt.pix.width, f->fmt.pix.height);
return -EINVAL;
}
sde_rot_mgr_lock(rot_dev->mgr); sde_rot_mgr_lock(rot_dev->mgr);
sde_rotator_get_config_from_ctx(ctx, &config); sde_rotator_get_config_from_ctx(ctx, &config);
config.input.format = f->fmt.pix.pixelformat; config.input.format = f->fmt.pix.pixelformat;