mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 22:04:26 +00:00
Make the tv tuner hal use libdmabufheap instead of libion
Let the TV tuner HAL allocate DMA-BUFs fds with libdmabufheap. Devices supporting ION will continue to allocate from ION with the change. Devices that are deprecating ION will be able to allocate from the DMA-BUF heap framework instead. Both frameworks allocate DMA-BUFs, hence no other changes are required in the handling of the fd. Test: mma android.hardware.tv.tuner@1.0-service Change-Id: Ic147ed83c9097be76162a86cd4f94d3b1c27a10f
This commit is contained in:
@@ -24,7 +24,7 @@ cc_defaults {
|
||||
"libfmq",
|
||||
"libhidlbase",
|
||||
"libhidlmemory",
|
||||
"libion",
|
||||
"libdmabufheap",
|
||||
"liblog",
|
||||
"libstagefright_foundation",
|
||||
"libutils",
|
||||
|
||||
@@ -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 {
|
||||
@@ -603,15 +605,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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user