[Libreoffice-commits] core.git: include/vcl slideshow/source vcl/source

Caolán McNamara caolanm at redhat.com
Sat May 21 09:05:07 UTC 2016


 include/vcl/opengl/OpenGLContext.hxx                                   |    8 
 slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx |  208 ----------
 vcl/source/opengl/OpenGLContext.cxx                                    |    5 
 3 files changed, 15 insertions(+), 206 deletions(-)

New commits:
commit 81283a891f274226113f6d136c251c2ba1538b4c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri May 20 13:11:45 2016 +0100

    GLX_EXT_texture_from_pixmap path cannot be called...
    
    slideshow mbHasTFPVisual is always false since
    
    commit eccaf91ec9c50d42ce98c90abe2c129bedbbc60e
    Date:   Mon May 19 19:21:29 2014 +0200
    
        use VCL's OpenGLContext for 3D transitions
    
        Change-Id: I510518461eb8bc9669d0de2679c34c473f66b175
    
    and GLWindow fbc has always been null since that incarnation of opengl started,
    so even if mbHasTFPVisual was true it would crash.
    
    OpenGLHelper::GetPixmapFBConfig is *almost* the same as the old removed code
    for setting fbc, but if I use that then for me the transitions still don't work
    at all.
    
    Examining further shows GetPixmapFBConfig lacks the test for
    GLX_BIND_TO_MIPMAP_TEXTURE_EXT that the old code had.
    
    If I add than, then it "works", but examining *that*, reveals it only works
    because GLX_BIND_TO_MIPMAP_TEXTURE_EXT is unsupported on my rig, so the
    GLX_EXT_texture_from_pixmap code still doesn't get executed.
    
    I apparently can't test the original working configuration, and I'm not
    particularly interested in getting X working and I just wanted to make sure I
    didn't break that case, so...
    
    this removes the uncallable since 2014 code entirely rather than try to
    fix it.
    
    I suspect this may leave the cairo-canvas CanvasBitmap::getFastPropertyValue
    "1" branch now also dead
    
    Change-Id: I6727576056533fa54a4f82378954fb53891f5873

diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx
index 0036849..10024b3 100644
--- a/include/vcl/opengl/OpenGLContext.hxx
+++ b/include/vcl/opengl/OpenGLContext.hxx
@@ -79,9 +79,6 @@ struct VCL_DLLPUBLIC GLWindow
     Display*            dpy;
     int                 screen;
     Window              win;
-#if defined( GLX_EXT_texture_from_pixmap )
-    GLXFBConfig        fbc;
-#endif
     XVisualInfo*       vi;
     GLXContext         ctx;
 
@@ -107,9 +104,6 @@ struct VCL_DLLPUBLIC GLWindow
         dpy(nullptr),
         screen(0),
         win(0),
-#if defined( GLX_EXT_texture_from_pixmap )
-        fbc(nullptr),
-#endif
         vi(nullptr),
         ctx(nullptr),
         GLXExtensions(nullptr),
@@ -195,7 +189,7 @@ public:
 
     void setWinPosAndSize(const Point &rPos, const Size& rSize);
     void setWinSize(const Size& rSize);
-    const GLWindow& getOpenGLWindow() const { return m_aGLWin;}
+    const GLWindow& getOpenGLWindow() const;
 
     SystemChildWindow* getChildWindow();
     const SystemChildWindow* getChildWindow() const;
diff --git a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx
index fa4df10..a185553 100644
--- a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx
+++ b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx
@@ -147,19 +147,6 @@ int calcComponentOrderIndex(const uno::Sequence<sal_Int8>& rTags)
     return -1;
 }
 
-#if defined( UNX ) && !defined( MACOSX )
-
-// not thread safe
-static bool errorTriggered;
-int oglErrorHandler( Display* /*dpy*/, XErrorEvent* /*evnt*/ )
-{
-    errorTriggered = true;
-
-    return 0;
-}
-
-#endif
-
 /** This is the Transitioner class for OpenGL 3D transitions in
  * slideshow. This class is implicitly
  * constructed from XTransitionFactory.
@@ -195,10 +182,6 @@ protected:
     }
 
     void createTexture( GLuint* texID,
-#if defined( GLX_EXT_texture_from_pixmap )
-            GLXPixmap pixmap,
-            bool usePixmap,
-#endif
             bool useMipmap,
             uno::Sequence<sal_Int8>& data,
             const OGLFormat* pFormat );
@@ -244,17 +227,7 @@ private:
     */
     uno::Sequence<sal_Int8> maLeavingBytes;
 
-#if defined( GLX_EXT_texture_from_pixmap )
-    GLXPixmap maLeavingPixmapGL;
-    GLXPixmap maEnteringPixmapGL;
-    Pixmap maLeavingPixmap;
-    Pixmap maEnteringPixmap;
-    bool mbFreeLeavingPixmap;
-    bool mbFreeEnteringPixmap;
-#endif
     bool mbRestoreSync;
-    bool mbUseLeavingPixmap;
-    bool mbUseEnteringPixmap;
 
     /** the form the raw bytes are in for the bitmaps
     */
@@ -282,16 +255,6 @@ public:
      */
     bool mbValidOpenGLContext;
 
-    /**
-       whether to generate mipmaped textures
-    */
-    bool mbGenerateMipmap;
-
-    /**
-       whether we have visual which can be used for texture_from_pixmap extension
-    */
-    bool mbHasTFPVisual;
-
 #if OSL_DEBUG_LEVEL > 0
     ptime maUpdateStartTime;
     ptime maUpdateEndTime;
@@ -374,8 +337,6 @@ bool OGLTransitionerImpl::initWindowFromSlideShowView( const Reference< presenta
     mpContext->setWinPosAndSize(Point(aCanvasArea.X, aCanvasArea.Y), Size(aCanvasArea.Width, aCanvasArea.Height));
     SAL_INFO("slideshow.opengl", "canvas area: " << aCanvasArea.X << "," << aCanvasArea.Y << " - " << aCanvasArea.Width << "x" << aCanvasArea.Height);
 
-    mbGenerateMipmap = GLEW_SGIS_generate_mipmap;
-
     CHECK_GL_ERROR();
     glEnable(GL_CULL_FACE);
     CHECK_GL_ERROR();
@@ -427,86 +388,8 @@ void OGLTransitionerImpl::impl_prepareSlides()
     mpContext->sync();
     CHECK_GL_ERROR();
 
-    mbUseLeavingPixmap = false;
-    mbUseEnteringPixmap = false;
-
-    const GLWindow& rGLWindow(mpContext->getOpenGLWindow());
-
-#if defined( GLX_EXT_texture_from_pixmap )
-    if( GLXEW_EXT_texture_from_pixmap && xLeavingSet.is() && xEnteringSet.is() && mbHasTFPVisual ) {
-        Sequence< Any > leaveArgs;
-        Sequence< Any > enterArgs;
-        if( (xLeavingSet->getFastPropertyValue( 1 ) >>= leaveArgs) &&
-            (xEnteringSet->getFastPropertyValue( 1 ) >>= enterArgs) ) {
-            SAL_INFO("slideshow.opengl", "pixmaps available");
-
-            sal_Int32 depth(0);
-
-            leaveArgs[0] >>= mbFreeLeavingPixmap;
-            enterArgs[0] >>= mbFreeEnteringPixmap;
-            leaveArgs[1] >>= maLeavingPixmap;
-            enterArgs[1] >>= maEnteringPixmap;
-            leaveArgs[2] >>= depth;
-
-            int pixmapAttribs[] = { GLX_TEXTURE_TARGET_EXT, GLX_TEXTURE_2D_EXT,
-                        GLX_TEXTURE_FORMAT_EXT, GLX_TEXTURE_FORMAT_RGB_EXT,
-                        GLX_MIPMAP_TEXTURE_EXT, True,
-                        None };
-
-
-            // sync so that we possibly get an pending XError, before we set our handler.
-            // this way we will not miss any error from other code
-            mpContext->sync();
-
-            int (*oldHandler)(Display* /*dpy*/, XErrorEvent* /*evnt*/);
-
-            // replace error handler temporarily
-            oldHandler = XSetErrorHandler( oglErrorHandler );
-
-            errorTriggered = false;
-            maLeavingPixmapGL = glXCreatePixmap( rGLWindow.dpy, rGLWindow.fbc, maLeavingPixmap, pixmapAttribs );
-
-            // sync so that we possibly get an XError
-            mpContext->sync();
-
-            if( !errorTriggered )
-                mbUseLeavingPixmap = true;
-            else {
-                SAL_INFO("slideshow.opengl", "XError triggered");
-                OSL_TRACE("XError triggered");
-                if( mbFreeLeavingPixmap ) {
-                    XFreePixmap( rGLWindow.dpy, maLeavingPixmap );
-                    mbFreeLeavingPixmap = false;
-                }
-                errorTriggered = false;
-            }
-
-            maEnteringPixmapGL = glXCreatePixmap( rGLWindow.dpy, rGLWindow.fbc, maEnteringPixmap, pixmapAttribs );
-
-            // sync so that we possibly get an XError
-            mpContext->sync();
-
-            SAL_INFO("slideshow.opengl", "created glx pixmap " << maLeavingPixmapGL << " and " << maEnteringPixmapGL << " depth: " << depth);
-            if( !errorTriggered )
-                mbUseEnteringPixmap = true;
-            else {
-                SAL_INFO("slideshow.opengl", "XError triggered");
-                if( mbFreeEnteringPixmap ) {
-                    XFreePixmap( rGLWindow.dpy, maEnteringPixmap );
-                    mbFreeEnteringPixmap = false;
-                }
-            }
-
-            // restore the error handler
-            XSetErrorHandler( oldHandler );
-        }
-    }
-#endif
-
-    if( !mbUseLeavingPixmap )
-        maLeavingBytes = mxLeavingBitmap->getData(maSlideBitmapLayout, aSlideRect);
-    if( !mbUseEnteringPixmap )
-        maEnteringBytes = mxEnteringBitmap->getData(maSlideBitmapLayout, aSlideRect);
+    maLeavingBytes = mxLeavingBitmap->getData(maSlideBitmapLayout, aSlideRect);
+    maEnteringBytes = mxEnteringBitmap->getData(maSlideBitmapLayout, aSlideRect);
 
     CHECK_GL_ERROR();
     GLInitSlides();
@@ -520,6 +403,7 @@ void OGLTransitionerImpl::impl_prepareSlides()
     // synchronized X still gives us much smoother play
     // I suspect some issues in above code in slideshow
     // synchronize whole transition for now
+    const GLWindow& rGLWindow(mpContext->getOpenGLWindow());
     mbRestoreSync = rGLWindow.Synchronize(true);
 }
 
@@ -557,10 +441,6 @@ bool OGLTransitionerImpl::setTransition( const std::shared_ptr<OGLTransitionImpl
 }
 
 void OGLTransitionerImpl::createTexture( GLuint* texID,
-#if defined( GLX_EXT_texture_from_pixmap )
-                     GLXPixmap pixmap,
-                     bool usePixmap,
-#endif
                      bool useMipmap,
                      uno::Sequence<sal_Int8>& data,
                      const OGLFormat* pFormat )
@@ -573,25 +453,8 @@ void OGLTransitionerImpl::createTexture( GLuint* texID,
     glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER );
     CHECK_GL_ERROR();
 
-#if defined( GLX_EXT_texture_from_pixmap )
-    if( usePixmap ) {
-        if( mbGenerateMipmap )
-            glTexParameteri( GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, True);
-        glXBindTexImageEXT (mpContext->getOpenGLWindow().dpy, pixmap, GLX_FRONT_LEFT_EXT, nullptr);
-        if( mbGenerateMipmap && useMipmap ) {
-            SAL_INFO("slideshow.opengl", "use mipmaps");
-            glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
-            glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR); //TRILINEAR FILTERING
-        } else {
-            glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
-            glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
-        }
-    } else {
-        impl_createTexture( useMipmap, data, pFormat );
-    }
-#else
     impl_createTexture( useMipmap, data, pFormat );
-#endif
+
     SAL_WARN_IF(!glIsTexture(*texID), "slideshow.opengl", "Can't generate Leaving slide textures in OpenGL");
     CHECK_GL_ERROR();
 }
@@ -1151,25 +1014,15 @@ void OGLTransitionerImpl::GLInitSlides()
 
     mpContext->makeCurrent();
 
-    const OGLFormat* pFormat = nullptr;
-    if( !mbUseLeavingPixmap || !mbUseEnteringPixmap )
-        pFormat = chooseFormats();
+    const OGLFormat* pFormat = chooseFormats();
 
     CHECK_GL_ERROR();
     createTexture( &maLeavingSlideGL,
-#if defined( GLX_EXT_texture_from_pixmap )
-           maLeavingPixmapGL,
-           mbUseLeavingPixmap,
-#endif
            mpTransition->getSettings().mbUseMipMapLeaving,
            maLeavingBytes,
            pFormat );
 
     createTexture( &maEnteringSlideGL,
-#if defined( GLX_EXT_texture_from_pixmap )
-           maEnteringPixmapGL,
-           mbUseEnteringPixmap,
-#endif
            mpTransition->getSettings().mbUseMipMapEntering,
            maEnteringBytes,
            pFormat );
@@ -1242,42 +1095,11 @@ void OGLTransitionerImpl::disposeTextures()
     mpContext->makeCurrent();
     CHECK_GL_ERROR();
 
-#if defined( GLX_EXT_texture_from_pixmap )
-    const GLWindow& rGLWindow(mpContext->getOpenGLWindow());
-
-    if( mbUseLeavingPixmap ) {
-        glXReleaseTexImageEXT( rGLWindow.dpy, maLeavingPixmapGL, GLX_FRONT_LEFT_EXT );
-        glXDestroyGLXPixmap( rGLWindow.dpy, maLeavingPixmapGL );
-        maLeavingPixmapGL = 0;
-        if( mbFreeLeavingPixmap ) {
-            XFreePixmap( rGLWindow.dpy, maLeavingPixmap );
-            mbFreeLeavingPixmap = false;
-            maLeavingPixmap = 0;
-        }
-    }
-    if( mbUseEnteringPixmap ) {
-        glXReleaseTexImageEXT( rGLWindow.dpy, maEnteringPixmapGL, GLX_FRONT_LEFT_EXT );
-        glXDestroyGLXPixmap( rGLWindow.dpy, maEnteringPixmapGL );
-        maEnteringPixmapGL = 0;
-        if( mbFreeEnteringPixmap ) {
-            XFreePixmap( rGLWindow.dpy, maEnteringPixmap );
-            mbFreeEnteringPixmap = false;
-            maEnteringPixmap = 0;
-        }
-    }
-#endif
-
-    if( !mbUseLeavingPixmap ) {
-        glDeleteTextures(1,&maLeavingSlideGL);
-        maLeavingSlideGL = 0;
-    }
-    if( !mbUseEnteringPixmap ) {
-        glDeleteTextures(1,&maEnteringSlideGL);
-        maEnteringSlideGL = 0;
-    }
+    glDeleteTextures(1,&maLeavingSlideGL);
+    maLeavingSlideGL = 0;
+    glDeleteTextures(1,&maEnteringSlideGL);
+    maEnteringSlideGL = 0;
 
-    mbUseLeavingPixmap = false;
-    mbUseEnteringPixmap = false;
     CHECK_GL_ERROR();
 }
 
@@ -1339,24 +1161,12 @@ OGLTransitionerImpl::OGLTransitionerImpl()
     , mxView()
     , maEnteringBytes()
     , maLeavingBytes()
-#if defined( GLX_EXT_texture_from_pixmap )
-    , maLeavingPixmapGL(0)
-    , maEnteringPixmapGL(0)
-    , maLeavingPixmap(0)
-    , maEnteringPixmap(0)
-    , mbFreeLeavingPixmap(false)
-    , mbFreeEnteringPixmap(false)
-#endif
     , mbRestoreSync(false)
-    , mbUseLeavingPixmap(false)
-    , mbUseEnteringPixmap(false)
     , maSlideBitmapLayout()
     , maSlideSize()
     , mbBrokenTexturesATI(false)
     , mnGLVersion(0)
     , mbValidOpenGLContext(false)
-    , mbGenerateMipmap(false)
-    , mbHasTFPVisual(false)
 {
 }
 
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index 89ce970..b5e0a30 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -836,4 +836,9 @@ void OpenGLContext::UseNoProgram()
     CHECK_GL_ERROR();
 }
 
+const GLWindow& OpenGLContext::getOpenGLWindow() const
+{
+    return m_aGLWin;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list