From patchwork Sat Jul 1 09:05:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SXJ1aSBXYW5nICjnjovnkZ4p?= X-Patchwork-Id: 115017 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp10920804vqr; Sat, 1 Jul 2023 02:13:07 -0700 (PDT) X-Google-Smtp-Source: APBJJlEWmgGIqwhYQokuPA2HuZ33+fkJMcSPABFAssq7gBExCRYD+uwSJcJySORzTdR10sycKXL8 X-Received: by 2002:a25:dc92:0:b0:bec:9efe:1022 with SMTP id y140-20020a25dc92000000b00bec9efe1022mr5029980ybe.21.1688202786777; Sat, 01 Jul 2023 02:13:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688202786; cv=none; d=google.com; s=arc-20160816; b=HiZzcmJIlXdD9xT971crk4i++RLpE43WB/l0JqVB35dtEg/E18ROIr7FCOFuAesuim LuH9D6nGF8dtgVGSzzxq/ugVeJHZV0wg1S8qOT8/uxPZrQK/dER2Cztq69vo2OnYJ+b0 tsDYH7ZTTgpY1yLwD1+nTQkax/r9xwhdl7UcfMgmot8N0JgJoxz86G5apurcluuVkmlU TcZMGvMPGkt6auJwVaYU2LBCiNfVmSyhUZ/fpT9tRjxEzVE3sWGdkNf9wJM8kRIUWUxr 7r9kajVeKBSBFriU94v42+QOk0iMmxFBQExxUegsduIqCK0pg3334m21R3ZnkzjM3Dio Kr5g== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=W3jSrELTXqHxAyOLqDfz/nZ3j+MAw+i0E6FGyxIbrI0=; fh=LUDi1nJzsTEXVpQ1A0bnWD7d/oQKTCi7MLzupLJQuRA=; b=OuWaLf6ew2+NvTNZ1b6eoifH/grbtflDlZgYnC6Z9JwmSuybjW1xHn9lEMgIzh3TgR sQFXa6v02tmfqUz8Dh97dSv/Zm+OF9VOa/2lzpq+Cy+B3jZ89uVaEH/R4oz6U23mRNe+ wXb4k4DWqZXrXwGLILW2V8n7SEjdm9c9jlj4uc4vLVS/juvHmCA+WMR+f6AdLvl5rJnW 6baqVaxximuiO9tvGks/WfYRR7pVjoeTH8o7FOHQWxzW6t+FfNXRdX6ZY7a4glImYsav tx2WeQXo2T58xSQO6c1CPWlYwfx4ZoZzEGdx3kX+96Uwgp26etXry0bahc1baLBnHKHx 9yaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=USz0t5UN; 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 f16-20020a631010000000b0053b0da378edsi14414874pgl.789.2023.07.01.02.12.47; Sat, 01 Jul 2023 02:13:06 -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; dkim=pass header.i=@mediatek.com header.s=dk header.b=USz0t5UN; 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 S229561AbjGAJG4 (ORCPT + 99 others); Sat, 1 Jul 2023 05:06:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229452AbjGAJGy (ORCPT ); Sat, 1 Jul 2023 05:06:54 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 380799E; Sat, 1 Jul 2023 02:06:49 -0700 (PDT) X-UUID: 9936a9cc17ee11ee9cb5633481061a41-20230701 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:Message-ID:Date:Subject:CC:To:From; bh=W3jSrELTXqHxAyOLqDfz/nZ3j+MAw+i0E6FGyxIbrI0=; b=USz0t5UNVfubVTRNjFx/crLydxLQRn792jBUZ3L4lWoG/mHl8P55d/So8jPIM+tanyf3Bh1H+2XZo7yLqmXxT99jZU9Qb2NX0rsvZvH4R6xaxVppsKYMto+TznTDw86JlxyikMQI3TuvrL2k/wJ5ysePA4OMiXFtRw7EqIy55EM=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.27,REQID:5ff68c12-8989-4786-b329-7c2df0f34e69,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:100,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:100 X-CID-INFO: VERSION:1.1.27,REQID:5ff68c12-8989-4786-b329-7c2df0f34e69,IP:0,URL :0,TC:0,Content:0,EDM:0,RT:0,SF:100,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTIO N:quarantine,TS:100 X-CID-META: VersionHash:01c9525,CLOUDID:aa1581da-b4fa-43c8-9c3e-0d3fabd03ec0,B ulkID:230701170646LIZD5JJY,BulkQuantity:0,Recheck:0,SF:38|29|28|17|19|48,T C:nil,Content:0,EDM:-3,IP:nil,URL:11|1,File:nil,Bulk:nil,QS:nil,BEC:nil,CO L:0,OSI:0,OSA:0,AV:0,LES:1,SPR:NO X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_SDM,TF_CID_SPAM_ASC,TF_CID_SPAM_FAS, TF_CID_SPAM_FSD,TF_CID_SPAM_ULN X-UUID: 9936a9cc17ee11ee9cb5633481061a41-20230701 Received: from mtkmbs13n1.mediatek.inc [(172.21.101.193)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 235621867; Sat, 01 Jul 2023 17:06:43 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by MTKMBS14N1.mediatek.inc (172.21.101.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Sat, 1 Jul 2023 17:05:55 +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.1118.26 via Frontend Transport; Sat, 1 Jul 2023 17:05:54 +0800 From: Irui Wang To: Hans Verkuil , Mauro Carvalho Chehab , Matthias Brugger CC: Yunfei Dong , Maoguang Meng , Irui Wang , , , , , Subject: [PATCH] media: mediatek: vcodec: Add a flag to indicate vdec_fb finding status Date: Sat, 1 Jul 2023 17:05:21 +0800 Message-ID: <20230701090521.22240-1-irui.wang@mediatek.com> X-Mailer: git-send-email 2.25.1 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,SPF_HELO_PASS, T_SCC_BODY_TEXT_LINE,T_SPF_TEMPERROR,UNPARSEABLE_RELAY,URIBL_BLOCKED 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?1770208924991510753?= X-GMAIL-MSGID: =?utf-8?q?1770208924991510753?= "fb_use_list" is vp9 stateful decoder driver to store current used or referenced frame buffer, and "fb_free_list" is used to store current available to be freed frame buffer. When the target frame buffer cannot be found in "fb_use_list", "NULL" should be returned to prevent unexpected frame buffer from being placed into "fb_free_list". Signed-off-by: Irui Wang --- drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_if.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_if.c b/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_if.c index 70b8383f7c8e..e77d5a2452c1 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_if.c +++ b/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_if.c @@ -220,15 +220,21 @@ static struct vdec_fb *vp9_rm_from_fb_use_list(struct vdec_vp9_inst { struct vdec_fb *fb = NULL; struct vdec_fb_node *node; + bool found = false; list_for_each_entry(node, &inst->fb_use_list, list) { fb = (struct vdec_fb *)node->fb; if (fb->base_y.va == addr) { list_move_tail(&node->list, &inst->available_fb_node_list); + found = true; break; } } + + if (!found) + fb = NULL; + return fb; }