xref: /aosp_15_r20/external/intel-media-driver/media_driver/agnostic/common/cm/cm_hal_vebox.h (revision ba62d9d3abf0e404f2022b4cd7a85e107f48596f)
1 /*
2 * Copyright (c) 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      cm_hal_vebox.h
24 //! \brief     HAL CM Vebox functions
25 //!
26 
27 #ifndef MEDIADRIVER_AGNOSTIC_COMMON_CM_CMHALVEBOX_H_
28 #define MEDIADRIVER_AGNOSTIC_COMMON_CM_CMHALVEBOX_H_
29 
30 #include "mos_os.h"
31 #include "renderhal_legacy.h"
32 #include "mhw_vebox.h"
33 
34 struct CM_VEBOX_SURFACE
35 {
36     uint16_t surfaceIndex;
37     uint16_t surfaceCtrlBits;
38 };
39 
40 #define VEBOX_SURFACE_NUMBER (16)     //MAX
41 
42 struct CM_VEBOX_SURFACE_DATA
43 {
44     CM_VEBOX_SURFACE surfaceEntry[VEBOX_SURFACE_NUMBER];
45 };
46 typedef CM_VEBOX_SURFACE_DATA *PCM_VEBOX_SURFACE_DATA;
47 
48 struct CM_HAL_EXEC_VEBOX_TASK_PARAM
49 {
50     uint32_t veboxVersion;   // [in] version
51     CM_VEBOX_STATE cmVeboxState;
52     void *veboxParam;         // CmBuffer, hold the vebox parameters
53     uint32_t veboxParamIndex;  // vebox parameter surface index (UMD)
54     CM_VEBOX_SURFACE_DATA veboxSurfaceData;
55     CM_QUEUE_CREATE_OPTION queueOption; // cm queue info, such as rcs/ccs gpu context.
56     int32_t taskIdOut;        // [out] Task ID
57     void *osData;              // [out] Used for Linux OS data to pass to event
58 };
59 typedef CM_HAL_EXEC_VEBOX_TASK_PARAM *PCM_HAL_EXEC_VEBOX_TASK_PARAM;
60 
61 enum VEBOX_SURF_USAGE
62 {
63     VEBOX_CURRENT_FRAME_INPUT_SURF,
64     VEBOX_PREVIOUS_FRAME_INPUT_SURF,
65     VEBOX_STMM_INPUT_SURF,
66     VEBOX_STMM_OUTPUT_SURF,
67     VEBOX_DN_CURRENT_FRAME_OUTPUT_SURF,
68     VEBOX_CURRENT_FRAME_OUTPUT_SURF,
69     VEBOX_PREVIOUS_FRAME_OUTPUT_SURF,
70     VEBOX_STATISTICS_OUTPUT_SURF,
71     VEBOX_ALPHA_VIGNETTE_CORRECTION_SURF,
72     VEBOX_LACE_ACE_RGB_HISTOGRAM_OUTPUT_SURF,
73     VEBOX_SKIN_SCORE_OUTPUT_SURF
74 };
75 
76 //!
77 //! \brief      build up vebox command sequence
78 //! \details     based on passed vebox param to build command sequence and
79 //!             put it into command buffer
80 //! \param       [in] state --- CM_HAL_STATE
81 //! \param       [in] execVeboxParam -- vebox setup params
82 //!
83 MOS_STATUS HalCm_ExecuteVeboxTask(
84     PCM_HAL_STATE                   state,           // [in] Pointer to CM State
85     PCM_HAL_EXEC_VEBOX_TASK_PARAM   execVeboxParam);
86 
87 //!
88 //! \brief      Set up vebox surface Param
89 //! \details    set up vebox surface state based on parameter based from application
90 //!
91 //! \param     [in]state  -- CM_HAL_STATE
92 //! \param     [in]veboxSurfaceStateCmdParams  -- surface state param struct
93 //!
94 MOS_STATUS HalCm_SetVeboxSurfaceStateCmdParams(
95     PCM_HAL_STATE                   state,
96     PMHW_VEBOX_SURFACE_STATE_CMD_PARAMS   veboxSurfaceStateCmdParams);
97 
98 //!
99 //! \brief    set vebox DiIecp Command
100 //! \details  build up command to start processing the frames specified by
101 //!           VEB_SURFACE_STATE using the parameters specified by VEB_DI_STATE
102 //!           and VEB_IECP_STATE.
103 //!  \param   [in] state -- HAL_CM_STATE
104 //!  \param   [in] veboxDiIecpCmdParams  -- DIECP command parameter
105 //!  \param   [in] cmVeboxSurfaceDataInput  -- surface data such as index and control bits
106 //!
107 MOS_STATUS HalCm_SetVeboxDiIecpCmdParams(
108     PCM_HAL_STATE                   state,
109     PMHW_VEBOX_DI_IECP_CMD_PARAMS   veboxDiIecpCmdParams,
110     PCM_VEBOX_SURFACE_DATA       cmVeboxSurfaceDataInput);
111 
112 //!
113 //| \brief     reset vebox STMM history
114 //! \details   Resets the portion of the Vebox STMM surface associated with
115 //|            motion history for temporal filtering.
116 //| \param     [in] osInterface  -- MOS_INTERFACE
117 //| \param     [in] renderHalSTMMSurface -- RENDERHAL_SURFACE
118 //!
119 MOS_STATUS HalCm_VeboxInitSTMMHistory(
120     PMOS_INTERFACE          osInterface,
121     PRENDERHAL_SURFACE      renderHalSTMMSurface);
122 
123 #endif  // #ifndef MEDIADRIVER_AGNOSTIC_COMMON_CM_CMHALVEBOX_H_
124