backends/drm: inline renderFramebufferToSurface

And also remove an unnecessary makeContextCurrent
This commit is contained in:
Xaver Hugl 2021-12-21 12:24:57 +01:00 committed by Vlad Zahorodnii
parent c498d31aa7
commit cfdb303012
2 changed files with 6 additions and 13 deletions

View file

@ -234,7 +234,9 @@ bool EglGbmBackend::swapBuffers(DrmAbstractOutput *drmOutput, const QRegion &dir
{ {
Q_ASSERT(m_outputs.contains(drmOutput)); Q_ASSERT(m_outputs.contains(drmOutput));
Output &output = m_outputs[drmOutput]; Output &output = m_outputs[drmOutput];
renderFramebufferToSurface(output); if (output.current.shadowBuffer) {
output.current.shadowBuffer->render(output.output);
}
if (output.current.gbmSurface->swapBuffers()) { if (output.current.gbmSurface->swapBuffers()) {
cleanupRenderData(output.old); cleanupRenderData(output.old);
updateBufferAge(output, dirty); updateBufferAge(output, dirty);
@ -353,16 +355,6 @@ QSharedPointer<DrmBuffer> EglGbmBackend::importFramebuffer(Output &output, const
return nullptr; return nullptr;
} }
void EglGbmBackend::renderFramebufferToSurface(Output &output)
{
if (!output.current.shadowBuffer) {
// No additional render target.
return;
}
output.current.gbmSurface->makeContextCurrent();
output.current.shadowBuffer->render(output.output);
}
bool EglGbmBackend::initBufferConfigs() bool EglGbmBackend::initBufferConfigs()
{ {
const EGLint config_attribs[] = { const EGLint config_attribs[] = {
@ -581,7 +573,9 @@ QSharedPointer<DrmBuffer> EglGbmBackend::endFrameWithBuffer(AbstractOutput *drmO
Q_ASSERT(m_outputs.contains(drmOutput)); Q_ASSERT(m_outputs.contains(drmOutput));
Output &output = m_outputs[drmOutput]; Output &output = m_outputs[drmOutput];
if (isPrimary()) { if (isPrimary()) {
renderFramebufferToSurface(output); if (output.current.shadowBuffer) {
output.current.shadowBuffer->render(output.output);
}
auto buffer = output.current.gbmSurface->swapBuffersForDrm(); auto buffer = output.current.gbmSurface->swapBuffersForDrm();
if (buffer) { if (buffer) {
updateBufferAge(output, dirty); updateBufferAge(output, dirty);

View file

@ -123,7 +123,6 @@ private:
void setViewport(const Output &output) const; void setViewport(const Output &output) const;
void renderFramebufferToSurface(Output &output);
QRegion prepareRenderingForOutput(Output &output); QRegion prepareRenderingForOutput(Output &output);
QSharedPointer<DrmBuffer> importFramebuffer(Output &output, const QRegion &dirty) const; QSharedPointer<DrmBuffer> importFramebuffer(Output &output, const QRegion &dirty) const;
QSharedPointer<DrmBuffer> endFrameWithBuffer(AbstractOutput *output, const QRegion &dirty); QSharedPointer<DrmBuffer> endFrameWithBuffer(AbstractOutput *output, const QRegion &dirty);