xref: /aosp_15_r20/external/intel-media-driver/media_softlet/agnostic/common/hw/mhw_sfc_itf.h (revision ba62d9d3abf0e404f2022b4cd7a85e107f48596f)
1 /*
2 * Copyright (c) 2022, 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     mhw_sfc_itf.h
24 //! \brief    MHW SFC interface common base
25 //! \details
26 //!
27 
28 #ifndef __MHW_SFC_ITF_H__
29 #define __MHW_SFC_ITF_H__
30 
31 #include "mhw_itf.h"
32 #include "mhw_sfc_cmdpar.h"
33 
34 #define _SFC_CMD_DEF(DEF)                    \
35     DEF(SFC_LOCK);                           \
36     DEF(SFC_STATE);                          \
37     DEF(SFC_AVS_STATE);                      \
38     DEF(SFC_FRAME_START);                    \
39     DEF(SFC_IEF_STATE);                      \
40     DEF(SFC_AVS_CHROMA_Coeff_Table);         \
41     DEF(SFC_AVS_LUMA_Coeff_Table)
42 
43 namespace mhw
44 {
45 namespace sfc
46 {
47 class Itf
48 {
49 public:
50 
51     enum CommandsNumberOfAddresses
52     {
53         SFC_STATE_CMD_NUMBER_OF_ADDRESSES                  = 8,
54         SFC_AVS_LUMA_Coeff_Table_CMD_NUMBER_OF_ADDRESSES   = 0,
55         SFC_AVS_CHROMA_Coeff_Table_CMD_NUMBER_OF_ADDRESSES = 0,
56         SFC_AVS_STATE_CMD_NUMBER_OF_ADDRESSES              = 0,
57         SFC_FRAME_START_CMD_NUMBER_OF_ADDRESSES            = 0,
58         SFC_IEF_STATE_CMD_NUMBER_OF_ADDRESSES              = 0,
59         SFC_LOCK_CMD_NUMBER_OF_ADDRESSES                   = 0,
60     };
61 
62     class ParSetting
63     {
64     public:
65         virtual ~ParSetting() = default;
66         _SFC_CMD_DEF(_MHW_SETPAR_DEF);
67     };
68 
69     virtual ~Itf() = default;
70 
71     virtual MOS_STATUS SetSfcSamplerTable(
72         SFC_AVS_LUMA_Coeff_Table_PAR   *pLumaTable,
73         SFC_AVS_CHROMA_Coeff_Table_PAR *pChromaTable,
74         PMHW_AVS_PARAMS           pAvsParams,
75         MOS_FORMAT                SrcFormat,
76         float                     fScaleX,
77         float                     fScaleY,
78         uint32_t                  dwChromaSiting,
79         bool                      bUse8x8Filter,
80         float                     fHPStrength,
81         float                     fLanczosT) = 0;
82 
83     //!
84     //! \brief      get Output centering wheter enable
85     //! \param      [in] inputEnable
86     //!             wheter enable the Output center.
87     //! \return     void
88     //!
89     virtual void IsOutPutCenterEnable(
90         bool inputEnable) = 0;
91 
92     //!
93     //! \brief    Set which Sfc can be used by HW
94     //! \details  VPHAL set which Sfc can be use by HW
95     //! \param    [in] dwSfcIndex;
96     //!           set which Sfc can be used by HW
97     //! \param    [in] dwSfcCount;
98     //!           set Sfc Count
99     //! \return   MOS_STATUS
100     //!           MOS_STATUS_SUCCESS if success, else fail reason
101     virtual MOS_STATUS SetSfcIndex(
102         uint32_t dwSfcIndex,
103         uint32_t dwSfcCount) = 0;
104 
105     virtual MOS_STATUS GetInputFrameWidthHeightAlignUnit(
106         uint32_t &                widthAlignUnit,
107         uint32_t &                heightAlignUnit,
108         bool                      bVdbox,
109         CODECHAL_STANDARD         codecStandard,
110         CodecDecodeJpegChromaType jpegChromaType) = 0;
111 
112     virtual MOS_STATUS GetInputMinWidthHeightInfo(uint32_t &width, uint32_t &height) = 0;
113     virtual MOS_STATUS GetOutputMinWidthHeightInfo(uint32_t &width, uint32_t &height) = 0;
114 
115     virtual MOS_STATUS GetMinWidthHeightInfo(uint32_t &width, uint32_t &height) = 0;
116 
117     virtual MOS_STATUS GetMaxWidthHeightInfo(uint32_t &width, uint32_t &height) = 0;
118 
119     virtual MOS_STATUS GetScalingRatioLimit(float &minScalingRatio, float &maxScalingRatio) = 0;
120 
121         //!
122         //! \brief      Sets AVS Scaling Mode. Will configure the different coefficients of 8-Tap polyphase filter according to scaling mode.
123         //! \param      [in] ScalingMode
124         //!             AVS scaling mode e.g. Nearest, 8-Tap polyphase etc.
125         //! \return     MOS_STATUS
126         //!
127         virtual MOS_STATUS SetSfcAVSScalingMode(
128             MHW_SCALING_MODE ScalingMode) = 0;
129 
130     _SFC_CMD_DEF(_MHW_CMD_ALL_DEF_FOR_ITF);
131 
132 MEDIA_CLASS_DEFINE_END(mhw__sfc__Itf)
133 };
134 }  // namespace vebox
135 }  // namespace mhw
136 #endif  // __MHW_VEBOX_ITF_H__
137