backends/drm: fix overscan
Somehow its use got lost in the 5.24 development cycle
This commit is contained in:
parent
b1c1603c8c
commit
7faa2587de
5 changed files with 30 additions and 19 deletions
|
@ -261,24 +261,6 @@ uint32_t DrmConnector::overscan() const
|
|||
return 0;
|
||||
}
|
||||
|
||||
void DrmConnector::setOverscan(uint32_t overscan, const QSize &modeSize)
|
||||
{
|
||||
if (auto prop = m_props[static_cast<uint32_t>(PropertyIndex::Overscan)]) {
|
||||
prop->setPending(overscan);
|
||||
} else if (auto prop = m_props[static_cast<uint32_t>(PropertyIndex::Underscan)]) {
|
||||
float aspectRatio = modeSize.width() / static_cast<float>(modeSize.height());
|
||||
prop->setEnum(overscan > 0 ? UnderscanOptions::On : UnderscanOptions::Off);
|
||||
uint32_t hborder = overscan * aspectRatio;
|
||||
if (hborder > 128) {
|
||||
hborder = 128;
|
||||
overscan = 128 / aspectRatio;
|
||||
}
|
||||
// overscan only goes from 0-100 so we cut off the 101-128 value range of underscan_vborder
|
||||
setPending(PropertyIndex::Underscan_vborder, overscan);
|
||||
setPending(PropertyIndex::Underscan_hborder, hborder);
|
||||
}
|
||||
}
|
||||
|
||||
bool DrmConnector::vrrCapable() const
|
||||
{
|
||||
if (const auto &prop = getProp(PropertyIndex::VrrCapable)) {
|
||||
|
|
|
@ -105,7 +105,6 @@ public:
|
|||
AbstractWaylandOutput::SubPixel subpixel() const;
|
||||
bool hasOverscan() const;
|
||||
uint32_t overscan() const;
|
||||
void setOverscan(uint32_t overscan, const QSize &modeSize);
|
||||
bool vrrCapable() const;
|
||||
bool hasRgbRange() const;
|
||||
AbstractWaylandOutput::RgbRange rgbRange() const;
|
||||
|
|
|
@ -237,6 +237,14 @@ void DrmPipeline::prepareAtomicModeset()
|
|||
if (const auto &prop = m_connector->getProp(DrmConnector::PropertyIndex::LinkStatus)) {
|
||||
prop->setEnum(DrmConnector::LinkStatus::Good);
|
||||
}
|
||||
if (const auto overscan = m_connector->getProp(DrmConnector::PropertyIndex::Overscan)) {
|
||||
overscan->setPending(pending.overscan);
|
||||
} else if (const auto underscan = m_connector->getProp(DrmConnector::PropertyIndex::Underscan)) {
|
||||
const uint32_t hborder = calculateUnderscan();
|
||||
underscan->setEnum(pending.overscan != 0 ? DrmConnector::UnderscanOptions::On : DrmConnector::UnderscanOptions::Off);
|
||||
m_connector->getProp(DrmConnector::PropertyIndex::Underscan_vborder)->setPending(pending.overscan);
|
||||
m_connector->getProp(DrmConnector::PropertyIndex::Underscan_hborder)->setPending(hborder);
|
||||
}
|
||||
|
||||
pending.crtc->setPending(DrmCrtc::PropertyIndex::Active, activePending());
|
||||
pending.crtc->setPending(DrmCrtc::PropertyIndex::ModeId, activePending() ? pending.mode->blobId() : 0);
|
||||
|
@ -248,6 +256,19 @@ void DrmPipeline::prepareAtomicModeset()
|
|||
}
|
||||
}
|
||||
|
||||
uint32_t DrmPipeline::calculateUnderscan()
|
||||
{
|
||||
const auto size = pending.mode->size();
|
||||
const float aspectRatio = size.width() / static_cast<float>(size.height());
|
||||
uint32_t hborder = pending.overscan * aspectRatio;
|
||||
if (hborder > 128) {
|
||||
// overscan only goes from 0-100 so we cut off the 101-128 value range of underscan_vborder
|
||||
hborder = 128;
|
||||
pending.overscan = 128 / aspectRatio;
|
||||
}
|
||||
return hborder;
|
||||
}
|
||||
|
||||
void DrmPipeline::atomicCommitFailed()
|
||||
{
|
||||
if (m_oldTestBuffer) {
|
||||
|
|
|
@ -128,6 +128,7 @@ private:
|
|||
bool activePending() const;
|
||||
bool isCursorVisible() const;
|
||||
bool isBufferForDirectScanout() const;
|
||||
uint32_t calculateUnderscan();
|
||||
|
||||
// legacy only
|
||||
bool presentLegacy();
|
||||
|
|
|
@ -94,6 +94,14 @@ bool DrmPipeline::applyPendingChangesLegacy()
|
|||
if (const auto &rgbRange = m_connector->getProp(DrmConnector::PropertyIndex::Broadcast_RGB)) {
|
||||
rgbRange->setEnumLegacy(pending.rgbRange);
|
||||
}
|
||||
if (const auto overscan = m_connector->getProp(DrmConnector::PropertyIndex::Overscan)) {
|
||||
overscan->setPropertyLegacy(pending.overscan);
|
||||
} else if (const auto underscan = m_connector->getProp(DrmConnector::PropertyIndex::Underscan)) {
|
||||
const uint32_t hborder = calculateUnderscan();
|
||||
underscan->setEnumLegacy(pending.overscan != 0 ? DrmConnector::UnderscanOptions::On : DrmConnector::UnderscanOptions::Off);
|
||||
m_connector->getProp(DrmConnector::PropertyIndex::Underscan_vborder)->setPropertyLegacy(pending.overscan);
|
||||
m_connector->getProp(DrmConnector::PropertyIndex::Underscan_hborder)->setPropertyLegacy(hborder);
|
||||
}
|
||||
if (needsModeset() &&!legacyModeset()) {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue