Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5536773imu; Mon, 26 Nov 2018 01:44:18 -0800 (PST) X-Google-Smtp-Source: AFSGD/W2MIIuVDTh93Bc7jouI/ca8rq1x1eekTniX5QGbnnsx2x15bMgxTcsgekOMBLKz+2BlEFT X-Received: by 2002:a63:e4d:: with SMTP id 13mr22448419pgo.369.1543225458468; Mon, 26 Nov 2018 01:44:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543225458; cv=none; d=google.com; s=arc-20160816; b=n7cDfIKmeoq4Pv5IXV+3cBKf2vTOocuGA7QNdjF0UCm3mVBR8TOOaBJLlDN7BOvThu ajxA1+TsBWt428YN3B4xjmpHJXqToIx5isvjSFb3MUssS/+fs/guwNERfvsEzEylEItn 9B6UEf7RqtGShLGEQ1laUF1OlctaTueopGkXgRIhvBE0nDfZLRafgbDz9w6i3RP/3Ry2 H4V+Xn1gb/PxdWIZJcz1N9qaPvyYB2TRihS4VqLdQWYTyK0r5OUyTZVPhuREG2m+AHO8 Vopw+oMa+rH1MfaMw5X4BUM+33zPT8rV0PKaixirpsTWJs2acgUQeOJWFtXZ6ucDr/nu 9D6A== 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:dkim-signature; bh=jwAGUSJpReVLkr5hP7nDzH1OIe8/MwJOpl/HUzuKt6U=; b=uNfLC3L86mWRjpI6zZjH2wGdlEB5xmCFqZ4NgukpzUdf7QYi+CI0Pw+kfWfFnuoycZ y2SDjo3JwDQXskAHZYU3ZrJLJ2YUqGjSevnGJvpeQTO+ljluKpNvUSOdZYrpN4AZUbHh zj4+ztv/5iLEgNuOMckhwBigtrhRja7FMReFsfjCaVRh/n+BXtOiVL+l1/JBxGOtspoz 6ngClNVvDap8KN986iqzD/B+WjMj4f0fqNP9USc74QZMi51mo4P4vWb4v2GoeGDS3JQV NhASS4ZqgdZ/CyxVD/IraCRGWPZZ7ZYQj325x9JPGFZr6N79RtpXiRe/3B9xgMMwFtUb uX/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NG6KQPPS; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n10-v6si49237400plk.255.2018.11.26.01.44.01; Mon, 26 Nov 2018 01:44: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; dkim=pass header.i=@linaro.org header.s=google header.b=NG6KQPPS; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726251AbeKZUg6 (ORCPT + 99 others); Mon, 26 Nov 2018 15:36:58 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:44466 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726177AbeKZUg5 (ORCPT ); Mon, 26 Nov 2018 15:36:57 -0500 Received: by mail-wr1-f66.google.com with SMTP id z5so13808739wrt.11 for ; Mon, 26 Nov 2018 01:43:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=jwAGUSJpReVLkr5hP7nDzH1OIe8/MwJOpl/HUzuKt6U=; b=NG6KQPPSnu4bRTA4iasMnrjlWjTm/ikqSDahO+WYfqOpolQSBg0CYTRIb7r91EcaVG yKeN4VaaE16JEsOa9PrAF8gl1p7WxYOwtIzsWLvYLI01qpIL3ytS039/6nYl9nR2Tgjw gO2QfgbTHLzABXrw7Ltn507r1Q2duZL2op7aE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=jwAGUSJpReVLkr5hP7nDzH1OIe8/MwJOpl/HUzuKt6U=; b=ZlaDU4AdG6yL2xIyIF7kkXutkN6Ec7P0OBoaM9MagA+irF22W6AqJNghSQyCz8g9SJ yP7EdwPaNCbxNb4tDvTfUUBqlL+aei2wg8YSIRRCUcLIFurhJsL6m4JR7SLAqmw9h1xC H3bUYpP+Qm7m2kxy+qw0hPGD9Ymzna0ox1t9L10pY1WJG6SLY0XP4PbMw5XyI5ojaM+u 0B1ou64+VLMURuRBkvAih1jM2aie7kwraJ6U+VN/VTPRqixSJQ3gP1dLfLW4z+Uh1mp1 WcDt1ZvEbTKW5QrA8wpE9XoVKl119/o9U+yuYMaq/Y1k9fZzPcc5R9TcQi1DyFSLXeod zZyg== X-Gm-Message-State: AA+aEWaOez1DW+mlLge+iGckez2jEzoZlwlXBKcrrmMmSVb3a2jGpWEL YmZzwnDky+tLna2Q7uaPg8gttA== X-Received: by 2002:adf:bc87:: with SMTP id g7mr11365680wrh.250.1543225402805; Mon, 26 Nov 2018 01:43:22 -0800 (PST) Received: from [192.168.27.209] ([37.157.136.206]) by smtp.googlemail.com with ESMTPSA id r196sm214361wmd.40.2018.11.26.01.43.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Nov 2018 01:43:21 -0800 (PST) Subject: Re: [PATCH v2] media: venus: amend buffer size for bitstream plane To: Malathi Gottam , 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 References: <1542696783-23016-1-git-send-email-mgottam@codeaurora.org> From: Stanimir Varbanov Message-ID: <986d29fb-bc31-a6e3-1a10-499bebd8f5f5@linaro.org> Date: Mon, 26 Nov 2018 11:43:19 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <1542696783-23016-1-git-send-email-mgottam@codeaurora.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Malathi, thanks for the patch! On 11/20/18 8:53 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 > --- > 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; please use u32 for kernel internal variables. Otherwise looks good to me: Acked-by: Stanimir Varbanov > > 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: > -- regards, Stan