| 1 |
/* |
| 2 |
* Copyright (c) 2018-2020, 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 mos_auxtable_mgr.h |
| 24 |
//! \brief Container class for GMM aux table manager wrapper |
| 25 |
//! |
| 26 |
|
| 27 |
#ifndef MOS_AUXTABLE_MGR_H |
| 28 |
#define MOS_AUXTABLE_MGR_H |
| 29 |
|
| 30 |
#include "mos_bufmgr_api.h" |
| 31 |
#include "mos_os.h" |
| 32 |
|
| 33 |
//! |
| 34 |
//! \class AuxTableMgr |
| 35 |
//! \brief Aux Table Manager |
| 36 |
//! |
| 37 |
class AuxTableMgr |
| 38 |
{ |
| 39 |
public: |
| 40 |
//! |
| 41 |
//! \brief Constructor |
| 42 |
//! |
| 43 |
AuxTableMgr(MOS_BUFMGR *bufMgr, GMM_CLIENT_CONTEXT *gmmClientContext); |
| 44 |
|
| 45 |
//! |
| 46 |
//! \brief Destructor |
| 47 |
//! |
| 48 |
virtual ~AuxTableMgr(); |
| 49 |
|
| 50 |
//! |
| 51 |
//! \brief Create AuxTableMgr object |
| 52 |
//! \details Map GMM resource into aux table if needed and also mark it in bo. |
| 53 |
//! \param [in] bufMgr |
| 54 |
//! MOS_BUFMGR pointer |
| 55 |
//! \param [in] sku |
| 56 |
//! Sku table pointer |
| 57 |
//! \param [in] wa |
| 58 |
//! WA table pointer |
| 59 |
//! \return Object pointer to AuxTableMgr |
| 60 |
//! Return object pointer if success or return nullptr if failed |
| 61 |
//! |
| 62 |
static AuxTableMgr * CreateAuxTableMgr(MOS_BUFMGR *bufMgr, MEDIA_FEATURE_TABLE *sku, GMM_CLIENT_CONTEXT *gmmClientContext); |
| 63 |
|
| 64 |
//! |
| 65 |
//! \brief Map resource to aux table |
| 66 |
//! \details Map GMM resource into aux table if needed and also mark it in bo. |
| 67 |
//! \param [in] gmmResInfo |
| 68 |
//! GMM_RESOURCE_INFO pointer |
| 69 |
//! \param [in] bo |
| 70 |
//! MOS_LINUX_BO pointer |
| 71 |
//! \return MOS_STATUS |
| 72 |
//! Return MOS_STATUS_SUCCESS if successful, otherwise failed |
| 73 |
//! |
| 74 |
MOS_STATUS MapResource(GMM_RESOURCE_INFO *gmmResInfo, MOS_LINUX_BO *bo); |
| 75 |
|
| 76 |
//! |
| 77 |
//! \brief Unmap resource from aux table |
| 78 |
//! \details Unmap resource from aux table if it was mapped and unmark it in bo. |
| 79 |
//! \param [in] gmmResInfo |
| 80 |
//! GMM_RESOURCE_INFO pointer |
| 81 |
//! \param [in] bo |
| 82 |
//! MOS_LINUX_BO pointer |
| 83 |
//! \return MOS_STATUS |
| 84 |
//! Return MOS_STATUS_SUCCESS if successful, otherwise failed |
| 85 |
//! |
| 86 |
MOS_STATUS UnmapResource(GMM_RESOURCE_INFO *gmmResInfo, MOS_LINUX_BO *bo); |
| 87 |
|
| 88 |
//! |
| 89 |
//! \brief Insert aux table BOs into specific execute buffer |
| 90 |
//! \details Retrieve all BOs allocated for aux table and attach them to execute buffer |
| 91 |
//! so that they are pinned before h/w access it. |
| 92 |
//! \param [out] cmd_bo |
| 93 |
//! execute buffer bo to be attached |
| 94 |
//! \return MOS_STATUS |
| 95 |
//! Return MOS_STATUS_SUCCESS if successful, otherwise failed |
| 96 |
//! |
| 97 |
MOS_STATUS EmitAuxTableBOList(MOS_LINUX_BO *cmd_bo); |
| 98 |
|
| 99 |
//! |
| 100 |
//! \brief Get aux table base address |
| 101 |
//! \details Get current root aux table base address |
| 102 |
//! \return MOS_STATUS |
| 103 |
//! Return MOS_STATUS_SUCCESS if successful, otherwise failed |
| 104 |
//! |
| 105 |
uint64_t GetAuxTableBase(); |
| 106 |
|
| 107 |
private: |
| 108 |
GMM_CLIENT_CONTEXT *m_gmmClientContext = nullptr; //!< GMM Client Context for GMM Page table manager |
| 109 |
void *m_gmmPageTableMgr = nullptr; //!< The GMM Page Table Manager |
| 110 |
MEDIA_CLASS_DEFINE_END(AuxTableMgr) |
| 111 |
}; |
| 112 |
|
| 113 |
#endif //MOS_AUXTABLE_MGR_H |