2#include "libmythbase/mythconfig.h"
9#define LOC QString("DispDRM: ")
13#if CONFIG_QTPRIVATEHEADERS
21#if CONFIG_QTPRIVATEHEADERS
27 if (
auto *drmdisplay =
dynamic_cast<MythDisplayDRM*
>(mainwindow->GetDisplay()); drmdisplay)
29 if (
auto drm = drmdisplay->GetDevice(); drm && drm->Atomic() && drm->Authenticated())
31 if (
auto plane = drm->GetVideoPlane(); plane && plane->m_id)
44#if CONFIG_QTPRIVATEHEADERS
82#if CONFIG_QTPRIVATEHEADERS
123 auto mainresolution =
m_device->GetResolution();
124 LOG(VB_GENERAL, LOG_INFO,
LOC + QString(
"Filtering out modes that aren't %1x%2")
125 .arg(mainresolution.width()).arg(mainresolution.height()));
129 auto physicalsize =
m_device->GetPhysicalSize();
130 for (
const auto & mode : modes)
132 auto width = mode->m_width;
133 auto height = mode->m_height;
134 auto rate = mode->m_rate;
139 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"Ignoring interlaced mode %1x%2 %3i")
140 .arg(width).arg(height).arg(rate, 2,
'f', 2,
'0'));
146 if (
auto size = QSize(width, height); size != mainresolution)
148 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"Ignoring mode %1x%2 %3")
149 .arg(width).arg(height).arg(rate, 2,
'f', 2,
'0'));
153 QSize resolution(width, height);
155 if (!screenmap.contains(key))
156 screenmap[key] =
MythDisplayMode(resolution, physicalsize, -1.0, rate);
158 screenmap[key].AddRefreshRate(rate);
162 for (
auto & it : screenmap)
174 auto rate =
static_cast<double>(NAN);
181 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Desired resolution and frame rate not found.");
188 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Failed to find mode");
bool GetBoolSetting(const QString &key, bool defaultval=false)
static MythDRMPtr Create(QScreen *qScreen, const QString &Device=QString(), bool NeedPlanes=true)
Create a MythDRMDevice instance.
void UpdateCurrentMode() override
Retrieve screen details.
MythDisplayDRM(MythMainWindow *MainWindow)
~MythDisplayDRM() override
bool VideoModesAvailable() override
const MythDisplayModes & GetVideoModes() override
bool SwitchToVideoMode(QSize Size, double DesiredRate) override
static bool DirectRenderingAvailable()
bool UsingVideoModes() override
QMap< uint64_t, int > m_modeMap
void ScreenChanged(QScreen *qScreen) override
static int FindBestMatch(const MythDisplayModes &Modes, const MythDisplayMode &Mode, double &TargetRate)
static uint64_t CalcKey(QSize Size, double Rate)
virtual void UpdateCurrentMode()
Retrieve screen details.
virtual void ScreenChanged(QScreen *qScreen)
The actual screen in use has changed. We must use it.
MythDisplayModes m_videoModes
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
std::map< uint64_t, MythDisplayMode > DisplayModeMap
std::vector< MythDisplayMode > MythDisplayModes
#define DRM_MODE_FLAG_INTERLACE
std::shared_ptr< class MythDRMDevice > MythDRMPtr
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
bool HasMythMainWindow(void)
MythMainWindow * GetMythMainWindow(void)