Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp10428467rwl; Wed, 11 Jan 2023 20:23:42 -0800 (PST) X-Google-Smtp-Source: AMrXdXu3LtJiYjdjoW3q4gnrP3xoBpj3DcfHKmvUV+aiaFUOMcSzEZzHzfJ7kAQ6vHUxl2mR1emO X-Received: by 2002:a17:907:8193:b0:84d:4325:7f7a with SMTP id iy19-20020a170907819300b0084d43257f7amr11564603ejc.65.1673497422068; Wed, 11 Jan 2023 20:23:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673497422; cv=none; d=google.com; s=arc-20160816; b=jhkjInPZSLNOqATimAGkI1IndDO1SLyJyUo2m7jlopsv8dC+50Q08Jc1BaEBCluYsa 5pH338KZkzI2CyEQNx6Q4EwedYKjjQGi06HVpCuLgathrGoSoKCOAC9jQWSoYKLv3lrZ A8dPa1XLs6a5g0SwP0wYUu3fy4OfrCFeIHJIqcs0LtbxgS/VpeUjH/NGst7t7ajvBSe2 94dlIuJ4C22+2OOxS3z8dQFUyOPu+4LEzKzm9Wz86OD1mr+l6lzGQwx6qYlpwG3yR1oE N+61L9T1xpsIwjdHNQNbaB8wYxNmXagJqEOy6OZR1+n/UNHyk4ujSqPakys+aSCwWDtt Cn/A== 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=LWVItFchAxjQJyYfmQOrb6XjujvdQkI5SlHsF0+sIgg=; b=ankv/9i2cJXBZM/+nxh8qt9yqjRgJuraQe0V8pBmW4WiDovhIbIo4G049g0qJJILqA XCv01AT2ODumg5CUdlIX1oVYDF/327QMBqfbFZJZv/xMOauu/3Rtp/OAGbgW5fgVhzjJ tyz6WNs4sGT7HKhS/PIwCsKNxC1drZHrR31s9QyJQcVT2OyK4XOoqH8Jwr8b+Gwiyldf hGvANVMigYamK5SvT4LL3H4PMrmJJ9hPR1ZmPQyje8ospfOm2GeeyGRIxD03bI1xg1ja oBEKJM7sl7L+GVEAUOCvLs0A3QauODehaK/QOrgJTMb8sMUh9kCKEkcLS82dVnQuAD6e 0uvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=ltBoOkmu; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cq6-20020a056402220600b004520b01a355si6115468edb.52.2023.01.11.20.23.29; Wed, 11 Jan 2023 20:23:41 -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=ltBoOkmu; 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 S238657AbjALEMx (ORCPT + 50 others); Wed, 11 Jan 2023 23:12:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236529AbjALEMC (ORCPT ); Wed, 11 Jan 2023 23:12:02 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2F074C73F; Wed, 11 Jan 2023 20:11:55 -0800 (PST) X-UUID: 3d75cfa4922f11eda06fc9ecc4dadd91-20230112 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=LWVItFchAxjQJyYfmQOrb6XjujvdQkI5SlHsF0+sIgg=; b=ltBoOkmu1NLrzbQAq28P052jhcluYSYKlxwMoYtTAlnVK6jY0UYZgyBr7DqcINP0+z9h+V1x++LGM+2mBB4p0Y4Ai1cciihSEsNkSbrm1i50hEFo+TvqsMLwwtcG8+WuKr3VccowM4rFs9c9xzqSbMQhMn2IeyYUkKux/+V2veI=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.17,REQID:9c6f8cf6-8996-48ef-842f-8b5b237d1baf,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-25 X-CID-META: VersionHash:543e81c,CLOUDID:1db66b54-dd49-462e-a4be-2143a3ddc739,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0 X-CID-BVR: 0,NGT X-UUID: 3d75cfa4922f11eda06fc9ecc4dadd91-20230112 Received: from mtkmbs10n2.mediatek.inc [(172.21.101.183)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1055710536; Thu, 12 Jan 2023 12:11:51 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by mtkmbs11n1.mediatek.inc (172.21.101.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Thu, 12 Jan 2023 12:11:50 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Thu, 12 Jan 2023 12:11:49 +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 v3,7/7] media: mediatek: vcodec: change lat thread decode error condition Date: Thu, 12 Jan 2023 12:11:40 +0800 Message-ID: <20230112041140.833-8-yunfei.dong@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230112041140.833-1-yunfei.dong@mediatek.com> References: <20230112041140.833-1-yunfei.dong@mediatek.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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 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 --- .../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) { -- 2.18.0