backends/drm: move layers out of the pipeline state
They're not actually supposed to be ever reverted, so having them in the state is just unnecessary overhead
This commit is contained in:
parent
f7fb9476b3
commit
5340d729aa
3 changed files with 20 additions and 19 deletions
|
@ -65,7 +65,7 @@ bool DrmPipeline::testScanout()
|
|||
if (gpu()->atomicModeSetting()) {
|
||||
return commitPipelines({this}, CommitMode::Test) == Error::None;
|
||||
} else {
|
||||
if (m_pending.layer->currentBuffer()->buffer()->size() != m_pending.mode->size()) {
|
||||
if (m_primaryLayer->currentBuffer()->buffer()->size() != m_pending.mode->size()) {
|
||||
// scaling isn't supported with the legacy API
|
||||
return false;
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ DrmPipeline::Error DrmPipeline::present()
|
|||
if (gpu()->atomicModeSetting()) {
|
||||
return commitPipelines({this}, CommitMode::Commit);
|
||||
} else {
|
||||
if (m_pending.layer->hasDirectScanoutBuffer()) {
|
||||
if (m_primaryLayer->hasDirectScanoutBuffer()) {
|
||||
// already presented
|
||||
return Error::None;
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ DrmPipeline::Error DrmPipeline::commitPipelinesAtomic(const QVector<DrmPipeline
|
|||
}
|
||||
for (const auto &pipeline : pipelines) {
|
||||
if (pipeline->activePending()) {
|
||||
if (!pipeline->m_pending.layer->checkTestBuffer()) {
|
||||
if (!pipeline->m_primaryLayer->checkTestBuffer()) {
|
||||
qCWarning(KWIN_DRM) << "Checking test buffer failed for" << mode;
|
||||
return Error::TestBufferFailed;
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ bool DrmPipeline::prepareAtomicPresentation(DrmAtomicCommit *commit)
|
|||
return false;
|
||||
}
|
||||
|
||||
const auto fb = m_pending.layer->currentBuffer();
|
||||
const auto fb = m_primaryLayer->currentBuffer();
|
||||
m_pending.crtc->primaryPlane()->set(commit, QPoint(0, 0), fb->buffer()->size(), centerBuffer(fb->buffer()->size(), m_pending.mode->size()));
|
||||
commit->addBuffer(m_pending.crtc->primaryPlane(), fb);
|
||||
|
||||
|
@ -453,7 +453,7 @@ QMap<uint32_t, QVector<uint64_t>> DrmPipeline::cursorFormats() const
|
|||
|
||||
bool DrmPipeline::pruneModifier()
|
||||
{
|
||||
const DmaBufAttributes *dmabufAttributes = m_pending.layer->currentBuffer() ? m_pending.layer->currentBuffer()->buffer()->dmabufAttributes() : nullptr;
|
||||
const DmaBufAttributes *dmabufAttributes = m_primaryLayer->currentBuffer() ? m_primaryLayer->currentBuffer()->buffer()->dmabufAttributes() : nullptr;
|
||||
if (!dmabufAttributes) {
|
||||
return false;
|
||||
}
|
||||
|
@ -547,12 +547,12 @@ bool DrmPipeline::enabled() const
|
|||
|
||||
DrmPipelineLayer *DrmPipeline::primaryLayer() const
|
||||
{
|
||||
return m_pending.layer.get();
|
||||
return m_primaryLayer.get();
|
||||
}
|
||||
|
||||
DrmOverlayLayer *DrmPipeline::cursorLayer() const
|
||||
{
|
||||
return m_pending.cursorLayer.get();
|
||||
return m_cursorLayer.get();
|
||||
}
|
||||
|
||||
DrmPlane::Transformations DrmPipeline::renderOrientation() const
|
||||
|
@ -625,8 +625,8 @@ void DrmPipeline::setEnable(bool enable)
|
|||
|
||||
void DrmPipeline::setLayers(const std::shared_ptr<DrmPipelineLayer> &primaryLayer, const std::shared_ptr<DrmOverlayLayer> &cursorLayer)
|
||||
{
|
||||
m_pending.layer = primaryLayer;
|
||||
m_pending.cursorLayer = cursorLayer;
|
||||
m_primaryLayer = primaryLayer;
|
||||
m_cursorLayer = cursorLayer;
|
||||
}
|
||||
|
||||
void DrmPipeline::setRenderOrientation(DrmPlane::Transformations orientation)
|
||||
|
|
|
@ -98,13 +98,15 @@ public:
|
|||
void setOutput(DrmOutput *output);
|
||||
DrmOutput *output() const;
|
||||
|
||||
void setLayers(const std::shared_ptr<DrmPipelineLayer> &primaryLayer, const std::shared_ptr<DrmOverlayLayer> &cursorLayer);
|
||||
DrmPipelineLayer *primaryLayer() const;
|
||||
DrmOverlayLayer *cursorLayer() const;
|
||||
|
||||
DrmCrtc *crtc() const;
|
||||
std::shared_ptr<DrmConnectorMode> mode() const;
|
||||
bool active() const;
|
||||
bool activePending() const;
|
||||
bool enabled() const;
|
||||
DrmPipelineLayer *primaryLayer() const;
|
||||
DrmOverlayLayer *cursorLayer() const;
|
||||
DrmPlane::Transformations renderOrientation() const;
|
||||
RenderLoopPrivate::SyncMode syncMode() const;
|
||||
uint32_t overscan() const;
|
||||
|
@ -118,7 +120,6 @@ public:
|
|||
void setMode(const std::shared_ptr<DrmConnectorMode> &mode);
|
||||
void setActive(bool active);
|
||||
void setEnable(bool enable);
|
||||
void setLayers(const std::shared_ptr<DrmPipelineLayer> &primaryLayer, const std::shared_ptr<DrmOverlayLayer> &cursorLayer);
|
||||
void setRenderOrientation(DrmPlane::Transformations orientation);
|
||||
void setSyncMode(RenderLoopPrivate::SyncMode mode);
|
||||
void setOverscan(uint32_t overscan);
|
||||
|
@ -189,8 +190,6 @@ private:
|
|||
double sdrBrightness = 200;
|
||||
ColorDescription colorDescription = ColorDescription::sRGB;
|
||||
|
||||
std::shared_ptr<DrmPipelineLayer> layer;
|
||||
std::shared_ptr<DrmOverlayLayer> cursorLayer;
|
||||
QPoint cursorHotspot;
|
||||
|
||||
// the transformation that buffers submitted to the pipeline should have
|
||||
|
@ -204,6 +203,8 @@ private:
|
|||
State m_current;
|
||||
|
||||
std::unique_ptr<DrmCommitThread> m_commitThread;
|
||||
std::shared_ptr<DrmPipelineLayer> m_primaryLayer;
|
||||
std::shared_ptr<DrmOverlayLayer> m_cursorLayer;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ DrmPipeline::Error DrmPipeline::presentLegacy()
|
|||
return err;
|
||||
}
|
||||
}
|
||||
const auto buffer = m_pending.layer->currentBuffer();
|
||||
const auto buffer = m_primaryLayer->currentBuffer();
|
||||
uint32_t flags = DRM_MODE_PAGE_FLIP_EVENT;
|
||||
if (m_pending.syncMode == RenderLoopPrivate::SyncMode::Async || m_pending.syncMode == RenderLoopPrivate::SyncMode::AdaptiveAsync) {
|
||||
flags |= DRM_MODE_PAGE_FLIP_ASYNC;
|
||||
|
@ -54,10 +54,10 @@ void DrmPipeline::forceLegacyModeset()
|
|||
|
||||
DrmPipeline::Error DrmPipeline::legacyModeset()
|
||||
{
|
||||
if (!m_pending.layer->checkTestBuffer()) {
|
||||
if (!m_primaryLayer->checkTestBuffer()) {
|
||||
return Error::TestBufferFailed;
|
||||
}
|
||||
auto commit = std::make_unique<DrmLegacyCommit>(this, m_pending.layer->currentBuffer());
|
||||
auto commit = std::make_unique<DrmLegacyCommit>(this, m_primaryLayer->currentBuffer());
|
||||
if (!commit->doModeset(m_connector, m_pending.mode.get())) {
|
||||
qCWarning(KWIN_DRM) << "Modeset failed!" << strerror(errno);
|
||||
return errnoToError();
|
||||
|
@ -155,8 +155,8 @@ bool DrmPipeline::setCursorLegacy()
|
|||
struct drm_mode_cursor2 arg = {
|
||||
.flags = DRM_MODE_CURSOR_BO | DRM_MODE_CURSOR_MOVE,
|
||||
.crtc_id = m_pending.crtc->id(),
|
||||
.x = m_pending.cursorLayer->position().x(),
|
||||
.y = m_pending.cursorLayer->position().y(),
|
||||
.x = m_cursorLayer->position().x(),
|
||||
.y = m_cursorLayer->position().y(),
|
||||
.width = (uint32_t)gpu()->cursorSize().width(),
|
||||
.height = (uint32_t)gpu()->cursorSize().height(),
|
||||
.handle = handle,
|
||||
|
|
Loading…
Reference in a new issue