• Home
  • History
  • Annotate
  • only in /frameworks/av/include/private/
History log of /frameworks/av/include/private/
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
cb2129b3b568a4e31bcbda3545a468024bc972fe 11-Nov-2014 Andy Hung <hunga@google.com> Fix missing loop count for static tracks.

StaticAudioTrackServerProxy::framesReady() previously returned
only the contiguous frames, update to return the total
available frames. This resolves short-count looping in
SoundPool for FastTracks.

Also (1) Removes the racy condition of reading two variables
and (2) Fixes buffer->mNonContig to return the correct value
and (3) Restores behavior that loop count of 1 goes back to
loopStart once during playback.

Bug: 11830751
Bug: 12070295
Bug: 17456842
Change-Id: I64906e6036bb00a1d7375b03efe6deb69d6478ca
edia/AudioTrackShared.h
04906863a1fa7f296ac11f07e62aa688da39c3ad 09-Oct-2014 Marco Nelissen <marcone@google.com> Fix VideoFrame class layout for 64/32 bit

This structure is passed between 64 and 32 bit processes via shared
memory, so ensure it's the same size, and that the members we care
about are in the same place.

Bug: 17569156
Change-Id: Id776bc825af1fbf43a6dd3407cca064f6d932902
edia/VideoFrame.h
83b8808faad1e91690c64d7007348be8d9ebde73 21-Jun-2014 Eric Laurent <elaurent@google.com> audio flinger: add patch connection between hw modules

Add support for audio device connections between different audio
hw modules.
The patch is performed by creating a bridge between the playback
thread connected to the sink device and the record thread connected
to the source device using a pair of specialized PlaybackTrack and
RecordTrack.
- Added PatchTrack and PatchRecord classes.
- Added TrackBase type to indicate more clearly the track behavior.
- A TrackBase can allocate the buffer or reuse an existing one.
- Factored some code in openOutput() and openInput() for internal use
by PatchPanel.

Bug: 14815883.

Change-Id: Ib9515fcda864610458a4bc81fa8f59096ff4d7db
edia/AudioTrackShared.h
7903bb2b3065d58cc75637900922b434f50024d9 12-Jun-2014 Elliott Hughes <enh@google.com> am 2a8270e6: am c323737d: Merge "Offer a type-safe album art interface."

* commit '2a8270e6944fb3addfcba87f6885aaad196b8b88':
Offer a type-safe album art interface.
f3e80dddd7376aa9deeb27de25e1d50030a2ad98 11-Jun-2014 Elliott Hughes <enh@google.com> Offer a type-safe album art interface.

Bug: 15514223
Change-Id: Iddfc33a00e6cd3779ca09c01a55f62b151f6ec95
edia/VideoFrame.h
c56f3426099a3cf2d07ccff8886050c7fbce140f 22-Mar-2014 Glenn Kasten <gkasten@google.com> Pass stereo gains as packed minifloat

This will allow (eventually) a greater dynamic range for gains.
However there are still a few remaining places in effects and mixer
that will also need to be changed in order to get the full benefit.

Also fixes a minor bug: was not checking for NaN in AudioTrack C++.

Change-Id: I63bce9e82e0a61546d8ff475fb94bcb700d99c96
edia/AudioTrackShared.h
751a9c8cbc391a91604dd1052fb95d3e4d278c2f 28-Jan-2014 Glenn Kasten <gkasten@google.com> Replace size_t in shared memory by uint32_t

Eventually we may want to use uint64_t, but will need to confirm atomicity.

Bug: 12381724
Change-Id: Ia2c591d262d22b47b6f7dab4b9d9faa14b86d865
edia/AudioTrackShared.h
edia/StaticAudioTrackState.h
fdac7c00f9201bb3a9862069145f01d37e39755b 28-Jan-2014 Glenn Kasten <gkasten@google.com> Replace size_t in shared memory by uint32_t

Eventually we may want to use uint64_t, but will need to confirm atomicity.

Bug: 12381724
Change-Id: Ia2c591d262d22b47b6f7dab4b9d9faa14b86d865
edia/AudioTrackShared.h
edia/StaticAudioTrackState.h
74935e44734c1ec235c2b6677db3e0dbefa5ddb8 19-Dec-2013 Glenn Kasten <gkasten@google.com> Replace control block frameCount_ by explicit in/out parameter

in IAudioFlinger::createTrack and IAudioFlinger::openRecord

Change-Id: I09c644c80e92c8e744b1b99055988a2588b2a83d
edia/AudioTrackShared.h
a153b68f2260a8ed7fbb236fa659b13264ac5ac0 19-Oct-2013 Glenn Kasten <gkasten@google.com> am 77177fa2: am 95c03858: Merge "Allow releaseBuffer after flush" into klp-dev

* commit '77177fa20773d02b4f9c4147ecb98107f019fa7d':
Allow releaseBuffer after flush
2e422c472c91aa7912befd0fc038d1e11f354bc1 18-Oct-2013 Glenn Kasten <gkasten@google.com> Allow releaseBuffer after flush

After AudioTrack start checks for pending flush,
allow releaseBuffer on any previously obtained buffer.
For example, this can happen if the resampler has obtained
a buffer but not released the whole buffer yet.
Note that the resampler will be reading obsolete data.

Bug: 11285590
Change-Id: I0614fbb62e43604aac3089cce4b7797c87a306b5
edia/AudioTrackShared.h
771f1b6d196b7924707fc44177ac3a88fc31fa9e 17-Oct-2013 Eric Laurent <elaurent@google.com> am 7f8c3973: am 120a8847: Merge "AudioTrack: fix head position after restore" into klp-dev

* commit '7f8c397378a7ee5abd395413be71388ad36d3ed2':
AudioTrack: fix head position after restore
cc21e4f1e41dfa17e7e2bef995fcd22c45f6bcd0 17-Oct-2013 Eric Laurent <elaurent@google.com> AudioTrack: fix head position after restore

The head position transfered to the new track
by restoreTrack_l() must take into account the frames that
are dropped from the old track to avoid a non recoverable
offset in the playback head position returned to applications.

Bug: 11230062.
Change-Id: I51143a08b95e8f264ed709ae2054360315f2b8b1
edia/AudioTrackShared.h
16f3201d2fe99a39a8a9bb478528ae9003645dfe 18-Sep-2013 Glenn Kasten <gkasten@google.com> am 11454092: am 18f86140: Merge "Fix underruns when fast track denied due to SRC" into klp-dev

* commit '11454092e4a94d3c8b4576c981595339abdfac0d':
Fix underruns when fast track denied due to SRC
ce8828a016b082f730152af2204b8ea3610dc1ec 17-Sep-2013 Glenn Kasten <gkasten@google.com> Fix underruns when fast track denied due to SRC

OpenSL ES requests a fast track. If sample rate conversion is needed,
the request is denied by server, and a larger client buffer is used
to handle the higher latency of a normal track. However the client
notification period was calculated based on buffer being divided into
2 sub-buffers. That resulted in the notification period being too long.
The server pulls chunks that are smaller than half the total buffer.
So now the client uses 3 sub-buffers when there is SRC.

Also removed the 'defer wake' optimization because it was incorrect.
This optimization attempted to reduce the number of wakeups of client,
when server releaseBuffer knows that another releaseBuffer will be
following. But there is no way for the first releaseBuffer to predict
how soon the second releaseBuffer will occur. In some cases it was
a long time, and the client underran. So now the client is woken up
immediately if the total number of available frames to client is >=
the minimum number the client wants to see (the notification period).

Also fix bug where minimum frame count was not being used in the
calculation of notification period.

Bug: 10342804
Change-Id: I3c246f4e7bc3684a344f2cf08268dc082e338e2a
edia/AudioTrackShared.h
f557872b594d15599bdb65efd91eb5adeb1d0840 30-Aug-2013 Glenn Kasten <gkasten@google.com> am 908d3c09: am 51ec03c2: Merge "Implement Track::getTimestamp()" into klp-dev

* commit '908d3c09ca7f2ccb280aa5dc8d876099ff9a9d0f':
Implement Track::getTimestamp()
bd096fd9d8e5fc0e62f98807f4818a06f70d0812 23-Aug-2013 Glenn Kasten <gkasten@google.com> Implement Track::getTimestamp()

using a new timestamp latch in PlaybackThread, and
AudioTrackServerProxy::framesReleased() which returns mServer.

Change-Id: I1ebfba968c773faaab95648c272fd3ebd74718d6
edia/AudioTrackShared.h
e198c360d5e75a9b2097844c495c10902e7e8500 13-Aug-2013 Glenn Kasten <gkasten@google.com> Whitespace

Change-Id: Id3ccc183a03421330d0498faaa62a45915cdc3d6
edia/AudioTrackShared.h
82aaf94a5b18939e4d790bbc752031f3070704a3 18-Jul-2013 Glenn Kasten <gkasten@google.com> Report underruns for fast tracks also

This fixes a regression that was introduced earlier
by commit 9f80dd223d83d9bb9077fb6baee056cee4eaf7e5
called "New control block for AudioTrack and AudioRecord".
That commit broke underrun reporting for fast tracks.

Also remove Track::mUnderrunCount, which counted the number of underrun
events, and was only used by dumpsys media.audio_flinger.

Now dumpsys media.audio_flinger reports the number of underrun frames,

Isolated underrun-related control block accesses via the proxy, so that
the server is not directly poking around in the control block.

The new proxy APIs are AudioTrackServerProxy::getUnderrunFrames() and
AudioTrackServerProxy::tallyUnderrunFrames(). getUnderrunFrames() returns
a rolling counter for streaming tracks, or zero for static buffer tracks
which never underrun, but do a kind of 'pause' at end of buffer.
tallyUnderrunFrames() increments the counter by a specified number of frames.

Change-Id: Ib31fd73eb17cbb23888ce3af8ff29f471f5bd5a2
edia/AudioTrackShared.h
d054c32443a493513ab63529b0c8b1aca290278c 12-Jul-2013 Glenn Kasten <gkasten@google.com> Move control block mName to createTrack() output

This is part of a series of CLs to clean up the shared memory
control block, by removing any fields that don't have to be there.

Change-Id: I6e51003a1293b6800258c31b22cff2eba42162e7
edia/AudioTrackShared.h
96f60d8f04432a1ed503b3e24d5736d28c63c9a2 12-Jul-2013 Glenn Kasten <gkasten@google.com> Rename control block flags to mFlags

Change-Id: I7b6d31e24531954ab1ecdf3ed56c19433700bd89
edia/AudioTrackShared.h
f20e1d8df84c5fbeeace0052d100982ae39bb7a4 12-Jul-2013 Glenn Kasten <gkasten@google.com> Rename control block server to mServer and add comments

Change-Id: Ieabd91acee92d0e84e66fbd358df5282b856306e
edia/AudioTrackShared.h
b1a270d1e926fb9a01b4265a7675ed0c2c8f4868 14-May-2013 Richard Fitzgerald <rf@opensource.wolfsonmicro.com> libmedia: offloaded playback support

- start() returns a status so that upper layers can
recreate a non offloaded track in case of error.

- Added states to handle offloaded tracks specific:
- waiting for stream end (drain) notification by
audio flinger
- allow pause while waiting for stream end notification

- getPosition() queries the render position directly from
audio HAL.

- disable APIs not applicable to offloaded tracks

- Modified track restoring behavior for invalidated
offloaded tracks: just send the callback and wait for
upper layers to create a new track.

- Added wait for stream end management in audio track client
proxy. Similar to obtainBuffer and should be factored in.

Change-Id: I0fc48117946364cb255afd653195498891f622bd
Signed-off-by: Eric Laurent <elaurent@google.com>
edia/AudioTrackShared.h
bfb1b832079bbb9426f72f3863199a54aefd02da 07-Jan-2013 Eric Laurent <elaurent@google.com> AudioFlinger: offload playback, non-blocking write

- Added specialized playback thread class for offload playback,
derived from directoutput thread.
This thread type handles specific state transitions for offloaded
tracks and offloading commands (pause/resume/drain/flush..) to audio HAL.
As opposed to other threads, does not go to standby if the track is paused.

- Added support for asynchronous write and drain operations at audio HAL.
Use a thread to handle async callback events from HAL: this avoids locking
playback thread mutex when executing the callback and cause deadlocks when
calling audio HAL functions with the playback thread mutex locked.

- Better accouting for track activity: call start/stop and release Output
methods in audio policy manager when tracks are actually added and removed
from the active tracks list.
Added a command thread in audio policy service to handle stop/release commands
asynchronously and avoid deadlocks with playback thread.

- Track terminated status is not a state anymore. This condition is othogonal
to state to permitted state transitions while terminated.

Change-Id: Id157f4b3277620568d8eace7535d9186602564de
edia/AudioTrackShared.h
7db7df0e8d9d7cee8ba374468cdbfa0108e3337c 26-Jun-2013 Glenn Kasten <gkasten@google.com> AudioTrackShared cleanup

Maintain unreleased frame count on client side also (was already there on server side).
Assertion failure instead of BAD_VALUE status for incorrect usage of APIs.
Clean up error handling code.

Change-Id: I23ca2f6f8a7c18645309ee5d64fbc844429bcba8
edia/AudioTrackShared.h
ad3af3305f024bcbbd55c894a4995e449498e1ba 25-Mar-2013 Richard Fitzgerald <rf@opensource.wolfsonmicro.com> Public API changes for audio offload support.

NOTE: this does _not_ include all private member variables added
to classes as part of offload support. Only public/protected functions
and stubs functions/variables needed to make the changes buildable.

- isOffloadSupported() added to audio policy service
A stub implementation is required to build, this always returns false
- setParameters() added to IAudioTrack
A stub implementation is required to build, this always returns
INVALID_OPERATION

- CBlk flag for stream end

- Change AudioSystem::getRenderPosition() to take an audio_output_t
so caller can specify which output to query

- Add AudioSystem::isOffloadSupported()
This is fully implemented down to the AudioFlinger function
AudioPolicyServer::isOffloadSupported() which is just a stub
that always returns false.

- Add EVENT_STREAM_END to AudioTrack interface.
STREAM_END is used to signal when the hardware has actually finished
playing all the data it was sent.

- Add event type enumeration to media player interface AudioSink callbacks
so that the same callback can be used to handle multiple types of
event. For offloaded tracks we also have to handle STREAM_END and
TEAR_DOWN events

- Pass audio_offload_info_t to various functions used for opening outputs,
tracks and audio players. This passes additional information about the
compressed stream down to the HAL when using offload.
For publicly-available APIs this is an optional parameter (for some of
the internal and low-level APIs around the HAL interface it is mandatory)

- Add getParameters() and setParameters() API to AudioTrack
Currently dummy implementations.

- Change AudioPlayer contructor so that it takes a set of bitflags defining what
options are required. This replaces the original bool which only specified
whether to use deep buffering.

- Changes to StageFright class definition related to handling tearing-down of
an offloaded track when we need to switch back to software decode

- Define new StageFright utility functions used for offloaded tracks
Currently dummy implementations.

- AudioFlinger changes to use extended audio_config_t.
Fills in audio_offload_info_t member if this info is passed in when
opening an output.

- libvideoeditor changes required to add the new event type parameter
to AudioSink callback functions

- libmediaplayerservice changes required to add the new event type parameter
to AudioSink callback functions

Change-Id: I3ab41138aa1083d81fe83b886a9b1021ec7320f1
Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Signed-off-by: Eric Laurent <elaurent@google.com>
edia/AudioTrackShared.h
0d09a9bec07b3bec78bd473ff0bfcf0a261f3f25 24-Jun-2013 Glenn Kasten <gkasten@google.com> Use mFutex as an event flag rather than semaphore

An event flag can be more fault-tolerant in case of loss of synchronization,
as it cannot overflow. It also allows more bits to be used in the future.
See http://en.wikipedia.org/wiki/Event_flag

Change-Id: I01ca25d951eb263124da54bb4738f0d94ec4a48b
edia/AudioTrackShared.h
9f80dd223d83d9bb9077fb6baee056cee4eaf7e5 19-Dec-2012 Glenn Kasten <gkasten@google.com> New control block for AudioTrack and AudioRecord

Main differences between old and new control block:
- removes the mutex, which was a potential source of priority inversion
- circular indices into shared buffer, which is now always a power-of-2 size

Change-Id: I4e9b7fa99858b488ac98a441fa70e31dbba1b865
edia/AudioTrackShared.h
5c4cc0d99d3b1cb35c5d7c237272ee53142745fb 26-Nov-2012 Glenn Kasten <gkasten@google.com> Add template class SingleStateQueue

Change-Id: If7e2bc9b2a216524ee9cbb68682e2634933b4973
edia/StaticAudioTrackState.h
e3aa659e9cee7df5c12a80d285cc29ab3b2cbb39 04-Dec-2012 Glenn Kasten <gkasten@google.com> Start isolating control block accesses in a proxy

The proxy object will eventually be the only code that understands the
details of the control block. This should make it easier to change the
control block in the future.

Initial set of control block fields that are isolated:
- sample rate
- send level
- volume

Prepare for streaming/static separation by adding a union to the control
block for the new fields.

Fix bug in handling of max sample rate on a track. It was only checking
at re-configuration, not at each mix.

Simplify OutputTrack::obtainBuffer.

Change-Id: I2249f9d04f73a911a922ad1d7f6197292c74cd92
edia/AudioTrackShared.h
24ee6aaf1368e3a07061948273c629d05cb9b12a 30-Nov-2012 Andreas Huber <andih@google.com> am ba6b1bc3: am e7550eb2: Merge "Initialize and copy mRotationAngle in VideoFrame"

* commit 'ba6b1bc38e0c355277f69af286469adb5f02e876':
Initialize and copy mRotationAngle in VideoFrame
37007147edde731cd3dc74febd7bb7e093a35020 13-Sep-2012 Christer Fletcher <christer.fletcher@sonyericsson.com> Initialize and copy mRotationAngle in VideoFrame

When thumbnails were generated they could be generated at random
angles as the mRotationAngle variable was not initialized to any
value. This variable would have to be explicitly overwritten to not
cause random rotation. Changed the implementation to initialize the
value to 0 (no rotation). mRotationAngle was also missing in the
copy constructor.

Change-Id: I67a5340fdd807c6ab3a3da5eecb09b5b9d5f4666
edia/VideoFrame.h
b603744e96b07b1d5bf745bde593fb2c025cefcf 14-Nov-2012 Glenn Kasten <gkasten@google.com> Don't use control block frame count after create

This is part of a series to clean up the control block.

Change-Id: I7f4cb05aef63053f8e2ab05b286d302260ef4758
edia/AudioTrackShared.h
22eb4e239fbe9103568147d566d7482e480350b8 07-Nov-2012 Glenn Kasten <gkasten@google.com> Update audio comments

Change-Id: I85d7d2f6381b251db5695202fec75128883a8662
edia/AudioTrackShared.h
b36a7a68af073b1e7fd5cad6aa2c52223fd30efd 13-Nov-2012 Glenn Kasten <gkasten@google.com> Simplify AudioRecord::restoreTrack_l()

Finish removing CBLK_RESTORING and CBLK_RESTORED from control block flags,
and remove constant RESTORE_TIMEOUT_MS.

Also minor cleanup:
- Cache mCblk in local variable cblk and make cblk allocatable in a register.
- Use "iMem" for sp<IMemory>.
- Add missing error log to AudioRecord; it was already in AudioTrack.

This is part of a series to clean up the control block.

Change-Id: Ia5f5ab4763c392bc06a45851b167ddaee29e3455
edia/AudioTrackShared.h
83a0382dc17364567667a4e6135db43f5bd92efc 12-Nov-2012 Glenn Kasten <gkasten@google.com> Move frame size out of the control block

This is part of a series to clean up the control block.

Change-Id: Ifab1c42ac0f8be704e571b292713cd2250d12a3f
edia/AudioTrackShared.h
b929e417853694e37aba1ef4399f188987b709d9 08-Nov-2012 Glenn Kasten <gkasten@google.com> Move buffers pointer out of the control block

This is part of a series to clean up the control block.

Change-Id: Ie474557db7cb360f2d9a0f11600a68f5a3d46f07
edia/AudioTrackShared.h
a47f3165f53c8e8fb8907a94de7417e2c3047eeb 07-Nov-2012 Glenn Kasten <gkasten@google.com> Simplify AudioTrack::restoreTrack_l()

Remove CBLK_RESTORING and CBLK_RESTORED from control block flags,
for AudioTrack only. They are still used by AudioRecord.

This is part of a series to clean up the control block.

Change-Id: Iae4798f5b527c492bdaf789987ff3a1dadd0cb37
edia/AudioTrackShared.h
864585df53eb97c31e77b3ad7c0d89e4f9b42588 07-Nov-2012 Glenn Kasten <gkasten@google.com> Remove CBLK_DIRECTION from control block flags

This is part of a series to clean up the control block.

Change-Id: I0265fece3247356b585d4d48fbda6f37aea8a851
edia/AudioTrackShared.h
e0b07179a48ee50fda931d2aa1b3c751d167e4d7 07-Nov-2012 Glenn Kasten <gkasten@google.com> Remove CBLK_FAST from control block flags

This is part of a series to clean up the control block.

Change-Id: Ic881a3560d9547cb63fcc0cefec87aa3da480e0d
edia/AudioTrackShared.h
9c5fdd83f9b9f49be35107971feb33528d60b945 05-Nov-2012 Glenn Kasten <gkasten@google.com> Simplify control block flag names

Use only one symbol per flag

Change-Id: Ia3582e2134abd60c896d11337face65383e79c7c
edia/AudioTrackShared.h
85ab62c4b433df3f1a9826bed1c9bec07a86c750 01-Nov-2012 Glenn Kasten <gkasten@google.com> Line length 100

Change-Id: Ib28fd7b9ce951a6933f006e7f8812ba617625530
edia/AudioTrackShared.h
0c9d26d187017f7fb028ab52a0fbc6395142faa4 31-May-2012 Glenn Kasten <gkasten@google.com> Log track name on obtain/releaseBuffer warnings

This should help diagnose problems by allowing us to correlate
the logs with the dumpsys media.audio_flinger output.

Change-Id: I8c7c592b4f87d13b0f29c66ce7a2f301a0f063c9
edia/AudioTrackShared.h
3acbd053c842e76e1a40fc8a0bf62de87eebf00f 28-Feb-2012 Glenn Kasten <gkasten@google.com> Configure policy of mediaserver threads

Change-Id: Ifd825590ba36996064a458f64453a94b84722cb0
edia/AudioTrackShared.h
559bf2836f5da25b75bfb229fec0d20d540ee426 28-Mar-2012 James Dong <jdong@google.com> AV Android make files changes

o plus a few file relocation: ActivityManager.cpp/h, SoundPool.h, etc
o remove some runtime dependencies to libandroid, libandroid_runtime, etc

Change-Id: I047a47c5fb361dd5cf85cd98798c39f629a75d10
wui/DrawGlInfo.h
00a10e8eb39526df06779e0cdb6e6871752934d7 27-Mar-2012 Romain Guy <romainguy@google.com> Use a status_t return type for GL functors

WebView needs more fine-grained control over the behavior of the
framework upon execution of the display lists. The new status_t
allows WebView to requests its functor to be re-executed directly
without causing a redraw of the entire hierarchy.

Change-Id: I97a8141dc5c6eeb6805b6024cc1e76fce07d24cc
wui/DrawGlInfo.h
e53b9ead781c36e96d6b6f012ddffc93a3d80f0d 13-Mar-2012 Glenn Kasten <gkasten@google.com> Whitespace and indentation

Fix indentation to be multiple of 4.
Make it easier to search:
sp< not sp < to
"switch (...)" instead of "switch(...)" (also "if" and "while")
Remove redundant blank line at start or EOF.
Remove whitespace at end of line.
Remove extra blank lines where they don't add value.

Use git diff -b or -w to verify.

Change-Id: I966b7ba852faa5474be6907fb212f5e267c2874e
edia/VideoFrame.h
9f08fa0c5bd9353720feeb989a3af4610c929ca6 08-Mar-2012 Mathias Agopian <mathias@google.com> remove files that moved to frameworks/native

Change-Id: I140d291e520097b1148930f736823650e08488f7
inder/Static.h
inder/binder_module.h
ui/ComposerService.h
ui/LayerState.h
ui/SharedBufferStack.h
i/RegionHelper.h
tils/Static.h
df712ea86e6350f7005a02ab0e1c60c28a343ed0 26-Feb-2012 Mathias Agopian <mathias@google.com> fix libgui header location

Change-Id: Iec71706cdd4f29c6904993648ce873e83ef9cafe
ui/LayerState.h
ui/SharedBufferStack.h
urfaceflinger/LayerState.h
urfaceflinger/SharedBufferStack.h
d3393c35259588e8ad61a43d1d1aa1568e943307 26-Feb-2012 Mathias Agopian <mathias@google.com> libagl shouldn't export anything

Change-Id: Ia823dbc56aab2a0b8a6063df4348fe6baac124c6
pengles/gl_context.h
9eeafeb52fecf90882e9b44eeefcb7c3e16aa915 25-Feb-2012 Mathias Agopian <mathias@google.com> remove dependency on android_native{s_priv|buffer}.h

Change-Id: Ie4b95f7061c240f37c504414259f92d72c4ffc89
i/android_natives_priv.h
99e53b86eebb605b70dd7591b89bf61a9414ed0e 19-Jan-2012 Glenn Kasten <gkasten@google.com> Update comments

We no longer put the filename at start of file.

Change-Id: Ic435b159a23105681e3d4a6cb1ac097bc853302e
edia/AudioTrackShared.h
1a0ae5be3d1273cba12584b33830d859510fbf82 03-Feb-2012 Glenn Kasten <gkasten@google.com> Don't double destruct audio_track_cblk_t

Fortunately audio_track_cblk_t doesn't have a destructor, but for clarity
remove the double destruction.

Also add warning not to add any virtuals to audio_track_cblk_t.

Change-Id: I70ebe1a70460c7002145b2cdf10f9f137396e6f3
edia/AudioTrackShared.h
83d86538c4c479a9225c75ab27938e8f05abb9c8 17-Jan-2012 Glenn Kasten <gkasten@google.com> Make AudioTrack control block volume field private

This is part of the process of abstracting the control block
to make it easier to maintain.

Change-Id: Idb8f461e68dab3bcf268159cc0781651c6fb7094
edia/AudioTrackShared.h
b1cf75c4935001f61057989ee3cf27bbf09ecd9c 17-Jan-2012 Glenn Kasten <gkasten@google.com> Track volume cleanup

Always read and write track volumes atomically. In most places this was
already being done, but there were a couple places where the left and
right channels were read independently.

Changed constant MAX_GAIN_INT to be a uint32_t instead of a float.
It is always used as a uint32_t in comparisons and assignments.
Use MAX_GAIN_INT in more places.

Now that volume is always accessed atomically, removed the union
and alias for uint16_t volume[2], and kept only volumeLR.

Removed volatile as it's meaningless.

In AudioFlinger, clamp the track volumes read from shared memory
before applying master and stream volume.

Change-Id: If65e2b27e5bc3db5bf75540479843041b58433f0
edia/AudioTrackShared.h
613882293184e575a44bff681a3decaefe889e69 17-Jan-2012 Glenn Kasten <gkasten@google.com> Merge "Use size_t for frame size"
05632a5fa4b88ca474294887fc92a9fcdf0e2352 03-Jan-2012 Glenn Kasten <gkasten@google.com> AudioTrack and AudioFlinger send level cleanup

Add an API to control block for getting/setting send level.
This allow us to make the mSendLevel field private.

Document the lack of barriers.

Use 0.0f to initialize floating-point values (for doc only).

Change-Id: I59f83b00adeb89eeee227e7648625d9a835be7a4
edia/AudioTrackShared.h
b9980659501d0428d65d8292f3c32da69d37fbd2 11-Jan-2012 Glenn Kasten <gkasten@google.com> Use size_t for frame size

except in the control block, where we don't have room.

In AudioFlinger::ThreadBase::TrackBase::getBuffer,
read the frame size from control block only once.

Change-Id: Id6c4bccd4ed3e07d91df6bbea43bae45524f9f4e
edia/AudioTrackShared.h
362c4e697d8e9c034e964ac7b40227e054491547 14-Dec-2011 Glenn Kasten <gkasten@google.com> Audio C++ comments

Change-Id: I84906ebb9dfcfa5b96b287d18364b407f02a30c1
edia/AudioTrackShared.h
404a123bed7f180724ead17f10e037b3eb347701 18-Nov-2011 Mathias Agopian <mathias@google.com> split ComposerService out of SurfaceComposerClient.h

Change-Id: I1eb691f7ca263d5895d871ab675bb5826e0323c6
ui/ComposerService.h
8343f2c317b48f9b9827781b16a5c9fd31743826 31-Aug-2011 Mathias Agopian <mathias@google.com> fix Surface positions are not floats

Added Surface.setPosition(float, float) which allows to set a surface's
position in float.

Bug: 5239859
Change-Id: I903aef4ad5b5999142202fb8ea30fe216d805711
urfaceflinger/LayerState.h
81eedd1746be590d5d506dfb9ff23619f9d9898f 13-Jul-2011 Mike Lockwood <lockwood@android.com> Remove some #ifdef HAVE_ANDROID_OS that were needed for the simulator build

Change-Id: I13d9f251f86c05ae5405f37adbf6b8e9660935ba
Signed-off-by: Mike Lockwood <lockwood@android.com>
inder/binder_module.h
2df788fb0c402938f827bf9c9ce2ca3ab1dcd464 29-Jun-2011 Mathias Agopian <mathias@google.com> SF transactions are now O(1) wrt IPC instead of O(N).

Change-Id: I57669852cbf6aabae244ea86940a08a5a27ffc43
urfaceflinger/LayerState.h
4b85d1750153085fe5d076b67802dfb1ea2bbb13 20-Apr-2011 Mathias Agopian <mathias@google.com> unify SurfaceTexture and Surface

Add the concept of synchronous dequeueBuffer in SurfaceTexture
Implement {Surface|SurfaceTextureClient}::setSwapInterval()
Add SurfaceTexture logging
fix onFrameAvailable
urfaceflinger/SharedBufferStack.h
c6854100cea4fcd0f20cb2ac8235c02d1849b3a1 02-Jun-2011 Glenn Kasten <gkasten@google.com> Remove unnecessary level of priority indirection

Change-Id: I942d43973c20a7ace8b0d3f78b4da97e45e996c6
edia/AudioTrackShared.h
0d255b2d9061ba31f13ada3fc0f7e51916407176 25-May-2011 Jean-Michel Trivi <jmtrivi@google.com> Use channel mask instead of channel count for track creation

Record and playback objects (resp AudioRecord and AudioTrack)
are created using a channel mask, but this information is lost
in the mixer because only the channel count is known to
AudioFlinger. A channel count can always be derived from a
channel mask.

The change consists in:
- disambiguiting variable names for channel masks and counts
- passing the mask information from the client to AudioFlinger
and the mixer.
- when using the DIRECT ouput, only verifying the format of
the track is compatible with the output's for PCM.

Change-Id: I50d87bfb7d7afcabdf5f12d4ab75ef3a54132c0e
edia/AudioTrackShared.h
68178d6419df65d606d9105b3324260d38d7b02c 03-May-2011 Mathias Agopian <mathias@google.com> remove last traces of copybit

Change-Id: Ia0f13a0ee6f702256482b5eb29d7fa2aa840bfc7
pengles/gl_context.h
d0675ede6de2249256d20271a19ccbf9f11745b8 29-Apr-2011 Mathias Agopian <mathias@google.com> get rid of dependency on copybit HAL module

Change-Id: Ia608099a2426c11a91d33063ba53c93e1eccb428
pengles/gl_context.h
38ccae2c0324daa305f3fe77d25fdf5edec0b0e1 29-Mar-2011 Eric Laurent <elaurent@google.com> New fix for issue 4111672: control block flags

The first fix (commit 913af0b4) is problematic because it makes threads
in mediaserver process block on the cblk mutex. This is not permitted
as it can cause audio to skip or worse have a malicious application
prevent all audio playback by keeping the mutex locked.

The fix consists in using atomic operations when modifying the control
block flags.

Also fixed audio_track_cblk_t::framesReady() so that it doesn't block
when called from AudioFlinger (only applies when a loop is active).

Change-Id: Ibf0abb562ced3e9f64118afdd5036854bb959428
edia/AudioTrackShared.h
0ab985cf1ec0110022be22ff03aa300bb59b9c96 17-Mar-2011 Romain Guy <romainguy@google.com> Send WebView the current transform and whether we're drawing a layer.
Bug #3275491

These can be used by WebView to correctly apply alpha and geometric
transforms.

Change-Id: I2ecd4376d68df886dead3c9240317de33f56828f
wui/DrawGlInfo.h
1703cdfee717b1b312bf8979816a9e2f16a82e5d 07-Mar-2011 Eric Laurent <elaurent@google.com> Fix issue 3439872: video chat and bluetooth SCO

This change fixes the stability problems experienced when using
a bluetooth headset supporting both A2DP and SCO. Problems occur
when starting the video chat at which time the A2DP output is being
stopped to start SCO. At that time, active AudioTracks are invalidated
by AudioFlinger so that a new AudioTrack binder interface can be
recreated by the client process on the new mixer thread with correct parameters.
The problem was that the process to restore the binder interface was not
protected against concurrent requests which caused 2 binder interfaces
to be created sometimes. This could lead to permanent client deadlock
if one of the client threads was waiting for a condition of the first
created binder interface while the second one was created (as the AudioFlinger
would only signal conditions on the last one created).
This concurrent request situation is more likely to happen when a client
uses the JAVA AudioTrack as the JNI implementation uses simultaneously the
native AudioTrack callback and write push mechanisms. By doing so, the code
that checks if the binder interface should be restored (in obtainBuffer()) is
much more likely to be called concurrently from two different threads.

The fix consists in protecting the critical binder interface restore phase
with a flag in the AudioTrack control block. The first thread acting upon the binder
interface restore request will raise the flag and the second thread will just wait for
a condition to be signaled when the restore process is complete.

Also protected all accesses to the AudioTrack control block by a mutex to prevent
access while the track is being destroyed and restored. If a mutex cannot be held
(e.g because we call a callback function), acquire a strong reference on the IAudioTrack
to prevent its destruction while the cblk is being accessed.

Modified AudioTrack JNI to use GetByteArrayElements() instead of
GetPrimitiveArrayCritical() when writing audio buffers. Entering a critical section would
cause the JNI to abort if a mediaserver crash occurs during a write due to the AudioSystem
callback being called during the critical section when media server process restarts.
Anyway with current JNI implementation, either versions do not copy data most of the times
and the criticial version does not guaranty no data copy.

The same modifications have been made to AudioRecord.

Change-Id: Idc5aa711a04c3eee180cdd03f44fe17f3c4dcb52
edia/AudioTrackShared.h
196855ed4eb4681c4d3504438706caf6b505c9d6 01-Mar-2011 Mathias Agopian <mathias@google.com> Add support for up to 32 buffers per Surface

Bug: 3488016

Change-Id: Ie5536ad77d42a4d0e8270e0fd87ecb73471bcbbc
urfaceflinger/SharedBufferStack.h
9383d1a2197479e4d2ac4571c7fbe424f93e3b93 20-Jan-2011 Mathias Agopian <mathias@google.com> clean-up unneeded code

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.

Change-Id: I210413d4c8c0998dae05c8620ebfc895d3e6233d
urfaceflinger/SharedBufferStack.h
181a379b43c1e85389e8bb60825d9b608502717a 09-Dec-2010 Mathias Agopian <mathias@google.com> fix [3259708] Graphic Buffer Mapper does not support YV12

remove a bunch of a code that was there only to support broken gralloc implementations

Change-Id: I3c1a9172224cbcc283601abfbbd695a20815451f
i/sw_gralloc_handle.h
effae7fc1aab5354aae649d958db3c8ed77cafa7 02-Nov-2010 Jamie Gennis <jgennis@google.com> Implement reducing the buffer count of a Surface.

Change-Id: I7f979c60c06d654aa8265002836277434bc1a64f
Bug: 3095167
urfaceflinger/SharedBufferStack.h
ce0febae177d1816ee7a6750ed9fba52472b9a71 09-Nov-2010 James Dong <jdong@google.com> Support extracting thumbnail from rotated video tracks

Change-Id: Ife0a2536aaac5ff1efdf1035b9d2c892773ee16c
edia/VideoFrame.h
50817931e4cb4ae0019fd13c831a2839349834c5 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
urfaceflinger/SharedBufferStack.h
44d9848d6656777a18019223e0d35f2fcc67719a 01-Oct-2010 Eric Laurent <elaurent@google.com> Issue 3032913: improve AudioTrack recovery time

This issue showed that when an AudioTrack underruns during a too long period
of time and is therefore disabled by audioflinger mixer, it takes an additional
delay of up to 3 seconds to recover.
This fix adds a simple mechanism to recover immediately when the client application
is ready to write data again in the AudioTrack buffer

Also throttle warnings on record overflows

Change-Id: I8b2c71578dd134b9e60a15ee4d91b70f3799cb3d
edia/AudioTrackShared.h
d7c43d3d1ec96e3e3a9ed1faf3ccb2edc949b390 27-Aug-2010 Mathias Agopian <mathias@google.com> fix a race in SF buffer management

also remove some unused code.

Change-Id: Iae2c3309b7a08055f3e13a5b866c5c084993e352
urfaceflinger/SharedBufferStack.h
92235649a45e1b84f43e3c906c57eea7886a426c 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
urfaceflinger/SharedBufferStack.h
be1ad8d186d0db6e0a3c8885c95a354cbbfc52af 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
urfaceflinger/SharedBufferStack.h
628eff9967c4efd04204656d9756df9e32cf523c 23-Apr-2010 Jeff Brown <jeffbrown@google.com> Native input dispatch rewrite work in progress.

The old dispatch mechanism has been left in place and continues to
be used by default for now. To enable native input dispatch,
edit the ENABLE_NATIVE_DISPATCH constant in WindowManagerPolicy.

Includes part of the new input event NDK API. Some details TBD.

To wire up input dispatch, as the ViewRoot adds a window to the
window session it receives an InputChannel object as an output
argument. The InputChannel encapsulates the file descriptors for a
shared memory region and two pipe end-points. The ViewRoot then
provides the InputChannel to the InputQueue. Behind the
scenes, InputQueue simply attaches handlers to the native PollLoop object
that underlies the MessageQueue. This way MessageQueue doesn't need
to know anything about input dispatch per-se, it just exposes (in native
code) a PollLoop that other components can use to monitor file descriptor
state changes.

There can be zero or more targets for any given input event. Each
input target is specified by its input channel and some parameters
including flags, an X/Y coordinate offset, and the dispatch timeout.
An input target can request either synchronous dispatch (for foreground apps)
or asynchronous dispatch (fire-and-forget for wallpapers and "outside"
targets). Currently, finding the appropriate input targets for an event
requires a call back into the WindowManagerServer from native code.
In the future this will be refactored to avoid most of these callbacks
except as required to handle pending focus transitions.

End-to-end event dispatch mostly works!

To do: event injection, rate limiting, ANRs, testing, optimization, etc.

Change-Id: I8c36b2b9e0a2d27392040ecda0f51b636456de25
EADME
36ef8cf54e2bf2f96b8c7f47cd534c00ccb7b64f 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
urfaceflinger/SharedBufferStack.h
cbbf27f76b4798cbd91feb70d7555dac0cbf85cb 02-Jun-2010 Mathias Agopian <mathias@google.com> split surface management from surface's buffers management

Change-Id: If3c5655d1231f8f0c49ba68f972b1b20c93b3f87
urfaceflinger/SharedBufferStack.h
be916aa1267e2e6b1c148f51d11bcbbc79cb864c 02-Jun-2010 Eric Laurent <elaurent@google.com> Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications.

First drop of audio framework modifications for audio effects support.

- AudioTrack/AudioRecord:
Added support for auxiliary effects in AudioTrack
Added support for audio sessions
Fixed left right channel inversion in setVolume()

- IAudioFlinger:
Added interface methods for effect enumeraiton and instantiation
Added support for audio sessions.

- IAudioTrack:
Added method to attach auxiliary effect.

- AudioFlinger
Created new classes to control effect engines in effect library and manage effect connections to tracks or
output mix:
EffectModule: wrapper object controlling the effect engine implementation in the effect library. There
is one EffectModule per instance of an effect in a given audio session
EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session.
EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks
with same session ID. Each chain contains a variable number of EffectModules
EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application
controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles.

Added support for effect modules and effect chains creation in PlaybackThread.
modified mixer thread loop to allow track volume control by effect modules and call effect processing.

-AudioMixer
Each track now specifies its output buffer used by mixer for accumulation
Modified mixer process functions to process tracks by groups of tracks with same buffer
Modified track process functions to support accumulation to auxiliary channel

Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
edia/AudioEffectShared.h
edia/AudioTrackShared.h
ba0fab325cd8379378a2c8ad14dd1c44bf2760f3 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
urfaceflinger/SharedBufferStack.h
3f6b0cdd8cd57e2cca56a5dd4cfa726b9185d2e8 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
urfaceflinger/SharedBufferStack.h
fb6ae6666644c9a37a5d34dd03eb637333cf946b 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
urfaceflinger/SharedBufferStack.h
68f929b84acf0c985b9ae3157322c022798e5eb2 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
urfaceflinger/SharedBufferStack.h
082a4d89ae4bd156052346bbac7031ed7d741c9d 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
urfaceflinger/SharedBufferStack.h
dd9a3a7cb9bd5f68bc6b1fe709e10b6bd1f5b433 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"
urfaceflinger/SharedBufferStack.h
e1f61055b4abb96a86d1ff24b5a7777dfe40fe5f 18-May-2010 Mathias Agopian <mathias@google.com> fix some bugs in SharedBufferStack::resize

added buffers should now be labeled properly.

Change-Id: I28aa753fbe89ab89134e7753575319478934c7fa
urfaceflinger/SharedBufferStack.h
d1b449aad6c087a69f5ec66b7facb2845b73f1cb 14-May-2010 Eric Laurent <elaurent@google.com> Fix issue 2553359: Pandora does not work well with Passion deskdock / Cardock.

The problem is due to a too big difference between the buffer size used at the hardware interface and at the A2DP interface.
When no resampling occurs we don't notice problems but the timing is very tight. As soon as resampling is activated, the AudioTrack underruns.
This is because the AudioTrack buffers are not resized when moving the AudioTrack from hardware to A2DP output.
The AudioTrack buffers are calculated based on a hardware output buffer size of 3072 bytes. Which is much less than the A2DP output buffer size (10240).

The solution consists in creating new tracks with new buffers in AudioFlinger when the A2DP output is opened
instead of just transfering active tracks from hardware output mixer thread to the new A2DP output mixer thread.
To avoid synchronization issues between mixer threads and client processes, this is done by invalidating tracks
by setting a flag in their control block and having AudioTrack release the handle on this track (IAudioTrack)
and create a new IAudioTrack when this flag is detected next time obtainBuffer() or start() is executed.

AudioFlinger modifications:
- invalidate the tracks when setStreamOutput() is called
- make sure that notifications of output opening/closing and change of stream type to output mapping are sent synchronously to client process.
This is necessary so that AudioSystem has the new stream to output mapping when the AudioTrack detects the invalidate flag in the client process.
Previously their were sent when the corresponding thread loop was executed.

AudioTrack modifications:
- move frame count calculation and verification from set() to createTrack() so that is is updated every time a new IAudioTrack is created.
- detect track invalidate flag in obtainBuffer() and start() and create a new IAudioTrack.

AudioTrackShared modifications
- group all flags (out, flowControlFlag, forceReady...) into a single bit filed to save space.

Change-Id: I9ac26b6192230627d35084e1449640caaf7d56ee
edia/AudioTrackShared.h
45df6a2a25ff36606a5301155d8d97e9bf80d00b 14-May-2010 Eric Laurent <elaurent@google.com> AudioFlinger: rename variables to clarify reference to track channel count or channel mask

Some variables and structure members should be renamed to reflect the fact that they contain the
number of channels in a track (channel count) or the actual channels used by a track (channel mask).
Especially member "channels" of track control block (struct audio_track_cblk_t) is actually the
number of channels (channels count).

Change-Id: I220c8dede9fc00c8a5693389e790073b6ed307b8
edia/AudioTrackShared.h
5cc61b153dabc4e188302e85828c06cf9995b410 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
urfaceflinger/SharedBufferStack.h
86f69c1f41dcf4e0826b17ecf7fd71eb353b0782 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
urfaceflinger/SharedBufferStack.h
41623bfd339754718bab32a6259ff15920f1c588 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
urfaceflinger/SharedBufferStack.h
43d8a28165c0cf5ecfd4ea988f5db0f120672e60 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
urfaceflinger/SharedBufferStack.h
e9e4d5431d0df77a73f92b4a892417f47a57334c 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
urfaceflinger/SharedBufferStack.h
cdaaf320a1db27a7045fafa4d849c20daa97c146 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
urfaceflinger/SharedBufferStack.h
3cf613507f1e2f7bd932d921a6e222e426fd3be4 10-Feb-2010 Mathias Agopian <mathias@google.com> split libsurfaceflinger_client and libcamera_client out of libui
urfaceflinger/LayerState.h
urfaceflinger/SharedBufferStack.h
i/LayerState.h
i/SharedBufferStack.h
2eeabb1f98d162786b45a09659674025a0559251 03-Feb-2010 Mathias Agopian <mathias@google.com> fix [2133133] Software OpenGL ES Lighting is buggy (GL Gears washed out bug)

A typo caused GL_AMBIENT_AND_DIFFUSE to only set the the ambient color.

Fix another typo which caused the viewer position to be wrong for
specular highlights.

Switch back to eye-space lighting, since there are still some issues
with some demos (San Angeles in particular).
pengles/gl_context.h
1c38c276c8cd1c56907787c2a4f6c9e109409fff 02-Feb-2010 Mathias Agopian <mathias@google.com> implement [2396050] Add ETC1 texture support to AGL
pengles/gl_context.h
9416be414bf104fb07a532a8d6d9f71150eb6595 03-Nov-2009 Mathias Agopian <mathias@google.com> fix[2228133] pixelflinger ignores the "vertical stride" leading to artifacts when playing back video

we lost the concept of vertical stride when moving video playback to EGLImage.
Here we bring it back in a somewhat hacky-way that will work only for the
softgl/mdp backend.
pengles/gl_context.h
7b9d6a92534fd712c465b5ffcc4e7631f0147c1c 16-Oct-2009 Mathias Agopian <mathias@google.com> fix [2182249] [MR1] valgrind error in surface flinger
i/RegionHelper.h
68174b17d69f482e5b7015452673c813343a1587 08-Oct-2009 Mathias Agopian <mathias@google.com> fix [2170319] gmail bulk operation checkbox latency on passion

This also fixes [2152536] ANR in browser

When SF is enqueuing buffers faster than SF dequeues them.
The update flag in SF is not counted and under some situations SF will only
dequeue the first buffer. The state at this point is not technically
corrupted, it's valid, but just delayed by one buffer.

In the case of the Browser ANR, because the last enqueued buffer was delayed
the resizing of the current buffer couldn't happen.

The system would always fall back onto its feet if anything -else- in
tried to draw, because the "late" buffer would be picked up then.
i/SharedBufferStack.h
i/SurfaceFlingerSynchro.h
d46758b6ec99533babbd24f62e381eae0a2a66a6 07-Oct-2009 Mathias Agopian <mathias@google.com> fix [2152536] ANR in browser

A window is created and the browser is about to render into it the
very first time, at that point it does an IPC to SF to request a new
buffer. Meanwhile, the window manager removes that window from the
list and the shared memory block it uses is marked as invalid.
However, at that point, another window is created and is given the
same index (that just go freed), but a different identity and resets
the "invalid" bit in the shared block. When we go back to the buffer
allocation code, we're stuck because the surface we're allocating for
is gone and we don't detect it's invalid because the invalid bit has
been reset.

It is not sufficient to check for the invalid bit, I should
also check that identities match.
i/SharedBufferStack.h
5bffa09d4483ac31de42077d05d24ba26fab928d 06-Oct-2009 Mathias Agopian <mathias@google.com> fix [2168531] have software-only gralloc buffer side-step the HAL
i/sw_gralloc_handle.h
9d64a06fd89d125f0c8903bd0448b75853b6c0ef 06-Oct-2009 Mathias Agopian <mathias@google.com> fix [2167050] glTexImage2D code path buggy in SurfaceFlinger

When EGLImage extension is not available, SurfaceFlinger will fallback to using
glTexImage2D and glTexSubImage2D instead, which requires 50% more memory and an
extra copy. However this code path has never been exercised and had some bugs
which this patch fix.

Mainly the scale factor wasn't computed right when falling back on glDrawElements.
We also fallback to this mode of operation if a buffer doesn't have the adequate
usage bits for EGLImage usage.

This changes only code that is currently not executed. Some refactoring was needed to
keep the change clean. This doesn't change anything functionaly.
i/SurfaceBuffer.h
i/android_natives_priv.h
defd1bd08aaf7edc1918108419cf3f9d185c22f9 03-Oct-2009 Mathias Agopian <mathias@google.com> Attempt to fix [2152536] ANR in browser

The ANR is caused by SurfaceFlinger waiting for buffers of a removed surface to become availlable.
When it is removed from the current list, a Surface is marked as NO_INIT, which causes SF to return
immediately in the above case. For some reason, the surface here wasn't marked as NO_INIT.

This change makes the code more robust by always (irregadless or errors) setting the NO_INIT status
in all code paths where a surface is removed from the list.

Additionaly added more information in the logs, should this happen again.
i/SharedBufferStack.h
9e3ebf8c45ff1872a473c948acb8b7d9e3648f56 17-Sep-2009 Mathias Agopian <mathias@google.com> add basic time stats for surfaces lock time
i/SharedBufferStack.h
5a37cc51551efff88c780088ae8280f87b496472 15-Sep-2009 Mathias Agopian <mathias@google.com> make sure to update the tail pointer when undoing a dequeue
i/SharedBufferStack.h
4fc61bfdeff922c3bf88aee52a693b52bd98788c 11-Sep-2009 Mathias Agopian <mathias@google.com> fix [2112575] stuck on DequeueCondition for a surface that doesn't exist anymore

this also fixes part of [2111536] Device is soft rebooted after ending the call through voice dialer
i/SharedBufferStack.h
3dbf98cec721828df6c533ed5dfba8ceccaa3933 11-Sep-2009 Mathias Agopian <mathias@google.com> make sure conditions will return when the status of a surface is not NO_ERROR
i/SharedBufferStack.h
81e2a52fea13e6e4c9468884bfdd936c3c22e226 08-Sep-2009 Mathias Agopian <mathias@google.com> fix [2068105] implement queueBuffer/lockBuffer/dequeueBuffer properly

Rewrote SurfaceFlinger's buffer management from the ground-up.
The design now support an arbitrary number of buffers per surface, however the current implementation is limited to four. Currently only 2 buffers are used in practice.

The main new feature is to be able to dequeue all buffers at once (very important when there are only two).

A client can dequeue all buffers until there are none available, it can lock all buffers except the last one that is used for composition. The client will block then, until a new buffer is enqueued.

The current implementation requires that buffers are locked in the same order they are dequeued and enqueued in the same order they are locked. Only one buffer can be locked at a time.

eg. Allowed sequence: DQ, DQ, LOCK, Q, LOCK, Q
eg. Forbidden sequence: DQ, DQ, LOCK, LOCK, Q, Q
i/LayerState.h
i/SharedBufferStack.h
i/SharedState.h
i/SurfaceBuffer.h
4e3d2484c96508d5dea5296f41de4e46612fb7c4 11-Aug-2009 Martin Storsjo <martin@martin.st> Calculate specular lighting correctly

Since the lighting calculations are done in object space, the vector
from the object to the viewer also needs to be transformed to object
space.
pengles/gl_context.h
806a5fcb30abd2959381774e54f6dec79d6d86f4 14-Aug-2009 Mathias Agopian <mathias@google.com> be more friendly with C
i/android_natives_priv.h
c2f1f07084818942352c6bbfb36af9b6b330eb4e 17-Jul-2009 Eric Laurent <elaurent@google.com> Fix issue 1795088 Improve audio routing code

Initial commit for review.
Integrated comments after patch set 1 review.
Fixed lockup in AudioFlinger::ThreadBase::exit()
Fixed lockup when playing tone with AudioPlocyService startTone()
edia/AudioTrackShared.h
b07c28b90b2d2793be2b8878d813b607f3eebbb7 14-Jul-2009 Mathias Agopian <mathias@google.com> add a ctor to Mutex to specify the type, which can be shared. This is used by sf and af an soon will allow some optimization in the kernel for non shared mutexes
i/SharedState.h
00ee4800348236184d8aaa3b8285a9e2a3df712d 13-Jul-2009 Mathias Agopian <mathias@google.com> implement Mutex and Condition with pthread instead of calling futex directly.

internally pthread uses futex. the implementation consists of simple inlines
there are no implementation files anymore.
tils/futex_synchro.h
814914cd0858cafaa6ad625e3012de97d213636d 07-Jul-2009 Android (Google) Code Review <android-gerrit@google.com> Merge change 6382

* changes:
add a virtual destructor to region_rasterizer, to be on the safe side
7c5252ed0a5d8d01d7ad8ce24fdd465e91938d4d 07-Jul-2009 Mathias Agopian <mathias@google.com> add a virtual destructor to region_rasterizer, to be on the safe side
i/RegionHelper.h
349dba337e07e129f6ba49a132999f0b73fedbe3 07-Jul-2009 Eric Laurent <elaurent@google.com> am 88e209dc: Fix issue 1743700: AudioTrack: setPlaybackRate can not set the playback rate to twice of the ouputSR

Merge commit '88e209dcf8c2ebddda5c272f46d1bd5478bc639c'

* commit '88e209dcf8c2ebddda5c272f46d1bd5478bc639c':
Fix issue 1743700: AudioTrack: setPlaybackRate can not set the playback rate to twice of the ouputSR
573266210fb2b2e7d86fbd46d0dfe16763611d91 07-Jul-2009 Eric Laurent <elaurent@google.com> Fix issue 1743700: AudioTrack: setPlaybackRate can not set the playback rate to twice of the ouputSR

Store sample rate on 32 bits instead of 16 bits in audio_track_cblk_t.
Removed sampleRate() methods from AudioTrack and AudioRecord: replaced by getSampleRate().
AudioTrack::setSampleRate() no returns a status.
edia/AudioTrackShared.h
e35922dc7121ddbd2ec7923e0756adb92046b8ff 25-Jun-2009 Mathias Agopian <mathias@google.com> merge master in master_gl
e4f071b1f3d2da871a1a05446c32c0f324b52f1e 23-Jun-2009 Android (Google) Code Review <android-gerrit@google.com> am 5277103d: Merge change 5035 into donut

Merge commit '5277103db9033226814edc8fcba6f4ba4e846678'

* commit '5277103db9033226814edc8fcba6f4ba4e846678':
add glTexParameteri() and fix glTexParameteriv()
f1bd03d1eb0505a32485b1a52c7c8c5ed4e96765 23-Jun-2009 Mathias Agopian <mathias@google.com> add glTexParameteri() and fix glTexParameteriv()
pengles/gl_context.h
2ff585f4bdcce8a8db81956c2fba1c12db7f8a9d 11-Jun-2009 Mathias Agopian <mathias@google.com> fix a bug where copybit only renders in the first buffer when used with s/w GL
pengles/gl_context.h
79021f4b514a3847263586df8702a98af3a1d0d1 10-Jun-2009 Mathias Agopian <mathias@google.com> revive the copybit test.
i/SurfaceBuffer.h
348514d9be0488a1bda9680ea2f5da9ae779faa6 05-Jun-2009 Mathias Agopian <mathias@google.com> cleanup Debug.h a bit
i/SharedState.h
794aaef95e1afa06b68a93c9fe9c881cf438c76a 22-May-2009 Mathias Agopian <mathias@google.com> merge master to master_gl
7562408b2261d38415453378b6188f74fda99d88 20-May-2009 Mathias Agopian <mathias@google.com> move libbinder's header files under includes/binder
inder/Static.h
tils/Static.h
615a9bfbd98b90e09d868c128db84836feb658e4 19-May-2009 Mathias Agopian <mathias@google.com> checkpoint: split libutils into libutils + libbinder
inder/Static.h
inder/binder_module.h
tils/Static.h
tils/binder_module.h
cde489a26a200a21bcd6a3936435ec29dc389c42 11-May-2009 Mathias Agopian <mathias@google.com> Region now has its own implementation instead of relying on SkRegion, which allows us to break libui's dependency on libcorecg.
i/RegionHelper.h
376f5614699f088aa458addfdc26fca4c4c63d68 06-May-2009 Mathias Agopian <mathias@google.com> move android_native_buffer_t declaration into its own private/ui/android_native_priv.h header, since user code should never have access to it.
i/SurfaceBuffer.h
i/android_natives_priv.h
81dd9e9f10b3557e8f1b13a5b1466bdcd74e0b56 06-May-2009 Mathias Agopian <mathias@google.com> move opengl/include/EGL/android_natives.h to include/ui/egl/android_natives.h and don't include it from egl.h

the android_native_ types are just forward declared in egl.h
i/SurfaceBuffer.h
4fde27f0b89b3df5e280b648dd6c7968ee864916 21-Apr-2009 Mathias Agopian <mathias@google.com> a brand new MessageQueue for SurfaceFlinger.
i/SurfaceFlingerSynchro.h
b1514c918da830ce959c84ccec553769f227304e 10-Apr-2009 Mathias Agopian <mathias@google.com> Integrate from //sandbox/mathias/donut/...@145728

SurfaceFlinger rework for new EGL driver model support.
pengles/gl_context.h
i/SharedState.h
1179bc9b0e3d17c984e8f4ad38561c049dd102fa 19-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake_rel/...@140373
edia/AudioTrackShared.h
89fa4ad53f2f4d57adbc97ae1149fc00c9b6f3c5 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
edia/AudioTrackShared.h
edia/VideoFrame.h
pengles/gl_context.h
i/LayerState.h
i/SharedState.h
i/SurfaceFlingerSynchro.h
tils/Static.h
tils/binder_module.h
tils/futex_synchro.h
15f767b960b38059a74a42a33e16d8df2aec8bc1 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
edia/AudioTrackShared.h
edia/VideoFrame.h
pengles/gl_context.h
i/LayerState.h
i/SharedState.h
i/SurfaceFlingerSynchro.h
tils/Static.h
tils/binder_module.h
tils/futex_synchro.h
5e07b5774c8b376776caa4f5b0a193767697e97e 11-Feb-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@130745
pengles/gl_context.h
e5198b620a9a208ec59ea8457282404725f8ff6e 20-Jan-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@127101
edia/AudioTrackShared.h
54ffb8abf94365496a2dbf5d792b6977d6a8ef06 16-Jan-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@126645
pengles/gl_context.h
7b5eb023f8d87cca6d830ae6c11c6aadbe02aca8 18-Dec-2008 The Android Open Source Project <initial-contribution@android.com> Code drop from //branches/cupcake/...@124589
edia/AudioTrackShared.h
edia/VideoFrame.h
pengles/gl_context.h
2729ea9262ca60d93047e984739887cfc89e82eb 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution
edia/AudioTrackShared.h
pengles/gl_context.h
i/LayerState.h
i/SharedState.h
i/SurfaceFlingerSynchro.h
tils/Static.h
tils/binder_module.h
tils/futex_synchro.h