From patchwork Mon Jan 29 06:30:21 2024 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: 193286 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp393031dyb; Sun, 28 Jan 2024 22:35:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IHSnQrbLX2kEP0tuZoDHKEj4oxNXVFLxYSzBeT7VNETW8WjKABG1QbpcYadARMbSFHHrOON X-Received: by 2002:ac8:5e0e:0:b0:42a:a95a:afcd with SMTP id h14-20020ac85e0e000000b0042aa95aafcdmr618524qtx.50.1706510149132; Sun, 28 Jan 2024 22:35:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706510149; cv=pass; d=google.com; s=arc-20160816; b=M1tQr3ONmbXr0OmVRu1IOt5Xfqg8GfwZDKz+X79KDafGqiverRT1wGKDN60XWE4wK/ JUz7pYfGk3Lm2Euyo7aU1fDXuKQgSPJnaPytERkK12tNNhf9mj59OYd3Jwuwa16D2MRu crDBCbmUSeoyqzv3G9ANgfAbaoW4KfYQ2493bu17t1uUL7E31Z6yr9+4cfYkNyDGDew5 QBzJ675iJ8+Fa73My299BjtfHJBqPud1E6B5yPv59qi6so+9j6a9rmINqxoqJxI2FNyZ u3iWi6vPNB8U2wWvSqyQpPBxXi5TGGLRCechGqD5x9YDD/h3BXTXtq+dIDyBuopklCz/ kvKw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=tDdbTuWdtMHx44dMsP7Vdfz0hNjFshKJXaC0iWiaF9M=; fh=Jm1zUP85NkLhaS8mFbLRiIHu8uZd7NKlphUk8mYvM1c=; b=BXNeddLofxQ4GTKdhx/3preRFlnZGfqVgy46tJkvaHLgE7og3kbXdxqujbAyrHxO0D JaMH98In8ypdjgYEqkgSgb+/IC1TCyxoEY3b6Kd29TFSSQu3bCA18oAhidXkX7gp/FKr BdMvSDbt06TYSpWYYehIjYpIQHSHpq0OJj4CPdrUJucsXWqP/8n7c4V93QdU8ksSANWT bb+YfhzqmC13/9MNRBfW+vnGlJ16NxCfGU2zhsWOQ8+nBVeY9PN9JWZpZ5J1X5q8vv4k 5eIPx78d9NLdrjW3/DKRPbsa2zP5NZw/UDT72ronfWmGxW51DofQPXtohoBf6RUDG33J PpBg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=kAwNqxGO; arc=pass (i=1 spf=pass spfdomain=mediatek.com dkim=pass dkdomain=mediatek.com dmarc=pass fromdomain=mediatek.com); spf=pass (google.com: domain of linux-kernel+bounces-42254-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42254-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id i19-20020ac85e53000000b00429a50c4264si6963154qtx.619.2024.01.28.22.35.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jan 2024 22:35:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-42254-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=kAwNqxGO; arc=pass (i=1 spf=pass spfdomain=mediatek.com dkim=pass dkdomain=mediatek.com dmarc=pass fromdomain=mediatek.com); spf=pass (google.com: domain of linux-kernel+bounces-42254-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42254-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id E71C01C20E7A for ; Mon, 29 Jan 2024 06:35:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8A34D58132; Mon, 29 Jan 2024 06:31:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="kAwNqxGO" Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C2DF56445; Mon, 29 Jan 2024 06:31:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.61.82.184 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706509869; cv=none; b=IQ3ipYXrsclQOzrllhcAFd1L36Sdyppd+kri655WkXtDdJnI4kI2i5VJ/YYKzjC5gKHdx8UQWNEDlf1yaI8IWvRxgyA6JpyLcePjwGZhLzbVX0iuYhX6eFk7JatRcEBjBz0ZPJs0OoRLf19sfvAz9cl/ABEnBos2ZKe7NVSsAg8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706509869; c=relaxed/simple; bh=WiIjUCF8+rFVH1JAGZb99ANWCjBV8LC91Gu6iOjZLds=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=JAHnRP6Z46zrLyBXHJm5LT94hAcvuSjdKRdt/Sy1pzGScS6yG0bNq3NO0t+mNeorQTV1Ri3pai2lDC9132hxDW2lmuXdbLW0l6vh2ZR/nxIEcerNf5pWe1eZqjpwKe6bcomfYDLM8WwHSm7CKJqJ+AYausYH5LMunFS1tI3be+Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com; spf=pass smtp.mailfrom=mediatek.com; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b=kAwNqxGO; arc=none smtp.client-ip=210.61.82.184 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mediatek.com X-UUID: f8849be6be6f11eea2298b7352fd921d-20240129 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=tDdbTuWdtMHx44dMsP7Vdfz0hNjFshKJXaC0iWiaF9M=; b=kAwNqxGO6H/jjheOphrZ1Ne6f7lx1t1CPZngkccM0nw41xTalJqmQ1z1U1l1MuufggpOPx3Uvhj2LppBcPjUByp2WA1iqtSsEw4SY3HnQZEZY2auiSAOSw3LYujNnVGGwP/26SZqb/OXsxiM8T8u8aqEv5PB8Xiafw7U4pXPvj8=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.36,REQID:2c19284c-04cb-4681-8e21-7f01cae06b5d,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:6e16cf4,CLOUDID:2ed141fe-c16b-4159-a099-3b9d0558e447,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1, SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: f8849be6be6f11eea2298b7352fd921d-20240129 Received: from mtkmbs14n1.mediatek.inc [(172.21.101.75)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 487120532; Mon, 29 Jan 2024 14:31:01 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) 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.1118.26; Mon, 29 Jan 2024 14:31:00 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Mon, 29 Jan 2024 14:30:58 +0800 From: Yunfei Dong To: Jeffrey Kardatzke , =?utf-8?q?N=C3=ADcolas_F_=2E_?= =?utf-8?q?R_=2E_A_=2E_Prado?= , Nicolas Dufresne , Hans Verkuil , AngeloGioacchino Del Regno , Benjamin Gaignard , Nathan Hebert CC: Chen-Yu Tsai , Yong Wu , Hsin-Yi Wang , Fritz Koenig , Daniel Vetter , Steve Cho , Yunfei Dong , Sumit Semwal , Brian Starkey , John Stultz , "T . J . Mercier" , =?utf-8?q?Christian_K=C3=B6nig?= , Matthias Brugger , , , , , , , Subject: [PATCH v4,18/22] media: mediatek: vcodec: remove parse nal_info in kernel Date: Mon, 29 Jan 2024 14:30:21 +0800 Message-ID: <20240129063025.29251-19-yunfei.dong@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240129063025.29251-1-yunfei.dong@mediatek.com> References: <20240129063025.29251-1-yunfei.dong@mediatek.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MTK: N X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789405585718668914 X-GMAIL-MSGID: 1789405585718668914 The hardware can parse syntax to get nal_info, needn't to use cpu. Signed-off-by: Yunfei Dong --- .../vcodec/decoder/vdec/vdec_h264_req_multi_if.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_multi_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_multi_if.c index a1a68487131c..2dfb3043493e 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_multi_if.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_multi_if.c @@ -645,11 +645,10 @@ static int vdec_h264_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs, struct vdec_h264_slice_inst *inst = h_vdec; struct vdec_vpu_inst *vpu = &inst->vpu; struct mtk_video_dec_buf *src_buf_info; - int nal_start_idx, err, timeout = 0; + int err, timeout = 0; unsigned int data[2]; struct vdec_lat_buf *lat_buf; struct vdec_h264_slice_share_info *share_info; - unsigned char *buf; if (vdec_msg_queue_init(&inst->ctx->msg_queue, inst->ctx, vdec_h264_slice_core_decode, @@ -673,14 +672,6 @@ static int vdec_h264_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs, share_info = lat_buf->private_data; src_buf_info = container_of(bs, struct mtk_video_dec_buf, bs_buffer); - buf = (unsigned char *)bs->va; - nal_start_idx = mtk_vdec_h264_find_start_code(buf, bs->size); - if (nal_start_idx < 0) { - err = -EINVAL; - goto err_free_fb_out; - } - - inst->vsi->dec.nal_info = buf[nal_start_idx]; lat_buf->src_buf_req = src_buf_info->m2m_buf.vb.vb2_buf.req_obj.req; v4l2_m2m_buf_copy_metadata(&src_buf_info->m2m_buf.vb, &lat_buf->ts_info, true); @@ -689,7 +680,7 @@ static int vdec_h264_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs, goto err_free_fb_out; if (!inst->ctx->is_secure_playback) - vdec_h264_insert_startcode(inst->ctx->dev, buf, &bs->size, + vdec_h264_insert_startcode(inst->ctx->dev, bs->va, &bs->size, &share_info->h264_slice_params.pps); *res_chg = inst->resolution_changed;