Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp649439ybb; Wed, 25 Mar 2020 07:04:39 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtGnlyRiZEEsDp/b/RGnp/lcTFeQLR3NRcF5fWY1TKMpsXMMHLOehO9ILE2ncgmISvRHfdD X-Received: by 2002:a05:6830:1495:: with SMTP id s21mr2706096otq.35.1585145079136; Wed, 25 Mar 2020 07:04:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585145079; cv=none; d=google.com; s=arc-20160816; b=U2+3N7ddAnHTYJQuUqHTwUv7G44L60lN7+WW9MaaI3lKlOTsg8t3QIU5CiFsJQou35 v45erfBOyoIaGp5IKbSd+D79zlosbuJFT4HLXiJCorJ73mjJNbAj6rQDkJ5EUDd08Do+ YE9XUDHMQnZpZ9g7DLISfyKbahqXPgIGbQHk0YzeeHxd+9eKccwrFxRK6TC3tZY1l6s3 WsqF7d+Bn5Q3Yxwi2zxSEa7TtLFzwO4RnHqnzUir+PVRwtlev+p/qOxZvGK35PbMlrnb EJ2F0ZZMSkTxNzTJ+dClUvmyD1kFzOBuKm+NERF0f3dPdGsMfW76UQ6LT3Me1hrnoRNa ozzA== 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:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=LQq3EFJ59LIxHUdp5oSLSjexBDEoJBV/NBKXaRpQgvc=; b=LleEKIz3SIu3WtO4zp0C8t1VyAXAJ1JP/qlTNp77oZy5CbDBGY5Ri8+79c6QdKD5dc BA2efSzeLECybxkf8ia869kn5LlZJmrrnv/XDO4SW3JwbVP3qkmvxsk01PIv6vuhoLQp iIqUHUn7sN2PqhaJSfEGuQsXV5wRvFBwrazbmBQO599oPUh0JYh5gSTFXJ9RlEz66xz9 yPoIAydDfBVKLLbRfU16BuSJNGg7GhswZbv/O2b1cFD7Pn907Ppq602y+VaVP/AZXYki N6YDogZ/qj7Z1A0rH4z5/qRo3tGkkAWLwmYND9pqp6mYceJnOIlLlZEaJJ3rc1zWKbz/ XvdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ndufresne-ca.20150623.gappssmtp.com header.s=20150623 header.b=1OGHB3mX; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s14si11145598otp.243.2020.03.25.07.03.58; Wed, 25 Mar 2020 07:04:39 -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=@ndufresne-ca.20150623.gappssmtp.com header.s=20150623 header.b=1OGHB3mX; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727656AbgCYOC5 (ORCPT + 99 others); Wed, 25 Mar 2020 10:02:57 -0400 Received: from mail-qt1-f194.google.com ([209.85.160.194]:39670 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727277AbgCYOC4 (ORCPT ); Wed, 25 Mar 2020 10:02:56 -0400 Received: by mail-qt1-f194.google.com with SMTP id f20so2184045qtq.6 for ; Wed, 25 Mar 2020 07:02:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ndufresne-ca.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:cc:date:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=LQq3EFJ59LIxHUdp5oSLSjexBDEoJBV/NBKXaRpQgvc=; b=1OGHB3mXWgyadxhaLY3ieAeTgpSZKH4oRsUgiE3HazXkZEVAwqsCRLErTjKZtIQdyN fbkDrEC6S+VmzZgQboXDr9IDzkdf0gQ5BlpMljeciRq+LbVEaU/k/yarN+NAAI1/jg/7 2vSDUIueLoLxp1spvUureG4jyqJ2ViAI7Iz3oUlmnKEZ60/P1Xi5uPW7BQ3FLPvwjlkx jTaYjo4FnyTKvfspmo/7mF6GezdoN0nwoodUN9z1Nd8WV5bJx9mZ+UwoTYYfHeqf/wgP sUG26792imTiGn9U3g/fcpbJb1ds+juIomMff0DjZZ9m1nJqhKVQMY1f61mKiT2dwF0W IRFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=LQq3EFJ59LIxHUdp5oSLSjexBDEoJBV/NBKXaRpQgvc=; b=i2/ct0p0//bFPtzA1gMsaVzDpzTH8hX+vHhSHSGiXPc+QC5A9vHtre6z0I0ZIpq4/a l4FKVEgWDb1l+giNf1PcBbeuEKYbQnSyCiA1++effJO0RAiHfPJJOmoE8SgV31O+Nt6H Kp7d6Lw8cUNt6tNCTpRSz9EeNtTopAYWb1pFySCk6Ngvoc9RxVwfhAMbeKSGrjY9XH9M FqZsq4GKh9JElyeWWZ0dBUWp0yV3eQn9EARMPoUZOgqfsn9lel4zNa4EaIYTxIOBR+R/ JHSOsn+EIHp6VOZJNIMK58m6nq/oP6/tBKbVU8m/ehDHCxFHZCstrQ6TF2qUiLh4oZNM C5aA== X-Gm-Message-State: ANhLgQ3rrWD+zPxflgHiXIA7m6ohbeqi9FxF6JNzF02a1WQQHmGdQobb cAPnyMnxP14bp6/wBNymfkSZTQ== X-Received: by 2002:ac8:6f46:: with SMTP id n6mr2978711qtv.119.1585144975048; Wed, 25 Mar 2020 07:02:55 -0700 (PDT) Received: from skullcanyon ([192.222.193.21]) by smtp.gmail.com with ESMTPSA id 79sm15313675qkg.38.2020.03.25.07.02.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Mar 2020 07:02:54 -0700 (PDT) Message-ID: <0a8f6d97e6869ff694aedd67a3176217a885c938.camel@ndufresne.ca> Subject: Re: [PATCH v2 3/8] hantro: Use v4l2_m2m_buf_done_and_job_finish From: Nicolas Dufresne To: Hans Verkuil , Ezequiel Garcia , linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Tomasz Figa , kernel@collabora.com, Jonas Karlman , Heiko Stuebner , Alexandre Courbot , Jeffrey Kardatzke , Rob Herring Date: Wed, 25 Mar 2020 10:02:52 -0400 In-Reply-To: <13b1efe1-8b52-070b-cf11-b230bd405d3e@xs4all.nl> References: <20200318132108.21873-1-ezequiel@collabora.com> <20200318132108.21873-4-ezequiel@collabora.com> <13b1efe1-8b52-070b-cf11-b230bd405d3e@xs4all.nl> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.4 (3.34.4-1.fc31) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le mercredi 25 mars 2020 à 09:22 +0100, Hans Verkuil a écrit : > On 3/18/20 2:21 PM, Ezequiel Garcia wrote: > > Let the core sort out the nuances of returning buffers > > to userspace, by using the v4l2_m2m_buf_done_and_job_finish > > helper. > > > > This change also removes usage of buffer sequence fields, > > which shouldn't have any meaning for stateless decoders. > > Uh, why remove this? For one, doesn't this cause fails in v4l2-compliance? > Also, while I agree that it is not terribly useful, it doesn't hurt, does it? > > And the V4L2 spec makes no exception for stateless codecs with respect to the > sequence field. > > Nacked-by: Hans Verkuil The spec also does not say what it means either. As an example, you have spec for ALTERNATE interlacing mode that changes the meaning of the sequence, but not for alternate H264 fields (which cannot be part of the format, since this changes often). We also don't have spec for the the sequence behaviour while using HOLD features. I'm worried we are falling into the test driven trap, were people implement features to satisfy a test, while the added complexity don't really make sense. Shouldn't we change our approach and opt-out features for new type of HW, so that we can keep the drivers code saner? > > Regards, > > Hans > > > Signed-off-by: Ezequiel Garcia > > --- > > drivers/staging/media/hantro/hantro_drv.c | 27 ++++++++--------------- > > 1 file changed, 9 insertions(+), 18 deletions(-) > > > > diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c > > index 0b1200fc0e1a..ec889d755cd6 100644 > > --- a/drivers/staging/media/hantro/hantro_drv.c > > +++ b/drivers/staging/media/hantro/hantro_drv.c > > @@ -94,32 +94,23 @@ static void hantro_job_finish(struct hantro_dev *vpu, > > unsigned int bytesused, > > enum vb2_buffer_state result) > > { > > - struct vb2_v4l2_buffer *src, *dst; > > int ret; > > > > pm_runtime_mark_last_busy(vpu->dev); > > pm_runtime_put_autosuspend(vpu->dev); > > clk_bulk_disable(vpu->variant->num_clocks, vpu->clocks); > > > > - src = v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx); > > - dst = v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx); > > - > > - if (WARN_ON(!src)) > > - return; > > - if (WARN_ON(!dst)) > > - return; > > - > > - src->sequence = ctx->sequence_out++; > > - dst->sequence = ctx->sequence_cap++; > > - > > - ret = ctx->buf_finish(ctx, &dst->vb2_buf, bytesused); > > - if (ret) > > - result = VB2_BUF_STATE_ERROR; > > + if (ctx->buf_finish) { > > + struct vb2_v4l2_buffer *dst; > > > > - v4l2_m2m_buf_done(src, result); > > - v4l2_m2m_buf_done(dst, result); > > + dst = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx); > > + ret = ctx->buf_finish(ctx, &dst->vb2_buf, bytesused); > > + if (ret) > > + result = VB2_BUF_STATE_ERROR; > > + } > > > > - v4l2_m2m_job_finish(vpu->m2m_dev, ctx->fh.m2m_ctx); > > + v4l2_m2m_buf_done_and_job_finish(ctx->dev->m2m_dev, ctx->fh.m2m_ctx, > > + result); > > } > > > > void hantro_irq_done(struct hantro_dev *vpu, unsigned int bytesused, > >