Bug 774059 - Fix up references to glEGLImageTargetTexture2D - r=bjacob
☠☠ backed out by 76b751e49962 ☠ ☠
authorJeff Gilbert <jgilbert@mozilla.com>
Wed, 18 Jul 2012 14:17:10 -0700
changeset 99711 d4a04cc3832686ac09eeb6de4890d66ec4bbf0ca
parent 99710 82b78defe027e6ef7351bb9f6f31991315d2ed25
child 99712 44f8cae1dcf0dca74dd48c4134bf90d4c654bb1e
child 99720 76b751e49962f10938fd74ec2fede9fd62633e3e
push id23146
push useremorley@mozilla.com
push dateThu, 19 Jul 2012 12:27:27 +0000
treeherdermozilla-central@e1dcf7c892d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbjacob
bugs774059
milestone17.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 774059 - Fix up references to glEGLImageTargetTexture2D - r=bjacob
gfx/gl/GLContext.cpp
gfx/gl/GLContext.h
gfx/gl/GLContextProviderEGL.cpp
gfx/gl/GLContextSymbols.h
gfx/gl/GLDefs.h
gfx/gl/GLLibraryEGL.cpp
gfx/gl/GLLibraryEGL.h
--- a/gfx/gl/GLContext.cpp
+++ b/gfx/gl/GLContext.cpp
@@ -74,16 +74,17 @@ static const char *sExtensionNames[] = {
     "GL_EXT_framebuffer_multisample",
     "GL_ANGLE_framebuffer_multisample",
     "GL_OES_rgb8_rgba8",
     "GL_ARB_robustness",
     "GL_EXT_robustness",
     "GL_ARB_sync",
     "GL_OES_EGL_image",
     "GL_OES_EGL_sync",
+    "GL_OES_EGL_image_external",
     nsnull
 };
 
 /*
  * XXX - we should really know the ARB/EXT variants of these
  * instead of only handling the symbol if it's exposed directly.
  */
 
@@ -465,25 +466,25 @@ GLContext::InitWithPrefix(const char *pr
                 mSymbols.fWaitSync = nsnull;
                 mSymbols.fGetInteger64v = nsnull;
                 mSymbols.fGetSynciv = nsnull;
             }
         }
 
         if (IsExtensionSupported(OES_EGL_image)) {
             SymLoadStruct imageSymbols[] = {
-                { (PRFuncPtr*) &mSymbols.fImageTargetTexture2D, { "EGLImageTargetTexture2DOES", nsnull } },
+                { (PRFuncPtr*) &mSymbols.fEGLImageTargetTexture2D, { "EGLImageTargetTexture2DOES", nsnull } },
                 { nsnull, { nsnull } },
             };
 
             if (!LoadSymbols(&imageSymbols[0], trygl, prefix)) {
                 NS_ERROR("GL supports OES_EGL_image without supplying its functions.");
 
                 MarkExtensionUnsupported(OES_EGL_image);
-                mSymbols.fImageTargetTexture2D = nsnull;
+                mSymbols.fEGLImageTargetTexture2D = nsnull;
             }
         }
        
         // Load developer symbols, don't fail if we can't find them.
         SymLoadStruct auxSymbols[] = {
                 { (PRFuncPtr*) &mSymbols.fGetTexImage, { "GetTexImage", nsnull } },
                 { (PRFuncPtr*) &mSymbols.fGetTexLevelParameteriv, { "GetTexLevelParameteriv", nsnull } },
                 { nsnull, { nsnull } },
--- a/gfx/gl/GLContext.h
+++ b/gfx/gl/GLContext.h
@@ -1529,16 +1529,17 @@ public:
         EXT_framebuffer_multisample,
         ANGLE_framebuffer_multisample,
         OES_rgb8_rgba8,
         ARB_robustness,
         EXT_robustness,
         ARB_sync,
         OES_EGL_image,
         OES_EGL_sync,
+        OES_EGL_image_external,
         Extensions_Max
     };
 
     bool IsExtensionSupported(GLExtensions aKnownExtension) {
         return mAvailableExtensions[aKnownExtension];
     }
 
     void MarkExtensionUnsupported(GLExtensions aKnownExtension) {
@@ -3077,20 +3078,20 @@ public:
 
      void GLAPIENTRY fGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values) {
          BEFORE_GL_CALL;
          mSymbols.fGetSynciv(sync, pname, bufSize, length, values);
          AFTER_GL_CALL;
      }
 
      // OES_EGL_image (GLES)
-     void fImageTargetTexture2D(GLenum target, GLeglImage image)
+     void fEGLImageTargetTexture2D(GLenum target, GLeglImage image)
      {
          BEFORE_GL_CALL;
-         mSymbols.fImageTargetTexture2D(target, image);
+         mSymbols.fEGLImageTargetTexture2D(target, image);
          AFTER_GL_CALL;
      }
 
 #ifdef DEBUG
     void THEBES_API CreatedProgram(GLContext *aOrigin, GLuint aName);
     void THEBES_API CreatedShader(GLContext *aOrigin, GLuint aName);
     void THEBES_API CreatedBuffers(GLContext *aOrigin, GLsizei aCount, GLuint *aNames);
     void THEBES_API CreatedTextures(GLContext *aOrigin, GLsizei aCount, GLuint *aNames);
--- a/gfx/gl/GLContextProviderEGL.cpp
+++ b/gfx/gl/GLContextProviderEGL.cpp
@@ -38,18 +38,16 @@
 
 # if defined(MOZ_WIDGET_GONK)
 #  include "cutils/properties.h"
 #  include <ui/GraphicBuffer.h>
 
 using namespace android;
 
 # define EGL_NATIVE_BUFFER_ANDROID 0x3140
-# define EGL_IMAGE_PRESERVED_KHR   0x30D2
-# define GL_TEXTURE_EXTERNAL_OES   0x8D65
 
 # endif
 
 #endif
 
 #define GLES2_LIB "libGLESv2.so"
 #define GLES2_LIB2 "libGLESv2.so.2"
 
@@ -403,25 +401,25 @@ public:
         mBound = false;
         return true;
     }
 
     bool BindExternalBuffer(GLuint texture, void* buffer)
     {
 #if defined(MOZ_WIDGET_GONK)
         EGLint attrs[] = {
-            EGL_IMAGE_PRESERVED_KHR, LOCAL_EGL_TRUE,
+            LOCAL_EGL_IMAGE_PRESERVED, LOCAL_EGL_TRUE,
             LOCAL_EGL_NONE, LOCAL_EGL_NONE
         };
         EGLImage image = sEGLLibrary.fCreateImage(EGL_DISPLAY(),
                                                   EGL_NO_CONTEXT,
                                                   EGL_NATIVE_BUFFER_ANDROID,
                                                   buffer, attrs);
-        sEGLLibrary.fImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES, image);
-        fBindTexture(GL_TEXTURE_EXTERNAL_OES, texture);
+        fEGLImageTargetTexture2D(LOCAL_GL_TEXTURE_EXTERNAL, image);
+        fBindTexture(LOCAL_GL_TEXTURE_EXTERNAL, texture);
         sEGLLibrary.fDestroyImage(EGL_DISPLAY(), image);
         return true;
 #else
         return false;
 #endif
     }
 
     bool MakeCurrentImpl(bool aForce = false) {
@@ -860,17 +858,17 @@ bool GLContextEGL::AttachSharedHandle(Te
 {
     if (aType != TextureImage::ThreadShared)
         return false;
 
     NS_ASSERTION(mShareWithEGLImage, "EGLImage not supported or disabled in runtime");
 
     EGLTextureWrapper* wrap = (EGLTextureWrapper*)aSharedHandle;
     wrap->WaitSync();
-    sEGLLibrary.fImageTargetTexture2DOES(LOCAL_GL_TEXTURE_2D, wrap->GetEGLImage());
+    fEGLImageTargetTexture2D(LOCAL_GL_TEXTURE_2D, wrap->GetEGLImage());
     return true;
 }
 
 bool
 GLContextEGL::BindTex2DOffscreen(GLContext *aOffscreen)
 {
     if (aOffscreen->GetContextType() != ContextTypeEGL) {
         NS_WARNING("non-EGL context");
@@ -1306,17 +1304,17 @@ public:
         if (mTextureState == Created) {
             Resize(mSize);
         }
 
 #ifdef MOZ_WIDGET_GONK
         if (UsingDirectTexture()) {
             mGLContext->fActiveTexture(aTextureUnit);
             mGLContext->fBindTexture(LOCAL_GL_TEXTURE_2D, mTexture);
-            sEGLLibrary.fImageTargetTexture2DOES(LOCAL_GL_TEXTURE_2D, mEGLImage);
+            fEGLImageTargetTexture2D(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);
@@ -1409,17 +1407,17 @@ 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, 0);
+            mGLContext->fEGLImageTargetTexture2D(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;
             }
 
             void *vaddr;
             if (mGraphicBuffer->lock(GraphicBuffer::USAGE_SW_READ_OFTEN |
                                      GraphicBuffer::USAGE_SW_WRITE_OFTEN,
@@ -1572,26 +1570,26 @@ public:
         mConfig = nsnull;
 
         if (sEGLLibrary.HasKHRImagePixmap() &&
             mGLContext->IsExtensionSupported(GLContext::OES_EGL_image))
         {
             mEGLImage =
                 sEGLLibrary.fCreateImage(EGL_DISPLAY(),
                                          EGL_NO_CONTEXT,
-                                         LOCAL_EGL_NATIVE_PIXMAP_KHR,
+                                         LOCAL_EGL_NATIVE_PIXMAP,
                                          (EGLClientBuffer)xsurface->XDrawable(),
                                          nsnull);
 
             if (!mEGLImage) {
                 printf_stderr("couldn't create EGL image: ERROR (0x%04x)\n", sEGLLibrary.fGetError());
                 return false;
             }
             mGLContext->fBindTexture(LOCAL_GL_TEXTURE_2D, mTexture);
-            mGLContext->fImageTargetTexture2D(LOCAL_GL_TEXTURE_2D, mEGLImage);
+            mGLContext->fEGLImageTargetTexture2D(LOCAL_GL_TEXTURE_2D, mEGLImage);
             sEGLLibrary.fDestroyImage(EGL_DISPLAY(), mEGLImage);
             mEGLImage = nsnull;
         } else {
             if (!CreateEGLSurface(xsurface)) {
                 printf_stderr("ProviderEGL Failed create EGL surface: ERROR (0x%04x)\n", sEGLLibrary.fGetError());
                 return false;
             }
 
@@ -1610,17 +1608,17 @@ public:
         if (gUseBackingSurface) {
             mGLContext->MakeCurrent(true);
             PixelFormat format = PixelFormatForImage(mUpdateFormat);
             uint32_t usage = GraphicBuffer::USAGE_HW_TEXTURE |
                              GraphicBuffer::USAGE_SW_READ_OFTEN |
                              GraphicBuffer::USAGE_SW_WRITE_OFTEN;
             mGraphicBuffer = new GraphicBuffer(aSize.width, aSize.height, format, usage);
             if (mGraphicBuffer->initCheck() == OK) {
-                const int eglImageAttributes[] = { EGL_IMAGE_PRESERVED_KHR, LOCAL_EGL_TRUE,
+                const int eglImageAttributes[] = { LOCAL_EGL_IMAGE_PRESERVED, LOCAL_EGL_TRUE,
                                                    LOCAL_EGL_NONE, LOCAL_EGL_NONE };
                 mEGLImage = sEGLLibrary.fCreateImage(EGL_DISPLAY(),
                                                         EGL_NO_CONTEXT,
                                                         EGL_NATIVE_BUFFER_ANDROID,
                                                         (EGLClientBuffer) mGraphicBuffer->getNativeBuffer(),
                                                         eglImageAttributes);
                 if (!mEGLImage) {
                     LOG("Could not create EGL images: ERROR (0x%04x)", sEGLLibrary.fGetError());
--- a/gfx/gl/GLContextSymbols.h
+++ b/gfx/gl/GLContextSymbols.h
@@ -368,16 +368,16 @@ struct GLContextSymbols
     typedef void (GLAPIENTRY * PFNGLWAITSYNC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
     PFNGLWAITSYNC fWaitSync;
     typedef void (GLAPIENTRY * PFNGLGETINTEGER64V) (GLenum pname, GLint64 *params);
     PFNGLGETINTEGER64V fGetInteger64v;
     typedef void (GLAPIENTRY * PFNGLGETSYNCIV) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
     PFNGLGETSYNCIV fGetSynciv;
 
     // OES_egl_image
-    typedef void (GLAPIENTRY * PFNGLIMAGETARGETTEXTURE2D)(GLenum target, GLeglImage image);
-    PFNGLIMAGETARGETTEXTURE2D fImageTargetTexture2D;
+    typedef void (GLAPIENTRY * PFNGLEGLIMAGETARGETTEXTURE2D)(GLenum target, GLeglImage image);
+    PFNGLEGLIMAGETARGETTEXTURE2D fEGLImageTargetTexture2D;
 };
 
 }
 }
 
 #endif /* GLCONTEXTSYMBOLS_H_ */
--- a/gfx/gl/GLDefs.h
+++ b/gfx/gl/GLDefs.h
@@ -3019,16 +3019,19 @@ typedef void* GLeglImage;
 #define LOCAL_GL_SIGNALED                         0x9119
 #define LOCAL_GL_SYNC_FLUSH_COMMANDS_BIT          0x00000001
 #define LOCAL_GL_TIMEOUT_IGNORED                  0xFFFFFFFFFFFFFFFFull
 #define LOCAL_GL_ALREADY_SIGNALED                 0x911A
 #define LOCAL_GL_TIMEOUT_EXPIRED                  0x911B
 #define LOCAL_GL_CONDITION_SATISFIED              0x911C
 #define LOCAL_GL_WAIT_FAILED                      0x911D
 
+// OES_EGL_image_external
+#define LOCAL_GL_TEXTURE_EXTERNAL                 0x8D65
+
 #define LOCAL_GL_MAX_VERTEX_UNIFORM_VECTORS       0x8DFB
 #define LOCAL_GL_MAX_VARYING_VECTORS              0x8DFC
 #define LOCAL_GL_MAX_FRAGMENT_UNIFORM_VECTORS     0x8DFD
 #define LOCAL_GL_IMPLEMENTATION_COLOR_READ_TYPE   0x8B9A
 #define LOCAL_GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
 #define LOCAL_GL_MAX_FRAGMENT_INPUT_COMPONENTS    0x9125
 #define LOCAL_GL_MAX_VERTEX_OUTPUT_COMPONENTS     0x9122
 
@@ -3231,33 +3234,37 @@ typedef void* GLeglImage;
 #define LOCAL_EGL_SWAP_BEHAVIOR               0x3093
 #define LOCAL_EGL_MULTISAMPLE_RESOLVE         0x3099
 #define LOCAL_EGL_CONTEXT_CLIENT_TYPE         0x3097
 #define LOCAL_EGL_CONTEXT_CLIENT_VERSION      0x3098
 #define LOCAL_EGL_BACK_BUFFER                 0x3084
 #define LOCAL_EGL_TEXTURE_RGB                 0x305D
 #define LOCAL_EGL_TEXTURE_RGBA                0x305E
 #define LOCAL_EGL_TEXTURE_2D                  0x305F
-#define LOCAL_EGL_NATIVE_PIXMAP_KHR           0x30B0
-#define LOCAL_EGL_IMAGE_PRESERVED_KHR         0x30D2
 #define LOCAL_EGL_FALSE                       0
 #define LOCAL_EGL_TRUE                        1
 #define LOCAL_EGL_BITMAP_POINTER_KHR          0x30C6
 #define LOCAL_EGL_BITMAP_PITCH_KHR            0x30C7
 #define LOCAL_EGL_BITMAP_PIXEL_SIZE_KHR       0x3110
 #define LOCAL_EGL_LOCK_USAGE_HINT_KHR         0x30C5
 #define LOCAL_EGL_MAP_PRESERVE_PIXELS_KHR     0x30C4
 #define LOCAL_EGL_READ_SURFACE_BIT_KHR        0x0001
 #define LOCAL_EGL_WRITE_SURFACE_BIT_KHR       0x0002
 #define LOCAL_EGL_LOCK_SURFACE_BIT_KHR        0x0080
 #define LOCAL_EGL_CORE_NATIVE_ENGINE          0x305B
 #define LOCAL_EGL_READ                        0x305A
 #define LOCAL_EGL_DRAW                        0x3059
 #define LOCAL_EGL_CONTEXT_LOST                0x300E
 
+// EGL_KHR_image_base (not supplied by EGL_KHR_image!)
+#define LOCAL_EGL_IMAGE_PRESERVED             0x30D2
+
+// EGL_KHR_image_pixmap
+#define LOCAL_EGL_NATIVE_PIXMAP               0x30B0
+
 // EGL_KHR_gl_texture_2D_image
 #define LOCAL_EGL_GL_TEXTURE_2D               0x30B1
 
 // EGL_KHR_fence_sync
 #define LOCAL_EGL_SYNC_FENCE                  0x30F9
 #define LOCAL_EGL_SYNC_TYPE                   0x30F7
 #define LOCAL_EGL_SYNC_STATUS                 0x30F1
 #define LOCAL_EGL_SYNC_CONDITION              0x30F8
--- a/gfx/gl/GLLibraryEGL.cpp
+++ b/gfx/gl/GLLibraryEGL.cpp
@@ -304,33 +304,31 @@ GLLibraryEGL::LoadConfigSensitiveSymbols
 {
     GLLibraryLoader::PlatformLookupFunction lookupFunction =
             (GLLibraryLoader::PlatformLookupFunction)mSymbols.fGetProcAddress;
 
     if (IsExtensionSupported(KHR_image) || IsExtensionSupported(KHR_image_base)) {
         GLLibraryLoader::SymLoadStruct imageSymbols[] = {
             { (PRFuncPtr*) &mSymbols.fCreateImage,  { "eglCreateImageKHR",  nsnull } },
             { (PRFuncPtr*) &mSymbols.fDestroyImage, { "eglDestroyImageKHR", nsnull } },
-            { (PRFuncPtr*) &mSymbols.fImageTargetTexture2DOES, { "glEGLImageTargetTexture2DOES", NULL } },
             { nsnull, { nsnull } }
         };
 
         bool success = GLLibraryLoader::LoadSymbols(mEGLLibrary,
                                                     &imageSymbols[0],
                                                     lookupFunction);
         if (!success) {
             NS_ERROR("EGL supports KHR_image(_base) without exposing its functions!");
 
             MarkExtensionUnsupported(KHR_image);
             MarkExtensionUnsupported(KHR_image_base);
             MarkExtensionUnsupported(KHR_image_pixmap);
 
             mSymbols.fCreateImage = nsnull;
             mSymbols.fDestroyImage = nsnull;
-            mSymbols.fImageTargetTexture2DOES = nsnull;
         }
     } else {
         MarkExtensionUnsupported(KHR_image_pixmap);
     }
 }
 
 void
 GLLibraryEGL::DumpEGLConfig(EGLConfig cfg)
--- a/gfx/gl/GLLibraryEGL.h
+++ b/gfx/gl/GLLibraryEGL.h
@@ -416,23 +416,16 @@ public:
     EGLBoolean fGetSyncAttrib(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLint *value)
     {
         BEFORE_GL_CALL;
         EGLBoolean b = mSymbols.fGetSyncAttrib(dpy, sync, attribute, value);
         AFTER_GL_CALL;
         return b;
     }
 
-    void fImageTargetTexture2DOES(GLenum target, EGLImage image)
-    {
-        BEFORE_GL_CALL;
-        mSymbols.fImageTargetTexture2DOES(target, image);
-        AFTER_GL_CALL;
-    }
-
 
     EGLDisplay Display() {
         return mEGLDisplay;
     }
 
     bool IsANGLE() {
         return mIsANGLE;
     }
@@ -537,21 +530,16 @@ public:
         typedef EGLSync (GLAPIENTRY * pfnCreateSync)(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
         pfnCreateSync fCreateSync;
         typedef EGLBoolean (GLAPIENTRY * pfnDestroySync)(EGLDisplay dpy, EGLSync sync);
         pfnDestroySync fDestroySync;
         typedef EGLint (GLAPIENTRY * pfnClientWaitSync)(EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout);
         pfnClientWaitSync fClientWaitSync;
         typedef EGLBoolean (GLAPIENTRY * pfnGetSyncAttrib)(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLint *value);
         pfnGetSyncAttrib fGetSyncAttrib;
-
-        // This is EGL specific GL ext symbol "glEGLImageTargetTexture2DOES"
-        // Lets keep it here for now.
-        typedef void (GLAPIENTRY * pfnImageTargetTexture2DOES)(GLenum target, EGLImage image);
-        pfnImageTargetTexture2DOES fImageTargetTexture2DOES;
     } mSymbols;
 
 private:
     bool mInitialized;
     PRLibrary* mEGLLibrary;
     EGLDisplay mEGLDisplay;
 
     bool mIsANGLE;