aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChih-Yu Huang <akahuang@google.com>2021-11-18 19:30:57 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-11-18 19:30:57 +0000
commit18986b234ebab5faf97f8e073193111a30751222 (patch)
treefdfe4b315362ac6c82ce5aea5c76d33f9e1be38c
parent9cb7cb3ffba46830d6b560f50f36f408948e3403 (diff)
parentcec802b9d3773893a2756abc3e737530676381a1 (diff)
downloadv4l2_codec2-18986b234ebab5faf97f8e073193111a30751222.tar.gz
plugin_store: split getDmabufId() function to dedicated file am: cec802b9d3
Original change: https://googleplex-android-review.googlesource.com/c/platform/external/v4l2_codec2/+/16241005 Change-Id: I0c5dd2fee99c25f623f65705cd2d7ed3666ce5a1
-rw-r--r--plugin_store/Android.bp1
-rw-r--r--plugin_store/C2VdaBqBlockPool.cpp18
-rw-r--r--plugin_store/include/v4l2_codec2/plugin_store/C2VdaBqBlockPool.h4
3 files changed, 2 insertions, 21 deletions
diff --git a/plugin_store/Android.bp b/plugin_store/Android.bp
index c6f313c..621cbfc 100644
--- a/plugin_store/Android.bp
+++ b/plugin_store/Android.bp
@@ -18,6 +18,7 @@ cc_library_shared {
srcs: [
"C2VdaBqBlockPool.cpp",
"C2VdaPooledBlockPool.cpp",
+ "DmabufHelpers.cpp",
"H2BGraphicBufferProducer.cpp",
"V4L2PluginStore.cpp",
"VendorAllocatorLoader.cpp",
diff --git a/plugin_store/C2VdaBqBlockPool.cpp b/plugin_store/C2VdaBqBlockPool.cpp
index 4a4198f..8271d81 100644
--- a/plugin_store/C2VdaBqBlockPool.cpp
+++ b/plugin_store/C2VdaBqBlockPool.cpp
@@ -9,9 +9,6 @@
#include <errno.h>
#include <string.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
#include <chrono>
#include <mutex>
@@ -27,6 +24,7 @@
#include <log/log.h>
#include <ui/BufferQueueDefs.h>
+#include <v4l2_codec2/plugin_store/DmabufHelpers.h>
#include <v4l2_codec2/plugin_store/H2BGraphicBufferProducer.h>
#include <v4l2_codec2/plugin_store/V4L2AllocatorId.h>
@@ -54,20 +52,6 @@ using ::android::BufferQueueDefs::NUM_BUFFER_SLOTS;
using ::android::hardware::Return;
using HProducerListener = ::android::hardware::graphics::bufferqueue::V2_0::IProducerListener;
-std::optional<unique_id_t> getDmabufId(int dmabufFd) {
- struct stat sb {};
- if (fstat(dmabufFd, &sb) != 0) {
- return std::nullopt;
- }
-
- if (sb.st_size == 0) {
- ALOGE("Dma-buf size is 0. Please check your kernel is v5.3+");
- return std::nullopt;
- }
-
- return static_cast<unique_id_t>(sb.st_ino);
-}
-
static c2_status_t asC2Error(status_t err) {
switch (err) {
case OK:
diff --git a/plugin_store/include/v4l2_codec2/plugin_store/C2VdaBqBlockPool.h b/plugin_store/include/v4l2_codec2/plugin_store/C2VdaBqBlockPool.h
index fe66410..fde6299 100644
--- a/plugin_store/include/v4l2_codec2/plugin_store/C2VdaBqBlockPool.h
+++ b/plugin_store/include/v4l2_codec2/plugin_store/C2VdaBqBlockPool.h
@@ -16,10 +16,6 @@
namespace android {
-// We use the value of dma-buf inode as the unique ID of the graphic buffers.
-using unique_id_t = uint32_t;
-std::optional<unique_id_t> getDmabufId(int dmabufFd);
-
/**
* The BufferQueue-backed block pool design which supports to request arbitrary count of graphic
* buffers from IGBP, and use this buffer set among codec component and client.