Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5815715imu; Mon, 26 Nov 2018 05:39:18 -0800 (PST) X-Google-Smtp-Source: AFSGD/X26g7TjJqF51mX34VKy3zPoXvVtnd3wwZkpchU+zjNjiYb0Vlnv6MH2OAXGx3wIllarG0m X-Received: by 2002:a65:5c04:: with SMTP id u4mr24191080pgr.229.1543239558503; Mon, 26 Nov 2018 05:39:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543239558; cv=none; d=google.com; s=arc-20160816; b=gY3C22dtxDDfZW2TItB+EcCtb2y/5yk0+BIvtjcA/4WeFJNuBQ77VQZcScvrLeFjbR fUrPyb2B1mJLzxgvB9ckUMTcGTJSYtpO9abKopfB+N61d6DSRqEZVjPbkzzTQpMe9+2f SPLiQuYUV1++j1EMxJg9nUgkzSt8+9iWN5PiEDy6hrNotKQHtcCM2w+3rZek6QtxFMia poe8BHpvi5vIyPm5UvFjRUkPxhpb01VugZaolMGhn/zieOe+TflnDN0Uk1ckRML7yvIn pu7NvDyoxGSDMu8iGFhMGwT0naDugY4JueQq2GdmXI+s/5aGzo2t3MKsZRibOgKTmkTW GI0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=gdmTdaK03iWN4Ac5OUAk0Sdvefh0rKSZYflOKUyD2j4=; b=phJx0WmFdF4OGezmz41YwVZISuZLuPl6Bw2vwprt7GrZm+/BVWb35b76IwivH8IPvA vo82/7RHR2rHu63umGA8+fCZ05lWXOep21Na20/tqIuQQMxgHdX/k0KMzqZwJeNHO0Z/ j/MZ83TNVRfVb0PZU7H56H9f6ZBplTiDJeglOvdIuXZS9/X6D8PwHD4nTlLUe+DlbWo+ LoyfMG30yRHYaptyn//7VyCQbIKXpHyAx9clnnw5SFEbwav6GggOrSQp0DLxH9AfUVkO zWRxIDQn2Gtu+Yy4NFS3MYnKr+uohvf/DFPFL1KTeZnLVGoPEti4DNDKHNmSXSzX79mq yVmg== 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 h9si338728pgb.319.2018.11.26.05.39.00; Mon, 26 Nov 2018 05:39:18 -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 S1726470AbeK0Abw (ORCPT + 99 others); Mon, 26 Nov 2018 19:31:52 -0500 Received: from lb2-smtp-cloud9.xs4all.net ([194.109.24.26]:57294 "EHLO lb2-smtp-cloud9.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726231AbeK0Abv (ORCPT ); Mon, 26 Nov 2018 19:31:51 -0500 Received: from [192.168.2.10] ([212.251.195.8]) by smtp-cloud9.xs4all.net with ESMTPA id RH4xgkJpRbGVyRH51gYTOT; Mon, 26 Nov 2018 14:37:40 +0100 Subject: Re: [PATCH v3] media: venus: amend buffer size for bitstream plane To: Malathi Gottam , stanimir.varbanov@linaro.org, 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 References: <1543227173-2160-1-git-send-email-mgottam@codeaurora.org> From: Hans Verkuil Message-ID: Date: Mon, 26 Nov 2018 14:37:35 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <1543227173-2160-1-git-send-email-mgottam@codeaurora.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4wfHlDvhGtegRXaepWxVP2eAKmMDjUfPp4FU91bmsLEpKHYbfhSSfAGU2VmjcDvyAE1F51sJ1FUjZ+ek+kvH+xHCcIgsGlVqUP+X8iNt1DS6xIQ1m+Fltb jmEJ+0M3XHX43DHIGpaE93IXRrIbFK9biW+Ke+Y6Y+PgplnIFpzp/LKwpwt/weW/idxVQHw015jUiE6aXVZrxYOmmjQkaOsWKTM8pxaNcWFhpsWsGyY7pBfI F9btWV14cA9Yj0PO3PMKyqaYzQX4UU5ZDXkWNASeYPe4dMPdtgRshh6Id7tNrt9hYykZ3JYj0yhrvVoL/x1Z0AgzUmo4LFHMC2WxRuAuUnOaeJEsZ8AH/sbO oHOHbh31XaHmDV/CAQourD709msJpZ5NSOaN+NuFM3wKm2IbhuksaeXP2Cvwjnc2I8PhhwmYXQ5Z+rYD4gc690GcNxJxcg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/26/2018 11:12 AM, Malathi Gottam wrote: > 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 Sorry, this isn't allowed. It is the driver that sets the sizeimage value, never the other way around. If you need to allocate larger buffers, then use VIDIOC_CREATE_BUFS instead of VIDIOC_REQBUFS. What problem are you trying to solve with this patch? Regards, Hans > --- > 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..e43dd3d 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: >