From nobody Wed Nov 27 09:51:28 2024 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 DC6D613B58E; Sat, 12 Oct 2024 06:43:41 +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=1728715426; cv=none; b=KgIq4rCKjk5WWcrxkJHbt37nvg/580p53iKAkz+AukgBf3Ix0EQhWZ1htsAJY7RUlxMCF7/CMysSnc7Xepi7OjiQQeED9mg1xqqh4YxXWubhVprxmyK3wOBzeVsqxRHCdpCqtuToWCWNtNYjS0W2wjQmgM/ByVEm+cTePH1uUU0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728715426; c=relaxed/simple; bh=bqbk23+V4hI7XXk07Hp5KYUXOOU/B4dag1jsRermGrQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=hId7AbiYUK9x7VRi3p6iv5JK2gWvQhNzCPhX704Wl7WatmgQPAPmewgzdh7HunQtwSN19//JP/SnuXHTzog8oboHcnaL9UGkBE/9o4WxIUYswwPmi9oghikwZeXaOTNNTBTHqmxeO+0gzqEogIEeN5L08S8RViF/WuxbOXvtm+I= 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=HKL0QQy4; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="HKL0QQy4" X-UUID: 4ea924b4886511ef8b96093e013ec31c-20241012 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=mJBm24iA9R7+BmyjwpuCNp9S4WKAceoqhFjOXBR8nAU=; b=HKL0QQy41ZGGl6vHh9X2LSeClk3b31OqVI1fTn0tMr7Ymi65oIlrQhb3xwdQIVSJ+ZMO7U3cy5v+XciQca6kB+yLw/Vxflb+D8Pj3pUJUvBoms6SQam8qghfz3VeNBX32NsehOWxOD095Bl+ZMN1BwIWA4O+LYO7Y6Jcsogh3pE=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.41,REQID:ffc9ccba-b072-4f19-bdc5-9b5b946db6ee,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:6dc6a47,CLOUDID:6a302065-444a-4b47-a99a-591ade3b04b2,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,ARC:0 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: 4ea924b4886511ef8b96093e013ec31c-20241012 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 59797065; Sat, 12 Oct 2024 14:43:36 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by MTKMBS09N1.mediatek.inc (172.21.101.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Sat, 12 Oct 2024 14:43:35 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Sat, 12 Oct 2024 14:43:34 +0800 From: Yunfei Dong To: =?UTF-8?q?N=C3=ADcolas=20F=20=2E=20R=20=2E=20A=20=2E=20Prado?= , Sebastian Fricke , Nicolas Dufresne , Hans Verkuil , AngeloGioacchino Del Regno , Benjamin Gaignard , Nathan Hebert , Daniel Almeida CC: Hsin-Yi Wang , Fritz Koenig , Daniel Vetter , Steve Cho , Yunfei Dong , , , , , , Subject: [PATCH v5 3/5] media: mediatek: vcodec: Get SRC buffer from bitstream instead of M2M Date: Sat, 12 Oct 2024 14:43:27 +0800 Message-ID: <20241012064333.27269-4-yunfei.dong@mediatek.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241012064333.27269-1-yunfei.dong@mediatek.com> References: <20241012064333.27269-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 Content-Transfer-Encoding: quoted-printable X-MTK: N Content-Type: text/plain; charset="utf-8" Getting the SRC buffer from M2M will pick a different than the one used for current decode operation when the SRC buffer is removed from ready list. Signed-off-by: Yunfei Dong --- .../vcodec/decoder/vdec/vdec_av1_req_lat_if.c | 13 +++++++------ .../vcodec/decoder/vdec/vdec_vp9_req_lat_if.c | 15 +++++++-------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_av1_r= eq_lat_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_av1_= req_lat_if.c index 90217cc8e242..a744740ba5f1 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_av1_req_lat_= if.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_av1_req_lat_= if.c @@ -1062,19 +1062,20 @@ static inline void vdec_av1_slice_vsi_to_remote(str= uct vdec_av1_slice_vsi *vsi, =20 static int vdec_av1_slice_setup_lat_from_src_buf(struct vdec_av1_slice_ins= tance *instance, struct vdec_av1_slice_vsi *vsi, + struct mtk_vcodec_mem *bs, struct vdec_lat_buf *lat_buf) { - struct vb2_v4l2_buffer *src; + struct mtk_video_dec_buf *src_buf_info; struct vb2_v4l2_buffer *dst; =20 - src =3D v4l2_m2m_next_src_buf(instance->ctx->m2m_ctx); - if (!src) + src_buf_info =3D container_of(bs, struct mtk_video_dec_buf, bs_buffer); + if (!src_buf_info) return -EINVAL; =20 - lat_buf->vb2_v4l2_src =3D src; + lat_buf->vb2_v4l2_src =3D &src_buf_info->m2m_buf.vb; =20 dst =3D &lat_buf->ts_info; - v4l2_m2m_buf_copy_metadata(src, dst, true); + v4l2_m2m_buf_copy_metadata(lat_buf->vb2_v4l2_src, dst, true); vsi->frame.cur_ts =3D dst->vb2_buf.timestamp; =20 return 0; @@ -1724,7 +1725,7 @@ static int vdec_av1_slice_setup_lat(struct vdec_av1_s= lice_instance *instance, struct vdec_av1_slice_vsi *vsi =3D &pfc->vsi; int ret; =20 - ret =3D vdec_av1_slice_setup_lat_from_src_buf(instance, vsi, lat_buf); + ret =3D vdec_av1_slice_setup_lat_from_src_buf(instance, vsi, bs, lat_buf); if (ret) return ret; =20 diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_r= eq_lat_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_= req_lat_if.c index 3dceb668ba1c..c50a454ab4f7 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_= if.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_= if.c @@ -712,19 +712,18 @@ int vdec_vp9_slice_setup_single_from_src_to_dst(struc= t vdec_vp9_slice_instance * } =20 static int vdec_vp9_slice_setup_lat_from_src_buf(struct vdec_vp9_slice_ins= tance *instance, + struct mtk_vcodec_mem *bs, struct vdec_lat_buf *lat_buf) { - struct vb2_v4l2_buffer *src; - struct vb2_v4l2_buffer *dst; + struct mtk_video_dec_buf *src_buf_info; =20 - src =3D v4l2_m2m_next_src_buf(instance->ctx->m2m_ctx); - if (!src) + src_buf_info =3D container_of(bs, struct mtk_video_dec_buf, bs_buffer); + if (!src_buf_info) return -EINVAL; =20 - lat_buf->vb2_v4l2_src =3D src; + lat_buf->vb2_v4l2_src =3D &src_buf_info->m2m_buf.vb; =20 - dst =3D &lat_buf->ts_info; - v4l2_m2m_buf_copy_metadata(src, dst, true); + v4l2_m2m_buf_copy_metadata(lat_buf->vb2_v4l2_src, &lat_buf->ts_info, true= ); return 0; } =20 @@ -1154,7 +1153,7 @@ static int vdec_vp9_slice_setup_lat(struct vdec_vp9_s= lice_instance *instance, struct vdec_vp9_slice_vsi *vsi =3D &pfc->vsi; int ret; =20 - ret =3D vdec_vp9_slice_setup_lat_from_src_buf(instance, lat_buf); + ret =3D vdec_vp9_slice_setup_lat_from_src_buf(instance, bs, lat_buf); if (ret) goto err; =20 --=20 2.46.0