diff options
author | Jørgen Lind <jorgen.lind@theqtcompany.com> | 2015-09-18 12:32:26 +0200 |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@theqtcompany.com> | 2015-09-18 14:50:19 +0000 |
commit | dea335f03ac4ce0a28cb75be76b598727b073ef6 (patch) | |
tree | 47e45548d75d910cdda2ccf9b25e2b6cb6e3b65d /src/compositor/compositor_api/qwaylandview.cpp | |
parent | 65d2daa799f69f995f1496863311fe338a89ee42 (diff) |
Add a DiscardFontBuffers property to QWaylandView
This is an optimisation property which can be set on a view. If you have
two views for a surface, then the frontBuffer will be released first
when the last view has released the frontBuffer. With this option all
views with this option set to true will discard the frontBuffer when the
throtlingView discards its frontbuffer
Change-Id: Id628ec60830549ea930c1fff950501de2b073e48
Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
Diffstat (limited to 'src/compositor/compositor_api/qwaylandview.cpp')
-rw-r--r-- | src/compositor/compositor_api/qwaylandview.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/compositor/compositor_api/qwaylandview.cpp b/src/compositor/compositor_api/qwaylandview.cpp index 636937abb..8707b22d3 100644 --- a/src/compositor/compositor_api/qwaylandview.cpp +++ b/src/compositor/compositor_api/qwaylandview.cpp @@ -162,6 +162,13 @@ bool QWaylandView::advance() if (d->bufferLock) return false; + if (d->surface && d->surface->throttlingView() == this) { + Q_FOREACH (QWaylandView *view, d->surface->views()) { + if (view != this && view->discardFrontBuffers() && view->d_func()->currentBuffer == d->currentBuffer) + view->discardCurrentBuffer(); + } + } + QMutexLocker locker(&d->bufferMutex); d->forceAdvanceSucceed = false; d->currentBuffer = d->nextBuffer; @@ -203,6 +210,21 @@ void QWaylandView::setBufferLock(bool locked) d->bufferLock = locked; } +bool QWaylandView::discardFrontBuffers() const +{ + Q_D(const QWaylandView); + return d->discardFrontBuffers; +} + +void QWaylandView::setDiscardFrontBuffers(bool discard) +{ + Q_D(QWaylandView); + if (d->discardFrontBuffers == discard) + return; + d->discardFrontBuffers = discard; + emit discardFrontBuffersChanged(); +} + struct wl_resource *QWaylandView::surfaceResource() const { Q_D(const QWaylandView); |