s5p-mfc: limit the size of the CPB
PATCH 1/1 s5p-mfc: limit the size of the CPB
The register of the CPB limits the size. The max size is 4M, so it is more reasonable.
--- drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) mode change 100644 => 100755 drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
drivers/media/platform/s5p-mfc/s5p_mfc_dec.c +2 -1
@@ -466,7 +466,8 @@ 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) +if (pix_mp->plane_fmt[0 ].sizeimage && + pix_mp->plane_fmt[0 ].sizeimage <=MAX_CPB_SIZE ) ctx->dec_src_buf_size = pix_mp->plane_fmt[0 ].sizeimage;else pix_mp->plane_fmt[0].sizeimage = ctx->dec_src_buf_size =
--
1.7.9.5
PATCH 1/1 s5p-mfc: limit the size of the CPB
Hi panpan,
Thank you for your patch, please find my comments inline.
Quoted 20 lines
From: panpan liu [mailto:panpan1.liu at samsung.com]
Sent: Monday, July 14, 2014 9:22 AMThe register of the CPB limits the size. The max size is 4M, so it is more reasonable.
Signed-off-by panpan liu <[email protected]>--- drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) mode change 100644 =>100755
drivers/media/platform/s5p-mfc/s5p_mfc_dec.cdrivers/media/platform/s5p-mfc/s5p_mfc_dec.c +0
-0
drivers/media/platform/s5p-mfc/s5p_mfc_dec.c static int vidioc_s_fmt(struct file *file, void · line 471
Quoted 7 lines
drivers/media/platform/s5p-mfc/s5p_mfc_dec.c +2
-1@@ -466,7 +466,8 @@ 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) +if (pix_mp->plane_fmt[0 ].sizeimage && + pix_mp->plane_fmt[0 ].sizeimage <=MAX_CPB_SIZE )
The MAX_CPB_SIZE applies only to the v5 version of the MFC. To have this dependent on the actual variant used please use:
...
struct s5p_mfc_buf_size *buf_size = dev->variant->buf_size;
...
if (pix_mp->plane_fmt[0].sizeimage &&
pix_mp->plane_fmt[0].sizeimage <= buf_size->cpb)
...
drivers/media/platform/s5p-mfc/s5p_mfc_dec.c static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f) · line 473
Quoted 3 lines
drivers/media/platform/s5p-mfc/s5p_mfc_dec.c +0
-0ctx->dec_src_buf_size = pix_mp->plane_fmt[0 ].sizeimage; else pix_mp->plane_fmt[0].sizeimage = ctx->dec_src_buf_size =
Also, in case the desired buffer size is too large the driver should set the maximum size allowed and not the default size which is fairly small.
So you should cover three cases:
- no size set -> set default size
- size set < max - set the desired size
- size set > max - set the maximum size allowed
Best wishes,
Signature · 2 lines
Kamil Debski Samsung R&D Institute Poland