Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1471494imm; Wed, 19 Sep 2018 20:05:00 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda0P4gBwPfFoMHFebMvWOfHJnr23CqkKZheRplLt5RtlJjWEhIPZ+e77Lmh0w66x8wy2/PE X-Received: by 2002:a63:5204:: with SMTP id g4-v6mr34589360pgb.274.1537412700668; Wed, 19 Sep 2018 20:05:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537412700; cv=none; d=google.com; s=arc-20160816; b=VJniW31sc1QNoZotCJEIAvZYMRG5MYsf1BKEEz4ELEQITa6Ga0Sdn6RfVZCM6q5GoB 3PEMIGsZTzNkfDOunF7lHoFgT0M9UQLc6UwueQGlxGJM+lv85CWAmcuBSDRBA2YlPgRc uRVKTm3phcvE6r5Jam/XtfxJ6TDzcAdOLpF81mZMFc/xB3UREVRGzX0MkZ0gM70KAZwT tVrlMD+IGoGPuueVELcwyKkkfSnSyrXjC4aCJhvopRvhdoYejGnkJy9niylK2hlXixz7 4QxTqFRUVTn8yKu/qQye7uNptaiWzCu2rjrPj3vw0WsSdJHGuPJyHN8GzW37hRBFVlxn LYyA== 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=og13gTBJ4YCJ6/6HXAWAI/PXTEqh5+EDcfQi7Z8j7Yo=; b=V/1w9AmeEoodOcDcdXxXzoOCidBU2XELyfZ41PE9N5jefFBQvrtNz4gt2eeyDsKTuQ hdWZ8hdJD8g/vm03Jvim1mKyAtvf0JhLtwqimfmoFO4D38r5M84Qg4AQRanRuyYmNQIy Jdr4fPVQou36ud9590Gi5AtvG3JslGCXMxV1rfqP2A0ZEz4tn1QW8e75ycs0n8n2xNtP 1APAT6k3pixNHbJ9P3br4AJqkJHdMZjk/4rwl+PO+rpmHB7NkvTTJu+4l4hm0UaO/Vp6 j/v5Mmm4hlBhBFRePDrFgiemJRu6Lrh3Hb04C06DvAA4Qe4WxYRUciAa1OAaM2Ym0E6q wvwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=fKrFWAAm; 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 e8-v6si22779739plt.57.2018.09.19.20.04.44; Wed, 19 Sep 2018 20:05:00 -0700 (PDT) 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=fKrFWAAm; 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 S1733288AbeITInx (ORCPT + 99 others); Thu, 20 Sep 2018 04:43:53 -0400 Received: from mail-yw1-f65.google.com ([209.85.161.65]:41976 "EHLO mail-yw1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730446AbeITInw (ORCPT ); Thu, 20 Sep 2018 04:43:52 -0400 Received: by mail-yw1-f65.google.com with SMTP id q129-v6so3176867ywg.8 for ; Wed, 19 Sep 2018 20:02:46 -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:content-transfer-encoding; bh=og13gTBJ4YCJ6/6HXAWAI/PXTEqh5+EDcfQi7Z8j7Yo=; b=fKrFWAAmqXvWIN7L/o/eRwL1CUOOCduWshYOJFm98jG+3WMfca/x9faYQhocI7bad9 lStvIeDx6sCo1UHOFNGft0/j2YRcsSOAKtU+BzmiZi9Tg/siaXfSs0Vy0rrOUn/0NkEK th2vk1l9Bedw5vaWbg+Tm/hsDpEFd0gUcRGgw= 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=og13gTBJ4YCJ6/6HXAWAI/PXTEqh5+EDcfQi7Z8j7Yo=; b=YY7bZ5WJAN6BkbVJ0vLV/zspShMD0u/x624wB9xt50fQCqKWTRmRF1wRDJom6O8pmE pt3p7BX0tBT980WYMXlkIK0VlwY6kw9xBRM3U/rhC5/WcO0EWFyZRFK4iYO1FNe/WNUa /vrdolyjFYDXePBfOUIa5IRlpF19R6Q3S4N3futgpBQx37+E7tlT9BmBQgAtL2xs4Yhq HydmJBMgtboBt7dj4imHzPDKnK7g68fZYqQWlzecQ6tAu2qShQpo+lIYo+1DHqXUOVlp wS0WLGTfwjhhZMA1MgcUviTDNdq1BIQZ6rh9fipqqalYGXzLrzWPwwQiYzQMm4xTb+qX KfZA== X-Gm-Message-State: APzg51DYw/fPiBRpWfQcAZdJfqusS6TwT7FmC6LFUFv0jTBXHhl5oiVI qoGWc6Dse36772NHmoG2o51jk99qhg8Iwg== X-Received: by 2002:a81:9a44:: with SMTP id r65-v6mr16115985ywg.165.1537412566048; Wed, 19 Sep 2018 20:02:46 -0700 (PDT) Received: from mail-yw1-f43.google.com (mail-yw1-f43.google.com. [209.85.161.43]) by smtp.gmail.com with ESMTPSA id p126-v6sm4231001ywf.22.2018.09.19.20.02.44 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Sep 2018 20:02:44 -0700 (PDT) Received: by mail-yw1-f43.google.com with SMTP id k130-v6so675689ywe.6 for ; Wed, 19 Sep 2018 20:02:44 -0700 (PDT) X-Received: by 2002:a81:6ec5:: with SMTP id j188-v6mr15617673ywc.92.1537412564118; Wed, 19 Sep 2018 20:02:44 -0700 (PDT) MIME-Version: 1.0 References: <1530517447-29296-1-git-send-email-vgarodia@codeaurora.org> <01451f8e-aea3-b276-cb01-b0666a837d62@linaro.org> <4ce55726d810e308a2cae3f84bca7140bed48c7d.camel@ndufresne.ca> <92f6f79a-02ae-d23e-1b97-fc41fd921c89@linaro.org> <33e8d8e3-138e-0031-5b75-4bef114ac75e@xs4all.nl> <36b42952-982c-9048-77fb-72ca45cc7476@linaro.org> <051af6fb-e0e8-4008-99c5-9685ac24e454@xs4all.nl> <6d65ac0d-80a0-88fe-ed19-4785f2675e36@linaro.org> In-Reply-To: From: Tomasz Figa Date: Thu, 20 Sep 2018 12:02:32 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] venus: vdec: fix decoded data size To: nicolas@ndufresne.ca, Stanimir Varbanov , Alexandre Courbot Cc: Hans Verkuil , vgarodia@codeaurora.org, Linux Media Mailing List , linux-arm-msm , Linux Kernel Mailing List 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 Thu, Sep 20, 2018 at 12:53 AM Nicolas Dufresne wr= ote: > > Le mercredi 19 septembre 2018 =C3=A0 18:02 +0300, Stanimir Varbanov a > =C3=A9crit : > > > --- a/drivers/media/platform/qcom/venus/vdec.c > > > +++ b/drivers/media/platform/qcom/venus/vdec.c > > > @@ -943,8 +943,7 @@ static void vdec_buf_done(struct venus_inst > > > *inst, > > > unsigned int buf_type, > > > unsigned int opb_sz =3D > > > venus_helper_get_opb_size(inst); > > > > > > vb =3D &vbuf->vb2_buf; > > > - vb->planes[0].bytesused =3D > > > - max_t(unsigned int, opb_sz, bytesused); > > > + vb2_set_plane_payload(vb, 0, bytesused ? : > > > opb_sz); > > > vb->planes[0].data_offset =3D data_offset; > > > vb->timestamp =3D timestamp_us * NSEC_PER_USEC; > > > vbuf->sequence =3D inst->sequence_cap++; > > > > > > It works fine for me, and should not return 0 more often than it > > > did > > > before (i.e. never). In practice I also never see the firmware > > > reporting a payload of zero on SDM845, but maybe older chips > > > differ? > > > > yes, it looks fine. Let me test it with older versions. > > What about removing the allow_zero_bytesused flag on this specific > queue ? Then you can leave it to 0, and the framework will change it to > the buffer size. First of all, why we would ever have 0 in bytesused? That should never happen normally in the middle of decoding and if it happens, then perhaps such buffer should be returned by the driver with ERROR state or maybe just silently reused for further decoding. The only cases where the value of 0 could happen could be EOS or end of the drain sequence (explicit by STOP command or by resolution change). In both cases, having 0 bytesused returned from the driver to vb2 is perfectly fine, because such buffer would have the V4L2_BUF_FLAG_LAST flag set anyway. Best regards, Tomasz