summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jim Shargo <jshargo@google.com> 2024-07-30 00:06:27 +0000
committer Jim Shargo <jshargo@google.com> 2024-08-24 00:15:58 +0000
commite1bf47dd3c2d7e1672d5cc7033c9976443e5bb4a (patch)
tree2bba6873a49dca9cc09449bc3c0097a2f81cec07
parent76f52cc2a5589772ecdd98b65a80b27b1d6c274a (diff)
nativewindow: ConsumerBase-based classes now create their own BufferQueues
Using ConsumerBase-based classes is now the recommended way to create BufferQueues. This is an important step for go/warren-buffers, because it consolidates usages of BufferQueues to supported APIs and reduces the libgui API surface that exposes IGBP/IGBC. BYPASS_IGBP_IGBC_API_REASON: this CL is part of the migration. Bug: 340933754 Flag: com.android.graphics.libgui.flags.wb_consumer_base_owns_bq Test: atest, presubmit, compiles Change-Id: I51100792987d144da9303ebcf9e5a6e674754b99
-rw-r--r--libs/nativewindow/tests/ANativeWindowTest.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/libs/nativewindow/tests/ANativeWindowTest.cpp b/libs/nativewindow/tests/ANativeWindowTest.cpp
index 6cf8291da2..937ff02241 100644
--- a/libs/nativewindow/tests/ANativeWindowTest.cpp
+++ b/libs/nativewindow/tests/ANativeWindowTest.cpp
@@ -50,9 +50,14 @@ protected:
const ::testing::TestInfo* const test_info =
::testing::UnitTest::GetInstance()->current_test_info();
ALOGV("**** Setting up for %s.%s\n", test_info->test_case_name(), test_info->name());
+#if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_CONSUMER_BASE_OWNS_BQ)
+ mItemConsumer = new BufferItemConsumer(GRALLOC_USAGE_SW_READ_OFTEN);
+ mWindow = new TestableSurface(mItemConsumer->getSurface()->getIGraphicBufferProducer());
+#else
BufferQueue::createBufferQueue(&mProducer, &mConsumer);
mItemConsumer = new BufferItemConsumer(mConsumer, GRALLOC_USAGE_SW_READ_OFTEN);
mWindow = new TestableSurface(mProducer);
+#endif // COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_CONSUMER_BASE_OWNS_BQ)
const int success = native_window_api_connect(mWindow.get(), NATIVE_WINDOW_API_CPU);
EXPECT_EQ(0, success);
}
@@ -64,10 +69,12 @@ protected:
const int success = native_window_api_disconnect(mWindow.get(), NATIVE_WINDOW_API_CPU);
EXPECT_EQ(0, success);
}
+
+#if !COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_CONSUMER_BASE_OWNS_BQ)
sp<IGraphicBufferProducer> mProducer;
sp<IGraphicBufferConsumer> mConsumer;
+#endif // COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_CONSUMER_BASE_OWNS_BQ)
sp<BufferItemConsumer> mItemConsumer;
-
sp<TestableSurface> mWindow;
};