platforms/drm: rename user data in DrmPipeline to output

This commit is contained in:
Xaver Hugl 2021-08-08 00:03:09 +02:00
parent 65b55e2045
commit 18a8245ca2
3 changed files with 18 additions and 11 deletions

View file

@ -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());

View file

@ -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()

View file

@ -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<uint64_t> supportedModifiers(uint32_t drmFormat) const;
void setOutput(DrmOutput *output);
DrmOutput *output() const;
private:
bool atomicCommit();
bool atomicTest(const QVector<DrmPipeline*> &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;