[1/2] venus: venc: update output format based on capture format.

Message ID 1600968674-11559-2-git-send-email-dikshita@codeaurora.org (mailing list archive)
State Superseded, archived
Delegated to: Stanimir Varbanov
Headers
Series Venus: fix handling of crop and s_fmt |

Commit Message

Dikshita Agarwal Sept. 24, 2020, 5:31 p.m. UTC
  update output format parameters when s_fmt is called on
capture port as recommended in encoder spec.

Signed-off-by: Dikshita Agarwal <dikshita@codeaurora.org>
---
 drivers/media/platform/qcom/venus/venc.c | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)
  

Comments

Dikshita Agarwal Dec. 16, 2020, 6:14 a.m. UTC | #1
Hi All,

Kindly ignore this patch.
https://patchwork.linuxtv.org/project/linux-media/list/?series=3790 
replaces this.

Thanks,
Dikshita

On 2020-09-24 23:01, Dikshita Agarwal wrote:
> update output format parameters when s_fmt is called on
> capture port as recommended in encoder spec.
> 
> Signed-off-by: Dikshita Agarwal <dikshita@codeaurora.org>
> ---
>  drivers/media/platform/qcom/venus/venc.c | 28 
> +++++++++++++++-------------
>  1 file changed, 15 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/media/platform/qcom/venus/venc.c
> b/drivers/media/platform/qcom/venus/venc.c
> index c591d00..7d2aaa8 100644
> --- a/drivers/media/platform/qcom/venus/venc.c
> +++ b/drivers/media/platform/qcom/venus/venc.c
> @@ -382,31 +382,33 @@ static int venc_s_fmt(struct file *file, void
> *fh, struct v4l2_format *f)
> 
>  	memset(&format, 0, sizeof(format));
> 
> -	format.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
> -	format.fmt.pix_mp.pixelformat = pixfmt_out;
> +	format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
> +	format.fmt.pix_mp.pixelformat = pixfmt_cap;
>  	format.fmt.pix_mp.width = orig_pixmp.width;
>  	format.fmt.pix_mp.height = orig_pixmp.height;
>  	venc_try_fmt_common(inst, &format);
> 
> -	if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
> -		inst->out_width = format.fmt.pix_mp.width;
> -		inst->out_height = format.fmt.pix_mp.height;
> -		inst->colorspace = pixmp->colorspace;
> -		inst->ycbcr_enc = pixmp->ycbcr_enc;
> -		inst->quantization = pixmp->quantization;
> -		inst->xfer_func = pixmp->xfer_func;
> +	if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
> +		inst->width = format.fmt.pix_mp.width;
> +		inst->height = format.fmt.pix_mp.height;
>  	}
> 
>  	memset(&format, 0, sizeof(format));
> 
> -	format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
> -	format.fmt.pix_mp.pixelformat = pixfmt_cap;
> +	format.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
> +	format.fmt.pix_mp.pixelformat = pixfmt_out;
>  	format.fmt.pix_mp.width = orig_pixmp.width;
>  	format.fmt.pix_mp.height = orig_pixmp.height;
>  	venc_try_fmt_common(inst, &format);
> 
> -	inst->width = format.fmt.pix_mp.width;
> -	inst->height = format.fmt.pix_mp.height;
> +	inst->out_width = format.fmt.pix_mp.width;
> +	inst->out_height = format.fmt.pix_mp.height;
> +	if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
> +		inst->colorspace = pixmp->colorspace;
> +		inst->ycbcr_enc = pixmp->ycbcr_enc;
> +		inst->quantization = pixmp->quantization;
> +		inst->xfer_func = pixmp->xfer_func;
> +	}
> 
>  	if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
>  		inst->fmt_out = fmt;
  

Patch

diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c
index c591d00..7d2aaa8 100644
--- a/drivers/media/platform/qcom/venus/venc.c
+++ b/drivers/media/platform/qcom/venus/venc.c
@@ -382,31 +382,33 @@  static int venc_s_fmt(struct file *file, void *fh, struct v4l2_format *f)
 
 	memset(&format, 0, sizeof(format));
 
-	format.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
-	format.fmt.pix_mp.pixelformat = pixfmt_out;
+	format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+	format.fmt.pix_mp.pixelformat = pixfmt_cap;
 	format.fmt.pix_mp.width = orig_pixmp.width;
 	format.fmt.pix_mp.height = orig_pixmp.height;
 	venc_try_fmt_common(inst, &format);
 
-	if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
-		inst->out_width = format.fmt.pix_mp.width;
-		inst->out_height = format.fmt.pix_mp.height;
-		inst->colorspace = pixmp->colorspace;
-		inst->ycbcr_enc = pixmp->ycbcr_enc;
-		inst->quantization = pixmp->quantization;
-		inst->xfer_func = pixmp->xfer_func;
+	if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
+		inst->width = format.fmt.pix_mp.width;
+		inst->height = format.fmt.pix_mp.height;
 	}
 
 	memset(&format, 0, sizeof(format));
 
-	format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
-	format.fmt.pix_mp.pixelformat = pixfmt_cap;
+	format.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
+	format.fmt.pix_mp.pixelformat = pixfmt_out;
 	format.fmt.pix_mp.width = orig_pixmp.width;
 	format.fmt.pix_mp.height = orig_pixmp.height;
 	venc_try_fmt_common(inst, &format);
 
-	inst->width = format.fmt.pix_mp.width;
-	inst->height = format.fmt.pix_mp.height;
+	inst->out_width = format.fmt.pix_mp.width;
+	inst->out_height = format.fmt.pix_mp.height;
+	if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
+		inst->colorspace = pixmp->colorspace;
+		inst->ycbcr_enc = pixmp->ycbcr_enc;
+		inst->quantization = pixmp->quantization;
+		inst->xfer_func = pixmp->xfer_func;
+	}
 
 	if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
 		inst->fmt_out = fmt;