[Libreoffice-commits] core.git: include/vcl offapi/com toolkit/Library_tk.mk toolkit/source vcl/source
Tor Lillqvist
tml at collabora.com
Tue Jan 26 01:44:30 PST 2016
include/vcl/opengl/OpenGLContext.hxx | 5 +++++
offapi/com/sun/star/awt/XToolkitExperimental.idl | 5 +++++
toolkit/Library_tk.mk | 5 ++++-
toolkit/source/awt/vclxtoolkit.cxx | 19 +++++++++++++++++++
vcl/source/opengl/OpenGLContext.cxx | 9 +++++++++
5 files changed, 42 insertions(+), 1 deletion(-)
New commits:
commit 2c55288357c9d5410afae58c1fbb97cdfabf0360
Author: Tor Lillqvist <tml at collabora.com>
Date: Tue Jan 26 11:17:57 2016 +0200
Add API to get the number of OpenGL buffer swaps, including through UNO
Change-Id: Iff29ac615ad4b6516790b1cbbde0215a3cd0efe6
diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx
index d5a9e31..2b4af08 100644
--- a/include/vcl/opengl/OpenGLContext.hxx
+++ b/include/vcl/opengl/OpenGLContext.hxx
@@ -186,6 +186,9 @@ public:
/// reset the GL context so this context is not implicit in subsequent GL calls.
void resetCurrent();
void swapBuffers();
+
+ static sal_Int64 getBufferSwapCounter();
+
void sync();
void show();
@@ -249,6 +252,8 @@ private:
ProgramCollection maPrograms;
OpenGLProgram* mpCurrentProgram;
+ static sal_Int64 mnBufferSwapCounter;
+
public:
vcl::Region maClipRegion;
int mnPainting;
diff --git a/offapi/com/sun/star/awt/XToolkitExperimental.idl b/offapi/com/sun/star/awt/XToolkitExperimental.idl
index 3b73057..7c5d363 100644
--- a/offapi/com/sun/star/awt/XToolkitExperimental.idl
+++ b/offapi/com/sun/star/awt/XToolkitExperimental.idl
@@ -22,6 +22,11 @@ interface XToolkitExperimental : XToolkit2
/** Process all pending idle events
*/
void processEventsToIdle();
+
+
+ /** Get the number of OpenGL buffer swaps.
+ */
+ hyper getOpenGLBufferSwapCounter();
};
}; }; }; };
diff --git a/toolkit/Library_tk.mk b/toolkit/Library_tk.mk
index e5aaad5..1136e2e 100644
--- a/toolkit/Library_tk.mk
+++ b/toolkit/Library_tk.mk
@@ -21,7 +21,10 @@ $(eval $(call gb_Library_Library,tk))
$(eval $(call gb_Library_set_componentfile,tk,toolkit/util/tk))
-$(eval $(call gb_Library_use_external,tk,boost_headers))
+$(eval $(call gb_Library_use_externals,tk,\
+ boost_headers \
+ glew \
+))
$(eval $(call gb_Library_set_include,tk,\
$$(INCLUDE) \
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index 6929c58..7fe5032 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -22,6 +22,13 @@
#include <prewin.h>
#include <postwin.h>
#endif
+#if defined UNX && !defined MACOSX
+#include <prex.h>
+#include "GL/glxew.h"
+#include <postx.h>
+#undef None // Avoid clash with the one in <toolkit/awt/scrollabledialog.hxx>
+#undef Status // Sigh... used for instance as parameter name in css::awt::XImageConsumer
+#endif
#include <com/sun/star/awt/WindowAttribute.hpp>
#include <com/sun/star/awt/VclWindowPeerAttribute.hpp>
#include <com/sun/star/awt/WindowClass.hpp>
@@ -113,6 +120,7 @@
#include <vcl/window.hxx>
#include <vcl/wrkwin.hxx>
#include <vcl/throbber.hxx>
+#include <vcl/opengl/OpenGLContext.hxx>
#include "toolkit/awt/vclxspinbutton.hxx"
#include <tools/debug.hxx>
#include <comphelper/processfactory.hxx>
@@ -195,6 +203,9 @@ public:
virtual void SAL_CALL processEventsToIdle()
throw (css::uno::RuntimeException, std::exception) override;
+ virtual sal_Int64 SAL_CALL getOpenGLBufferSwapCounter()
+ throw (css::uno::RuntimeException, std::exception) override;
+
// css::awt::XToolkit
css::uno::Reference< css::awt::XWindowPeer > SAL_CALL getDesktopWindow( ) throw(css::uno::RuntimeException, std::exception) override;
css::awt::Rectangle SAL_CALL getWorkArea( ) throw(css::uno::RuntimeException, std::exception) override;
@@ -1906,6 +1917,8 @@ void SAL_CALL VCLXToolkit::reschedule()
Application::Reschedule(true);
}
+// css::awt::XToolkitExperimental
+
void SAL_CALL VCLXToolkit::processEventsToIdle()
throw (css::uno::RuntimeException, std::exception)
{
@@ -1913,6 +1926,12 @@ void SAL_CALL VCLXToolkit::processEventsToIdle()
Scheduler::ProcessEventsToIdle();
}
+sal_Int64 SAL_CALL VCLXToolkit::getOpenGLBufferSwapCounter()
+ throw (css::uno::RuntimeException, std::exception)
+{
+ return OpenGLContext::getBufferSwapCounter();
+}
+
// css:awt:XToolkitRobot
void SAL_CALL VCLXToolkit::keyPress( const css::awt::KeyEvent & aKeyEvent )
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index f409bec..a1296a9 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -50,6 +50,8 @@ static std::vector<GLXContext> g_vShareList;
static std::vector<HGLRC> g_vShareList;
#endif
+sal_Int64 OpenGLContext::mnBufferSwapCounter = 0;
+
GLWindow::~GLWindow()
{
#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID && !defined(LIBO_HEADLESS)
@@ -1535,6 +1537,8 @@ void OpenGLContext::swapBuffers()
glXSwapBuffers(m_aGLWin.dpy, m_aGLWin.win);
#endif
+ mnBufferSwapCounter++;
+
static bool bSleep = getenv("SAL_GL_SLEEP_ON_SWAP");
if (bSleep)
{
@@ -1544,6 +1548,11 @@ void OpenGLContext::swapBuffers()
}
}
+sal_Int64 OpenGLContext::getBufferSwapCounter()
+{
+ return mnBufferSwapCounter;
+}
+
void OpenGLContext::sync()
{
OpenGLZone aZone;
More information about the Libreoffice-commits
mailing list