[Libreoffice-commits] core.git: Branch 'private/mmeeks/opengl-backbuffer' - 5 commits - vcl/opengl vcl/source vcl/unx

Michael Meeks michael.meeks at collabora.com
Tue Dec 1 02:06:58 PST 2015


 vcl/opengl/gdiimpl.cxx              |   11 -----------
 vcl/source/app/salvtables.cxx       |    2 --
 vcl/source/window/paint.cxx         |    2 ++
 vcl/unx/generic/window/salframe.cxx |   13 ++++++++-----
 vcl/unx/gtk/gtksalframe.cxx         |   24 ++++++++++++++++--------
 5 files changed, 26 insertions(+), 26 deletions(-)

New commits:
commit b9d4748edae66e6595691b09d296cd8ae36be2f6
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Mon Nov 30 16:22:11 2015 +0000

    Remove lots of paint debugging - squash me ...
    
    Change-Id: I968205786e7cd9857a0325b55d1a45d1adc4306c

diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index b21eb12..31813fb 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -154,10 +154,6 @@ void OpenGLSalGraphicsImpl::Init()
             mpContext->ReleaseFramebuffer( maOffscreenTex );
         }
         maOffscreenTex = OpenGLTexture();
-        SAL_DEBUG("paint: " << this << " size mismatch - delete texture " <<
-                  maOffscreenTex.GetWidth() << " x " <<
-                  maOffscreenTex.GetHeight() << " vs. " <<
-                  GetWidth() << " x " << GetHeight());
         VCL_GL_INFO("::Init - re-size offscreen texture");
     }
 
@@ -438,7 +434,6 @@ bool OpenGLSalGraphicsImpl::CheckOffscreenTexture()
             mpContext->ReleaseFramebuffer( maOffscreenTex );
             maOffscreenTex = OpenGLTexture();
             VCL_GL_INFO( "re-size offscreen texture" );
-            SAL_DEBUG( "paint: " << this << " re-size offscreen texture" );
         }
     }
 
@@ -446,8 +441,6 @@ bool OpenGLSalGraphicsImpl::CheckOffscreenTexture()
     {
         VCL_GL_INFO( "create texture of size "
                      << GetWidth() << " x " << GetHeight() );
-        SAL_DEBUG( "paint: " << this << " create texture of size "
-                   << GetWidth() << " x " << GetHeight() );
         maOffscreenTex = OpenGLTexture( GetWidth(), GetHeight() );
         bClearTexture = true;
     }
@@ -1957,7 +1950,6 @@ void OpenGLSalGraphicsImpl::flush()
 
     if( !maOffscreenTex )
     {
-        SAL_DEBUG("paint: " << this << " flush and swap - no texture !");
         VCL_GL_INFO( "flushAndSwap - odd no texture !" );
         return;
     }
@@ -1965,12 +1957,9 @@ void OpenGLSalGraphicsImpl::flush()
     if (mnDrawCountAtFlush == mnDrawCount)
     {
         VCL_GL_INFO( "eliding redundant flushAndSwap, no drawing since last!" );
-        SAL_DEBUG( "paint: " << this << " eliding redundant flushAndSwap, no drawing since last!" );
         return;
     }
 
-    SAL_DEBUG("paint: " << this << " flush and swap");
-
     mnDrawCountAtFlush = mnDrawCount;
 
     OpenGLZone aZone;
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index bc77397..fce0e69 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -63,12 +63,10 @@ void SalFrame::BeginPaint()
 {
     m_nPaintNesting++;
     assert (m_nPaintNesting > 0);
-    SAL_DEBUG("paint: " << this << " begin " << m_nPaintNesting);
 }
 
 void SalFrame::EndPaint()
 {
-    SAL_DEBUG("paint: " << this << " end " << m_nPaintNesting);
     assert (m_nPaintNesting > 0);
     if (--m_nPaintNesting == 0)
         Flush();
commit 51d246db6506f349d8c7043b2328928bae430cb4
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Mon Nov 30 16:17:09 2015 +0000

    Squash out - already upstream.
    
    Change-Id: I035080bc0b801f8ed335924efec4b043938eb82d

diff --git a/vcl/unx/gtk/gtksalframe.cxx b/vcl/unx/gtk/gtksalframe.cxx
index eb9db82..50c8b76 100644
--- a/vcl/unx/gtk/gtksalframe.cxx
+++ b/vcl/unx/gtk/gtksalframe.cxx
@@ -495,6 +495,7 @@ void GtkSalFrame::doKeyCallback( guint state,
 GtkSalFrame::GtkSalFrame( SalFrame* pParent, SalFrameStyleFlags nStyle )
     : m_nXScreen( getDisplay()->GetDefaultXScreen() )
     , m_pGraphics(nullptr)
+    , m_bGraphics(false)
 {
     getDisplay()->registerFrame( this );
     m_bDefaultPos       = true;
@@ -509,6 +510,7 @@ GtkSalFrame::GtkSalFrame( SalFrame* pParent, SalFrameStyleFlags nStyle )
 GtkSalFrame::GtkSalFrame( SystemParentData* pSysData )
     : m_nXScreen( getDisplay()->GetDefaultXScreen() )
     , m_pGraphics(nullptr)
+    , m_bGraphics(false)
 {
     getDisplay()->registerFrame( this );
     // permanently ignore errors from our unruly children ...
commit c1776c01941bf27c4a1c03f405a6dca0f08ebffb
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Mon Nov 30 16:15:03 2015 +0000

    Avoid excessive flushing by hold paint guard over window update.
    
    Change-Id: Id267e3e9245e987d98fe141d1356a7fc29d419a4

diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx
index 6402639..34462e6 100644
--- a/vcl/source/window/paint.cxx
+++ b/vcl/source/window/paint.cxx
@@ -1290,6 +1290,8 @@ void Window::Update()
     if ( !mpWindowImpl->mbReallyVisible )
         return;
 
+    OutputDevice::PaintScope aScope (this);
+
     bool bFlush = false;
     if ( mpWindowImpl->mpFrameWindow->mpWindowImpl->mbPaintFrame )
     {
commit 6ec7e89531f374b899d96478fc15cffeb9ce2daf
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Mon Nov 30 16:14:36 2015 +0000

    vcl: Don't flush if we're mid-rendering - to avoid partial contents.
    
    Change-Id: I320736051a7955044c6306a569253ca9371191e4

diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx
index 6b1bbff..aee263a 100644
--- a/vcl/unx/generic/window/salframe.cxx
+++ b/vcl/unx/generic/window/salframe.cxx
@@ -2286,11 +2286,14 @@ void X11SalFrame::SetTitle( const OUString& rTitle )
 
 void X11SalFrame::Flush()
 {
-    SAL_DEBUG("flush " << this);
-    if( pGraphics_ )
-        pGraphics_->Flush();
-    if( pFreeGraphics_ )
-        pFreeGraphics_->Flush();
+    // Don't flush if we're still painting, just wait.
+    if ( GetPaintNesting() == 0 )
+    {
+        if( pGraphics_ )
+            pGraphics_->Flush();
+        if( pFreeGraphics_ )
+            pFreeGraphics_->Flush();
+    }
     XFlush( GetDisplay()->GetDisplay() );
 }
 
diff --git a/vcl/unx/gtk/gtksalframe.cxx b/vcl/unx/gtk/gtksalframe.cxx
index 8d0fd0a..eb9db82 100644
--- a/vcl/unx/gtk/gtksalframe.cxx
+++ b/vcl/unx/gtk/gtksalframe.cxx
@@ -2623,13 +2623,20 @@ void GtkSalFrame::SetPointerPos( long nX, long nY )
 void GtkSalFrame::Flush()
 {
     if( m_pGraphics )
-        m_pGraphics->Flush();
-
+    {
+        // Don't flush if we're still painting, just wait.
+        if ( GetPaintNesting() == 0 )
+        {
+            m_pGraphics->Flush();
 #if GTK_CHECK_VERSION(3,0,0)
-    gdk_display_flush( getGdkDisplay() );
+            gdk_display_flush( getGdkDisplay() );
 #else
-    XFlush (GDK_DISPLAY_XDISPLAY (getGdkDisplay()));
+            XFlush (GDK_DISPLAY_XDISPLAY (getGdkDisplay()));
 #endif
+        }
+        else
+            SAL_WARN("vcl.opengl", "avoid erroneous flush during paint");
+    }
 }
 
 #ifndef GDK_Open
commit e656959689a55b6bd3d7d0fe64a333e3c08b5a15
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Mon Nov 30 16:13:42 2015 +0000

    vcl: gtk frames should DeInitialize properly, to handle GL cleanup.
    
    Change-Id: Ie6a5464c28b89f08639939690052023e685a3d33

diff --git a/vcl/unx/gtk/gtksalframe.cxx b/vcl/unx/gtk/gtksalframe.cxx
index c318db9..8d0fd0a 100644
--- a/vcl/unx/gtk/gtksalframe.cxx
+++ b/vcl/unx/gtk/gtksalframe.cxx
@@ -845,9 +845,11 @@ void GtkSalFrame::InvalidateGraphics()
     if( m_pGraphics )
     {
 #if !GTK_CHECK_VERSION(3,0,0)
-        m_pGraphics->SetDrawable( None, m_nXScreen );
+        m_pGraphics->DeInit();
         m_pGraphics->SetWindow(nullptr);
 #endif
+        delete m_pGraphics;
+        m_pGraphics = NULL;
         m_bGraphics = false;
     }
 }
@@ -921,9 +923,6 @@ GtkSalFrame::~GtkSalFrame()
         g_object_unref( G_OBJECT( m_pForeignParent ) );
     if( m_pForeignTopLevel )
         g_object_unref( G_OBJECT( m_pForeignTopLevel) );
-
-    delete m_pGraphics;
-    m_pGraphics = NULL;
 }
 
 void GtkSalFrame::moveWindow( long nX, long nY )


More information about the Libreoffice-commits mailing list