diff --git a/plugin_store/Android.bp b/plugin_store/Android.bp
index c6f313c776dce62573399f6b51fdcde8ebbc3281..621cbfcd9fe27722d394923fae0a6b4f3a9a8ba0 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 4a4198fb4f1950709c98317a3b18e932cf8665a4..8271d81282e86eb504c7814347375c83ca919333 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/DmabufHelpers.cpp b/plugin_store/DmabufHelpers.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..4441d6695eb59b92e109beb3d1a899c1dd51bde1
--- /dev/null
+++ b/plugin_store/DmabufHelpers.cpp
@@ -0,0 +1,32 @@
+// Copyright 2021 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+//#define LOG_NDEBUG 0
+#define LOG_TAG "DmabufHelpers"
+
+#include <v4l2_codec2/plugin_store/DmabufHelpers.h>
+
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <log/log.h>
+
+namespace android {
+
+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);
+}
+
+}  // namespace android
diff --git a/plugin_store/include/v4l2_codec2/plugin_store/C2VdaBqBlockPool.h b/plugin_store/include/v4l2_codec2/plugin_store/C2VdaBqBlockPool.h
index fe66410ccebbac3e343e56e214ba8be5e047d383..fde62998a16aa7b9ddb147affa9d6fe0df3f1aeb 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.
diff --git a/plugin_store/include/v4l2_codec2/plugin_store/DmabufHelpers.h b/plugin_store/include/v4l2_codec2/plugin_store/DmabufHelpers.h
new file mode 100644
index 0000000000000000000000000000000000000000..dd38feedd88035f96ff35a7c91b3a2b2239b4d8a
--- /dev/null
+++ b/plugin_store/include/v4l2_codec2/plugin_store/DmabufHelpers.h
@@ -0,0 +1,20 @@
+// Copyright 2021 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ANDROID_V4L2_CODEC2_PLUGIN_STORE_DMABUF_HELPERS_H
+#define ANDROID_V4L2_CODEC2_PLUGIN_STORE_DMABUF_HELPERS_H
+
+#include <inttypes.h>
+
+#include <optional>
+
+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);
+
+}  // namespace android
+
+#endif  // ANDROID_V4L2_CODEC2_PLUGIN_STORE_DMABUF_HELPERS_H