5 #define LOC QString("FreeSync: ")
17 LOG(VB_GENERAL, LOG_INFO,
LOC +
"No FreeSync support detected - cannot force");
21 if (freesync->Enabled() == Enable)
23 LOG(VB_GENERAL, LOG_INFO,
LOC + QString(
"FreeSync already %1abled")
24 .arg(Enable ?
"en" :
"dis"));
28 if (!freesync->IsControllable())
30 LOG(VB_GENERAL, LOG_INFO,
LOC + QString(
"Cannot %1able FreeSync - do not have permission")
31 .arg(Enable ?
"en" :
"dis"));
35 auto * freesync2 =
dynamic_cast<MythDRMVRR*
>(freesync.get());
41 if (drmModeObjectSetProperty(
Device->GetFD(),
Device->GetCrtc()->m_id,
42 DRM_MODE_OBJECT_CRTC, freesync2->GetVRRProperty()->m_id, Enable ? 1 : 0) == 0)
48 LOG(VB_GENERAL, LOG_INFO,
LOC + (Enable ?
"Enabled" :
"Disabled"));
52 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Error setting FreeSync");
61 auto connector =
Device->GetConnector();
66 if (!capableval || capableval->m_value < 1)
69 auto crtc =
Device->GetCrtc();
79 bool isenabled = enabledval->
m_value > 0;
80 bool controllable =
Device->Atomic() &&
Device->Authenticated();
81 return std::shared_ptr<MythVRR>(
new MythDRMVRR(
Device, enabled, controllable, isenabled, Range));
100 :
MythVRR(Controllable, FreeSync, Enabled, Range),
101 m_device(std::move(
Device)),
102 m_vrrProp(std::move(VRRProp))
112 LOG(VB_GENERAL, LOG_INFO,
LOC +
"Resetting FreeSync to desktop default");
121 #ifdef USING_QTPRIVATEHEADERS
123 m_device->QueueAtomics({{ m_device->GetCrtc()->m_id, m_vrrProp->m_id, Enable ? 1 : 0 }}))
127 LOG(VB_GENERAL, LOG_INFO,
LOC + (Enable ?
"Enabled" :
"Disabled"));