diff options
author | popcornmix <popcornmix@gmail.com> | 2014-10-30 12:40:48 +0000 |
---|---|---|
committer | Rainer Hochecker <fernetmenta@online.de> | 2014-10-31 21:45:12 +0100 |
commit | 8cf74b47b1c9b896838871350a53fc497fe78305 (patch) | |
tree | 77ed75dfb652300597b171f081ab250bdc3f6431 | |
parent | 1c490a01645f72c3129c16cf21953fe27cdfb4ff (diff) |
[egl] Add support for calling OnResetDevice on display mode change
-rw-r--r-- | xbmc/windowing/egl/WinSystemEGL.cpp | 21 | ||||
-rw-r--r-- | xbmc/windowing/egl/WinSystemEGL.h | 5 |
2 files changed, 26 insertions, 0 deletions
diff --git a/xbmc/windowing/egl/WinSystemEGL.cpp b/xbmc/windowing/egl/WinSystemEGL.cpp index 6de3532619..d2a94c92f4 100644 --- a/xbmc/windowing/egl/WinSystemEGL.cpp +++ b/xbmc/windowing/egl/WinSystemEGL.cpp @@ -29,6 +29,8 @@ #include "settings/AdvancedSettings.h" #include "settings/Settings.h" #include "settings/DisplaySettings.h" +#include "guilib/DispResource.h" +#include "threads/SingleLock.h" #include "utils/log.h" #include "EGLWrapper.h" #include "EGLQuirks.h" @@ -282,6 +284,11 @@ bool CWinSystemEGL::CreateNewWindow(const CStdString& name, bool fullScreen, RES } Show(); + CSingleLock lock(m_resourceSection); + // tell any shared resources + for (std::vector<IDispResource *>::iterator i = m_resources.begin(); i != m_resources.end(); i++) + (*i)->OnResetDevice(); + return true; } @@ -472,6 +479,20 @@ bool CWinSystemEGL::Show(bool raise) return m_egl->ShowWindow(true); } +void CWinSystemEGL::Register(IDispResource *resource) +{ + CSingleLock lock(m_resourceSection); + m_resources.push_back(resource); +} + +void CWinSystemEGL::Unregister(IDispResource* resource) +{ + CSingleLock lock(m_resourceSection); + std::vector<IDispResource*>::iterator i = find(m_resources.begin(), m_resources.end(), resource); + if (i != m_resources.end()) + m_resources.erase(i); +} + EGLDisplay CWinSystemEGL::GetEGLDisplay() { return m_display; diff --git a/xbmc/windowing/egl/WinSystemEGL.h b/xbmc/windowing/egl/WinSystemEGL.h index 6c15471592..654889540c 100644 --- a/xbmc/windowing/egl/WinSystemEGL.h +++ b/xbmc/windowing/egl/WinSystemEGL.h @@ -29,6 +29,7 @@ #include "windowing/WinSystem.h" class CEGLWrapper; +class IDispResource; class CWinSystemEGL : public CWinSystemBase, public CRenderSystemGLES { @@ -55,6 +56,8 @@ public: virtual bool Restore() ; virtual bool Hide(); virtual bool Show(bool raise = true); + virtual void Register(IDispResource *resource); + virtual void Unregister(IDispResource *resource); virtual bool Support3D(int width, int height, uint32_t mode) const; virtual bool ClampToGUIDisplayLimits(int &width, int &height); @@ -79,6 +82,8 @@ protected: CEGLWrapper *m_egl; std::string m_extensions; + CCriticalSection m_resourceSection; + std::vector<IDispResource*> m_resources; }; XBMC_GLOBAL_REF(CWinSystemEGL,g_Windowing); |