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>
This commit is contained in:
parent
7cdcc26722
commit
770e0bb756
@ -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;
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user