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
diff --git a/libs/gui/tests/SurfaceTextureGLToGL_test.cpp b/libs/gui/tests/SurfaceTextureGLToGL_test.cpp
index b3f6066..c28b4d1 100644
--- a/libs/gui/tests/SurfaceTextureGLToGL_test.cpp
+++ b/libs/gui/tests/SurfaceTextureGLToGL_test.cpp
@@ -33,6 +33,8 @@
     // 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 @@
     // 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, EglDestroySurfaceUnrefsBuffers) {
+    SetUpWindowAndContext();
     sp<GraphicBuffer> buffers[2];
 
     // This test requires async mode to run on a single thread.
@@ -197,6 +202,7 @@
 }
 
 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, EglMakeCurrentBeforeConsumerDeathUnrefsBuffers) {
+    SetUpWindowAndContext();
     sp<GraphicBuffer> buffer;
 
     EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mProducerEglSurface,
@@ -291,6 +298,7 @@
 }
 
 TEST_F(SurfaceTextureGLToGLTest, EglMakeCurrentAfterConsumerDeathUnrefsBuffers) {
+    SetUpWindowAndContext();
     sp<GraphicBuffer> buffer;
 
     EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mProducerEglSurface,
@@ -335,6 +343,8 @@
     // 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 @@
     // 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 @@
     // 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);