| 1 | /* |
| 2 | * Copyright (c) 2012-2018, 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_g11.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_g11.h" |
| 28 | #include "vphal_render_vebox_g11_base.h" |
| 29 | #include "vphal_render_composite_g11.h" |
| 30 | |
| 31 | void VphalRendererG11::GetCacheCntl( |
| 32 | PMOS_INTERFACE pOsInterface, |
| 33 | PLATFORM *pPlatform, |
| 34 | MEDIA_FEATURE_TABLE *pSkuTable, |
| 35 | PVPHAL_RENDER_CACHE_CNTL pSettings) |
| 36 | |
| 37 | { |
| 38 | MOS_HW_RESOURCE_DEF Usage; |
| 39 | MEMORY_OBJECT_CONTROL_STATE MemObjCtrl; |
| 40 | |
| 41 | if (pSettings->bCompositing) |
| 42 | { |
| 43 | pSettings->Composite.bL3CachingEnabled = true; |
| 44 | |
| 45 | VPHAL_SET_SURF_MEMOBJCTL(pSettings->Composite.PrimaryInputSurfMemObjCtl, MOS_MP_RESOURCE_USAGE_AGE3_SurfaceState); |
| 46 | VPHAL_SET_SURF_MEMOBJCTL(pSettings->Composite.InputSurfMemObjCtl, MOS_MP_RESOURCE_USAGE_AGE3_SurfaceState); |
| 47 | VPHAL_SET_SURF_MEMOBJCTL(pSettings->Composite.TargetSurfMemObjCtl, MOS_MP_RESOURCE_USAGE_DEFAULT); |
| 48 | } |
| 49 | if (pSettings->bDnDi) |
| 50 | { |
| 51 | pSettings->DnDi.bL3CachingEnabled = true; |
| 52 | |
| 53 | VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.CurrentInputSurfMemObjCtl, MOS_MP_RESOURCE_USAGE_SurfaceState); |
| 54 | VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.PreviousInputSurfMemObjCtl, MOS_MP_RESOURCE_USAGE_SurfaceState); |
| 55 | VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.STMMInputSurfMemObjCtl, MOS_MP_RESOURCE_USAGE_SurfaceState); |
| 56 | VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.STMMOutputSurfMemObjCtl, MOS_MP_RESOURCE_USAGE_SurfaceState); |
| 57 | VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.DnOutSurfMemObjCtl, MOS_MP_RESOURCE_USAGE_SurfaceState); |
| 58 | VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.CurrentOutputSurfMemObjCtl, MOS_MP_RESOURCE_USAGE_SurfaceState); |
| 59 | VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.StatisticsOutputSurfMemObjCtl, MOS_MP_RESOURCE_USAGE_SurfaceState); |
| 60 | VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.AlphaOrVignetteSurfMemObjCtl, MOS_MP_RESOURCE_USAGE_SurfaceState); |
| 61 | VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.LaceOrAceOrRgbHistogramSurfCtrl, MOS_MP_RESOURCE_USAGE_SurfaceState); |
| 62 | VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.SkinScoreSurfMemObjCtl, MOS_MP_RESOURCE_USAGE_SurfaceState); |
| 63 | VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.LaceLookUpTablesSurfMemObjCtl, MOS_MP_RESOURCE_USAGE_SurfaceState); |
| 64 | VPHAL_SET_SURF_MEMOBJCTL(pSettings->DnDi.Vebox3DLookUpTablesSurfMemObjCtl, MOS_MP_RESOURCE_USAGE_SurfaceState); |
| 65 | } |
| 66 | if (pSettings->bLace) |
| 67 | { |
| 68 | VPHAL_SET_SURF_MEMOBJCTL(pSettings->Lace.FrameHistogramSurfaceMemObjCtl, MOS_MP_RESOURCE_USAGE_SurfaceState); |
| 69 | VPHAL_SET_SURF_MEMOBJCTL(pSettings->Lace.AggregatedHistogramSurfaceMemObjCtl, MOS_MP_RESOURCE_USAGE_SurfaceState); |
| 70 | VPHAL_SET_SURF_MEMOBJCTL(pSettings->Lace.StdStatisticsSurfaceMemObjCtl, MOS_MP_RESOURCE_USAGE_SurfaceState); |
| 71 | VPHAL_SET_SURF_MEMOBJCTL(pSettings->Lace.PwlfInSurfaceMemObjCtl, MOS_MP_RESOURCE_USAGE_SurfaceState); |
| 72 | VPHAL_SET_SURF_MEMOBJCTL(pSettings->Lace.PwlfOutSurfaceMemObjCtl, MOS_MP_RESOURCE_USAGE_SurfaceState); |
| 73 | VPHAL_SET_SURF_MEMOBJCTL(pSettings->Lace.WeitCoefSurfaceMemObjCtl, MOS_MP_RESOURCE_USAGE_SurfaceState); |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | MOS_STATUS VphalRendererG11::AllocateRenderComponents( |
| 78 | PMHW_VEBOX_INTERFACE pVeboxInterface, |
| 79 | PMHW_SFC_INTERFACE pSfcInterface) |
| 80 | { |
| 81 | MOS_STATUS eStatus; |
| 82 | VPHAL_RENDER_CACHE_CNTL CacheCntl; |
| 83 | |
| 84 | VPHAL_RENDER_CHK_NULL_RETURN(m_pRenderHal); |
| 85 | |
| 86 | eStatus = MOS_STATUS_SUCCESS; |
| 87 | |
| 88 | |
| 89 | // Get the cache settings |
| 90 | MOS_ZeroMemory(&CacheCntl, sizeof(CacheCntl)); |
| 91 | |
| 92 | CacheCntl.bDnDi = true; |
| 93 | CacheCntl.bCompositing = true; |
| 94 | CacheCntl.bLace = MEDIA_IS_SKU(m_pSkuTable, FtrLace); |
| 95 | VPHAL_RENDERER_GET_CACHE_CNTL(this, |
| 96 | m_pOsInterface, |
| 97 | &m_pRenderHal->Platform, |
| 98 | m_pSkuTable, |
| 99 | &CacheCntl); |
| 100 | |
| 101 | // Initialize Advanced Processing Interface |
| 102 | pRender[VPHAL_RENDER_ID_VEBOX] = MOS_New( |
| 103 | VPHAL_VEBOX_STATE_G11_BASE, |
| 104 | m_pOsInterface, |
| 105 | pVeboxInterface, |
| 106 | pSfcInterface, |
| 107 | m_pRenderHal, |
| 108 | &VeboxExecState[0], |
| 109 | &PerfData, |
| 110 | CacheCntl.DnDi, |
| 111 | &eStatus); |
| 112 | if (!pRender[VPHAL_RENDER_ID_VEBOX] || |
| 113 | (eStatus != MOS_STATUS_SUCCESS)) |
| 114 | { |
| 115 | eStatus = MOS_STATUS_NO_SPACE; |
| 116 | VPHAL_RENDER_ASSERTMESSAGE("Allocate Vebox Render Fail."); |
| 117 | return eStatus; |
| 118 | } |
| 119 | pRender[VPHAL_RENDER_ID_VEBOX2] = MOS_New( |
| 120 | VPHAL_VEBOX_STATE_G11_BASE, |
| 121 | m_pOsInterface, |
| 122 | pVeboxInterface, |
| 123 | pSfcInterface, |
| 124 | m_pRenderHal, |
| 125 | &VeboxExecState[1], |
| 126 | &PerfData, |
| 127 | CacheCntl.DnDi, |
| 128 | &eStatus); |
| 129 | |
| 130 | if (!pRender[VPHAL_RENDER_ID_VEBOX2] || |
| 131 | (eStatus != MOS_STATUS_SUCCESS)) |
| 132 | { |
| 133 | eStatus = MOS_STATUS_NO_SPACE; |
| 134 | VPHAL_RENDER_ASSERTMESSAGE("Allocate Vebox Render Fail."); |
| 135 | return eStatus; |
| 136 | } |
| 137 | |
| 138 | // Allocate Composite State |
| 139 | pRender[VPHAL_RENDER_ID_COMPOSITE] = MOS_New( |
| 140 | CompositeStateG11, |
| 141 | m_pOsInterface, |
| 142 | m_pRenderHal, |
| 143 | &PerfData, |
| 144 | CacheCntl.Composite, |
| 145 | &eStatus); |
| 146 | if (!pRender[VPHAL_RENDER_ID_COMPOSITE] || |
| 147 | (eStatus != MOS_STATUS_SUCCESS)) |
| 148 | { |
| 149 | eStatus = MOS_STATUS_NO_SPACE; |
| 150 | VPHAL_RENDER_ASSERTMESSAGE("Allocate Composite Render Fail."); |
| 151 | return eStatus; |
| 152 | } |
| 153 | |
| 154 | return eStatus; |
| 155 | } |
| 156 |