4#include "libmythbase/mythconfig.h"
7#define LOC QString("FreeSync: ")
19 LOG(VB_GENERAL, LOG_INFO,
LOC +
"No FreeSync support detected - cannot force");
23 if (freesync->Enabled() == Enable)
25 LOG(VB_GENERAL, LOG_INFO,
LOC + QString(
"FreeSync already %1abled")
26 .arg(Enable ?
"en" :
"dis"));
30 if (!freesync->IsControllable())
32 LOG(VB_GENERAL, LOG_INFO,
LOC + QString(
"Cannot %1able FreeSync - do not have permission")
33 .arg(Enable ?
"en" :
"dis"));
37 auto * freesync2 =
dynamic_cast<MythDRMVRR*
>(freesync.get());
43 if (drmModeObjectSetProperty(
Device->GetFD(),
Device->GetCrtc()->m_id,
44 DRM_MODE_OBJECT_CRTC, freesync2->GetVRRProperty()->m_id, Enable ? 1 : 0) == 0)
50 LOG(VB_GENERAL, LOG_INFO,
LOC + (Enable ?
"Enabled" :
"Disabled"));
54 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Error setting FreeSync");
63 auto connector =
Device->GetConnector();
68 if (!capableval || capableval->m_value < 1)
71 auto crtc =
Device->GetCrtc();
81 bool isenabled = enabledval->
m_value > 0;
82 bool controllable =
Device->Atomic() &&
Device->Authenticated();
83 return std::shared_ptr<MythVRR>(
new MythDRMVRR(
Device, enabled, controllable, isenabled, Range));
102 :
MythVRR(Controllable, FreeSync, Enabled, Range),
103 m_device(std::move(
Device)),
104 m_vrrProp(std::move(VRRProp))
114 LOG(VB_GENERAL, LOG_INFO,
LOC +
"Resetting FreeSync to desktop default");
123#if CONFIG_QTPRIVATEHEADERS
125 m_device->QueueAtomics({{ m_device->GetCrtc()->m_id, m_vrrProp->m_id, Enable ? 1 : 0 }}))
129 LOG(VB_GENERAL, LOG_INFO,
LOC + (Enable ?
"Enabled" :
"Disabled"));
A device containing images (ie. USB stick, CD, storage group etc)
static DRMProp GetProperty(const QString &Name, const DRMProps &Properties)
A wrapper around FreeSync/Adaptive-Sync support.
static void ForceFreeSync(const MythDRMPtr &Device, bool Enable)
Force FreeSync on or off before the main app is started.
void SetEnabled(bool Enable=true) override
static MythVRRPtr CreateFreeSync(const MythDRMPtr &Device, MythVRRRange Range)
MythDRMVRR(MythDRMPtr Device, DRMProp VRRProp, bool Controllable, bool Enabled, MythVRRRange Range)
static bool s_freeSyncDefaultValue
static bool s_freeSyncResetOnExit
std::shared_ptr< class MythDRMDevice > MythDRMPtr
std::shared_ptr< class MythDRMProperty > DRMProp
std::tuple< int, int, bool > MythVRRRange
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
std::shared_ptr< class MythVRR > MythVRRPtr