From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0BF64C43334 for ; Tue, 14 Jun 2022 14:45:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=S5MFX8Z36AFw/3lnuiRhvDXwe0AvCKW7WlsTzQD78KM=; b=u5nGoRXCRZV7WM IgNX80ukJTyJ5jgYpDLMjKamNTQDz8j9DmzjrdqJqHEnt78b7sKcBU+DAdEDQgcdDj8JRTzDx1rCu cqdChllwd7iUnbTraiY8IPkNIqGEbf1oxJra2xLQCtv/dpNu1T3He2TbGYJFe2M2rJfbJlVsWH8t8 mF8Zko6QmMMQ73IWY0Oe9QHdmP5A3J85KN7XowRSVR8MBiXfmMu6y0CNWcXRDGv17ydmTfxxQcu5Y wku7knGEASptotIH2twh8q6sON9SpbAF4FnUMQOeg5dhZHVlXfQLd97eGmIpE5TX7SbZwdHzlPZGr a8q+1gNDNZr1a/VQ7Ixg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o17mi-00A1BC-Uz; Tue, 14 Jun 2022 14:44:48 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o17mf-00A19w-Ls for linux-rockchip@lists.infradead.org; Tue, 14 Jun 2022 14:44:47 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 55E2BB81884; Tue, 14 Jun 2022 14:44:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24A10C3411B; Tue, 14 Jun 2022 14:44:40 +0000 (UTC) Message-ID: Date: Tue, 14 Jun 2022 16:44:39 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.0 Subject: Re: [PATCH v1 2/5] media: rkvdec: Add an ops to check for decode errors Content-Language: en-US To: Nicolas Dufresne , linux-media@vger.kernel.org, Ezequiel Garcia , Mauro Carvalho Chehab , Greg Kroah-Hartman Cc: kernel@collabora.com, linux-rockchip@lists.infradead.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org References: <20220610125215.240539-1-nicolas.dufresne@collabora.com> <20220610125215.240539-3-nicolas.dufresne@collabora.com> From: Hans Verkuil In-Reply-To: <20220610125215.240539-3-nicolas.dufresne@collabora.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220614_074446_048885_F3283ACF X-CRM114-Status: GOOD ( 23.87 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org On 6/10/22 14:52, Nicolas Dufresne wrote: > This optional internal ops allow each codec to do their own > error status checking. The presence of an error is reported > using the ERROR buffer state. This patch have no functional > changes. If a buffer is returned with state ERROR, then that means that it is seriously corrupt and userspace is expected to drop it. You might still want to show it for debugging purposes, but the normal action is to drop it. So this is not a valid approach for a decoder that can still produce a decent picture, albeit with macroblock artifacts. A separate control that can be returned as part of the request and contains some sort of error indication would be more appropriate. Buffer state ERROR is really meant for e.g. DMA errors and it shouldn't be mixed with decode errors that still produce a valid picture. Regards, Hans > > Signed-off-by: Nicolas Dufresne > --- > drivers/staging/media/rkvdec/rkvdec.c | 10 ++++++---- > drivers/staging/media/rkvdec/rkvdec.h | 2 ++ > 2 files changed, 8 insertions(+), 4 deletions(-) > > diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c > index 7bab7586918c..7e76f8b72885 100644 > --- a/drivers/staging/media/rkvdec/rkvdec.c > +++ b/drivers/staging/media/rkvdec/rkvdec.c > @@ -950,6 +950,7 @@ static void rkvdec_v4l2_cleanup(struct rkvdec_dev *rkvdec) > static irqreturn_t rkvdec_irq_handler(int irq, void *priv) > { > struct rkvdec_dev *rkvdec = priv; > + struct rkvdec_ctx *ctx; > enum vb2_buffer_state state; > u32 status; > > @@ -958,12 +959,13 @@ static irqreturn_t rkvdec_irq_handler(int irq, void *priv) > VB2_BUF_STATE_DONE : VB2_BUF_STATE_ERROR; > > writel(0, rkvdec->regs + RKVDEC_REG_INTERRUPT); > - if (cancel_delayed_work(&rkvdec->watchdog_work)) { > - struct rkvdec_ctx *ctx; > + ctx = v4l2_m2m_get_curr_priv(rkvdec->m2m_dev); > > - ctx = v4l2_m2m_get_curr_priv(rkvdec->m2m_dev); > + if (ctx->coded_fmt_desc->ops->check_error_info) > + state = ctx->coded_fmt_desc->ops->check_error_info(ctx); > + > + if (cancel_delayed_work(&rkvdec->watchdog_work)) > rkvdec_job_finish(ctx, state); > - } > > return IRQ_HANDLED; > } > diff --git a/drivers/staging/media/rkvdec/rkvdec.h b/drivers/staging/media/rkvdec/rkvdec.h > index 633335ebb9c4..4ae8e6c6b03c 100644 > --- a/drivers/staging/media/rkvdec/rkvdec.h > +++ b/drivers/staging/media/rkvdec/rkvdec.h > @@ -73,6 +73,8 @@ struct rkvdec_coded_fmt_ops { > struct vb2_v4l2_buffer *dst_buf, > enum vb2_buffer_state result); > int (*try_ctrl)(struct rkvdec_ctx *ctx, struct v4l2_ctrl *ctrl); > + /* called from IRQ handler */ > + int (*check_error_info)(struct rkvdec_ctx *ctx); > }; > > struct rkvdec_coded_fmt_desc { _______________________________________________ Linux-rockchip mailing list Linux-rockchip@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-rockchip