History log of /frameworks/base/libs/surfaceflinger_client/SharedBufferStack.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
21956040a77808909ebda426fbd3cce6c8ed059f 19-Jan-2011 Mathias Agopian <mathias@google.com> fix [3361121] hang in glClear() - device unresponsive, OTA fails (DO NOT MERGE)

Generally we never want to lock a buffer for write access if it is at
the "head" on the surfaceflinger side. The only exception (1) is when
the buffer is not currently in use AND there is at least one queued
buffer -- in which case, SurfaceFlinger will never use said buffer
anymore, because on the next composition around, it will be able to
retire the first queued buffer.

The logic above relies on SurfaceFlinger always retiring
and locking a buffer before composition -- unfortunately this
didn't happen during a screenshot.

This could leave us in a situation where a buffer is locked by the
application for write, and used by SurfaceFlinger for texturing,
causing a hang.

Here, we fix this issue by never assuming the exception (1), it was
intended as an optimization allowing ANativeWindow::lockBuffer() to
return sooner and was justified when most of SF composition was
done in software. The actual buffer locking is now ensured by
gralloc. We could have handled screenshots in a similar way to
a regular composition, but it could have caused glitches on screen,
essentially, taking a screenshot could cause to skip a frame.

now that we removed the notion of a "inUse" buffer in surfaceflinger
a lot of code can be simplified / removed.

noteworthy, the whole concept of "unlockClient" wrt. "compositionComplete"
is also gone.
/frameworks/base/libs/surfaceflinger_client/SharedBufferStack.cpp
8ddd2c72ee7dd6f45e5375a197774b8671b982b7 02-Oct-2010 Mathias Agopian <mathias@google.com> fix [2835280] Add support for cancelling buffers to ANativeWindow

There is a new ANativeWindow::cancelBuffer() API that can be used to
cancel any dequeued buffer, BEFORE it's been enqueued. The buffer is
returned to the list of availlable buffers. dequeue and cancel are not
mutually thread safe, they must be called from the same thread or
external synchronization must be used.

Change-Id: I86cc7985bace8b6a93ad2c75d2bef5c3c2cb4d61
/frameworks/base/libs/surfaceflinger_client/SharedBufferStack.cpp
c9289fa1c4d3aeba5122863cdae7d0a9806d8833 27-Aug-2010 Mathias Agopian <mathias@google.com> fix a race in SF buffer management

also remove some unused code.

Change-Id: Iae2c3309b7a08055f3e13a5b866c5c084993e352
/frameworks/base/libs/surfaceflinger_client/SharedBufferStack.cpp
e96aa3e859cb747e241dfa2999fcd142a688ed57 20-Aug-2010 Mathias Agopian <mathias@google.com> fix [2931513] Add support for setting the orientation of an ANativeWindow

Also implement support for cropping.

Change-Id: Iba5888dd242bf2feaac9e9ce26e404c1f404c280
/frameworks/base/libs/surfaceflinger_client/SharedBufferStack.cpp
51c70e3e41ee8bedc1d951a06a74202dafa13009 28-Jul-2010 Mathias Agopian <mathias@google.com> fix [2873058] Surface::dequeueBuffer blocks on last buffer, i.e. cannot dequeue all allocated buffers at once.

this situation happened when the last buffer needed to be resized
(or allocated, the first time). the assumption was that the buffer
was in use by SF itself as the current buffer (obviously, this
assumption made no sense when the buffer had never been allocated, btw).

the system would wait until some other buffer became the "front" buffer.

we fix this problem by entirely removing the requirement that the
buffer being resized cannot be the front buffer. instead, we just
allocate a new buffer and replace the front buffer by the new one.

the downside is that this uses more memory (an extra buffer) for a
brief amount of time while the old buffer is being reallocated and
before it has actually been replaced.

Change-Id: I022e4621209474ceb1c671b23deb4188eaaa7285
/frameworks/base/libs/surfaceflinger_client/SharedBufferStack.cpp
5e14010b1fc066dfcbc0a577d59492687c99667d 09-Jun-2010 Mathias Agopian <mathias@google.com> allow re-targetting of surfaces

Surfaces can now be parcelized and sent to remote
processes. When a surface crosses a process
boundary, it looses its connection with the
current process and gets attached to the new one.

Change-Id: I39c7b055bcd3ea1162ef2718d3d4b866bf7c81c0
/frameworks/base/libs/surfaceflinger_client/SharedBufferStack.cpp
7623da435e45c7c03ef6a00a43675deb6645f070 02-Jun-2010 Mathias Agopian <mathias@google.com> split surface management from surface's buffers management

Change-Id: If3c5655d1231f8f0c49ba68f972b1b20c93b3f87
/frameworks/base/libs/surfaceflinger_client/SharedBufferStack.cpp
770492cb2b19f6a36ad748cd05fbedfbb9a67dfa 28-May-2010 Mathias Agopian <mathias@google.com> more clean-up in preparation of bigger changes

the most important change here is the renaming of
ISurfaceFlingerClient to ISurfaceComposerClient

Change-Id: I94e18b0417f50e06f21377446639c61f65f959b3
/frameworks/base/libs/surfaceflinger_client/SharedBufferStack.cpp
2ce19af45bf4c5e311a73df474ffe88d96d118c5 26-May-2010 Mathias Agopian <mathias@google.com> fix [2712278] The preview buffer left some black borders in left and bottom edges

we were incorrectly flagging push_buffer surfaces as invalid

Change-Id: I4dfd4ffbbe8a71f7e23e835db8d71966416c29bb
/frameworks/base/libs/surfaceflinger_client/SharedBufferStack.cpp
2be352adab7f11646fda7c0240e496bbb37f7bd1 22-May-2010 Mathias Agopian <mathias@google.com> added the notion of fixed-size buffers

the new native_window_set_buffers_geometry allows
to specify a size and format for all buffers to be
dequeued. the buffer will be scalled to the window's
size.

Change-Id: I2c378b85c88d29cdd827a5f319d5c704d79ba381
/frameworks/base/libs/surfaceflinger_client/SharedBufferStack.cpp
57d89899c9fb978a1c097f298aa94c5db1f61bb6 21-May-2010 Mathias Agopian <mathias@google.com> fix a bug when reallocating a window's buffers is needed

we need to mark the buffers that need to be reallocated,
NOT the buffer's indices.

Change-Id: I809e2e1b03b56c4d2ab983c25523dae99aa1da74
/frameworks/base/libs/surfaceflinger_client/SharedBufferStack.cpp
25f0bdaea6d1a34aae3faf6688cad4fbebcca969 21-May-2010 Mathias Agopian <mathias@google.com> added native_window_set_buffer_count()

this method can be used to change the number of buffers
associated to a native window. the default is two.

Change-Id: I608b959e6b29d77f95edb23c31dc9b099a758f2f
/frameworks/base/libs/surfaceflinger_client/SharedBufferStack.cpp
898c4c91be8e11b6d5388c623ae80f12ac25fd27 19-May-2010 Mathias Agopian <mathias@google.com> fix the threading issue for setBuffercount()

this change introduces R/W locks in the right places.
on the server-side, it guarantees that setBufferCount()
is synchronized with "retire" and "resize".
on the client-side, it guarantees that setBufferCount()
is synchronized with "dequeue", "lockbuffer" and "queue"
/frameworks/base/libs/surfaceflinger_client/SharedBufferStack.cpp
be6c8fc4d5f8144cbfc715da0d2ef3c704db279d 18-May-2010 Mathias Agopian <mathias@google.com> fix a bug where queueBuffer() would fail after the SharedbufferStack is resized

Change-Id: I12bf13a62018ce1349bab7be0b0cad7fad13fee8
/frameworks/base/libs/surfaceflinger_client/SharedBufferStack.cpp
cd30f4f849bb215509bd2645726048271b5db01e 18-May-2010 Mathias Agopian <mathias@google.com> fix some bugs in SharedBufferStack::resize

added buffers should now be labeled properly.

Change-Id: I28aa753fbe89ab89134e7753575319478934c7fa
/frameworks/base/libs/surfaceflinger_client/SharedBufferStack.cpp
59751dbf7d8f12aeb5c4c07719b7dbbf1f9b5d4b 08-May-2010 Mathias Agopian <mathias@google.com> SharedBufferStack now can grow up to 16 buffers.

there is a new resize() api, which currently only allows growing.

Change-Id: Ia37b81b73be466d2491ffed7f3a23cd8e113c6fe
/frameworks/base/libs/surfaceflinger_client/SharedBufferStack.cpp
9f2c4fd9a14ea79e4cbbd3ab8925794711a6411c 11-May-2010 Mathias Agopian <mathias@google.com> Refactor some code in surfaceflinger in preparation of upcoming changes

the new TextureMagager class now handle texture creation and upload
as well as EGL image creation and binding to GraphicBuffers. This is
used indirectly by Layer and directly by LayerBuffer

the new BufferManager class handles the set of buffers used for a
Layer (Surface), it abstracts how many buffer there is as well as
the use of EGLimage vs. regular texture ops (glTexImage2D).

Change-Id: I2da1ddcf27758e6731400f6cc4e20bef35c0a39a
/frameworks/base/libs/surfaceflinger_client/SharedBufferStack.cpp
3b91e13ec7cdf7d607a221feda2eb0afc1e02050 30-Apr-2010 Mathias Agopian <mathias@google.com> make sure the server-side validates pointers/indices visible on the client side

Change-Id: I604f58d3fcd2d09ec7998123c627401081345cd6
/frameworks/base/libs/surfaceflinger_client/SharedBufferStack.cpp
bfe7f0b12165a1ad4a73b6d8f013cb9e115a3c60 28-Apr-2010 Mathias Agopian <mathias@google.com> Add support for enqueuing buffers in arbitrary order

Also added a very simple SharedBufferStack unit test.

Change-Id: I253dbbe98a53c966b78d22d4d6dd59f8aefc8c40
/frameworks/base/libs/surfaceflinger_client/SharedBufferStack.cpp
f590f702c8142fa5225a6d2ea6649515c1a2961f 28-Apr-2010 Mathias Agopian <mathias@google.com> cleanup. waitForCondition() now uses polymorphsim instead of templtes

the reason for the above change is that waitForCondition() had become
large over time, mainly to handle error cases, using inlines to
evaluate the condition doesn't buys us much anymore while it increases
code size.

Change-Id: I2595d850832628954b900ab8bb1796c863447bc7
/frameworks/base/libs/surfaceflinger_client/SharedBufferStack.cpp
c54c12713b98f308f848d2eb9ed7ef28ecc62c55 28-Apr-2010 Mathias Agopian <mathias@google.com> fix a race condition in undoDequeue(), where 'tail' could be computed incorrectly.

in the undoDequeue() case, 'tail' was recalculated from 'available' and 'head'
however there was a race between this and retireAndLock(), which could cause
'tail' to be recalculated wrongly.

the interesting thing though is that retireAndLock() shouldn't have any impact
on the value of 'tail', which is client-side only attribute.
we fix the race by saving the value of 'tail' before dequeue() and restore it
in the case of undoDequeue(), since we know it doesn't depend on retireAndLock().

Change-Id: I4bcc4d16b6bc4dd93717ee739c603040b18295a0
/frameworks/base/libs/surfaceflinger_client/SharedBufferStack.cpp
a8a0aa8b922c45fb4633f51610f264a19f9bd825 22-Apr-2010 Mathias Agopian <mathias@google.com> better fix for [2420565] Surface.lockCanvas() updates the dirty region too often

Change-Id: I83438b40effd21538f1c74396dc665254b9d5ab6
/frameworks/base/libs/surfaceflinger_client/SharedBufferStack.cpp
16a86ee30b70aea8c254b836c708f54a608d25f3 16-Apr-2010 Mathias Agopian <mathias@google.com> added setCrop() to android_native_window_t

hooked up the new method up to Surface.cpp
the actual crop is not implemented in SF yet

Change-Id: Ic6e313c98fd880f127a051a0ccc71808bd689751
/frameworks/base/libs/surfaceflinger_client/SharedBufferStack.cpp
6bb5ebaa0305a30b5037f6533b3b989e0437d26c 06-Apr-2010 Mathias Agopian <pixelflinger@google.com> add support for up to 16 buffers per surface

also increase the dirtyregion size from 1 to 6 rectangles.
Overall we now need 27KiB process instead of 4KiB

Change-Id: Iebda5565015158f49d9ca8dbcf55e6ad04855be3
/frameworks/base/libs/surfaceflinger_client/SharedBufferStack.cpp
a729f97e8bfba67a94b1cde26d0d78d84528de85 20-Mar-2010 Mathias Agopian <mathias@google.com> libutils Condition are now PRIVATE by default

Condition must be initialized with SHARED for the old behavior, where
they can be used accross processes.

Updated the two places android that require SHARED conditions.

PRIVATE conditions (and mutexes) use more efficient syscalls.

Change-Id: I9a281a4b88206e92ac559c66554e886b9c62db3a
/frameworks/base/libs/surfaceflinger_client/SharedBufferStack.cpp
4119c543024b4ae647b22a2da1422f8848a6ef7a 09-Mar-2010 Mathias Agopian <mathias@google.com> Fix a small bug where we could compute SharedBufferStack's tail incorrectly.

Also add "tail" to the debug dump().

Change-Id: I04b1ea375dfc9ddcc22f0c6b6cd01300e507572e
/frameworks/base/libs/surfaceflinger_client/SharedBufferStack.cpp
000479f9e325b4e426a67033abd92d47da412725 10-Feb-2010 Mathias Agopian <mathias@google.com> split libsurfaceflinger_client and libcamera_client out of libui
/frameworks/base/libs/surfaceflinger_client/SharedBufferStack.cpp