1 /*===================== begin_copyright_notice ==================================
2 
3 # Copyright (c) 2021, Intel Corporation
4 
5 # Permission is hereby granted, free of charge, to any person obtaining a
6 # copy of this software and associated documentation files (the "Software"),
7 # to deal in the Software without restriction, including without limitation
8 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 # and/or sell copies of the Software, and to permit persons to whom the
10 # Software is furnished to do so, subject to the following conditions:
11 
12 # The above copyright notice and this permission notice shall be included
13 # in all copies or substantial portions of the Software.
14 
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
19 # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20 # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21 # OTHER DEALINGS IN THE SOFTWARE.
22 
23 ======================= end_copyright_notice ==================================*/
24 //!
25 //! \file     mhw_vdbox_avp_xe_hpm.h
26 //! \brief    Defines functions for constructing Vdbox AVP commands on DG2 platform
27 //!
28 
29 #ifndef __MHW_VDBOX_AVP_XE_HPM_H__
30 #define __MHW_VDBOX_AVP_XE_HPM_H__
31 
32 #include "mhw_vdbox_avp_g12_X.h"
33 #include "mhw_vdbox_avp_impl_xe_hpm.h"
34 
35 class MhwVdboxAvpPipeBufAddrParamsXe_Hpm : public MhwVdboxAvpPipeBufAddrParams
36 {
37 public:
38     MOS_RESOURCE *m_originalUncompressedPictureSourceBuffer   = nullptr;
39     MOS_RESOURCE *m_downscaledUncompressedPictureSourceBuffer = nullptr;
40     MOS_RESOURCE *m_tileSizeStreamoutBuffer                   = nullptr;
41     uint32_t      m_tileSizeStreamoutBufferSize               = 0;
42     uint32_t      m_tileSizeStreamoutBufferOffset             = 0;
43     MOS_RESOURCE *m_tileStatisticsPakStreamoutBuffer          = nullptr;
44     MOS_RESOURCE *m_cuStreamoutBuffer                         = nullptr;
45     MOS_RESOURCE *m_sseLineReadWriteBuffer                    = nullptr;
46     MOS_RESOURCE *m_sseTileLineReadWriteBuffer                = nullptr;
47     MOS_SURFACE  *m_postCDEFpixelsBuffer                      = nullptr;
48 
49     MOS_MEMCOMP_STATE m_postCdefSurfMmcState                  = {};
50     virtual void Initialize();
51     //!
52     //! \brief    Destructor
53     //!
~MhwVdboxAvpPipeBufAddrParamsXe_Hpm()54     virtual ~MhwVdboxAvpPipeBufAddrParamsXe_Hpm() {}
55 };
56 
57 //!  MHW Vdbox Avp interface for Xe_HPM
58 /*!
59 This class defines the Avp command interface for Xe_HPM platforms
60 */
61 class MhwVdboxAvpInterfaceXe_Hpm : public MhwVdboxAvpInterfaceG12
62 {
63 public:
64     MhwVdboxAvpInterfaceXe_Hpm(
65         PMOS_INTERFACE  osInterface,
66         MhwMiInterface *miInterface,
67         MhwCpInterface *cpInterface,
68         bool            decodeInUse);
69     ~MhwVdboxAvpInterfaceXe_Hpm();
70 
71     MOS_STATUS GetAvpStateCommandSize(
72         uint32_t *                      commandsSize,
73         uint32_t *                      patchListSize,
74         PMHW_VDBOX_STATE_CMDSIZE_PARAMS params) override;
75 
76     MOS_STATUS GetAvpPrimitiveCommandSize(
77         uint32_t *commandsSize,
78         uint32_t *patchListSize) override;
79 
80     MOS_STATUS AddAvpPipeModeSelectCmd(
81         PMOS_COMMAND_BUFFER                cmdBuffer,
82         PMHW_VDBOX_PIPE_MODE_SELECT_PARAMS params) override;
83 
84     MOS_STATUS AddAvpDecodeSurfaceStateCmd(
85         PMOS_COMMAND_BUFFER       cmdBuffer,
86         PMHW_VDBOX_SURFACE_PARAMS params) override;
87 
88     MOS_STATUS AddAvpPipeBufAddrCmd(
89         PMOS_COMMAND_BUFFER           cmdBuffer,
90         MhwVdboxAvpPipeBufAddrParams *params) override;
91 
92     //!
93     //! \brief    Adds AVP Ind Obj Base Address command
94     //! \details  function to add AVP Ind Obj Base Address command in command buffer
95     //!
96     //! \param    [in] cmdBuffer
97     //!           Command buffer to which HW command is added
98     //! \param    [in] params
99     //!           Params structure used to populate the HW command
100     //!
101     //! \return   MOS_STATUS
102     //!           MOS_STATUS_SUCCESS if success, else fail reason
103     //!
104     MOS_STATUS AddAvpIndObjBaseAddrCmd(
105         PMOS_COMMAND_BUFFER                 cmdBuffer,
106         PMHW_VDBOX_IND_OBJ_BASE_ADDR_PARAMS params) override;
107 
GetNewAvpInterface()108     std::shared_ptr<void> GetNewAvpInterface() override
109     {
110         if (!m_avpItfNew)
111         {
112             auto ptr = std::make_shared<mhw::vdbox::avp::xe_hpm::Impl>(m_osInterface);
113             ptr->SetCacheabilitySettings(m_cacheabilitySettings);
114             m_avpItfNew = ptr;
115         }
116 
117         return m_avpItfNew;
118     }
119 };
120 
121 #endif
122