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,
|
||||
{QByteArrayLiteral("Good"), QByteArrayLiteral("Bad")}),
|
||||
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)
|
||||
, m_pipeline(std::make_unique<DrmPipeline>(this))
|
||||
, 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);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
QDebugStateSaver saver(s);
|
||||
|
@ -482,4 +492,20 @@ DrmConnector::DrmContentType DrmConnector::kwinToDrmContentType(ContentType type
|
|||
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,
|
||||
LinkStatus = 11,
|
||||
ContentType = 12,
|
||||
PanelOrientation = 13,
|
||||
Count
|
||||
};
|
||||
|
||||
|
@ -84,6 +85,12 @@ public:
|
|||
Cinema = 3,
|
||||
Game = 4
|
||||
};
|
||||
enum class PanelOrientation : uint32_t {
|
||||
Normal = 0,
|
||||
UpsideDown = 1,
|
||||
LeftUp = 2,
|
||||
RightUp = 3
|
||||
};
|
||||
|
||||
bool init() override;
|
||||
bool updateProperties() override;
|
||||
|
@ -110,8 +117,10 @@ public:
|
|||
bool hasRgbRange() const;
|
||||
Output::RgbRange rgbRange() const;
|
||||
LinkStatus linkStatus() const;
|
||||
PanelOrientation panelOrientation() const;
|
||||
|
||||
static DrmContentType kwinToDrmContentType(ContentType type);
|
||||
static Output::Transform toKWinTransform(PanelOrientation orientation);
|
||||
|
||||
private:
|
||||
QList<std::shared_ptr<DrmConnectorMode>> generateCommonModes();
|
||||
|
|
|
@ -76,6 +76,7 @@ DrmOutput::DrmOutput(DrmPipeline *pipeline)
|
|||
.edid = edid->raw(),
|
||||
.subPixel = conn->subpixel(),
|
||||
.capabilities = capabilities,
|
||||
.panelOrientation = DrmConnector::toKWinTransform(conn->panelOrientation()),
|
||||
.internal = conn->isInternal(),
|
||||
.nonDesktop = conn->isNonDesktop(),
|
||||
});
|
||||
|
|
|
@ -406,4 +406,9 @@ void Output::setContentType(ContentType contentType)
|
|||
m_contentType = contentType;
|
||||
}
|
||||
|
||||
Output::Transform Output::panelOrientation() const
|
||||
{
|
||||
return m_information.panelOrientation;
|
||||
}
|
||||
|
||||
} // namespace KWin
|
||||
|
|
|
@ -248,6 +248,7 @@ public:
|
|||
|
||||
bool isPlaceholder() const;
|
||||
bool isNonDesktop() const;
|
||||
Transform panelOrientation() const;
|
||||
|
||||
virtual void setColorTransformation(const std::shared_ptr<ColorTransformation> &transformation);
|
||||
|
||||
|
@ -317,6 +318,7 @@ protected:
|
|||
QByteArray edid;
|
||||
SubPixel subPixel = SubPixel::Unknown;
|
||||
Capabilities capabilities;
|
||||
Transform panelOrientation = Transform::Normal;
|
||||
bool internal = false;
|
||||
bool placeholder = false;
|
||||
bool nonDesktop = false;
|
||||
|
|
|
@ -675,7 +675,7 @@ void Workspace::updateOutputConfiguration()
|
|||
} else {
|
||||
props->enabled = true;
|
||||
props->pos = pos;
|
||||
props->transform = Output::Transform::Normal;
|
||||
props->transform = output->panelOrientation();
|
||||
}
|
||||
pos.setX(pos.x() + output->geometry().width());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue