Commit e27ecfe8 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

Remove excessive damage region clipping

We already try to ensure that the surface damage is within render target
bounds. Avoid clipping surface damage in render backend, which is a bit
excessive task and perhaps it should be done an abstraction level above.
parent 05de198c
Pipeline #140602 passed with stage
in 14 minutes and 58 seconds
......@@ -254,9 +254,7 @@ void EglGbmBackend::aboutToStartPainting(AbstractOutput *output, const QRegion &
Q_ASSERT(m_surfaces.contains(output));
const auto &surface = m_surfaces[output];
if (surface->bufferAge() > 0 && !damagedRegion.isEmpty() && supportsPartialUpdate()) {
const QRegion region = damagedRegion & output->geometry();
QVector<EGLint> rects = regionToRects(region, static_cast<DrmAbstractOutput*>(output));
QVector<EGLint> rects = regionToRects(damagedRegion, static_cast<DrmAbstractOutput*>(output));
const bool correct = eglSetDamageRegionKHR(eglDisplay(), surface->eglSurface(), rects.data(), rects.count()/4);
if (!correct) {
qCWarning(KWIN_DRM) << "eglSetDamageRegionKHR failed:" << getEglErrorString();
......@@ -287,7 +285,7 @@ void EglGbmBackend::endFrame(AbstractOutput *output, const QRegion &renderedRegi
Q_UNUSED(renderedRegion)
m_surfaces[output]->endRendering(damagedRegion);
static_cast<DrmAbstractOutput*>(output)->present(m_surfaces[output]->currentBuffer(), damagedRegion & output->geometry());
static_cast<DrmAbstractOutput*>(output)->present(m_surfaces[output]->currentBuffer(), damagedRegion);
}
bool EglGbmBackend::scanout(AbstractOutput *output, SurfaceItem *surfaceItem)
......
......@@ -114,7 +114,7 @@ bool EglGbmLayer::endRendering(const QRegion &damagedRegion)
m_shadowBuffer->render(m_output);
}
GLRenderTarget::popRenderTarget();
const auto buffer = m_gbmSurface->swapBuffersForDrm(damagedRegion.intersected(m_output->geometry()));
const auto buffer = m_gbmSurface->swapBuffersForDrm(damagedRegion);
if (buffer) {
m_currentBuffer = buffer;
}
......
......@@ -315,9 +315,7 @@ void EglWaylandBackend::aboutToStartPainting(AbstractOutput *output, const QRegi
Q_ASSERT(m_outputs.contains(output));
const auto &eglOutput = m_outputs[output];
if (eglOutput->m_bufferAge > 0 && !damagedRegion.isEmpty() && supportsPartialUpdate()) {
const QRegion region = damagedRegion & eglOutput->m_waylandOutput->geometry();
QVector<EGLint> rects = regionToRects(region, eglOutput->m_waylandOutput);
QVector<EGLint> rects = regionToRects(damagedRegion, eglOutput->m_waylandOutput);
const bool correct = eglSetDamageRegionKHR(eglDisplay(), eglOutput->m_eglSurface,
rects.data(), rects.count()/4);
if (!correct) {
......@@ -387,11 +385,10 @@ void EglWaylandBackend::endFrame(AbstractOutput *output, const QRegion &rendered
GLRenderTarget::popRenderTarget();
const auto &eglOutput = m_outputs[output];
QRegion damage = damagedRegion.intersected(eglOutput->m_waylandOutput->geometry());
presentOnSurface(eglOutput, damage);
presentOnSurface(eglOutput, damagedRegion);
if (supportsBufferAge()) {
eglOutput->m_damageJournal.add(damage);
eglOutput->m_damageJournal.add(damagedRegion);
}
}
......
......@@ -719,10 +719,8 @@ void Scene::clearStackingOrder()
stacking_order.clear();
}
void Scene::paintWindow(Window* w, int mask, const QRegion &_region)
void Scene::paintWindow(Window *w, int mask, const QRegion &region)
{
// no painting outside visible screen (and no transformations)
const QRegion region = _region & renderTargetRect();
if (region.isEmpty()) // completely clipped
return;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment