| 1 |
/* |
| 2 |
* Copyright (C) 2005-2018 Team Kodi |
| 3 |
* This file is part of Kodi - https://kodi.tv |
| 4 |
* |
| 5 |
* SPDX-License-Identifier: GPL-2.0-or-later |
| 6 |
* See LICENSES/README.md for more information. |
| 7 |
*/ |
| 8 |
|
| 9 |
#pragma once |
| 10 |
|
| 11 |
#include "guilib/DispResource.h" |
| 12 |
#include "threads/Event.h" |
| 13 |
#include "windowing/VideoSync.h" |
| 14 |
|
| 15 |
#include <GL/glx.h> |
| 16 |
#include <X11/X.h> |
| 17 |
#include <X11/Xlib.h> |
| 18 |
|
| 19 |
#include "system_gl.h" |
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
namespace KODI |
| 24 |
{ |
| 25 |
namespace WINDOWING |
| 26 |
{ |
| 27 |
namespace X11 |
| 28 |
{ |
| 29 |
|
| 30 |
class CWinSystemX11GLContext; |
| 31 |
|
| 32 |
class CVideoSyncGLX : public CVideoSync, IDispResource |
| 33 |
{ |
| 34 |
public: |
| 35 |
explicit CVideoSyncGLX(CVideoReferenceClock* clock, CWinSystemX11GLContext& winSystem) |
| 36 |
: CVideoSync(clock), m_winSystem(winSystem) |
| 37 |
{ |
| 38 |
} |
| 39 |
bool Setup() override; |
| 40 |
void Run(CEvent& stopEvent) override; |
| 41 |
void Cleanup() override; |
| 42 |
float GetFps() override; |
| 43 |
void OnLostDisplay() override; |
| 44 |
void OnResetDisplay() override; |
| 45 |
|
| 46 |
private: |
| 47 |
int (*m_glXWaitVideoSyncSGI) (int, int, unsigned int*); |
| 48 |
int (*m_glXGetVideoSyncSGI) (unsigned int*); |
| 49 |
|
| 50 |
static Display* m_Dpy; |
| 51 |
CWinSystemX11GLContext &m_winSystem; |
| 52 |
XVisualInfo *m_vInfo; |
| 53 |
Window m_Window; |
| 54 |
GLXContext m_Context; |
| 55 |
volatile bool m_displayLost; |
| 56 |
volatile bool m_displayReset; |
| 57 |
CEvent m_lostEvent; |
| 58 |
}; |
| 59 |
|
| 60 |
} |
| 61 |
} |
| 62 |
} |