diff mbox series

[v3,04/18] media: vicodec: selection api should only check signal buffer types

Message ID 20190224090234.19723-5-dafna3@gmail.com (mailing list archive)
State New, archived
Headers show
Series add support to stateless decoder | expand

Commit Message

Dafna Hirschfeld Feb. 24, 2019, 9:02 a.m. UTC
The selection api should check only signal buffer types
because multiplanar types are converted to
signal in drivers/media/v4l2-core/v4l2-ioctl.c

Signed-off-by: Dafna Hirschfeld <dafna3@gmail.com>
---
 drivers/media/platform/vicodec/vicodec-core.c | 20 +++----------------
 1 file changed, 3 insertions(+), 17 deletions(-)

Comments

Hans Verkuil Feb. 25, 2019, 9:14 a.m. UTC | #1
On 2/24/19 10:02 AM, Dafna Hirschfeld wrote:
> The selection api should check only signal buffer types
> because multiplanar types are converted to
> signal in drivers/media/v4l2-core/v4l2-ioctl.c

signal -> single (also in the subject of this patch)

Regards,

	Hans

> 
> Signed-off-by: Dafna Hirschfeld <dafna3@gmail.com>
> ---
>  drivers/media/platform/vicodec/vicodec-core.c | 20 +++----------------
>  1 file changed, 3 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/media/platform/vicodec/vicodec-core.c b/drivers/media/platform/vicodec/vicodec-core.c
> index d7636fe9e174..b92a91e06e18 100644
> --- a/drivers/media/platform/vicodec/vicodec-core.c
> +++ b/drivers/media/platform/vicodec/vicodec-core.c
> @@ -945,16 +945,6 @@ static int vidioc_g_selection(struct file *file, void *priv,
>  {
>  	struct vicodec_ctx *ctx = file2ctx(file);
>  	struct vicodec_q_data *q_data;
> -	enum v4l2_buf_type valid_cap_type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
> -	enum v4l2_buf_type valid_out_type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
> -
> -	if (multiplanar) {
> -		valid_cap_type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
> -		valid_out_type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
> -	}
> -
> -	if (s->type != valid_cap_type && s->type != valid_out_type)
> -		return -EINVAL;
>  
>  	q_data = get_q_data(ctx, s->type);
>  	if (!q_data)
> @@ -963,8 +953,8 @@ static int vidioc_g_selection(struct file *file, void *priv,
>  	 * encoder supports only cropping on the OUTPUT buffer
>  	 * decoder supports only composing on the CAPTURE buffer
>  	 */
> -	if ((ctx->is_enc && s->type == valid_out_type) ||
> -	    (!ctx->is_enc && s->type == valid_cap_type)) {
> +	if ((ctx->is_enc && s->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) ||
> +	    (!ctx->is_enc && s->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)) {
>  		switch (s->target) {
>  		case V4L2_SEL_TGT_COMPOSE:
>  		case V4L2_SEL_TGT_CROP:
> @@ -992,12 +982,8 @@ static int vidioc_s_selection(struct file *file, void *priv,
>  {
>  	struct vicodec_ctx *ctx = file2ctx(file);
>  	struct vicodec_q_data *q_data;
> -	enum v4l2_buf_type out_type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
> -
> -	if (multiplanar)
> -		out_type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
>  
> -	if (s->type != out_type)
> +	if (s->type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
>  		return -EINVAL;
>  
>  	q_data = get_q_data(ctx, s->type);
>
diff mbox series

Patch

diff --git a/drivers/media/platform/vicodec/vicodec-core.c b/drivers/media/platform/vicodec/vicodec-core.c
index d7636fe9e174..b92a91e06e18 100644
--- a/drivers/media/platform/vicodec/vicodec-core.c
+++ b/drivers/media/platform/vicodec/vicodec-core.c
@@ -945,16 +945,6 @@  static int vidioc_g_selection(struct file *file, void *priv,
 {
 	struct vicodec_ctx *ctx = file2ctx(file);
 	struct vicodec_q_data *q_data;
-	enum v4l2_buf_type valid_cap_type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-	enum v4l2_buf_type valid_out_type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
-
-	if (multiplanar) {
-		valid_cap_type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
-		valid_out_type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
-	}
-
-	if (s->type != valid_cap_type && s->type != valid_out_type)
-		return -EINVAL;
 
 	q_data = get_q_data(ctx, s->type);
 	if (!q_data)
@@ -963,8 +953,8 @@  static int vidioc_g_selection(struct file *file, void *priv,
 	 * encoder supports only cropping on the OUTPUT buffer
 	 * decoder supports only composing on the CAPTURE buffer
 	 */
-	if ((ctx->is_enc && s->type == valid_out_type) ||
-	    (!ctx->is_enc && s->type == valid_cap_type)) {
+	if ((ctx->is_enc && s->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) ||
+	    (!ctx->is_enc && s->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)) {
 		switch (s->target) {
 		case V4L2_SEL_TGT_COMPOSE:
 		case V4L2_SEL_TGT_CROP:
@@ -992,12 +982,8 @@  static int vidioc_s_selection(struct file *file, void *priv,
 {
 	struct vicodec_ctx *ctx = file2ctx(file);
 	struct vicodec_q_data *q_data;
-	enum v4l2_buf_type out_type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
-
-	if (multiplanar)
-		out_type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
 
-	if (s->type != out_type)
+	if (s->type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
 		return -EINVAL;
 
 	q_data = get_q_data(ctx, s->type);