Skip to content

Commit

Permalink
[VP] Fix cm rt leak
Browse files Browse the repository at this point in the history
Fix cm rt leak whhen destroy cm device
  • Loading branch information
kchen1024 authored and intel-mediadev committed Oct 13, 2023
1 parent c3185c6 commit e3cbfcb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
10 changes: 10 additions & 0 deletions media_driver/agnostic/common/cm/cm_hal.h
Original file line number Diff line number Diff line change
Expand Up @@ -1964,6 +1964,12 @@ typedef struct _CM_HAL_STATE
uint64_t kernelId);

uint32_t (*pfnRegisterStream) (PCM_HAL_STATE state);

void(*pfnUnRegisterStream)
(
uint32_t streamIndex,
PCM_HAL_STATE state);

} CM_HAL_STATE, *PCM_HAL_STATE;

typedef struct _CM_HAL_MI_REG_OFFSETS
Expand Down Expand Up @@ -2108,6 +2114,10 @@ MOS_STATUS HalCm_GetGpuTime(
uint32_t HalCm_RegisterStream(
PCM_HAL_STATE state);

void HalCm_UnRegisterStream(
uint32_t streamIndex,
PCM_HAL_STATE state);

MOS_STATUS HalCm_GetSipBinary(
PCM_HAL_STATE state);

Expand Down
7 changes: 7 additions & 0 deletions media_driver/agnostic/common/cm/cm_queue_rt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@ int32_t CmQueueRT::Destroy(CmQueueRT* &queue )

queue->DestroyComputeGpuContext();

PCM_HAL_STATE cmHalState = ((PCM_CONTEXT_DATA)queue->m_device->GetAccelData())->cmHalState;
CM_CHK_NULL_RETURN_CMERROR(cmHalState);
if (cmHalState->pfnUnRegisterStream != nullptr && queue->m_streamIndex != cmHalState->osInterface->streamIndex)
{
cmHalState->pfnUnRegisterStream(queue->m_streamIndex, cmHalState);
}

CmSafeDelete( queue );

return result;
Expand Down

0 comments on commit e3cbfcb

Please sign in to comment.