Merge "Make the tv tuner hal use libdmabufheap instead of libion" am: 5001056e0f am: 4448d5ff1e am: 5df8053163

Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1610134

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I37f564aac29a00985d41ac8b5d18c0cc4da7df5c
This commit is contained in:
Amy Zhang
2021-03-09 22:14:41 +00:00
committed by Automerger Merge Worker
2 changed files with 10 additions and 8 deletions

View File

@@ -33,7 +33,7 @@ cc_defaults {
"libfmq",
"libhidlbase",
"libhidlmemory",
"libion",
"libdmabufheap",
"liblog",
"libstagefright_foundation",
"libutils",

View File

@@ -16,9 +16,11 @@
#define LOG_TAG "android.hardware.tv.tuner@1.0-Filter"
#include "Filter.h"
#include <BufferAllocator/BufferAllocator.h>
#include <utils/Log.h>
#include "Filter.h"
namespace android {
namespace hardware {
namespace tv {
@@ -622,15 +624,15 @@ void Filter::detachFilterFromRecord() {
}
int Filter::createAvIonFd(int size) {
// Create an ion fd and allocate an av fd mapped to a buffer to it.
int ion_fd = ion_open();
if (ion_fd == -1) {
ALOGE("[Filter] Failed to open ion fd %d", errno);
// Create an DMA-BUF fd and allocate an av fd mapped to a buffer to it.
auto buffer_allocator = std::make_unique<BufferAllocator>();
if (!buffer_allocator) {
ALOGE("[Filter] Unable to create BufferAllocator object");
return -1;
}
int av_fd = -1;
ion_alloc_fd(dup(ion_fd), size, 0 /*align*/, ION_HEAP_SYSTEM_MASK, 0 /*flags*/, &av_fd);
if (av_fd == -1) {
av_fd = buffer_allocator->Alloc("system-uncached", size);
if (av_fd < 0) {
ALOGE("[Filter] Failed to create av fd %d", errno);
return -1;
}