From patchwork Mon Dec 19 06:43:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?WXVuZmVpIERvbmcgKOiRo+S6kemjnik=?= X-Patchwork-Id: 34422 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp2236806wrn; Sun, 18 Dec 2022 23:05:30 -0800 (PST) X-Google-Smtp-Source: AA0mqf41l38Hud9v82BnZ8LhisX1lGsi75JDHeBueFD4SEr4jgMwAck30cQbOjmoJ8SmJ56O7Afd X-Received: by 2002:a17:907:595:b0:7c0:f4f8:582a with SMTP id vw21-20020a170907059500b007c0f4f8582amr28653221ejb.52.1671433530136; Sun, 18 Dec 2022 23:05:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671433530; cv=none; d=google.com; s=arc-20160816; b=qMqlOIW/hM6c81uj3xi96xCpmW6vpO5PW1t1ihs0afGWkOeSOAgBMM17yZd40ks2qK VS/+WVT9VHeftuu89AKqH8rNX6TwQgTAuYlkNA1ZalRovCDMBD3dUa4APSad550dlUzc TVKbcdwc4ww7biQjUD6aQISvT2ZRO7kM7C6pJNA4RU1HO5SillWFFMYGmetY9zGU0tPy qJzc/lSk5f69Q55O9L7kVbQAME+sqa9RtKDC7IFZ/w/NAkcSRnTYgJQ00zfNY1DxCsyl zQhAbjo8oC2BAKojdr+PwLp0Fc6eycqO26dVENS7kenuTqiGzjMXInhGl84LPSDtAp/y rhmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=T2of0ZtsSdQnP/6PVqQ39dVzQ6Net2p0RRdMofvxzzM=; b=FS6Eob4uhbstmg/+ZWcunDzRL1qjW6PPeFGtCDJJZMwWtWL8AU7rVB3cOqPDfiBK5D xzGlKe1y01cdmdWMMl0hjNP4s5S4bOI+mxxyGhibABfGMqo7+UuOhikYdrMDL4WjdSYZ eAI375O4Ce+TXkVT2OcqeoYEEUUonTc88Mk6y48gsuJ+oHAVIy+dnl6b7KavtBd4RfsM 9MnUBPbRc2XZPqQmljgViIeZqxawXo2bC9OfVcugwBjpiYsqSc/w+NDB8+y97RpNYyNi wX/0ZSRJU2xgMIVaRdeV1a2pNs4hRHNtDsa6kHWTiH4ivVCfu65lYIvqR3V+tD90t4dK cOTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=mxeX9XuV; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b10-20020a056402084a00b0046b5f810167si5812356edz.279.2022.12.18.23.05.00; Sun, 18 Dec 2022 23:05:30 -0800 (PST) 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; dkim=pass header.i=@mediatek.com header.s=dk header.b=mxeX9XuV; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231694AbiLSGpi (ORCPT + 99 others); Mon, 19 Dec 2022 01:45:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231549AbiLSGo6 (ORCPT ); Mon, 19 Dec 2022 01:44:58 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C8D9DF4C; Sun, 18 Dec 2022 22:43:52 -0800 (PST) X-UUID: e139a3b208a8494c8c60b1d3bb613c4f-20221219 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=T2of0ZtsSdQnP/6PVqQ39dVzQ6Net2p0RRdMofvxzzM=; b=mxeX9XuVb3+8y8gtIRzJtPHsFhVYKzvw16oyi8dMuwii5DIi15zNR0uaQdybjmavbEfd7XKanZOPwqqIc0UdriprS11Orix0Nn9j+O8OOHioNk/W4CmfRP/iwj37zoOlMcUjWzLtO1eVWKaCfWvH+Azgen8lS/7veO98yCFSEW0=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.14,REQID:134e9667-6e65-4240-abb2-dd3cba8014dd,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Release_Ham,ACTI ON:release,TS:70 X-CID-INFO: VERSION:1.1.14,REQID:134e9667-6e65-4240-abb2-dd3cba8014dd,IP:0,URL :0,TC:0,Content:-25,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTI ON:quarantine,TS:70 X-CID-META: VersionHash:dcaaed0,CLOUDID:0d972152-dd49-462e-a4be-2143a3ddc739,B ulkID:221219144348GX6T4CSG,BulkQuantity:0,Recheck:0,SF:38|28|17|19|48,TC:n il,Content:0,EDM:-3,IP:nil,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 X-UUID: e139a3b208a8494c8c60b1d3bb613c4f-20221219 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1841356489; Mon, 19 Dec 2022 14:43:47 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs11n2.mediatek.inc (172.21.101.187) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Mon, 19 Dec 2022 14:43:45 +0800 Received: from localhost.localdomain (10.17.3.154) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Mon, 19 Dec 2022 14:43:44 +0800 From: Yunfei Dong To: Yunfei Dong , Chen-Yu Tsai , Nicolas Dufresne , Hans Verkuil , AngeloGioacchino Del Regno , Benjamin Gaignard , Tiffany Lin CC: Mauro Carvalho Chehab , Matthias Brugger , Hsin-Yi Wang , Fritz Koenig , Daniel Vetter , Steve Cho , , , , , , Subject: [PATCH v2,7/7] media: mediatek: vcodec: change lat thread decode error condition Date: Mon, 19 Dec 2022 14:43:32 +0800 Message-ID: <20221219064332.2124-8-yunfei.dong@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221219064332.2124-1-yunfei.dong@mediatek.com> References: <20221219064332.2124-1-yunfei.dong@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752625085467823228?= X-GMAIL-MSGID: =?utf-8?q?1752625085467823228?= If lat thread can't get lat buffer, it should be that current instance don't be schedulded, the driver can't free the src buffer directly. Fixes: 7b182b8d9c85 ("media: mediatek: vcodec: Refactor get and put capture buffer flow") Signed-off-by: Yunfei Dong Reviewed-by: AngeloGioacchino Del Regno --- .../platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c | 6 ++++-- .../platform/mediatek/vcodec/vdec/vdec_h264_req_multi_if.c | 2 +- .../platform/mediatek/vcodec/vdec/vdec_vp9_req_lat_if.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c index ffbcee04dc26..04beb3f08eea 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c @@ -258,8 +258,10 @@ static void mtk_vdec_worker(struct work_struct *work) if (src_buf_req) v4l2_ctrl_request_complete(src_buf_req, &ctx->ctrl_hdl); } else { - v4l2_m2m_src_buf_remove(ctx->m2m_ctx); - v4l2_m2m_buf_done(vb2_v4l2_src, state); + if (ret != -EAGAIN) { + v4l2_m2m_src_buf_remove(ctx->m2m_ctx); + v4l2_m2m_buf_done(vb2_v4l2_src, state); + } v4l2_m2m_job_finish(dev->m2m_dev_dec, ctx->m2m_ctx); } } diff --git a/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_multi_if.c b/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_multi_if.c index 8f262e86bb05..07774b6a3dbd 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_multi_if.c +++ b/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_multi_if.c @@ -574,7 +574,7 @@ static int vdec_h264_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs, lat_buf = vdec_msg_queue_dqbuf(&inst->ctx->msg_queue.lat_ctx); if (!lat_buf) { mtk_vcodec_err(inst, "failed to get lat buffer"); - return -EINVAL; + return -EAGAIN; } share_info = lat_buf->private_data; src_buf_info = container_of(bs, struct mtk_video_dec_buf, bs_buffer); diff --git a/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_req_lat_if.c b/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_req_lat_if.c index cbb6728b8a40..cf16cf2807f0 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_req_lat_if.c +++ b/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_req_lat_if.c @@ -2070,7 +2070,7 @@ static int vdec_vp9_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs, lat_buf = vdec_msg_queue_dqbuf(&instance->ctx->msg_queue.lat_ctx); if (!lat_buf) { mtk_vcodec_err(instance, "Failed to get VP9 lat buf\n"); - return -EBUSY; + return -EAGAIN; } pfc = (struct vdec_vp9_slice_pfc *)lat_buf->private_data; if (!pfc) {