diff options
author | panpan liu <panpan1.liu@samsung.com> | 2014-07-15 22:51:33 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-07-21 16:02:50 -0300 |
commit | f8600689de949f79309221be2bca36b4d2b953d1 (patch) | |
tree | 0e482ff264e9277a7335dcb6292e5bbc28fa5c09 /drivers/media/platform | |
parent | b313bcc9a46795c0233a765411cef9a15caaa7fb (diff) | |
download | linux-stable-f8600689de949f79309221be2bca36b4d2b953d1.tar.gz linux-stable-f8600689de949f79309221be2bca36b4d2b953d1.tar.bz2 linux-stable-f8600689de949f79309221be2bca36b4d2b953d1.zip |
[media] s5p-mfc: limit the size of the CPB
The CPB size is limited by the hardware. Add this limit to the s_fmt.
Signed-off-by: panpan liu <panpan1.liu@samsung.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/platform')
-rw-r--r-- | drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c index 4d93835dec9d..9103258b7df3 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c @@ -436,6 +436,7 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f) struct s5p_mfc_ctx *ctx = fh_to_ctx(priv); int ret = 0; struct v4l2_pix_format_mplane *pix_mp; + struct s5p_mfc_buf_size *buf_size = dev->variant->buf_size; mfc_debug_enter(); ret = vidioc_try_fmt(file, priv, f); @@ -459,11 +460,13 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f) mfc_debug(2, "The codec number is: %d\n", ctx->codec_mode); pix_mp->height = 0; pix_mp->width = 0; - if (pix_mp->plane_fmt[0].sizeimage) - ctx->dec_src_buf_size = pix_mp->plane_fmt[0].sizeimage; - else + if (pix_mp->plane_fmt[0].sizeimage == 0) pix_mp->plane_fmt[0].sizeimage = ctx->dec_src_buf_size = DEF_CPB_SIZE; + else if (pix_mp->plane_fmt[0].sizeimage > buf_size->cpb) + ctx->dec_src_buf_size = buf_size->cpb; + else + ctx->dec_src_buf_size = pix_mp->plane_fmt[0].sizeimage; pix_mp->plane_fmt[0].bytesperline = 0; ctx->state = MFCINST_INIT; ret = 0; |