ooo-build r12078 - in branches/sled-10-sp1-ooo-build-2-4: . patches/src680



Author: rodo
Date: Tue Apr  1 16:00:32 2008
New Revision: 12078
URL: http://svn.gnome.org/viewvc/ooo-build?rev=12078&view=rev

Log:
2008-04-01  Radek Doulik  <rodo novell com>

	* patches/src680/apply: added transogl-detect-fix.diff with
	changes described below

	* build/ooh680-m12/slideshow/source/engine/OGLTrans/OGLTrans_TransitionerImpl.cxx:
	better detect whether GLX is present. Also fix vendor detection
	problem.

	* patches/src680/apply: added transogl-sync-fix.diff with changed
	described below

	* build/ooh680-m12/slideshow/source/engine/OGLTrans/OGLTrans_TransitionerImpl.cxx:
	do glflush and xsync for every frame to have more fluent animation
	on Mesa and possibly others



Added:
   branches/sled-10-sp1-ooo-build-2-4/patches/src680/transogl-detect-fix.diff
   branches/sled-10-sp1-ooo-build-2-4/patches/src680/transogl-sync-fix.diff
Modified:
   branches/sled-10-sp1-ooo-build-2-4/ChangeLog
   branches/sled-10-sp1-ooo-build-2-4/patches/src680/apply

Modified: branches/sled-10-sp1-ooo-build-2-4/patches/src680/apply
==============================================================================
--- branches/sled-10-sp1-ooo-build-2-4/patches/src680/apply	(original)
+++ branches/sled-10-sp1-ooo-build-2-4/patches/src680/apply	Tue Apr  1 16:00:32 2008
@@ -1639,6 +1639,8 @@
 transogl-mesa-fallback.diff
 transogl-shader-transitions-1.diff
 transogl-dispose-fix.diff
+transogl-sync-fix.diff
+transogl-detect-fix.diff
 
 [ Experimental ]
 # sal_uInt32 -> sal_uIntPtr for events on some places

Added: branches/sled-10-sp1-ooo-build-2-4/patches/src680/transogl-detect-fix.diff
==============================================================================
--- (empty file)
+++ branches/sled-10-sp1-ooo-build-2-4/patches/src680/transogl-detect-fix.diff	Tue Apr  1 16:00:32 2008
@@ -0,0 +1,128 @@
+diff -rup slideshow/source/engine/OGLTrans.orig/OGLTrans_TransitionerImpl.cxx slideshow/source/engine/OGLTrans/OGLTrans_TransitionerImpl.cxx
+--- slideshow/source/engine/OGLTrans.orig/OGLTrans_TransitionerImpl.cxx	2008-04-01 16:42:51.000000000 +0200
++++ slideshow/source/engine/OGLTrans/OGLTrans_TransitionerImpl.cxx	2008-04-01 16:44:55.000000000 +0200
+@@ -88,7 +88,7 @@ public:
+     explicit OGLTransitionerImpl(OGLTransitionImpl* pOGLTransition);
+     bool initWindowFromSlideShowView( const uno::Reference< presentation::XSlideShowView >& xView, double, double);
+     void setSlides( const uno::Reference< rendering::XBitmap >& xLeavingSlide , const uno::Reference< rendering::XBitmap >& xEnteringSlide );
+-    static void initialize( const uno::Reference< presentation::XSlideShowView >& xView );
++    static bool initialize( const uno::Reference< presentation::XSlideShowView >& xView );
+ 
+     // XTransition
+     virtual SAL_CALL void update( double nTime ) throw (uno::RuntimeException);
+@@ -165,14 +165,20 @@ public:
+     /** Whether Mesa is the OpenGL vendor
+      */
+     static bool cbMesa;
++
++    /**
++       whether the display has GLX extension
++     */
++    static bool cbGLXPresent;
+ };
+ 
+ // declare the static variables as some gcc versions have problems declaring them automaticaly
+ bool OGLTransitionerImpl::cbBrokenTexturesATI;
+ float OGLTransitionerImpl::cnGLVersion;
+ bool OGLTransitionerImpl::cbMesa;
++bool OGLTransitionerImpl::cbGLXPresent;
+ 
+-void OGLTransitionerImpl::initialize( const uno::Reference< presentation::XSlideShowView >& xView )
++bool OGLTransitionerImpl::initialize( const uno::Reference< presentation::XSlideShowView >& xView )
+ {
+     // not thread safe
+     static bool initialized = false;
+@@ -181,28 +187,34 @@ void OGLTransitionerImpl::initialize( co
+         OGLTransitionerImpl *instance;
+ 
+         instance = new OGLTransitionerImpl( NULL );
+-        instance->initWindowFromSlideShowView( xView, 0, 0 );
++        if( instance->initWindowFromSlideShowView( xView, 0, 0 ) ) {
+ 
+-        const GLubyte* version = glGetString( GL_VERSION );
+-        if( version && version[0] ) {
+-            cnGLVersion = version[0] - '0';
+-            if( version[1] == '.' && version[2] )
+-                cnGLVersion += (version[2] - '0')/10.0;
+-        } else
+-            cnGLVersion = 1.0;
+-        OSL_TRACE("GL version: %s parsed: %f", version, cnGLVersion );
++            const GLubyte* version = glGetString( GL_VERSION );
++            if( version && version[0] ) {
++                cnGLVersion = version[0] - '0';
++                if( version[1] == '.' && version[2] )
++                    cnGLVersion += (version[2] - '0')/10.0;
++            } else
++                cnGLVersion = 1.0;
++            OSL_TRACE("GL version: %s parsed: %f", version, cnGLVersion );
++
++            const GLubyte* vendor = glGetString( GL_VENDOR );
++            cbMesa = ( vendor && strstr( (const char *) vendor, "Mesa" ) );
++            OSL_TRACE("GL vendor: %s identified as Mesa: %d", vendor, cbMesa );
+ 
+-        const GLubyte* vendor = glGetString( GL_VENDOR );
+-        cbMesa = ( vendor && strstr( (const char *) vendor, "Mesa" ) );
+-        OSL_TRACE("GL vendor: %s identified as Mesa: %d", vendor, cbMesa );
++            /* TODO: check for version once the bug in fglrx driver is fixed */
++            cbBrokenTexturesATI = (vendor && strcmp( (const char *) vendor, "ATI Technologies Inc." ) == 0 );
+ 
+-        /* TODO: check for version once the bug in fglrx driver is fixed */
+-        cbBrokenTexturesATI = (strcmp( (const char *) glGetString( GL_VENDOR ), "ATI Technologies Inc." ) == 0 );
++            instance->disposing();
++            cbGLXPresent = true;
++        } else
++            cbGLXPresent = false;
+ 
+-        instance->disposing();
+         delete instance;
+         initialized = true;
+     }
++
++    return cbGLXPresent;
+ }
+ 
+ bool OGLTransitionerImpl::initWindowFromSlideShowView( const uno::Reference< presentation::XSlideShowView >& xView, double, double)
+@@ -226,6 +238,10 @@ bool OGLTransitionerImpl::initWindowFrom
+ 
+     const SystemEnvData* sysData(pPWindow->GetSystemData());
+     GLWin.dpy = reinterpret_cast<unx::Display*>(sysData->pDisplay);
++
++    if( unx::glXQueryExtension( GLWin.dpy, NULL, NULL ) == false )
++        return false;
++
+     GLWin.win = sysData->aWindow;
+     GLWin.screen = unx::XDefaultScreen(GLWin.dpy);
+     unx::XVisualInfo* vi( NULL );
+@@ -543,7 +559,7 @@ void SAL_CALL OGLTransitionerImpl::updat
+ {
+     osl::MutexGuard const guard( m_aMutex );
+ 
+-    if (isDisposed() || pTransition->mnRequiredGLVersion > cnGLVersion)
++    if (isDisposed() || !cbGLXPresent || pTransition->mnRequiredGLVersion > cnGLVersion)
+         return;
+ 
+     glEnable(GL_DEPTH_TEST);
+@@ -654,7 +670,7 @@ public:
+         if( !hasTransition( transitionType, transitionSubType ) )
+             return uno::Reference< presentation::XTransition >();
+ 
+-        OGLTransitionerImpl::initialize( view );
++        bool bGLXPresent = OGLTransitionerImpl::initialize( view );
+ 
+         if( OGLTransitionerImpl::cbMesa && (
+             ( transitionType == animations::TransitionType::FADE && transitionSubType == animations::TransitionSubType::CROSSFADE ) ||
+@@ -721,9 +737,11 @@ public:
+ 
+         rtl::Reference<OGLTransitionerImpl> xRes(
+             new OGLTransitionerImpl(pTransition) );
+-        if(!xRes->initWindowFromSlideShowView(view,slideOffset.X,slideOffset.Y))
+-            return uno::Reference< presentation::XTransition >();
+-        xRes->setSlides(leavingBitmap,enteringBitmap);
++        if( bGLXPresent ) {
++            if( !xRes->initWindowFromSlideShowView(view,slideOffset.X,slideOffset.Y))
++                return uno::Reference< presentation::XTransition >();
++            xRes->setSlides(leavingBitmap,enteringBitmap);
++        }
+ 
+         return uno::Reference<presentation::XTransition>(xRes.get());
+     }

Added: branches/sled-10-sp1-ooo-build-2-4/patches/src680/transogl-sync-fix.diff
==============================================================================
--- (empty file)
+++ branches/sled-10-sp1-ooo-build-2-4/patches/src680/transogl-sync-fix.diff	Tue Apr  1 16:00:32 2008
@@ -0,0 +1,48 @@
+diff -rup slideshow/source/engine/OGLTrans-orig1/OGLTrans_TransitionerImpl.cxx slideshow/source/engine/OGLTrans/OGLTrans_TransitionerImpl.cxx
+--- slideshow/source/engine/OGLTrans-orig1/OGLTrans_TransitionerImpl.cxx	2008-03-28 11:00:45.000000000 +0100
++++ slideshow/source/engine/OGLTrans/OGLTrans_TransitionerImpl.cxx	2008-03-28 11:22:52.000000000 +0100
+@@ -183,16 +183,6 @@ void OGLTransitionerImpl::initialize( co
+         instance = new OGLTransitionerImpl( NULL );
+         instance->initWindowFromSlideShowView( xView, 0, 0 );
+ 
+-        if( instance->GLWin.HasGLXExtension("GLX_SGI_swap_control" ) ) {
+-            // enable vsync
+-            typedef GLint (*glXSwapIntervalProc)(GLint);
+-            glXSwapIntervalProc glXSwapInterval = (glXSwapIntervalProc) unx::glXGetProcAddress( (const GLubyte*) "glXSwapIntervalSGI" );
+-            if( glXSwapInterval ) {
+-                glXSwapInterval( 1 );
+-                OSL_TRACE("set swap interval to 1 (enable vsync)");
+-            }
+-        }
+-
+         const GLubyte* version = glGetString( GL_VERSION );
+         if( version && version[0] ) {
+             cnGLVersion = version[0] - '0';
+@@ -349,6 +339,16 @@ bool OGLTransitionerImpl::initWindowFrom
+         return false;
+     }
+ 
++    if( GLWin.HasGLXExtension("GLX_SGI_swap_control" ) ) {
++        // enable vsync
++        typedef GLint (*glXSwapIntervalProc)(GLint);
++        glXSwapIntervalProc glXSwapInterval = (glXSwapIntervalProc) unx::glXGetProcAddress( (const GLubyte*) "glXSwapIntervalSGI" );
++        if( glXSwapInterval ) {
++            glXSwapInterval( 1 );
++            OSL_TRACE("set swap interval to 1 (enable vsync)");
++        }
++    }
++
+     glEnable(GL_CULL_FACE);
+     glCullFace(GL_BACK);
+     glClearColor (0, 0, 0, 0);
+@@ -557,6 +557,10 @@ void SAL_CALL OGLTransitionerImpl::updat
+ 	unx::glXSwapBuffers(GLWin.dpy, GLWin.win);
+ 	if( pWindow )
+         pWindow->Show();
++
++    /* flush & sync */
++    glFlush();
++    XSync( GLWin.dpy, false );
+ }
+ 
+ // we are about to be disposed (someone call dispose() on us)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]