From patchwork Thu Sep 24 17:31:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dikshita Agarwal X-Patchwork-Id: 11798039 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1F7A859D for ; Thu, 24 Sep 2020 17:31:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 07E972396E for ; Thu, 24 Sep 2020 17:31:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728553AbgIXRbf (ORCPT ); Thu, 24 Sep 2020 13:31:35 -0400 Received: from alexa-out.qualcomm.com ([129.46.98.28]:33711 "EHLO alexa-out.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726915AbgIXRbf (ORCPT ); Thu, 24 Sep 2020 13:31:35 -0400 Received: from ironmsg-lv-alpha.qualcomm.com ([10.47.202.13]) by alexa-out.qualcomm.com with ESMTP; 24 Sep 2020 10:31:34 -0700 Received: from ironmsg01-blr.qualcomm.com ([10.86.208.130]) by ironmsg-lv-alpha.qualcomm.com with ESMTP/TLS/AES256-SHA; 24 Sep 2020 10:31:31 -0700 Received: from dikshita-linux.qualcomm.com ([10.204.65.237]) by ironmsg01-blr.qualcomm.com with ESMTP; 24 Sep 2020 23:01:18 +0530 Received: by dikshita-linux.qualcomm.com (Postfix, from userid 347544) id B049A4E7F; Thu, 24 Sep 2020 23:01:17 +0530 (IST) From: Dikshita Agarwal To: linux-media@vger.kernel.org, stanimir.varbanov@linaro.org Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, vgarodia@codeaurora.org, Dikshita Agarwal Subject: [PATCH 1/2] venus: venc: update output format based on capture format. Date: Thu, 24 Sep 2020 23:01:13 +0530 Message-Id: <1600968674-11559-2-git-send-email-dikshita@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1600968674-11559-1-git-send-email-dikshita@codeaurora.org> References: <1600968674-11559-1-git-send-email-dikshita@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org update output format parameters when s_fmt is called on capture port as recommended in encoder spec. Signed-off-by: Dikshita Agarwal --- 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; From patchwork Thu Sep 24 17:31:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dikshita Agarwal X-Patchwork-Id: 11798035 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 72D9B92C for ; Thu, 24 Sep 2020 17:31:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5F1FB239EC for ; Thu, 24 Sep 2020 17:31:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728625AbgIXRbg (ORCPT ); Thu, 24 Sep 2020 13:31:36 -0400 Received: from alexa-out.qualcomm.com ([129.46.98.28]:33711 "EHLO alexa-out.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728566AbgIXRbf (ORCPT ); Thu, 24 Sep 2020 13:31:35 -0400 Received: from ironmsg-lv-alpha.qualcomm.com ([10.47.202.13]) by alexa-out.qualcomm.com with ESMTP; 24 Sep 2020 10:31:35 -0700 Received: from ironmsg01-blr.qualcomm.com ([10.86.208.130]) by ironmsg-lv-alpha.qualcomm.com with ESMTP/TLS/AES256-SHA; 24 Sep 2020 10:31:33 -0700 Received: from dikshita-linux.qualcomm.com ([10.204.65.237]) by ironmsg01-blr.qualcomm.com with ESMTP; 24 Sep 2020 23:01:20 +0530 Received: by dikshita-linux.qualcomm.com (Postfix, from userid 347544) id 4B8DD4E7E; Thu, 24 Sep 2020 23:01:19 +0530 (IST) From: Dikshita Agarwal To: linux-media@vger.kernel.org, stanimir.varbanov@linaro.org Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, vgarodia@codeaurora.org, Dikshita Agarwal Subject: [PATCH 2/2] venus: venc: fix handlig of S_SELECTION and G_SELECTION Date: Thu, 24 Sep 2020 23:01:14 +0530 Message-Id: <1600968674-11559-3-git-send-email-dikshita@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1600968674-11559-1-git-send-email-dikshita@codeaurora.org> References: <1600968674-11559-1-git-send-email-dikshita@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Stanimir Varbanov - return correct width and height for G_SELECTION - if requested rectangle wxh doesn't match with capture port wxh adjust the rectangle to supported wxh. Signed-off-by: Dikshita Agarwal --- drivers/media/platform/qcom/venus/venc.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index 7d2aaa8..a2cc12d 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -463,13 +463,13 @@ static int venc_g_fmt(struct file *file, void *fh, struct v4l2_format *f) switch (s->target) { case V4L2_SEL_TGT_CROP_DEFAULT: case V4L2_SEL_TGT_CROP_BOUNDS: - s->r.width = inst->width; - s->r.height = inst->height; - break; - case V4L2_SEL_TGT_CROP: s->r.width = inst->out_width; s->r.height = inst->out_height; break; + case V4L2_SEL_TGT_CROP: + s->r.width = inst->width; + s->r.height = inst->height; + break; default: return -EINVAL; } @@ -490,10 +490,14 @@ static int venc_g_fmt(struct file *file, void *fh, struct v4l2_format *f) switch (s->target) { case V4L2_SEL_TGT_CROP: - if (s->r.width != inst->out_width || - s->r.height != inst->out_height || - s->r.top != 0 || s->r.left != 0) - return -EINVAL; + if (s->r.width != inst->width || + s->r.height != inst->height || + s->r.top != 0 || s->r.left != 0) { + s->r.top = 0; + s->r.left = 0; + s->r.width = inst->width; + s->r.height = inst->height; + } break; default: return -EINVAL;