1 /*
2 * Copyright (c) 2019, 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_copy_packet.h
24 //! \brief    Defines the implementation of huc copy packet
25 //!
26 
27 #ifndef __CODECHAL_HUC_COPY_PACKET_H__
28 #define __CODECHAL_HUC_COPY_PACKET_H__
29 
30 #include "media_cmd_packet.h"
31 #include "decode_huc.h"
32 #include "media_pipeline.h"
33 #include "codec_hw_next.h"
34 #include "decode_utils.h"
35 #include "decode_huc_copy_packet_itf.h"
36 #include "mhw_vdbox_huc_cmdpar.h"
37 #include "mhw_vdbox_huc_itf.h"
38 #include "mhw_cmdpar.h"
39 
40 namespace decode
41 {
42 class HucCopyPkt : public DecodeHucBasic, public HucCopyPktItf, public mhw::vdbox::huc::Itf::ParSetting
43 {
44     public:
45 
HucCopyPkt(MediaPipeline * pipeline,MediaTask * task,CodechalHwInterfaceNext * hwInterface)46         HucCopyPkt(MediaPipeline *pipeline, MediaTask *task, CodechalHwInterfaceNext *hwInterface)
47             : DecodeHucBasic(pipeline, task, hwInterface) {}
48 
~HucCopyPkt()49         virtual ~HucCopyPkt() { m_copyParamsList.clear(); }
50 
51         virtual MOS_STATUS PushCopyParams(HucCopyParams &copyParams) override;
52 
53         MOS_STATUS Submit(MOS_COMMAND_BUFFER *commandBuffer, uint8_t packetPhase = otherPacket) override;
54 
55         //!
56         //! \brief  Calculate Command Size
57         //!
58         //! \param  [in, out] commandBufferSize
59         //!         requested size
60         //! \param  [in, out] requestedPatchListSize
61         //!         requested size
62         //! \return MOS_STATUS
63         //!         status
64         //!
65         virtual MOS_STATUS CalculateCommandSize(
66             uint32_t &commandBufferSize,
67             uint32_t &requestedPatchListSize) override;
68 
69         //!
70         //! \brief  Get Packet Name
71         //! \return std::string
72         //!
GetPacketName()73         virtual std::string GetPacketName() override
74         {
75             return "HUC_COPY";
76         }
77 
78     protected:
79         virtual MOS_STATUS Execute(MOS_COMMAND_BUFFER& cmdBuffer, bool prologNeeded) override;
80         void SetPerfTag();
81         virtual MOS_STATUS AddCmd_HUC_PIPE_MODE_SELECT(MOS_COMMAND_BUFFER &cmdBuffer);
82         virtual MOS_STATUS AddHucIndState(MOS_COMMAND_BUFFER &cmdBuffer);
83         virtual MHW_SETPAR_DECL_HDR(HUC_IND_OBJ_BASE_ADDR_STATE);
84         virtual MHW_SETPAR_DECL_HDR(HUC_STREAM_OBJECT);
85 
86         std::vector<HucCopyParams> m_copyParamsList; //!< Copy parameters list
87         uint32_t                   m_copyParamsIdx = 0; //!< Copy parameters index
88 
89     MEDIA_CLASS_DEFINE_END(decode__HucCopyPkt)
90     };
91 
92 }  // namespace decode
93 #endif
94