linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] s5p-mfc: limit the size of the CPB
@ 2014-07-14  7:22 panpan liu
  2014-07-14  9:29 ` Kamil Debski
  0 siblings, 1 reply; 11+ messages in thread
From: panpan liu @ 2014-07-14  7:22 UTC (permalink / raw)
  To: linux-arm-kernel

The register of the CPB limits the size. The max size is 4M, so it
is more reasonable.

Signed-off-by: panpan liu <panpan1.liu@samsung.com>
---
 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

diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
old mode 100644
new mode 100755
index 0bae907..889cb06
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
@@ -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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH] s5p-mfc: limit the size of the CPB
  2014-07-14  7:22 panpan liu
@ 2014-07-14  9:29 ` Kamil Debski
  0 siblings, 0 replies; 11+ messages in thread
From: Kamil Debski @ 2014-07-14  9:29 UTC (permalink / raw)
  To: linux-arm-kernel

Hi panpan,

Thank you for your patch, please find my comments inline.

> From: panpan liu [mailto:panpan1.liu at samsung.com]
> Sent: Monday, July 14, 2014 9:22 AM
> 
> The register of the CPB limits the size. The max size is 4M, so it is
> more reasonable.
> 
> Signed-off-by: panpan liu <panpan1.liu@samsung.com>
> ---
>  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
> 
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> old mode 100644
> new mode 100755
> index 0bae907..889cb06
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> @@ -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)
...

>  		ctx->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, 
-- 
Kamil Debski
Samsung R&D Institute Poland

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] s5p-mfc: limit the size of the CPB
@ 2014-07-14 11:16 panpan liu
  0 siblings, 0 replies; 11+ messages in thread
From: panpan liu @ 2014-07-14 11:16 UTC (permalink / raw)
  To: linux-arm-kernel

The register of the CPB limits the size. The max size is 4M, so it
is more reasonable.

Change-Id: I4ffe90ac8b4de7aed8f396b3072d5db6ead9741c
Signed-off-by: panpan liu <panpan1.liu@samsung.com>
---
 drivers/media/platform/s5p-mfc/s5p_mfc_dec.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
 mode change 100644 => 100755 drivers/media/platform/s5p-mfc/s5p_mfc_dec.c

diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
old mode 100644
new mode 100755
index 0bae907..70b9458
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
@@ -413,7 +413,8 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f)
 	int ret = 0;
 	struct s5p_mfc_fmt *fmt;
 	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);
 	pix_mp = &f->fmt.pix_mp;
@@ -466,11 +467,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;
 out:
--
1.7.9.5

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH] s5p-mfc: limit the size of the CPB
@ 2014-07-14 11:18 panpan liu
  2014-07-14 14:07 ` Kamil Debski
  0 siblings, 1 reply; 11+ messages in thread
From: panpan liu @ 2014-07-14 11:18 UTC (permalink / raw)
  To: linux-arm-kernel

The register of the CPB limits the size. The max size is 4M, so it
is more reasonable.


Signed-off-by: panpan liu <panpan1.liu@samsung.com>
---
 drivers/media/platform/s5p-mfc/s5p_mfc_dec.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
 mode change 100644 => 100755 drivers/media/platform/s5p-mfc/s5p_mfc_dec.c

diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
old mode 100644
new mode 100755
index 0bae907..70b9458
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
@@ -413,7 +413,8 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f)
 	int ret = 0;
 	struct s5p_mfc_fmt *fmt;
 	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);
 	pix_mp = &f->fmt.pix_mp;
@@ -466,11 +467,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;
 out:
--
1.7.9.5

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH] s5p-mfc: limit the size of the CPB
  2014-07-14 11:18 panpan liu
@ 2014-07-14 14:07 ` Kamil Debski
  0 siblings, 0 replies; 11+ messages in thread
From: Kamil Debski @ 2014-07-14 14:07 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

> From: panpan liu [mailto:panpan1.liu at samsung.com]
> Sent: Monday, July 14, 2014 1:18 PM
> Subject: [PATCH] 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.

The commit message should be rephrased as well. It is no longer fixed
to 4MB.

"The CPB size is limited by the hardware. Add this limit to the s_fmt."

> 
> 
> Signed-off-by: panpan liu <panpan1.liu@samsung.com>
> ---
>  drivers/media/platform/s5p-mfc/s5p_mfc_dec.c |   11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
>  mode change 100644 => 100755 drivers/media/platform/s5p-
> mfc/s5p_mfc_dec.c
> 
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> old mode 100644
> new mode 100755
> index 0bae907..70b9458
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> @@ -413,7 +413,8 @@ static int vidioc_s_fmt(struct file *file, void
> *priv, struct v4l2_format *f)
>  	int ret = 0;
>  	struct s5p_mfc_fmt *fmt;
>  	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);
>  	pix_mp = &f->fmt.pix_mp;
> @@ -466,11 +467,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;
>  out:
> --
> 1.7.9.5

Best wishes,
-- 
Kamil Debski
Samsung R&D Institute Poland

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] s5p-mfc: limit the size of the CPB
@ 2014-07-15  3:07 panpan liu
  2014-07-15 10:51 ` Kamil Debski
  2014-07-15 10:51 ` Kamil Debski
  0 siblings, 2 replies; 11+ messages in thread
From: panpan liu @ 2014-07-15  3:07 UTC (permalink / raw)
  To: linux-arm-kernel

The CPB size is limited by the hardware. Add this limit to the s_fmt.

Signed-off-by: panpan liu <panpan1.liu@samsung.com>
---
 drivers/media/platform/s5p-mfc/s5p_mfc_dec.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
 mode change 100644 => 100755 drivers/media/platform/s5p-mfc/s5p_mfc_dec.c

diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
old mode 100644
new mode 100755
index 0bae907..70b9458
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
@@ -413,7 +413,8 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f)
 	int ret = 0;
 	struct s5p_mfc_fmt *fmt;
 	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);
 	pix_mp = &f->fmt.pix_mp;
@@ -466,11 +467,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;
 out:
--
1.7.9.5

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH] s5p-mfc: limit the size of the CPB
  2014-07-15  3:07 [PATCH] s5p-mfc: limit the size of the CPB panpan liu
@ 2014-07-15 10:51 ` Kamil Debski
  2014-07-15 10:51 ` Kamil Debski
  1 sibling, 0 replies; 11+ messages in thread
From: Kamil Debski @ 2014-07-15 10:51 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

Please also rebase the patches onto the master branch of the media tree.

http://git.linuxtv.org/cgit.cgi/media_tree.git/

Best wishes,
-- 
Kamil Debski
Samsung R&D Institute Poland


> -----Original Message-----
> From: panpan liu [mailto:panpan1.liu at samsung.com]
> Sent: Tuesday, July 15, 2014 5:08 AM
> To: kyungmin.park at samsung.com; k.debski at samsung.com;
> jtp.park at samsung.com; mchehab at redhat.com
> Cc: linux-arm-kernel at lists.infradead.org; linux-media at vger.kernel.org
> Subject: [PATCH] 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>
> ---
>  drivers/media/platform/s5p-mfc/s5p_mfc_dec.c |   11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)  mode change 100644 =>
> 100755 drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> 
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> old mode 100644
> new mode 100755
> index 0bae907..70b9458
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> @@ -413,7 +413,8 @@ static int vidioc_s_fmt(struct file *file, void
> *priv, struct v4l2_format *f)
>  	int ret = 0;
>  	struct s5p_mfc_fmt *fmt;
>  	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);
>  	pix_mp = &f->fmt.pix_mp;
> @@ -466,11 +467,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;
>  out:
> --
> 1.7.9.5

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] s5p-mfc: limit the size of the CPB
  2014-07-15  3:07 [PATCH] s5p-mfc: limit the size of the CPB panpan liu
  2014-07-15 10:51 ` Kamil Debski
@ 2014-07-15 10:51 ` Kamil Debski
  1 sibling, 0 replies; 11+ messages in thread
From: Kamil Debski @ 2014-07-15 10:51 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Panpan,

Checkpatch gives errors on your patch.

------------------------------
Applying 24839 hit enter to continue...
------------------------------
Checkpatch:
------------------------------
ERROR: do not set execute permissions for source files
#34: FILE: drivers/media/platform/s5p-mfc/s5p_mfc_dec.c

ERROR: space required before the open parenthesis '('
#58: FILE: drivers/media/platform/s5p-mfc/s5p_mfc_dec.c:473:
+	else if(pix_mp->plane_fmt[0].sizeimage > buf_size->cpb)

total: 2 errors, 0 warnings, 25 lines checked

NOTE: Ignored message types: PATCH_PREFIX

24839 has style problems, please review.

If any of these errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.



> -----Original Message-----
> From: panpan liu [mailto:panpan1.liu at samsung.com]
> Sent: Tuesday, July 15, 2014 5:08 AM
> To: kyungmin.park at samsung.com; k.debski at samsung.com;
> jtp.park at samsung.com; mchehab at redhat.com
> Cc: linux-arm-kernel at lists.infradead.org; linux-media at vger.kernel.org
> Subject: [PATCH] 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>
> ---
>  drivers/media/platform/s5p-mfc/s5p_mfc_dec.c |   11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)  mode change 100644 =>
> 100755 drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> 
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> old mode 100644
> new mode 100755
> index 0bae907..70b9458
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> @@ -413,7 +413,8 @@ static int vidioc_s_fmt(struct file *file, void
> *priv, struct v4l2_format *f)
>  	int ret = 0;
>  	struct s5p_mfc_fmt *fmt;
>  	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);
>  	pix_mp = &f->fmt.pix_mp;
> @@ -466,11 +467,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;
>  out:
> --
> 1.7.9.5

Best wishes,
-- 
Kamil Debski
Samsung R&D Institute Poland

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] s5p-mfc: limit the size of the CPB
@ 2014-07-16  1:46 panpan liu
  0 siblings, 0 replies; 11+ messages in thread
From: panpan liu @ 2014-07-16  1:46 UTC (permalink / raw)
  To: linux-arm-kernel

The CPB size is limited by the hardware. Add this limit to the s_fmt.
 space required before the open parenthesis '('
Signed-off-by: panpan liu <panpan1.liu@samsung.com>
---
 drivers/media/platform/s5p-mfc/s5p_mfc_dec.c |    9 ++++++---
 1 file 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 0bae907..0621ed8 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
@@ -413,6 +413,7 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f)
 	int ret = 0;
 	struct s5p_mfc_fmt *fmt;
 	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);
@@ -466,11 +467,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;
 out:
--
1.7.9.5

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH] s5p-mfc: limit the size of the CPB
@ 2014-07-16  1:51 panpan liu
  2014-07-16 13:59 ` Kamil Debski
  0 siblings, 1 reply; 11+ messages in thread
From: panpan liu @ 2014-07-16  1:51 UTC (permalink / raw)
  To: linux-arm-kernel

The CPB size is limited by the hardware. Add this limit to the s_fmt.

Signed-off-by: panpan liu <panpan1.liu@samsung.com>
---
 drivers/media/platform/s5p-mfc/s5p_mfc_dec.c |    9 ++++++---
 1 file 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 0bae907..0621ed8 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
@@ -413,6 +413,7 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f)
 	int ret = 0;
 	struct s5p_mfc_fmt *fmt;
 	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);
@@ -466,11 +467,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;
 out:
--
1.7.9.5

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH] s5p-mfc: limit the size of the CPB
  2014-07-16  1:51 panpan liu
@ 2014-07-16 13:59 ` Kamil Debski
  0 siblings, 0 replies; 11+ messages in thread
From: Kamil Debski @ 2014-07-16 13:59 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Panpan,

I merged your patch to my tree. However, next time please base the patch
on the newest branch from Mauro. Please mind the whitespaces, I had to
manually correct them. Also, please add version number to the [PATCH] part
of subject e.g. [PATCH v10].

Best wishes,
-- 
Kamil Debski
Samsung R&D Institute Poland


> -----Original Message-----
> From: panpan liu [mailto:panpan1.liu at samsung.com]
> Sent: Wednesday, July 16, 2014 3:52 AM
> To: kyungmin.park at samsung.com; k.debski at samsung.com;
> jtp.park at samsung.com; mchehab at redhat.com
> Cc: linux-arm-kernel at lists.infradead.org; linux-media at vger.kernel.org
> Subject: [PATCH] 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>
> ---
>  drivers/media/platform/s5p-mfc/s5p_mfc_dec.c |    9 ++++++---
>  1 file 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 0bae907..0621ed8 100644
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> @@ -413,6 +413,7 @@ static int vidioc_s_fmt(struct file *file, void
> *priv, struct v4l2_format *f)
>  	int ret = 0;
>  	struct s5p_mfc_fmt *fmt;
>  	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);
> @@ -466,11 +467,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;
>  out:
> --
> 1.7.9.5

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-07-16 13:59 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-15  3:07 [PATCH] s5p-mfc: limit the size of the CPB panpan liu
2014-07-15 10:51 ` Kamil Debski
2014-07-15 10:51 ` Kamil Debski
  -- strict thread matches above, loose matches on Subject: below --
2014-07-16  1:51 panpan liu
2014-07-16 13:59 ` Kamil Debski
2014-07-16  1:46 panpan liu
2014-07-14 11:18 panpan liu
2014-07-14 14:07 ` Kamil Debski
2014-07-14 11:16 panpan liu
2014-07-14  7:22 panpan liu
2014-07-14  9:29 ` Kamil Debski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).