• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2 * Copyright (c) 2021, 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_g12_tgllp.cpp
24 //! \brief    Vphal Interface Definition
25 //! \details  Vphal Interface Definition Including:
26 //!           const and function
27 //!
28 #include "vphal_g12_tgllp.h"
29 #include "vphal_renderer_g12_tgllp.h"
30 
Allocate(const VphalSettings * pVpHalSettings)31 MOS_STATUS VphalStateG12Tgllp::Allocate(
32     const VphalSettings *pVpHalSettings)
33 {
34     MOS_STATUS eStatus = MOS_STATUS_SUCCESS;
35 
36     VPHAL_PUBLIC_CHK_NULL(pVpHalSettings);
37     VPHAL_PUBLIC_CHK_NULL(m_renderHal);
38 
39     // Update MOCS
40     if (m_renderHal->pOsInterface && m_renderHal->pOsInterface->pfnCachePolicyGetMemoryObject && m_renderHal->pOsInterface->pfnGetGmmClientContext)
41     {
42         MHW_STATE_BASE_ADDR_PARAMS *pStateBaseParams = &m_renderHal->StateBaseAddressParams;
43         MEMORY_OBJECT_CONTROL_STATE StateMocs        = m_renderHal->pOsInterface->pfnCachePolicyGetMemoryObject(MOS_MP_RESOURCE_USAGE_DEFAULT,
44             m_renderHal->pOsInterface->pfnGetGmmClientContext(m_renderHal->pOsInterface));
45 
46         //update MOCS for Instruction Cache
47         pStateBaseParams->mocs4InstructionCache = StateMocs.DwordValue;
48         //update MOCS for General state
49         pStateBaseParams->mocs4GeneralState = StateMocs.DwordValue;
50         //update MOCS for Dynamic state
51         pStateBaseParams->mocs4DynamicState = StateMocs.DwordValue;
52         //update MOCS for Surface state
53         pStateBaseParams->mocs4SurfaceState = StateMocs.DwordValue;
54         //update MOCS for Indirect Object
55         pStateBaseParams->mocs4IndirectObjectBuffer = StateMocs.DwordValue;
56         //update MOCS for Stateless Dataport access
57         pStateBaseParams->mocs4StatelessDataport = StateMocs.DwordValue;
58     }
59 
60     eStatus = VphalState::Allocate(pVpHalSettings);
61 
62 finish:
63     return eStatus;
64 }
65 
66 //!
67 //! \brief    Create instance of VphalRenderer
68 //! \details  Create instance of VphalRenderer
69 //! \return   MOS_STATUS
70 //!           Return MOS_STATUS_SUCCESS if successful, otherwise failed
71 //!
CreateRenderer()72 MOS_STATUS VphalStateG12Tgllp::CreateRenderer()
73 {
74     MOS_STATUS eStatus = MOS_STATUS_UNKNOWN;
75 
76     // Setup rendering interface functions
77     m_renderer = MOS_New(
78         VphalRendererG12Tgllp,
79         m_renderHal,
80         &eStatus);
81 
82     if (m_renderer == nullptr)
83     {
84         return MOS_STATUS_NULL_POINTER;
85     }
86     else
87     {
88         if (eStatus != MOS_STATUS_SUCCESS)
89         {
90             MOS_Delete(m_renderer);
91             m_renderer = nullptr;
92             return eStatus;
93         }
94         else
95         {
96             m_renderer->SetStatusReportTable(&m_statusTable);
97         }
98     }
99 
100     eStatus = m_renderer->InitKdllParam();
101     if (eStatus != MOS_STATUS_SUCCESS)
102     {
103         MOS_Delete(m_renderer);
104         m_renderer = nullptr;
105         return eStatus;
106     }
107 
108     eStatus = m_renderer->AllocateRenderComponents(
109                                 m_veboxInterface,
110                                 m_sfcInterface);
111 
112     return eStatus;
113 }
114