Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5464877imu; Mon, 26 Nov 2018 00:24:40 -0800 (PST) X-Google-Smtp-Source: AFSGD/VEmqp36yD/vVBFTxzwUkALP6VMgMMmKX6GmEpnxQg//6eZ/RqR+LhXzCZsqSIeiqbcRP0/ X-Received: by 2002:a17:902:4324:: with SMTP id i33-v6mr27173069pld.253.1543220680611; Mon, 26 Nov 2018 00:24:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543220680; cv=none; d=google.com; s=arc-20160816; b=MKFYRjnUUpoLci5fZnXbNBBLRhmaDCggdd0Hbdj8fU3oEw7FNaJudqCV+/F0tSWEdX Z0RPr4b7WjNjI8QjRmxGySVB/32aWA7dKjw876PmjIj6+0nnMLaSch52FpR8BgvXGXBZ gIUBHUclhhtAi0GZO0X+oe6Fe5PWEt4A5GEO+Uceo97EpAfqRJfNzvru8JJWkJv9iX97 QqPWIkjMlXkCRVHN7GTTqe6fc0251VX7wFM34pEsZtP9GbDbXylQhqqJqogrhlFr9HFG gF4VvTOeJW0r9Iq72GNM9FO8KOMiqjLi8aG95qlQ3FNXNMTq8k/cu9wZc3dfSmFkITXZ 1Hcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=ULT/Aj3Zmut/IPJW9QflK8qisZnF9iE79i+We+hGGCQ=; b=dCRqgZOpMN35ww/jMlBvHFDe6JkCkqJgOkNw9yqFUvD3GBl+SIgGeN3M64VkSwNUcK TYrBOuBdcMiCxRjUpCSXwnHcj6813QkMxjeNyqYTiLNIlldyriaizHhHsAu2Tcs6vA7Y /U/xCDBCoW/2jFSYLeWcCFaJDRqrU1wH72I7tTI6FybWxZ/elgXWJq4KSgzN6/iiptkV /MpVAhPyby8AO/9EZUgXZuSXcpIn5TlbxQsFFWTxcwJyskXgZdg9usbe/qiklhshFeu2 0HB0T53fIa5lSK0UTDFn2LaCuatvVPKvnY4sj+S+0Ho9XpN5366vqJO33bH8XdrkxTZU NM2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=lOKenlEJ; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i6-v6si31247923plt.328.2018.11.26.00.24.20; Mon, 26 Nov 2018 00:24:40 -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=@chromium.org header.s=google header.b=lOKenlEJ; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726343AbeKZTPV (ORCPT + 99 others); Mon, 26 Nov 2018 14:15:21 -0500 Received: from mail-oi1-f194.google.com ([209.85.167.194]:45688 "EHLO mail-oi1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726191AbeKZTPU (ORCPT ); Mon, 26 Nov 2018 14:15:20 -0500 Received: by mail-oi1-f194.google.com with SMTP id b141so14992841oii.12 for ; Mon, 26 Nov 2018 00:21:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ULT/Aj3Zmut/IPJW9QflK8qisZnF9iE79i+We+hGGCQ=; b=lOKenlEJXafNg1+6oykrACkn7SW8DK+pyKbWB6ddccYJs4ZOETkPeIR44ZjbNSMj9d 3pdX0e7s/xSZrKI25kn4ZRBIzbTdCg/QjO2o816P7saopNfEHKow6nGq2t7yiPR402uU 0K8C0HNeUws9pulm0FHLPz3uyrCADVK1QjGn8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ULT/Aj3Zmut/IPJW9QflK8qisZnF9iE79i+We+hGGCQ=; b=d8/+I11sgoj4CNwf60O7A4BWLNBGP8/7nAsSkeiVMHI5YBGAnojNfiA5mSoAc5iKEk wKeatXK5Gft/0gL6mlomSnjqoxxj7arvboirOl8uo9hZdodz6HQOWi/ZXqcP1Q3Qxz3C bbEtWkdPBKBFnfX+HY5j329Dt67f+9wOO+P0qBKnWCQwAiehF3P7kVE8ztLkg10grdAU oeYMUeoJw/H5Hf1EiNE5bnL6H0Z0eNNKOBlCcxPDFVdnbQVt69Bqc/le6K2t7FtS012x EPPmJQqsV4DEcS7y5PveRrVDtZ/fwLwLWqx01UIXAdYe2uXxHIQESUEXVZqTFKolVvat xNEA== X-Gm-Message-State: AGRZ1gKhuXYJuLEwQUlMtZYagIkxRSJFiedB3DH9EqIin0XcqeA8wcYc CAbV1ytKCoiUEYjA3Gy2WITZvTHxrTTXNw== X-Received: by 2002:aca:220b:: with SMTP id b11mr13836398oic.87.1543220519096; Mon, 26 Nov 2018 00:21:59 -0800 (PST) Received: from mail-oi1-f175.google.com (mail-oi1-f175.google.com. [209.85.167.175]) by smtp.gmail.com with ESMTPSA id r203sm8273830oih.11.2018.11.26.00.21.57 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Nov 2018 00:21:58 -0800 (PST) Received: by mail-oi1-f175.google.com with SMTP id u18so14998642oie.10 for ; Mon, 26 Nov 2018 00:21:57 -0800 (PST) X-Received: by 2002:aca:a60d:: with SMTP id p13mr15214453oie.2.1543220517187; Mon, 26 Nov 2018 00:21:57 -0800 (PST) MIME-Version: 1.0 References: <1542696783-23016-1-git-send-email-mgottam@codeaurora.org> In-Reply-To: <1542696783-23016-1-git-send-email-mgottam@codeaurora.org> From: Alexandre Courbot Date: Mon, 26 Nov 2018 17:21:45 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] media: venus: amend buffer size for bitstream plane To: mgottam@codeaurora.org Cc: Stanimir Varbanov , Hans Verkuil , Mauro Carvalho Chehab , Linux Media Mailing List , LKML , linux-arm-msm@vger.kernel.org, vgarodia@codeaurora.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Malathi, On Tue, Nov 20, 2018 at 3:53 PM 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; > > 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: I think this should work, but don't we also need to do the same thing for the decoder's OUTPUT queue?