xref: /aosp_15_r20/external/intel-media-driver/media_softlet/agnostic/common/vp/hal/packet/vp_sfc_common.h (revision ba62d9d3abf0e404f2022b4cd7a85e107f48596f)
1 /*
2 * Copyright (c) 2018-2024, 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 #ifndef __VP_SFC_COMMON_H__
23 #define __VP_SFC_COMMON_H__
24 
25 #include "vp_common.h"
26 #include "vp_pipeline_common.h"
27 #include "mhw_sfc_itf.h"
28 
29 namespace vp
30 {
31 //!
32 //! \brief Constants used to derive Line Buffer sizes
33 //!
34 #define SFC_CACHELINE_SIZE_IN_BYTES                         (512 / 8)
35 #define SFC_AVS_LINEBUFFER_SIZE_PER_PIXEL_4_TAP_12BIT       (5 * SFC_CACHELINE_SIZE_IN_BYTES / 8)
36 #define SFC_AVS_LINEBUFFER_SIZE_PER_PIXEL_8_TAP_12BIT       (6 * SFC_CACHELINE_SIZE_IN_BYTES / 8)
37 #define SFC_AVS_LINEBUFFER_SIZE_PER_PIXEL_4_TAP_8BIT        (3 * SFC_CACHELINE_SIZE_IN_BYTES / 8)
38 #define SFC_AVS_LINEBUFFER_SIZE_PER_PIXEL_8_TAP_8BIT        (5 * SFC_CACHELINE_SIZE_IN_BYTES / 8)
39 #define SFC_IEF_LINEBUFFER_SIZE_PER_VERTICAL_PIXEL          (1 * SFC_CACHELINE_SIZE_IN_BYTES / 4)
40 #define SFC_SFD_LINEBUFFER_SIZE_PER_PIXEL                   (1 * SFC_CACHELINE_SIZE_IN_BYTES / 10)
41 #define SFC_LINEBUFEER_SIZE_LIMITED                         4000
42 
43 typedef struct _SFC_COLORFILL_PARAMS
44 {
45     bool                            bColorfillEnable;                           // Colorfill Enable
46     float                           fColorFillYRPixel;                          // ColorFill Y/R pixel
47     float                           fColorFillUGPixel;                          // ColorFill U/G pixel
48     float                           fColorFillVBPixel;                          // ColorFill V/B pixel
49     float                           fColorFillAPixel;                           // ColorFill A pixel
50     float                           fAlphaPixel;                                // Alpha pixel
51 }SFC_COLORFILL_PARAMS, *PSFC_COLORFILL_PARAMS;
52 
53 //!
54 //! \brief Transient Render data populated for every BLT call
55 //!
56 typedef struct _VPHAL_SFC_RENDER_DATA
57 {
58     bool                                bColorFill;                             //!< Enable ColorFill
59     bool                                bScaling;                               //!< Enable Scaling
60     bool                                bIEF;                                   //!< Enable IEF filter
61     bool                                bCSC;                                   //!< Enable CSC filter
62     bool                                bMirrorEnable;                          //!< Enable Mirror filter
63 
64     float                               fScaleX;                                //!< X Scaling ratio
65     float                               fScaleY;                                //!< Y Scaling ratio
66     uint16_t                            wIEFFactor;                             //!< IEF factor
67     mhw::sfc::SFC_STATE_PAR            *sfcStateParams;                         //!< Pointer to SFC state params
68     PVPHAL_IEF_PARAMS                   pIefParams;                             //!< Pointer to IEF params
69     PMHW_AVS_PARAMS                     pAvsParams;                             //!< Pointer to AVS params
70     PSFC_COLORFILL_PARAMS               pColorFillParams;                       //!< Pointer to ColorFill params
71     PVPHAL_ALPHA_PARAMS                 pAlphaParams;                           //!< Pointer to Alpha params
72     VPHAL_CSPACE                        SfcInputCspace;                         //!< SFC Input Color Space
73     MOS_FORMAT                          SfcInputFormat;                         //!< SFC Input Format
74     VPHAL_ROTATION                      SfcRotation;                            //!< SFC Rotation Mode
75     uint32_t                            mirrorType;                             //!< Mirror Type -- vert/horiz
76     VPHAL_SCALING_MODE                  SfcScalingMode;                         //!< SFC Scaling Mode
77 
78     uint32_t                            SfcSrcChromaSiting;                     //!< SFC Source Surface Chroma Siting
79 
80     PVP_SURFACE                         pSfcPipeOutSurface;                     //!< SFC Pipe output surface
81 
82     bool                                bForcePolyPhaseCoefs;                   //!< SFC AVS force polyphase coef
83     bool                                b1stPassOfSfc2PassScaling;              //!< 1st Pass of Sfc 2Pass Scaling
84 
85 } VP_SFC_RENDER_DATA, *PVP_SFC_RENDER_DATA;
86 
87 typedef struct _VPHAL_SFC_RENDER_DATA_LEGACY
88 {
89     bool                                bColorFill;                             //!< Enable ColorFill
90     bool                                bScaling;                               //!< Enable Scaling
91     bool                                bIEF;                                   //!< Enable IEF filter
92     bool                                bCSC;                                   //!< Enable CSC filter
93     bool                                bMirrorEnable;                          //!< Enable Mirror filter
94 
95     float                               fScaleX;                                //!< X Scaling ratio
96     float                               fScaleY;                                //!< Y Scaling ratio
97     uint16_t                            wIEFFactor;                             //!< IEF factor
98     MHW_SFC_STATE_PARAMS               *sfcStateParams;                         //!< Pointer to SFC state params
99     PVPHAL_IEF_PARAMS                   pIefParams;                             //!< Pointer to IEF params
100     PMHW_AVS_PARAMS                     pAvsParams;                             //!< Pointer to AVS params
101     PSFC_COLORFILL_PARAMS               pColorFillParams;                       //!< Pointer to ColorFill params
102     PVPHAL_ALPHA_PARAMS                 pAlphaParams;                           //!< Pointer to Alpha params
103     VPHAL_CSPACE                        SfcInputCspace;                         //!< SFC Input Color Space
104     MOS_FORMAT                          SfcInputFormat;                         //!< SFC Input Format
105     VPHAL_ROTATION                      SfcRotation;                            //!< SFC Rotation Mode
106     uint32_t                            mirrorType;                             //!< Mirror Type -- vert/horiz
107     VPHAL_SCALING_MODE                  SfcScalingMode;                         //!< SFC Scaling Mode
108 
109     uint32_t                            SfcSrcChromaSiting;                     //!< SFC Source Surface Chroma Siting
110 
111     PVP_SURFACE                         pSfcPipeOutSurface;                     //!< SFC Pipe output surface
112 
113     bool                                bForcePolyPhaseCoefs;                   //!< SFC AVS force polyphase coef
114     bool                                b1stPassOfSfc2PassScaling;              //!< 1st Pass of Sfc 2Pass Scaling
115 
116 } VP_SFC_RENDER_DATA_LEGACY, * PVP_SFC_RENDER_DATA_LEGACY;
117 
118 //!
119 //! \brief  Structure to hold AVS Coeff tables
120 //!
121 struct VPHAL_SFC_AVS_STATE
122 {
123     mhw::sfc::SFC_AVS_LUMA_Coeff_Table_PAR      LumaCoeffs;
124     mhw::sfc::SFC_AVS_CHROMA_Coeff_Table_PAR    ChromaCoeffs;
125     mhw::sfc::SFC_AVS_STATE_PAR                 AvsStateParams;
126 };
127 
128 //!
129 //! \brief  Structure to hold AVS Coeff tables
130 //!
131 struct VPHAL_SFC_AVS_STATE_LEGACY
132 {
133     MHW_SFC_AVS_LUMA_TABLE      LumaCoeffs;
134     MHW_SFC_AVS_CHROMA_TABLE    ChromaCoeffs;
135     MHW_SFC_AVS_STATE           AvsStateParams;
136 };
137 
138 }
139 #endif // !__VP_SFC_COMMON_H__
140