Skip to content

Commit

Permalink
[Decode] add back some mutex while it impacts vp9 drc
Browse files Browse the repository at this point in the history
  • Loading branch information
Jexu committed Apr 17, 2024
1 parent d369ca9 commit d24afa0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions media_driver/linux/common/ddi/media_libva.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1339,14 +1339,14 @@ VAStatus DdiMedia_MediaMemoryDecompress(PDDI_MEDIA_CONTEXT mediaCtx, DDI_MEDIA_S
}
else
{
//DdiMediaUtil_LockMutex(&mediaCtx->SurfaceMutex);
//DdiMediaUtil_LockMutex(&mediaCtx->MemDecompMutex);
DdiMediaUtil_LockMutex(&mediaCtx->SurfaceMutex);
DdiMediaUtil_LockMutex(&mediaCtx->MemDecompMutex);

DdiMedia_MediaSurfaceToMosResource(mediaSurface, &surface);
DdiMedia_MediaMemoryDecompressInternal(&mosCtx, &surface);

//DdiMediaUtil_UnLockMutex(&mediaCtx->MemDecompMutex);
//DdiMediaUtil_UnLockMutex(&mediaCtx->SurfaceMutex);
DdiMediaUtil_UnLockMutex(&mediaCtx->MemDecompMutex);
DdiMediaUtil_UnLockMutex(&mediaCtx->SurfaceMutex);

if (pCpDdiInterface)
{
Expand Down Expand Up @@ -2556,12 +2556,12 @@ VAStatus DdiMedia_DestroySurfaces (
MOS_TraceEventExt(EVENT_VA_SYNC, EVENT_TYPE_END, nullptr, 0, nullptr, 0);
}

//DdiMediaUtil_LockMutex(&mediaCtx->SurfaceMutex);
DdiMediaUtil_LockMutex(&mediaCtx->SurfaceMutex);
DdiMediaUtil_FreeSurface(surface);
MOS_FreeMemory(surface);
DdiMediaUtil_ReleasePMediaSurfaceFromHeap(mediaCtx->pSurfaceHeap, (uint32_t)surfaces[i]);
mediaCtx->uiNumSurfaces--;
//DdiMediaUtil_UnLockMutex(&mediaCtx->SurfaceMutex);
DdiMediaUtil_UnLockMutex(&mediaCtx->SurfaceMutex);
}

MOS_TraceEventExt(EVENT_VA_FREE_SURFACE, EVENT_TYPE_END, nullptr, 0, nullptr, 0);
Expand Down Expand Up @@ -3606,7 +3606,7 @@ VAStatus DdiMedia_MapBufferInternal (
default:
if((buf->format != Media_Format_CPU) && (DdiMedia_MediaFormatToOsFormat(buf->format) != VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT))
{
//DdiMediaUtil_LockMutex(&mediaCtx->BufferMutex);
DdiMediaUtil_LockMutex(&mediaCtx->BufferMutex);
// A critical section starts.
// Make sure not to bailout with a return until the section ends.

Expand All @@ -3626,7 +3626,7 @@ VAStatus DdiMedia_MapBufferInternal (
}

// The critical section ends.
//DdiMediaUtil_UnLockMutex(&mediaCtx->BufferMutex);
DdiMediaUtil_UnLockMutex(&mediaCtx->BufferMutex);
}
else
{
Expand Down Expand Up @@ -4078,7 +4078,7 @@ static VAStatus DdiMedia_StatusCheck (
PDDI_DECODE_CONTEXT decCtx = (PDDI_DECODE_CONTEXT)surface->pDecCtx;
if (decCtx && surface->curCtxType == DDI_MEDIA_CONTEXT_TYPE_DECODER)
{
//DdiMediaUtil_LockGuard guard(&mediaCtx->SurfaceMutex);
DdiMediaUtil_LockGuard guard(&mediaCtx->SurfaceMutex);

Codechal *codecHal = decCtx->pCodecHal;
//return success just avoid vaDestroyContext is ahead of vaSyncSurface
Expand Down
4 changes: 2 additions & 2 deletions media_driver/linux/common/ddi/media_libva_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,10 +388,10 @@ DDI_MEDIA_BUFFER* DdiMedia_GetBufferFromVABufferID (PDDI_MEDIA_CONTEXT mediaCtx,

bool DdiMedia_DestroyBufFromVABufferID (PDDI_MEDIA_CONTEXT mediaCtx, VABufferID bufferID)
{
//DdiMediaUtil_LockMutex(&mediaCtx->BufferMutex);
DdiMediaUtil_LockMutex(&mediaCtx->BufferMutex);
DdiMediaUtil_ReleasePMediaBufferFromHeap(mediaCtx->pBufferHeap, bufferID);
mediaCtx->uiNumBufs--;
//DdiMediaUtil_UnLockMutex(&mediaCtx->BufferMutex);
DdiMediaUtil_UnLockMutex(&mediaCtx->BufferMutex);
return true;
}

Expand Down

0 comments on commit d24afa0

Please sign in to comment.