From patchwork Thu Nov 17 09:24:49 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: 21518 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp299723wrr; Thu, 17 Nov 2022 01:28:28 -0800 (PST) X-Google-Smtp-Source: AA0mqf7NDyJOEM+8CRgDmfgpmSVzIkzeMymAMIrlttltwCl1o8+JhEfTf3e2Fg6VwzAKOD9saJK2 X-Received: by 2002:a17:902:74c4:b0:17f:66ae:b84 with SMTP id f4-20020a17090274c400b0017f66ae0b84mr1999727plt.32.1668677307822; Thu, 17 Nov 2022 01:28:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668677307; cv=none; d=google.com; s=arc-20160816; b=Rt9ynNnc8WcvaBZ4vLupPSsh+8ITCUq58g2lx4hAkNQklSXIrpXR5E6ilyrAAkficH oNwIDMLoUW3QTuftXSq8rfuT92EOosz1uHGiI2utnkVMHryFwo5VJ/vxmwB466myoVGH iRnDrc4xvM5/0TAkAZpTdcbpUr0lko+Ez+IgDs/ipqtpMljC1W4ub/2iOT/nAr/8HZDb U1ha2KsKaAsCKXTR/WxWnMUvvDO0ED6wlk4pyuvqTpyhFK+nSvr7TkHKN207Q5eSEX8h uRYnMf5pHnSeVydSsOFeQkKYMt4ROR0bRwyEN3QCXQjD2fvjJrjoLss8+bdjZnh1id1f r9wA== 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=Ig/pSgvvR3yu/pp6Gz7Idjah+bRQCtScaa8fUqrsgPs=; b=nAdWlSggPoU76ez3LadrnJQ/hxWkk84EpqFaTO0Nfyn8pgN2CAYEdsphJaVBmtEuqb avLoRy9imePFvey/XKKf4N8/BEkAcaHsiursEddV0xynPQsg82zJvF7gZQIUCJmi3sps Gu/6kSfxvBJiWKHnzri7Xjk8UX/4jr2nGJZhXDwUJrEFdO9bw1ye7Xa+CE7UCQUF275F HBfd4vvTWyHPvMjz0Ri8LxiL6z0Ru34vvDesDaNlSIt+Nl36JECyiJTOm4T3zn9HCbOo eK89mjSlFtk0pwUw/FR9yfCDJc0V3ETJ+R6xyMZQbNcHMKzYajvd4ygTalROWLgAZtJU DQqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=JiuVamA4; 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 cq17-20020a056a00331100b005712b7c5b2fsi402743pfb.78.2022.11.17.01.28.15; Thu, 17 Nov 2022 01:28:27 -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=JiuVamA4; 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 S239483AbiKQJZ0 (ORCPT + 99 others); Thu, 17 Nov 2022 04:25:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234646AbiKQJZI (ORCPT ); Thu, 17 Nov 2022 04:25:08 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 001736393; Thu, 17 Nov 2022 01:25:03 -0800 (PST) X-UUID: 86a6023b2ce44bf99582c96fe0c95b65-20221117 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=Ig/pSgvvR3yu/pp6Gz7Idjah+bRQCtScaa8fUqrsgPs=; b=JiuVamA4AKOVGDxE97Vg4SEsupmyYMDEuyAbMOwpYBRDps2XK4fgXi4HRypZH5dKqLCwdUGJEsQ3YegfemeRZgaNHuquEIQT/PxizH325QxIp2De9PLBuQTjhbUa1IGd5kTWPu9/ycdh64wRa6ElCxjrjde9qRWDAfdrsmPVHtE=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.13,REQID:8dea99cf-0841-475f-9ffb-c039dda3fe0d,IP:0,U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:90 X-CID-INFO: VERSION:1.1.13,REQID:8dea99cf-0841-475f-9ffb-c039dda3fe0d,IP:0,URL :0,TC:0,Content:-5,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTIO N:quarantine,TS:90 X-CID-META: VersionHash:d12e911,CLOUDID:326b88f8-3a34-4838-abcf-dfedf9dd068e,B ulkID:221117172500VYPIAU3T,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: 86a6023b2ce44bf99582c96fe0c95b65-20221117 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 735513468; Thu, 17 Nov 2022 17:24:58 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by mtkmbs13n2.mediatek.inc (172.21.101.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Thu, 17 Nov 2022 17:24:56 +0800 Received: from localhost.localdomain (10.17.3.154) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Thu, 17 Nov 2022 17:24:55 +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 , George Sun , Xiaoyong Lu , Hsin-Yi Wang , Fritz Koenig , Daniel Vetter , Steve Cho , , , , , , Subject: [PATCH v2,1/5] media: mediatek: vcodec: Fix getting NULL pointer for dst buffer Date: Thu, 17 Nov 2022 17:24:49 +0800 Message-ID: <20221117092453.31366-2-yunfei.dong@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221117092453.31366-1-yunfei.dong@mediatek.com> References: <20221117092453.31366-1-yunfei.dong@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,UNPARSEABLE_RELAY autolearn=no 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?1749734976601788786?= X-GMAIL-MSGID: =?utf-8?q?1749734976601788786?= The driver may can't get v4l2 buffer when lat or core decode timeout, will lead to crash when call v4l2_m2m_buf_done to set dst buffer (NULL pointer) done. Fixes: 7b182b8d9c85 ("media: mediatek: vcodec: Refactor get and put capture buffer flow") Signed-off-by: Yunfei Dong --- .../mediatek/vcodec/mtk_vcodec_dec_stateless.c | 11 +++++++---- 1 file changed, 7 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 c45bd2599bb2..e86809052a9f 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c @@ -138,10 +138,13 @@ static void mtk_vdec_stateless_cap_to_disp(struct mtk_vcodec_ctx *ctx, int error state = VB2_BUF_STATE_DONE; vb2_dst = v4l2_m2m_dst_buf_remove(ctx->m2m_ctx); - v4l2_m2m_buf_done(vb2_dst, state); - - mtk_v4l2_debug(2, "free frame buffer id:%d to done list", - vb2_dst->vb2_buf.index); + if (vb2_dst) { + v4l2_m2m_buf_done(vb2_dst, state); + mtk_v4l2_debug(2, "free frame buffer id:%d to done list", + vb2_dst->vb2_buf.index); + } else { + mtk_v4l2_err("dst buffer is NULL"); + } if (src_buf_req) v4l2_ctrl_request_complete(src_buf_req, &ctx->ctrl_hdl); From patchwork Thu Nov 17 09:24:50 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: 21517 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp299601wrr; Thu, 17 Nov 2022 01:27:59 -0800 (PST) X-Google-Smtp-Source: AA0mqf6BGHi8IEIDFAIM5Z6hdbiaKiy6tih0JInMNtf/Ku91Rz+PHli4wGBWq5t9nnv8x+BBzSGv X-Received: by 2002:a05:6a02:108:b0:46b:3acb:77ab with SMTP id bg8-20020a056a02010800b0046b3acb77abmr1284984pgb.359.1668677278864; Thu, 17 Nov 2022 01:27:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668677278; cv=none; d=google.com; s=arc-20160816; b=pbbaqu+VI9aUhIzkTjjHjp4n/V1bWf/y4JtacxIp9eSou82veevy5rC8NKicHGZEqI RjMEdNjPRHN+3ZqFKJgQAWvlSTaZEzu8BHAfp4DXK8eWrk1twyIR0XG35RlaYBT1u2ze qYfDTg+lnJpdUoKmt0EJTgPOGdBqg73fBwtzuw6LAHalO/lSYhDhReMO49W5WPB++amW huD/KwEAXwNS92M1rbcPK6QcEV6QzJgdOX6rm251wFdt4xEvBTf1S84C1IDJp8P1/ZCy IF2L/w5oJrYbMvwTVGeGyf7KFxx9krNV8qyBGSEoHTd4259R9t5m/dMlGeiVTeRoeqW/ ARAg== 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=zviENZfXwyOfFZjYFG/07wjjoPE34cnyXb34jHJ5SG8=; b=KboprE9sccLTpFDdqj0URVjmhvHucVFR8M576kz9k9VH+AnnbIJCdKbKoV71GmbXNk POYl8J9onjQeo9RZxHvPAXr6PNjGEF/pLRjxqLXLlOaLV1fuiRlaSKZ13FhPX5pJv9o/ L8QNjij+5hbvJiNclN0j21lPzhmr3WfgrShfxVubhrWhWc7bW/8aQWce/2EhXPjYdKBN drsGduIV8mGP9WJFIafn7+c9qTbO6F1SwYuldqIWNjwi448G+Vfg2iaogpM9L2mjHrH2 rHKxUhkxDKgfZW1WoKLRxYluS/hYn/U/6ZvpVK/ZtLtYB89xCs03JhYA7hAW/owFGVIf E/7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=IM1abASH; 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 x7-20020a170902a38700b001842f465c10si481316pla.438.2022.11.17.01.27.46; Thu, 17 Nov 2022 01:27:58 -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=IM1abASH; 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 S234312AbiKQJZV (ORCPT + 99 others); Thu, 17 Nov 2022 04:25:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234248AbiKQJZI (ORCPT ); Thu, 17 Nov 2022 04:25:08 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41D6A5FC7; Thu, 17 Nov 2022 01:25:03 -0800 (PST) X-UUID: 0251dd356a174eb0b03b3eaa06a97557-20221117 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=zviENZfXwyOfFZjYFG/07wjjoPE34cnyXb34jHJ5SG8=; b=IM1abASHy9/G4x2uRgj7wjpCEKvC1F08marpFfvS7tfLVl+2TEaW/GYeWfZvhigpPxIGChVXRMMRWXY2skFTI9QG004UCrBr/pgg2c21DeCfUFVW+T8+It2qmO5hcS7zB76RI7MX717ddAgQyjCmGvcvltvEWbvRuQ6+4Lg+dMs=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.13,REQID:0933916a-1895-431e-a0a4-e464b4119c2e,IP:0,U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:-5 X-CID-META: VersionHash:d12e911,CLOUDID:6b340c2f-2938-482e-aafd-98d66723b8a9,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 X-UUID: 0251dd356a174eb0b03b3eaa06a97557-20221117 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 1259357121; Thu, 17 Nov 2022 17:24:59 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Thu, 17 Nov 2022 17:24:57 +0800 Received: from localhost.localdomain (10.17.3.154) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Thu, 17 Nov 2022 17:24:56 +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 , George Sun , Xiaoyong Lu , Hsin-Yi Wang , Fritz Koenig , Daniel Vetter , Steve Cho , , , , , , Subject: [PATCH v2,2/5] media: mediatek: vcodec: Can't set dst buffer to done when lat decode error Date: Thu, 17 Nov 2022 17:24:50 +0800 Message-ID: <20221117092453.31366-3-yunfei.dong@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221117092453.31366-1-yunfei.dong@mediatek.com> References: <20221117092453.31366-1-yunfei.dong@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,UNPARSEABLE_RELAY autolearn=no 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?1749734946394005233?= X-GMAIL-MSGID: =?utf-8?q?1749734946394005233?= Core thread will call v4l2_m2m_buf_done to set dst buffer done for lat architecture. If lat call v4l2_m2m_buf_done_and_job_finish to free dst buffer when lat decode error, core thread will access kernel NULL pointer dereference, then crash. Signed-off-by: Yunfei Dong --- .../media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 e86809052a9f..ffbcee04dc26 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c @@ -253,7 +253,7 @@ static void mtk_vdec_worker(struct work_struct *work) state = ret ? VB2_BUF_STATE_ERROR : VB2_BUF_STATE_DONE; if (!IS_VDEC_LAT_ARCH(dev->vdec_pdata->hw_arch) || - ctx->current_codec == V4L2_PIX_FMT_VP8_FRAME || ret) { + ctx->current_codec == V4L2_PIX_FMT_VP8_FRAME) { v4l2_m2m_buf_done_and_job_finish(dev->m2m_dev_dec, ctx->m2m_ctx, state); if (src_buf_req) v4l2_ctrl_request_complete(src_buf_req, &ctx->ctrl_hdl); From patchwork Thu Nov 17 09:24:51 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: 21519 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp300074wrr; Thu, 17 Nov 2022 01:29:35 -0800 (PST) X-Google-Smtp-Source: AA0mqf7WXs1y5Sx+P34Kt6Vf711PHXeMpjd6nitY+tIbuOY4WshJgXSPAEseXqVIA4AjzLhVzXNk X-Received: by 2002:aa7:8709:0:b0:572:2189:84ef with SMTP id b9-20020aa78709000000b00572218984efmr2136398pfo.28.1668677375221; Thu, 17 Nov 2022 01:29:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668677375; cv=none; d=google.com; s=arc-20160816; b=hbUsyfykCoJMwOj/4yn3GHZM/VowMabLOZmfsx6QNI9rxL+mIDqOESvlcJsmYUeMFS fWm/Cu2kRhx2xzODtaniI9mZqAcH88DprZRhNRXd8f6zvxgZoh2e0K0uCizPx3mYKwn1 Mzebgrutw0bTVGVeGDPkAchV+LLT5XMgJF6wEVWqHGTOoDNb1VHOh7xmsPnwWghuxTMX P+bf5yPANIDUpFIUMcKIbIr8Qli35f73QtF20IRDxxYm3A+JXfePFqRBm1s41oQqhsNa GCVpM2d/VRG/kiXLBvfVwPut2ZcO9xjI2xA3Xn/+BjVl1LTFrkng2+dnp7vbZd8SN7cX v6NQ== 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=hrBrelk5E6V7oQz6lAqQbyOq+sxngawPs1R5zG57/GQ=; b=D7ZFiBcu58mGkieO1b8dsS4pCGdnZwkasa7f5YYW8cMRypUt4Cwusr9fsVTbvCGQVl j8WAW6V4mvejJV3HZA9ZFCpGtgEFfJb1RCPWb9Dg8rdnMAoSC3MZtzreNRmkOLtvQawz kB/dzpo5zIBVg0lOXXacLhUzXsM7EPp2oHi16JZhwJDBKb6wkwCKjsWkx2a2WTsaOtgf JdOdNqBW0hZEqVuLZvLC4/E101JPONdHrmSPLBytTuaz12oynRF2UbACewUkfd7ZWrGF anbpGT4xp6sXBgD8DdqHzF2h3k3azQHTLbBY0Xp2AdukAfjlMpysotsXLZ3Rs2XNKKNx P4eA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=Op1tIZu7; 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 c19-20020a170902c1d300b0017f61b0bc5bsi449113plc.557.2022.11.17.01.29.21; Thu, 17 Nov 2022 01:29:35 -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=Op1tIZu7; 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 S239930AbiKQJZg (ORCPT + 99 others); Thu, 17 Nov 2022 04:25:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239112AbiKQJZJ (ORCPT ); Thu, 17 Nov 2022 04:25:09 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E3DE63D2; Thu, 17 Nov 2022 01:25:05 -0800 (PST) X-UUID: 225ac95e5d034b42bc8aba2b7a011b07-20221117 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=hrBrelk5E6V7oQz6lAqQbyOq+sxngawPs1R5zG57/GQ=; b=Op1tIZu7VhygqmgiBfYKeVBX4zoTKK2TX8ixOpVAQITd/GbK27jNMu8VRjut45wZ2ruvt6+BV34Ntp9FsBn0riPKe1GiR7nLfvUSPAFXZIyV1+YBu3w3TTVt5Xdy0O8XoUT4IiQlbH8zXowGmsLh8rkEmW+J8d0HQ1PjQ4WZnqQ=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.12,REQID:231684dc-d929-41c9-b794-f71e2bb4b40c,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:62cd327,CLOUDID:eaf876db-6ad4-42ff-91f3-18e0272db660,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 X-UUID: 225ac95e5d034b42bc8aba2b7a011b07-20221117 Received: from mtkmbs10n2.mediatek.inc [(172.21.101.183)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 516917116; Thu, 17 Nov 2022 17:25:01 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) 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, 17 Nov 2022 17:24:59 +0800 Received: from localhost.localdomain (10.17.3.154) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Thu, 17 Nov 2022 17:24:58 +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 , George Sun , Xiaoyong Lu , Hsin-Yi Wang , Fritz Koenig , Daniel Vetter , Steve Cho , , , , , , Subject: [PATCH v2,3/5] media: mediatek: vcodec: Fix h264 set lat buffer error Date: Thu, 17 Nov 2022 17:24:51 +0800 Message-ID: <20221117092453.31366-4-yunfei.dong@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221117092453.31366-1-yunfei.dong@mediatek.com> References: <20221117092453.31366-1-yunfei.dong@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,RDNS_NONE, SPF_HELO_PASS,SPF_PASS,UNPARSEABLE_RELAY autolearn=no 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?1749735047408574794?= X-GMAIL-MSGID: =?utf-8?q?1749735047408574794?= Will set lat buffer to lat_list two times when lat decode timeout for inner racing mode. If core thread can't get frame buffer, need to return error value. Fixes: 59fba9eed5a7 ("media: mediatek: vcodec: support stateless H.264 decoding for mt8192") Signed-off-by: Yunfei Dong Reviewed-by: AngeloGioacchino Del Regno --- - fix comments according to AngeloGioacchino's suggestion. --- .../vcodec/vdec/vdec_h264_req_multi_if.c | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) 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 4cc92700692b..8f262e86bb05 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 @@ -471,14 +471,19 @@ static int vdec_h264_slice_core_decode(struct vdec_lat_buf *lat_buf) sizeof(share_info->h264_slice_params)); fb = ctx->dev->vdec_pdata->get_cap_buffer(ctx); - y_fb_dma = fb ? (u64)fb->base_y.dma_addr : 0; - vdec_fb_va = (unsigned long)fb; + if (!fb) { + err = -EBUSY; + mtk_vcodec_err(inst, "fb buffer is NULL"); + goto vdec_dec_end; + } + vdec_fb_va = (unsigned long)fb; + y_fb_dma = (u64)fb->base_y.dma_addr; if (ctx->q_data[MTK_Q_DATA_DST].fmt->num_planes == 1) c_fb_dma = y_fb_dma + inst->ctx->picinfo.buf_w * inst->ctx->picinfo.buf_h; else - c_fb_dma = fb ? (u64)fb->base_c.dma_addr : 0; + c_fb_dma = (u64)fb->base_c.dma_addr; mtk_vcodec_debug(inst, "[h264-core] y/c addr = 0x%llx 0x%llx", y_fb_dma, c_fb_dma); @@ -630,7 +635,7 @@ static int vdec_h264_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs, err = vpu_dec_start(vpu, data, 2); if (err) { mtk_vcodec_debug(inst, "lat decode err: %d", err); - goto err_scp_decode; + goto err_free_fb_out; } share_info->trans_end = inst->ctx->msg_queue.wdma_addr.dma_addr + @@ -647,12 +652,17 @@ static int vdec_h264_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs, /* wait decoder done interrupt */ timeout = mtk_vcodec_wait_for_done_ctx(inst->ctx, MTK_INST_IRQ_RECEIVED, WAIT_INTR_TIMEOUT_MS, MTK_VDEC_LAT0); + if (timeout) + mtk_vcodec_err(inst, "lat decode timeout: pic_%d", inst->slice_dec_num); inst->vsi->dec.timeout = !!timeout; err = vpu_dec_end(vpu); - if (err == SLICE_HEADER_FULL || timeout || err == TRANS_BUFFER_FULL) { - err = -EINVAL; - goto err_scp_decode; + if (err == SLICE_HEADER_FULL || err == TRANS_BUFFER_FULL) { + if (!IS_VDEC_INNER_RACING(inst->ctx->dev->dec_capability)) + vdec_msg_queue_qbuf(&inst->ctx->msg_queue.lat_ctx, lat_buf); + inst->slice_dec_num++; + mtk_vcodec_err(inst, "lat dec fail: pic_%d err:%d", inst->slice_dec_num, err); + return -EINVAL; } share_info->trans_end = inst->ctx->msg_queue.wdma_addr.dma_addr + @@ -669,10 +679,6 @@ static int vdec_h264_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs, inst->slice_dec_num++; return 0; - -err_scp_decode: - if (!IS_VDEC_INNER_RACING(inst->ctx->dev->dec_capability)) - vdec_msg_queue_qbuf(&inst->ctx->msg_queue.lat_ctx, lat_buf); err_free_fb_out: vdec_msg_queue_qbuf(&inst->ctx->msg_queue.lat_ctx, lat_buf); mtk_vcodec_err(inst, "slice dec number: %d err: %d", inst->slice_dec_num, err); From patchwork Thu Nov 17 09:24:52 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: 21521 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp300329wrr; Thu, 17 Nov 2022 01:30:15 -0800 (PST) X-Google-Smtp-Source: AA0mqf5JGPQk4YaUe484rxs2RzqxA5osUa4fx3ojrzO0HppgvpGicI6vZFRR9R7rkv8uQkb5d6LU X-Received: by 2002:a17:903:2407:b0:17f:3da:f19d with SMTP id e7-20020a170903240700b0017f03daf19dmr1807582plo.147.1668677415049; Thu, 17 Nov 2022 01:30:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668677415; cv=none; d=google.com; s=arc-20160816; b=dpNK+gKFEImM7yL6qsIOYmJbIEO/I0S1tdN0SOD1xJUkKmPq3C9xNuKRaXBU7i8ihV 9ZipybJC0QgFCXZLXEFrqUlacpVnZdB92DiUr0SadKooh4X1EtzMW0f8ARo5EH0/IVh/ 36mVZwx07EQPD0ImwsuL+f9ZQCUycI+i/8zRFxojuwo1ZGG1JbJUUzs99OHMmQbkvn6W TONbPscIcMITKzZ7MIr79mHABqh1eG24kpGeV4VJyiJblsUZsne0mW13oBMKiJHALI04 LMJdONwBJlL7ly5kh8xNUmicZ52B7jW+HvFChRddJ203S+MTD6RkfWmcSaEac2GxiOvB NTdw== 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=ztddfO3HpzzX7jMv99ap2IqMNrkjflAF85r48IEZWKU=; b=TIs00Wtz13jXGyqKWBNSoB3P+ClHaApdk4GJ8K7aIIw3zBJ8CCw+VeZQxNorV1HDXG eZ9l4gjMmaTB4g+zBmjo2wvsmRBWkzwwbccrtANS6M1ayQ4d0YJfwtclihXy+cuE0S7g FBF0vaASExOnE38iMHFKRPJGi1bXcMoDordIf7rwJ443CVa8Mqodcw2YThBEVb1cTmI7 ZGWiXqk+SXTQn1q8UR0Iro4LLbRMQB6xbczUBbTilnnZUY68uyDcgtd/XjxdPdPlvna7 g4gEl/sRBf8pa/lWCevcCfA+Z17P0lsOlRVEo47kYhd8zYCh4zvTC4cc5mHj6y9howX7 EQVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=sPaIxISq; 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 e24-20020a17090ab39800b002142c16103csi381235pjr.24.2022.11.17.01.30.02; Thu, 17 Nov 2022 01:30:15 -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=sPaIxISq; 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 S239913AbiKQJZp (ORCPT + 99 others); Thu, 17 Nov 2022 04:25:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239285AbiKQJZJ (ORCPT ); Thu, 17 Nov 2022 04:25:09 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CD73B1C3; Thu, 17 Nov 2022 01:25:08 -0800 (PST) X-UUID: 2d86bf5b79cd451790e0a8fcc531def9-20221117 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=ztddfO3HpzzX7jMv99ap2IqMNrkjflAF85r48IEZWKU=; b=sPaIxISqZE9f7omtmM/9wDwL5S8algZJxoK8GKbEG2AOmDzlviQX+r+yu9t2BlQeTK9ABYO6X8dfjV0RY4aUY4OknLUnGZ/XDG/NJZTjKPEBvxFEs4NxjWNuwELlMyI6x9/j9ZP6TEKy0eDMXVuS5B74OY7whvnHqj072Jtp5Pw=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.12,REQID:0653e927-1962-4356-a135-6084b0a425ff,IP:0,U RL:0,TC:0,Content:-5,EDM:25,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:20 X-CID-META: VersionHash:62cd327,CLOUDID:9ef976db-6ad4-42ff-91f3-18e0272db660,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:5,IP:nil,UR L:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 X-UUID: 2d86bf5b79cd451790e0a8fcc531def9-20221117 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 2029179431; Thu, 17 Nov 2022 17:25:02 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) 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; Thu, 17 Nov 2022 17:25:00 +0800 Received: from localhost.localdomain (10.17.3.154) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Thu, 17 Nov 2022 17:24:59 +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 , George Sun , Xiaoyong Lu , Hsin-Yi Wang , Fritz Koenig , Daniel Vetter , Steve Cho , , , , , , Subject: [PATCH v2,4/5] media: mediatek: vcodec: Setting lat buf to lat_list when lat decode error Date: Thu, 17 Nov 2022 17:24:52 +0800 Message-ID: <20221117092453.31366-5-yunfei.dong@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221117092453.31366-1-yunfei.dong@mediatek.com> References: <20221117092453.31366-1-yunfei.dong@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,RDNS_NONE, SPF_HELO_PASS,SPF_PASS,UNPARSEABLE_RELAY autolearn=no 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?1749735089173150284?= X-GMAIL-MSGID: =?utf-8?q?1749735089173150284?= Need to set lat buf to lat_list when lat decode error, or lat buffer will lost. Fixes: 5d418351ca8f ("media: mediatek: vcodec: support stateless VP9 decoding") Signed-off-by: Yunfei Dong Reviewed-by: AngeloGioacchino Del Regno --- .../mediatek/vcodec/vdec/vdec_vp9_req_lat_if.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) 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 fb1c36a3592d..cbb6728b8a40 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 @@ -2073,21 +2073,23 @@ static int vdec_vp9_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs, return -EBUSY; } pfc = (struct vdec_vp9_slice_pfc *)lat_buf->private_data; - if (!pfc) - return -EINVAL; + if (!pfc) { + ret = -EINVAL; + goto err_free_fb_out; + } vsi = &pfc->vsi; ret = vdec_vp9_slice_setup_lat(instance, bs, lat_buf, pfc); if (ret) { mtk_vcodec_err(instance, "Failed to setup VP9 lat ret %d\n", ret); - return ret; + goto err_free_fb_out; } vdec_vp9_slice_vsi_to_remote(vsi, instance->vsi); ret = vpu_dec_start(&instance->vpu, NULL, 0); if (ret) { mtk_vcodec_err(instance, "Failed to dec VP9 ret %d\n", ret); - return ret; + goto err_free_fb_out; } if (instance->irq) { @@ -2107,7 +2109,7 @@ static int vdec_vp9_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs, /* LAT trans full, no more UBE or decode timeout */ if (ret) { mtk_vcodec_err(instance, "VP9 decode error: %d\n", ret); - return ret; + goto err_free_fb_out; } mtk_vcodec_debug(instance, "lat dma addr: 0x%lx 0x%lx\n", @@ -2120,6 +2122,9 @@ static int vdec_vp9_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs, vdec_msg_queue_qbuf(&ctx->dev->msg_queue_core_ctx, lat_buf); return 0; +err_free_fb_out: + vdec_msg_queue_qbuf(&ctx->msg_queue.lat_ctx, lat_buf); + return ret; } static int vdec_vp9_slice_decode(void *h_vdec, struct mtk_vcodec_mem *bs, From patchwork Thu Nov 17 09:24:53 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: 21520 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp300319wrr; Thu, 17 Nov 2022 01:30:14 -0800 (PST) X-Google-Smtp-Source: AA0mqf6Q+O1xMHoi/Mk1ue9Syqf/LsKeP7fRqPLyJM23tvXAFbvBsGmDALD2LIGMeeSy6cqFfvt1 X-Received: by 2002:a17:902:ecc3:b0:188:59d2:33e with SMTP id a3-20020a170902ecc300b0018859d2033emr1787864plh.142.1668677414059; Thu, 17 Nov 2022 01:30:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668677414; cv=none; d=google.com; s=arc-20160816; b=wr7OEUib0SQ7r4NItlIlCI1PDXnVzTAAWPMrXTcjbxZ2PbmajRQVmfDpGg2s69rdeN j4+VbQygN0xp956G8JH521qSNZXh3vNW6fPbzmkGC6vxjd8VSshmC9GGvggGy1EuproZ xa5Qiw40lHaNgy0CZK+rKB2k9fFGbL5y6lkL4D63BtywbMHMbkfylT18EI9bW85ZkbK9 pxQQGR2LMezUfBCwQ07JsOdt1CvZZJEipJCySNqjhIiw4t/YRI4qX92IlwWbU6JXb43I BFOpFp+j4oL7KAJDw2ocRAZcdCtzry7nMn7iJie+FKnisjPrLJw1zUO3vQtXS0MwKG9u PrMw== 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=2i8ue32zbAB2L5zW+f/v6ja22a6vjPgIueav6O2jRPg=; b=h7HM/ITZ8bXcdnJbnaW/kvvSl+tWKmkFqSnSaLOf94CkpBdMJgwdXFhtBYrEe9fVWH WG48sQ/yU0NUJfBun0B3cD0FQKpZH0xhFDF9YoqZqnWpgv19TEXOb8KVOxIz9Rj8lUCy +QsTAAtl8RQfmmFapjZK/g4Brk8GAwFzVBWUMuyEQerH9DyPvZqBIlDZydFf/YoGYS12 gWXQgJVCEBBWsJiVcnKS1fa3oAmCg4FmXI0br6WkxtRsmlXcZWq/Qn0bwRNFsFHRSPVE Il+7wAJiF+XnpZ2U2JIyH5YxObTg8pk66ZsI/hjOS+56TyGS1Lt/4s5X+mIHb4gYM3/1 crIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=PFAKG40V; 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 bk13-20020a056a02028d00b00470422012f6si464005pgb.687.2022.11.17.01.30.01; Thu, 17 Nov 2022 01:30:14 -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=PFAKG40V; 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 S239899AbiKQJZl (ORCPT + 99 others); Thu, 17 Nov 2022 04:25:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239267AbiKQJZJ (ORCPT ); Thu, 17 Nov 2022 04:25:09 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0FFC7656; Thu, 17 Nov 2022 01:25:05 -0800 (PST) X-UUID: 9d4c971178fc4c6392487e0b8f157fb8-20221117 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=2i8ue32zbAB2L5zW+f/v6ja22a6vjPgIueav6O2jRPg=; b=PFAKG40Vd32WWsTq+f5SipqSe6RDKWFcRVv0OamftBF6HwSO+/PMs2qEpA1gvCn2vHcaS9BCbF7yd8DYdPjqGYGb5Zu1ueq81K4v4Apb44GpXDzPT+SC7FXhUyZ58DSMwbc1YqlPu8YlSNvmr2QlX1qyApuVoOJrKUF0wGedZ9U=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.13,REQID:3371898b-ad19-4ed9-aab4-4732f3087482,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:95 X-CID-INFO: VERSION:1.1.13,REQID:3371898b-ad19-4ed9-aab4-4732f3087482,IP:0,URL :0,TC:0,Content:0,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTION :quarantine,TS:95 X-CID-META: VersionHash:d12e911,CLOUDID:55f976db-6ad4-42ff-91f3-18e0272db660,B ulkID:221117172503CT5CQNLZ,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: 9d4c971178fc4c6392487e0b8f157fb8-20221117 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 240677237; Thu, 17 Nov 2022 17:25:03 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by mtkmbs13n2.mediatek.inc (172.21.101.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Thu, 17 Nov 2022 17:25:01 +0800 Received: from localhost.localdomain (10.17.3.154) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Thu, 17 Nov 2022 17:25:00 +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 , George Sun , Xiaoyong Lu , Hsin-Yi Wang , Fritz Koenig , Daniel Vetter , Steve Cho , , , , , , Subject: [PATCH v2,5/5] media: mediatek: vcodec: Core thread depends on core_list Date: Thu, 17 Nov 2022 17:24:53 +0800 Message-ID: <20221117092453.31366-6-yunfei.dong@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221117092453.31366-1-yunfei.dong@mediatek.com> References: <20221117092453.31366-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?1749735088427985894?= X-GMAIL-MSGID: =?utf-8?q?1749735088427985894?= Core thread will continue to work when core_list is not empty, not depends on lat_list. Fixes: 365e4ba01df4 ("media: mtk-vcodec: Add work queue for core hardware decode") Signed-off-by: Yunfei Dong Reviewed-by: AngeloGioacchino Del Regno --- drivers/media/platform/mediatek/vcodec/vdec_msg_queue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.c b/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.c index ae500980ad45..dc2004790a47 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.c +++ b/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.c @@ -221,7 +221,7 @@ static void vdec_msg_queue_core_work(struct work_struct *work) mtk_vcodec_dec_disable_hardware(ctx, MTK_VDEC_CORE); vdec_msg_queue_qbuf(&ctx->msg_queue.lat_ctx, lat_buf); - if (!list_empty(&ctx->msg_queue.lat_ctx.ready_queue)) { + if (!list_empty(&dev->msg_queue_core_ctx.ready_queue)) { mtk_v4l2_debug(3, "re-schedule to decode for core: %d", dev->msg_queue_core_ctx.ready_num); queue_work(dev->core_workqueue, &msg_queue->core_work);