From 2adaf04fab35cf47c824d74d901b54094e01ccd3 Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Tue, 18 Dec 2012 09:49:45 -0800 Subject: Rename ISurfaceTexture and SurfaceTexture The C++ class names don't match what the classes do, so rename ISurfaceTexture to IGraphicBufferProducer, and SurfaceTexture to GLConsumer. Bug 7736700 Change-Id: Ia03e468888025b5cae3c0ee1995434515dbea387 --- libs/gui/tests/BufferQueue_test.cpp | 8 +++--- libs/gui/tests/SurfaceTextureClient_test.cpp | 14 +++++----- libs/gui/tests/SurfaceTexture_test.cpp | 38 ++++++++++++++-------------- 3 files changed, 30 insertions(+), 30 deletions(-) (limited to 'libs/gui/tests') diff --git a/libs/gui/tests/BufferQueue_test.cpp b/libs/gui/tests/BufferQueue_test.cpp index 817abb4837..12cbfb0d7d 100644 --- a/libs/gui/tests/BufferQueue_test.cpp +++ b/libs/gui/tests/BufferQueue_test.cpp @@ -63,19 +63,19 @@ struct DummyConsumer : public BufferQueue::ConsumerListener { TEST_F(BufferQueueTest, AcquireBuffer_ExceedsMaxAcquireCount_Fails) { sp dc(new DummyConsumer); mBQ->consumerConnect(dc); - ISurfaceTexture::QueueBufferOutput qbo; + IGraphicBufferProducer::QueueBufferOutput qbo; mBQ->connect(NATIVE_WINDOW_API_CPU, &qbo); mBQ->setBufferCount(4); int slot; sp fence; sp buf; - ISurfaceTexture::QueueBufferInput qbi(0, Rect(0, 0, 1, 1), + IGraphicBufferProducer::QueueBufferInput qbi(0, Rect(0, 0, 1, 1), NATIVE_WINDOW_SCALING_MODE_FREEZE, 0, fence); BufferQueue::BufferItem item; for (int i = 0; i < 2; i++) { - ASSERT_EQ(ISurfaceTexture::BUFFER_NEEDS_REALLOCATION, + ASSERT_EQ(IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION, mBQ->dequeueBuffer(&slot, fence, 1, 1, 0, GRALLOC_USAGE_SW_READ_OFTEN)); ASSERT_EQ(OK, mBQ->requestBuffer(slot, &buf)); @@ -83,7 +83,7 @@ TEST_F(BufferQueueTest, AcquireBuffer_ExceedsMaxAcquireCount_Fails) { ASSERT_EQ(OK, mBQ->acquireBuffer(&item)); } - ASSERT_EQ(ISurfaceTexture::BUFFER_NEEDS_REALLOCATION, + ASSERT_EQ(IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION, mBQ->dequeueBuffer(&slot, fence, 1, 1, 0, GRALLOC_USAGE_SW_READ_OFTEN)); ASSERT_EQ(OK, mBQ->requestBuffer(slot, &buf)); diff --git a/libs/gui/tests/SurfaceTextureClient_test.cpp b/libs/gui/tests/SurfaceTextureClient_test.cpp index baeca0652d..2df83a08d0 100644 --- a/libs/gui/tests/SurfaceTextureClient_test.cpp +++ b/libs/gui/tests/SurfaceTextureClient_test.cpp @@ -40,7 +40,7 @@ protected: ALOGV("Begin test: %s.%s", testInfo->test_case_name(), testInfo->name()); - mST = new SurfaceTexture(123); + mST = new GLConsumer(123); mSTC = new SurfaceTextureClient(mST->getBufferQueue()); mANW = mSTC; @@ -102,7 +102,7 @@ protected: return sDefaultConfigAttribs; } - sp mST; + sp mST; sp mSTC; sp mANW; @@ -112,7 +112,7 @@ protected: }; TEST_F(SurfaceTextureClientTest, GetISurfaceTextureIsNotNull) { - sp ist(mSTC->getISurfaceTexture()); + sp ist(mSTC->getISurfaceTexture()); ASSERT_TRUE(ist != NULL); } @@ -250,7 +250,7 @@ TEST_F(SurfaceTextureClientTest, BufferGeometrySizeCanBeChangedWithoutFormat) { } TEST_F(SurfaceTextureClientTest, SurfaceTextureSetDefaultSize) { - sp st(mST); + sp st(mST); ANativeWindowBuffer* buf; EXPECT_EQ(OK, st->setDefaultBufferSize(16, 8)); ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf)); @@ -464,7 +464,7 @@ TEST_F(SurfaceTextureClientTest, SetCropCropsCrop) { // from the SurfaceTexture class. TEST_F(SurfaceTextureClientTest, DISABLED_SurfaceTextureSyncModeWaitRetire) { class MyThread : public Thread { - sp mST; + sp mST; EGLContext ctx; EGLSurface sur; EGLDisplay dpy; @@ -480,7 +480,7 @@ TEST_F(SurfaceTextureClientTest, DISABLED_SurfaceTextureSyncModeWaitRetire) { return false; } public: - MyThread(const sp& mST) + MyThread(const sp& mST) : mST(mST), mBufferRetired(false) { ctx = eglGetCurrentContext(); sur = eglGetCurrentSurface(EGL_DRAW); @@ -685,7 +685,7 @@ protected: ASSERT_NE(EGL_NO_CONTEXT, mEglContext); for (int i = 0; i < NUM_SURFACE_TEXTURES; i++) { - sp st(new SurfaceTexture(i)); + sp st(new GLConsumer(i)); sp stc(new SurfaceTextureClient(st->getBufferQueue())); mEglSurfaces[i] = eglCreateWindowSurface(mEglDisplay, myConfig, static_cast(stc.get()), NULL); diff --git a/libs/gui/tests/SurfaceTexture_test.cpp b/libs/gui/tests/SurfaceTexture_test.cpp index 58976adbaf..b6020ca2af 100644 --- a/libs/gui/tests/SurfaceTexture_test.cpp +++ b/libs/gui/tests/SurfaceTexture_test.cpp @@ -18,7 +18,7 @@ //#define LOG_NDEBUG 0 #include -#include +#include #include #include #include @@ -384,7 +384,7 @@ protected: virtual void SetUp() { GLTest::SetUp(); - mST = new SurfaceTexture(TEX_ID); + mST = new GLConsumer(TEX_ID); mSTC = new SurfaceTextureClient(mST->getBufferQueue()); mANW = mSTC; mTextureRenderer = new TextureRenderer(TEX_ID, mST); @@ -406,7 +406,7 @@ protected: class TextureRenderer: public RefBase { public: - TextureRenderer(GLuint texName, const sp& st): + TextureRenderer(GLuint texName, const sp& st): mTexName(texName), mST(st) { } @@ -447,7 +447,7 @@ protected: ASSERT_NE(-1, mTexMatrixHandle); } - // drawTexture draws the SurfaceTexture over the entire GL viewport. + // drawTexture draws the GLConsumer over the entire GL viewport. void drawTexture() { static const GLfloat triangleVertices[] = { -1.0f, 1.0f, @@ -494,14 +494,14 @@ protected: } GLuint mTexName; - sp mST; + sp mST; GLuint mPgm; GLint mPositionHandle; GLint mTexSamplerHandle; GLint mTexMatrixHandle; }; - class FrameWaiter : public SurfaceTexture::FrameAvailableListener { + class FrameWaiter : public GLConsumer::FrameAvailableListener { public: FrameWaiter(): mPendingFrames(0) { @@ -526,7 +526,7 @@ protected: Condition mCondition; }; - // Note that SurfaceTexture will lose the notifications + // Note that GLConsumer will lose the notifications // onBuffersReleased and onFrameAvailable as there is currently // no way to forward the events. This DisconnectWaiter will not let the // disconnect finish until finishDisconnect() is called. It will @@ -575,7 +575,7 @@ protected: Condition mFrameCondition; }; - sp mST; + sp mST; sp mSTC; sp mANW; sp mTextureRenderer; @@ -1070,7 +1070,7 @@ TEST_F(SurfaceTextureGLTest, TexturingFromCpuFilledRGBABufferPow2) { EXPECT_TRUE(checkPixel( 3, 52, 35, 231, 35, 35)); } -// Tests if SurfaceTexture and BufferQueue are robust enough +// Tests if GLConsumer and BufferQueue are robust enough // to handle a special case where updateTexImage is called // in the middle of disconnect. This ordering is enforced // by blocking in the disconnect callback. @@ -1123,12 +1123,12 @@ TEST_F(SurfaceTextureGLTest, DisconnectStressTest) { sp pt(new ProducerThread(mANW)); pt->run(); - // eat a frame so SurfaceTexture will own an at least one slot + // eat a frame so GLConsumer will own an at least one slot dw->waitForFrame(); EXPECT_EQ(OK,mST->updateTexImage()); dw->waitForFrame(); - // Could fail here as SurfaceTexture thinks it still owns the slot + // Could fail here as GLConsumer thinks it still owns the slot // but bufferQueue has released all slots EXPECT_EQ(OK,mST->updateTexImage()); @@ -1136,7 +1136,7 @@ TEST_F(SurfaceTextureGLTest, DisconnectStressTest) { } -// This test ensures that the SurfaceTexture clears the mCurrentTexture +// This test ensures that the GLConsumer clears the mCurrentTexture // when it is disconnected and reconnected. Otherwise it will // attempt to release a buffer that it does not owned TEST_F(SurfaceTextureGLTest, DisconnectClearsCurrentTexture) { @@ -1581,7 +1581,7 @@ TEST_F(SurfaceTextureGLToGLTest, EglDestroySurfaceUnrefsBuffers) { // This test should have the only reference to buffer 0. EXPECT_EQ(1, buffers[0]->getStrongCount()); - // The SurfaceTexture should hold a single reference to buffer 1 in its + // The GLConsumer should hold a single reference to buffer 1 in its // mCurrentBuffer member. All of the references in the slots should have // been released. EXPECT_EQ(2, buffers[1]->getStrongCount()); @@ -1615,7 +1615,7 @@ TEST_F(SurfaceTextureGLToGLTest, EglDestroySurfaceAfterAbandonUnrefsBuffers) { buffers[i] = mST->getCurrentBuffer(); } - // Abandon the SurfaceTexture, releasing the ref that the SurfaceTexture has + // Abandon the GLConsumer, releasing the ref that the GLConsumer has // on buffers[2]. mST->abandon(); @@ -1847,7 +1847,7 @@ TEST_F(SurfaceTextureGLToGLTest, TexturingFromPreRotatedGLFilledBuffer) { * This test fixture is for testing GL -> GL texture streaming from one thread * to another. It contains functionality to create a producer thread that will * perform GL rendering to an ANativeWindow that feeds frames to a - * SurfaceTexture. Additionally it supports interlocking the producer and + * GLConsumer. Additionally it supports interlocking the producer and * consumer threads so that a specific sequence of calls can be * deterministically created by the test. * @@ -1914,13 +1914,13 @@ protected: // FrameCondition is a utility class for interlocking between the producer // and consumer threads. The FrameCondition object should be created and // destroyed in the consumer thread only. The consumer thread should set - // the FrameCondition as the FrameAvailableListener of the SurfaceTexture, + // the FrameCondition as the FrameAvailableListener of the GLConsumer, // and should call both waitForFrame and finishFrame once for each expected // frame. // // This interlocking relies on the fact that onFrameAvailable gets called - // synchronously from SurfaceTexture::queueBuffer. - class FrameCondition : public SurfaceTexture::FrameAvailableListener { + // synchronously from GLConsumer::queueBuffer. + class FrameCondition : public GLConsumer::FrameAvailableListener { public: FrameCondition(): mFrameAvailable(false), @@ -1951,7 +1951,7 @@ protected: ALOGV("-finishFrame"); } - // This should be called by SurfaceTexture on the producer thread. + // This should be called by GLConsumer on the producer thread. virtual void onFrameAvailable() { Mutex::Autolock lock(mMutex); ALOGV("+onFrameAvailable"); -- cgit v1.2.3-59-g8ed1b