Skip to content

Commit

Permalink
Merge pull request #441 from popcornmix/windowing
Browse files Browse the repository at this point in the history
rbp: kill g_Windowing
  • Loading branch information
FernetMenta committed Nov 24, 2017
2 parents 3090144 + 3b175d1 commit 285fff2
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 20 deletions.
1 change: 0 additions & 1 deletion xbmc/cores/VideoPlayer/DVDCodecs/Video/MMALCodec.cpp
Expand Up @@ -31,7 +31,6 @@
#include "ServiceBroker.h"
#include "DVDClock.h"
#include "DVDStreamInfo.h"
#include "windowing/WindowingFactory.h"
#include "cores/VideoPlayer/DVDCodecs/DVDCodecs.h"
#include "cores/VideoPlayer/DVDCodecs/DVDFactoryCodec.h"
#include "DVDVideoCodec.h"
Expand Down
Expand Up @@ -34,7 +34,6 @@
#include "threads/SingleLock.h"
#include "utils/log.h"
#include "utils/MathUtils.h"
#include "windowing/WindowingFactory.h"
#include "cores/VideoPlayer/DVDCodecs/Video/MMALCodec.h"
#include "cores/VideoPlayer/DVDCodecs/Video/MMALFFmpeg.h"
#include "xbmc/Application.h"
Expand Down
20 changes: 13 additions & 7 deletions xbmc/cores/omxplayer/OMXImage.cpp
Expand Up @@ -32,7 +32,8 @@
#include "settings/Settings.h"
#include "linux/RBP.h"
#include "utils/URIUtils.h"
#include "windowing/WindowingFactory.h"
#include "windowing/WinSystem.h"
#include "windowing/rpi/WinSystemRpiGLESContext.h"
#include "Application.h"
#include <algorithm>
#include <cassert>
Expand Down Expand Up @@ -223,7 +224,8 @@ bool COMXImage::SendMessage(bool (*callback)(EGLDisplay egl_display, EGLContext
// we can only call gl functions from the application thread or texture thread
if ( g_application.IsCurrentThread() )
{
return callback(g_Windowing.GetEGLDisplay(), GetEGLContext(), cookie);
CWinSystemRpiGLESContext &winsystem = static_cast<CWinSystemRpiGLESContext &>(CServiceBroker::GetWinSystem());
return callback(winsystem.GetEGLDisplay(), GetEGLContext(), cookie);
}
struct callbackinfo mess;
mess.callback = callback;
Expand Down Expand Up @@ -335,8 +337,9 @@ bool COMXImage::DecodeJpegToTexture(COMXImageFile *file, unsigned int width, uns
EGLContext COMXImage::GetEGLContext()
{
CSingleLock lock(m_texqueue_lock);
CWinSystemRpiGLESContext &winsystem = static_cast<CWinSystemRpiGLESContext &>(CServiceBroker::GetWinSystem());
if (g_application.IsCurrentThread())
return g_Windowing.GetEGLContext();
return winsystem.GetEGLContext();
if (m_egl_context == EGL_NO_CONTEXT)
CreateContext();
return m_egl_context;
Expand Down Expand Up @@ -386,7 +389,8 @@ void COMXImage::CreateContext()
{
EGLConfig egl_config;
GLint m_result;
EGLDisplay egl_display = g_Windowing.GetEGLDisplay();
CWinSystemRpiGLESContext &winsystem = static_cast<CWinSystemRpiGLESContext &>(CServiceBroker::GetWinSystem());
EGLDisplay egl_display = winsystem.GetEGLDisplay();

eglInitialize(egl_display, NULL, NULL);
CheckError();
Expand All @@ -413,7 +417,7 @@ void COMXImage::CreateContext()
CLog::Log(LOGERROR, "%s: Could not find a compatible configuration",__FUNCTION__);
return;
}
m_egl_context = eglCreateContext(egl_display, egl_config, g_Windowing.GetEGLContext(), contextAttrs);
m_egl_context = eglCreateContext(egl_display, egl_config, winsystem.GetEGLContext(), contextAttrs);
CheckError();
if (m_egl_context == EGL_NO_CONTEXT)
{
Expand Down Expand Up @@ -451,7 +455,8 @@ void COMXImage::Process()
m_texqueue.pop();
lock.Leave();

mess->result = mess->callback(g_Windowing.GetEGLDisplay(), GetEGLContext(), mess->cookie);
CWinSystemRpiGLESContext &winsystem = static_cast<CWinSystemRpiGLESContext &>(CServiceBroker::GetWinSystem());
mess->result = mess->callback(winsystem.GetEGLDisplay(), GetEGLContext(), mess->cookie);
{
CSingleLock lock(m_texqueue_lock);
mess->sync.Set();
Expand Down Expand Up @@ -1982,7 +1987,8 @@ void COMXTexture::Close()

bool COMXTexture::HandlePortSettingChange(unsigned int resize_width, unsigned int resize_height, void *egl_image, bool port_settings_changed)
{
EGLDisplay egl_display = g_Windowing.GetEGLDisplay();
CWinSystemRpiGLESContext &winsystem = static_cast<CWinSystemRpiGLESContext &>(CServiceBroker::GetWinSystem());
EGLDisplay egl_display = winsystem.GetEGLDisplay();
OMX_ERRORTYPE omx_err;

if (port_settings_changed)
Expand Down
1 change: 0 additions & 1 deletion xbmc/cores/omxplayer/OMXPlayerVideo.cpp
Expand Up @@ -34,7 +34,6 @@

#include "DVDDemuxers/DVDDemuxUtils.h"
#include "DVDCodecs/DVDCodecUtils.h"
#include "windowing/WindowingFactory.h"
#include "settings/DisplaySettings.h"
#include "settings/Settings.h"
#include "settings/MediaSettings.h"
Expand Down
1 change: 0 additions & 1 deletion xbmc/guilib/TexturePi.cpp
Expand Up @@ -20,7 +20,6 @@

#include "system.h"
#include "Texture.h"
#include "windowing/WindowingFactory.h"
#include "utils/log.h"
#include "utils/GLUtils.h"
#include "guilib/TextureManager.h"
Expand Down
7 changes: 4 additions & 3 deletions xbmc/windowing/rpi/VideoSyncPi.cpp
Expand Up @@ -21,8 +21,9 @@
#include "system.h"

#include "VideoSyncPi.h"
#include "ServiceBroker.h"
#include "guilib/GraphicContext.h"
#include "windowing/WindowingFactory.h"
#include "windowing/WinSystem.h"
#include "utils/TimeUtils.h"
#include "utils/log.h"
#include "linux/RBP.h"
Expand All @@ -32,7 +33,7 @@ bool CVideoSyncPi::Setup(PUPDATECLOCK func)
{
UpdateClock = func;
m_abort = false;
g_Windowing.Register(this);
CServiceBroker::GetWinSystem().Register(this);
CLog::Log(LOGDEBUG, "CVideoReferenceClock: setting up RPi");
return true;
}
Expand All @@ -53,7 +54,7 @@ void CVideoSyncPi::Run(CEvent& stopEvent)
void CVideoSyncPi::Cleanup()
{
CLog::Log(LOGDEBUG, "CVideoReferenceClock: cleaning up RPi");
g_Windowing.Unregister(this);
CServiceBroker::GetWinSystem().Unregister(this);
}

float CVideoSyncPi::GetFps()
Expand Down
2 changes: 0 additions & 2 deletions xbmc/windowing/rpi/WinSystemRpi.cpp
Expand Up @@ -39,8 +39,6 @@

CWinSystemRpi::CWinSystemRpi()
{
m_eWindowSystem = WINDOW_SYSTEM_RPI;

m_nativeDisplay = EGL_NO_DISPLAY;
m_nativeWindow = EGL_NO_SURFACE;

Expand Down
7 changes: 7 additions & 0 deletions xbmc/windowing/rpi/WinSystemRpiGLESContext.cpp
Expand Up @@ -34,6 +34,13 @@

using namespace KODI;


std::unique_ptr<CWinSystemBase> CWinSystemBase::CreateWinSystem()
{
std::unique_ptr<CWinSystemBase> winSystem(new CWinSystemRpiGLESContext());
return winSystem;
}

bool CWinSystemRpiGLESContext::InitWindowSystem()
{
if (!CWinSystemRpi::InitWindowSystem())
Expand Down
4 changes: 0 additions & 4 deletions xbmc/windowing/rpi/WinSystemRpiGLESContext.h
Expand Up @@ -22,7 +22,6 @@

#include "GLContextEGL.h"
#include "rendering/gles/RenderSystemGLES.h"
#include "utils/GlobalsHandling.h"
#include "WinSystemRpi.h"

class CWinSystemRpiGLESContext : public CWinSystemRpi, public CRenderSystemGLES
Expand Down Expand Up @@ -53,6 +52,3 @@ class CWinSystemRpiGLESContext : public CWinSystemRpi, public CRenderSystemGLES
CGLContextEGL m_pGLContext;

};

XBMC_GLOBAL_REF(CWinSystemRpiGLESContext, g_Windowing);
#define g_Windowing XBMC_GLOBAL_USE(CWinSystemRpiGLESContext)

0 comments on commit 285fff2

Please sign in to comment.