V4L2DecodeInterface: Switch to GRALLOC allocator
This CL switches to output allocator to C2PlatformAllocatorStore::GRALLOC
that enforces use of C2PooledBufferPool without need of allocating a
separate allocator ID. For this reason V4L2AllocatorId::V4L2_BUFFERPOOL
is no longer used and is removed in this change.
Bug: 268301611
Bug: 268305422
Bug: 270329448
Bug: 238710012
Bug: 238390060
Bug: 270331759
Bug: 238709912
Test: CtsMediaCodecTestCases
Test: CtsMediaDecoderTestCases
Test: CtsMediaV2TestCases
Test: GtsExoPlayerTestCases com.google.android.exoplayer.gts.CommonEncryptionDrmTest#cencSchemeTypeV*
Change-Id: Ife2fbb6ac4ff2dc25e006792f8dad2d8ec6f4ac4
diff --git a/components/V4L2DecodeInterface.cpp b/components/V4L2DecodeInterface.cpp
index e8c7996..5764c18 100644
--- a/components/V4L2DecodeInterface.cpp
+++ b/components/V4L2DecodeInterface.cpp
@@ -329,7 +329,7 @@
const C2Allocator::id_t inputAllocators[] = {secureMode ? V4L2AllocatorId::SECURE_LINEAR
: C2AllocatorStore::DEFAULT_LINEAR};
- const C2Allocator::id_t outputAllocators[] = {V4L2AllocatorId::V4L2_BUFFERPOOL};
+ const C2Allocator::id_t outputAllocators[] = {C2PlatformAllocatorStore::GRALLOC};
const C2Allocator::id_t surfaceAllocator =
secureMode ? V4L2AllocatorId::SECURE_GRAPHIC : C2PlatformAllocatorStore::BUFFERQUEUE;
const C2BlockPool::local_id_t outputBlockPools[] = {C2BlockPool::BASIC_GRAPHIC};
diff --git a/components/VideoFramePool.cpp b/components/VideoFramePool.cpp
index 070cc40..4bf45f3 100644
--- a/components/VideoFramePool.cpp
+++ b/components/VideoFramePool.cpp
@@ -43,7 +43,7 @@
}
return dmabufId.value();
}
- case V4L2AllocatorId::V4L2_BUFFERPOOL:
+ case C2PlatformAllocatorStore::GRALLOC:
FALLTHROUGH;
case V4L2AllocatorId::SECURE_LINEAR: {
std::shared_ptr<_C2BlockPoolData> blockPoolData =
@@ -75,7 +75,7 @@
uint64_t usage = static_cast<uint64_t>(BufferUsage::VIDEO_DECODER);
if (isSecure) {
usage |= C2MemoryUsage::READ_PROTECTED;
- } else if (blockPool->getAllocatorId() == android::V4L2AllocatorId::V4L2_BUFFERPOOL) {
+ } else if (blockPool->getAllocatorId() == C2PlatformAllocatorStore::GRALLOC) {
// CPU access to buffers is only required in byte buffer mode.
usage |= C2MemoryUsage::CPU_READ;
}
diff --git a/plugin_store/V4L2PluginStore.cpp b/plugin_store/V4L2PluginStore.cpp
index a8cdab6..9f9f262 100644
--- a/plugin_store/V4L2PluginStore.cpp
+++ b/plugin_store/V4L2PluginStore.cpp
@@ -66,9 +66,6 @@
}
switch (allocatorId) {
- case V4L2AllocatorId::V4L2_BUFFERPOOL:
- return new C2PooledBlockPool(allocator, poolId);
-
case V4L2AllocatorId::SECURE_LINEAR:
return new C2PooledBlockPool(allocator, poolId);
diff --git a/plugin_store/include/v4l2_codec2/plugin_store/V4L2AllocatorId.h b/plugin_store/include/v4l2_codec2/plugin_store/V4L2AllocatorId.h
index 45a470c..2353076 100644
--- a/plugin_store/include/v4l2_codec2/plugin_store/V4L2AllocatorId.h
+++ b/plugin_store/include/v4l2_codec2/plugin_store/V4L2AllocatorId.h
@@ -12,8 +12,7 @@
// The allocator ids used for V4L2DecodeComponent.
enum : C2AllocatorStore::id_t {
- V4L2_BUFFERPOOL = C2PlatformAllocatorStore::PLATFORM_END,
- SECURE_LINEAR,
+ SECURE_LINEAR = C2PlatformAllocatorStore::PLATFORM_END,
SECURE_GRAPHIC,
};