backends/drm: make buffer age environment variable work again

It can be very useful for debugging
This commit is contained in:
Xaver Hugl 2023-08-28 21:29:05 +02:00
parent 1c18d11206
commit 1d1981b0f4
2 changed files with 6 additions and 5 deletions

View file

@ -31,6 +31,8 @@ static const QVector<uint64_t> linearModifier = {DRM_FORMAT_MOD_LINEAR};
static const QVector<uint64_t> implicitModifier = {DRM_FORMAT_MOD_INVALID};
static const QVector<uint32_t> cpuCopyFormats = {DRM_FORMAT_ARGB8888, DRM_FORMAT_XRGB8888};
static const bool bufferAgeEnabled = qEnvironmentVariable("KWIN_USE_BUFFER_AGE") != QStringLiteral("0");
static gbm_format_name_desc formatName(uint32_t format)
{
gbm_format_name_desc ret;
@ -90,7 +92,7 @@ std::optional<OutputLayerBeginFrameInfo> EglGbmLayerSurface::startRendering(cons
}
}
QRegion repaint = m_surface.damageJournal.accumulate(slot->age(), infiniteRegion());
const QRegion repaint = bufferAgeEnabled ? m_surface.damageJournal.accumulate(slot->age(), infiniteRegion()) : infiniteRegion();
if (enableColormanagement) {
if (!m_surface.shadowBuffer || m_surface.shadowTexture->size() != m_surface.gbmSwapchain->size()) {
m_surface.shadowTexture = GLTexture::allocate(GL_RGBA16F, m_surface.gbmSwapchain->size());

View file

@ -31,6 +31,8 @@ namespace KWin
namespace Wayland
{
static const bool bufferAgeEnabled = qEnvironmentVariable("KWIN_USE_BUFFER_AGE") != QStringLiteral("0");
WaylandEglPrimaryLayer::WaylandEglPrimaryLayer(WaylandOutput *output, WaylandEglBackend *backend)
: m_waylandOutput(output)
, m_backend(backend)
@ -86,10 +88,7 @@ std::optional<OutputLayerBeginFrameInfo> WaylandEglPrimaryLayer::beginFrame()
return std::nullopt;
}
QRegion repair;
if (m_backend->supportsBufferAge()) {
repair = m_damageJournal.accumulate(m_buffer->age(), infiniteRegion());
}
const QRegion repair = bufferAgeEnabled ? m_damageJournal.accumulate(m_buffer->age(), infiniteRegion()) : infiniteRegion();
if (!m_query) {
m_query = std::make_unique<GLRenderTimeQuery>();
}