Revert "codec2: C2AllocatorIon/DmaBuf: add support for padding"
This reverts commit 0b2d2f95e8b7c41250829d829b2c67571a3dad09.
Reason for revert: creating revert to be able to test if this CL caused a regression on playback.
Bug: 183684422
Change-Id: Ic64851677b781b118c408762bd33f15a0f98ef1d
diff --git a/media/codec2/vndk/C2DmaBufAllocator.cpp b/media/codec2/vndk/C2DmaBufAllocator.cpp
index 7c8999b..750aa31 100644
--- a/media/codec2/vndk/C2DmaBufAllocator.cpp
+++ b/media/codec2/vndk/C2DmaBufAllocator.cpp
@@ -16,13 +16,11 @@
//#define LOG_NDEBUG 0
#define LOG_TAG "C2DmaBufAllocator"
-
#include <BufferAllocator/BufferAllocator.h>
#include <C2Buffer.h>
#include <C2Debug.h>
#include <C2DmaBufAllocator.h>
#include <C2ErrnoUtils.h>
-
#include <linux/ion.h>
#include <sys/mman.h>
#include <unistd.h> // getpagesize, size_t, close, dup
@@ -30,15 +28,14 @@
#include <list>
+#ifdef __ANDROID_APEX__
#include <android-base/properties.h>
+#endif
namespace android {
namespace {
- constexpr size_t USAGE_LRU_CACHE_SIZE = 1024;
-
- // max padding after ion/dmabuf allocations in bytes
- constexpr uint32_t MAX_PADDING = 0x8000; // 32KB
+constexpr size_t USAGE_LRU_CACHE_SIZE = 1024;
}
/* =========================== BUFFER HANDLE =========================== */
@@ -252,23 +249,9 @@
int bufferFd = -1;
int ret = 0;
- // NOTE: read this property directly from the property as this code has to run on
- // Android Q, but the sysprop was only introduced in Android S.
- static size_t sPadding =
- base::GetUintProperty("media.c2.dmabuf.padding", (uint32_t)0, MAX_PADDING);
- if (sPadding > SIZE_MAX - size) {
- // size would overflow
- ALOGD("dmabuf_alloc: size #%zx cannot accommodate padding #%zx", size, sPadding);
- ret = -ENOMEM;
- } else {
- size_t allocSize = size + sPadding;
- bufferFd = alloc.Alloc(heap_name, allocSize, flags);
- if (bufferFd < 0) {
- ret = bufferFd;
- }
- }
+ bufferFd = alloc.Alloc(heap_name, size, flags);
+ if (bufferFd < 0) ret = bufferFd;
- // this may be a non-working handle if bufferFd is negative
mHandle = C2HandleBuf(bufferFd, size);
mId = id;
mInit = c2_status_t(c2_map_errno<ENOMEM, EACCES, EINVAL>(ret));