Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1541197iog; Tue, 14 Jun 2022 08:04:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMMlZRWZyIycG93IuJ/2NzGj6mPMgD4gja/oU5/LG6fMfdwb9kP4yNVpM6ndtrzEvOp8QH X-Received: by 2002:a63:5c56:0:b0:3fc:824d:fc57 with SMTP id n22-20020a635c56000000b003fc824dfc57mr5016558pgm.561.1655219088764; Tue, 14 Jun 2022 08:04:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655219088; cv=none; d=google.com; s=arc-20160816; b=agAJfxqTU3iv2AYO2YvJkydkKeG68SCcZnv2gKAqn0QHcme087gWrmBaaqrHhjNkVF RaIFijCKM+Tkr65U/wA5wfWxOXLWi2vJF40xeahSJbJNyEJ9x6phiyrHpbLhXpNJ5uBE 2plzoGIHTL2XP+HSYbP392B+OI6fahRfUcWcmCgAlXr+6eARGabAaT+IxeEsYxcWJf2N 6J7bZxA70rrQ5SP51FYMs2OIo3o+/xnZ7E2rkEew/+8yhSJwAnj5dbz8Rz2UvePjTQIp s3dZ5/3VRKk9LTEkq7HEEPeSfR1hqKBZd0d8tOl90gBkbWHmJ6dIaaVEKQRMq1cyUxi3 dF/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=67P45Yk+dfMdg95fO/rgXv4Ft5EmrqyXq7NON4xS2Wk=; b=ciKRAbw9aVh8XS4GqZDmDBs2S5ifZGRF+d0ANebJqfVA6QJnlp2KntYrtsg0mAvd+9 Vs4sctOOVaLpkHGCt04UAyII2OEJRHeZEgVM/Y2bSTGSy8WaGZd9l5IWyBzfj9VOyR1u P29vg8Eyyqg3Xgn5Zx/yaMWuVNwh4RFLfUxm3N8yxBLozOu14FNQBrJVmycMMLqD9MSI FHbbHXS/9eBxmCx4HClBlxDQCNG3T727RoywYuxtPQfY21rPdpITO4Ay/WCcPA1cklyU 95pPq2JOxbtnoJ47KO0k6Yrf54hb8LZwnXcffn1+XPf0gzJDUtR6OGKkAoTBpOfgWHJD 0Slg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z16-20020a63b910000000b003fc1ba17213si13418881pge.160.2022.06.14.08.04.31; Tue, 14 Jun 2022 08:04:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232649AbiFNOou (ORCPT + 99 others); Tue, 14 Jun 2022 10:44:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231584AbiFNOoo (ORCPT ); Tue, 14 Jun 2022 10:44:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EF8A1AF38; Tue, 14 Jun 2022 07:44:44 -0700 (PDT) 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 dfw.source.kernel.org (Postfix) with ESMTPS id 9FBD161762; Tue, 14 Jun 2022 14:44:43 +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> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,NICE_REPLY_A,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 {