本文整理汇总了C++中CM_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ CM_ASSERT函数的具体用法?C++ CM_ASSERT怎么用?C++ CM_ASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CM_ASSERT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateAuxDevice
INT CmDevice_RT::Initialize(CmDriverContext * pDriverContext)
{
INT result = CreateAuxDevice(pDriverContext);
if (result != CM_SUCCESS) {
CM_ASSERT(0);
return result;
}
m_pSurfaceMgr = NULL;
result = CmSurfaceManager::Create(this,
m_HalMaxValues,
m_HalMaxValuesEx, m_pSurfaceMgr);
if (result != CM_SUCCESS) {
CM_ASSERT(0);
return result;
}
result = CreateQueue_Internel();
if (result != CM_SUCCESS) {
CM_ASSERT(0);
return result;
}
return result;
}
示例2: sizeof
INT CmDevice_RT::GetMaxValueFromCaps(CM_HAL_MAX_VALUES & MaxValues,
CM_HAL_MAX_VALUES_EX & MaxValuesEx)
{
DXVA_CM_QUERY_CAPS queryCaps;
UINT querySize = sizeof(DXVA_CM_QUERY_CAPS);
CmSafeMemSet(&queryCaps, 0, sizeof(DXVA_CM_QUERY_CAPS));
queryCaps.Type = DXVA_CM_MAX_VALUES;
INT hr = GetCapsInternal(&queryCaps, &querySize);
if (FAILED(hr)) {
CM_ASSERT(0);
return CM_FAILURE;
}
MaxValues = queryCaps.MaxValues;
MaxValues.iMaxArgsPerKernel =
(queryCaps.MaxValues.iMaxArgsPerKernel >
CM_MAX_ARGS_PER_KERNEL) ? (CM_MAX_ARGS_PER_KERNEL) :
queryCaps.MaxValues.iMaxArgsPerKernel;
CmSafeMemSet(&queryCaps, 0, sizeof(DXVA_CM_QUERY_CAPS));
queryCaps.Type = DXVA_CM_MAX_VALUES_EX;
hr = GetCapsInternal(&queryCaps, &querySize);
if (FAILED(hr)) {
CM_ASSERT(0);
return CM_FAILURE;
}
MaxValuesEx = queryCaps.MaxValuesEx;
return CM_SUCCESS;
}
示例3: dlopen
INT CmDevice_RT::LoadJITDll(void)
{
int result = 0;
if (NULL == m_hJITDll) {
m_hJITDll = dlopen(GetJitterName(), RTLD_LAZY);
if (NULL == m_hJITDll) {
result = CM_JITDLL_LOAD_FAILURE;
CM_ASSERT(0);
return result;
}
if (NULL == m_fJITCompile) {
m_fJITCompile =
(pJITCompile) GetProcAddress(m_hJITDll,
JITCOMPILE_FUNCTION_STR);
m_fFreeBlock =
(pFreeBlock) GetProcAddress(m_hJITDll,
FREEBLOCK_FUNCTION_STR);
m_fJITVersion =
(pJITVersion) GetProcAddress(m_hJITDll,
JITVERSION_FUNCTION_STR);
}
if ((NULL == m_fJITCompile) || (NULL == m_fFreeBlock)
|| (NULL == m_fJITVersion)) {
result = CM_JITDLL_LOAD_FAILURE;
CM_ASSERT(0);
return result;
}
}
return result;
}
示例4: dlopen
INT CmDevice::GetFreeBlockFnt(pFreeBlock & fFreeBlock)
{
if (m_fFreeBlock) {
fFreeBlock = m_fFreeBlock;
} else {
if (!m_hJITDll) {
if (sizeof(void *) == 4) {
m_hJITDll = dlopen("igfxcmjit32.so", RTLD_LAZY);
} else {
m_hJITDll = dlopen("igfxcmjit64.so", RTLD_LAZY);
}
if (NULL == m_hJITDll) {
CM_ASSERT(0);
return CM_JITDLL_LOAD_FAILURE;
}
}
m_fFreeBlock =
(pFreeBlock) GetProcAddress(m_hJITDll,
FREEBLOCK_FUNCTION_STR);
if (NULL == m_fFreeBlock) {
CM_ASSERT(0);
return CM_JITDLL_LOAD_FAILURE;
}
fFreeBlock = m_fFreeBlock;
}
return CM_SUCCESS;
}
示例5: locker
CM_RT_API INT CmDevice_RT::DestroyTask(CmTask * &pTask)
{
CLock locker(m_CriticalSection_Task);
if (pTask == NULL) {
return CM_FAILURE;
}
CmTask_RT* pTask_RT = static_cast< CmTask_RT* >(pTask);
if ( pTask_RT == NULL ) {
return CM_FAILURE;
}
UINT index = pTask_RT->GetIndexInTaskArray();
if (pTask == (CmTask_RT *) m_TaskArray.GetElement(index)) {
INT status = CmTask_RT::Destroy(pTask_RT);
if (status == CM_SUCCESS) {
m_TaskArray.SetElement(index, NULL);
pTask = NULL;
return CM_SUCCESS;
} else {
CM_ASSERT(0);
return status;
}
} else {
CM_ASSERT(0);
return CM_FAILURE;
}
}
示例6: new
INT CmDevice_RT::Create(CmDriverContext * pDriverContext, CmDevice_RT * &pDevice,
UINT DevCreateOption)
{
INT result = CM_FAILURE;
if (pDevice != NULL) {
pDevice->Acquire();
return CM_SUCCESS;
}
pDevice = new(std::nothrow) CmDevice_RT(DevCreateOption);
if (pDevice) {
pDevice->Acquire();
result = pDevice->Initialize(pDriverContext);
if (result != CM_SUCCESS) {
CM_ASSERT(0);
CmDevice_RT::Destroy(pDevice);
pDevice = NULL;
}
} else {
CM_ASSERT(0);
result = CM_OUT_OF_HOST_MEMORY;
}
return result;
}
示例7: cm_bindInterfaceTrace
t_cm_error cm_bindInterfaceTrace(
const t_interface_require_description *itfRequire,
const t_interface_provide_description *itfProvide,
t_elfdescription *elfhandleTrace)
{
t_interface_require *require = &itfRequire->client->Template->requires[itfRequire->requireIndex];
t_interface_require_description bcitfRequire;
t_interface_provide_description bcitfProvide;
t_trace_bf_info *bfInfo;
t_cm_error error;
LOG_INTERNAL(1, "\n##### Bind Synchronous Trace %s/%x.%s -> %s/%x.%s #####\n",
itfRequire->client->pathname, itfRequire->client, itfRequire->origName,
itfProvide->server->pathname, itfProvide->server, itfProvide->origName);
/* Allocate aynchronous binding factory information */
bfInfo = (t_trace_bf_info*)OSAL_Alloc(sizeof(t_trace_bf_info));
if(bfInfo == 0)
return CM_NO_MORE_MEMORY;
/*
* Instantiate related trace on dsp
*/
{
char traceTemplateName[4 + MAX_INTERFACE_TYPE_NAME_LENGTH + 1];
cm_StringCopy(traceTemplateName,"_tr.", sizeof(traceTemplateName));
cm_StringConcatenate(traceTemplateName, require->interface->type, MAX_INTERFACE_TYPE_NAME_LENGTH);
if ((error = cm_instantiateComponent(
traceTemplateName,
itfRequire->client->domainId,
itfProvide->server->priority,
traceDup,
elfhandleTrace,
&bfInfo->traceInstance)) != CM_OK) {
OSAL_Free(bfInfo);
return (error == CM_COMPONENT_NOT_FOUND)?CM_BINDING_COMPONENT_NOT_FOUND : error;
}
}
/* Bind event to server interface (Error must not occure) */
CM_ASSERT(cm_getRequiredInterface(bfInfo->traceInstance, "target", &bcitfRequire) == CM_OK);
cm_bindLowLevelInterface(&bcitfRequire, itfProvide, BF_SYNCHRONOUS, NULL);
/* Get the event interface (Error must not occure) */
CM_ASSERT(cm_getProvidedInterface(bfInfo->traceInstance, "target", &bcitfProvide) == CM_OK);
/* Bind client to event (Error must not occure) */
cm_bindLowLevelInterface(itfRequire, &bcitfProvide, BF_TRACE, bfInfo);
cm_TRC_traceBinding(TRACE_BIND_COMMAND_BIND_SYNCHRONOUS,
itfRequire->client, itfProvide->server,
itfRequire->client->Template->requires[itfRequire->requireIndex].name,
itfProvide->server->Template->provides[itfProvide->provideIndex].name);
return CM_OK;
}
示例8: CM_ASSERTMESSAGE
INT CmQueue::Enqueue_RT(CmKernel * pKernelArray[],
const UINT uiKernelCount,
const UINT uiTotalThreadCount,
CmEvent * &pEvent,
const CmThreadSpace * pTS,
UINT64 uiSyncBitmap,
PCM_HAL_POWER_OPTION_PARAM pPowerOption)
{
if (pKernelArray == NULL) {
CM_ASSERTMESSAGE("Kernel array is NULL.");
return CM_INVALID_ARG_VALUE;
}
if (uiKernelCount == 0) {
CM_ASSERTMESSAGE("There are no valid kernels.");
return CM_INVALID_ARG_VALUE;
}
BOOL bIsEventVisible = (pEvent == CM_NO_EVENT) ? FALSE : TRUE;
CmTaskInternal *pTask = NULL;
INT result = CmTaskInternal::Create(uiKernelCount, uiTotalThreadCount,
pKernelArray,
pTS, m_pDevice, uiSyncBitmap,
pTask);
if (result != CM_SUCCESS) {
CM_ASSERT(0);
return result;
}
m_CriticalSection_Queue.Acquire();
if (!m_EnqueuedTasks.Push(pTask)) {
m_CriticalSection_Queue.Release();
CM_ASSERT(0);
return CM_FAILURE;
}
INT taskDriverId = -1;
result = CreateEvent(pTask, bIsEventVisible, taskDriverId, pEvent);
if (result != CM_SUCCESS) {
m_CriticalSection_Queue.Release();
CM_ASSERT(0);
return result;
}
pTask->SetPowerOption(pPowerOption);
UpdateSurfaceStateOnPush(pTask);
result = FlushTaskWithoutSync();
m_CriticalSection_Queue.Release();
return result;
}
示例9: CM_ASSERT
INT CmEvent::Query(void)
{
CM_RETURN_CODE hr = CM_SUCCESS;
if ((m_Status != CM_STATUS_FLUSHED) && (m_Status != CM_STATUS_STARTED)) {
return CM_FAILURE;
}
CM_ASSERT(m_TaskDriverId > -1);
CM_HAL_QUERY_TASK_PARAM param;
param.iTaskId = m_TaskDriverId;
PCM_CONTEXT pCmData = (PCM_CONTEXT) m_pDevice->GetAccelData();
CHK_GENOSSTATUS_RETURN_CMERROR(pCmData->pCmHalState->
pfnQueryTask(pCmData->pCmHalState,
¶m));
if (param.status == CM_TASK_FINISHED) {
CmQueue *pQueue = NULL;
m_Time = param.iTaskDuration;
m_Status = CM_STATUS_FINISHED;
m_GlobalCMSubmitTime = param.iTaskGlobalCMSubmitTime;
m_CMSubmitTimeStamp = param.iTaskCMSubmitTimeStamp;
m_HWStartTimeStamp = param.iTaskHWStartTimeStamp;
m_HWEndTimeStamp = param.iTaskHWEndTimeStamp;
m_CompleteTime = param.iTaskCompleteTime;
m_pDevice->GetQueue(pQueue);
if (!pQueue) {
CM_ASSERT(0);
return CM_FAILURE;
}
if (m_OsData) {
drm_intel_bo_unreference((drm_intel_bo *) m_OsData);
}
m_GlobalCMSubmitTime = param.iTaskGlobalCMSubmitTime;
m_CMSubmitTimeStamp = param.iTaskCMSubmitTimeStamp;
m_HWStartTimeStamp = param.iTaskHWStartTimeStamp;
m_HWEndTimeStamp = param.iTaskHWEndTimeStamp;
m_CompleteTime = param.iTaskCompleteTime;
} else if (param.status == CM_TASK_IN_PROGRESS) {
m_Status = CM_STATUS_STARTED;
}
finish:
return hr;
}
示例10: CM_ASSERT
INT CmSurfaceManager::DestroySurface(CmBuffer_RT * &pSurface1D,
SURFACE_DESTROY_KIND destroyKind)
{
UINT handle = 0;
INT result = CM_SUCCESS;
if (!pSurface1D) {
return CM_FAILURE;
}
SurfaceIndex *pIndex = NULL;
pSurface1D->GetIndex(pIndex);
CM_ASSERT(pIndex);
UINT index = pIndex->get_data();
CM_ASSERT(m_SurfaceArray[index] == pSurface1D);
if (destroyKind == FORCE_DESTROY) {
pSurface1D->WaitForReferenceFree();
} else {
if (m_pCmDevice->IsSurfaceReuseEnabled()
&& !pSurface1D->IsUpSurface()) {
result =
UPDATE_STATE_FOR_REUSE_DESTROY(destroyKind, index);
} else {
result =
UPDATE_STATE_FOR_DELAYED_DESTROY(destroyKind,
index);
}
if (result != CM_SUCCESS) {
return result;
}
}
result = pSurface1D->GetHandle(handle);
if (result != CM_SUCCESS) {
return result;
}
result = FreeBuffer(handle);
if (result != CM_SUCCESS) {
return result;
}
CmSurface *pSurface = pSurface1D;
CmSurface::Destroy(pSurface);
UPDATE_STATE_FOR_REAL_DESTROY(index, CM_ENUM_CLASS_TYPE_CMBUFFER_RT);
return CM_SUCCESS;
}
示例11: switch
INT CmSurfaceManager::UPDATE_STATE_FOR_REAL_DESTROY(UINT i,
CM_ENUM_CLASS_TYPE kind)
{
m_SurfaceReleased[i] = FALSE;
m_SurfaceCached[i] = FALSE;
m_SurfaceArray[i] = NULL;
m_SurfaceDestroyID[i]++;
m_SurfaceSizes[i] = 0;
switch (kind) {
case CM_ENUM_CLASS_TYPE_CMBUFFER_RT:
m_bufferCount--;
break;
case CM_ENUM_CLASS_TYPE_CMSURFACE2D:
m_2DSurfaceCount--;
break;
case CM_ENUM_CLASS_TYPE_CMSURFACE2DUP:
m_2DUPSurfaceCount--;
break;
default:
CM_ASSERT(0);
break;
}
return CM_SUCCESS;
}
示例12: new
INT CmSurface2DUP::Create(UINT index, UINT handle, UINT width, UINT height,
CM_SURFACE_FORMAT format,
CmSurfaceManager * pSurfaceManager,
CmSurface2DUP * &pSurface)
{
INT result = CM_SUCCESS;
pSurface =
new(std::nothrow) CmSurface2DUP(handle, width, height, format,
pSurfaceManager);
if (pSurface) {
result = pSurface->Initialize(index);
if (result != CM_SUCCESS) {
CmSurface *pBaseSurface = pSurface;
CmSurface::Destroy(pBaseSurface);
}
} else {
CM_ASSERT(0);
result = CM_OUT_OF_HOST_MEMORY;
}
return result;
}
示例13: CM_ASSERT
CM_RT_API INT
CmDevice_RT::CreateKernel(CmProgram * pProgram, const char *kernelName,
CmKernel * &pKernel, const char *options)
{
if (pProgram == NULL) {
CM_ASSERT(0);
return CM_INVALID_ARG_VALUE;
}
CLock locker(m_CriticalSection_Program_Kernel);
UINT freeSlotInKernelArray = m_KernelArray.GetFirstFreeIndex();
CmKernel_RT *pKernel_RT=NULL;
CmProgram_RT* pProgram_RT = static_cast<CmProgram_RT*>(pProgram);
INT result =
CmKernel_RT::Create(this, pProgram_RT, kernelName, freeSlotInKernelArray,
m_KernelCount, pKernel_RT, options);
if (result == CM_SUCCESS) {
m_KernelArray.SetElement(freeSlotInKernelArray, pKernel_RT);
m_KernelCount++;
pKernel = static_cast< CmKernel * >(pKernel_RT);
}
return result;
}
示例14: FlushTaskWithoutSync
INT CmQueue::CleanQueue(void)
{
INT status = CM_SUCCESS;
m_CriticalSection_Queue.Acquire();
if (!m_EnqueuedTasks.IsEmpty()) {
FlushTaskWithoutSync(TRUE);
}
CM_ASSERT(m_EnqueuedTasks.IsEmpty());
m_EnqueuedTasks.DeleteFreePool();
struct timeval start;
gettimeofday(&start, NULL);
UINT64 timeout_usec;
timeout_usec = CM_MAX_TIMEOUT * m_FlushedTasks.GetCount() * 1000000;
while (!m_FlushedTasks.IsEmpty() && status != CM_EXCEED_MAX_TIMEOUT) {
QueryFlushedTasks();
struct timeval current;
gettimeofday(¤t, NULL);
UINT64 timeuse_usec;
timeuse_usec =
1000000 * (current.tv_sec - start.tv_sec) +
current.tv_usec - start.tv_usec;
if (timeuse_usec > timeout_usec)
status = CM_EXCEED_MAX_TIMEOUT;
}
m_FlushedTasks.DeleteFreePool();
m_CriticalSection_Queue.Release();
return status;
}
示例15: CM_ASSERT
INT CmQueue::UpdateSurfaceStateOnPush(CmTaskInternal * pTask)
{
INT *pSurfState = NULL;
BOOL *surfArray = NULL;
CmSurfaceManager *pSurfaceMgr = NULL;
UINT freeSurfNum = 0;
m_pDevice->GetSurfaceManager(pSurfaceMgr);
if (!pSurfaceMgr) {
CM_ASSERT(0);
return CM_FAILURE;
}
CSync *pSurfaceLock = m_pDevice->GetSurfaceCreationLock();
pSurfaceLock->Acquire();
UINT poolSize = pSurfaceMgr->GetSurfacePoolSize();
pSurfaceMgr->GetSurfaceState(pSurfState);
pTask->GetTaskSurfaces(surfArray);
for (UINT i = 0; i < poolSize; i++) {
if (surfArray[i]) {
pSurfState[i]++;
}
}
pSurfaceMgr->DestroySurfaceInPool(freeSurfNum, DELAYED_DESTROY);
pSurfaceLock->Release();
return CM_SUCCESS;
}