backends/drm: prevent some detachments
This commit is contained in:
parent
0c78da0e3a
commit
090b687126
5 changed files with 11 additions and 11 deletions
|
@ -194,7 +194,7 @@ int DrmConnector::currentModeIndex() const
|
||||||
return m_modeIndex;
|
return m_modeIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<DrmConnectorMode *> DrmConnector::modes()
|
QVector<DrmConnectorMode *> DrmConnector::modes() const
|
||||||
{
|
{
|
||||||
return m_modes;
|
return m_modes;
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@ public:
|
||||||
|
|
||||||
DrmConnectorMode *currentMode() const;
|
DrmConnectorMode *currentMode() const;
|
||||||
int currentModeIndex() const;
|
int currentModeIndex() const;
|
||||||
QVector<DrmConnectorMode *> modes();
|
QVector<DrmConnectorMode *> modes() const;
|
||||||
void setModeIndex(int index);
|
void setModeIndex(int index);
|
||||||
void findCurrentMode(drmModeModeInfo currentMode);
|
void findCurrentMode(drmModeModeInfo currentMode);
|
||||||
void updateModes();
|
void updateModes();
|
||||||
|
|
|
@ -116,7 +116,7 @@ void DrmOutput::updateCursor()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto plane = m_pipeline->pending.crtc->cursorPlane();
|
const auto plane = m_pipeline->pending.crtc->cursorPlane();
|
||||||
if (!m_cursor || (plane && !plane->formats()[m_cursor->drmFormat()].contains(DRM_FORMAT_MOD_LINEAR))) {
|
if (!m_cursor || (plane && !plane->formats().value(m_cursor->drmFormat()).contains(DRM_FORMAT_MOD_LINEAR))) {
|
||||||
if (plane) {
|
if (plane) {
|
||||||
const auto formatModifiers = plane->formats();
|
const auto formatModifiers = plane->formats();
|
||||||
const auto formats = formatModifiers.keys();
|
const auto formats = formatModifiers.keys();
|
||||||
|
|
|
@ -191,7 +191,7 @@ bool DrmPipeline::populateAtomicValues(drmModeAtomicReq *req, uint32_t &flags)
|
||||||
if (pending.crtc) {
|
if (pending.crtc) {
|
||||||
pending.crtc->setPending(DrmCrtc::PropertyIndex::VrrEnabled, pending.syncMode == RenderLoopPrivate::SyncMode::Adaptive);
|
pending.crtc->setPending(DrmCrtc::PropertyIndex::VrrEnabled, pending.syncMode == RenderLoopPrivate::SyncMode::Adaptive);
|
||||||
pending.crtc->setPending(DrmCrtc::PropertyIndex::Gamma_LUT, pending.gamma ? pending.gamma->blobId() : 0);
|
pending.crtc->setPending(DrmCrtc::PropertyIndex::Gamma_LUT, pending.gamma ? pending.gamma->blobId() : 0);
|
||||||
auto modeSize = m_connector->modes()[pending.modeIndex]->size();
|
auto modeSize = m_connector->modes().at(pending.modeIndex)->size();
|
||||||
pending.crtc->primaryPlane()->set(QPoint(0, 0), m_primaryBuffer ? m_primaryBuffer->size() : bufferSize(), QPoint(0, 0), modeSize);
|
pending.crtc->primaryPlane()->set(QPoint(0, 0), m_primaryBuffer ? m_primaryBuffer->size() : bufferSize(), QPoint(0, 0), modeSize);
|
||||||
pending.crtc->primaryPlane()->setBuffer(activePending() ? m_primaryBuffer.get() : nullptr);
|
pending.crtc->primaryPlane()->setBuffer(activePending() ? m_primaryBuffer.get() : nullptr);
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ void DrmPipeline::prepareAtomicModeset()
|
||||||
m_connector->setPending(DrmConnector::PropertyIndex::CrtcId, 0);
|
m_connector->setPending(DrmConnector::PropertyIndex::CrtcId, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto mode = m_connector->modes()[pending.modeIndex];
|
auto mode = m_connector->modes().at(pending.modeIndex);
|
||||||
|
|
||||||
m_connector->setPending(DrmConnector::PropertyIndex::CrtcId, activePending() ? pending.crtc->id() : 0);
|
m_connector->setPending(DrmConnector::PropertyIndex::CrtcId, activePending() ? pending.crtc->id() : 0);
|
||||||
if (const auto &prop = m_connector->getProp(DrmConnector::PropertyIndex::Broadcast_RGB)) {
|
if (const auto &prop = m_connector->getProp(DrmConnector::PropertyIndex::Broadcast_RGB)) {
|
||||||
|
@ -400,7 +400,7 @@ void DrmPipeline::applyPendingChanges()
|
||||||
|
|
||||||
QSize DrmPipeline::bufferSize() const
|
QSize DrmPipeline::bufferSize() const
|
||||||
{
|
{
|
||||||
const auto modeSize = m_connector->modes()[pending.modeIndex]->size();
|
const auto modeSize = m_connector->modes().at(pending.modeIndex)->size();
|
||||||
if (pending.bufferTransformation & (DrmPlane::Transformation::Rotate90 | DrmPlane::Transformation::Rotate270)) {
|
if (pending.bufferTransformation & (DrmPlane::Transformation::Rotate90 | DrmPlane::Transformation::Rotate270)) {
|
||||||
return modeSize.transposed();
|
return modeSize.transposed();
|
||||||
}
|
}
|
||||||
|
@ -409,7 +409,7 @@ QSize DrmPipeline::bufferSize() const
|
||||||
|
|
||||||
QSize DrmPipeline::sourceSize() const
|
QSize DrmPipeline::sourceSize() const
|
||||||
{
|
{
|
||||||
const auto modeSize = m_connector->modes()[pending.modeIndex]->size();
|
const auto modeSize = m_connector->modes().at(pending.modeIndex)->size();
|
||||||
if (pending.sourceTransformation & (DrmPlane::Transformation::Rotate90 | DrmPlane::Transformation::Rotate270)) {
|
if (pending.sourceTransformation & (DrmPlane::Transformation::Rotate90 | DrmPlane::Transformation::Rotate270)) {
|
||||||
return modeSize.transposed();
|
return modeSize.transposed();
|
||||||
}
|
}
|
||||||
|
@ -418,7 +418,7 @@ QSize DrmPipeline::sourceSize() const
|
||||||
|
|
||||||
bool DrmPipeline::isCursorVisible() const
|
bool DrmPipeline::isCursorVisible() const
|
||||||
{
|
{
|
||||||
const QRect mode = QRect(QPoint(), m_connector->modes()[pending.modeIndex]->size());
|
const QRect mode = QRect(QPoint(), m_connector->modes().at(pending.modeIndex)->size());
|
||||||
return pending.cursorBo && QRect(pending.cursorPos, pending.cursorBo->size()).intersects(mode);
|
return pending.cursorBo && QRect(pending.cursorPos, pending.cursorBo->size()).intersects(mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -468,7 +468,7 @@ bool DrmPipeline::isFormatSupported(uint32_t drmFormat) const
|
||||||
if (pending.crtc->primaryPlane()) {
|
if (pending.crtc->primaryPlane()) {
|
||||||
return pending.crtc->primaryPlane()->formats().contains(drmFormat);
|
return pending.crtc->primaryPlane()->formats().contains(drmFormat);
|
||||||
} else {
|
} else {
|
||||||
return legacyFormats.keys().contains(drmFormat);
|
return legacyFormats.contains(drmFormat);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
@ -478,7 +478,7 @@ bool DrmPipeline::isFormatSupported(uint32_t drmFormat) const
|
||||||
QVector<uint64_t> DrmPipeline::supportedModifiers(uint32_t drmFormat) const
|
QVector<uint64_t> DrmPipeline::supportedModifiers(uint32_t drmFormat) const
|
||||||
{
|
{
|
||||||
if (pending.crtc && pending.crtc->primaryPlane()) {
|
if (pending.crtc && pending.crtc->primaryPlane()) {
|
||||||
return pending.crtc->primaryPlane()->formats()[drmFormat];
|
return pending.crtc->primaryPlane()->formats().value(drmFormat);
|
||||||
} else {
|
} else {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ bool DrmPipeline::presentLegacy()
|
||||||
|
|
||||||
bool DrmPipeline::legacyModeset()
|
bool DrmPipeline::legacyModeset()
|
||||||
{
|
{
|
||||||
auto mode = m_connector->modes()[pending.modeIndex];
|
auto mode = m_connector->modes().at(pending.modeIndex);
|
||||||
uint32_t connId = m_connector->id();
|
uint32_t connId = m_connector->id();
|
||||||
if (!checkTestBuffer() || drmModeSetCrtc(gpu()->fd(), pending.crtc->id(), m_primaryBuffer->bufferId(), 0, 0, &connId, 1, mode->nativeMode()) != 0) {
|
if (!checkTestBuffer() || drmModeSetCrtc(gpu()->fd(), pending.crtc->id(), m_primaryBuffer->bufferId(), 0, 0, &connId, 1, mode->nativeMode()) != 0) {
|
||||||
qCWarning(KWIN_DRM) << "Modeset failed!" << strerror(errno);
|
qCWarning(KWIN_DRM) << "Modeset failed!" << strerror(errno);
|
||||||
|
|
Loading…
Reference in a new issue