Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp306994imu; Mon, 19 Nov 2018 22:59:45 -0800 (PST) X-Google-Smtp-Source: AFSGD/XSgTATZjDcWyc0ZvcOzEmFetRe6M8CtW4ssekqZUAU5tKgmAkkkPUEAoOU2xSgrBm839bq X-Received: by 2002:a63:bc02:: with SMTP id q2mr874818pge.116.1542697185826; Mon, 19 Nov 2018 22:59:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542697185; cv=none; d=google.com; s=arc-20160816; b=ivk9oRww6TG6GHrLDTi7C0AO6qlYNI2MFHAoWilJasSyyu3sXd4m6N1SFA3m0dn9IW oR4ypMmQFTbnJTguOeWSPUOiO4eYgbLbHKwty835y3+gk2ACNr75TXwwc5NAARtHQNOt w9Ttsvg4Co7bFaXa9wjjmmKLGJei32EeodyxtBDKqTjnxPSxDZaR0iDC/TSIodSlhFrX ulUuDNtQ3RotUwXOrZ9h17BaGXY1QZSNLdNXZiKXSytOp+NJMSDhRmZIR0ggil++JX+k M7f3TFWAAUXIv8TguglD24QFubPnimEv/9AMDNNExRHyZb70WWxMoutkczQQju1cn/Hw XXDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=qGH5j+SYbt2D/h5xcwWkUo7Hb+iPq5mD341nfDSHiSE=; b=Hri8kW08vAU9fUxkzf8QdosZFJX/rfG3cs2d6uKYtX1Vx6nv/Q+BTscDbgIjoq9wDh a120RsVtnAlFw70yzmDbotLedhK1ajNcF2NCBUPcFMagQk9ERxN0l3sUxlxHP4Fl1GVB QJhUjWjozsrg8yD6qFxK4d6YVc+q5Yzw8xyoSJ11kHFNnxMdh2h446AzzyvCKuBnqgqt vxjDooUow3JkIQohlWZPEl4qHVd3yFkUDFUGkWD1RgrOVhDwXNlH6+CqY8dJXODmBQ2B 093syWZMfIumMC4FzHQ5tBxEasrIAQnHjwft1sP9aSGyJLMIAj8PkKc9jQyL1Zqn0kOj o0Tw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t1si43760366pgj.542.2018.11.19.22.59.30; Mon, 19 Nov 2018 22:59:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732263AbeKTRUm (ORCPT + 99 others); Tue, 20 Nov 2018 12:20:42 -0500 Received: from alexa-out-blr-02.qualcomm.com ([103.229.18.198]:17339 "EHLO alexa-out-blr.qualcomm.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726883AbeKTRUm (ORCPT ); Tue, 20 Nov 2018 12:20:42 -0500 X-IronPort-AV: E=Sophos;i="5.56,255,1539628200"; d="scan'208";a="247048" Received: from ironmsg03-blr.qualcomm.com ([10.86.208.132]) by alexa-out-blr.qualcomm.com with ESMTP/TLS/AES256-SHA; 20 Nov 2018 12:23:07 +0530 X-IronPort-AV: E=McAfee;i="5900,7806,9082"; a="2109510" Received: from mgottam-linux.qualcomm.com ([10.204.65.20]) by ironmsg03-blr.qualcomm.com with ESMTP; 20 Nov 2018 12:23:07 +0530 Received: by mgottam-linux.qualcomm.com (Postfix, from userid 2305155) id 6051E3193; Tue, 20 Nov 2018 12:23:06 +0530 (IST) From: Malathi Gottam To: stanimir.varbanov@linaro.org, hverkuil@xs4all.nl, mchehab@kernel.org Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, acourbot@chromium.org, vgarodia@codeaurora.org, mgottam@codeaurora.org Subject: [PATCH v2] media: venus: amend buffer size for bitstream plane Date: Tue, 20 Nov 2018 12:23:03 +0530 Message-Id: <1542696783-23016-1-git-send-email-mgottam@codeaurora.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Accept the buffer size requested by client and compare it against driver calculated size and set the maximum to bitstream plane. Signed-off-by: Malathi Gottam --- drivers/media/platform/qcom/venus/venc.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index ce85962..ecfdbd6 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -303,6 +303,7 @@ static int venc_enum_fmt(struct file *file, void *fh, struct v4l2_fmtdesc *f) struct v4l2_pix_format_mplane *pixmp = &f->fmt.pix_mp; struct v4l2_plane_pix_format *pfmt = pixmp->plane_fmt; const struct venus_format *fmt; + __u32 sizeimage; memset(pfmt[0].reserved, 0, sizeof(pfmt[0].reserved)); memset(pixmp->reserved, 0, sizeof(pixmp->reserved)); @@ -334,9 +335,10 @@ static int venc_enum_fmt(struct file *file, void *fh, struct v4l2_fmtdesc *f) pixmp->num_planes = fmt->num_planes; pixmp->flags = 0; - pfmt[0].sizeimage = venus_helper_get_framesz(pixmp->pixelformat, - pixmp->width, - pixmp->height); + sizeimage = venus_helper_get_framesz(pixmp->pixelformat, + pixmp->width, + pixmp->height); + pfmt[0].sizeimage = max(ALIGN(pfmt[0].sizeimage, SZ_4K), sizeimage); if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) pfmt[0].bytesperline = ALIGN(pixmp->width, 128); @@ -408,8 +410,10 @@ static int venc_s_fmt(struct file *file, void *fh, struct v4l2_format *f) if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) inst->fmt_out = fmt; - else if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) + else if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { inst->fmt_cap = fmt; + inst->output_buf_size = pixmp->plane_fmt[0].sizeimage; + } return 0; } @@ -908,6 +912,7 @@ static int venc_queue_setup(struct vb2_queue *q, sizes[0] = venus_helper_get_framesz(inst->fmt_cap->pixfmt, inst->width, inst->height); + sizes[0] = max(sizes[0], inst->output_buf_size); inst->output_buf_size = sizes[0]; break; default: -- 1.9.1