From 43345160c5829b02393fd2bb3105d32668401702 Mon Sep 17 00:00:00 2001 From: MediaPipe Team Date: Tue, 18 Oct 2022 11:55:19 -0700 Subject: [PATCH] Add ImageFrame and GlTexture view providers to Ahwb GpuBuffer storage - ImageFrame views are backed by CPU locks of the AHWB. - GlTextureViews are managed through a GlTextureBuffer connected to the AHWB allocation. This improves the latency of heterogeneous access sequences, but makes `ImageFrame > ImageFrame` sequences slower due to CPU locking. PiperOrigin-RevId: 481982546 --- mediapipe/gpu/BUILD | 3 +++ mediapipe/gpu/gl_texture_view.h | 1 + mediapipe/gpu/gpu_buffer_test.cc | 1 + 3 files changed, 5 insertions(+) diff --git a/mediapipe/gpu/BUILD b/mediapipe/gpu/BUILD index e3d36611c..aec2445b9 100644 --- a/mediapipe/gpu/BUILD +++ b/mediapipe/gpu/BUILD @@ -378,8 +378,11 @@ cc_library( ], }), deps = [ + ":gl_texture_buffer", ":gpu_buffer_format", ":gpu_buffer_storage", + ":image_frame_view", + "//mediapipe/framework/formats:image_frame", "@com_google_absl//absl/strings:str_format", ], ) diff --git a/mediapipe/gpu/gl_texture_view.h b/mediapipe/gpu/gl_texture_view.h index 1f0a23f31..8b47d620b 100644 --- a/mediapipe/gpu/gl_texture_view.h +++ b/mediapipe/gpu/gl_texture_view.h @@ -65,6 +65,7 @@ class GlTextureView { friend class GpuBuffer; friend class GlTextureBuffer; friend class GpuBufferStorageCvPixelBuffer; + friend class GpuBufferStorageAhwb; GlTextureView(GlContext* context, GLenum target, GLuint name, int width, int height, std::shared_ptr gpu_buffer, int plane, DetachFn detach, DoneWritingFn done_writing) diff --git a/mediapipe/gpu/gpu_buffer_test.cc b/mediapipe/gpu/gpu_buffer_test.cc index c207acf60..3fd519b21 100644 --- a/mediapipe/gpu/gpu_buffer_test.cc +++ b/mediapipe/gpu/gpu_buffer_test.cc @@ -18,6 +18,7 @@ #include "mediapipe/framework/port/gmock.h" #include "mediapipe/framework/port/gtest.h" #include "mediapipe/framework/tool/test_util.h" +#include "mediapipe/gpu/gpu_buffer_storage_ahwb.h" #include "mediapipe/gpu/gpu_buffer_storage_image_frame.h" #include "mediapipe/gpu/gpu_test_base.h" #include "stb_image.h"