| 1 |
/* |
| 2 |
* Copyright (c) 2019-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 hal_oca_interface.cpp |
| 24 |
//! \brief Implementation of functions for Hal OCA Interface |
| 25 |
//! \details Implementation of functions for Hal OCA Interface |
| 26 |
//! |
| 27 |
|
| 28 |
#include "stdint.h" |
| 29 |
#include "mos_os.h" |
| 30 |
#include "hal_oca_interface.h" |
| 31 |
#include "mhw_mmio.h" |
| 32 |
#include "mos_interface.h" |
| 33 |
#include "mos_oca_interface_specific.h" |
| 34 |
#include "vphal.h" |
| 35 |
#include "vphal_debug.h" |
| 36 |
|
| 37 |
|
| 38 |
/****************************************************************************************************/ |
| 39 |
/* HalOcaInterface */ |
| 40 |
/****************************************************************************************************/ |
| 41 |
MOS_STATUS HalOcaInterface::MhwMiLoadRegisterImmCmd( |
| 42 |
MhwMiInterface *pMiInterface, |
| 43 |
PMOS_COMMAND_BUFFER pCmdBuffer, |
| 44 |
MHW_MI_LOAD_REGISTER_IMM_PARAMS *params) |
| 45 |
{ |
| 46 |
return MOS_STATUS_SUCCESS; |
| 47 |
} |
| 48 |
|
| 49 |
//! |
| 50 |
//! \brief Oca operation which should be called at the beginning of 1st level batch buffer start. |
| 51 |
//! \param [in/out] cmdBuffer |
| 52 |
//! Command buffer for current BB. hOcaBuf in cmdBuffer will be updated. |
| 53 |
//! \param [in] mosContext |
| 54 |
//! Reference to MOS_CONTEXT. |
| 55 |
//! \param [in] gpuContextHandle |
| 56 |
//! Gpu context handle |
| 57 |
//! \param [in] mhwMiInterface |
| 58 |
//! Reference to MhwMiInterface. |
| 59 |
//! \param [in] mmioRegisters |
| 60 |
//! mmio registers for current engine. |
| 61 |
//! \param [in] offsetOf1stLevelBB |
| 62 |
//! Offset for current BB in cmdBuffer. |
| 63 |
//! \param [in] bUseSizeOfCmdBuf |
| 64 |
//! If true, use size of cmdBuffer for batch buffer, else use sizeOf1stLevelBB. |
| 65 |
//! \param [in] sizeOf1stLevelBB |
| 66 |
//! Size of BB. Ignore if bUseSizeOfResource == true. |
| 67 |
//! \return void |
| 68 |
//! No return value. Handle all exception inside the function. |
| 69 |
//! |
| 70 |
void HalOcaInterface::On1stLevelBBStart(MOS_COMMAND_BUFFER &cmdBuffer, MOS_CONTEXT &mosContext, |
| 71 |
uint32_t gpuContextHandle, MhwMiInterface &mhwMiInterface, MHW_MI_MMIOREGISTERS &mmioRegisters, |
| 72 |
uint32_t offsetOf1stLevelBB, bool bUseSizeOfCmdBuf, uint32_t sizeOf1stLevelBB) |
| 73 |
{ |
| 74 |
HalOcaInterfaceNext::On1stLevelBBStart(cmdBuffer, mosContext, gpuContextHandle); |
| 75 |
} |
| 76 |
|
| 77 |
//! |
| 78 |
//! \brief Oca operation which should be called at the beginning of 1st level batch buffer start. |
| 79 |
//! \param [in/out] cmdBuffer |
| 80 |
//! Command buffer for current BB. hOcaBuf in cmdBuffer will be updated. |
| 81 |
//! \param [in] mosContext |
| 82 |
//! Reference to MOS_CONTEXT. |
| 83 |
//! \param [in] gpuContextHandle |
| 84 |
//! Gpu context handle |
| 85 |
//! \param [in] mhwMiInterface |
| 86 |
//! Reference to MhwMiInterface. |
| 87 |
//! \param [in] mmioRegisters |
| 88 |
//! mmio registers for current engine. |
| 89 |
//! \param [in] offsetOf1stLevelBB |
| 90 |
//! Offset for current BB in cmdBuffer. |
| 91 |
//! \param [in] bUseSizeOfCmdBuf |
| 92 |
//! If true, use size of cmdBuffer for batch buffer, else use sizeOf1stLevelBB. |
| 93 |
//! \param [in] sizeOf1stLevelBB |
| 94 |
//! Size of BB. Ignore if bUseSizeOfResource == true. |
| 95 |
//! \return void |
| 96 |
//! No return value. Handle all exception inside the function. |
| 97 |
//! |
| 98 |
void HalOcaInterface::On1stLevelBBStart(MOS_COMMAND_BUFFER& cmdBuffer, MOS_CONTEXT& mosContext, |
| 99 |
uint32_t gpuContextHandle, MhwMiInterface& mhwMiInterface, MmioRegistersMfx& mmioRegisters, |
| 100 |
uint32_t offsetOf1stLevelBB, bool bUseSizeOfCmdBuf, uint32_t sizeOf1stLevelBB) |
| 101 |
{ |
| 102 |
HalOcaInterfaceNext::On1stLevelBBStart(cmdBuffer, mosContext, gpuContextHandle); |
| 103 |
} |
| 104 |
|
| 105 |
//! |
| 106 |
//! \brief Oca operation which should be called before adding dispatch states, |
| 107 |
//! e.g. VEB_DI_IECP_STATE and MEDIA_OBJECT_WALKER. |
| 108 |
//! \param [in] cmdBuffer |
| 109 |
//! Command buffer for current BB. |
| 110 |
//! \param [in] mosContext |
| 111 |
//! Reference to MOS_CONTEXT. |
| 112 |
//! \param [in] mhwMiInterface |
| 113 |
//! Reference to MhwMiInterface. |
| 114 |
//! \param [in] mmioRegisters |
| 115 |
//! mmio registers for current engine. |
| 116 |
//! \return void |
| 117 |
//! No return value. Handle all exception inside the function. |
| 118 |
//! |
| 119 |
void HalOcaInterface::OnDispatch(MOS_COMMAND_BUFFER &_cmdBuffer, MOS_INTERFACE &osInterface, MhwMiInterface &mhwMiInterface, MHW_MI_MMIOREGISTERS &mmioRegisters) |
| 120 |
{ |
| 121 |
MOS_CONTEXT &mosContext = *osInterface.pOsContext; |
| 122 |
AddRTLogReource(_cmdBuffer, (MOS_CONTEXT_HANDLE)&mosContext, osInterface); |
| 123 |
} |
| 124 |
|
| 125 |
|
| 126 |
/****************************************************************************************************/ |
| 127 |
/* Private functions to ensure class singleton. */ |
| 128 |
/****************************************************************************************************/ |
| 129 |
HalOcaInterface::HalOcaInterface() |
| 130 |
{ |
| 131 |
} |
| 132 |
|
| 133 |
HalOcaInterface::HalOcaInterface(HalOcaInterface &) |
| 134 |
{ |
| 135 |
} |
| 136 |
|
| 137 |
HalOcaInterface& HalOcaInterface::operator= (HalOcaInterface &) |
| 138 |
{ |
| 139 |
return *this; |
| 140 |
} |