Skip to content

Commit

Permalink
[Decode] move lock from element to pSurface/ pBuffer
Browse files Browse the repository at this point in the history
Signed-off-by: Xu, Zhengguo <[email protected]>
  • Loading branch information
Jexu committed Apr 23, 2024
1 parent 78a4bc4 commit fcab0cd
Show file tree
Hide file tree
Showing 8 changed files with 110 additions and 68 deletions.
2 changes: 2 additions & 0 deletions media_driver/linux/common/codec/ddi/media_ddi_decode_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -994,6 +994,7 @@ VAStatus DdiMediaDecode::CreateBuffer(
buf->uiOffset = 0;
buf->bCFlushReq = false;
buf->pMediaCtx = m_ddiDecodeCtx->pMediaCtx;
buf->lock = MOS_New(std::shared_timed_mutex);

switch ((int32_t)type)
{
Expand Down Expand Up @@ -1122,6 +1123,7 @@ VAStatus DdiMediaDecode::CreateBuffer(
if(buf)
{
MOS_FreeMemory(buf->pData);
MOS_Delete(buf->lock);
MOS_FreeMemory(buf);
}
return va;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -917,6 +917,7 @@ VAStatus DdiEncodeBase::CreateBuffer(
buf->uiNumElements = elementsNum;
buf->uiType = type;
buf->uiOffset = 0;
buf->lock = MOS_New(std::shared_timed_mutex);

uint32_t bufSize = 0;
uint32_t expectedSize = 0xffffffff;
Expand Down
8 changes: 4 additions & 4 deletions media_driver/linux/common/codec/ddi/media_libva_decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ VAStatus DdiDecode_StatusReport(PDDI_MEDIA_CONTEXT mediaCtx, CodechalDecode *dec
(tempNewReport.m_codecStatus == CODECHAL_STATUS_INCOMPLETE) ||
(tempNewReport.m_codecStatus == CODECHAL_STATUS_RESET))
{
mediaCtx->pSurfaceHeap->lock.lock_shared();
mediaCtx->pSurfaceHeap->lock->lock_shared();
PDDI_MEDIA_SURFACE_HEAP_ELEMENT mediaSurfaceHeapElmt = (PDDI_MEDIA_SURFACE_HEAP_ELEMENT)mediaCtx->pSurfaceHeap->pHeapBase;

uint32_t j = 0;
Expand All @@ -423,7 +423,7 @@ VAStatus DdiDecode_StatusReport(PDDI_MEDIA_CONTEXT mediaCtx, CodechalDecode *dec
break;
}
}
mediaCtx->pSurfaceHeap->lock.unlock_shared();
mediaCtx->pSurfaceHeap->lock->unlock_shared();
}
else
{
Expand Down Expand Up @@ -490,7 +490,7 @@ VAStatus DdiDecode_StatusReport(PDDI_MEDIA_CONTEXT mediaCtx, DecodePipelineAdapt
(tempNewReport.codecStatus == CODECHAL_STATUS_INCOMPLETE) ||
(tempNewReport.codecStatus == CODECHAL_STATUS_RESET))
{
mediaCtx->pSurfaceHeap->lock.lock_shared();
mediaCtx->pSurfaceHeap->lock->lock_shared();
PDDI_MEDIA_SURFACE_HEAP_ELEMENT mediaSurfaceHeapElmt = (PDDI_MEDIA_SURFACE_HEAP_ELEMENT)mediaCtx->pSurfaceHeap->pHeapBase;

uint32_t j = 0;
Expand All @@ -505,7 +505,7 @@ VAStatus DdiDecode_StatusReport(PDDI_MEDIA_CONTEXT mediaCtx, DecodePipelineAdapt
break;
}
}
mediaCtx->pSurfaceHeap->lock.unlock_shared();
mediaCtx->pSurfaceHeap->lock->unlock_shared();
}
else
{
Expand Down
Loading

0 comments on commit fcab0cd

Please sign in to comment.