Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp742640ybj; Tue, 5 May 2020 06:58:44 -0700 (PDT) X-Google-Smtp-Source: APiQypJvAimpWCkNSwG4aBTreeWmPoQg6y2JTdARc64o4VGoY/a1ApjPT4x7ELxJHhGOkFj+ct2Z X-Received: by 2002:a50:cd55:: with SMTP id d21mr995052edj.115.1588687124094; Tue, 05 May 2020 06:58:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588687124; cv=none; d=google.com; s=arc-20160816; b=lK5fr0BIwzS1udGoaxS4Wc9E6Bw8xpJih+B+qTXo57aCX4oj+DA7HR+CGiBTVk5DxX SyYpqZKt9zrGso8sUm2844+qCn/RgfV32itE0dRdHnxM9IW3MUdt5OtdnqhhzwQh+hTf UCy8xi4P/30ZOBKfUlUDLkPI5YJnxmA07VdES8N2PZAnwud+n3/8RvD7oNP/2PSR4s/t 8nmsXiOlM+1MECf1oTRYutF/z89mgcTTzFbuXVcg/5gUX2veJxbgLjogNBxQFl18Em9R +mjsJIII0xzEPj6ON5QnrzHB38F1FGbYBv/uQrGBAA/u74h1CMa9l078l0VocTsjZCKW WXoQ== 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=kByI+w+1r3yVREOJZ6z093OJKNl72Y1CH8ahM0Q63XY=; b=ROkCTDhnzFz87SC1VmOzqpg6pnzGXlH4BzaiqJC/Ktb5gQ9gSYk8GXWjUhtAjOoZ9g wF6zqgsb3Mba/pFU7MpxIyd3G+n++H50Ljv/ojFI5IbLHWOM1FfdqaJy3IpWi6CEzci1 7y4gdTM0octHQQyd5ss0JQ62ebVc1Y4Dg82D47PIBC/815w788OucJ8l2Y+Uj073muJ7 W6Ky4rT3jM79HJhLOS+/x8cEaZg2+y/T75Vo9l2pJvPPHFHGR9O1V8pW599lMYTFFv4z x1qfBb4HV7Y5jfvGtEvVGgabKVjElxaB1s3DcdLsskpXN8SLbptlUEvxewK2KEq+amwG uMMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ipNtgkcP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id j18si1323699edj.12.2020.05.05.06.58.21; Tue, 05 May 2020 06:58:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ipNtgkcP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1729234AbgEEN4T (ORCPT + 99 others); Tue, 5 May 2020 09:56:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1729202AbgEEN4R (ORCPT ); Tue, 5 May 2020 09:56:17 -0400 Received: from mail-ed1-x541.google.com (mail-ed1-x541.google.com [IPv6:2a00:1450:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEDBBC061A0F for ; Tue, 5 May 2020 06:56:16 -0700 (PDT) Received: by mail-ed1-x541.google.com with SMTP id r16so1848158edw.5 for ; Tue, 05 May 2020 06:56:16 -0700 (PDT) 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=kByI+w+1r3yVREOJZ6z093OJKNl72Y1CH8ahM0Q63XY=; b=ipNtgkcPwQaCd/KFAKKCzEcUcKFCfb7x3z4NEVWMwUh94Bu54C4AbN3A72Y5hKnJ+n oiStdLca3s0SQIKFEVG/KxqF9OkQx3cbrCDG4u9U3+xQz/xE655gmDYg1+OJeblGE2Iu Y38P1mTpYn7m6tr5ZZYBBkCmxVOIAJ/Cck6YE= 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=kByI+w+1r3yVREOJZ6z093OJKNl72Y1CH8ahM0Q63XY=; b=VC7LZ8xhyJeGc5QOzSn5Lo1MTPpqWplJ/AyEL3wcXcAQLV42CxYtjcDEmDzcxMsHXh hxA8oWl+pHnCauOrokXEUzfVD2uagRICfXiIBTusLV4/IuSYpy21UB1trHTuVfdLfCqn EaRJ9iIhTUORagw4UNLW3553lt7qFH9NfOLstrIG5EOhIV9VgKjZRtIM0ZCelclIBNAI wSPSqFjbOr5+M+5GRr0C10GJszzliFi5i6Llng3JyeChm/IMTduuqu/I9fRVUgZpP5yQ pwjHXQzrqyA05waaabxtipZMP5HXF2H+diNchEGDjHAOQuPWKaqvSQNgrKUPiOJ1X299 I7Nw== X-Gm-Message-State: AGi0PuYOTMm0bMN14gGJ6AyKJI+ETTeGLut1N6094XqmZnl6fWlcdfNM Tn3kf/r2EifFLLMRvrOapZJXBUa6uM1mPQ== X-Received: by 2002:aa7:cb43:: with SMTP id w3mr2651240edt.95.1588686975283; Tue, 05 May 2020 06:56:15 -0700 (PDT) Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com. [209.85.221.51]) by smtp.gmail.com with ESMTPSA id o17sm332460ejr.76.2020.05.05.06.56.14 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 05 May 2020 06:56:14 -0700 (PDT) Received: by mail-wr1-f51.google.com with SMTP id y3so2900694wrt.1 for ; Tue, 05 May 2020 06:56:14 -0700 (PDT) X-Received: by 2002:adf:d0d1:: with SMTP id z17mr3809161wrh.295.1588686973780; Tue, 05 May 2020 06:56:13 -0700 (PDT) MIME-Version: 1.0 References: <20200505134110.3435-1-ezequiel@collabora.com> <20200505134110.3435-2-ezequiel@collabora.com> In-Reply-To: <20200505134110.3435-2-ezequiel@collabora.com> From: Tomasz Figa Date: Tue, 5 May 2020 15:56:02 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 1/3] media: rkvdec: Fix .buf_prepare To: Ezequiel Garcia Cc: Linux Media Mailing List , "open list:ARM/Rockchip SoC..." , Linux Kernel Mailing List , kernel@collabora.com, Jonas Karlman , Heiko Stuebner , Hans Verkuil , Alexandre Courbot , Jeffrey Kardatzke , Gustavo Padovan 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 Ezequiel, On Tue, May 5, 2020 at 3:41 PM Ezequiel Garcia wrote: > > The driver should only set the payload on .buf_prepare > if the buffer is CAPTURE type, or if an OUTPUT buffer > has a zeroed payload. Thanks for the patch. Just one question below. Where does the requirement to set OUTPUT buffer bytesused to sizeimage if the original bytesused is 0 come from? Best regards, Tomasz > > Fix it. > > Fixes: cd33c830448ba ("media: rkvdec: Add the rkvdec driver") > Signed-off-by: Ezequiel Garcia > --- > drivers/staging/media/rkvdec/rkvdec.c | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c > index 225eeca73356..4df2a248ab96 100644 > --- a/drivers/staging/media/rkvdec/rkvdec.c > +++ b/drivers/staging/media/rkvdec/rkvdec.c > @@ -456,7 +456,15 @@ static int rkvdec_buf_prepare(struct vb2_buffer *vb) > if (vb2_plane_size(vb, i) < sizeimage) > return -EINVAL; > } > - vb2_set_plane_payload(vb, 0, f->fmt.pix_mp.plane_fmt[0].sizeimage); > + > + /* > + * Buffer's bytesused is written by the driver for CAPTURE buffers, > + * or if the application passed zero bytesused on an OUTPUT buffer. > + */ > + if (!V4L2_TYPE_IS_OUTPUT(vq->type) || > + (V4L2_TYPE_IS_OUTPUT(vq->type) && !vb2_get_plane_payload(vb, 0))) > + vb2_set_plane_payload(vb, 0, > + f->fmt.pix_mp.plane_fmt[0].sizeimage); > return 0; > } > > -- > 2.26.0.rc2 >