This changes the way that SurfaceFlinger's shadow buffer management
works such that instead of tracking the size of the shadow queue in the
BufferQueue, SF tracks the last frame number it has seen, and passes
that into the acquireBuffer call. BufferQueueConsumer then ensures that
it never returns a buffer newer than that frame number, even if that
means that it must return PRESENT_LATER for an otherwise valid buffer.
Change-Id: I3fcb45f683ed660c3f18a8b85ae1f8a962ba6f0e
(cherry picked from commit a4650a50a0)
This change places BufferQueue into a predictable state where
allocation is allowed whenever a producer connects. This allows clients
to disconnect and reconnect without having to worry about being locked
out of allocation.
Bug: 20554276
Change-Id: Ic0f920a3d4204f2cafdfa69e46f3bb4204571d7e
(cherry picked from commit 2b83cc920a)
This completes the plumbing from ConsumerListener::onFrameReplaced into
SurfaceFlinger (and other consumers that may care).
Change-Id: I376e78ace95d6748e8662e6b4d47c0dfa697a300
(cherry picked from commit dc13c5b85b)
Clears the frame number of a slot when it is freed, since it is used
to determine if a released buffer is stale.
Bug: 20445852
Change-Id: I02415e7b25a1eafe7414d6eb1cedf62ac5543cd9
(cherry picked from commit 52937cd9a5)
SurfaceFlinger's (Layer's) shadow copy of the BufferQueue queue was
getting out of sync for a few reasons. This change fixes these by
doing the following:
- Adds a check to re-synchronize the shadow copy every time we
successfully acquire a buffer by first dropping stale buffers before
removing the current buffer.
- Avoids trying to perform updates for buffers which have been rejected
(for incorrect dimensions) by SurfaceFlinger.
- Adds IGraphicBufferConsumer::setShadowQueueSize, which allows the
consumer to notify the BufferQueue that it is maintaining a shadow
copy of the queue and prevents it from dropping so many buffers
during acquireBuffer that it ends up returning a buffer for which the
consumer has not yet received an onFrameAvailable call.
Bug: 20096136
Change-Id: I78d0738428005fc19b3be85cc8f1db498043612f
Surface::{cancel,queue}Buffer and GraphicBufferMapper::lockAsyncYCbCr take the
ownership of |fenceFd|s. Though they don't close it on error cases.
Change-Id: I49a7ce8837d5c510c4ac4ad4649f310d18610e80
Adds a NATIVE_WINDOW_BUFFER_AGE query, which returns the age of the
contents of the most recently dequeued buffer as the number of frames
that have elapsed since it was last queued.
Change-Id: Ib6fd62945cb62d1e60133a65beee510363218a23
Changes Surface::detachNextBuffer to return an sp<GraphicBuffer>
instead of an ANativeWindowBuffer* to ensure that reference counting
works correctly.
Bug: 20092217
Change-Id: I3979ea6121aaf14845f0554477b778770413581e
Adds a new method IGBP::allowAllocation, which controls whether
dequeueBuffer is permitted to allocate a new buffer. If allocation is
disallowed, dequeueBuffer will block or return an error as it
normally would (as controlled by *ControlledByApp).
If there are free buffers, but they are not of the correct dimensions,
format, or usage, they may be freed if a more suitable buffer is not
found first.
Bug: 19801715
Change-Id: I0d604958b78b2fd775c2547690301423f9a52165
BufferQueue used to choose free buffers by scanning through its array
of slots and picking one based on timestamp. This changes that
mechanism to use a pair of free lists: one with buffers attached and
one without. This makes it easier to choose either type of free slot
depending on the needs of the current operation.
Fixes an issue with the first version of this change, found in bugs
20482952, 20443314, and 20464549.
Bug: 13175420
Change-Id: I9b6e83cfe8f9b4329a976025cb8e291d51fb6d4a
When the surface damage code went in, it incorrectly assumed that if
an application was doing CPU rendering, it would be using lock and
unlockAndPost instead of dequeue and queue, so it repurposed the dirty
region too aggressively. This change keeps it from clobbering the
dirty region if a CPU producer is attached.
Bug: 20431815
Change-Id: Id4dfd71378311ea822f0289f6de2d20a7bd84014
These tests hadn't been run in a while and had accumulated some rot.
This fixes most of the compile warnings and some tests which fail
incorrectly, but 2 failures remain on N6.
Change-Id: I7fee78cd058a32f4d7df40ec9f899ff767f68517
BufferItem and GraphicBuffer were not parceling correctly, which had
not been noticed because the libgui tests (specifically, one that
tests placing a BufferQueue in a separate process from the IGBP/C)
had not been run recently. This change fixes the errors found in
those classes.
Change-Id: Ie224361a534a79115a3481d83ff97f21d154d4f5
BufferQueue used to choose free buffers by scanning through its array
of slots and picking one based on timestamp. This changes that
mechanism to use a pair of free lists: one with buffers attached and
one without. This makes it easier to choose either type of free slot
depending on the needs of the current operation.
Bug: 13175420
Change-Id: Ic8398e7511bd11a60a1c82e3ad2ee271c9822be1
This change adds support for passing surface damage all of the way
down from the EGL interface through the consumer side of the
BufferQueue. Depends on system/core change
Ie645e6a52b37b5c1b3be19481e8348570d1aa62c
Bug: 11239309
Change-Id: I4457ea826e9ade4ec187f973851d855b7b93a31b
Fence was flattening incorrectly, causing issues with any fields
flattened after it, and Region was relying on being the last object
flattened. This change addresses both.
Change-Id: If49de061de6e2f11f4d846b4d8c18627dfb7e109
There is memory corruption in below code
const Rect* prev = &dst[prevIndex];
dst.add(Rect(prev->right, top, right, bottom));
prev points to a memory of vector dst, when dst resize in add()
call, the memory that prev points to will be copy to the new
allocated vector memory and the old memory will become undefined
Avoid pointer in this case, use a local copy instead
Change-Id: I4d95ceedd00c8fb615ac153082ade1b1ce0d0fa8
Exposes IGraphicBufferConsumer::detachBuffer as a ConsumerBase
method. attachBuffer is not currently exposed, because all current
clients will be recycling buffers through the allocator.
Bug: 19628705
Change-Id: I3e519767fa43d5d880c1d5695e31b60f6ad588af
Exposes the attachBuffer and detachNextBuffer calls from
IGraphicBufferProducer to the public Surface interface. Also moves
the version of connect that takes a producer callback from protected
to public.
Bug: 19628705
Change-Id: I9ebc3013c4d9c84c4e8ef150c00e03f8af80319e
(cherry picked from commit c14ecb9de2)
Removes IGraphicBufferConsumer::BufferItem. Depends on the
following changes:
I187b3a7d05196b6289596afac8fb9a9d4aebff76
I0ddd38df37500cfd6b21d1e768ed14e39c5cd9fc
Cherry-pick of Id1fa56d092188f2cb712768d5d2fc6a9027fb73c
Change-Id: I3edf0db8fba656fd78e18a5a7f1137f0fb6b237d
Currently, there are two instances of BufferItem: one inside of
IGraphicBufferConsumer, and a standalone one inside of libgui. They
only differ in the name of one of the fields, and we want to remove
the IGBC version. This changes things so that client code may be
incrementally switched over to the libgui version.
This is a squashed commit containing the following changes:
I64f495105f56cbf5803cea4aa6b072ea29b70cf5
I1394e693314429ada93427889f10b7b01c948053
I9c3bc8037fa9438d4d9080b8afb694219ef2f71f
I699ed0a6837076867ca756b28d1ffb2238f7a0d9
Iac8425e1241774304a131da2fb9dec6e82922f13
Change-Id: Ic4d51f5df6dbc70b376d13fceba2335b9bae4f3d
- Wire up new dataSpace parameter through buffer queue stack
- Update tests to include the parameter
- Switch eglApi to using dataSpace to indicate sRGB gamma/linear
difference
- Remove RAW_SENSOR in favor of RAW16
- Remove use of sRGB format enums
- Add default dataspace to buffer queue core
- Add query for default dataspace
Cherry pick of I070bd2e7c56506055c419004c29e2e3feac725df
Change-Id: I461952389c18051176c6b75e664f20ad369f5760
An #ifdef was causing multiple returns in this function, which was
triggering an unreachable code error on some build targets. This
adds an #else to ensure that only one return is exposed in any given
build.
Cherry pick of I9ed7c3e769bc9094ad31d810944227d1d8302886
Change-Id: Ibddc5706159d168031d1805fcce3eedc068296cf
This change allows clients of Surface to provide an IProducerListener
callback object to Surface::connect, which will be passed down to the
underlying IGraphicBufferProducer.
Cherry pick of I5ea5229bf3a329bf02c6bd20e7247039c75d136b
Change-Id: I6f8f52c72654e4cee649721383819bafe378f964
Since some variables had been switched from signed to unsigned, there
was a section of code that was guaranteed to be incorrect because it
effectively did 'if (a < b) { c = a - b; }'. This change fixes it.
Cherry pick of I9cdd6c9a0179801addebb5d6dc1fbaddf8f53c62
Bug: 19346631
Change-Id: Id13a46f74c9ae7278463ce22b586f4dc21b5e453
There shouldn't be more than 4096 fds (probably signficantly smaller) and
there shouldn't be more than 4096 ints.
Cherry pick of I3a3e50ee3078a4710e9737114e65afc923ed0573
Bug: 18076253
Change-Id: I82a883572b401f115d252dcd3d00aa7252b49b0e
Enables -Weverything and -Werror, with just a few exceptions for
warnings we can't (or shouldn't need to) work around.
Cherry pick of I034abec27bf4020d84af60d7acc1939c59986dd6 plus a
couple of minor changes to CpuConsumer.cpp to make it work with a
prior change:
Uncomment CC_LOGV on line 46
Change C-style cast to static_cast on line 71
Change-Id: Iaec610477ea0122317b0578fb74caf2383d4cf08