backends/drm: ensure correct format+modifiers pairs for surfaces
When the crtcs get switched around between outputs, their primary planes and thus the supported formats also get switched around. In order to make sure that doesn't cause any problems, always check whether or not the format+modifiers used are supported.
This commit is contained in:
parent
bd3dd7ce36
commit
fe9a3f45c0
3 changed files with 12 additions and 0 deletions
|
@ -552,6 +552,10 @@ bool EglGbmBackend::doesRenderFit(const Output &output, const Output::RenderData
|
|||
if (output.forceXrgb8888 && render.gbmSurface->format() != DRM_FORMAT_XRGB8888) {
|
||||
return false;
|
||||
}
|
||||
if (!output.output->isFormatSupported(render.gbmSurface->format())
|
||||
|| output.output->supportedModifiers(render.gbmSurface->format()) != render.gbmSurface->modifiers()) {
|
||||
return false;
|
||||
}
|
||||
QSize surfaceSize = output.output->bufferSize();
|
||||
if (surfaceSize != render.gbmSurface->size()) {
|
||||
return false;
|
||||
|
|
|
@ -40,6 +40,7 @@ GbmSurface::GbmSurface(DrmGpu *gpu, const QSize &size, uint32_t format, QVector<
|
|||
, m_gpu(gpu)
|
||||
, m_size(size)
|
||||
, m_format(format)
|
||||
, m_modifiers(modifiers)
|
||||
{
|
||||
if (!m_surface) {
|
||||
qCCritical(KWIN_DRM) << "Could not create gbm surface!" << strerror(errno);
|
||||
|
@ -138,4 +139,9 @@ uint32_t GbmSurface::format() const
|
|||
return m_format;
|
||||
}
|
||||
|
||||
QVector<uint64_t> GbmSurface::modifiers() const
|
||||
{
|
||||
return m_modifiers;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ public:
|
|||
QSize size() const;
|
||||
bool isValid() const;
|
||||
uint32_t format() const;
|
||||
QVector<uint64_t> modifiers() const;
|
||||
|
||||
private:
|
||||
gbm_surface *m_surface;
|
||||
|
@ -47,6 +48,7 @@ private:
|
|||
EGLSurface m_eglSurface = EGL_NO_SURFACE;
|
||||
QSize m_size;
|
||||
const uint32_t m_format;
|
||||
const QVector<uint64_t> m_modifiers;
|
||||
|
||||
QSharedPointer<GbmBuffer> m_currentBuffer;
|
||||
QSharedPointer<DrmGbmBuffer> m_currentDrmBuffer;
|
||||
|
|
Loading…
Reference in a new issue