summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2012-05-24 15:47:52 +0200
committerQt by Nokia <qt-info@nokia.com>2012-05-30 01:54:45 +0200
commit770e0bb75653b93e9bf7525f5b9062dd3cff8fb5 (patch)
tree6e089444793b30f5524df5a1aa8bfa26c9bd1cac /src
parent7cdcc267220db301080e7ade8e2f21e530e77b82 (diff)
Add some batching functions to QPlatformSharedGraphicsCache iface
This adds some pure virtual functions to the interface to enable batching requests. The interface functions no longer need to be invokable, as invokeMethod() is too slow to be used at the required frequency anyway. Change-Id: I89b607de1a28f3f4b728c334c04bcd443d4366b4 Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/gui/kernel/qplatformsharedgraphicscache.h13
-rw-r--r--src/gui/kernel/qplatformsharedgraphicscache_qpa.cpp84
2 files changed, 92 insertions, 5 deletions
diff --git a/src/gui/kernel/qplatformsharedgraphicscache.h b/src/gui/kernel/qplatformsharedgraphicscache.h
index 83752fbcb7..1960aa4590 100644
--- a/src/gui/kernel/qplatformsharedgraphicscache.h
+++ b/src/gui/kernel/qplatformsharedgraphicscache.h
@@ -76,14 +76,17 @@ public:
explicit QPlatformSharedGraphicsCache(QObject *parent = 0) : QObject(parent) {}
- Q_INVOKABLE virtual void ensureCacheInitialized(const QByteArray &cacheId, BufferType bufferType,
+ virtual void beginRequestBatch() = 0;
+ virtual void ensureCacheInitialized(const QByteArray &cacheId, BufferType bufferType,
PixelFormat pixelFormat) = 0;
-
- Q_INVOKABLE virtual void requestItems(const QByteArray &cacheId, const QVector<quint32> &itemIds) = 0;
- Q_INVOKABLE virtual void insertItems(const QByteArray &cacheId,
+ virtual void requestItems(const QByteArray &cacheId, const QVector<quint32> &itemIds) = 0;
+ virtual void insertItems(const QByteArray &cacheId,
const QVector<quint32> &itemIds,
const QVector<QImage> &items) = 0;
- Q_INVOKABLE virtual void releaseItems(const QByteArray &cacheId, const QVector<quint32> &itemIds) = 0;
+ virtual void releaseItems(const QByteArray &cacheId, const QVector<quint32> &itemIds) = 0;
+ virtual void endRequestBatch() = 0;
+
+ virtual bool requestBatchStarted() const = 0;
virtual uint textureIdForBuffer(void *bufferId) = 0;
virtual void referenceBuffer(void *bufferId) = 0;
diff --git a/src/gui/kernel/qplatformsharedgraphicscache_qpa.cpp b/src/gui/kernel/qplatformsharedgraphicscache_qpa.cpp
index a3bb8da358..e38ece3cba 100644
--- a/src/gui/kernel/qplatformsharedgraphicscache_qpa.cpp
+++ b/src/gui/kernel/qplatformsharedgraphicscache_qpa.cpp
@@ -66,6 +66,10 @@ QT_BEGIN_NAMESPACE
entered into the shared cache. As the items are rendered into the cache, itemsAvailable() signals
will be emitted for each of the items which have previously been requested and which have not
yet been reported as ready.
+
+ Using beginRequestBatch() and endRequestBatch(), it's possible to batch glyph requests, which
+ could improve performance in cases where you have a sequence of requests pending, and you
+ do not need the results during this sequence.
*/
/*!
@@ -209,4 +213,84 @@ QT_BEGIN_NAMESPACE
any itemsInvalidated() signal for these items.
*/
+/*!
+ \fn void beginRequestBatch()
+
+ This is a hint to the cache that a burst of requests is pending. In some implementations, this
+ will improve performance, as the cache can focus on handling the requests and wait with the
+ results until it is done. It should typically be called prior to a sequence of calls to
+ requestItems() and releaseItems().
+
+ Any call to beginRequestBatch() must be followed at some point by a call to endRequestBatch().
+ Failing to do this may lead to the results of requests never being emitted.
+
+ \note beginRequestBatch() and endRequestBatch() have no stacking logic. Calling
+ beginRequestBatch() twice in a row has no effect, and the single existing batch will be ended
+ by the earliest call to endRequestBatch().
+
+ \sa endRequestBatch(), requestBatchStarted()
+*/
+
+/*!
+ \fn void endRequestBatch()
+
+ Signals to the cache that the request sequence which has previously been commenced using
+ beginRequestBatch() has now finished.
+
+ \sa beginRequestBatch(), requestBatchStarted()
+*/
+
+/*!
+ \fn bool requestBatchStarted() const
+
+ Returns true if a request batch has previously been started using beginRequestBatch()
+ and not yet stopped using endRequestBatch().
+
+ \sa beginRequestBatch(), endRequestBatch()
+*/
+
+/*!
+ \fn uint textureIdForBuffer(void *bufferId)
+
+ Returns an OpenGL texture ID corresponding to the buffer \a bufferId, which has previously
+ been passed through signals itemsAvailable() or itemsUpdated(). The relevant OpenGL context
+ should be current when calling this function.
+
+ \sa eglImageForBuffer(), sizeOfBuffer()
+*/
+
+/*!
+ \fn void *eglImageForBuffer(void *bufferId)
+
+ Returns an EGLImageKHR image corresponding to the buffer \a bufferId.
+
+ \sa textureIdForBuffer(), sizeOfBuffer()
+*/
+
+/*!
+ \fn void referenceBuffer(void *bufferId)
+
+ Registers a reference to the buffer \a bufferId.
+
+ \sa dereferenceBuffer()
+*/
+
+/*!
+ \fn bool dereferenceBuffer(void *bufferId)
+
+ Removed a previously registered reference to the buffer \a bufferId. Returns true if there
+ are still more references to the buffer in question, or false if this was the last reference
+ (in which case the buffer may have been deleted in the cache.)
+
+ \sa dereferenceBuffer()
+*/
+
+/*!
+ \fn QSize sizeOfBuffer(void *bufferId)
+
+ Returns the size of the buffer \a bufferId.
+
+ \sa textureIdForBuffer(), eglImageForBuffer()
+*/
+
QT_END_NAMESPACE