| 1 |
/* |
| 2 |
* Copyright (c) 2024, 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 |
//! |
| 24 |
//! \file mos_cache_manager.h |
| 25 |
//! \brief cache management, to be used across media components |
| 26 |
//! \details cache management, to be used across media components |
| 27 |
//! |
| 28 |
#ifndef __MOS_CACHE_MANAGER_H__ |
| 29 |
#define __MOS_CACHE_MANAGER_H__ |
| 30 |
|
| 31 |
#include "mos_defs.h" |
| 32 |
#include "mos_os_hw.h" |
| 33 |
|
| 34 |
enum ENGINE_TYPE |
| 35 |
{ |
| 36 |
RENDER_ENGINE = 0, |
| 37 |
SFC_ENGINE, |
| 38 |
VEBOX_ENGINE, |
| 39 |
VDBOX_ENGINE |
| 40 |
}; |
| 41 |
|
| 42 |
enum SURFACE_TYPE_BASE |
| 43 |
{ |
| 44 |
VEBOX_HEAP = 0, |
| 45 |
ISH_HEAP, |
| 46 |
GSH_HEAP, |
| 47 |
HEAP_MAX |
| 48 |
}; |
| 49 |
|
| 50 |
enum CACHE_COMPONENTS |
| 51 |
{ |
| 52 |
CACHE_COMPONENT_COMMON = 0, |
| 53 |
CACHE_COMPONENT_VP, |
| 54 |
MAX_CACHE_COMPONENTS |
| 55 |
}; |
| 56 |
|
| 57 |
struct MOS_CACHE_ELEMENT |
| 58 |
{ |
| 59 |
MOS_HW_RESOURCE_DEF mocsUsageType; |
| 60 |
MOS_HW_RESOURCE_DEF patIndex; |
| 61 |
MOS_CACHE_ELEMENT(MOS_HW_RESOURCE_DEF _mocsUsageType, MOS_HW_RESOURCE_DEF _patIndex) : |
| 62 |
mocsUsageType(_mocsUsageType), patIndex(_patIndex) |
| 63 |
{ |
| 64 |
} |
| 65 |
}; |
| 66 |
|
| 67 |
struct MOS_CACHE_OBJECT |
| 68 |
{ |
| 69 |
uint64_t value; |
| 70 |
MOS_CACHE_OBJECT(MOS_COMPONENT _componentId, uint32_t _surfaceType, bool _isHeap, bool _isOutput, ENGINE_TYPE _engineType) : |
| 71 |
value( (static_cast<uint64_t>(_componentId) << 60) | (static_cast<uint64_t>(_surfaceType + !_isHeap * HEAP_MAX ) << 28) | \ |
| 72 |
(static_cast<uint64_t>(_isOutput) << 27) | (static_cast<uint64_t>(_engineType) << 23)) |
| 73 |
{ |
| 74 |
} |
| 75 |
} ; |
| 76 |
|
| 77 |
bool RegisterCacheSettings(CACHE_COMPONENTS id, std::map<uint64_t, MOS_CACHE_ELEMENT> *cacheTablesPtr); |
| 78 |
|
| 79 |
bool LoadCacheSettings(MOS_COMPONENT id, uint32_t feature, bool bOut, ENGINE_TYPE engineType, MOS_CACHE_ELEMENT &element, bool isHeapSurf); |
| 80 |
|
| 81 |
#endif |