Skip to content

Commit d66dbd3

Browse files
pengwan1intel-mediadev
authored andcommitted
[Decode] [PDVT-SH] AV1 CRC Output Enable
AV1 CRC Output Enable
1 parent 0c442fb commit d66dbd3

File tree

9 files changed

+287
-4
lines changed

9 files changed

+287
-4
lines changed

media_driver/agnostic/Xe_M/Xe_HPM/hw/vdbox/mhw_vdbox_avp_hwcmd_xe_hpm.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@
3636

3737
#include "mhw_hwcmd.h"
3838

39-
#ifdef _MEDIA_RESERVED
40-
#include "mhw_vdbox_avp_cmdpar_ext.h"
41-
#endif
42-
4339
#pragma once
4440
#pragma pack(1)
4541

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
/*
2+
* Copyright (c) 2025, Intel Corporation
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a
5+
* copy of this software and associated documentation files (the "Software"),
6+
* to deal in the Software without restriction, including without limitation
7+
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
8+
* and/or sell copies of the Software, and to permit persons to whom the
9+
* Software is furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included
12+
* in all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18+
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19+
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20+
* OTHER DEALINGS IN THE SOFTWARE.
21+
*/
22+
23+
//!
24+
//! \file decode_av1_debug_packet.cpp
25+
//! \brief Defines the implementation for AV1 decode debug sub packet
26+
//! \details The AV1 decode debug sub packet implementation provides debug functionality
27+
//! for AV1 decode operations, including AVP debug data collection and CRC verification.
28+
//!
29+
30+
#if (_DEBUG || _RELEASE_INTERNAL)
31+
32+
#include "decode_av1_debug_packet.h"
33+
#include "decode_utils.h"
34+
35+
namespace decode
36+
{
37+
38+
Av1DecodeDebugPkt::Av1DecodeDebugPkt(DecodePipeline *pipeline, CodechalHwInterfaceNext *hwInterface)
39+
: DecodeSubPacket(pipeline, hwInterface)
40+
{
41+
m_hwInterface = hwInterface;
42+
m_pipeline = pipeline;
43+
}
44+
45+
MOS_STATUS Av1DecodeDebugPkt::Init()
46+
{
47+
DECODE_FUNC_CALL();
48+
49+
DECODE_CHK_NULL(m_pipeline);
50+
DECODE_CHK_NULL(m_hwInterface);
51+
52+
m_miItf = m_hwInterface->GetMiInterfaceNext();
53+
DECODE_CHK_NULL(m_miItf);
54+
55+
return MOS_STATUS_SUCCESS;
56+
}
57+
58+
MOS_STATUS Av1DecodeDebugPkt::Prepare()
59+
{
60+
DECODE_FUNC_CALL();
61+
62+
return MOS_STATUS_SUCCESS;
63+
}
64+
65+
MOS_STATUS Av1DecodeDebugPkt::CalculateCommandSize(uint32_t &commandBufferSize, uint32_t &requestedPatchListSize)
66+
{
67+
DECODE_FUNC_CALL();
68+
69+
commandBufferSize = 0;
70+
requestedPatchListSize = 0;
71+
return MOS_STATUS_SUCCESS;
72+
}
73+
74+
MOS_STATUS Av1DecodeDebugPkt::Destroy()
75+
{
76+
DECODE_FUNC_CALL();
77+
78+
return MOS_STATUS_SUCCESS;
79+
}
80+
81+
MOS_STATUS Av1DecodeDebugPkt::Execute(MOS_COMMAND_BUFFER& cmdBuffer)
82+
{
83+
DECODE_FUNC_CALL();
84+
85+
return MOS_STATUS_SUCCESS;
86+
}
87+
88+
MOS_STATUS Av1DecodeDebugPkt::Completed()
89+
{
90+
DECODE_FUNC_CALL();
91+
92+
return MOS_STATUS_SUCCESS;
93+
}
94+
95+
} // namespace decode
96+
97+
#endif // _DEBUG || _RELEASE_INTERNAL
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
/*
2+
* Copyright (c) 2025, Intel Corporation
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a
5+
* copy of this software and associated documentation files (the "Software"),
6+
* to deal in the Software without restriction, including without limitation
7+
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
8+
* and/or sell copies of the Software, and to permit persons to whom the
9+
* Software is furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included
12+
* in all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18+
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19+
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20+
* OTHER DEALINGS IN THE SOFTWARE.
21+
*/
22+
23+
//!
24+
//! \file decode_av1_debug_packet.h
25+
//! \brief Defines the common interface for AV1 decode debug sub packet
26+
//! \details The AV1 decode debug sub packet interface provides debug functionality
27+
//! for AV1 decode operations, including AVP debug data collection and CRC verification.
28+
//!
29+
30+
#ifndef __DECODE_AV1_DEBUG_PACKET_H__
31+
#define __DECODE_AV1_DEBUG_PACKET_H__
32+
33+
#if (_DEBUG || _RELEASE_INTERNAL)
34+
35+
#include "decode_sub_packet.h"
36+
#include "codechal_setting.h"
37+
#include "decode_pipeline.h"
38+
39+
namespace decode
40+
{
41+
42+
class Av1DecodeDebugPkt : public DecodeSubPacket
43+
{
44+
public:
45+
//!
46+
//! \brief AV1 decode debug sub packet constructor
47+
//!
48+
Av1DecodeDebugPkt(DecodePipeline *pipeline, CodechalHwInterfaceNext *hwInterface);
49+
50+
//!
51+
//! \brief AV1 decode debug sub packet destructor
52+
//!
53+
virtual ~Av1DecodeDebugPkt() {};
54+
55+
//!
56+
//! \brief Initialize the debug sub packet
57+
//! \return MOS_STATUS
58+
//! MOS_STATUS_SUCCESS if success, else fail reason
59+
//!
60+
virtual MOS_STATUS Init() override;
61+
62+
//!
63+
//! \brief Prepare the parameters for debug sub packet
64+
//! \return MOS_STATUS
65+
//! MOS_STATUS_SUCCESS if success, else fail reason
66+
//!
67+
virtual MOS_STATUS Prepare() override;
68+
69+
//!
70+
//! \brief Calculate Command Size
71+
//!
72+
//! \param [in, out] commandBufferSize
73+
//! requested size
74+
//! \param [in, out] requestedPatchListSize
75+
//! requested size
76+
//! \return MOS_STATUS
77+
//! status
78+
//!
79+
virtual MOS_STATUS CalculateCommandSize(
80+
uint32_t &commandBufferSize,
81+
uint32_t &requestedPatchListSize) override;
82+
83+
//!
84+
//! \brief Destroy the debug sub packet
85+
//! \return MOS_STATUS
86+
//! MOS_STATUS_SUCCESS if success, else fail reason
87+
//!
88+
virtual MOS_STATUS Destroy();
89+
90+
//!
91+
//! \brief Execute debug sub packet
92+
//! \param [in] cmdBuffer
93+
//! Command buffer
94+
//! \return MOS_STATUS
95+
//! MOS_STATUS_SUCCESS if success, else fail reason
96+
//!
97+
virtual MOS_STATUS Execute(MOS_COMMAND_BUFFER& cmdBuffer);
98+
99+
//!
100+
//! \brief Complete debug operations after decode
101+
//! \return MOS_STATUS
102+
//! MOS_STATUS_SUCCESS if success, else fail reason
103+
//!
104+
virtual MOS_STATUS Completed();
105+
106+
protected:
107+
std::shared_ptr<mhw::mi::Itf> m_miItf = nullptr;
108+
109+
MEDIA_CLASS_DEFINE_END(decode__Av1DecodeDebugPkt)
110+
};
111+
112+
}
113+
114+
#endif // _DEBUG || _RELEASE_INTERNAL
115+
116+
#endif // !__DECODE_AV1_DEBUG_PACKET_H__

media_softlet/agnostic/common/codec/hal/dec/av1/packet/decode_av1_packet.cpp

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
#include "decode_status_report_defs.h"
2828
#include "decode_predication_packet.h"
2929
#include "decode_marker_packet.h"
30+
#if (_DEBUG || _RELEASE_INTERNAL)
31+
#include "decode_av1_debug_packet.h"
32+
#endif
3033

3134
namespace decode {
3235

@@ -64,6 +67,20 @@ MOS_STATUS Av1DecodePkt::Init()
6467
m_pictureStatesSize, 1, CODEC_NUM_AV1_SECOND_BB, true, lockableVideoMem);
6568
DECODE_CHK_NULL(m_secondLevelBBArray);
6669

70+
#if (_DEBUG || _RELEASE_INTERNAL)
71+
// Initialize debug packet
72+
DecodeSubPacket* debugSubPacket = m_av1Pipeline->GetSubPacket(DecodePacketId(m_av1Pipeline, av1DebugSubPacketId));
73+
if (debugSubPacket != nullptr)
74+
{
75+
Av1DecodeDebugPkt* debugPkt = dynamic_cast<Av1DecodeDebugPkt*>(debugSubPacket);
76+
if (debugPkt != nullptr)
77+
{
78+
m_av1DebugPkt = debugPkt;
79+
DECODE_CHK_STATUS(m_av1DebugPkt->Init());
80+
}
81+
}
82+
#endif
83+
6784
return MOS_STATUS_SUCCESS;
6885
}
6986

@@ -85,6 +102,14 @@ MOS_STATUS Av1DecodePkt::Destroy()
85102
DECODE_CHK_STATUS(m_allocator->Destroy(m_secondLevelBBArray));
86103
}
87104

105+
#if (_DEBUG || _RELEASE_INTERNAL)
106+
// Destroy debug packet
107+
if (m_av1DebugPkt != nullptr)
108+
{
109+
DECODE_CHK_STATUS(m_av1DebugPkt->Destroy());
110+
}
111+
#endif
112+
88113
return MOS_STATUS_SUCCESS;
89114
}
90115

@@ -187,6 +212,14 @@ MOS_STATUS Av1DecodePkt::Completed(void *mfxStatus, void *rcsStatus, void *statu
187212
DecodeStatusReportData *statusReportData = (DecodeStatusReportData *)statusReport;
188213
DECODE_VERBOSEMESSAGE("Current Frame Index = %d", statusReportData->currDecodedPic.FrameIdx);
189214

215+
#if (_DEBUG || _RELEASE_INTERNAL)
216+
// Complete debug packet operations
217+
if (m_av1DebugPkt != nullptr)
218+
{
219+
DECODE_CHK_STATUS(m_av1DebugPkt->Completed());
220+
}
221+
#endif
222+
190223
return MOS_STATUS_SUCCESS;
191224
}
192225

@@ -284,6 +317,14 @@ MOS_STATUS Av1DecodePkt::EndStatusReport(uint32_t srType, MOS_COMMAND_BUFFER* cm
284317
// Add Mi flush here to ensure end status tag flushed to memory earlier than completed count
285318
DECODE_CHK_STATUS(MiFlush(*cmdBuffer));
286319

320+
#if (_DEBUG || _RELEASE_INTERNAL)
321+
// Execute debug packet
322+
if (m_av1DebugPkt != nullptr)
323+
{
324+
DECODE_CHK_STATUS(m_av1DebugPkt->Execute(*cmdBuffer));
325+
}
326+
#endif
327+
287328
return MOS_STATUS_SUCCESS;
288329
}
289330

media_softlet/agnostic/common/codec/hal/dec/av1/packet/decode_av1_packet.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
namespace decode
3939
{
4040

41+
class Av1DecodeDebugPkt;
42+
4143
class Av1DecodePkt : public CmdPacket, public MediaStatusReportObserver
4244
{
4345
public:
@@ -173,6 +175,9 @@ class Av1DecodePkt : public CmdPacket, public MediaStatusReportObserver
173175
PMHW_BATCH_BUFFER m_batchBuf = nullptr;
174176
std::shared_ptr<mhw::vdbox::vdenc::Itf> m_vdencItf = nullptr;
175177

178+
private:
179+
Av1DecodeDebugPkt *m_av1DebugPkt = nullptr; //!< AV1 debug packet for debug functionality
180+
176181
MEDIA_CLASS_DEFINE_END(decode__Av1DecodePkt)
177182
};
178183

media_softlet/agnostic/common/codec/hal/dec/av1/packet/decode_av1_tile_packet.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,15 @@ namespace decode
253253

254254
m_av1BasicFeature->m_frameCompletedFlag = par.lastTileOfFrame;
255255

256+
#if (_DEBUG || _RELEASE_INTERNAL)
257+
bool crcOutputEnable = false;
258+
if (m_av1Pipeline != nullptr)
259+
{
260+
crcOutputEnable = m_av1Pipeline->GetCRCOutputEnable();
261+
}
262+
par.enableAvpDebugMode = crcOutputEnable;
263+
#endif
264+
256265
DECODE_CHK_STATUS(m_avpItf->MHW_ADDCMD_F(AVP_TILE_CODING)(&cmdBuffer));
257266

258267
return MOS_STATUS_SUCCESS;

media_softlet/agnostic/common/codec/hal/dec/av1/packet/media_srcs.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@ set(SOFTLET_DECODE_AV1_SOURCES_
2424
${CMAKE_CURRENT_LIST_DIR}/decode_av1_picture_packet.cpp
2525
${CMAKE_CURRENT_LIST_DIR}/decode_av1_tile_packet.cpp
2626
${CMAKE_CURRENT_LIST_DIR}/decode_av1_packet.cpp
27+
${CMAKE_CURRENT_LIST_DIR}/decode_av1_debug_packet.cpp
2728
)
2829

2930
set(SOFTLET_DECODE_AV1_HEADERS_
3031
${SOFTLET_DECODE_AV1_HEADERS_}
3132
${CMAKE_CURRENT_LIST_DIR}/decode_av1_picture_packet.h
3233
${CMAKE_CURRENT_LIST_DIR}/decode_av1_tile_packet.h
3334
${CMAKE_CURRENT_LIST_DIR}/decode_av1_packet.h
35+
${CMAKE_CURRENT_LIST_DIR}/decode_av1_debug_packet.h
3436
)
3537

3638
source_group( CodecHalNext\\Shared\\Decode FILES ${SOFTLET_DECODE_AV1_SOURCES_} ${SOFTLET_DECODE_AV1_HEADERS_} )

media_softlet/agnostic/common/codec/hal/dec/av1/pipeline/decode_av1_pipeline.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
#include "decode_av1_feature_manager.h"
3030
#include "decode_huc_packet_creator_base.h"
3131
#include "media_debug_fast_dump.h"
32+
#if (_DEBUG || _RELEASE_INTERNAL)
33+
#include "decode_av1_debug_packet.h"
34+
#endif
3235

3336
namespace decode {
3437

@@ -154,6 +157,19 @@ MOS_STATUS Av1Pipeline::CreateSubPackets(DecodeSubPacketManager &subPacketManage
154157

155158
DECODE_CHK_STATUS(DecodePipeline::CreateSubPackets(subPacketManager, codecSettings));
156159

160+
#if (_DEBUG || _RELEASE_INTERNAL)
161+
// Create debug packet
162+
Av1DecodeDebugPkt *debugPkt = MOS_New(Av1DecodeDebugPkt, this, m_hwInterface);
163+
DECODE_CHK_NULL(debugPkt);
164+
MOS_STATUS status = subPacketManager.Register(
165+
DecodePacketId(this, av1DebugSubPacketId), *debugPkt);
166+
if (status != MOS_STATUS_SUCCESS)
167+
{
168+
MOS_Delete(debugPkt);
169+
return status;
170+
}
171+
#endif
172+
157173
return MOS_STATUS_SUCCESS;
158174
}
159175

media_softlet/agnostic/common/codec/hal/dec/av1/pipeline/decode_av1_pipeline.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ class Av1Pipeline : public DecodePipeline
6363
DeclareDecodePacketId(av1PictureSubPacketId);
6464
DeclareDecodePacketId(av1TileSubPacketId);
6565
DeclareDecodePacketId(av1DecodeAqmId);
66+
DeclareDecodePacketId(av1DebugSubPacketId);
6667

6768
protected:
6869
//!

0 commit comments

Comments
 (0)