Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CM] Strict indication const and static in methods #1874

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions media_driver/agnostic/common/cm/cm_array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ CmDynamicArray::~CmDynamicArray( void )

\*****************************************************************************/

void* CmDynamicArray::GetElement( const uint32_t index )
void* CmDynamicArray::GetElement( const uint32_t index ) const
{
void* element;

Expand Down Expand Up @@ -180,7 +180,7 @@ bool CmDynamicArray::SetElement( const uint32_t index, const void* element )

\*****************************************************************************/

uint32_t CmDynamicArray::GetSize( void )
uint32_t CmDynamicArray::GetSize( void ) const
{
const uint32_t size = m_usedSize;
return size;
Expand Down Expand Up @@ -357,7 +357,7 @@ void CmDynamicArray::DeleteArray( void )
uint32_t length

\*****************************************************************************/
uint32_t CmDynamicArray::GetMaxSize( void )
uint32_t CmDynamicArray::GetMaxSize( void ) const
{
return m_actualSize;
}
Expand All @@ -378,7 +378,7 @@ uint32_t CmDynamicArray::GetMaxSize( void )

\*****************************************************************************/

bool CmDynamicArray::IsValidIndex( const uint32_t index )
bool CmDynamicArray::IsValidIndex( const uint32_t index ) const
{
return ( index < GetSize() );
}
Expand Down
8 changes: 4 additions & 4 deletions media_driver/agnostic/common/cm/cm_array.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ class CmDynamicArray
CmDynamicArray();
~CmDynamicArray( void );

void* GetElement( const uint32_t index ) ;
void* GetElement( const uint32_t index ) const;
bool SetElement( const uint32_t index, const void* element );

uint32_t GetSize( void ) ;
uint32_t GetMaxSize( void ) ;
uint32_t GetSize( void ) const;
uint32_t GetMaxSize( void ) const;

void Delete( void );

Expand All @@ -56,7 +56,7 @@ class CmDynamicArray
void CreateArray( const uint32_t size );
void DeleteArray( void );

bool IsValidIndex( const uint32_t index ) ;
bool IsValidIndex( const uint32_t index ) const;

void** m_arrayBuffer;

Expand Down
10 changes: 5 additions & 5 deletions media_driver/agnostic/common/cm/cm_buffer_rt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,12 +551,12 @@ void CmBuffer_RT::SetSize( size_t size )
m_size = size;
}

bool CmBuffer_RT::IsUpSurface()
bool CmBuffer_RT::IsUpSurface() const
{
return (m_bufferType == CM_BUFFER_UP);
}

bool CmBuffer_RT::IsSVMSurface()
bool CmBuffer_RT::IsSVMSurface() const
{
return (m_bufferType == CM_BUFFER_SVM);
}
Expand All @@ -573,17 +573,17 @@ bool CmBuffer_RT::IsCMRTAllocatedSVMBuffer()
return m_isCMRTAllocatedSVMBuffer;
}

bool CmBuffer_RT::IsConditionalSurface()
bool CmBuffer_RT::IsConditionalSurface() const
{
return m_isConditionalBuffer;
}

uint32_t CmBuffer_RT::GetConditionalCompareValue()
uint32_t CmBuffer_RT::GetConditionalCompareValue() const
{
return m_comparisonValue;
}

bool CmBuffer_RT::IsCompareMaskEnabled()
bool CmBuffer_RT::IsCompareMaskEnabled() const
{
return m_enableCompareMask;
}
Expand Down
10 changes: 5 additions & 5 deletions media_driver/agnostic/common/cm/cm_buffer_rt.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,17 @@ class CmBuffer_RT: public CmBuffer,

void SetSize(size_t size);

bool IsUpSurface();
bool IsUpSurface() const;

bool IsSVMSurface();
bool IsSVMSurface() const;

virtual bool IsCMRTAllocatedSVMBuffer();

bool IsConditionalSurface();
bool IsConditionalSurface() const;

uint32_t GetConditionalCompareValue();
uint32_t GetConditionalCompareValue() const;

bool IsCompareMaskEnabled();
bool IsCompareMaskEnabled() const;

uint32_t GetBufferType() { return m_bufferType; }

Expand Down
2 changes: 1 addition & 1 deletion media_driver/agnostic/common/cm/cm_dsh.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class CmDSH
MOS_STATUS Initialize(FrameTrackerProducer *trackerProducer);

CmMediaState* CreateMediaState();
void DestroyMediaState(CmMediaState *mediaState);
static void DestroyMediaState(CmMediaState *mediaState);

protected:
HeapManager *m_heapMgr;
Expand Down
10 changes: 5 additions & 5 deletions media_driver/agnostic/common/cm/cm_event_rt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ int32_t CmEventRT::ModifyStatus(CM_STATUS status, uint64_t elapsedTime)
return CM_SUCCESS;
}

int32_t CmEventRT::GetQueue(CmQueueRT *& queue)
int32_t CmEventRT::GetQueue(CmQueueRT *& queue) const
{
queue = m_queue;
return CM_SUCCESS;
Expand Down Expand Up @@ -331,7 +331,7 @@ int32_t CmEventRT::GetHWStartTime(LARGE_INTEGER* time)

}

uint32_t CmEventRT::GetKernelCount()
uint32_t CmEventRT::GetKernelCount() const
{
return m_kernelCount;
}
Expand Down Expand Up @@ -466,7 +466,7 @@ int32_t CmEventRT::SetCompleteTime( LARGE_INTEGER time )
return CM_SUCCESS;
}

int32_t CmEventRT::GetIndex( uint32_t & index )
int32_t CmEventRT::GetIndex( uint32_t & index ) const
{
index = m_index;
return CM_SUCCESS;
Expand Down Expand Up @@ -513,7 +513,7 @@ int32_t CmEventRT::SetTaskOsData( void *data )
//| Purpose: Get Task ID
//| Returns: Result of the operation.
//*-----------------------------------------------------------------------------
int32_t CmEventRT::GetTaskDriverId( int32_t & id )
int32_t CmEventRT::GetTaskDriverId( int32_t & id ) const
{
id = m_taskDriverId;
return CM_SUCCESS;
Expand Down Expand Up @@ -595,7 +595,7 @@ int32_t CmEventRT::Query( void )
//| Purpose: Get m_status.
//| Returns: return m_status.
//*-----------------------------------------------------------------------------
CM_STATUS CmEventRT::GetStatusWithoutFlush()
CM_STATUS CmEventRT::GetStatusWithoutFlush() const
{
return m_status;
}
Expand Down
10 changes: 5 additions & 5 deletions media_driver/agnostic/common/cm/cm_event_rt.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ class CmEventRT: public CmEvent

CM_RT_API int32_t GetExecutionTickTime(uint64_t &ticks);

int32_t GetIndex(uint32_t &index);
int32_t GetIndex(uint32_t &index) const;

int32_t SetTaskDriverId(int32_t id);

int32_t GetTaskDriverId(int32_t &id);
int32_t GetTaskDriverId(int32_t &id) const;

int32_t SetTaskOsData(void *data);

Expand All @@ -109,7 +109,7 @@ class CmEventRT: public CmEvent

int32_t GetCompleteTime(LARGE_INTEGER *time);

uint32_t GetKernelCount();
uint32_t GetKernelCount() const;

int32_t GetEnqueueTime(LARGE_INTEGER *time);

Expand All @@ -119,11 +119,11 @@ class CmEventRT: public CmEvent

int32_t ModifyStatus(CM_STATUS status, uint64_t elapsedTime);

int32_t GetQueue(CmQueueRT *&queue);
int32_t GetQueue(CmQueueRT *&queue) const;

int32_t Query();

CM_STATUS GetStatusWithoutFlush();
CM_STATUS GetStatusWithoutFlush() const;

#if CM_LOG_ON
std::string Log(const char *callerFuncName);
Expand Down
2 changes: 1 addition & 1 deletion media_driver/agnostic/common/cm/cm_group_space.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ uint32_t CmThreadGroupSpace::GetIndexInTGsArray( void )
}

#if CM_LOG_ON
std::string CmThreadGroupSpace::Log()
std::string CmThreadGroupSpace::Log() const
{
std::ostringstream oss;

Expand Down
4 changes: 2 additions & 2 deletions media_driver/agnostic/common/cm/cm_group_space.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ class CmThreadGroupSpace
virtual uint32_t GetIndexInTGsArray();

#if CM_LOG_ON
std::string Log();
std::string Log() const;
#endif

protected:
CmThreadGroupSpace(CmDeviceRT* device, uint32_t index, uint32_t threadSpaceWidth, uint32_t threadSpaceHeight, uint32_t groupSpaceWidth, uint32_t groupSpaceHeight);
CmThreadGroupSpace(CmDeviceRT* device, uint32_t index, uint32_t threadSpaceWidth, uint32_t threadSpaceHeight, uint32_t threadSpaceDepth, uint32_t groupSpaceWidth, uint32_t groupSpaceHeight, uint32_t groupSpaceDepth);
~CmThreadGroupSpace( void );
int32_t Initialize( void );
static int32_t Initialize( void );

CmDeviceRT* m_device;
uint32_t m_threadSpaceWidth;
Expand Down
2 changes: 1 addition & 1 deletion media_driver/agnostic/common/cm/cm_hal_hashtable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ MOS_STATUS CmHashTable::Init()
return eStatus;
}

void CmHashTable::Free()
void CmHashTable::Free() const
{
if (m_hashTable.pHashEntries) MOS_FreeMemory(m_hashTable.pHashEntries);
}
Expand Down
4 changes: 2 additions & 2 deletions media_driver/agnostic/common/cm/cm_hal_hashtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ class CmHashTable
{
public:
MOS_STATUS Init();
void Free();
void Free() const;
MOS_STATUS Register(int32_t UniqID, int32_t CacheID, void *pData);
void* Search(int32_t UniqID, int32_t CacheID, uint16_t &wSearchIndex);
void* Unregister(int32_t UniqID, int32_t CacheID);

private:
uint16_t SimpleHash(int32_t value);
static uint16_t SimpleHash(int32_t value);
MOS_STATUS Extend();
CM_HAL_COALESCED_HASH_TABLE m_hashTable;
};
Expand Down
8 changes: 4 additions & 4 deletions media_driver/agnostic/common/cm/cm_kernel_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ int32_t CmKernelData::Initialize( void )
//| Purpose: Get Kernel Data pointer
//| Returns: Result of the operation.
//*-----------------------------------------------------------------------------
int32_t CmKernelData::GetCmKernel( CmKernelRT*& kernel )
int32_t CmKernelData::GetCmKernel( CmKernelRT*& kernel ) const
{
kernel = m_kernel;
return CM_SUCCESS;
Expand All @@ -162,7 +162,7 @@ int32_t CmKernelData::SetKernelDataSize(int32_t value)
//| Purpose: Get Kernel Data pointer
//| Returns: Result of the operation.
//*-----------------------------------------------------------------------------
int32_t CmKernelData::GetKernelDataSize()
int32_t CmKernelData::GetKernelDataSize() const
{
return m_kerneldatasize;
}
Expand Down Expand Up @@ -212,7 +212,7 @@ PCM_HAL_KERNEL_PARAM CmKernelData::GetHalCmKernelData( )
//| Purpose: Whether the kernel data is in use
//| Returns: Result of the operation.
//*-----------------------------------------------------------------------------
bool CmKernelData::IsInUse()
bool CmKernelData::IsInUse() const
{
return m_isInUse;
}
Expand All @@ -221,7 +221,7 @@ bool CmKernelData::IsInUse()
//| Purpose: Get Curbe Size from kernel data
//| Returns: Result of the operation.
//*-----------------------------------------------------------------------------
uint32_t CmKernelData::GetKernelCurbeSize( void )
uint32_t CmKernelData::GetKernelCurbeSize( void ) const
{
return m_halKernelParam.totalCurbeSize;
}
Expand Down
10 changes: 5 additions & 5 deletions media_driver/agnostic/common/cm/cm_kernel_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,23 @@ class CmKernelData : public CmDynamicArray
static int32_t Create( CmKernelRT* kernel, CmKernelData*& kernelData );
static int32_t Destroy( CmKernelData* &kernelData );

int32_t GetCmKernel( CmKernelRT*& kernel );
int32_t GetCmKernel( CmKernelRT*& kernel ) const;
int32_t SetKernelDataSize(int32_t value);
int32_t GetKernelDataSize();
int32_t GetKernelDataSize() const;
uint32_t Acquire(void);
uint32_t SafeRelease(void);

virtual PCM_HAL_KERNEL_PARAM GetHalCmKernelData( );
bool IsInUse( void );
uint32_t GetKernelCurbeSize( void );
bool IsInUse( void ) const;
uint32_t GetKernelCurbeSize( void ) const;
int32_t ResetStatus( void );

protected:

CmKernelData( CmKernelRT* kernel );
~CmKernelData( void );

int32_t Initialize( void );
static int32_t Initialize( void );

uint32_t m_kerneldatasize;
CmKernelRT* m_kernel;
Expand Down
2 changes: 1 addition & 1 deletion media_driver/agnostic/common/cm/cm_kernel_ex.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class CmKernelEx : public CMRT_UMD::CmKernelRT

bool IsSurface(uint16_t kind);

CM_ARG_KIND ToArgKind(CMRT_UMD::CmSurface *surface);
static CM_ARG_KIND ToArgKind(CMRT_UMD::CmSurface *surface);

inline bool ArgArraySupported(uint16_t kind) {return IsSurface(kind) || kind == ARG_KIND_SAMPLER; }

Expand Down
16 changes: 8 additions & 8 deletions media_driver/agnostic/common/cm/cm_kernel_rt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -911,13 +911,13 @@ CM_RT_API int32_t CmKernelRT::SetThreadCount(uint32_t count )
return CM_SUCCESS;
}

int32_t CmKernelRT::GetThreadCount(uint32_t& count )
int32_t CmKernelRT::GetThreadCount(uint32_t& count ) const
{
count = m_threadCount;
return CM_SUCCESS;
}

int32_t CmKernelRT::GetKernelSurfaces(bool *&surfArray)
int32_t CmKernelRT::GetKernelSurfaces(bool *&surfArray) const
{
surfArray = m_surfaceArray;
return CM_SUCCESS;
Expand Down Expand Up @@ -945,7 +945,7 @@ int32_t CmKernelRT::ResetKernelSurfaces()
//| Use "value + indexSurfaceArray" to locate its surfaceIndex
//| Returns: CmSurface. Null if not found
//*-----------------------------------------------------------------------------
CmSurface* CmKernelRT::GetSurfaceFromSurfaceArray( SurfaceIndex* value, uint32_t indexSurfaceArray)
CmSurface* CmKernelRT::GetSurfaceFromSurfaceArray( SurfaceIndex* value, uint32_t indexSurfaceArray) const
{
int32_t hr = CM_SUCCESS;
CmSurface *surface = nullptr;
Expand Down Expand Up @@ -1105,7 +1105,7 @@ int32_t CmKernelRT::SetArgsVme(CM_KERNEL_INTERNAL_ARG_TYPE nArgType, uint32_t ar
//| vmeCmIndexArray points to arg.surfIndex
//| Returns: Result of the operation.
//*-----------------------------------------------------------------------------
int32_t CmKernelRT::SetArgsSingleVme(CmSurfaceVme* vmeSurface, uint8_t *vmeArgValueArray, uint16_t *cmSufacesArray)
int32_t CmKernelRT::SetArgsSingleVme(CmSurfaceVme* vmeSurface, uint8_t *vmeArgValueArray, uint16_t *cmSufacesArray) const
{

int32_t hr = CM_SUCCESS;
Expand Down Expand Up @@ -2391,10 +2391,10 @@ CM_RT_API int32_t CmKernelRT::SetThreadArg(uint32_t threadId, uint32_t index, si
//| Purpose: Calculate the total size of kernel data
//*-----------------------------------------------------------------------------
int32_t CmKernelRT::CalcKernelDataSize(
uint32_t movInstNum, // [in] the number of move instructions
uint32_t numArgs, // [in] number of args , surface array count
uint32_t argSize, // [in] Size of arguments
uint32_t & totalKernelDataSize) // [out] total size of kernel data
uint32_t movInstNum, // [in] the number of move instructions
uint32_t numArgs, // [in] number of args , surface array count
uint32_t argSize, // [in] Size of arguments
uint32_t & totalKernelDataSize) const // [out] total size of kernel data
{
int32_t hr = CM_SUCCESS;

Expand Down
Loading