summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Pablo Ceballos <pceballos@google.com> 2015-10-06 11:14:51 -0700
committer Pablo Ceballos <pceballos@google.com> 2015-10-06 11:14:51 -0700
commitb687a2814ca9db576eb1ea33dea90ac35cd61bc1 (patch)
tree53711a9c63dfb60f7a19b64b7028112b03ce173c
parent200316cce07b280d46ef3e407dd83f89f72452b8 (diff)
BQ: fix Volantis test failures
The Volantis driver will dequeue a buffer in eglCreateWindowSurface. - Remove the requirement that no buffers be dequeued when calling setAsyncMode() on a BufferQueueProducer, since this gets called from eglSwapInterval. - Modify the tests to call setMaxDequeuedBufferCount before calling eglCreateWindowSurface. Change-Id: Icc64e9933f151771bbd57035549cd5928c0b7216
-rw-r--r--include/gui/IGraphicBufferProducer.h8
-rw-r--r--libs/gui/BufferQueueProducer.cpp8
-rw-r--r--libs/gui/tests/IGraphicBufferProducer_test.cpp4
-rw-r--r--libs/gui/tests/SurfaceTextureGLThreadToGL_test.cpp10
-rw-r--r--libs/gui/tests/SurfaceTextureGLToGL.h2
-rw-r--r--libs/gui/tests/SurfaceTextureGLToGL_test.cpp14
6 files changed, 28 insertions, 18 deletions
diff --git a/include/gui/IGraphicBufferProducer.h b/include/gui/IGraphicBufferProducer.h
index be1874a18f..b8cba2f430 100644
--- a/include/gui/IGraphicBufferProducer.h
+++ b/include/gui/IGraphicBufferProducer.h
@@ -113,14 +113,10 @@ public:
// allow for the asynchronous behavior. If it is not enabled queue/dequeue
// calls may block.
//
- // This function should not be called when there are any currently dequeued
- // buffer slots, doing so will result in a BAD_VALUE error.
- //
// Return of a value other than NO_ERROR means an error has occurred:
// * NO_INIT - the buffer queue has been abandoned.
- // * BAD_VALUE - one of the below conditions occurred:
- // * client has one or more buffers dequeued
- // * this call would cause the maxBufferCount value to be exceeded
+ // * BAD_VALUE - this call would cause the maxBufferCount value to be
+ // exceeded
virtual status_t setAsyncMode(bool async) = 0;
// dequeueBuffer requests a new buffer slot for the client to use. Ownership
diff --git a/libs/gui/BufferQueueProducer.cpp b/libs/gui/BufferQueueProducer.cpp
index deec3305b8..0cb018ccae 100644
--- a/libs/gui/BufferQueueProducer.cpp
+++ b/libs/gui/BufferQueueProducer.cpp
@@ -159,14 +159,6 @@ status_t BufferQueueProducer::setAsyncMode(bool async) {
return NO_INIT;
}
- // There must be no dequeued buffers when changing the async mode.
- for (int s = 0; s < BufferQueueDefs::NUM_BUFFER_SLOTS; ++s) {
- if (mSlots[s].mBufferState == BufferSlot::DEQUEUED) {
- BQ_LOGE("setAsyncMode: buffer owned by producer");
- return BAD_VALUE;
- }
- }
-
if ((mCore->mMaxAcquiredBufferCount + mCore->mMaxDequeuedBufferCount +
(async || mCore->mDequeueBufferCannotBlock ? 1 : 0)) >
mCore->mMaxBufferCount) {
diff --git a/libs/gui/tests/IGraphicBufferProducer_test.cpp b/libs/gui/tests/IGraphicBufferProducer_test.cpp
index 7455cd9c19..882b14cb13 100644
--- a/libs/gui/tests/IGraphicBufferProducer_test.cpp
+++ b/libs/gui/tests/IGraphicBufferProducer_test.cpp
@@ -616,10 +616,6 @@ TEST_F(IGraphicBufferProducerTest, SetAsyncMode_Fails) {
TEST_PRODUCER_USAGE_BITS))) << "slot: " << dequeuedSlot;
}
- // Client has one or more buffers dequeued
- EXPECT_EQ(BAD_VALUE, mProducer->setAsyncMode(false)) << "asyncMode: "
- << false;
-
// Abandon buffer queue
ASSERT_OK(mConsumer->consumerDisconnect());
diff --git a/libs/gui/tests/SurfaceTextureGLThreadToGL_test.cpp b/libs/gui/tests/SurfaceTextureGLThreadToGL_test.cpp
index b4e25f3a4f..c4d0aaa4bb 100644
--- a/libs/gui/tests/SurfaceTextureGLThreadToGL_test.cpp
+++ b/libs/gui/tests/SurfaceTextureGLThreadToGL_test.cpp
@@ -31,6 +31,8 @@ TEST_F(SurfaceTextureGLThreadToGLTest,
}
};
+ SetUpWindowAndContext();
+
runProducerThread(new PT());
mFC->waitForFrame();
@@ -50,6 +52,8 @@ TEST_F(SurfaceTextureGLThreadToGLTest,
}
};
+ SetUpWindowAndContext();
+
runProducerThread(new PT());
mFC->waitForFrame();
@@ -75,6 +79,8 @@ TEST_F(SurfaceTextureGLThreadToGLTest,
}
};
+ SetUpWindowAndContext();
+
runProducerThread(new PT());
for (int i = 0; i < NUM_ITERATIONS; i++) {
@@ -104,6 +110,8 @@ TEST_F(SurfaceTextureGLThreadToGLTest,
}
};
+ SetUpWindowAndContext();
+
runProducerThread(new PT());
for (int i = 0; i < NUM_ITERATIONS; i++) {
@@ -134,6 +142,8 @@ TEST_F(SurfaceTextureGLThreadToGLTest,
}
};
+ SetUpWindowAndContext();
+
runProducerThread(new PT());
// Allow three frames to be rendered and queued before starting the
diff --git a/libs/gui/tests/SurfaceTextureGLToGL.h b/libs/gui/tests/SurfaceTextureGLToGL.h
index 5a2eff3951..5d43a48898 100644
--- a/libs/gui/tests/SurfaceTextureGLToGL.h
+++ b/libs/gui/tests/SurfaceTextureGLToGL.h
@@ -34,7 +34,9 @@ protected:
virtual void SetUp() {
SurfaceTextureGLTest::SetUp();
+ }
+ void SetUpWindowAndContext() {
mProducerEglSurface = eglCreateWindowSurface(mEglDisplay, mGlConfig,
mANW.get(), NULL);
ASSERT_EQ(EGL_SUCCESS, eglGetError());
diff --git a/libs/gui/tests/SurfaceTextureGLToGL_test.cpp b/libs/gui/tests/SurfaceTextureGLToGL_test.cpp
index b3f606691d..c28b4d141c 100644
--- a/libs/gui/tests/SurfaceTextureGLToGL_test.cpp
+++ b/libs/gui/tests/SurfaceTextureGLToGL_test.cpp
@@ -33,6 +33,8 @@ TEST_F(SurfaceTextureGLToGLTest, TransformHintGetsRespected) {
// to 2, and max acquired already defaults to 1.
ASSERT_EQ(OK, mSTC->setMaxDequeuedBufferCount(2));
+ SetUpWindowAndContext();
+
// Do the producer side of things
EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mProducerEglSurface,
mProducerEglSurface, mProducerEglContext));
@@ -85,6 +87,8 @@ TEST_F(SurfaceTextureGLToGLTest, TexturingFromGLFilledRGBABufferPow2) {
// Set max dequeued to 2, and max acquired already defaults to 1.
ASSERT_EQ(OK, mSTC->setMaxDequeuedBufferCount(2));
+ SetUpWindowAndContext();
+
// Do the producer side of things
EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mProducerEglSurface,
mProducerEglSurface, mProducerEglContext));
@@ -152,6 +156,7 @@ TEST_F(SurfaceTextureGLToGLTest, TexturingFromGLFilledRGBABufferPow2) {
}
TEST_F(SurfaceTextureGLToGLTest, EglDestroySurfaceUnrefsBuffers) {
+ SetUpWindowAndContext();
sp<GraphicBuffer> buffers[2];
// This test requires async mode to run on a single thread.
@@ -197,6 +202,7 @@ TEST_F(SurfaceTextureGLToGLTest, EglDestroySurfaceUnrefsBuffers) {
}
TEST_F(SurfaceTextureGLToGLTest, EglDestroySurfaceAfterAbandonUnrefsBuffers) {
+ SetUpWindowAndContext();
sp<GraphicBuffer> buffers[3];
// This test requires async mode to run on a single thread.
@@ -254,6 +260,7 @@ TEST_F(SurfaceTextureGLToGLTest, EglDestroySurfaceAfterAbandonUnrefsBuffers) {
}
TEST_F(SurfaceTextureGLToGLTest, EglMakeCurrentBeforeConsumerDeathUnrefsBuffers) {
+ SetUpWindowAndContext();
sp<GraphicBuffer> buffer;
EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mProducerEglSurface,
@@ -291,6 +298,7 @@ TEST_F(SurfaceTextureGLToGLTest, EglMakeCurrentBeforeConsumerDeathUnrefsBuffers)
}
TEST_F(SurfaceTextureGLToGLTest, EglMakeCurrentAfterConsumerDeathUnrefsBuffers) {
+ SetUpWindowAndContext();
sp<GraphicBuffer> buffer;
EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mProducerEglSurface,
@@ -335,6 +343,8 @@ TEST_F(SurfaceTextureGLToGLTest, TexturingFromUserSizedGLFilledBuffer) {
// Set max dequeued to 2, and max acquired already defaults to 1.
ASSERT_EQ(OK, mSTC->setMaxDequeuedBufferCount(2));
+ SetUpWindowAndContext();
+
// Set the user buffer size.
native_window_set_buffers_user_dimensions(mANW.get(), texWidth, texHeight);
@@ -393,6 +403,8 @@ TEST_F(SurfaceTextureGLToGLTest, TexturingFromPreRotatedUserSizedGLFilledBuffer)
// Set max dequeued to 2, and max acquired already defaults to 1.
ASSERT_EQ(OK, mSTC->setMaxDequeuedBufferCount(2));
+ SetUpWindowAndContext();
+
// Set the transform hint.
mST->setTransformHint(NATIVE_WINDOW_TRANSFORM_ROT_90);
@@ -455,6 +467,8 @@ TEST_F(SurfaceTextureGLToGLTest, TexturingFromPreRotatedGLFilledBuffer) {
// Set max dequeued to 2, and max acquired already defaults to 1.
ASSERT_EQ(OK, mSTC->setMaxDequeuedBufferCount(2));
+ SetUpWindowAndContext();
+
// Set the transform hint.
mST->setTransformHint(NATIVE_WINDOW_TRANSFORM_ROT_90);