| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
#pragma once |
| 27 |
|
| 28 |
#include "cm_def.h" |
| 29 |
#include "cm_surface_manager.h" |
| 30 |
#include "frame_tracker.h" |
| 31 |
|
| 32 |
namespace CMRT_UMD |
| 33 |
{ |
| 34 |
|
| 35 |
class CmSurfaceManager; |
| 36 |
class CmEventRT; |
| 37 |
class CSync; |
| 38 |
|
| 39 |
class CmSurface |
| 40 |
{ |
| 41 |
public: |
| 42 |
static int32_t Destroy( CmSurface* &surface ); |
| 43 |
bool IsCmCreated( void ){ return m_isCmCreated; } |
| 44 |
virtual CM_ENUM_CLASS_TYPE Type() const = 0; |
| 45 |
int32_t TouchDeviceQueue(); |
| 46 |
virtual int32_t WaitForReferenceFree(); |
| 47 |
int32_t SetMemoryObjectControl(MEMORY_OBJECT_CONTROL memCtrl, MEMORY_TYPE memType, uint32_t age); |
| 48 |
int32_t SetResourceUsage(MOS_HW_RESOURCE_DEF mosUsage); |
| 49 |
|
| 50 |
std::string GetFormatString(CM_SURFACE_FORMAT format); |
| 51 |
virtual void DumpContent(uint32_t kernelNumber, char *kernelName, int32_t taskId, uint32_t argIndex, uint32_t vectorIndex) { return; } |
| 52 |
virtual void Log(std::ostringstream &oss) { return; } |
| 53 |
inline void SetRenderTracker(uint32_t index, uint32_t tracker) {m_lastRenderTracker.Merge(index, tracker); } |
| 54 |
inline void SetFastTracker(uint32_t index, uint32_t tracker) {m_lastFastTracker.Merge(index, tracker); } |
| 55 |
inline void SetVeboxTracker(uint32_t tracker) {m_lastVeboxTracker = tracker; } |
| 56 |
inline void DelayDestroy() { m_released = true; } |
| 57 |
inline bool IsDelayDestroyed() {return m_released; } |
| 58 |
inline bool AllReferenceCompleted() { |
| 59 |
|
| 60 |
return (m_lastRenderTracker.IsExpired()) |
| 61 |
|
| 62 |
&& (m_lastFastTracker.IsExpired()) |
| 63 |
|
| 64 |
&& (m_lastVeboxTracker == 0 || ((int)(m_lastVeboxTracker - m_surfaceMgr->LatestVeboxTracker()) <= 0)); |
| 65 |
} |
| 66 |
inline bool CanBeDestroyed() { |
| 67 |
return m_released && AllReferenceCompleted(); |
| 68 |
} |
| 69 |
|
| 70 |
inline CmSurface*& DelayDestroyPrev() {return m_delayDestroyPrev; } |
| 71 |
inline CmSurface*& DelayDestroyNext() {return m_delayDestroyNext; } |
| 72 |
|
| 73 |
inline uint8_t GetPropertyIndex() {return m_propertyIndex; } |
| 74 |
|
| 75 |
protected: |
| 76 |
CmSurface( CmSurfaceManager* surfMgr , bool isCmCreated ); |
| 77 |
virtual ~CmSurface( void ); |
| 78 |
int32_t Initialize( uint32_t index ); |
| 79 |
|
| 80 |
int32_t FlushDeviceQueue( CmEventRT* event ); |
| 81 |
bool MemoryObjectCtrlPolicyCheck(MEMORY_OBJECT_CONTROL memCtrl); |
| 82 |
|
| 83 |
#if MDF_SURFACE_CONTENT_DUMP |
| 84 |
MOS_CONTEXT* GetMosContext(); |
| 85 |
#endif |
| 86 |
|
| 87 |
SurfaceIndex* m_index; |
| 88 |
|
| 89 |
CmSurfaceManager* m_surfaceMgr; |
| 90 |
|
| 91 |
bool m_isCmCreated; |
| 92 |
|
| 93 |
CM_SURFACE_MEM_OBJ_CTRL m_memObjCtrl; |
| 94 |
|
| 95 |
FrameTrackerToken m_lastRenderTracker; |
| 96 |
|
| 97 |
FrameTrackerToken m_lastFastTracker; |
| 98 |
|
| 99 |
uint32_t m_lastVeboxTracker; |
| 100 |
|
| 101 |
bool m_released; |
| 102 |
|
| 103 |
CmSurface *m_delayDestroyPrev; |
| 104 |
|
| 105 |
CmSurface *m_delayDestroyNext; |
| 106 |
|
| 107 |
uint8_t m_propertyIndex; |
| 108 |
|
| 109 |
private: |
| 110 |
CmSurface (const CmSurface& other); |
| 111 |
CmSurface& operator= (const CmSurface& other); |
| 112 |
}; |
| 113 |
}; |