summaryrefslogtreecommitdiffstats
path: root/libs/gui
diff options
context:
space:
mode:
authorJamie Gennis <jgennis@google.com>2011-11-19 18:04:43 -0800
committerJamie Gennis <jgennis@google.com>2011-11-21 14:37:29 -0800
commit87f3265bb082160efdfdfb87a79698c67ebad447 (patch)
treea9eb05cf1cb1a6d59d1dafe806c843aee10daa76 /libs/gui
parentc10a94c4b8b42ef75168ad140fdb97d6cca3d2eb (diff)
downloadframeworks_base-87f3265bb082160efdfdfb87a79698c67ebad447.zip
frameworks_base-87f3265bb082160efdfdfb87a79698c67ebad447.tar.gz
frameworks_base-87f3265bb082160efdfdfb87a79698c67ebad447.tar.bz2
EGL: default to swap interval 1
This change explicitly sets swap interval 1 on the window when an EGLSurface is created to render to it. Change-Id: I91eb29dbee3ae4a55076b921f084d503fbe94e03
Diffstat (limited to 'libs/gui')
-rw-r--r--libs/gui/SurfaceTexture.cpp5
-rw-r--r--libs/gui/tests/SurfaceTexture_test.cpp25
2 files changed, 30 insertions, 0 deletions
diff --git a/libs/gui/SurfaceTexture.cpp b/libs/gui/SurfaceTexture.cpp
index 0561909..1aa0e2d 100644
--- a/libs/gui/SurfaceTexture.cpp
+++ b/libs/gui/SurfaceTexture.cpp
@@ -1005,6 +1005,11 @@ uint32_t SurfaceTexture::getCurrentScalingMode() const {
return mCurrentScalingMode;
}
+bool SurfaceTexture::isSynchronousMode() const {
+ Mutex::Autolock lock(mMutex);
+ return mSynchronousMode;
+}
+
int SurfaceTexture::query(int what, int* outValue)
{
Mutex::Autolock lock(mMutex);
diff --git a/libs/gui/tests/SurfaceTexture_test.cpp b/libs/gui/tests/SurfaceTexture_test.cpp
index 4da37c9..cce18ae 100644
--- a/libs/gui/tests/SurfaceTexture_test.cpp
+++ b/libs/gui/tests/SurfaceTexture_test.cpp
@@ -1245,6 +1245,31 @@ TEST_F(SurfaceTextureGLToGLTest, EglDestroySurfaceAfterAbandonUnrefsBuffers) {
EXPECT_EQ(1, buffers[2]->getStrongCount());
}
+TEST_F(SurfaceTextureGLToGLTest, EglSurfaceDefaultsToSynchronousMode) {
+ // This test requires 3 buffers to run on a single thread.
+ mST->setBufferCountServer(3);
+
+ ASSERT_TRUE(mST->isSynchronousMode());
+
+ for (int i = 0; i < 10; i++) {
+ // Produce a frame
+ EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mProducerEglSurface,
+ mProducerEglSurface, mProducerEglContext));
+ ASSERT_EQ(EGL_SUCCESS, eglGetError());
+ glClear(GL_COLOR_BUFFER_BIT);
+ EXPECT_TRUE(eglSwapBuffers(mEglDisplay, mProducerEglSurface));
+ ASSERT_EQ(EGL_SUCCESS, eglGetError());
+
+ // Consume a frame
+ EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface,
+ mEglContext));
+ ASSERT_EQ(EGL_SUCCESS, eglGetError());
+ ASSERT_EQ(NO_ERROR, mST->updateTexImage());
+ }
+
+ ASSERT_TRUE(mST->isSynchronousMode());
+}
+
/*
* 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