Loading include/gui/SurfaceTexture.h +0 −5 Original line number Diff line number Diff line Loading @@ -211,7 +211,6 @@ protected: // all slots. void freeAllBuffers(); static bool isExternalFormat(uint32_t format); static GLenum getTextureTarget(uint32_t format); private: Loading Loading @@ -348,10 +347,6 @@ private: // reset mCurrentTexture to INVALID_BUFFER_SLOT. int mCurrentTexture; // mCurrentTextureTarget is the GLES texture target to be used with the // current texture. GLenum mCurrentTextureTarget; // mCurrentTextureBuf is the graphic buffer of the current texture. It's // possible that this buffer is not associated with any buffer slot, so we // must track it separately in order to support the getCurrentBuffer method. Loading libs/gui/SurfaceTexture.cpp +6 −24 Original line number Diff line number Diff line Loading @@ -86,7 +86,6 @@ SurfaceTexture::SurfaceTexture(GLuint tex, bool allowSynchronousMode) : mClientBufferCount(0), mServerBufferCount(MIN_ASYNC_BUFFER_SLOTS), mCurrentTexture(INVALID_BUFFER_SLOT), mCurrentTextureTarget(GL_TEXTURE_EXTERNAL_OES), mCurrentTransform(0), mCurrentTimestamp(0), mNextTransform(0), Loading Loading @@ -651,12 +650,8 @@ status_t SurfaceTexture::updateTexImage() { LOGW("updateTexImage: clearing GL error: %#04x", error); } GLenum target = getTextureTarget(mSlots[buf].mGraphicBuffer->format); if (target != mCurrentTextureTarget) { glDeleteTextures(1, &mTexName); } glBindTexture(target, mTexName); glEGLImageTargetTexture2DOES(target, (GLeglImageOES)image); glBindTexture(GL_TEXTURE_EXTERNAL_OES, mTexName); glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES, (GLeglImageOES)image); bool failed = false; while ((error = glGetError()) != GL_NO_ERROR) { Loading @@ -678,7 +673,6 @@ status_t SurfaceTexture::updateTexImage() { // Update the SurfaceTexture state. mCurrentTexture = buf; mCurrentTextureTarget = target; mCurrentTextureBuf = mSlots[buf].mGraphicBuffer; mCurrentCrop = mSlots[buf].mCrop; mCurrentTransform = mSlots[buf].mTransform; Loading @@ -692,7 +686,7 @@ status_t SurfaceTexture::updateTexImage() { mDequeueCondition.signal(); } else { // We always bind the texture even if we don't update its contents. glBindTexture(mCurrentTextureTarget, mTexName); glBindTexture(GL_TEXTURE_EXTERNAL_OES, mTexName); } return OK; Loading @@ -717,20 +711,8 @@ bool SurfaceTexture::isExternalFormat(uint32_t format) return false; } GLenum SurfaceTexture::getTextureTarget(uint32_t format) { GLenum target = GL_TEXTURE_2D; #if defined(GL_OES_EGL_image_external) if (isExternalFormat(format)) { target = GL_TEXTURE_EXTERNAL_OES; } #endif return target; } GLenum SurfaceTexture::getCurrentTextureTarget() const { Mutex::Autolock lock(mMutex); return mCurrentTextureTarget; return GL_TEXTURE_EXTERNAL_OES; } void SurfaceTexture::getTransformMatrix(float mtx[16]) { Loading Loading @@ -959,12 +941,12 @@ void SurfaceTexture::dump(String8& result, const char* prefix, } snprintf(buffer, SIZE, "%scurrent: {crop=[%d,%d,%d,%d], transform=0x%02x, current=%d, target=0x%04x}\n" "%scurrent: {crop=[%d,%d,%d,%d], transform=0x%02x, current=%d}\n" "%snext : {crop=[%d,%d,%d,%d], transform=0x%02x, FIFO(%d)={%s}}\n" , prefix, mCurrentCrop.left, mCurrentCrop.top, mCurrentCrop.right, mCurrentCrop.bottom, mCurrentTransform, mCurrentTexture, mCurrentTextureTarget, mCurrentTransform, mCurrentTexture, prefix, mNextCrop.left, mNextCrop.top, mNextCrop.right, mNextCrop.bottom, mCurrentTransform, fifoSize, fifo.string() ); Loading libs/gui/tests/SurfaceTexture_test.cpp +14 −18 Original line number Diff line number Diff line Loading @@ -832,9 +832,7 @@ TEST_F(SurfaceTextureGLTest, TexturingFromCpuFilledYV12BuffersRepeatedly) { pt->requestExitAndWait(); } // XXX: This test is disabled because there are currently no drivers that can // handle RGBA textures with the GL_TEXTURE_EXTERNAL_OES target. TEST_F(SurfaceTextureGLTest, DISABLED_TexturingFromCpuFilledRGBABufferNpot) { TEST_F(SurfaceTextureGLTest, TexturingFromCpuFilledRGBABufferNpot) { const int texWidth = 64; const int texHeight = 66; Loading Loading @@ -871,26 +869,24 @@ TEST_F(SurfaceTextureGLTest, DISABLED_TexturingFromCpuFilledRGBABufferNpot) { EXPECT_TRUE(checkPixel( 0, 65, 35, 35, 35, 35)); EXPECT_TRUE(checkPixel(15, 10, 35, 231, 231, 231)); EXPECT_TRUE(checkPixel(24, 63, 38, 228, 231, 35)); EXPECT_TRUE(checkPixel(23, 65, 231, 35, 231, 35)); EXPECT_TRUE(checkPixel(19, 40, 35, 231, 35, 35)); EXPECT_TRUE(checkPixel(38, 30, 231, 35, 35, 35)); EXPECT_TRUE(checkPixel(42, 54, 35, 35, 35, 231)); EXPECT_TRUE(checkPixel(37, 33, 228, 38, 38, 38)); EXPECT_TRUE(checkPixel(37, 34, 35, 231, 231, 231)); EXPECT_TRUE(checkPixel(31, 8, 231, 35, 35, 231)); EXPECT_TRUE(checkPixel(36, 47, 228, 35, 231, 231)); EXPECT_TRUE(checkPixel(24, 63, 38, 228, 231, 35)); EXPECT_TRUE(checkPixel(48, 3, 228, 228, 38, 35)); EXPECT_TRUE(checkPixel(37, 47, 231, 35, 231, 231)); EXPECT_TRUE(checkPixel(25, 38, 35, 35, 35, 35)); EXPECT_TRUE(checkPixel(49, 6, 35, 231, 35, 35)); EXPECT_TRUE(checkPixel(54, 50, 35, 231, 231, 231)); EXPECT_TRUE(checkPixel(24, 25, 41, 41, 231, 231)); EXPECT_TRUE(checkPixel(10, 9, 38, 38, 231, 231)); EXPECT_TRUE(checkPixel(27, 26, 231, 231, 231, 231)); EXPECT_TRUE(checkPixel(10, 6, 35, 35, 231, 231)); EXPECT_TRUE(checkPixel(29, 4, 35, 35, 35, 231)); EXPECT_TRUE(checkPixel(56, 31, 38, 228, 231, 35)); EXPECT_TRUE(checkPixel(55, 28, 35, 35, 231, 35)); EXPECT_TRUE(checkPixel(58, 55, 35, 35, 231, 231)); } // XXX: This test is disabled because there are currently no drivers that can // handle RGBA textures with the GL_TEXTURE_EXTERNAL_OES target. TEST_F(SurfaceTextureGLTest, DISABLED_TexturingFromCpuFilledRGBABufferPow2) { TEST_F(SurfaceTextureGLTest, TexturingFromCpuFilledRGBABufferPow2) { const int texWidth = 64; const int texHeight = 64; Loading Loading @@ -944,9 +940,7 @@ TEST_F(SurfaceTextureGLTest, DISABLED_TexturingFromCpuFilledRGBABufferPow2) { EXPECT_TRUE(checkPixel( 3, 52, 35, 231, 35, 35)); } // XXX: This test is disabled because there are currently no drivers that can // handle RGBA textures with the GL_TEXTURE_EXTERNAL_OES target. TEST_F(SurfaceTextureGLTest, DISABLED_TexturingFromGLFilledRGBABufferPow2) { TEST_F(SurfaceTextureGLTest, TexturingFromGLFilledRGBABufferPow2) { const int texWidth = 64; const int texHeight = 64; Loading @@ -956,7 +950,7 @@ TEST_F(SurfaceTextureGLTest, DISABLED_TexturingFromGLFilledRGBABufferPow2) { EGLSurface stcEglSurface = eglCreateWindowSurface(mEglDisplay, mGlConfig, mANW.get(), NULL); ASSERT_EQ(EGL_SUCCESS, eglGetError()); ASSERT_NE(EGL_NO_SURFACE, mEglSurface); ASSERT_NE(EGL_NO_SURFACE, stcEglSurface); EXPECT_TRUE(eglMakeCurrent(mEglDisplay, stcEglSurface, stcEglSurface, mEglContext)); Loading @@ -980,6 +974,8 @@ TEST_F(SurfaceTextureGLTest, DISABLED_TexturingFromGLFilledRGBABufferPow2) { eglSwapBuffers(mEglDisplay, stcEglSurface); eglDestroySurface(mEglDisplay, stcEglSurface); // Do the consumer side of things EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext)); Loading Loading
include/gui/SurfaceTexture.h +0 −5 Original line number Diff line number Diff line Loading @@ -211,7 +211,6 @@ protected: // all slots. void freeAllBuffers(); static bool isExternalFormat(uint32_t format); static GLenum getTextureTarget(uint32_t format); private: Loading Loading @@ -348,10 +347,6 @@ private: // reset mCurrentTexture to INVALID_BUFFER_SLOT. int mCurrentTexture; // mCurrentTextureTarget is the GLES texture target to be used with the // current texture. GLenum mCurrentTextureTarget; // mCurrentTextureBuf is the graphic buffer of the current texture. It's // possible that this buffer is not associated with any buffer slot, so we // must track it separately in order to support the getCurrentBuffer method. Loading
libs/gui/SurfaceTexture.cpp +6 −24 Original line number Diff line number Diff line Loading @@ -86,7 +86,6 @@ SurfaceTexture::SurfaceTexture(GLuint tex, bool allowSynchronousMode) : mClientBufferCount(0), mServerBufferCount(MIN_ASYNC_BUFFER_SLOTS), mCurrentTexture(INVALID_BUFFER_SLOT), mCurrentTextureTarget(GL_TEXTURE_EXTERNAL_OES), mCurrentTransform(0), mCurrentTimestamp(0), mNextTransform(0), Loading Loading @@ -651,12 +650,8 @@ status_t SurfaceTexture::updateTexImage() { LOGW("updateTexImage: clearing GL error: %#04x", error); } GLenum target = getTextureTarget(mSlots[buf].mGraphicBuffer->format); if (target != mCurrentTextureTarget) { glDeleteTextures(1, &mTexName); } glBindTexture(target, mTexName); glEGLImageTargetTexture2DOES(target, (GLeglImageOES)image); glBindTexture(GL_TEXTURE_EXTERNAL_OES, mTexName); glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES, (GLeglImageOES)image); bool failed = false; while ((error = glGetError()) != GL_NO_ERROR) { Loading @@ -678,7 +673,6 @@ status_t SurfaceTexture::updateTexImage() { // Update the SurfaceTexture state. mCurrentTexture = buf; mCurrentTextureTarget = target; mCurrentTextureBuf = mSlots[buf].mGraphicBuffer; mCurrentCrop = mSlots[buf].mCrop; mCurrentTransform = mSlots[buf].mTransform; Loading @@ -692,7 +686,7 @@ status_t SurfaceTexture::updateTexImage() { mDequeueCondition.signal(); } else { // We always bind the texture even if we don't update its contents. glBindTexture(mCurrentTextureTarget, mTexName); glBindTexture(GL_TEXTURE_EXTERNAL_OES, mTexName); } return OK; Loading @@ -717,20 +711,8 @@ bool SurfaceTexture::isExternalFormat(uint32_t format) return false; } GLenum SurfaceTexture::getTextureTarget(uint32_t format) { GLenum target = GL_TEXTURE_2D; #if defined(GL_OES_EGL_image_external) if (isExternalFormat(format)) { target = GL_TEXTURE_EXTERNAL_OES; } #endif return target; } GLenum SurfaceTexture::getCurrentTextureTarget() const { Mutex::Autolock lock(mMutex); return mCurrentTextureTarget; return GL_TEXTURE_EXTERNAL_OES; } void SurfaceTexture::getTransformMatrix(float mtx[16]) { Loading Loading @@ -959,12 +941,12 @@ void SurfaceTexture::dump(String8& result, const char* prefix, } snprintf(buffer, SIZE, "%scurrent: {crop=[%d,%d,%d,%d], transform=0x%02x, current=%d, target=0x%04x}\n" "%scurrent: {crop=[%d,%d,%d,%d], transform=0x%02x, current=%d}\n" "%snext : {crop=[%d,%d,%d,%d], transform=0x%02x, FIFO(%d)={%s}}\n" , prefix, mCurrentCrop.left, mCurrentCrop.top, mCurrentCrop.right, mCurrentCrop.bottom, mCurrentTransform, mCurrentTexture, mCurrentTextureTarget, mCurrentTransform, mCurrentTexture, prefix, mNextCrop.left, mNextCrop.top, mNextCrop.right, mNextCrop.bottom, mCurrentTransform, fifoSize, fifo.string() ); Loading
libs/gui/tests/SurfaceTexture_test.cpp +14 −18 Original line number Diff line number Diff line Loading @@ -832,9 +832,7 @@ TEST_F(SurfaceTextureGLTest, TexturingFromCpuFilledYV12BuffersRepeatedly) { pt->requestExitAndWait(); } // XXX: This test is disabled because there are currently no drivers that can // handle RGBA textures with the GL_TEXTURE_EXTERNAL_OES target. TEST_F(SurfaceTextureGLTest, DISABLED_TexturingFromCpuFilledRGBABufferNpot) { TEST_F(SurfaceTextureGLTest, TexturingFromCpuFilledRGBABufferNpot) { const int texWidth = 64; const int texHeight = 66; Loading Loading @@ -871,26 +869,24 @@ TEST_F(SurfaceTextureGLTest, DISABLED_TexturingFromCpuFilledRGBABufferNpot) { EXPECT_TRUE(checkPixel( 0, 65, 35, 35, 35, 35)); EXPECT_TRUE(checkPixel(15, 10, 35, 231, 231, 231)); EXPECT_TRUE(checkPixel(24, 63, 38, 228, 231, 35)); EXPECT_TRUE(checkPixel(23, 65, 231, 35, 231, 35)); EXPECT_TRUE(checkPixel(19, 40, 35, 231, 35, 35)); EXPECT_TRUE(checkPixel(38, 30, 231, 35, 35, 35)); EXPECT_TRUE(checkPixel(42, 54, 35, 35, 35, 231)); EXPECT_TRUE(checkPixel(37, 33, 228, 38, 38, 38)); EXPECT_TRUE(checkPixel(37, 34, 35, 231, 231, 231)); EXPECT_TRUE(checkPixel(31, 8, 231, 35, 35, 231)); EXPECT_TRUE(checkPixel(36, 47, 228, 35, 231, 231)); EXPECT_TRUE(checkPixel(24, 63, 38, 228, 231, 35)); EXPECT_TRUE(checkPixel(48, 3, 228, 228, 38, 35)); EXPECT_TRUE(checkPixel(37, 47, 231, 35, 231, 231)); EXPECT_TRUE(checkPixel(25, 38, 35, 35, 35, 35)); EXPECT_TRUE(checkPixel(49, 6, 35, 231, 35, 35)); EXPECT_TRUE(checkPixel(54, 50, 35, 231, 231, 231)); EXPECT_TRUE(checkPixel(24, 25, 41, 41, 231, 231)); EXPECT_TRUE(checkPixel(10, 9, 38, 38, 231, 231)); EXPECT_TRUE(checkPixel(27, 26, 231, 231, 231, 231)); EXPECT_TRUE(checkPixel(10, 6, 35, 35, 231, 231)); EXPECT_TRUE(checkPixel(29, 4, 35, 35, 35, 231)); EXPECT_TRUE(checkPixel(56, 31, 38, 228, 231, 35)); EXPECT_TRUE(checkPixel(55, 28, 35, 35, 231, 35)); EXPECT_TRUE(checkPixel(58, 55, 35, 35, 231, 231)); } // XXX: This test is disabled because there are currently no drivers that can // handle RGBA textures with the GL_TEXTURE_EXTERNAL_OES target. TEST_F(SurfaceTextureGLTest, DISABLED_TexturingFromCpuFilledRGBABufferPow2) { TEST_F(SurfaceTextureGLTest, TexturingFromCpuFilledRGBABufferPow2) { const int texWidth = 64; const int texHeight = 64; Loading Loading @@ -944,9 +940,7 @@ TEST_F(SurfaceTextureGLTest, DISABLED_TexturingFromCpuFilledRGBABufferPow2) { EXPECT_TRUE(checkPixel( 3, 52, 35, 231, 35, 35)); } // XXX: This test is disabled because there are currently no drivers that can // handle RGBA textures with the GL_TEXTURE_EXTERNAL_OES target. TEST_F(SurfaceTextureGLTest, DISABLED_TexturingFromGLFilledRGBABufferPow2) { TEST_F(SurfaceTextureGLTest, TexturingFromGLFilledRGBABufferPow2) { const int texWidth = 64; const int texHeight = 64; Loading @@ -956,7 +950,7 @@ TEST_F(SurfaceTextureGLTest, DISABLED_TexturingFromGLFilledRGBABufferPow2) { EGLSurface stcEglSurface = eglCreateWindowSurface(mEglDisplay, mGlConfig, mANW.get(), NULL); ASSERT_EQ(EGL_SUCCESS, eglGetError()); ASSERT_NE(EGL_NO_SURFACE, mEglSurface); ASSERT_NE(EGL_NO_SURFACE, stcEglSurface); EXPECT_TRUE(eglMakeCurrent(mEglDisplay, stcEglSurface, stcEglSurface, mEglContext)); Loading @@ -980,6 +974,8 @@ TEST_F(SurfaceTextureGLTest, DISABLED_TexturingFromGLFilledRGBABufferPow2) { eglSwapBuffers(mEglDisplay, stcEglSurface); eglDestroySurface(mEglDisplay, stcEglSurface); // Do the consumer side of things EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext)); Loading