All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] media: s5p-mfc fix vidioc_g_crop() to return crop info.
@ 2016-06-29 23:33 ` Shuah Khan
  0 siblings, 0 replies; 4+ messages in thread
From: Shuah Khan @ 2016-06-29 23:33 UTC (permalink / raw)
  To: kyungmin.park, k.debski, jtp.park, mchehab, javier
  Cc: Shuah Khan, linux-arm-kernel, linux-media, linux-kernel

Fix vidioc_g_crop() to report crop information irrepective of ctx state.
g_crop is expected to return crop information as long as the passed in
v4l2_crop type field is vV4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
 drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
index a01a373..4ace9e1 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
@@ -774,12 +774,9 @@ static int vidioc_g_crop(struct file *file, void *priv,
 	struct s5p_mfc_dev *dev = ctx->dev;
 	u32 left, right, top, bottom;
 
-	if (ctx->state != MFCINST_HEAD_PARSED &&
-	ctx->state != MFCINST_RUNNING && ctx->state != MFCINST_FINISHING
-					&& ctx->state != MFCINST_FINISHED) {
-			mfc_err("Cannont set crop\n");
-			return -EINVAL;
-		}
+	if (cr->type != V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
+		return -EINVAL;
+
 	if (ctx->src_fmt->fourcc == V4L2_PIX_FMT_H264) {
 		left = s5p_mfc_hw_call(dev->mfc_ops, get_crop_info_h, ctx);
 		right = left >> S5P_FIMV_SHARED_CROP_RIGHT_SHIFT;
-- 
2.7.4

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

* [PATCH] media: s5p-mfc fix vidioc_g_crop() to return crop info.
@ 2016-06-29 23:33 ` Shuah Khan
  0 siblings, 0 replies; 4+ messages in thread
From: Shuah Khan @ 2016-06-29 23:33 UTC (permalink / raw)
  To: linux-arm-kernel

Fix vidioc_g_crop() to report crop information irrepective of ctx state.
g_crop is expected to return crop information as long as the passed in
v4l2_crop type field is vV4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
 drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
index a01a373..4ace9e1 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
@@ -774,12 +774,9 @@ static int vidioc_g_crop(struct file *file, void *priv,
 	struct s5p_mfc_dev *dev = ctx->dev;
 	u32 left, right, top, bottom;
 
-	if (ctx->state != MFCINST_HEAD_PARSED &&
-	ctx->state != MFCINST_RUNNING && ctx->state != MFCINST_FINISHING
-					&& ctx->state != MFCINST_FINISHED) {
-			mfc_err("Cannont set crop\n");
-			return -EINVAL;
-		}
+	if (cr->type != V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
+		return -EINVAL;
+
 	if (ctx->src_fmt->fourcc == V4L2_PIX_FMT_H264) {
 		left = s5p_mfc_hw_call(dev->mfc_ops, get_crop_info_h, ctx);
 		right = left >> S5P_FIMV_SHARED_CROP_RIGHT_SHIFT;
-- 
2.7.4

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

* Re: [PATCH] media: s5p-mfc fix vidioc_g_crop() to return crop info.
  2016-06-29 23:33 ` Shuah Khan
@ 2016-06-30  6:38   ` Hans Verkuil
  -1 siblings, 0 replies; 4+ messages in thread
From: Hans Verkuil @ 2016-06-30  6:38 UTC (permalink / raw)
  To: Shuah Khan, kyungmin.park, k.debski, jtp.park, mchehab, javier
  Cc: linux-arm-kernel, linux-media, linux-kernel

On 06/30/2016 01:33 AM, Shuah Khan wrote:
> Fix vidioc_g_crop() to report crop information irrepective of ctx state.
> g_crop is expected to return crop information as long as the passed in
> v4l2_crop type field is vV4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE.
> 
> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
> ---
>  drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> index a01a373..4ace9e1 100644
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> @@ -774,12 +774,9 @@ static int vidioc_g_crop(struct file *file, void *priv,
>  	struct s5p_mfc_dev *dev = ctx->dev;
>  	u32 left, right, top, bottom;
>  
> -	if (ctx->state != MFCINST_HEAD_PARSED &&
> -	ctx->state != MFCINST_RUNNING && ctx->state != MFCINST_FINISHING
> -					&& ctx->state != MFCINST_FINISHED) {
> -			mfc_err("Cannont set crop\n");
> -			return -EINVAL;
> -		}

Well, without this information all you can do is to return a fake rectangle.
The decoder needs to have parsed the header to know the size.

> +	if (cr->type != V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)

Actually, this should be V4L2_BUF_TYPE_VIDEO_OUTPUT. See the spec.

I actually wonder why there is a g_crop at all since without a s_crop it doesn't
provide any useful information.

And if it is needed, then g_selection is the right callback since g_crop for
output provides the compose rectangle, not the crop rectangle (one of the
reasons we introduced g/s_selection).

Regards,

	Hans

> +		return -EINVAL;
> +
>  	if (ctx->src_fmt->fourcc == V4L2_PIX_FMT_H264) {
>  		left = s5p_mfc_hw_call(dev->mfc_ops, get_crop_info_h, ctx);
>  		right = left >> S5P_FIMV_SHARED_CROP_RIGHT_SHIFT;
> 

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

* [PATCH] media: s5p-mfc fix vidioc_g_crop() to return crop info.
@ 2016-06-30  6:38   ` Hans Verkuil
  0 siblings, 0 replies; 4+ messages in thread
From: Hans Verkuil @ 2016-06-30  6:38 UTC (permalink / raw)
  To: linux-arm-kernel

On 06/30/2016 01:33 AM, Shuah Khan wrote:
> Fix vidioc_g_crop() to report crop information irrepective of ctx state.
> g_crop is expected to return crop information as long as the passed in
> v4l2_crop type field is vV4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE.
> 
> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
> ---
>  drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> index a01a373..4ace9e1 100644
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> @@ -774,12 +774,9 @@ static int vidioc_g_crop(struct file *file, void *priv,
>  	struct s5p_mfc_dev *dev = ctx->dev;
>  	u32 left, right, top, bottom;
>  
> -	if (ctx->state != MFCINST_HEAD_PARSED &&
> -	ctx->state != MFCINST_RUNNING && ctx->state != MFCINST_FINISHING
> -					&& ctx->state != MFCINST_FINISHED) {
> -			mfc_err("Cannont set crop\n");
> -			return -EINVAL;
> -		}

Well, without this information all you can do is to return a fake rectangle.
The decoder needs to have parsed the header to know the size.

> +	if (cr->type != V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)

Actually, this should be V4L2_BUF_TYPE_VIDEO_OUTPUT. See the spec.

I actually wonder why there is a g_crop at all since without a s_crop it doesn't
provide any useful information.

And if it is needed, then g_selection is the right callback since g_crop for
output provides the compose rectangle, not the crop rectangle (one of the
reasons we introduced g/s_selection).

Regards,

	Hans

> +		return -EINVAL;
> +
>  	if (ctx->src_fmt->fourcc == V4L2_PIX_FMT_H264) {
>  		left = s5p_mfc_hw_call(dev->mfc_ops, get_crop_info_h, ctx);
>  		right = left >> S5P_FIMV_SHARED_CROP_RIGHT_SHIFT;
> 

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

end of thread, other threads:[~2016-06-30  6:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-29 23:33 [PATCH] media: s5p-mfc fix vidioc_g_crop() to return crop info Shuah Khan
2016-06-29 23:33 ` Shuah Khan
2016-06-30  6:38 ` Hans Verkuil
2016-06-30  6:38   ` Hans Verkuil

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.