MythTV  master
mythnvcontrol.h
Go to the documentation of this file.
1 #ifndef MYTHNVCONTROL_H
2 #define MYTHNVCONTROL_H
3 
4 // MythTV
5 #include "mythvrr.h"
6 
7 // Qt
8 #include <QLibrary>
9 
10 // Std
11 #include <tuple>
12 #include <memory>
13 
14 // X headers always last
15 #include "platforms/mythxdisplay.h"
16 
17 using NVControl = std::shared_ptr<class MythNVControl>;
18 using QueryTargetBinary = bool(*)(Display*,int,int,unsigned int,unsigned int, unsigned char**,int*);
19 using QueryScreenAttrib = bool(*)(Display*,int,unsigned int,unsigned int,int*);
20 using QueryTargetAttrib = bool(*)(Display*,int,int,unsigned int,unsigned int,int*);
21 using SetAttribute = void(*)(Display*,int,unsigned int,unsigned int,int);
22 
23 class MythGSync : public MythVRR
24 {
25  public:
26  static inline bool s_gsyncResetOnExit = false;
27  static inline bool s_gsyncDefaultValue = false;
28  static void ForceGSync(bool Enable);
29  static MythVRRPtr CreateGSync(const NVControl& Device, MythVRRRange Range);
30  ~MythGSync() override;
31  void SetEnabled(bool Enable = true) override;
32 
33  protected:
35  NVControl m_nvControl { nullptr };
36 };
37 
39 {
40  public:
41  static NVControl Create();
43 
44  int GetDisplayID() const;
45 
46  protected:
47  MythNVControl(const QString& Path, MythXDisplay* MDisplay);
48  QLibrary m_lib;
49 
50  public:
51  MythXDisplay* m_display { nullptr };
56 };
57 #endif
QueryTargetBinary
bool(*)(Display *, int, int, unsigned int, unsigned int, unsigned char **, int *) QueryTargetBinary
Definition: mythnvcontrol.h:18
bool
bool
Definition: pxsup2dast.c:30
MythNVControl
A simple wrapper around libXNVCtrl - which is dynamically loaded on demand.
Definition: mythnvcontrol.h:38
NVControl
std::shared_ptr< class MythNVControl > NVControl
Definition: mythnvcontrol.h:17
mythvrr.h
MythGSync::~MythGSync
~MythGSync() override
Definition: mythnvcontrol.cpp:109
Device
A device containing images (ie. USB stick, CD, storage group etc)
Definition: imagemanager.cpp:35
MythNVControl::m_queryTarget
QueryTargetAttrib m_queryTarget
Definition: mythnvcontrol.h:54
MythNVControl::MythNVControl
MythNVControl(const QString &Path, MythXDisplay *MDisplay)
Definition: mythnvcontrol.cpp:180
QueryScreenAttrib
bool(*)(Display *, int, unsigned int, unsigned int, int *) QueryScreenAttrib
Definition: mythnvcontrol.h:19
MythVRR
Definition: mythvrr.h:14
MythGSync::m_nvControl
NVControl m_nvControl
Definition: mythnvcontrol.h:35
MythNVControl::m_display
MythXDisplay * m_display
Definition: mythnvcontrol.h:51
MythNVControl::~MythNVControl
~MythNVControl()
Definition: mythnvcontrol.cpp:190
MythGSync::CreateGSync
static MythVRRPtr CreateGSync(const NVControl &Device, MythVRRRange Range)
Definition: mythnvcontrol.cpp:54
MythNVControl::m_lib
QLibrary m_lib
Definition: mythnvcontrol.h:48
QueryTargetAttrib
bool(*)(Display *, int, int, unsigned int, unsigned int, int *) QueryTargetAttrib
Definition: mythnvcontrol.h:20
MythGSync::s_gsyncDefaultValue
static bool s_gsyncDefaultValue
Definition: mythnvcontrol.h:27
MythVRRRange
std::tuple< int, int, bool > MythVRRRange
Definition: mythedid.h:19
mythxdisplay.h
MythVRR::Enabled
bool Enabled() const
Definition: mythvrr.cpp:106
MythNVControl::m_queryBinary
QueryTargetBinary m_queryBinary
Definition: mythnvcontrol.h:52
MythNVControl::Create
static NVControl Create()
Create a valid instance of MythNVControl.
Definition: mythnvcontrol.cpp:135
MythGSync
A wrapper around NVidia GSync support (when using X11 and a Display Port connection).
Definition: mythnvcontrol.h:23
MythXDisplay
Definition: mythxdisplay.h:15
MythGSync::MythGSync
MythGSync(NVControl Device, VRRType Type, bool Enabled, MythVRRRange Range)
Definition: mythnvcontrol.cpp:103
MythNVControl::GetDisplayID
int GetDisplayID() const
Definition: mythnvcontrol.cpp:196
MythNVControl::m_queryScreen
QueryScreenAttrib m_queryScreen
Definition: mythnvcontrol.h:53
SetAttribute
void(*)(Display *, int, unsigned int, unsigned int, int) SetAttribute
Definition: mythnvcontrol.h:21
MythGSync::s_gsyncResetOnExit
static bool s_gsyncResetOnExit
Definition: mythnvcontrol.h:26
MythGSync::SetEnabled
void SetEnabled(bool Enable=true) override
Definition: mythnvcontrol.cpp:119
MythNVControl::m_setAttrib
SetAttribute m_setAttrib
Definition: mythnvcontrol.h:55
MythGSync::ForceGSync
static void ForceGSync(bool Enable)
Enable or disable GSync before the main window is created.
Definition: mythnvcontrol.cpp:27
MythVRRPtr
std::shared_ptr< class MythVRR > MythVRRPtr
Definition: mythvrr.h:11
MythVRR::VRRType
VRRType
Definition: mythvrr.h:17