Commit 27e7dba1 authored by Xaver Hugl's avatar Xaver Hugl
Browse files

Only release shared buffers right before the next frame

BUG: 425586


(cherry picked from commit 2c6d19fe)
parent ab5d1737
......@@ -36,9 +36,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();
......
......@@ -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<DrmOutput*>(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<DrmOutput*>(output);
......@@ -471,7 +458,6 @@ void EglGbmBackend::renderFramebufferToSurface(Output &output)
output.importedGbmBo = importedBuffer;
}
}
renderingBackend()->cleanupDmabufForSecondaryGpuOutput(output.output);
}
}
......
......@@ -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:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment