1 /*
2 * Copyright (c) 2023, 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 //! \file     decode_huc_authcheck_packet_m12.h
24 //! \brief    Defines the implementation of HuC authentication check packet
25 //!
26 
27 #ifndef __DECODE_HUC_AUTHCHECK_PACKET_M12_H__
28 #define __DECODE_HUC_AUTHCHECK_PACKET_M12_H__
29 
30 #include "decode_allocator.h"
31 #include "decode_utils.h"
32 #include "decode_pipeline.h"
33 #include "codechal_hw_g12_X.h"
34 
35 namespace decode
36 {
37     class DecodeHucAuthCheckPktM12
38     {
39     public:
DecodeHucAuthCheckPktM12(MediaPipeline * pipeline,CodechalHwInterface * hwInterface)40         DecodeHucAuthCheckPktM12(MediaPipeline *pipeline, CodechalHwInterface *hwInterface)
41         {
42             m_hwInterface = dynamic_cast<CodechalHwInterfaceG12 *>(hwInterface);
43             m_pipeline = dynamic_cast<DecodePipeline *>(pipeline);
44 
45             if (hwInterface != nullptr)
46             {
47                 m_miInterface = hwInterface->GetMiInterface();
48                 m_osInterface = hwInterface->GetOsInterface();
49                 m_hucInterface = hwInterface->GetHucInterface();
50             }
51         }
~DecodeHucAuthCheckPktM12()52         virtual ~DecodeHucAuthCheckPktM12() {}
53 
54         //!
55         //! \brief  Initialize the media packet, allocate required resources
56         //! \return MOS_STATUS
57         //!         MOS_STATUS_SUCCESS if success, else fail reason
58         //!
59         MOS_STATUS Init();
60 
61         //!
62         //! \brief  Destroy allocated resources
63         //! \return MOS_STATUS
64         //!         MOS_STATUS_SUCCESS if success, else fail reason
65         //!
66         MOS_STATUS Destroy();
67 
68         //!
69         //! \brief  Execute hevc picture packet
70         //! \return MOS_STATUS
71         //!         MOS_STATUS_SUCCESS if success, else fail reason
72         //!
73         MOS_STATUS Execute(MOS_COMMAND_BUFFER &cmdBuffer);
74 
GetSecondLvlBB()75         PMHW_BATCH_BUFFER GetSecondLvlBB() { return m_batchBuf; };
76 
77     private:
78         MOS_STATUS Init2ndLevelCmdBuffer(MHW_BATCH_BUFFER &batchBuffer, uint8_t *batchBufBase);
79 
80         MOS_STATUS PackHucAuthCmds(MOS_COMMAND_BUFFER &cmdBuffer);
81 
82         PMOS_INTERFACE          m_osInterface  = nullptr;
83         CodechalHwInterfaceG12 *m_hwInterface  = nullptr;
84         MhwMiInterface         *m_miInterface  = nullptr;
85         MhwVdboxHucInterface   *m_hucInterface = nullptr;
86 
87         DecodePipeline    *m_pipeline           = nullptr;
88         DecodeAllocator   *m_allocator          = nullptr;
89         MOS_BUFFER        *m_hucAuthCheckBuf    = nullptr;  //!< Pointer to Huc authentication buffer
90         BatchBufferArray  *m_secondLevelBBArray = nullptr;  //!< Pointer to second level batch buffer
91         PMHW_BATCH_BUFFER  m_batchBuf           = nullptr;
92         MOS_COMMAND_BUFFER m_hucAuthCmdBuffer   = {};
93 
94 MEDIA_CLASS_DEFINE_END(decode__HucAuthCheckPktM12)
95     };
96 }  // namespace decode
97 #endif
98