From: Wu-Cheng Li <wuchengli@xxxxxxxxxxxx> Use the requested size as the minimum bound, unless it's less than the required hardware minimum. The bound align function will align to the closest value but we do not want to adjust below the requested size. Signed-off-by: Wu-Cheng Li <wuchengli@xxxxxxxxxxxx> Signed-off-by: Kiran AVND <avnd.kiran@xxxxxxxxxxx> --- drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c index 04b0467..aa99742 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c @@ -1059,6 +1059,7 @@ static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f) struct s5p_mfc_dev *dev = video_drvdata(file); struct s5p_mfc_fmt *fmt; struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp; + u32 min_w, min_h; if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { fmt = find_format(f, MFC_FMT_ENC); @@ -1093,8 +1094,16 @@ static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f) return -EINVAL; } - v4l_bound_align_image(&pix_fmt_mp->width, 8, 1920, 1, - &pix_fmt_mp->height, 4, 1080, 1, 0); + /* + * Use the requested size as the minimum bound, unless it's less + * than the required hardware minimum. The bound align function + * will align to the closest value but we do not want to adjust + * below the requested size. + */ + min_w = min(max(16u, pix_fmt_mp->width), 1920u); + min_h = min(max(16u, pix_fmt_mp->height), 1088u); + v4l_bound_align_image(&pix_fmt_mp->width, min_w, 1920, 4, + &pix_fmt_mp->height, min_h, 1088, 4, 0); } else { mfc_err("invalid buf type\n"); return -EINVAL; -- 1.7.3.rc2 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html