xref: /aosp_15_r20/external/intel-media-driver/media_driver/agnostic/common/vp/hal/vphal_ddi.h (revision ba62d9d3abf0e404f2022b4cd7a85e107f48596f)
1 /*
2 * Copyright (c) 2009-2017, 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      vphal_ddi.h
24 //! \brief
25 //!
26 //!
27 //! \file     vphal_ddi.h
28 //! \brief    VPHAL related utility functions that are needed in DDI layer
29 //! \details  Common utility functions for different DDI layers
30 //!
31 #ifndef __VPHAL_DDI_H__
32 #define __VPHAL_DDI_H__
33 
34 #include "vphal.h"          // Vphal interface structures and definitions
35 
36 //!
37 //! \brief 60 to 30fps detection threshold,
38 //!        larger values may increase the detection time, and should be used
39 //!        with caution;
40 //!        smaller values increase probability of switching between 30 and
41 //!        60fps, and may cause instability if frame drops are detected
42 //!
43 #define FPS_60_TO_30_THRESHOLD 10
44 
45 //!
46 //! \brief 30 to 60fps detection threshold,
47 //!        larger values may increase the detection time, and should be used
48 //!        with caution;
49 //!        smaller values increase probability of switching between 30 and
50 //!        60fps, and may cause instability if frame drops are detected
51 //!
52 #define FPS_30_TO_60_THRESHOLD 10
53 
54 //!
55 //! \brief Frame rate detection states enum
56 //!
57 typedef enum _FPS_DETECTION_STATE
58 {
59     FPS_RESET = 0,            //!< Initial state
60     FPS_30_F0,                //!< 30fps, field 0
61     FPS_30_F1,                //!< 30fps, field 1
62     FPS_60_F0,                //!< 60fps, field 0
63     FPS_60_F1,                //!< 60fps, field 1
64     FPS_30_TO_60,             //!< 30fps to 60fps detection
65     FPS_60_TO_30,             //!< 60fps to 30fps detection
66 
67     FPS_DETECTION_STATES      //!< Number of frame rate detection states
68 } FPS_DETECTION_STATE;
69 
70 
71 //!
72 //! \brief    Judge whether the input procamp value is default or not
73 //! \details  If the procamp values requested are outside one step of the
74 //!           default value(to handle precision errors), then return true
75 //! \param    [in] ProcAmpParameters
76 //!           ProcAmp Parameters
77 //! \return   bool
78 //!           - true  The input procamp value is not default
79 //!           - false The input procamp value is default
80 //!
81 bool VpHal_DdiProcAmpValuesNotDefault(
82     VPHAL_PROCAMP_PARAMS    ProcAmpParameters);
83 
84 //!
85 //! \brief    Destroy VPHAL rendering parameters
86 //! \details  Free source/target surface and other parameters
87 //! \param    [in,out] pRenderParams
88 //!           Render parameter pointer
89 //! \return   void
90 //!
91 void VpHal_DdiReleaseRenderParams(
92     PVPHAL_RENDER_PARAMS    pRenderParams);
93 
94 //!
95 //! \brief    Delete surface at DDI layer
96 //! \details  Free different parameter structures in surfaces and free surfaces
97 //!           at DDI layer, e.g. Sourc/Target/Bwd/Fwd surface
98 //! \param    [in,out] pSurf
99 //!           VPHAL surface pointer
100 //! \return   void
101 //!
102 void VpHal_DdiDeleteSurface(
103     PVPHAL_SURFACE          pSurf);
104 
105 //!
106 //! \brief    Report mode of different features
107 //! \details  Report DI/Scaling/OutputPipe/FRC mode
108 //! \param    [in] pVpHalState
109 //!           VPHAL state pointer
110 //! \param    [in,out] pConfigValues
111 //!           Porinter to configuration report value structure,
112 //!           feature modes will be store in this structure.
113 //! \return   void
114 //!
115 void VpHal_DdiReportFeatureMode(
116     VpBase*                 pVpHalState,
117     PVP_CONFIG              pConfigValues);
118 
119 //!
120 //! \brief    Set up split screen demo mode
121 //! \details  Allocate and initialize split-screen demo mode structure
122 //! \param    [in] splitDemoPosDdi
123 //!           The split demo position setting from DDI layer
124 //! \param    [in] splitDemoParaDdi
125 //!           The split demo parameters setting from DDI layer
126 //! \param    [in,out] splitScreenDemoModeParams
127 //!           Pointer to struct for split-screen demo mode parameters
128 //! \param    [in,out] disableDemoMode
129 //!           Return whether demo mode will be disable or not
130 //! \param    [in] disableDemoMode
131 //!           Pointer to MOS INTERFACE for OS interaction
132 //! \return   MOS_STATUS
133 //!           Return MOS_STATUS_SUCCESS if successful, otherwise failed
134 //!
135 MOS_STATUS VpHal_DdiSetupSplitScreenDemoMode(
136     uint32_t                                splitDemoPosDdi,
137     uint32_t                                splitDemoParaDdi,
138     PVPHAL_SPLIT_SCREEN_DEMO_MODE_PARAMS    *splitScreenDemoModeParams,
139     bool                                    *disableDemoMode,
140     PMOS_INTERFACE                          pOsInterface);
141 
142 //!
143 //! \brief    Init IEF Params to their default value
144 //! \details  Init IEF Params to their default value
145 //! \param    [out] pIEFParams
146 //!           The IEF Params struct to be initialized
147 //! \return   MOS_STATUS
148 //!           Return MOS_STATUS_SUCCESS if successful, otherwise failed
149 //!
150 MOS_STATUS VpHal_DdiInitIEFParams(
151     PVPHAL_IEF_PARAMS       pIEFParams);
152 
153 #endif   // __VPHAL_DDI_H__
154 
155