backends/drm: support the panel orientation property
This commit is contained in:
parent
e58affc71b
commit
65e886cde2
6 changed files with 45 additions and 2 deletions
|
@ -112,7 +112,8 @@ DrmConnector::DrmConnector(DrmGpu *gpu, uint32_t connectorId)
|
||||||
PropertyDefinition(QByteArrayLiteral("link-status"), Requirement::Optional,
|
PropertyDefinition(QByteArrayLiteral("link-status"), Requirement::Optional,
|
||||||
{QByteArrayLiteral("Good"), QByteArrayLiteral("Bad")}),
|
{QByteArrayLiteral("Good"), QByteArrayLiteral("Bad")}),
|
||||||
PropertyDefinition(QByteArrayLiteral("content type"), Requirement::Optional,
|
PropertyDefinition(QByteArrayLiteral("content type"), Requirement::Optional,
|
||||||
{QByteArrayLiteral("No Data"), QByteArrayLiteral("Graphics"), QByteArrayLiteral("Photo"), QByteArrayLiteral("Cinema"), QByteArrayLiteral("Game")})},
|
{QByteArrayLiteral("No Data"), QByteArrayLiteral("Graphics"), QByteArrayLiteral("Photo"), QByteArrayLiteral("Cinema"), QByteArrayLiteral("Game")}),
|
||||||
|
PropertyDefinition(QByteArrayLiteral("panel orientation"), Requirement::Optional, {QByteArrayLiteral("Normal"), QByteArrayLiteral("Upside Down"), QByteArrayLiteral("Left Side Up"), QByteArrayLiteral("Right Side Up")})},
|
||||||
DRM_MODE_OBJECT_CONNECTOR)
|
DRM_MODE_OBJECT_CONNECTOR)
|
||||||
, m_pipeline(std::make_unique<DrmPipeline>(this))
|
, m_pipeline(std::make_unique<DrmPipeline>(this))
|
||||||
, m_conn(drmModeGetConnector(gpu->fd(), connectorId))
|
, m_conn(drmModeGetConnector(gpu->fd(), connectorId))
|
||||||
|
@ -447,6 +448,15 @@ std::shared_ptr<DrmConnectorMode> DrmConnector::generateMode(const QSize &size,
|
||||||
return std::make_shared<DrmConnectorMode>(this, mode);
|
return std::make_shared<DrmConnectorMode>(this, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DrmConnector::PanelOrientation DrmConnector::panelOrientation() const
|
||||||
|
{
|
||||||
|
if (const auto &property = getProp(PropertyIndex::PanelOrientation)) {
|
||||||
|
return property->enumForValue<PanelOrientation>(property->current());
|
||||||
|
} else {
|
||||||
|
return PanelOrientation::Normal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QDebug &operator<<(QDebug &s, const KWin::DrmConnector *obj)
|
QDebug &operator<<(QDebug &s, const KWin::DrmConnector *obj)
|
||||||
{
|
{
|
||||||
QDebugStateSaver saver(s);
|
QDebugStateSaver saver(s);
|
||||||
|
@ -482,4 +492,20 @@ DrmConnector::DrmContentType DrmConnector::kwinToDrmContentType(ContentType type
|
||||||
Q_UNREACHABLE();
|
Q_UNREACHABLE();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Output::Transform DrmConnector::toKWinTransform(PanelOrientation orientation)
|
||||||
|
{
|
||||||
|
switch (orientation) {
|
||||||
|
case PanelOrientation::Normal:
|
||||||
|
return KWin::Output::Transform::Normal;
|
||||||
|
case PanelOrientation::RightUp:
|
||||||
|
return KWin::Output::Transform::Rotated270;
|
||||||
|
case PanelOrientation::LeftUp:
|
||||||
|
return KWin::Output::Transform::Rotated90;
|
||||||
|
case PanelOrientation::UpsideDown:
|
||||||
|
return KWin::Output::Transform::Rotated180;
|
||||||
|
default:
|
||||||
|
Q_UNREACHABLE();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,6 +65,7 @@ public:
|
||||||
MaxBpc = 10,
|
MaxBpc = 10,
|
||||||
LinkStatus = 11,
|
LinkStatus = 11,
|
||||||
ContentType = 12,
|
ContentType = 12,
|
||||||
|
PanelOrientation = 13,
|
||||||
Count
|
Count
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -84,6 +85,12 @@ public:
|
||||||
Cinema = 3,
|
Cinema = 3,
|
||||||
Game = 4
|
Game = 4
|
||||||
};
|
};
|
||||||
|
enum class PanelOrientation : uint32_t {
|
||||||
|
Normal = 0,
|
||||||
|
UpsideDown = 1,
|
||||||
|
LeftUp = 2,
|
||||||
|
RightUp = 3
|
||||||
|
};
|
||||||
|
|
||||||
bool init() override;
|
bool init() override;
|
||||||
bool updateProperties() override;
|
bool updateProperties() override;
|
||||||
|
@ -110,8 +117,10 @@ public:
|
||||||
bool hasRgbRange() const;
|
bool hasRgbRange() const;
|
||||||
Output::RgbRange rgbRange() const;
|
Output::RgbRange rgbRange() const;
|
||||||
LinkStatus linkStatus() const;
|
LinkStatus linkStatus() const;
|
||||||
|
PanelOrientation panelOrientation() const;
|
||||||
|
|
||||||
static DrmContentType kwinToDrmContentType(ContentType type);
|
static DrmContentType kwinToDrmContentType(ContentType type);
|
||||||
|
static Output::Transform toKWinTransform(PanelOrientation orientation);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QList<std::shared_ptr<DrmConnectorMode>> generateCommonModes();
|
QList<std::shared_ptr<DrmConnectorMode>> generateCommonModes();
|
||||||
|
|
|
@ -76,6 +76,7 @@ DrmOutput::DrmOutput(DrmPipeline *pipeline)
|
||||||
.edid = edid->raw(),
|
.edid = edid->raw(),
|
||||||
.subPixel = conn->subpixel(),
|
.subPixel = conn->subpixel(),
|
||||||
.capabilities = capabilities,
|
.capabilities = capabilities,
|
||||||
|
.panelOrientation = DrmConnector::toKWinTransform(conn->panelOrientation()),
|
||||||
.internal = conn->isInternal(),
|
.internal = conn->isInternal(),
|
||||||
.nonDesktop = conn->isNonDesktop(),
|
.nonDesktop = conn->isNonDesktop(),
|
||||||
});
|
});
|
||||||
|
|
|
@ -406,4 +406,9 @@ void Output::setContentType(ContentType contentType)
|
||||||
m_contentType = contentType;
|
m_contentType = contentType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Output::Transform Output::panelOrientation() const
|
||||||
|
{
|
||||||
|
return m_information.panelOrientation;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace KWin
|
} // namespace KWin
|
||||||
|
|
|
@ -248,6 +248,7 @@ public:
|
||||||
|
|
||||||
bool isPlaceholder() const;
|
bool isPlaceholder() const;
|
||||||
bool isNonDesktop() const;
|
bool isNonDesktop() const;
|
||||||
|
Transform panelOrientation() const;
|
||||||
|
|
||||||
virtual void setColorTransformation(const std::shared_ptr<ColorTransformation> &transformation);
|
virtual void setColorTransformation(const std::shared_ptr<ColorTransformation> &transformation);
|
||||||
|
|
||||||
|
@ -317,6 +318,7 @@ protected:
|
||||||
QByteArray edid;
|
QByteArray edid;
|
||||||
SubPixel subPixel = SubPixel::Unknown;
|
SubPixel subPixel = SubPixel::Unknown;
|
||||||
Capabilities capabilities;
|
Capabilities capabilities;
|
||||||
|
Transform panelOrientation = Transform::Normal;
|
||||||
bool internal = false;
|
bool internal = false;
|
||||||
bool placeholder = false;
|
bool placeholder = false;
|
||||||
bool nonDesktop = false;
|
bool nonDesktop = false;
|
||||||
|
|
|
@ -675,7 +675,7 @@ void Workspace::updateOutputConfiguration()
|
||||||
} else {
|
} else {
|
||||||
props->enabled = true;
|
props->enabled = true;
|
||||||
props->pos = pos;
|
props->pos = pos;
|
||||||
props->transform = Output::Transform::Normal;
|
props->transform = output->panelOrientation();
|
||||||
}
|
}
|
||||||
pos.setX(pos.x() + output->geometry().width());
|
pos.setX(pos.x() + output->geometry().width());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue