Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e1bf47dd authored by Jim Shargo's avatar Jim Shargo
Browse files

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
parent 76f52cc2
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -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;
};