diff --git a/plugins/platforms/drm/abstract_egl_drm_backend.h b/plugins/platforms/drm/abstract_egl_drm_backend.h index 8f00499113..301dd0ef8c 100644 --- a/plugins/platforms/drm/abstract_egl_drm_backend.h +++ b/plugins/platforms/drm/abstract_egl_drm_backend.h @@ -35,9 +35,6 @@ public: Q_UNUSED(stride) return 0; } - virtual void cleanupDmabufForSecondaryGpuOutput(AbstractOutput *output) { - Q_UNUSED(output) - } virtual QRegion beginFrameForSecondaryGpu(AbstractOutput *output) { Q_UNUSED(output) return QRegion(); diff --git a/plugins/platforms/drm/egl_gbm_backend.cpp b/plugins/platforms/drm/egl_gbm_backend.cpp index 55b0f9d956..e79b3802cc 100644 --- a/plugins/platforms/drm/egl_gbm_backend.cpp +++ b/plugins/platforms/drm/egl_gbm_backend.cpp @@ -271,6 +271,14 @@ int EglGbmBackend::getDmabufForSecondaryGpuOutput(AbstractOutput *output, uint32 if (it == m_secondaryGpuOutputs.end()) { return -1; } + if (it->dmabufFd) { + close(it->dmabufFd); + it->dmabufFd = 0; + } + if (it->secondaryGbmBo) { + it->gbmSurface.get()->releaseBuffer(it->secondaryGbmBo); + it->secondaryGbmBo = nullptr; + } renderFramebufferToSurface(*it); auto error = eglSwapBuffers(eglDisplay(), it->eglSurface); if (error != EGL_TRUE) { @@ -289,27 +297,6 @@ int EglGbmBackend::getDmabufForSecondaryGpuOutput(AbstractOutput *output, uint32 return it->dmabufFd; } -void EglGbmBackend::cleanupDmabufForSecondaryGpuOutput(AbstractOutput *output) -{ - DrmOutput *drmOutput = static_cast(output); - auto it = std::find_if(m_secondaryGpuOutputs.begin(), m_secondaryGpuOutputs.end(), - [drmOutput] (const Output &output) { - return output.output == drmOutput; - } - ); - if (it == m_secondaryGpuOutputs.end()) { - return; - } - if (it->dmabufFd) { - close(it->dmabufFd); - it->dmabufFd = 0; - } - if (it->secondaryGbmBo) { - it->gbmSurface.get()->releaseBuffer(it->secondaryGbmBo); - it->secondaryGbmBo = nullptr; - } -} - QRegion EglGbmBackend::beginFrameForSecondaryGpu(AbstractOutput *output) { DrmOutput *drmOutput = static_cast(output); @@ -471,7 +458,6 @@ void EglGbmBackend::renderFramebufferToSurface(Output &output) output.importedGbmBo = importedBuffer; } } - renderingBackend()->cleanupDmabufForSecondaryGpuOutput(output.output); } } diff --git a/plugins/platforms/drm/egl_gbm_backend.h b/plugins/platforms/drm/egl_gbm_backend.h index 19344c2fe6..2c34eecb29 100644 --- a/plugins/platforms/drm/egl_gbm_backend.h +++ b/plugins/platforms/drm/egl_gbm_backend.h @@ -46,7 +46,6 @@ public: void addOutput(DrmOutput *output) override; void removeOutput(DrmOutput *output) override; int getDmabufForSecondaryGpuOutput(AbstractOutput *output, uint32_t *format, uint32_t *stride) override; - void cleanupDmabufForSecondaryGpuOutput(AbstractOutput *output) override; QRegion beginFrameForSecondaryGpu(AbstractOutput *output) override; protected: