|
|
|
@ -413,9 +413,7 @@ std::shared_ptr<C2LinearBlock> _C2BlockFactory::CreateLinearBlock(
|
|
|
|
|
|
|
|
|
|
std::shared_ptr<C2LinearAllocation> alloc;
|
|
|
|
|
if (C2AllocatorIon::isValid(cHandle)) {
|
|
|
|
|
native_handle_t *handle = native_handle_clone(cHandle);
|
|
|
|
|
if (handle) {
|
|
|
|
|
c2_status_t err = sAllocator->priorLinearAllocation(handle, &alloc);
|
|
|
|
|
c2_status_t err = sAllocator->priorLinearAllocation(cHandle, &alloc);
|
|
|
|
|
const std::shared_ptr<C2PooledBlockPoolData> poolData =
|
|
|
|
|
std::make_shared<C2PooledBlockPoolData>(data);
|
|
|
|
|
if (err == C2_OK && poolData) {
|
|
|
|
@ -425,7 +423,6 @@ std::shared_ptr<C2LinearBlock> _C2BlockFactory::CreateLinearBlock(
|
|
|
|
|
return block;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return nullptr;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -674,19 +671,16 @@ public:
|
|
|
|
|
ResultStatus status = mBufferPoolManager->allocate(
|
|
|
|
|
mConnectionId, params, &cHandle, &bufferPoolData);
|
|
|
|
|
if (status == ResultStatus::OK) {
|
|
|
|
|
native_handle_t *handle = native_handle_clone(cHandle);
|
|
|
|
|
if (handle) {
|
|
|
|
|
std::shared_ptr<C2LinearAllocation> alloc;
|
|
|
|
|
std::shared_ptr<C2PooledBlockPoolData> poolData =
|
|
|
|
|
std::make_shared<C2PooledBlockPoolData>(bufferPoolData);
|
|
|
|
|
c2_status_t err = mAllocator->priorLinearAllocation(handle, &alloc);
|
|
|
|
|
c2_status_t err = mAllocator->priorLinearAllocation(cHandle, &alloc);
|
|
|
|
|
if (err == C2_OK && poolData && alloc) {
|
|
|
|
|
*block = _C2BlockFactory::CreateLinearBlock(alloc, poolData, 0, capacity);
|
|
|
|
|
if (*block) {
|
|
|
|
|
return C2_OK;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return C2_NO_MEMORY;
|
|
|
|
|
}
|
|
|
|
|
if (status == ResultStatus::NO_MEMORY) {
|
|
|
|
@ -710,13 +704,11 @@ public:
|
|
|
|
|
ResultStatus status = mBufferPoolManager->allocate(
|
|
|
|
|
mConnectionId, params, &cHandle, &bufferPoolData);
|
|
|
|
|
if (status == ResultStatus::OK) {
|
|
|
|
|
native_handle_t *handle = native_handle_clone(cHandle);
|
|
|
|
|
if (handle) {
|
|
|
|
|
std::shared_ptr<C2GraphicAllocation> alloc;
|
|
|
|
|
std::shared_ptr<C2PooledBlockPoolData> poolData =
|
|
|
|
|
std::make_shared<C2PooledBlockPoolData>(bufferPoolData);
|
|
|
|
|
c2_status_t err = mAllocator->priorGraphicAllocation(
|
|
|
|
|
handle, &alloc);
|
|
|
|
|
cHandle, &alloc);
|
|
|
|
|
if (err == C2_OK && poolData && alloc) {
|
|
|
|
|
*block = _C2BlockFactory::CreateGraphicBlock(
|
|
|
|
|
alloc, poolData, C2Rect(width, height));
|
|
|
|
@ -724,7 +716,6 @@ public:
|
|
|
|
|
return C2_OK;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return C2_NO_MEMORY;
|
|
|
|
|
}
|
|
|
|
|
if (status == ResultStatus::NO_MEMORY) {
|
|
|
|
@ -1117,9 +1108,7 @@ std::shared_ptr<C2GraphicBlock> _C2BlockFactory::CreateGraphicBlock(
|
|
|
|
|
|
|
|
|
|
std::shared_ptr<C2GraphicAllocation> alloc;
|
|
|
|
|
if (C2AllocatorGralloc::isValid(cHandle)) {
|
|
|
|
|
native_handle_t *handle = native_handle_clone(cHandle);
|
|
|
|
|
if (handle) {
|
|
|
|
|
c2_status_t err = sAllocator->priorGraphicAllocation(handle, &alloc);
|
|
|
|
|
c2_status_t err = sAllocator->priorGraphicAllocation(cHandle, &alloc);
|
|
|
|
|
const std::shared_ptr<C2PooledBlockPoolData> poolData =
|
|
|
|
|
std::make_shared<C2PooledBlockPoolData>(data);
|
|
|
|
|
if (err == C2_OK && poolData) {
|
|
|
|
@ -1129,7 +1118,6 @@ std::shared_ptr<C2GraphicBlock> _C2BlockFactory::CreateGraphicBlock(
|
|
|
|
|
return block;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return nullptr;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|