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

Revert "Fix camera record flicker issue" #15

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
4 changes: 0 additions & 4 deletions omx_utils/include/mfx_omx_gralloc_adapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ class MfxOmxGrallocAdapter
mfxStatus Alloc(const mfxU16 width, const mfxU16 height, buffer_handle_t *outHandle);
mfxStatus Free(const buffer_handle_t handle);

mfxStatus ImportBuffer(const buffer_handle_t rawHandle, buffer_handle_t *outBuffer);
mfxStatus Release(buffer_handle_t bufferHandle);

void RegisterBuffer(buffer_handle_t handle);
void UnregisterBuffer(buffer_handle_t handle);

Expand All @@ -62,7 +59,6 @@ class MfxOmxGrallocAdapter
#endif
GRALLOC1_PFN_GET_DIMENSIONS m_grallocGetDimensions;
GRALLOC1_PFN_ALLOCATE m_grallocAllocate;
GRALLOC1_PFN_IMPORT_BUFFER m_grallocImportBuffer;
GRALLOC1_PFN_RELEASE m_grallocRelease;
GRALLOC1_PFN_LOCK m_grallocLock;
GRALLOC1_PFN_UNLOCK m_grallocUnlock;
Expand Down
35 changes: 1 addition & 34 deletions omx_utils/src/mfx_omx_gralloc_adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ MfxOmxGrallocAdapter::MfxOmxGrallocAdapter()
#endif
, m_grallocGetDimensions(NULL)
, m_grallocAllocate(NULL)
, m_grallocImportBuffer(NULL)
, m_grallocRelease(NULL)
, m_grallocLock(NULL)
, m_grallocUnlock(NULL)
Expand Down Expand Up @@ -107,10 +106,6 @@ mfxStatus MfxOmxGrallocAdapter::Init()
(GRALLOC1_PFN_LOCK) m_pGralloc1Dev->getFunction(m_pGralloc1Dev, GRALLOC1_FUNCTION_LOCK);
m_grallocUnlock =
(GRALLOC1_PFN_UNLOCK) m_pGralloc1Dev->getFunction(m_pGralloc1Dev, GRALLOC1_FUNCTION_UNLOCK);
m_grallocImportBuffer =
(GRALLOC1_PFN_IMPORT_BUFFER) m_pGralloc1Dev->getFunction(m_pGralloc1Dev, GRALLOC1_FUNCTION_IMPORT_BUFFER);
m_grallocRelease =
(GRALLOC1_PFN_RELEASE) m_pGralloc1Dev->getFunction(m_pGralloc1Dev, GRALLOC1_FUNCTION_RELEASE);

if (!m_grallocGetFormat ||
!m_grallocGetNumFlexPlanes ||
Expand All @@ -122,9 +117,7 @@ mfxStatus MfxOmxGrallocAdapter::Init()
!m_grallocAllocate ||
!m_grallocRelease ||
!m_grallocLock ||
!m_grallocUnlock ||
!m_grallocImportBuffer ||
!m_grallocRelease)
!m_grallocUnlock)
{
gralloc1_close(m_pGralloc1Dev);
m_pGralloc1Dev = NULL;
Expand Down Expand Up @@ -282,32 +275,6 @@ mfxStatus MfxOmxGrallocAdapter::Unlock(buffer_handle_t handle)
return mfx_res;
}

mfxStatus MfxOmxGrallocAdapter::ImportBuffer(const buffer_handle_t rawHandle, buffer_handle_t *outBuffer)
{
MFX_OMX_AUTO_TRACE_FUNC();
mfxStatus mfx_res = MFX_ERR_NONE;
#ifdef MFX_OMX_USE_GRALLOC_1
m_grallocImportBuffer(m_pGralloc1Dev, rawHandle, outBuffer);
#else
*outBuffer = native_handle_clone(rawHandle);
#endif
MFX_OMX_AUTO_TRACE_I32(mfx_res);
return mfx_res;
}
mfxStatus MfxOmxGrallocAdapter::Release(buffer_handle_t bufferHandle)
{
MFX_OMX_AUTO_TRACE_FUNC();
mfxStatus mfx_res = MFX_ERR_NONE;
#ifdef MFX_OMX_USE_GRALLOC_1
m_grallocRelease(m_pGralloc1Dev, bufferHandle);
#else
native_handle_close(bufferHandle);
native_handle_delete(bufferHandle);
#endif
MFX_OMX_AUTO_TRACE_I32(mfx_res);
return mfx_res;
}

mfxStatus MfxOmxGrallocAdapter::Alloc(const mfxU16 width, const mfxU16 height, buffer_handle_t *outHandle)
{
MFX_OMX_AUTO_TRACE_FUNC();
Expand Down
21 changes: 3 additions & 18 deletions omx_utils/src/mfx_omx_vaapi_allocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -583,25 +583,14 @@ mfxStatus MfxOmxVaapiFrameAllocator::LoadGrallocBuffer(const mfxU8* handle, cons

mfxU8 *img = NULL;
bool bIsLocked = false;
bool bIsImported = false;
buffer_handle_t bufferHandle;

mfx_res = m_pGralloc->ImportBuffer((buffer_handle_t)handle, &bufferHandle);
if (MFX_ERR_NONE == mfx_res)
{
bIsImported = true;
}
else
{
MFX_OMX_AUTO_TRACE_MSG("Failed to import buffer");
}
mfx_res = m_pGralloc->GetInfo(bufferHandle, &info);
mfx_res = m_pGralloc->GetInfo((buffer_handle_t)handle, &info);
if (MFX_ERR_NONE == mfx_res)
{
MFX_OMX_AUTO_TRACE_I32(info.width);
MFX_OMX_AUTO_TRACE_I32(info.height);

mfx_res = m_pGralloc->Lock(bufferHandle, info.width, info.height, GRALLOC_USAGE_HW_VIDEO_ENCODER, &img);
mfx_res = m_pGralloc->Lock((buffer_handle_t)handle, info.width, info.height, GRALLOC_USAGE_HW_VIDEO_ENCODER, &img);
if (MFX_ERR_NONE == mfx_res)
{
bIsLocked = true;
Expand Down Expand Up @@ -668,11 +657,7 @@ mfxStatus MfxOmxVaapiFrameAllocator::LoadGrallocBuffer(const mfxU8* handle, cons

if (bIsLocked)
{
m_pGralloc->Unlock(bufferHandle);
}
if (bIsImported)
{
m_pGralloc->Release(bufferHandle);
m_pGralloc->Unlock((buffer_handle_t)handle);
}

MFX_OMX_AUTO_TRACE_I32(mfx_res);
Expand Down