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 vphal_renderer_g9.cpp
24 //! \brief VPHAL top level rendering component and the entry to low level renderers
25 //! \details The top renderer is responsible for coordinating the sequence of calls to low level renderers, e.g. DNDI or Comp
26 //!
27 #include "vphal_renderer_g9.h"
28 #if defined(ENABLE_KERNELS) && !defined(_FULL_OPEN_SOURCE)
29 #include "igvpkrn_g9.h"
30 #endif
31 #include "vphal_render_vebox_g9_base.h"
32 #include "vphal_render_composite_g9.h"
33
34 extern const Kdll_RuleEntry g_KdllRuleTable_g9[];
35
GetCacheCntl(PMOS_INTERFACE pOsInterface,PLATFORM * pPlatform,MEDIA_FEATURE_TABLE * pSkuTable,PVPHAL_RENDER_CACHE_CNTL pSettings)36 void VphalRendererG9::GetCacheCntl(
37 PMOS_INTERFACE pOsInterface,
38 PLATFORM *pPlatform,
39 MEDIA_FEATURE_TABLE *pSkuTable,
40 PVPHAL_RENDER_CACHE_CNTL pSettings)
41
42 {
43 MOS_HW_RESOURCE_DEF Usage;
44 MEMORY_OBJECT_CONTROL_STATE MemObjCtrl;
45
46 if (pSettings->bCompositing)
47 {
48 pSettings->Composite.bL3CachingEnabled = true;
49
50 VPHAL_SET_SURF_MEMOBJCTL(pSettings->Composite.PrimaryInputSurfMemObjCtl, MOS_MP_RESOURCE_USAGE_SurfaceState);
51 VPHAL_SET_SURF_MEMOBJCTL(pSettings->Composite.InputSurfMemObjCtl, MOS_MP_RESOURCE_USAGE_SurfaceState);
52 VPHAL_SET_SURF_MEMOBJCTL(pSettings->Composite.TargetSurfMemObjCtl, MOS_MP_RESOURCE_USAGE_No_LLC_L3_AGE_SurfaceState);
53 }
54 if (pSettings->bDnDi)
55 {
56 pSettings->DnDi.bL3CachingEnabled = true;
57
58 VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.CurrentInputSurfMemObjCtl, MOS_MP_RESOURCE_USAGE_No_L3_SurfaceState);
59 VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.PreviousInputSurfMemObjCtl, MOS_MP_RESOURCE_USAGE_No_L3_SurfaceState);
60 VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.STMMInputSurfMemObjCtl, MOS_MP_RESOURCE_USAGE_No_L3_SurfaceState);
61 VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.STMMOutputSurfMemObjCtl, MOS_MP_RESOURCE_USAGE_No_LLC_L3_SurfaceState);
62 VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.DnOutSurfMemObjCtl, MOS_MP_RESOURCE_USAGE_No_LLC_L3_SurfaceState);
63 VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.CurrentOutputSurfMemObjCtl, MOS_MP_RESOURCE_USAGE_No_LLC_L3_SurfaceState);
64 VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.StatisticsOutputSurfMemObjCtl, MOS_MP_RESOURCE_USAGE_No_LLC_L3_SurfaceState);
65 VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.AlphaOrVignetteSurfMemObjCtl, MOS_MP_RESOURCE_USAGE_No_LLC_L3_AGE_SurfaceState);
66 VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.LaceOrAceOrRgbHistogramSurfCtrl, MOS_MP_RESOURCE_USAGE_SurfaceState);
67 VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.SkinScoreSurfMemObjCtl, MOS_MP_RESOURCE_USAGE_SurfaceState);
68 VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.LaceLookUpTablesSurfMemObjCtl, MOS_MP_RESOURCE_USAGE_SurfaceState);
69 }
70 if (pSettings->bLace)
71 {
72 VPHAL_SET_SURF_MEMOBJCTL(pSettings->Lace.FrameHistogramSurfaceMemObjCtl, MOS_MP_RESOURCE_USAGE_AGE3_SurfaceState);
73 VPHAL_SET_SURF_MEMOBJCTL(pSettings->Lace.AggregatedHistogramSurfaceMemObjCtl, MOS_MP_RESOURCE_USAGE_AGE3_SurfaceState);
74 VPHAL_SET_SURF_MEMOBJCTL(pSettings->Lace.StdStatisticsSurfaceMemObjCtl, MOS_MP_RESOURCE_USAGE_AGE3_SurfaceState);
75 VPHAL_SET_SURF_MEMOBJCTL(pSettings->Lace.PwlfInSurfaceMemObjCtl, MOS_MP_RESOURCE_USAGE_AGE3_SurfaceState);
76 VPHAL_SET_SURF_MEMOBJCTL(pSettings->Lace.PwlfOutSurfaceMemObjCtl, MOS_MP_RESOURCE_USAGE_AGE3_SurfaceState);
77 VPHAL_SET_SURF_MEMOBJCTL(pSettings->Lace.WeitCoefSurfaceMemObjCtl, MOS_MP_RESOURCE_USAGE_AGE3_SurfaceState);
78 }
79 }
80
AllocateRenderComponents(PMHW_VEBOX_INTERFACE pVeboxInterface,PMHW_SFC_INTERFACE pSfcInterface)81 MOS_STATUS VphalRendererG9::AllocateRenderComponents(
82 PMHW_VEBOX_INTERFACE pVeboxInterface,
83 PMHW_SFC_INTERFACE pSfcInterface)
84 {
85 MOS_STATUS eStatus;
86 PMHW_SFC_INTERFACE pParamSfcInterface;
87 VPHAL_RENDER_CACHE_CNTL CacheCntl;
88
89 VPHAL_RENDER_CHK_NULL_RETURN(m_pRenderHal);
90
91 eStatus = MOS_STATUS_SUCCESS;
92
93 #if __VPHAL_SFC_SUPPORTED
94 pParamSfcInterface = pSfcInterface;
95 #else
96 // Disable SFC SKU as it is not supported in this build
97 MEDIA_WR_SKU(m_pRenderHal->pSkuTable, FtrSFCPipe, 0);
98 pParamSfcInterface = nullptr;
99 #endif
100
101 // Get the cache settings
102 MOS_ZeroMemory(&CacheCntl, sizeof(CacheCntl));
103
104 CacheCntl.bDnDi = true;
105 CacheCntl.bCompositing = true;
106 VPHAL_RENDERER_GET_CACHE_CNTL(this,
107 m_pOsInterface,
108 &m_pRenderHal->Platform,
109 m_pSkuTable,
110 &CacheCntl);
111
112 // Initialize Advanced Processing Interface
113 pRender[VPHAL_RENDER_ID_VEBOX] = MOS_New(
114 VPHAL_VEBOX_STATE_G9_BASE,
115 m_pOsInterface,
116 pVeboxInterface,
117 pParamSfcInterface,
118 m_pRenderHal,
119 &VeboxExecState[0],
120 &PerfData,
121 CacheCntl.DnDi,
122 &eStatus);
123 if (!pRender[VPHAL_RENDER_ID_VEBOX] ||
124 (eStatus != MOS_STATUS_SUCCESS))
125 {
126 eStatus = MOS_STATUS_NO_SPACE;
127 VPHAL_RENDER_ASSERTMESSAGE("Allocate Vebox Render Fail.");
128 return eStatus;
129 }
130
131 pRender[VPHAL_RENDER_ID_VEBOX2] = MOS_New(
132 VPHAL_VEBOX_STATE_G9_BASE,
133 m_pOsInterface,
134 pVeboxInterface,
135 pParamSfcInterface,
136 m_pRenderHal,
137 &VeboxExecState[1],
138 &PerfData,
139 CacheCntl.DnDi,
140 &eStatus);
141 if (!pRender[VPHAL_RENDER_ID_VEBOX2] ||
142 (eStatus != MOS_STATUS_SUCCESS))
143 {
144 eStatus = MOS_STATUS_NO_SPACE;
145 VPHAL_RENDER_ASSERTMESSAGE("Allocate Vebox Render Fail.");
146 return eStatus;
147 }
148
149 // Allocate Composite State
150 pRender[VPHAL_RENDER_ID_COMPOSITE] = MOS_New(
151 CompositeStateG9,
152 m_pOsInterface,
153 m_pRenderHal,
154 &PerfData,
155 CacheCntl.Composite,
156 &eStatus);
157 if (!pRender[VPHAL_RENDER_ID_COMPOSITE] ||
158 (eStatus != MOS_STATUS_SUCCESS))
159 {
160 eStatus = MOS_STATUS_NO_SPACE;
161 VPHAL_RENDER_ASSERTMESSAGE("Allocate Composite Render Fail.");
162 return eStatus;
163 }
164
165 if (MEDIA_IS_SKU(m_pRenderHal->pSkuTable, FtrHDR))
166 {
167 pHdrState = MOS_New(VPHAL_HDR_STATE);
168 if (pHdrState)
169 {
170 MOS_ZeroMemory(pHdrState, sizeof(VPHAL_HDR_STATE));
171 VpHal_HdrInitInterface(pHdrState, m_pRenderHal);
172 }
173 }
174
175 return eStatus;
176 }
177
InitKdllParam()178 MOS_STATUS VphalRendererG9::InitKdllParam()
179 {
180 MOS_STATUS eStatus = MOS_STATUS_SUCCESS;
181
182 #if defined(ENABLE_KERNELS) && !defined(_FULL_OPEN_SOURCE)
183 pKernelDllRules = g_KdllRuleTable_g9;
184 pcKernelBin = (const void*)IGVPKRN_G9;
185 dwKernelBinSize = IGVPKRN_G9_SIZE;
186 #endif
187
188 return eStatus;
189 }
190