1 /*===================== begin_copyright_notice ==================================
2 # Copyright (c) 2020-2021, Intel Corporation
3 # Permission is hereby granted, free of charge, to any person obtaining a
4 # copy of this software and associated documentation files (the "Software"),
5 # to deal in the Software without restriction, including without limitation
6 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 # and/or sell copies of the Software, and to permit persons to whom the
8 # Software is furnished to do so, subject to the following conditions:
9 # The above copyright notice and this permission notice shall be included
10 # in all copies or substantial portions of the Software.
11 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
12 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
14 # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
15 # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
16 # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
17 # OTHER DEALINGS IN THE SOFTWARE.
18 ======================= end_copyright_notice ==================================*/
19 //!
20 //! \file      codechal_hw_next_xe_hpm.h
21 //! \brief     This modules implements HW interface layer to be used on dg2 platforms on all operating systems/DDIs, across CODECHAL components.
22 //!
23 #ifndef __CODECHAL_HW_NEXT_XE_HPM_H__
24 #define __CODECHAL_HW_NEXT_XE_HPM_H__
25 
26 #include "codechal_hw.h"
27 #include "codechal_debug.h"
28 
29 //!  Codechal hw interface Gen12
30 /*!
31 This class defines the interfaces for hardware dependent settings and functions used in Codechal for Gen12 platforms
32 */
33 class CodechalHwInterfaceNextXe_Hpm : public CodechalHwInterfaceNext
34 {
35 public:
36 
37     //!
38     //! \brief    Constructor
39     //!
40     CodechalHwInterfaceNextXe_Hpm(
41         PMOS_INTERFACE    osInterface,
42         CODECHAL_FUNCTION codecFunction,
43         MhwInterfacesNext *mhwInterfacesNext,
44         bool              disableScalability);
45 
46     //!
47     //! \brief    Copy constructor
48     //!
49     CodechalHwInterfaceNextXe_Hpm(const CodechalHwInterfaceNextXe_Hpm &) = delete;
50 
51     //!
52     //! \brief    Copy assignment operator
53     //!
54     CodechalHwInterfaceNextXe_Hpm &operator=(const CodechalHwInterfaceNextXe_Hpm &) = delete;
55 
56     //!
57     //! \brief    Destructor
58     //!
59     virtual ~CodechalHwInterfaceNextXe_Hpm();
60 
61     bool UsesRenderEngine(CODECHAL_FUNCTION codecFunction, uint32_t standard);
62 
Uses2PlanesInputSurfaceFilmGrain()63     bool Uses2PlanesInputSurfaceFilmGrain()
64     {
65         return true;
66     }
67 
68     //!
69     //! \brief    Calculates the maximum size for AVP picture level commands
70     //! \details  Client facing function to calculate the maximum size for AVP picture level commands
71     //! \param    [in] mode
72     //!           Indicate the codec mode
73     //! \param    [out] commandsSize
74     //!           The maximum command buffer size
75     //! \param    [out] patchListSize
76     //!           The maximum command patch list size
77     //! \param    [in] params
78     //!           Indicate the command size parameters
79     //! \return   MOS_STATUS
80     //!           MOS_STATUS_SUCCESS if success, else fail reason
81     //!
82     virtual MOS_STATUS GetAvpStateCommandSize(
83             uint32_t                        mode,
84             uint32_t                        *commandsSize,
85             uint32_t                        *patchListSize,
86             PMHW_VDBOX_STATE_CMDSIZE_PARAMS params) override;
87 
88 #if USE_CODECHAL_DEBUG_TOOL
89     //! \brief    Create media copy
90     //! \details  Create media copy instance.
91     //! \param    osInterface
92     //!           [in] Pointer to MOS_INTERFACE.
93     //! \return   MediaCopyBaseState*
94     //!           Pointer to MediaCopyBaseState
95     //!
96     virtual MediaCopyBaseState *CreateMediaCopy(PMOS_INTERFACE mosInterface) override;
97 #endif
98 
99     //!
100     //! \brief    Calculates maximum size for AVP tile level commands
101     //! \details  Client facing function to calculate maximum size for AVP tile level commands
102     //! \param    [in] mode
103     //!           Indicate the codec mode
104     //! \param    [out] commandsSize
105     //!            The maximum command buffer size
106     //! \param    [out] patchListSize
107     //!           The maximum command patch list size
108     //! \return   MOS_STATUS
109     //!           MOS_STATUS_SUCCESS if success, else fail reason
110     //!
111     virtual MOS_STATUS GetAvpPrimitiveCommandSize(
112             uint32_t                        mode,
113             uint32_t                        *commandsSize,
114             uint32_t                        *patchListSize) override;
115 
116     virtual MOS_STATUS Initialize(
117         CodechalSetting *settings) override;
118 private:
119     //!
120     //! \brief    Called by constructor
121     //!
122     void PrepareCmdSize(CODECHAL_FUNCTION codecFunction);
123 
124     std::shared_ptr<MhwMiInterface> m_miInterface     = nullptr;
125     MhwRenderInterface             *m_renderInterface = nullptr;
126 
127 MEDIA_CLASS_DEFINE_END(CodechalHwInterfaceNextXe_Hpm)
128 };
129 
130 #endif // __CODECHAL_HW_NEXT_XE_HPM_H__