summaryrefslogtreecommitdiffstats
path: root/src/compositor
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@theqtcompany.com>2015-09-18 12:32:26 +0200
committerPaul Olav Tvete <paul.tvete@theqtcompany.com>2015-09-18 14:50:19 +0000
commitdea335f03ac4ce0a28cb75be76b598727b073ef6 (patch)
tree47e45548d75d910cdda2ccf9b25e2b6cb6e3b65d /src/compositor
parent65d2daa799f69f995f1496863311fe338a89ee42 (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')
-rw-r--r--src/compositor/compositor_api/qwaylandview.cpp22
-rw-r--r--src/compositor/compositor_api/qwaylandview.h5
-rw-r--r--src/compositor/compositor_api/qwaylandview_p.h2
3 files changed, 29 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);
diff --git a/src/compositor/compositor_api/qwaylandview.h b/src/compositor/compositor_api/qwaylandview.h
index 7eba0c809..5a820fb50 100644
--- a/src/compositor/compositor_api/qwaylandview.h
+++ b/src/compositor/compositor_api/qwaylandview.h
@@ -57,6 +57,7 @@ class Q_COMPOSITOR_EXPORT QWaylandView : public QObject
Q_PROPERTY(QWaylandSurface *surface READ surface WRITE setSurface NOTIFY surfaceChanged)
Q_PROPERTY(QWaylandOutput *output READ output WRITE setOutput NOTIFY outputChanged)
Q_PROPERTY(bool bufferLock READ isBufferLocked WRITE setBufferLock NOTIFY bufferLockChanged)
+ Q_PROPERTY(bool discardFrontBuffers READ discardFrontBuffers WRITE setDiscardFrontBuffers NOTIFY discardFrontBuffersChanged)
public:
QWaylandView(QObject *renderObject = 0, QObject *parent = 0);
virtual ~QWaylandView();
@@ -78,6 +79,9 @@ public:
bool isBufferLocked() const;
void setBufferLock(bool locked);
+ bool discardFrontBuffers() const;
+ void setDiscardFrontBuffers(bool discard);
+
struct wl_resource *surfaceResource() const;
Q_SIGNALS:
@@ -85,6 +89,7 @@ Q_SIGNALS:
void surfaceDestroyed();
void outputChanged();
void bufferLockChanged();
+ void discardFrontBuffersChanged();
};
QT_END_NAMESPACE
diff --git a/src/compositor/compositor_api/qwaylandview_p.h b/src/compositor/compositor_api/qwaylandview_p.h
index a4a75a6cb..1b5fc53e8 100644
--- a/src/compositor/compositor_api/qwaylandview_p.h
+++ b/src/compositor/compositor_api/qwaylandview_p.h
@@ -61,6 +61,7 @@ public:
, bufferLock(false)
, broadcastRequestedPositionChanged(false)
, forceAdvanceSucceed(false)
+ , discardFrontBuffers(false)
{ }
void markSurfaceAsDestroyed(QWaylandSurface *surface);
@@ -77,6 +78,7 @@ public:
bool bufferLock;
bool broadcastRequestedPositionChanged;
bool forceAdvanceSucceed;
+ bool discardFrontBuffers;
};
QT_END_NAMESPACE