91 changes: 76 additions & 15 deletions mythtv/libs/libmythtv/mythhdrtracker.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
// MythTV
#ifdef USING_DRM_VIDEO
#include "drm/mythhdrtrackerdrm.h"
#endif
#include "mythhdrtracker.h"
#include "mythedid.h"
#include "mythdisplay.h"
#include "mythlogging.h"
#include "mythframe.h"
#include "mythavutil.h"

#define LOC QString("HDRTracker: ")

/*! \brief Create a tracker instance that looks for changes in the required EOTF
*
* An instance is only created if the display supports at least one HDR format *and*
* the instance is capable of signalling the HDR metadata to the display (which
* is currently limited to DRM on linux - with no X11 or Wayland).
*/
HDRTracker MythHDRTracker::Create(MythDisplay* _Display)
{
if (!_Display)
Expand All @@ -20,26 +27,80 @@ HDRTracker MythHDRTracker::Create(MythDisplay* _Display)
// We only support HDR10 and HLG
if (!hdr->m_supportedTypes)
{
LOG(VB_PLAYBACK, LOG_INFO, "No HDR support detected for this display");
LOG(VB_PLAYBACK, LOG_INFO, LOC + "No HDR support detected for this display");
return nullptr;
}

// We only know how to deal with HDR Static Metablock Type 1 (which is the only type)
if (hdr->m_metadataType != MythHDR::StaticType1)
// We need to be able to set metadata
if (!hdr->IsControllable())
{
LOG(VB_PLAYBACK, LOG_INFO, LOC + "HDR signalling support not available");
return nullptr;
}

HDRTracker result = nullptr;
#ifdef USING_DRM_VIDEO
result = MythHDRTrackerDRM::Create(_Display);
#endif

if (!result.get())
LOG(VB_PLAYBACK, LOG_INFO, "HDR signalling support not available");
return result;
return std::shared_ptr<MythHDRTracker>(new MythHDRTracker(hdr));
}

MythHDRTracker::MythHDRTracker(MythHDRPtr HDR)
: m_hdrSupport(std::move(HDR))
: m_hdr(std::move(HDR))
{
LOG(VB_GENERAL, LOG_INFO, LOC + QString("Tracking HDR signalling for: %1")
.arg(m_hdr->TypesToString().join(",")));
}

MythHDRTracker::~MythHDRTracker()
{
Reset();
}

void MythHDRTracker::Reset()
{
// TODO Revert to the pre-existing state - don't assume SDR
if (m_hdr && m_hdr->m_currentType != MythHDR::SDR)
m_hdr->SetHDRMetadata(MythHDR::SDR, nullptr);
m_metadata = nullptr;
}

/*! \brief Track changes to the HDR type (EOTF) and request a change when needed.
*
* \note Signalling is only requested when a change is seen; this is all static
* metadata currently (i.e. no HDR10+ support - which is frame by frame). But there
* may be an advantage to signalling every frame or at least every X frames as I'm
* not sure this is 100% reliable.
*/
void MythHDRTracker::Update(MythVideoFrame* Frame)
{
if (!Frame || !m_hdr)
return;

// Do we have an HDR EOTF that is supported by the display?
if (auto eotf = MythAVUtil::FFmpegTransferToHDRType(Frame->m_colortransfer);
eotf & m_hdr->m_supportedTypes)
{
if (eotf == MythHDR::HLG)
{
if (m_hdr->m_currentType != MythHDR::HLG)
{
m_hdr->SetHDRMetadata(MythHDR::HLG, nullptr);
m_metadata = nullptr;
}
}
else
{
// TODO Better change tracking when there is no metadata (i.e. Frame->m_hdrMetadata is null)
if (m_hdr->m_currentType != MythHDR::HDR10 || !m_metadata ||
(Frame->m_hdrMetadata.get() && !m_metadata->Equals(Frame->m_hdrMetadata.get())))
{
m_metadata = Frame->m_hdrMetadata ?
std::make_shared<MythHDRVideoMetadata>(*(Frame->m_hdrMetadata.get())) :
std::make_shared<MythHDRVideoMetadata>();
m_hdr->SetHDRMetadata(MythHDR::HDR10, m_metadata);
}
}
}
else
{
Reset();
}
}

10 changes: 5 additions & 5 deletions mythtv/libs/libmythtv/mythhdrtracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ class MythHDRTracker
{
public:
static HDRTracker Create(class MythDisplay* _Display);
virtual void Update(class MythVideoFrame* Frame) = 0;
virtual void Reset() = 0;
~MythHDRTracker();
void Update(class MythVideoFrame* Frame);

protected:
explicit MythHDRTracker(MythHDRPtr HDR);
virtual ~MythHDRTracker() = default;
void Reset();

MythHDRVideoPtr m_ffmpegMetadata { nullptr };
MythHDRPtr m_hdrSupport { nullptr };
MythHDRVideoPtr m_metadata { nullptr };
MythHDRPtr m_hdr { nullptr };
};

#endif
2 changes: 2 additions & 0 deletions mythtv/libs/libmythui/libmythui.pro
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ using_drm {
HEADERS += platforms/drm/mythdrmencoder.h
HEADERS += platforms/drm/mythdrmframebuffer.h
HEADERS += platforms/drm/mythdrmvrr.h
HEADERS += platforms/drm/mythdrmhdr.h
SOURCES += platforms/mythdisplaydrm.cpp
SOURCES += platforms/mythscreensaverdrm.cpp
SOURCES += platforms/mythdrmdevice.cpp
Expand All @@ -159,6 +160,7 @@ using_drm {
SOURCES += platforms/drm/mythdrmencoder.cpp
SOURCES += platforms/drm/mythdrmframebuffer.cpp
SOURCES += platforms/drm/mythdrmvrr.cpp
SOURCES += platforms/drm/mythdrmhdr.cpp
QMAKE_CXXFLAGS += $${LIBDRM_CFLAGS}
}

Expand Down
14 changes: 5 additions & 9 deletions mythtv/libs/libmythui/mythdisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ QStringList MythDisplay::GetDescription()
auto types = m_hdrState->m_supportedTypes;
auto hdr = m_hdrState->TypesToString();
result.append(tr("Supported HDR formats\t: %1").arg(hdr.join(",")));
if (types && !m_hdrState->m_controllable)
if (types && !m_hdrState->IsControllable())
result.append(tr("HDR mode switching is not available"));
}

Expand Down Expand Up @@ -930,14 +930,10 @@ void MythDisplay::InitHDR()
{
if (m_edid.Valid())
{
m_hdrState = m_edid.GetHDRSupport();
auto hdr = m_hdrState->TypesToString();
if (m_hdrState->m_metadataType != MythHDR::StaticType1 &&
m_hdrState->m_supportedTypes > MythHDR::SDR)
{
LOG(VB_GENERAL, LOG_WARNING, LOC + "Display does not report support for Static Metadata Type 1");
}
LOG(VB_GENERAL, LOG_NOTICE, LOC + QString("Supported HDR formats: %1").arg(hdr.join(",")));
auto hdrdesc = m_edid.GetHDRSupport();
m_hdrState = MythHDR::Create(this, hdrdesc);
LOG(VB_GENERAL, LOG_NOTICE, LOC + QString("Supported HDR formats: %1")
.arg(m_hdrState->TypesToString().join(",")));
}
}

Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythui/mythdisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ class MUI_PUBLIC MythDisplay : public QObject

virtual void UpdateCurrentMode ();
virtual bool SwitchToVideoMode (QSize Size, double Framerate);
virtual void InitHDR ();

void DebugModes () const;
void SetWidget (QWidget *MainWindow);
Expand All @@ -84,6 +83,7 @@ class MUI_PUBLIC MythDisplay : public QObject
void InitScreenBounds ();
void WaitForScreenChange();
void WaitForNewScreen ();
void InitHDR ();

bool m_waitForModeChanges { true };
bool m_modeComplete { false };
Expand Down
10 changes: 2 additions & 8 deletions mythtv/libs/libmythui/mythedid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,9 @@ int MythEDID::VideoLatency(bool Interlaced) const
return m_videoLatency[Interlaced ? 1 : 0];
}

MythHDRPtr MythEDID::GetHDRSupport() const
MythHDRDesc MythEDID::GetHDRSupport() const
{
auto result = MythHDR::Create();
result->m_supportedTypes = m_hdrSupport;
result->m_minLuminance = m_minLuminance;
result->m_maxAvgLuminance = m_maxAvgLuminance;
result->m_maxLuminance = m_maxLuminance;
result->m_metadataType = static_cast<MythHDR::HDRMeta>(m_hdrMetaTypes);
return result;
return { m_hdrSupport, m_minLuminance, m_maxAvgLuminance, m_maxLuminance };
}

/*! \brief Return the range of supported refresh rates
Expand Down
11 changes: 3 additions & 8 deletions mythtv/libs/libmythui/mythedid.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <array>
#include <tuple>

using MythHDRDesc = std::tuple<MythHDR::HDRTypes,double,double,double>;
using MythVRRRange = std::tuple<int,int,bool>;

class MUI_PUBLIC MythEDID
Expand All @@ -37,7 +38,7 @@ class MUI_PUBLIC MythEDID
int AudioLatency (bool Interlaced) const;
int VideoLatency (bool Interlaced) const;
void Debug () const;
MythHDRPtr GetHDRSupport () const;
MythHDRDesc GetHDRSupport () const;
MythVRRRange GetVRRRange () const;

private:
Expand All @@ -49,12 +50,6 @@ class MUI_PUBLIC MythEDID
HLG = 1 << 3
};

enum HDRMetadaType
{
Unknown = 0,
Static1 = 1 << 0
};

void Parse ();
bool ParseBaseBlock (const quint8* Data);
void ParseDisplayDescriptor(const quint8* Data, uint Offset);
Expand Down Expand Up @@ -88,8 +83,8 @@ class MUI_PUBLIC MythEDID
uint8_t m_deepYUV { 0 };
int m_vrrMin { 0 };
int m_vrrMax { 0 };
MythHDR::HDRTypes m_hdrSupport { MythHDR::SDR };
int m_hdrMetaTypes { 0 };
MythHDR::HDRTypes m_hdrSupport { MythHDR::SDR };
double m_maxLuminance { 0.0 };
double m_maxAvgLuminance { 0.0 };
double m_minLuminance { 0.0 };
Expand Down
40 changes: 36 additions & 4 deletions mythtv/libs/libmythui/mythhdr.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
// MythTV
#include "mythhdr.h"
#include "mythdisplay.h"

#ifdef USING_DRM
#include "platforms/drm/mythdrmhdr.h"
#endif

/*! \class MythHDRMetadata
* \brief Encapsulates HDR metadata conformant with Static Metadata Type 1 per CTA-861-G Final.
Expand All @@ -21,15 +26,42 @@ bool MythHDRMetadata::Equals(MythHDRMetadata* Other)
m_displayPrimaries[2][1] == Other->m_displayPrimaries[2][1];
}

MythHDRPtr MythHDR::Create()
MythHDRPtr MythHDR::Create(MythDisplay* _Display, const MythHDRDesc& Desc)
{
MythHDRPtr result = nullptr;

// Only try and create a controllable device if the display supports HDR
if (std::get<0>(Desc) > SDR)
{
#ifdef USING_DRM
result = MythDRMHDR::Create(_Display, Desc);
#else
(void)_Display;
#endif
}

if (!result)
result = std::shared_ptr<MythHDR>(new MythHDR(Desc));
return result;
}

MythHDR::MythHDR(const MythHDRDesc& Desc)
: m_supportedTypes(std::get<0>(Desc)),
m_minLuminance(std::get<1>(Desc)),
m_maxAvgLuminance(std::get<2>(Desc)),
m_maxLuminance(std::get<3>(Desc))
{
}

bool MythHDR::IsControllable() const
{
return std::shared_ptr<MythHDR>(new MythHDR());
return m_controllable;
}

QString MythHDR::TypeToString(HDRType Type)
{
if (Type & HDR10) return QObject::tr("HDR10");
if (Type & HLG) return QObject::tr("Hybrid Log-Gamma");
if (Type & HDR10) return QObject::tr("HDR10");
if (Type & HLG) return QObject::tr("Hybrid Log-Gamma");
return QObject::tr("Unknown");
}

Expand Down
25 changes: 11 additions & 14 deletions mythtv/libs/libmythui/mythhdr.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,29 +42,26 @@ class MUI_PUBLIC MythHDR
Q_DECLARE_FLAGS(HDRTypes, HDRType)
Q_FLAG(HDRTypes)

enum HDRMeta
{
Unknown = 0,
StaticType1 = 1
};

static MythHDRPtr Create();
using MythHDRDesc = std::tuple<HDRTypes,double,double,double>;
static MythHDRPtr Create(class MythDisplay* _Display, const MythHDRDesc& Desc);
virtual ~MythHDR() = default;
virtual void SetHDRMetadata(HDRType /*Type*/, MythHDRMetaPtr /*Metadata*/) {}

static QString TypeToString (HDRType Type);
static QStringList TypesToString(HDRTypes Types);
QStringList TypesToString() const;
bool IsControllable() const;

bool m_controllable { false };
HDRType m_currentType { SDR };
HDRTypes m_supportedTypes { SDR };
double m_maxLuminance { 0.0 };
double m_maxAvgLuminance { 0.0 };
double m_minLuminance { 0.0 };
HDRMeta m_metadataType { Unknown };
MythHDRMetaPtr m_metadata { nullptr };

protected:
MythHDR() = default;
explicit MythHDR(const MythHDRDesc& Desc);

bool m_controllable { false };
double m_minLuminance { 0.0 };
double m_maxAvgLuminance { 0.0 };
double m_maxLuminance { 0.0 };

private:
Q_DISABLE_COPY(MythHDR)
Expand Down
105 changes: 105 additions & 0 deletions mythtv/libs/libmythui/platforms/drm/mythdrmhdr.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
// MythTV
#include "platforms/drm/mythdrmhdr.h"
#include "platforms/mythdisplaydrm.h"
#include "mythlogging.h"

#define LOC QString("HDR: ")

MythHDRPtr MythDRMHDR::Create(MythDisplay* _Display, const MythHDRDesc& Desc)
{
auto * display = dynamic_cast<MythDisplayDRM*>(_Display);
if (!display)
return nullptr;

// Display support for HDR formats has already been checked. We need to check
// here that we have a valid, authenticated DRM device and that the connector
// supports the HDR_OUTPUT_METADATA property
auto device = display->GetDevice();
if (!(device && device->Authenticated() && device->Atomic()))
return nullptr;

if (auto connector = device->GetConnector(); connector.get())
if (auto hdrprop = MythDRMProperty::GetProperty("HDR_OUTPUT_METADATA", connector->m_properties); hdrprop)
return std::shared_ptr<MythHDR>(new MythDRMHDR(device, hdrprop, Desc));

return nullptr;
}

MythDRMHDR::MythDRMHDR(MythDRMPtr Device, DRMProp HDRProp, const MythHDRDesc& Desc)
: MythHDR(Desc),
m_device(Device),
m_connector(Device->GetConnector()),
m_hdrProp(HDRProp),
m_crtc(Device->GetCrtc())
{
m_controllable = true;
m_activeProp = MythDRMProperty::GetProperty("ACTIVE", m_crtc->m_properties);
}

MythDRMHDR::~MythDRMHDR()
{
Cleanup();
}

void MythDRMHDR::Cleanup()
{
if (m_hdrBlob && m_device)
{
drmModeDestroyPropertyBlob(m_device->GetFD(), m_hdrBlob);
m_hdrBlob = 0;
}
}

static inline hdmi_eotf MythHDRToDRMHDR(MythHDR::HDRType Type)
{
switch (Type)
{
case MythHDR::HDR10: return HDMI_EOTF_SMPTE_ST2084;
case MythHDR::HLG: return HDMI_EOTF_BT_2100_HLG;
default: break;
}
return HDMI_EOTF_TRADITIONAL_GAMMA_SDR;
}

void MythDRMHDR::SetHDRMetadata(HDRType Type, MythHDRMetaPtr Metadata)
{
static hdr_output_metadata s_defaultMetadata =
{
HDMI_STATIC_METADATA_TYPE1, { 0, HDMI_STATIC_METADATA_TYPE1, {{0,0}}, {0,0}, 0, 0, 0, 0}
};

Cleanup();
auto eotf = MythHDRToDRMHDR(Type);
m_drmMetadata = s_defaultMetadata;
m_drmMetadata.hdmi_metadata_type1.eotf = eotf;

if (Metadata)
{
m_drmMetadata.hdmi_metadata_type1.max_display_mastering_luminance = Metadata->m_maxMasteringLuminance;
m_drmMetadata.hdmi_metadata_type1.min_display_mastering_luminance = Metadata->m_minMasteringLuminance;
m_drmMetadata.hdmi_metadata_type1.max_cll = Metadata->m_maxContentLightLevel;
m_drmMetadata.hdmi_metadata_type1.max_fall = Metadata->m_maxFrameAverageLightLevel;
m_drmMetadata.hdmi_metadata_type1.white_point.x = Metadata->m_whitePoint[0];
m_drmMetadata.hdmi_metadata_type1.white_point.y = Metadata->m_whitePoint[1];
for (size_t i = 0; i < 3; ++i)
{
m_drmMetadata.hdmi_metadata_type1.display_primaries[i].x = Metadata->m_displayPrimaries[i][0];
m_drmMetadata.hdmi_metadata_type1.display_primaries[i].y = Metadata->m_displayPrimaries[i][1];
}
}

LOG(VB_GENERAL, LOG_INFO, LOC + QString("Creating HDR info frame for %1")
.arg(eotf == HDMI_EOTF_BT_2100_HLG ? "HLG" : eotf == HDMI_EOTF_SMPTE_ST2084 ? "HDR10" : "SDR"));
if (drmModeCreatePropertyBlob(m_device->GetFD(), &m_drmMetadata, sizeof(m_drmMetadata), &m_hdrBlob) == 0)
{
LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("HDR blob id %1").arg(m_hdrBlob));
m_device->QueueAtomics({{ m_connector->m_id, m_hdrProp->m_id, m_hdrBlob }});
if (m_crtc && m_activeProp)
m_device->QueueAtomics({{ m_crtc->m_id, m_activeProp->m_id, 1 }});
m_currentType = Type;
}
else
{
LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to create HDR blob id");
}
}
74 changes: 74 additions & 0 deletions mythtv/libs/libmythui/platforms/drm/mythdrmhdr.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#ifndef MYTHDRMHDR_H
#define MYTHDRMHDR_H

// MythTV
#include "config.h"
#include "mythhdr.h"
#include "platforms/mythdrmdevice.h"

// libdrm
extern "C" {
enum hdmi_eotf
{
HDMI_EOTF_TRADITIONAL_GAMMA_SDR = 0,
HDMI_EOTF_TRADITIONAL_GAMMA_HDR,
HDMI_EOTF_SMPTE_ST2084,
HDMI_EOTF_BT_2100_HLG,
};

enum hdmi_metadata_type
{
HDMI_STATIC_METADATA_TYPE1 = 0,
};

#if HAVE_STRUCT_HDR_METADATA_INFOFRAME
#include <drm_mode.h>
#else
struct hdr_metadata_infoframe {
__u8 eotf;
__u8 metadata_type;
struct {
__u16 x, y;
} display_primaries[3];
struct {
__u16 x, y;
} white_point;
__u16 max_display_mastering_luminance;
__u16 min_display_mastering_luminance;
__u16 max_cll;
__u16 max_fall;
};

struct hdr_output_metadata {
__u32 metadata_type;
union {
struct hdr_metadata_infoframe hdmi_metadata_type1;
};
};
#endif
}

using DRMMeta = hdr_output_metadata;

class MythDRMHDR : public MythHDR
{
public:
static MythHDRPtr Create(class MythDisplay* _Display, const MythHDRDesc& Desc);
~MythDRMHDR() override;
void SetHDRMetadata(HDRType Type, MythHDRMetaPtr Metadata) override;

protected:
MythDRMHDR(MythDRMPtr Device, DRMProp HDRProp, const MythHDRDesc& Desc);

private:
void Cleanup();
MythDRMPtr m_device { nullptr };
DRMConn m_connector { nullptr };
DRMProp m_hdrProp { nullptr };
DRMCrtc m_crtc { nullptr };
DRMProp m_activeProp { nullptr };
uint32_t m_hdrBlob { 0 };
DRMMeta m_drmMetadata;
};

#endif
33 changes: 13 additions & 20 deletions mythtv/libs/libmythui/platforms/mythdisplaydrm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
void MythDisplayDRM::MainWindowReady()
{
#ifdef USING_QTPRIVATEHEADERS
if (m_device.get())
if (m_device)
m_device->MainWindowReady();
#endif
}
Expand All @@ -22,8 +22,8 @@ bool MythDisplayDRM::DirectRenderingAvailable()

if (auto mainwindow = GetMythMainWindow(); mainwindow)
if (auto drmdisplay = dynamic_cast<MythDisplayDRM*>(mainwindow->GetDisplay()); drmdisplay)
if (auto drm = drmdisplay->GetDevice(); drm.get() && drm->Atomic() && drm->Authenticated())
if (auto plane = drm->GetVideoPlane(); plane.get() && plane->m_id)
if (auto drm = drmdisplay->GetDevice(); drm && drm->Atomic() && drm->Authenticated())
if (auto plane = drm->GetVideoPlane(); plane && plane->m_id)
return true;
#endif
return false;
Expand All @@ -34,7 +34,7 @@ MythDisplayDRM::MythDisplayDRM(MythMainWindow* MainWindow)
m_device = MythDRMDevice::Create(m_screen);
Initialise();
#ifdef USING_QTPRIVATEHEADERS
if (MainWindow && m_device.get() && m_device->GetVideoPlane().get())
if (MainWindow && m_device && m_device->GetVideoPlane())
connect(MainWindow, &MythMainWindow::SignalWindowReady, this, &MythDisplayDRM::MainWindowReady);
#else
(void)MainWindow;
Expand All @@ -57,47 +57,40 @@ void MythDisplayDRM::ScreenChanged(QScreen *qScreen)
{
MythDisplay::ScreenChanged(qScreen);

if (m_device.get() && m_device->GetScreen() != m_screen)
if (m_device && m_device->GetScreen() != m_screen)
m_device = nullptr;

if (!m_device.get())
if (!m_device)
m_device = MythDRMDevice::Create(m_screen);

emit screenChanged();
}

bool MythDisplayDRM::VideoModesAvailable()
{
return m_device.get() && m_device->CanSwitchModes();
return m_device && m_device->CanSwitchModes();
}

bool MythDisplayDRM::IsPlanar()
{
#ifdef USING_QTPRIVATEHEADERS
return m_device.get() && m_device->Authenticated() && m_device->Atomic() &&
m_device->GetVideoPlane().get() && m_device->GetVideoPlane()->m_id;
return m_device && m_device->Authenticated() && m_device->Atomic() &&
m_device->GetVideoPlane() && m_device->GetVideoPlane()->m_id;
#else
return false;
#endif
}

void MythDisplayDRM::InitHDR()
{
MythDisplay::InitHDR();
if (m_hdrState.get() && m_device.get() && m_device->Atomic() && m_device->Authenticated())
m_hdrState->m_controllable = true;
}

bool MythDisplayDRM::UsingVideoModes()
{
if (gCoreContext && m_device.get() && m_device->CanSwitchModes())
if (gCoreContext && m_device && m_device->CanSwitchModes())
return gCoreContext->GetBoolSetting("UseVideoModes", false);
return false;
}

void MythDisplayDRM::UpdateCurrentMode()
{
if (m_device.get())
if (m_device)
{
// Ensure video modes are fetched early
GetVideoModes();
Expand All @@ -118,7 +111,7 @@ const MythDisplayModes& MythDisplayDRM::GetVideoModes()

m_videoModes.clear();
m_modeMap.clear();
if (!m_screen || !m_device.get() || !m_device->CanSwitchModes())
if (!m_screen || !m_device || !m_device->CanSwitchModes())
return m_videoModes;

auto mainresolution = m_device->GetResolution();
Expand Down Expand Up @@ -169,7 +162,7 @@ const MythDisplayModes& MythDisplayDRM::GetVideoModes()

bool MythDisplayDRM::SwitchToVideoMode(QSize Size, double DesiredRate)
{
if (!m_screen || !m_device.get() || !m_device->CanSwitchModes() || m_videoModes.empty())
if (!m_screen || !m_device || !m_device->CanSwitchModes() || m_videoModes.empty())
return false;

auto rate = static_cast<double>(NAN);
Expand Down
1 change: 0 additions & 1 deletion mythtv/libs/libmythui/platforms/mythdisplaydrm.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class MUI_PUBLIC MythDisplayDRM : public MythDisplay

public:
bool IsPlanar() override;
void InitHDR() override;
bool VideoModesAvailable() override;
bool UsingVideoModes() override;
void UpdateCurrentMode() override;
Expand Down