Fix force xrgb 8888

19c471405e7eb4b6026db24d776d205125dbc013 introduced a regression if
there are two gbm backend and the backend fail to choose drm format.

This fix does two things:
1. Current buffer format should not be reset after create new buffer,
   otherwise current.format may just be empty after resetOutput.
2. force xrgb 8888 need to be set on the primary backend.

BUG: 448790
master
Weng Xuetian 3 years ago
parent f81e84412e
commit e64f60ce08
No known key found for this signature in database
GPG Key ID: 8E8B898CBF2412F9

@ -155,7 +155,6 @@ bool EglGbmBackend::resetOutput(Output &output)
qCCritical(KWIN_DRM) << "Could not find a suitable format for output" << output.output;
return false;
}
output.current.format = gbmFormat.value();
uint32_t format = gbmFormat.value().drmFormat;
QVector<uint64_t> modifiers = output.output->supportedModifiers(format);
const QSize size = output.output->bufferSize();
@ -193,6 +192,7 @@ bool EglGbmBackend::resetOutput(Output &output)
cleanupRenderData(output.old);
output.old = output.current;
output.current = {};
output.current.format = gbmFormat.value();
output.current.gbmSurface = gbmSurface;
if (!output.output->needsSoftwareTransformation()) {
@ -349,6 +349,7 @@ QSharedPointer<DrmBuffer> EglGbmBackend::importFramebuffer(Output &output, const
qCWarning(KWIN_DRM) << "all imports failed on output" << output.output;
// try again with XRGB8888, the most universally supported basic format
output.forceXrgb8888 = true;
renderingBackend()->setForceXrgb8888(output.output);
return nullptr;
}
@ -862,6 +863,11 @@ bool EglGbmBackend::prefer10bpc() const
return !ok || preferred == 30;
}
void EglGbmBackend::setForceXrgb8888(DrmAbstractOutput *output) {
auto &o = m_outputs[output];
o.forceXrgb8888 = true;
}
bool operator==(const GbmFormat &lhs, const GbmFormat &rhs)
{
return lhs.drmFormat == rhs.drmFormat;

@ -141,6 +141,8 @@ private:
static EglGbmBackend *renderingBackend();
void setForceXrgb8888(DrmAbstractOutput *output);
friend class EglGbmTexture;
};

Loading…
Cancel
Save