summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@theqtcompany.com>2015-09-03 13:55:33 +0200
committerJørgen Lind <jorgen.lind@theqtcompany.com>2015-09-04 16:12:47 +0200
commit82d713d89638ebd49ed87bf5f66362a93607efd8 (patch)
tree226289c668a423d77e94daf886830a9faea05d20 /src
parent7e9b31ecda04aa3ad5eea737c19cf2f204d208da (diff)
Make it possible to discard currentBuffer of a view
This will be convenient if there is a view which copies the currentBuffer to a cache and then wants to release the ref to the buffer Change-Id: I0b7bbb4bc22c420fdf0d1af4bb1bbf0a4f888bc8
Diffstat (limited to 'src')
-rw-r--r--src/compositor/compositor_api/qwaylandview.cpp11
-rw-r--r--src/compositor/compositor_api/qwaylandview.h1
-rw-r--r--src/compositor/compositor_api/qwaylandview_p.h2
3 files changed, 13 insertions, 1 deletions
diff --git a/src/compositor/compositor_api/qwaylandview.cpp b/src/compositor/compositor_api/qwaylandview.cpp
index 90f182c5d..fa1371925 100644
--- a/src/compositor/compositor_api/qwaylandview.cpp
+++ b/src/compositor/compositor_api/qwaylandview.cpp
@@ -200,18 +200,27 @@ void QWaylandView::attach(const QWaylandBufferRef &ref, const QRegion &damage)
bool QWaylandView::advance()
{
Q_D(QWaylandView);
- if (d->currentBuffer == d->nextBuffer)
+ if (d->currentBuffer == d->nextBuffer && !d->forceAdvanceSucceed)
return false;
if (d->bufferLock)
return false;
QMutexLocker locker(&d->bufferMutex);
+ d->forceAdvanceSucceed = false;
d->currentBuffer = d->nextBuffer;
d->currentDamage = d->nextDamage;
return true;
}
+void QWaylandView::discardCurrentBuffer()
+{
+ Q_D(QWaylandView);
+ QMutexLocker locker(&d->bufferMutex);
+ d->currentBuffer = QWaylandBufferRef();
+ d->forceAdvanceSucceed = true;
+}
+
QWaylandBufferRef QWaylandView::currentBuffer()
{
Q_D(QWaylandView);
diff --git a/src/compositor/compositor_api/qwaylandview.h b/src/compositor/compositor_api/qwaylandview.h
index eddcdea49..bc7eea764 100644
--- a/src/compositor/compositor_api/qwaylandview.h
+++ b/src/compositor/compositor_api/qwaylandview.h
@@ -81,6 +81,7 @@ public:
virtual void attach(const QWaylandBufferRef &ref, const QRegion &damage);
virtual bool advance();
+ virtual void discardCurrentBuffer();
virtual QWaylandBufferRef currentBuffer();
virtual QRegion currentDamage();
diff --git a/src/compositor/compositor_api/qwaylandview_p.h b/src/compositor/compositor_api/qwaylandview_p.h
index c37cd6b71..b31c37112 100644
--- a/src/compositor/compositor_api/qwaylandview_p.h
+++ b/src/compositor/compositor_api/qwaylandview_p.h
@@ -60,6 +60,7 @@ public:
, output(Q_NULLPTR)
, bufferLock(false)
, broadcastRequestedPositionChanged(false)
+ , forceAdvanceSucceed(false)
{ }
void markSurfaceAsDestroyed(QWaylandSurface *surface);
@@ -75,6 +76,7 @@ public:
QRegion nextDamage;
bool bufferLock;
bool broadcastRequestedPositionChanged;
+ bool forceAdvanceSucceed;
};
QT_END_NAMESPACE