Bug 745137 - Removed double buffering stubs, fixed crashiness across all devices. r=gal

This commit is contained in:
Cody Brocious 2012-06-14 14:57:26 -04:00
parent fea3d98f7e
commit 40ab2a089f

View File

@ -824,7 +824,6 @@ public:
if (gUseBackingSurface) {
#ifdef MOZ_WIDGET_GONK
mGLContext->fGenTextures(1, &mBackTexture);
switch (mUpdateFormat) {
case gfxASurface::ImageFormatARGB32:
mShaderType = BGRALayerProgramType;
@ -875,9 +874,6 @@ public:
if (ctx && !ctx->IsDestroyed()) {
ctx->MakeCurrent();
ctx->fDeleteTextures(1, &mTexture);
#ifdef MOZ_WIDGET_GONK
ctx->fDeleteTextures(1, &mBackTexture);
#endif
ReleaseTexImage();
DestroyEGLSurface();
}
@ -1084,9 +1080,21 @@ public:
Resize(mSize);
}
mGLContext->fActiveTexture(aTextureUnit);
mGLContext->fBindTexture(LOCAL_GL_TEXTURE_2D, mTexture);
mGLContext->fActiveTexture(LOCAL_GL_TEXTURE0);
#ifdef MOZ_WIDGET_GONK
if (UsingDirectTexture()) {
mGLContext->fActiveTexture(aTextureUnit);
mGLContext->fBindTexture(LOCAL_GL_TEXTURE_2D, mTexture);
sEGLLibrary.fImageTargetTexture2DOES(LOCAL_GL_TEXTURE_2D, mEGLImage);
if (sEGLLibrary.fGetError() != LOCAL_EGL_SUCCESS) {
LOG("Could not set image target texture. ERROR (0x%04x)", sEGLLibrary.fGetError());
}
} else
#endif
{
mGLContext->fActiveTexture(aTextureUnit);
mGLContext->fBindTexture(LOCAL_GL_TEXTURE_2D, mTexture);
mGLContext->fActiveTexture(LOCAL_GL_TEXTURE0);
}
}
virtual GLuint GetTextureID()
@ -1175,10 +1183,11 @@ public:
#ifdef MOZ_WIDGET_GONK
if (mGraphicBuffer != nsnull) {
// Unset the EGLImage target so that we don't get clashing locks
mGLContext->MakeCurrent(true);
mGLContext->fActiveTexture(LOCAL_GL_TEXTURE0);
mGLContext->fBindTexture(LOCAL_GL_TEXTURE_2D, mTexture);
sEGLLibrary.fImageTargetTexture2DOES(LOCAL_GL_TEXTURE_2D, mEGLImage);
sEGLLibrary.fImageTargetTexture2DOES(LOCAL_GL_TEXTURE_2D, 0);
if (sEGLLibrary.fGetError() != LOCAL_EGL_SUCCESS) {
LOG("Could not set image target texture. ERROR (0x%04x)", sEGLLibrary.fGetError());
return false;
@ -1302,12 +1311,10 @@ public:
{
#ifdef MOZ_WIDGET_GONK
mGraphicBuffer.clear();
mGraphicBackBuffer.clear();
if (mEGLImage) {
sEGLLibrary.fDestroyImage(EGL_DISPLAY(), mEGLImage);
sEGLLibrary.fDestroyImage(EGL_DISPLAY(), mBackEGLImage);
mEGLImage = mBackEGLImage = nsnull;
mEGLImage = nsnull;
}
#endif
@ -1378,8 +1385,7 @@ public:
GraphicBuffer::USAGE_SW_READ_OFTEN |
GraphicBuffer::USAGE_SW_WRITE_OFTEN;
mGraphicBuffer = new GraphicBuffer(aSize.width, aSize.height, format, usage);
mGraphicBackBuffer = new GraphicBuffer(aSize.width, aSize.height, format, usage);
if (mGraphicBuffer->initCheck() == OK && mGraphicBackBuffer->initCheck() == OK) {
if (mGraphicBuffer->initCheck() == OK) {
const int eglImageAttributes[] = { EGL_IMAGE_PRESERVED_KHR, LOCAL_EGL_TRUE,
LOCAL_EGL_NONE, LOCAL_EGL_NONE };
mEGLImage = sEGLLibrary.fCreateImage(EGL_DISPLAY(),
@ -1387,12 +1393,7 @@ public:
EGL_NATIVE_BUFFER_ANDROID,
(EGLClientBuffer) mGraphicBuffer->getNativeBuffer(),
eglImageAttributes);
mBackEGLImage = sEGLLibrary.fCreateImage(EGL_DISPLAY(),
EGL_NO_CONTEXT,
EGL_NATIVE_BUFFER_ANDROID,
(EGLClientBuffer) mGraphicBackBuffer->getNativeBuffer(),
eglImageAttributes);
if (!mEGLImage || !mBackEGLImage) {
if (!mEGLImage) {
LOG("Could not create EGL images: ERROR (0x%04x)", sEGLLibrary.fGetError());
return false;
}
@ -1418,13 +1419,10 @@ protected:
nsRefPtr<gfxASurface> mBackingSurface;
nsRefPtr<gfxASurface> mUpdateSurface;
#ifdef MOZ_WIDGET_GONK
sp<GraphicBuffer> mGraphicBuffer, mGraphicBackBuffer;
EGLImage mEGLImage, mBackEGLImage;
GLuint mTexture, mBackTexture;
#else
sp<GraphicBuffer> mGraphicBuffer;
#endif
EGLImage mEGLImage;
GLuint mTexture;
#endif
EGLSurface mSurface;
EGLConfig mConfig;
TextureState mTextureState;
@ -1458,11 +1456,10 @@ GLContextEGL::TileGenFunc(const nsIntSize& aSize,
GLuint texture;
fGenTextures(1, &texture);
fActiveTexture(LOCAL_GL_TEXTURE0);
fBindTexture(LOCAL_GL_TEXTURE_2D, texture);
nsRefPtr<TextureImageEGL> teximage =
new TextureImageEGL(texture, aSize, LOCAL_GL_CLAMP_TO_EDGE, aContentType, this, aFlags);
teximage->BindTexture(LOCAL_GL_TEXTURE0);
GLint texfilter = aFlags & TextureImage::UseNearestFilter ? LOCAL_GL_NEAREST : LOCAL_GL_LINEAR;
fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_MIN_FILTER, texfilter);