diff --git a/src/plugins/platforms/drm/drm_output.cpp b/src/plugins/platforms/drm/drm_output.cpp index a0b147a5c2..b57823094b 100644 --- a/src/plugins/platforms/drm/drm_output.cpp +++ b/src/plugins/platforms/drm/drm_output.cpp @@ -41,7 +41,7 @@ DrmOutput::DrmOutput(DrmGpu *gpu, DrmPipeline *pipeline) : DrmAbstractOutput(gpu) , m_pipeline(pipeline) { - m_pipeline->setUserData(this); + m_pipeline->setOutput(this); auto conn = m_pipeline->connector(); m_renderLoop->setRefreshRate(conn->currentMode().refreshRate); setSubPixelInternal(conn->subpixel()); diff --git a/src/plugins/platforms/drm/drm_pipeline.cpp b/src/plugins/platforms/drm/drm_pipeline.cpp index 5d2328a7d7..066b39179b 100644 --- a/src/plugins/platforms/drm/drm_pipeline.cpp +++ b/src/plugins/platforms/drm/drm_pipeline.cpp @@ -35,7 +35,7 @@ namespace KWin { DrmPipeline::DrmPipeline(DrmGpu *gpu, DrmConnector *conn, DrmCrtc *crtc, DrmPlane *primaryPlane) - : m_pageflipUserData(nullptr) + : m_output(nullptr) , m_gpu(gpu) , m_connector(conn) , m_crtc(crtc) @@ -154,13 +154,13 @@ bool DrmPipeline::doAtomicCommit(drmModeAtomicReq *req, uint32_t flags, bool tes bool result = populateAtomicValues(req, flags); // test - if (result && drmModeAtomicCommit(m_gpu->fd(), req, (flags & (~DRM_MODE_PAGE_FLIP_EVENT)) | DRM_MODE_ATOMIC_TEST_ONLY, m_pageflipUserData) != 0) { + if (result && drmModeAtomicCommit(m_gpu->fd(), req, (flags & (~DRM_MODE_PAGE_FLIP_EVENT)) | DRM_MODE_ATOMIC_TEST_ONLY, m_output) != 0) { qCWarning(KWIN_DRM) << "Atomic test failed!" << strerror(errno); printDebugInfo(); result = false; } // commit - if (!testOnly && result && drmModeAtomicCommit(m_gpu->fd(), req, flags, m_pageflipUserData) != 0) { + if (!testOnly && result && drmModeAtomicCommit(m_gpu->fd(), req, flags, m_output) != 0) { qCCritical(KWIN_DRM) << "Atomic commit failed! This never should've happened!" << strerror(errno); printDebugInfo(); result = false; @@ -220,7 +220,7 @@ bool DrmPipeline::presentLegacy() } m_lastFlags = DRM_MODE_PAGE_FLIP_EVENT; m_crtc->setNext(m_primaryBuffer); - if (drmModePageFlip(m_gpu->fd(), m_crtc->id(), m_primaryBuffer ? m_primaryBuffer->bufferId() : 0, DRM_MODE_PAGE_FLIP_EVENT, m_pageflipUserData) != 0) { + if (drmModePageFlip(m_gpu->fd(), m_crtc->id(), m_primaryBuffer ? m_primaryBuffer->bufferId() : 0, DRM_MODE_PAGE_FLIP_EVENT, m_output) != 0) { qCWarning(KWIN_DRM) << "Page flip failed:" << strerror(errno) << m_primaryBuffer; return false; } @@ -275,8 +275,8 @@ bool DrmPipeline::checkTestBuffer() } #if HAVE_GBM auto backend = m_gpu->eglBackend(); - if (backend && m_pageflipUserData) { - auto buffer = backend->renderTestFrame(m_pageflipUserData); + if (backend && m_output) { + auto buffer = backend->renderTestFrame(m_output); if (buffer && buffer->bufferId()) { m_oldTestBuffer = m_primaryBuffer; m_primaryBuffer = buffer; @@ -534,9 +534,14 @@ void DrmPipeline::pageFlipped() } } -void DrmPipeline::setUserData(DrmOutput *data) +void DrmPipeline::setOutput(DrmOutput *output) { - m_pageflipUserData = data; + m_output = output; +} + +DrmOutput *DrmPipeline::output() const +{ + return m_output; } void DrmPipeline::updateProperties() diff --git a/src/plugins/platforms/drm/drm_pipeline.h b/src/plugins/platforms/drm/drm_pipeline.h index 7ca76d0381..f9af62979e 100644 --- a/src/plugins/platforms/drm/drm_pipeline.h +++ b/src/plugins/platforms/drm/drm_pipeline.h @@ -77,13 +77,15 @@ public: void pageFlipped(); void printDebugInfo() const; - void setUserData(DrmOutput *data); QSize sourceSize() const; void updateProperties(); bool isFormatSupported(uint32_t drmFormat) const; QVector supportedModifiers(uint32_t drmFormat) const; + void setOutput(DrmOutput *output); + DrmOutput *output() const; + private: bool atomicCommit(); bool atomicTest(const QVector &pipelines); @@ -95,7 +97,7 @@ private: bool setPendingTransformation(const DrmPlane::Transformations &transformation); - DrmOutput *m_pageflipUserData = nullptr; + DrmOutput *m_output = nullptr; DrmGpu *m_gpu = nullptr; DrmConnector *m_connector = nullptr; DrmCrtc *m_crtc = nullptr;