backends/drm: fix modifier check

If we force a linear modifier, the modifier list can't match up with the
display, which causes the surface to be recreated every frame.

CCBUG: 462625
This commit is contained in:
Xaver Hugl 2022-12-06 17:49:24 +01:00
parent ca7f7a42c8
commit 3d9ccaf742
2 changed files with 4 additions and 2 deletions

View file

@ -216,7 +216,7 @@ bool EglGbmLayerSurface::doesSurfaceFit(const Surface &surface, const QSize &siz
return surface.gbmSurface
&& surface.gbmSurface->size() == size
&& formats.contains(surface.gbmSurface->format())
&& (surface.gbmSurface->modifiers().empty() || surface.gbmSurface->modifiers() == formats[surface.gbmSurface->format()]);
&& (surface.forceLinear || surface.gbmSurface->modifiers().empty() || surface.gbmSurface->modifiers() == formats[surface.gbmSurface->format()]);
}
std::optional<EglGbmLayerSurface::Surface> EglGbmLayerSurface::createSurface(const QSize &size, const QMap<uint32_t, QVector<uint64_t>> &formats) const
@ -279,7 +279,8 @@ std::optional<EglGbmLayerSurface::Surface> EglGbmLayerSurface::createSurface(con
{
Surface ret;
ret.importMode = importMode;
ret.gbmSurface = createGbmSurface(size, format, modifiers, importMode == MultiGpuImportMode::DumbBuffer || m_bufferTarget != BufferTarget::Normal);
ret.forceLinear = importMode == MultiGpuImportMode::DumbBuffer || m_bufferTarget != BufferTarget::Normal;
ret.gbmSurface = createGbmSurface(size, format, modifiers, ret.forceLinear);
if (!ret.gbmSurface) {
return std::nullopt;
}

View file

@ -72,6 +72,7 @@ private:
MultiGpuImportMode importMode;
std::shared_ptr<GbmBuffer> currentBuffer;
std::shared_ptr<DrmFramebuffer> currentFramebuffer;
bool forceLinear = false;
};
bool checkSurface(const QSize &size, const QMap<uint32_t, QVector<uint64_t>> &formats);
bool doesSurfaceFit(const Surface &surface, const QSize &size, const QMap<uint32_t, QVector<uint64_t>> &formats) const;