diff --git a/components/DecodeInterface.cpp b/components/DecodeInterface.cpp index 53689bdc998bb25b2f26536ef28f316146df5af9..13f0be4102e6541180afb25cdcdd2b433b42d7ed 100644 --- a/components/DecodeInterface.cpp +++ b/components/DecodeInterface.cpp @@ -315,7 +315,7 @@ DecodeInterface::DecodeInterface(const std::string& name, bool secureMode = name.find(".secure") != std::string::npos; const C2Allocator::id_t inputAllocators[] = {secureMode ? V4L2AllocatorId::SECURE_LINEAR - : C2AllocatorStore::DEFAULT_LINEAR}; + : V4L2AllocatorId::DMABUF_CARVEOUT}; const C2Allocator::id_t outputAllocators[] = {C2PlatformAllocatorStore::GRALLOC}; const C2Allocator::id_t surfaceAllocator = diff --git a/plugin_store/C2CarveoutDmaBufAllocator.cpp b/plugin_store/C2CarveoutDmaBufAllocator.cpp index 3e0e5e6460d24e2ad1975a65aa69868c9159ec44..89b37cb58da97d3bd93c708cd6dd04bf04084395 100644 --- a/plugin_store/C2CarveoutDmaBufAllocator.cpp +++ b/plugin_store/C2CarveoutDmaBufAllocator.cpp @@ -348,7 +348,7 @@ c2_status_t C2CarveoutDmaBufAllocator::mapUsage(C2MemoryUsage usage, size_t capa !(usage.expected & (C2MemoryUsage::CPU_READ | C2MemoryUsage::CPU_WRITE))) *heap_name = "system-uncached"; else - *heap_name = "system"; + *heap_name = "carveout_video"; *flags = 0; res = C2_NO_INIT; } diff --git a/plugin_store/V4L2PluginStore.cpp b/plugin_store/V4L2PluginStore.cpp index 1ad624cbc4c05674527f4c15a28cf60b38d98810..e7cbffd0e486616605a293710a8d8636caf11745 100644 --- a/plugin_store/V4L2PluginStore.cpp +++ b/plugin_store/V4L2PluginStore.cpp @@ -17,6 +17,7 @@ #include <log/log.h> #include <v4l2_codec2/plugin_store/V4L2AllocatorId.h> +#include <v4l2_codec2/plugin_store/C2CarveoutDmaBufAllocator.h> #include <v4l2_codec2/plugin_store/VendorAllocatorLoader.h> namespace android { @@ -47,6 +48,9 @@ C2Allocator* createAllocator(C2Allocator::id_t allocatorId) { return allocatorLoader->createAllocator(allocatorId); } + if (allocatorId == V4L2AllocatorId::DMABUF_CARVEOUT) + return new C2CarveoutDmaBufAllocator(allocatorId); + ALOGI("%s(): Fallback to create C2AllocatorGralloc(id=%u)", __func__, allocatorId); return new C2AllocatorGralloc(allocatorId, true); } @@ -98,6 +102,9 @@ C2BlockPool* createBlockPool(C2Allocator::id_t allocatorId, C2BlockPool::local_i case V4L2AllocatorId::SECURE_GRAPHIC: return new C2BufferQueueBlockPool(allocator, poolId); + case V4L2AllocatorId::DMABUF_CARVEOUT: + return new C2PooledBlockPool(allocator, poolId); + default: ALOGE("%s(): Unknown allocator id=%u", __func__, allocatorId); return nullptr; diff --git a/plugin_store/include/v4l2_codec2/plugin_store/V4L2AllocatorId.h b/plugin_store/include/v4l2_codec2/plugin_store/V4L2AllocatorId.h index 2353076405ca21062fa5e998c10604e155258e25..6fcf88eb3b2b5aeee1b205241b769c2fb3b6b5f1 100644 --- a/plugin_store/include/v4l2_codec2/plugin_store/V4L2AllocatorId.h +++ b/plugin_store/include/v4l2_codec2/plugin_store/V4L2AllocatorId.h @@ -14,6 +14,7 @@ namespace V4L2AllocatorId { enum : C2AllocatorStore::id_t { SECURE_LINEAR = C2PlatformAllocatorStore::PLATFORM_END, SECURE_GRAPHIC, + DMABUF_CARVEOUT, }; } // namespace V4L2AllocatorId