summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2016-01-26 11:17:57 +0200
committerTor Lillqvist <tml@collabora.com>2016-01-26 11:43:50 +0200
commit2c55288357c9d5410afae58c1fbb97cdfabf0360 (patch)
tree5cd0ab352add75f31bb5d7eadf05e5257ed3d424
parent7c151f39144b7401a99c7b736a41e5dce4ac4db1 (diff)
Add API to get the number of OpenGL buffer swaps, including through UNO
Change-Id: Iff29ac615ad4b6516790b1cbbde0215a3cd0efe6
-rw-r--r--include/vcl/opengl/OpenGLContext.hxx5
-rw-r--r--offapi/com/sun/star/awt/XToolkitExperimental.idl5
-rw-r--r--toolkit/Library_tk.mk5
-rw-r--r--toolkit/source/awt/vclxtoolkit.cxx19
-rw-r--r--vcl/source/opengl/OpenGLContext.cxx9
5 files changed, 42 insertions, 1 deletions
diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx
index d5a9e3142173..2b4af081b755 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 3b7305739331..7c5d36331958 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 e5aaad5083e4..1136e2e65896 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 6929c5849045..7fe5032df1b4 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 f409bec72d01..a1296a99ae97 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;