Bug 736298 - Remove unused CreateForNativePixmapSurface - r=bjacob
authorJeff Gilbert <jgilbert@mozilla.com>
Fri, 27 Jul 2012 14:30:38 -0700
changeset 106238 f58214b53c9aa7d8c7e7db18f4c8ca9ff5f1191f
parent 106237 4537da6b8a8398606be011178495e17a62924898
child 106239 b69f5004fde895ea61615139b4fd705f49116514
push id1490
push userakeybl@mozilla.com
push dateMon, 08 Oct 2012 18:29:50 +0000
treeherdermozilla-beta@f335e7dacdc1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbjacob
bugs736298
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 736298 - Remove unused CreateForNativePixmapSurface - r=bjacob
gfx/gl/GLContextProviderCGL.mm
gfx/gl/GLContextProviderEGL.cpp
gfx/gl/GLContextProviderGLX.cpp
gfx/gl/GLContextProviderImpl.h
gfx/gl/GLContextProviderNull.cpp
gfx/gl/GLContextProviderWGL.cpp
--- a/gfx/gl/GLContextProviderCGL.mm
+++ b/gfx/gl/GLContextProviderCGL.mm
@@ -593,22 +593,16 @@ GLContextProviderCGL::CreateOffscreen(co
     {
         return glContext.forget();
     }
 
     // everything failed
     return nsnull;
 }
 
-already_AddRefed<GLContext>
-GLContextProviderCGL::CreateForNativePixmapSurface(gfxASurface *aSurface)
-{
-    return nsnull;
-}
-
 static nsRefPtr<GLContext> gGlobalContext;
 
 GLContext *
 GLContextProviderCGL::GetGlobalContext(const ContextFlags)
 {
     if (!sCGLLibrary.EnsureInitialized()) {
         return nsnull;
     }
--- a/gfx/gl/GLContextProviderEGL.cpp
+++ b/gfx/gl/GLContextProviderEGL.cpp
@@ -2614,52 +2614,16 @@ GLContextProviderEGL::CreateOffscreen(co
         return nsnull;
     }
     return glContext.forget();
 #else
     return nsnull;
 #endif
 }
 
-already_AddRefed<GLContext>
-GLContextProviderEGL::CreateForNativePixmapSurface(gfxASurface* aSurface)
-{
-    if (!sEGLLibrary.EnsureInitialized())
-        return nsnull;
-
-#ifdef MOZ_X11
-    EGLSurface surface = nsnull;
-    EGLConfig config = nsnull;
-
-    if (aSurface->GetType() != gfxASurface::SurfaceTypeXlib) {
-        // Not implemented
-        return nsnull;
-    }
-
-    surface = CreateEGLSurfaceForXSurface(aSurface, &config);
-    if (!config) {
-        return nsnull;
-    }
-
-    GLContextEGL *shareContext = GetGlobalContextEGL();
-    gfxXlibSurface* xsurface = static_cast<gfxXlibSurface*>(aSurface);
-
-    nsRefPtr<GLContextEGL> glContext =
-        GLContextEGL::CreateGLContext(DepthToGLFormat(xsurface->XRenderFormat()->depth),
-                                      surface, config, shareContext, false);
-
-    glContext->HoldSurface(aSurface);
-
-    return glContext.forget().get();
-#else
-    // Not implemented
-    return nsnull;
-#endif
-}
-
 GLContext *
 GLContextProviderEGL::GetGlobalContext(const ContextFlags)
 {
 // Don't want a global context on Android as 1) share groups across 2 threads fail on many Tegra drivers (bug 759225)
 // and 2) some mobile devices have a very strict limit on global number of GL contexts (bug 754257)
 #ifdef MOZ_JAVA_COMPOSITOR
     return nsnull;
 #endif
--- a/gfx/gl/GLContextProviderGLX.cpp
+++ b/gfx/gl/GLContextProviderGLX.cpp
@@ -1295,73 +1295,16 @@ GLContextProviderGLX::CreateOffscreen(co
         // we weren't able to create the initial
         // offscreen FBO, so this is dead
         return nsnull;
     }
 
     return glContext.forget();
 }
 
-already_AddRefed<GLContext>
-GLContextProviderGLX::CreateForNativePixmapSurface(gfxASurface *aSurface)
-{
-    if (!sGLXLibrary.EnsureInitialized()) {
-        return nsnull;
-    }
-
-    if (aSurface->GetType() != gfxASurface::SurfaceTypeXlib) {
-        NS_WARNING("GLContextProviderGLX::CreateForNativePixmapSurface called with non-Xlib surface");
-        return nsnull;
-    }
-
-    nsAutoTArray<int, 20> attribs;
-
-#define A1_(_x)  do { attribs.AppendElement(_x); } while(0)
-#define A2_(_x,_y)  do {                                                \
-        attribs.AppendElement(_x);                                      \
-        attribs.AppendElement(_y);                                      \
-    } while(0)
-
-    A2_(GLX_DOUBLEBUFFER, False);
-    A2_(GLX_DRAWABLE_TYPE, GLX_PIXMAP_BIT);
-    A1_(0);
-
-    int numFormats;
-    Display *display = DefaultXDisplay();
-    int xscreen = DefaultScreen(display);
-
-    ScopedXFree<GLXFBConfig> cfg(sGLXLibrary.xChooseFBConfig(display,
-                                                             xscreen,
-                                                             attribs.Elements(),
-                                                             &numFormats));
-    if (!cfg) {
-        return nsnull;
-    }
-    NS_ASSERTION(numFormats > 0,
-                 "glXChooseFBConfig() failed to match our requested format and violated its spec (!)");
-
-    gfxXlibSurface *xs = static_cast<gfxXlibSurface*>(aSurface);
-
-    GLXPixmap glxpixmap = sGLXLibrary.xCreatePixmap(display,
-                                                    cfg[0],
-                                                    xs->XDrawable(),
-                                                    NULL);
-
-    nsRefPtr<GLContextGLX> glContext = GLContextGLX::CreateGLContext(ContextFormat(ContextFormat::BasicRGB24),
-                                                                     display,
-                                                                     glxpixmap,
-                                                                     cfg[0],
-                                                                     NULL,
-                                                                     NULL,
-                                                                     false,
-                                                                     xs);
-
-    return glContext.forget();
-}
-
 static nsRefPtr<GLContext> gGlobalContext;
 
 GLContext *
 GLContextProviderGLX::GetGlobalContext(const ContextFlags)
 {
     static bool triedToCreateContext = false;
     if (!triedToCreateContext && !gGlobalContext) {
         triedToCreateContext = true;
--- a/gfx/gl/GLContextProviderImpl.h
+++ b/gfx/gl/GLContextProviderImpl.h
@@ -59,27 +59,16 @@ public:
      * @return Context to use for offscreen rendering
      */
     static already_AddRefed<GLContext>
     CreateOffscreen(const gfxIntSize& aSize,
                     const ContextFormat& aFormat = ContextFormat::BasicRGBA32Format,
                     const ContextFlags aFlags = GLContext::ContextFlagsNone);
 
     /**
-     * Try to create a GL context from native surface for arbitrary gfxASurface
-     * If surface not compatible this will return NULL
-     *
-     * @param aSurface surface to create a context for
-     *
-     * @return Context to use for this surface
-     */
-    static already_AddRefed<GLContext>
-    CreateForNativePixmapSurface(gfxASurface *aSurface);
-
-    /**
      * Get a pointer to the global context, creating it if it doesn't exist.
      */
     static GLContext *
     GetGlobalContext( const ContextFlags aFlags = GLContext::ContextFlagsNone);
 
     /**
      * Free any resources held by this Context Provider.
      */
--- a/gfx/gl/GLContextProviderNull.cpp
+++ b/gfx/gl/GLContextProviderNull.cpp
@@ -17,22 +17,16 @@ GLContextProviderNull::CreateForWindow(n
 already_AddRefed<GLContext>
 GLContextProviderNull::CreateOffscreen(const gfxIntSize&,
                                        const ContextFormat&,
                                        const ContextFlags)
 {
     return nsnull;
 }
 
-already_AddRefed<GLContext>
-GLContextProviderNull::CreateForNativePixmapSurface(gfxASurface *)
-{
-    return nsnull;
-}
-
 GLContext *
 GLContextProviderNull::GetGlobalContext()
 {
     return nsnull;
 }
 
 void
 GLContextProviderNull::Shutdown()
--- a/gfx/gl/GLContextProviderWGL.cpp
+++ b/gfx/gl/GLContextProviderWGL.cpp
@@ -787,22 +787,16 @@ GLContextProviderWGL::CreateOffscreen(co
         return nsnull;
 
     glContext->mOffscreenSize = aSize;
     glContext->mOffscreenActualSize = aSize;
 
     return glContext.forget();
 }
 
-already_AddRefed<GLContext>
-GLContextProviderWGL::CreateForNativePixmapSurface(gfxASurface *aSurface)
-{
-    return nsnull;
-}
-
 static nsRefPtr<GLContextWGL> gGlobalContext[WGLLibrary::LIBS_MAX];
 
 GLContext *
 GLContextProviderWGL::GetGlobalContext(const ContextFlags aFlags)
 {
     LibType libToUse = WGLLibrary::SelectLibrary(aFlags);
     
     if (!sWGLLib[libToUse].EnsureInitialized(libToUse == WGLLibrary::MESA_LLVMPIPE_LIB)) {