Loading media/codec2/hidl/1.0/utils/InputSurfaceConnection.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -168,7 +168,7 @@ struct InputSurfaceConnection::Impl : public ComponentWrapper { std::shared_ptr<C2GraphicAllocation> alloc; C2Handle* handle = WrapNativeCodec2GrallocHandle( native_handle_clone(buffer->handle), buffer->handle, buffer->width, buffer->height, buffer->format, buffer->usage, buffer->stride); mAllocatorMutex.lock(); Loading media/codec2/sfplugin/C2OMXNode.cpp +1 −5 Original line number Diff line number Diff line Loading @@ -225,18 +225,14 @@ status_t C2OMXNode::emptyBuffer( if (omxBuf.mBufferType == OMXBuffer::kBufferTypeANWBuffer && omxBuf.mGraphicBuffer != nullptr) { std::shared_ptr<C2GraphicAllocation> alloc; native_handle_t *clonedHandle = native_handle_clone(omxBuf.mGraphicBuffer->handle); handle = WrapNativeCodec2GrallocHandle( clonedHandle, omxBuf.mGraphicBuffer->handle, omxBuf.mGraphicBuffer->width, omxBuf.mGraphicBuffer->height, omxBuf.mGraphicBuffer->format, omxBuf.mGraphicBuffer->usage, omxBuf.mGraphicBuffer->stride); c2_status_t err = mAllocator->priorGraphicAllocation(handle, &alloc); if (clonedHandle) { native_handle_delete(clonedHandle); } if (err != OK) { return UNKNOWN_ERROR; } Loading media/codec2/sfplugin/Codec2Buffer.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -578,7 +578,7 @@ std::shared_ptr<C2Buffer> GraphicMetadataBuffer::asC2Buffer() { ALOGV("VideoNativeMetadata: %dx%d", buffer->width, buffer->height); C2Handle *handle = WrapNativeCodec2GrallocHandle( native_handle_clone(buffer->handle), buffer->handle, buffer->width, buffer->height, buffer->format, Loading media/codec2/vndk/C2AllocatorGralloc.cpp +24 −4 Original line number Diff line number Diff line Loading @@ -159,7 +159,7 @@ public: return xd != nullptr && xd->magic == MAGIC; } static C2HandleGralloc* WrapNativeHandle( static C2HandleGralloc* WrapAndMoveNativeHandle( const native_handle_t *const handle, uint32_t width, uint32_t height, uint32_t format, uint64_t usage, uint32_t stride, uint32_t generation, uint64_t igbp_id = 0, uint32_t igbp_slot = 0) { Loading @@ -181,6 +181,26 @@ public: return reinterpret_cast<C2HandleGralloc *>(res); } static C2HandleGralloc* WrapNativeHandle( const native_handle_t *const handle, uint32_t width, uint32_t height, uint32_t format, uint64_t usage, uint32_t stride, uint32_t generation, uint64_t igbp_id = 0, uint32_t igbp_slot = 0) { if (handle == nullptr) { return nullptr; } native_handle_t *clone = native_handle_clone(handle); if (clone == nullptr) { return nullptr; } C2HandleGralloc *res = WrapAndMoveNativeHandle( clone, width, height, format, usage, stride, generation, igbp_id, igbp_slot); if (res == nullptr) { native_handle_close(clone); } native_handle_delete(clone); return res; } static native_handle_t* UnwrapNativeHandle( const C2Handle *const handle) { const ExtraData *xd = getExtraData(handle); Loading Loading @@ -366,7 +386,7 @@ c2_status_t C2AllocationGralloc::map( if (mHandle) { mHandle->getIgbpData(&generation, &igbp_id, &igbp_slot); } mLockedHandle = C2HandleGralloc::WrapNativeHandle( mLockedHandle = C2HandleGralloc::WrapAndMoveNativeHandle( mBuffer, mInfo.mapperInfo.width, mInfo.mapperInfo.height, (uint32_t)mInfo.mapperInfo.format, mInfo.mapperInfo.usage, mInfo.stride, generation, igbp_id, igbp_slot); Loading Loading @@ -743,7 +763,7 @@ c2_status_t C2AllocatorGralloc::Impl::newGraphicAllocation( return; } info.stride = stride; buffer = std::move(buffers[0]); buffer = buffers[0]; }); if (err != C2_OK) { return err; Loading @@ -752,7 +772,7 @@ c2_status_t C2AllocatorGralloc::Impl::newGraphicAllocation( allocation->reset(new C2AllocationGralloc( info, mMapper, buffer, C2HandleGralloc::WrapNativeHandle( C2HandleGralloc::WrapAndMoveNativeHandle( buffer.getNativeHandle(), info.mapperInfo.width, info.mapperInfo.height, (uint32_t)info.mapperInfo.format, info.mapperInfo.usage, info.stride, Loading media/codec2/vndk/platform/C2BqBuffer.cpp +21 −29 Original line number Diff line number Diff line Loading @@ -269,12 +269,9 @@ private: } } if (slotBuffer) { native_handle_t *grallocHandle = native_handle_clone(slotBuffer->handle); if (grallocHandle) { ALOGV("buffer wraps %llu %d", (unsigned long long)mProducerId, slot); C2Handle *c2Handle = android::WrapNativeCodec2GrallocHandle( grallocHandle, slotBuffer->handle, slotBuffer->width, slotBuffer->height, slotBuffer->format, Loading @@ -283,8 +280,6 @@ private: slotBuffer->getGenerationNumber(), mProducerId, slot); if (c2Handle) { // Moved everything to c2Handle. native_handle_delete(grallocHandle); std::shared_ptr<C2GraphicAllocation> alloc; c2_status_t err = mAllocator->priorGraphicAllocation(c2Handle, &alloc); if (err != C2_OK) { Loading @@ -297,9 +292,6 @@ private: *block = _C2BlockFactory::CreateGraphicBlock(alloc, poolData); return C2_OK; } native_handle_close(grallocHandle); native_handle_delete(grallocHandle); } // Block was not created. call requestBuffer# again next time. slotBuffer.clear(); (void)mProducer->cancelBuffer(slot, fenceHandle).isOk(); Loading Loading
media/codec2/hidl/1.0/utils/InputSurfaceConnection.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -168,7 +168,7 @@ struct InputSurfaceConnection::Impl : public ComponentWrapper { std::shared_ptr<C2GraphicAllocation> alloc; C2Handle* handle = WrapNativeCodec2GrallocHandle( native_handle_clone(buffer->handle), buffer->handle, buffer->width, buffer->height, buffer->format, buffer->usage, buffer->stride); mAllocatorMutex.lock(); Loading
media/codec2/sfplugin/C2OMXNode.cpp +1 −5 Original line number Diff line number Diff line Loading @@ -225,18 +225,14 @@ status_t C2OMXNode::emptyBuffer( if (omxBuf.mBufferType == OMXBuffer::kBufferTypeANWBuffer && omxBuf.mGraphicBuffer != nullptr) { std::shared_ptr<C2GraphicAllocation> alloc; native_handle_t *clonedHandle = native_handle_clone(omxBuf.mGraphicBuffer->handle); handle = WrapNativeCodec2GrallocHandle( clonedHandle, omxBuf.mGraphicBuffer->handle, omxBuf.mGraphicBuffer->width, omxBuf.mGraphicBuffer->height, omxBuf.mGraphicBuffer->format, omxBuf.mGraphicBuffer->usage, omxBuf.mGraphicBuffer->stride); c2_status_t err = mAllocator->priorGraphicAllocation(handle, &alloc); if (clonedHandle) { native_handle_delete(clonedHandle); } if (err != OK) { return UNKNOWN_ERROR; } Loading
media/codec2/sfplugin/Codec2Buffer.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -578,7 +578,7 @@ std::shared_ptr<C2Buffer> GraphicMetadataBuffer::asC2Buffer() { ALOGV("VideoNativeMetadata: %dx%d", buffer->width, buffer->height); C2Handle *handle = WrapNativeCodec2GrallocHandle( native_handle_clone(buffer->handle), buffer->handle, buffer->width, buffer->height, buffer->format, Loading
media/codec2/vndk/C2AllocatorGralloc.cpp +24 −4 Original line number Diff line number Diff line Loading @@ -159,7 +159,7 @@ public: return xd != nullptr && xd->magic == MAGIC; } static C2HandleGralloc* WrapNativeHandle( static C2HandleGralloc* WrapAndMoveNativeHandle( const native_handle_t *const handle, uint32_t width, uint32_t height, uint32_t format, uint64_t usage, uint32_t stride, uint32_t generation, uint64_t igbp_id = 0, uint32_t igbp_slot = 0) { Loading @@ -181,6 +181,26 @@ public: return reinterpret_cast<C2HandleGralloc *>(res); } static C2HandleGralloc* WrapNativeHandle( const native_handle_t *const handle, uint32_t width, uint32_t height, uint32_t format, uint64_t usage, uint32_t stride, uint32_t generation, uint64_t igbp_id = 0, uint32_t igbp_slot = 0) { if (handle == nullptr) { return nullptr; } native_handle_t *clone = native_handle_clone(handle); if (clone == nullptr) { return nullptr; } C2HandleGralloc *res = WrapAndMoveNativeHandle( clone, width, height, format, usage, stride, generation, igbp_id, igbp_slot); if (res == nullptr) { native_handle_close(clone); } native_handle_delete(clone); return res; } static native_handle_t* UnwrapNativeHandle( const C2Handle *const handle) { const ExtraData *xd = getExtraData(handle); Loading Loading @@ -366,7 +386,7 @@ c2_status_t C2AllocationGralloc::map( if (mHandle) { mHandle->getIgbpData(&generation, &igbp_id, &igbp_slot); } mLockedHandle = C2HandleGralloc::WrapNativeHandle( mLockedHandle = C2HandleGralloc::WrapAndMoveNativeHandle( mBuffer, mInfo.mapperInfo.width, mInfo.mapperInfo.height, (uint32_t)mInfo.mapperInfo.format, mInfo.mapperInfo.usage, mInfo.stride, generation, igbp_id, igbp_slot); Loading Loading @@ -743,7 +763,7 @@ c2_status_t C2AllocatorGralloc::Impl::newGraphicAllocation( return; } info.stride = stride; buffer = std::move(buffers[0]); buffer = buffers[0]; }); if (err != C2_OK) { return err; Loading @@ -752,7 +772,7 @@ c2_status_t C2AllocatorGralloc::Impl::newGraphicAllocation( allocation->reset(new C2AllocationGralloc( info, mMapper, buffer, C2HandleGralloc::WrapNativeHandle( C2HandleGralloc::WrapAndMoveNativeHandle( buffer.getNativeHandle(), info.mapperInfo.width, info.mapperInfo.height, (uint32_t)info.mapperInfo.format, info.mapperInfo.usage, info.stride, Loading
media/codec2/vndk/platform/C2BqBuffer.cpp +21 −29 Original line number Diff line number Diff line Loading @@ -269,12 +269,9 @@ private: } } if (slotBuffer) { native_handle_t *grallocHandle = native_handle_clone(slotBuffer->handle); if (grallocHandle) { ALOGV("buffer wraps %llu %d", (unsigned long long)mProducerId, slot); C2Handle *c2Handle = android::WrapNativeCodec2GrallocHandle( grallocHandle, slotBuffer->handle, slotBuffer->width, slotBuffer->height, slotBuffer->format, Loading @@ -283,8 +280,6 @@ private: slotBuffer->getGenerationNumber(), mProducerId, slot); if (c2Handle) { // Moved everything to c2Handle. native_handle_delete(grallocHandle); std::shared_ptr<C2GraphicAllocation> alloc; c2_status_t err = mAllocator->priorGraphicAllocation(c2Handle, &alloc); if (err != C2_OK) { Loading @@ -297,9 +292,6 @@ private: *block = _C2BlockFactory::CreateGraphicBlock(alloc, poolData); return C2_OK; } native_handle_close(grallocHandle); native_handle_delete(grallocHandle); } // Block was not created. call requestBuffer# again next time. slotBuffer.clear(); (void)mProducer->cancelBuffer(slot, fenceHandle).isOk(); Loading