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: Irui Wang X-Patchwork-Id: 698377 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18294EB64DC for ; Sat, 1 Jul 2023 09:06:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229557AbjGAJGz (ORCPT ); Sat, 1 Jul 2023 05:06:55 -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 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org "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; }