include/vcl/opengl/OpenGLWrapper.hxx | 6 +++++ offapi/com/sun/star/awt/XToolkitExperimental.idl | 5 ++++ toolkit/Library_tk.mk | 5 +++- toolkit/source/awt/vclxtoolkit.cxx | 12 ++++++++++ vcl/Library_vcl.mk | 4 --- vcl/inc/OpenGLWrapper.hxx | 20 ----------------- vcl/osx/OpenGLWrapper.cxx | 27 ----------------------- vcl/source/opengl/OpenGLContext.cxx | 23 ++++++++++++++----- 8 files changed, 44 insertions(+), 58 deletions(-)
New commits: commit 59ebd032b834f31f2b3069395f7e7962a0adfea2 Author: Tor Lillqvist <t...@collabora.com> Date: Tue Jan 26 11:17:57 2016 +0200 tdf#97633 Add API to get the number of OpenGL buffer swaps, including ... ... through UNO (cherry picked from commits dff18c2be9c72aa05940982f506804eb41d3d79a, 2c55288357c9d5410afae58c1fbb97cdfabf0360, 32d98b2551644dea50e58f99ae921a82a0f69753 and 4cd058f3f6568724c65ac88769f17fcc6078da23) Change-Id: Iff29ac615ad4b6516790b1cbbde0215a3cd0efe6 Reviewed-on: https://gerrit.libreoffice.org/22209 Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> Tested-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/include/vcl/opengl/OpenGLWrapper.hxx b/include/vcl/opengl/OpenGLWrapper.hxx index e73aa08..3b7f6a7 100644 --- a/include/vcl/opengl/OpenGLWrapper.hxx +++ b/include/vcl/opengl/OpenGLWrapper.hxx @@ -23,6 +23,12 @@ struct VCL_DLLPUBLIC OpenGLWrapper * Returns true if VCL has OpenGL rendering enabled */ static bool isVCLOpenGLEnabled(); + + + /** + * Returns the number of times OpenGL buffers have been swapped. + */ + static sal_Int64 getBufferSwapCounter(); }; #endif // INCLUDED_VCL_OPENGL_OPENGLWRAPPER_HXX 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 32aa182..3b5548b 100644 --- a/toolkit/source/awt/vclxtoolkit.cxx +++ b/toolkit/source/awt/vclxtoolkit.cxx @@ -113,6 +113,7 @@ #include <vcl/window.hxx> #include <vcl/wrkwin.hxx> #include <vcl/throbber.hxx> +#include <vcl/opengl/OpenGLWrapper.hxx> #include "toolkit/awt/vclxspinbutton.hxx" #include <tools/debug.hxx> #include <comphelper/processfactory.hxx> @@ -195,6 +196,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 +1910,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 +1919,12 @@ void SAL_CALL VCLXToolkit::processEventsToIdle() Scheduler::ProcessEventsToIdle(); } +sal_Int64 SAL_CALL VCLXToolkit::getOpenGLBufferSwapCounter() + throw (css::uno::RuntimeException, std::exception) +{ + return OpenGLWrapper::getBufferSwapCounter(); +} + // css:awt:XToolkitRobot void SAL_CALL VCLXToolkit::keyPress( const css::awt::KeyEvent & aKeyEvent ) diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index b0804a0..a9fe72f 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -106,10 +106,6 @@ $(eval $(call gb_Library_add_cxxflags,vcl,\ $(gb_OBJCXXFLAGS) \ )) -$(eval $(call gb_Library_add_exception_objects,vcl,\ - vcl/osx/OpenGLWrapper \ -)) - endif ifeq ($(ENABLE_JAVA),TRUE) diff --git a/vcl/inc/OpenGLWrapper.hxx b/vcl/inc/OpenGLWrapper.hxx deleted file mode 100644 index 9134801..0000000 --- a/vcl/inc/OpenGLWrapper.hxx +++ /dev/null @@ -1,20 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -#include "AppKit/NSOpenGLView.h" -#include "AppKit/NSOpenGL.h" - -namespace OpenGLWrapper -{ - void swapBuffers(NSOpenGLView* pView); - void makeCurrent(NSOpenGLView* pView); - void resetCurrent(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/osx/OpenGLWrapper.cxx b/vcl/osx/OpenGLWrapper.cxx deleted file mode 100644 index fc008f4..0000000 --- a/vcl/osx/OpenGLWrapper.cxx +++ /dev/null @@ -1,27 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -#include "OpenGLWrapper.hxx" - -void OpenGLWrapper::swapBuffers(NSOpenGLView* pView) -{ - [[pView openGLContext] flushBuffer]; -} - -void OpenGLWrapper::makeCurrent(NSOpenGLView* pView) -{ - [[pView openGLContext] makeCurrentContext]; -} - -void OpenGLWrapper::resetCurrent() -{ - [NSOpenGLContext clearCurrentContext]; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx index 82d987d..bdd6a4e 100644 --- a/vcl/source/opengl/OpenGLContext.cxx +++ b/vcl/source/opengl/OpenGLContext.cxx @@ -11,6 +11,7 @@ #include <vcl/opengl/OpenGLContext.hxx> #include <vcl/opengl/OpenGLHelper.hxx> +#include <vcl/opengl/OpenGLWrapper.hxx> #include <vcl/syschild.hxx> #include <vcl/sysdata.hxx> @@ -22,7 +23,8 @@ #if defined(MACOSX) #include <premac.h> -#include "OpenGLWrapper.hxx" +#include <AppKit/NSOpenGLView.h> +#include <AppKit/NSOpenGL.h> #include <postmac.h> #endif @@ -49,6 +51,8 @@ static std::vector<GLXContext> g_vShareList; static std::vector<HGLRC> g_vShareList; #endif +static sal_Int64 nBufferSwapCounter = 0; + GLWindow::~GLWindow() { #if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID && !defined(LIBO_HEADLESS) @@ -991,7 +995,7 @@ bool OpenGLContext::ImplInit() VCL_GL_INFO("OpenGLContext::ImplInit----start"); NSOpenGLView* pView = getOpenGLView(); - OpenGLWrapper::makeCurrent(pView); + [[pView openGLContext] makeCurrentContext]; bool bRet = InitGLEW(); InitGLEWDebugging(); @@ -1265,7 +1269,7 @@ void OpenGLContext::reset() m_aGLWin.hRC = 0; } #elif defined( MACOSX ) - OpenGLWrapper::resetCurrent(); + [NSOpenGLContext clearCurrentContext]; #elif defined( IOS ) || defined( ANDROID ) || defined(LIBO_HEADLESS) // nothing #elif defined( UNX ) @@ -1421,7 +1425,7 @@ void OpenGLContext::makeCurrent() } #elif defined( MACOSX ) NSOpenGLView* pView = getOpenGLView(); - OpenGLWrapper::makeCurrent(pView); + [[pView openGLContext] makeCurrentContext]; #elif defined( IOS ) || defined( ANDROID ) || defined(LIBO_HEADLESS) // nothing #elif defined( UNX ) @@ -1512,7 +1516,7 @@ void OpenGLContext::resetCurrent() wglMakeCurrent(NULL, NULL); #elif defined( MACOSX ) (void) this; // loplugin:staticmethods - OpenGLWrapper::resetCurrent(); + [NSOpenGLContext clearCurrentContext]; #elif defined( IOS ) || defined( ANDROID ) || defined(LIBO_HEADLESS) // nothing #elif defined( UNX ) @@ -1529,13 +1533,15 @@ void OpenGLContext::swapBuffers() SwapBuffers(m_aGLWin.hDC); #elif defined( MACOSX ) NSOpenGLView* pView = getOpenGLView(); - OpenGLWrapper::swapBuffers(pView); + [[pView openGLContext] flushBuffer]; #elif defined( IOS ) || defined( ANDROID ) || defined(LIBO_HEADLESS) // nothing #elif defined( UNX ) glXSwapBuffers(m_aGLWin.dpy, m_aGLWin.win); #endif + nBufferSwapCounter++; + static bool bSleep = getenv("SAL_GL_SLEEP_ON_SWAP"); if (bSleep) { @@ -1545,6 +1551,11 @@ void OpenGLContext::swapBuffers() } } +sal_Int64 OpenGLWrapper::getBufferSwapCounter() +{ + return nBufferSwapCounter; +} + void OpenGLContext::sync() { OpenGLZone aZone; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits