summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDan Stoza <stoza@google.com>2015-06-05 16:00:13 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-06-05 16:00:13 +0000
commitd7214d62639f02db9a420eb3f97259a4c909da45 (patch)
tree12b7d5ef0ba1d0202021babccc0d9b3285eeb0de /include
parent37fea879609963703e75f46cb3267fa86d1f2bd2 (diff)
parent9d2c5a7c678bd384df0fb29952cf8943e7b1b160 (diff)
downloadframeworks_native-d7214d62639f02db9a420eb3f97259a4c909da45.zip
frameworks_native-d7214d62639f02db9a420eb3f97259a4c909da45.tar.gz
frameworks_native-d7214d62639f02db9a420eb3f97259a4c909da45.tar.bz2
am 9d2c5a7c: Merge "libgui: Add generation numbers to BufferQueue" into mnc-dev
* commit '9d2c5a7c678bd384df0fb29952cf8943e7b1b160': libgui: Add generation numbers to BufferQueue
Diffstat (limited to 'include')
-rw-r--r--include/gui/BufferQueueCore.h5
-rw-r--r--include/gui/BufferQueueProducer.h3
-rw-r--r--include/gui/IGraphicBufferConsumer.h3
-rw-r--r--include/gui/IGraphicBufferProducer.h14
-rw-r--r--include/gui/Surface.h9
-rw-r--r--include/ui/GraphicBuffer.h10
6 files changed, 41 insertions, 3 deletions
diff --git a/include/gui/BufferQueueCore.h b/include/gui/BufferQueueCore.h
index d7686ec..99134ea 100644
--- a/include/gui/BufferQueueCore.h
+++ b/include/gui/BufferQueueCore.h
@@ -275,6 +275,11 @@ private:
// buffer as the number of frames that have elapsed since it was last queued
uint64_t mBufferAge;
+ // mGenerationNumber stores the current generation number of the attached
+ // producer. Any attempt to attach a buffer with a different generation
+ // number will fail.
+ uint32_t mGenerationNumber;
+
}; // class BufferQueueCore
} // namespace android
diff --git a/include/gui/BufferQueueProducer.h b/include/gui/BufferQueueProducer.h
index ed660fb..afa7eb1 100644
--- a/include/gui/BufferQueueProducer.h
+++ b/include/gui/BufferQueueProducer.h
@@ -175,6 +175,9 @@ public:
// See IGraphicBufferProducer::allowAllocation
virtual status_t allowAllocation(bool allow);
+ // See IGraphicBufferProducer::setGenerationNumber
+ virtual status_t setGenerationNumber(uint32_t generationNumber);
+
private:
// This is required by the IBinder::DeathRecipient interface
virtual void binderDied(const wp<IBinder>& who);
diff --git a/include/gui/IGraphicBufferConsumer.h b/include/gui/IGraphicBufferConsumer.h
index 6363a3a..60ec9cc 100644
--- a/include/gui/IGraphicBufferConsumer.h
+++ b/include/gui/IGraphicBufferConsumer.h
@@ -110,7 +110,8 @@ public:
// will be deallocated as stale.
//
// Return of a value other than NO_ERROR means an error has occurred:
- // * BAD_VALUE - outSlot or buffer were NULL
+ // * BAD_VALUE - outSlot or buffer were NULL, or the generation number of
+ // the buffer did not match the buffer queue.
// * INVALID_OPERATION - cannot attach the buffer because it would cause too
// many buffers to be acquired.
// * NO_MEMORY - no free slots available
diff --git a/include/gui/IGraphicBufferProducer.h b/include/gui/IGraphicBufferProducer.h
index 5c50b2b..4ca4cd5 100644
--- a/include/gui/IGraphicBufferProducer.h
+++ b/include/gui/IGraphicBufferProducer.h
@@ -218,8 +218,9 @@ public:
//
// Return of a negative value means an error has occurred:
// * NO_INIT - the buffer queue has been abandoned.
- // * BAD_VALUE - outSlot or buffer were NULL or invalid combination of
- // async mode and buffer count override.
+ // * BAD_VALUE - outSlot or buffer were NULL, invalid combination of
+ // async mode and buffer count override, or the generation
+ // number of the buffer did not match the buffer queue.
// * INVALID_OPERATION - cannot attach the buffer because it would cause
// too many buffers to be dequeued, either because
// the producer already has a single buffer dequeued
@@ -470,6 +471,15 @@ public:
// eligible slot is available, dequeueBuffer will block or return an error
// as usual.
virtual status_t allowAllocation(bool allow) = 0;
+
+ // Sets the current generation number of the BufferQueue.
+ //
+ // This generation number will be inserted into any buffers allocated by the
+ // BufferQueue, and any attempts to attach a buffer with a different
+ // generation number will fail. Buffers already in the queue are not
+ // affected and will retain their current generation number. The generation
+ // number defaults to 0.
+ virtual status_t setGenerationNumber(uint32_t generationNumber) = 0;
};
// ----------------------------------------------------------------------------
diff --git a/include/gui/Surface.h b/include/gui/Surface.h
index fd6d48c..261b07c 100644
--- a/include/gui/Surface.h
+++ b/include/gui/Surface.h
@@ -101,6 +101,11 @@ public:
*/
void allocateBuffers();
+ /* Sets the generation number on the IGraphicBufferProducer and updates the
+ * generation number on any buffers attached to the Surface after this call.
+ * See IGBP::setGenerationNumber for more information. */
+ status_t setGenerationNumber(uint32_t generationNumber);
+
protected:
virtual ~Surface();
@@ -305,6 +310,10 @@ private:
// When a non-CPU producer is attached, this reflects the surface damage
// (the change since the previous frame) passed in by the producer.
Region mDirtyRegion;
+
+ // Stores the current generation number. See setGenerationNumber and
+ // IGraphicBufferProducer::setGenerationNumber for more information.
+ uint32_t mGenerationNumber;
};
}; // namespace android
diff --git a/include/ui/GraphicBuffer.h b/include/ui/GraphicBuffer.h
index f91d192..3da720f 100644
--- a/include/ui/GraphicBuffer.h
+++ b/include/ui/GraphicBuffer.h
@@ -94,6 +94,11 @@ public:
Rect getBounds() const { return Rect(width, height); }
uint64_t getId() const { return mId; }
+ uint32_t getGenerationNumber() const { return mGenerationNumber; }
+ void setGenerationNumber(uint32_t generation) {
+ mGenerationNumber = generation;
+ }
+
status_t reallocate(uint32_t inWidth, uint32_t inHeight,
PixelFormat inFormat, uint32_t inUsage);
@@ -166,6 +171,11 @@ private:
sp<ANativeWindowBuffer> mWrappedBuffer;
uint64_t mId;
+
+ // Stores the generation number of this buffer. If this number does not
+ // match the BufferQueue's internal generation number (set through
+ // IGBP::setGenerationNumber), attempts to attach the buffer will fail.
+ uint32_t mGenerationNumber;
};
}; // namespace android