Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6219190imu; Tue, 13 Nov 2018 20:14:43 -0800 (PST) X-Google-Smtp-Source: AJdET5eIVE2+Uppg1zaSOJht1In7dVDn+2J+BM19NtH9uvXkKHtTR5MNBTPnG1a+49f2C+Y50nQf X-Received: by 2002:a63:6643:: with SMTP id a64-v6mr311819pgc.15.1542168883730; Tue, 13 Nov 2018 20:14:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542168883; cv=none; d=google.com; s=arc-20160816; b=fCgbI63qwOok5z9niGG7N8qYPEccQicWpQ5VaRe2G9n8lZzACeIhgA4E22sIJSxSTo QqMiryxbIQO0bgF3Q1ZC4krrOPy0WU77vsF0wJ0RscVF3nzUhII8253jiZpg6xBT5RCr BDh48m8bLDAkEJ2XeHbLtArpjvqpegsLLKUyeV93WUV5C8E+FRWdyiaYPIGbJ9wRQAJa cWPk2njTRaD72R552vb0QNBHfJHQNGQHLca/xB6junNT7t3/Ev7FQgRq+bj/0Z+8XUii OD8QfbLwI4i545SYUWud2fhkH77j24Bn94zjnmbONfTzGmFHCxVPMrufIQKCx59MuaBs zZMg== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=pSciaaazLU+tsRiAXIAu1T0fgKnu1OCPXb5F+gL2BOQ=; b=Xtj6f3HsVHnOCO6iNe4rOohrfEbzSpvs2mIPzcrfK+j47zNzsNNPU5vYlofIyNIrL4 pmVs3wu5xUiMc9ifB+IimyhqZaSyKXFYXCvdAYzR1xWhZ17ccKAGnlfClwVJY5V5FhnP MULKBOp25DAT8dhu3ZKWAv/f2xp6s6ab3+Q0miwfFs1In7AMGj+1e5PCMj7yOtcHn2Ot HoTXqRn3ojG6LWiTkKyGN7MN+sK9xQlg3wofk1nlNWOq/Uzo1Rt5T8q9CChxewkEti9F TDxQapDXX2yrDGS/ekCxDLMn/g4x6jQCzbxz2ye6KTFI8bEpL5xdEp/fLZIHVydeZdmH tYVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=CWNG3NPw; 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 y7-v6si21911002pgi.256.2018.11.13.20.14.15; Tue, 13 Nov 2018 20:14:43 -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=CWNG3NPw; 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 S1730998AbeKNOO1 (ORCPT + 99 others); Wed, 14 Nov 2018 09:14:27 -0500 Received: from mail-oi1-f194.google.com ([209.85.167.194]:42266 "EHLO mail-oi1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727251AbeKNOO0 (ORCPT ); Wed, 14 Nov 2018 09:14:26 -0500 Received: by mail-oi1-f194.google.com with SMTP id x63-v6so12439120oix.9 for ; Tue, 13 Nov 2018 20:13:00 -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:content-transfer-encoding; bh=pSciaaazLU+tsRiAXIAu1T0fgKnu1OCPXb5F+gL2BOQ=; b=CWNG3NPwF16VQ2F4n4I9v4PJAe0jn/GVB3N9nkNzNjLsHqDvbWUN+H8g2JnEEpowp/ zv+JytzYuR/13ERA2gOIwSZDCfEnOoa/l0U4AhS6TOg0yZbPDRQepmOamRpkSICG5hFv OlvgyQ5qGrs0AXPYoWFDHJMXmwxT5wUwHwAbw= 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:content-transfer-encoding; bh=pSciaaazLU+tsRiAXIAu1T0fgKnu1OCPXb5F+gL2BOQ=; b=hsfP4J4icUOmPH7+IMbJACwAKKBiqz/mQdjZgCJgXkJ0A23DIJ1rhZapAWlLlFOrHr POeuUQb1GGc7GFtzY/X66DXujdD0gUilFoXW61AIuSaECF1gp9zkA186Z9+vnsUzG7wD 6guZ2KXejvhTKf1HIscrH/xGODt4t0MJ90+r8Tx3MqD/MEPiGBllDx/CF/TAI95OomqN JrWW57fe8+bhz9lIibOYFsxfqk1kKu97nxf8yu/PGoBR1Go9BEZUFO4PE01ugjOOV56u ghrj28M9XV8ydh9cx4HObxIM0lkanScwNah0m4lB+3Rk19JAHMR0khlyzp1tWJlhTW1J 0rkQ== X-Gm-Message-State: AGRZ1gLNwN8cb7z5jxTHWuejLltrND4txjfmp1YTTtj59OSocZczSjpW R6ttUYynIx+XzE936YSkB/XzY61XGc5Zkg== X-Received: by 2002:aca:afcb:: with SMTP id y194-v6mr154265oie.199.1542168780063; Tue, 13 Nov 2018 20:13:00 -0800 (PST) Received: from mail-oi1-f169.google.com (mail-oi1-f169.google.com. [209.85.167.169]) by smtp.gmail.com with ESMTPSA id p37sm15149594otc.27.2018.11.13.20.12.58 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 20:12:59 -0800 (PST) Received: by mail-oi1-f169.google.com with SMTP id x63-v6so12439082oix.9 for ; Tue, 13 Nov 2018 20:12:58 -0800 (PST) X-Received: by 2002:aca:5a41:: with SMTP id o62-v6mr146623oib.323.1542168778386; Tue, 13 Nov 2018 20:12:58 -0800 (PST) MIME-Version: 1.0 References: <20181113093048.236201-1-acourbot@chromium.org> In-Reply-To: From: Alexandre Courbot Date: Wed, 14 Nov 2018 13:12:46 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] media: venus: fix reported size of 0-length buffers To: Nicolas Dufresne Cc: Stanimir Varbanov , Mauro Carvalho Chehab , Linux Media Mailing List , linux-arm-msm@vger.kernel.org, LKML Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 14, 2018 at 3:54 AM Nicolas Dufresne wro= te: > > > > Le mar. 13 nov. 2018 04 h 30, Alexandre Courbot a= =C3=A9crit : >> >> The last buffer is often signaled by an empty buffer with the >> V4L2_BUF_FLAG_LAST flag set. Such buffers were returned with the >> bytesused field set to the full size of the OPB, which leads >> user-space to believe that the buffer actually contains useful data. Fix >> this by passing the number of bytes reported used by the firmware. > > > That means the driver does not know on time which one is last. Why not ju= st returned EPIPE to userspace on DQBUF and ovoid this useless roundtrip ? Sorry, I don't understand what you mean. EPIPE is supposed to be returned after a buffer with V4L2_BUF_FLAG_LAST is made available for dequeue. This patch amends the code that prepares this LAST-flagged buffer. How could we avoid a roundtrip in this case? > >> >> Signed-off-by: Alexandre Courbot >> --- >> drivers/media/platform/qcom/venus/vdec.c | 4 +--- >> 1 file changed, 1 insertion(+), 3 deletions(-) >> >> diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/pl= atform/qcom/venus/vdec.c >> index 189ec975c6bb..282de21cf2e1 100644 >> --- a/drivers/media/platform/qcom/venus/vdec.c >> +++ b/drivers/media/platform/qcom/venus/vdec.c >> @@ -885,10 +885,8 @@ static void vdec_buf_done(struct venus_inst *inst, = unsigned int buf_type, >> vbuf->field =3D V4L2_FIELD_NONE; >> >> if (type =3D=3D V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { >> - unsigned int opb_sz =3D venus_helper_get_opb_size(inst); >> - >> vb =3D &vbuf->vb2_buf; >> - vb2_set_plane_payload(vb, 0, bytesused ? : opb_sz); >> + vb2_set_plane_payload(vb, 0, bytesused); >> vb->planes[0].data_offset =3D data_offset; >> vb->timestamp =3D timestamp_us * NSEC_PER_USEC; >> vbuf->sequence =3D inst->sequence_cap++; >> -- >> 2.19.1.930.g4563a0d9d0-goog >>