Skip to content

Commit

Permalink
MythDRMDevice: Remove reference counting
Browse files Browse the repository at this point in the history
- it is unused and I'll be using a shared pointer instead
  • Loading branch information
mark-kendall committed Oct 1, 2020
1 parent ba05b9a commit f5af338
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 35 deletions.
34 changes: 16 additions & 18 deletions mythtv/libs/libmythui/platforms/mythdrmdevice.cpp
Expand Up @@ -15,8 +15,7 @@
#define LOC (QString("%1: ").arg(m_deviceName))

MythDRMDevice::MythDRMDevice(QScreen *qScreen, const QString& Device)
: ReferenceCounter("DRMDev"),
m_screen(qScreen),
: m_screen(qScreen),
m_deviceName(Device),
m_verbose(Device.isEmpty() ? LOG_INFO : LOG_DEBUG)
{
Expand All @@ -39,7 +38,7 @@ MythDRMDevice::~MythDRMDevice()
Close();
}

bool MythDRMDevice::Open(void)
bool MythDRMDevice::Open()
{
if (m_deviceName.isEmpty())
m_deviceName = FindBestDevice();
Expand All @@ -58,7 +57,7 @@ bool MythDRMDevice::Open(void)
return true;
}

void MythDRMDevice::Close(void)
void MythDRMDevice::Close()
{
if (m_fd)
{
Expand All @@ -77,42 +76,42 @@ void MythDRMDevice::Close(void)
m_fd = 0;
}

bool MythDRMDevice::IsValid(void) const
bool MythDRMDevice::IsValid() const
{
return m_valid;
}

QString MythDRMDevice::GetSerialNumber(void) const
QString MythDRMDevice::GetSerialNumber() const
{
return m_serialNumber;
}

QScreen* MythDRMDevice::GetScreen(void) const
QScreen* MythDRMDevice::GetScreen() const
{
return m_screen;
}

QSize MythDRMDevice::GetResolution(void) const
QSize MythDRMDevice::GetResolution() const
{
return m_resolution;
}

QSize MythDRMDevice::GetPhysicalSize(void) const
QSize MythDRMDevice::GetPhysicalSize() const
{
return m_physicalSize;
}

double MythDRMDevice::GetRefreshRate(void) const
double MythDRMDevice::GetRefreshRate() const
{
return m_refreshRate;
}

bool MythDRMDevice::Authenticated(void) const
bool MythDRMDevice::Authenticated() const
{
return m_authenticated;
}

MythEDID MythDRMDevice::GetEDID(void)
MythEDID MythDRMDevice::GetEDID()
{
return m_edid;
}
Expand All @@ -129,7 +128,7 @@ static QString GetConnectorName(drmModeConnector *Connector)
return QString("%1%2").arg(QString::fromStdString(connectorNames[type])).arg(Connector->connector_type_id);
}

void MythDRMDevice::Authenticate(void)
void MythDRMDevice::Authenticate()
{
if (!m_fd || m_authenticated)
return;
Expand All @@ -144,7 +143,7 @@ void MythDRMDevice::Authenticate(void)
}
}

bool MythDRMDevice::Initialise(void)
bool MythDRMDevice::Initialise()
{
if (!m_fd)
return false;
Expand Down Expand Up @@ -274,8 +273,7 @@ bool MythDRMDevice::Initialise(void)
}

m_crtc = crtc;
m_resolution = QSize(static_cast<int>(m_crtc->width),
static_cast<int>(m_crtc->height));
m_resolution = QSize(static_cast<int>(m_crtc->width), static_cast<int>(m_crtc->height));
if (m_crtc->mode_valid)
{
drmModeModeInfo mode = m_crtc->mode;
Expand All @@ -288,7 +286,7 @@ bool MythDRMDevice::Initialise(void)
return true;
}

QString MythDRMDevice::FindBestDevice(void)
QString MythDRMDevice::FindBestDevice()
{
if (!m_screen)
return QString();
Expand Down Expand Up @@ -367,7 +365,7 @@ MythDRMDevice::DRMEnum MythDRMDevice::GetEnumProperty(const QString& Property)
if ((prop->flags & DRM_MODE_PROP_ENUM) && prop->name == Property)
{
result.m_value = m_connector->prop_values[prop->prop_id];
for (int i = 0; i < prop->count_enums; ++i)
for (int j = 0; j < prop->count_enums; ++j)
result.m_enums.insert({prop->enums[i].value, prop->enums[i].name});
}
drmModeFreeProperty(prop);
Expand Down
33 changes: 16 additions & 17 deletions mythtv/libs/libmythui/platforms/mythdrmdevice.h
Expand Up @@ -6,7 +6,6 @@

// MythTV
#include "mythlogging.h"
#include "referencecounter.h"
#include "mythdisplay.h"

// libdrm
Expand All @@ -15,7 +14,7 @@ extern "C" {
#include <xf86drmMode.h>
}

class MythDRMDevice : public ReferenceCounter
class MythDRMDevice
{
public:
class DRMEnum
Expand All @@ -27,26 +26,26 @@ class MythDRMDevice : public ReferenceCounter
};

explicit MythDRMDevice(QScreen *qScreen, const QString& Device = QString());
~MythDRMDevice() override;
~MythDRMDevice();

bool IsValid (void) const;
QString GetSerialNumber(void) const;
QScreen* GetScreen (void) const;
QSize GetResolution (void) const;
QSize GetPhysicalSize(void) const;
double GetRefreshRate (void) const;
bool Authenticated (void) const;
MythEDID GetEDID (void);
bool IsValid () const;
QString GetSerialNumber() const;
QScreen* GetScreen () const;
QSize GetResolution () const;
QSize GetPhysicalSize() const;
double GetRefreshRate () const;
bool Authenticated () const;
MythEDID GetEDID ();
DRMEnum GetEnumProperty(const QString& Property);

private:
Q_DISABLE_COPY(MythDRMDevice)
bool Open (void);
void Close (void);
void Authenticate (void);
bool Initialise (void);
bool Open ();
void Close ();
void Authenticate ();
bool Initialise ();

QString FindBestDevice (void);
QString FindBestDevice ();
static bool ConfirmDevice(const QString& Device);

drmModePropertyBlobPtr GetBlobProperty(drmModeConnectorPtr Connector, const QString& Property) const;
Expand All @@ -69,4 +68,4 @@ class MythDRMDevice : public ReferenceCounter
MythEDID m_edid { };
};

#endif // MYTHDRMDEVICE_H
#endif

0 comments on commit f5af338

Please sign in to comment.