• Home
  • History
  • Annotate
  • only in /frameworks/base/include/private/
History log of /frameworks/base/include/private/
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
486590963e2207d68eebd6944fec70d50d41116a 01-Jun-2012 Chet Haase <chet@google.com> Skip eglSwapBuffers() call when we do not draw to GL

The fix is to track when we issue GL drawing commands, and to skip the
call to eglSwapBuffers() when a DisplayList does not result in
any actual rendering calls to GL.

Issue #6364143 QuickMuni list items and buttons flicker instead of fade

Change-Id: I60a02c61a58c32d92481a1e814b4c8a49c6a37a3
wui/DrawGlInfo.h
7b6a75872bd2df96a23453d31c2e2e7fcc373554 11-Apr-2012 Chet Haase <chet@google.com> Pass width/height parameters to webview

When webview draws into an fbo layer, it needs to know the
size of that surface to create the rendering transform appropriately.
This change copies in the current viewport size to the structure that
is passed to the webview.

Change-Id: I7160b0836d00834134c799c95a439cdc045e2035
wui/DrawGlInfo.h
8f3b8e32993d190a26c70c839a63d8ce4c3b16d9 28-Mar-2012 Romain Guy <romainguy@google.com> Allow fine-grained control over functors execution

Adds non-drawing execution mode

Change-Id: I82f92cf1b9a3b9ff2ca6d7427c4e02b73e04e6bf
wui/DrawGlInfo.h
d927a1d99630c05ff773f0e9e8791ca9a965e020 28-Mar-2012 James Dong <jdong@google.com> Deleted the media, camera, drm related files since they are relocated

Change-Id: I9bc5573ee07e30b305b5b879023aa9ec69e10b91
edia/AudioEffectShared.h
edia/AudioTrackShared.h
edia/VideoFrame.h
6554943a1dd6854c0f4976900956e556767b49e1 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
18db49a46259020387c40fff36d92edc1087a366 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
8c79817dc6459baa2c79db88e3c3e4d5c07d6a61 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
8335f1ccccedb6655d96d9d5b697a7f0938235dd 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
7d3916ff9cd464bd064a7e075c555f9ec6ff4349 26-Feb-2012 Mathias Agopian <mathias@google.com> libagl shouldn't export anything

Change-Id: Ia823dbc56aab2a0b8a6063df4348fe6baac124c6
pengles/gl_context.h
af01feafc30152baf8e0a5cfddbf02bd14731fd2 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
b3db213eb55acb661e4b9ea40bcc00af4b76fab9 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
d9d68dcb62760e561fadc061b593e8c76bce85d6 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
bc4de888c12f1ad9aec8c9b2a0addaaa73dceae9 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
0632bad8bad41bc44184596478ec2d203d52096f 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
8c17a2f0884527c3ce42a2c6dbd073014d179b53 17-Jan-2012 Glenn Kasten <gkasten@google.com> Merge "Use size_t for frame size"
4790bd8be850235e9c6f1acf1e1e6146ef2996b3 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
faf354dc7f8065a90174adb6e725603176f0044f 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
e5fb263a3625c0e6b4a9aefa86067bb9463dd06d 14-Dec-2011 Glenn Kasten <gkasten@google.com> Audio C++ comments

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

Change-Id: I1eb691f7ca263d5895d871ab675bb5826e0323c6
ui/ComposerService.h
34cb9f2a960c4173bdafb4b8a2444c1bca4c5f0d 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
c1b9bbb21c8ad5109978a4e9e770cd18b0257434 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
439863f3b3e725b5de1cba4940a21900369961c0 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
7bb843ca0777111dae7daf8f1b0705817cf523c4 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
993fccec5bd0355835f0457064a28c2c13eecc60 02-Jun-2011 Glenn Kasten <gkasten@google.com> Remove unnecessary level of priority indirection

Change-Id: I942d43973c20a7ace8b0d3f78b4da97e45e996c6
edia/AudioTrackShared.h
5439223b5633679edcc255651e7062046004d75d 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
6b85f173046340da7ccd503845a2950843f085f3 03-May-2011 Mathias Agopian <mathias@google.com> remove last traces of copybit

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

Change-Id: Ia608099a2426c11a91d33063ba53c93e1eccb428
pengles/gl_context.h
ae29b7632ecf2068698c0d121cff284dcc82f4ec 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
08aa2cbd5e62e7ca140f78f8bea0477a19880fd9 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
421ddc014b31478ba0ef115e098d8780a35af331 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
9f81547fc58736f317c0031cdce942e5d27ee2b6 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
1d4549ab0312319a79fb37068a3fc63bbb0a3adc 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
19f9eda28a1bd182a5f7bba9dde015b29ab04d25 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
6c925d00e131e40811897e0ddc332d6f5bc83178 02-Nov-2010 Jamie Gennis <jgennis@google.com> Implement reducing the buffer count of a Surface.

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

Change-Id: Ife0a2536aaac5ff1efdf1035b9d2c892773ee16c
edia/VideoFrame.h
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
urfaceflinger/SharedBufferStack.h
4712baab81d0b683bc22668d2278c9daff92797e 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
c9289fa1c4d3aeba5122863cdae7d0a9806d8833 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
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
urfaceflinger/SharedBufferStack.h
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
urfaceflinger/SharedBufferStack.h
46b9ac0ae2162309774a7478cd9d4e578747bfc2 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
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
urfaceflinger/SharedBufferStack.h
7623da435e45c7c03ef6a00a43675deb6645f070 02-Jun-2010 Mathias Agopian <mathias@google.com> split surface management from surface's buffers management

Change-Id: If3c5655d1231f8f0c49ba68f972b1b20c93b3f87
urfaceflinger/SharedBufferStack.h
65b65459e6ac59f8a257009df8014467ae0838ee 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
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
urfaceflinger/SharedBufferStack.h
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
urfaceflinger/SharedBufferStack.h
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
urfaceflinger/SharedBufferStack.h
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
urfaceflinger/SharedBufferStack.h
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
urfaceflinger/SharedBufferStack.h
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"
urfaceflinger/SharedBufferStack.h
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
urfaceflinger/SharedBufferStack.h
eb8f850d0b7e53956e917fd9645f808c1a09bc88 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
b0a0147f344a2d26d86be2b1bdf5bfde50ef86c2 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
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
urfaceflinger/SharedBufferStack.h
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
urfaceflinger/SharedBufferStack.h
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
urfaceflinger/SharedBufferStack.h
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
urfaceflinger/SharedBufferStack.h
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
urfaceflinger/SharedBufferStack.h
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
urfaceflinger/SharedBufferStack.h
000479f9e325b4e426a67033abd92d47da412725 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
e304bdd5ee5ed0b0d37fe388021c9cd138feda7f 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
d1f73a2fcae6481edf07763ca06c4f381ebe13c2 02-Feb-2010 Mathias Agopian <mathias@google.com> implement [2396050] Add ETC1 texture support to AGL
pengles/gl_context.h
36d0184e089831b74de6005f01da9e7b26679bb9 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
a8ac904d97a008b346390c87e74d44df39b0f320 16-Oct-2009 Mathias Agopian <mathias@google.com> fix [2182249] [MR1] valgrind error in surface flinger
i/RegionHelper.h
e05f07dffa196d6403733b26317faa9f267d518f 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
4961c959aebac31991fd7653853d47dfd79d3472 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
6f5f5a095a5a4d42fc656cf8c1e6d0f67594f88d 06-Oct-2009 Mathias Agopian <mathias@google.com> fix [2168531] have software-only gralloc buffer side-step the HAL
i/sw_gralloc_handle.h
6950e428feaccc8164b989ef64e771a99948797a 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
0c4cec7e4df87181486d280c98fba9c0f4774c37 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
bcef9ac35da08b9f7f8a4728af94c23a7a010669 17-Sep-2009 Mathias Agopian <mathias@google.com> add basic time stats for surfaces lock time
i/SharedBufferStack.h
bd8527110caa5427ade0edd7ce0d00e63f15ccbc 15-Sep-2009 Mathias Agopian <mathias@google.com> make sure to update the tail pointer when undoing a dequeue
i/SharedBufferStack.h
248b5bd51e325107f8119b564db6a06ac51c232a 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
436c627ca4228284caf363f0cb35947e58b841b9 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
9779b221e999583ff89e0dfc40e56398737adbb3 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
c0dea964913268bd64009e657635e617f3e0c21c 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
f233915016a9053c23af6e4bceb319e7140f71bc 14-Aug-2009 Mathias Agopian <mathias@google.com> be more friendly with C
i/android_natives_priv.h
a553c25b33c99b345cf1c8688f8df0ed8df14e5a 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
fb4f266a1b9f6a20e256d192a940ae4ccc510fad 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
b1c4ca5ad21ae63cd5af2cfc1be82ba176d25195 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
42a3265cfb93f28d977353b8fe7a8b350de09fd0 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
eb0ccd5c7ba5ea63f60a927b3e5e7f10bfacff48 07-Jul-2009 Mathias Agopian <mathias@google.com> add a virtual destructor to region_rasterizer, to be on the safe side
i/RegionHelper.h
fcc5be99e0497f25a12e77622c27b4de30e45b3d 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
88e209dcf8c2ebddda5c272f46d1bd5478bc639c 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
f31868e59fbf59a8d479587c80b648fb37a166fc 25-Jun-2009 Mathias Agopian <mathias@google.com> merge master in master_gl
ffa5a5a3dbef79dc6958c629080b1a6438a7b637 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()
aaf4b6b3315fc546396a4b82c8c5cab0c2d2cb85 23-Jun-2009 Mathias Agopian <mathias@google.com> add glTexParameteri() and fix glTexParameteriv()
pengles/gl_context.h
350d651706d8f484d9aeb539d491526f822fa84a 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
07fcf4c3a91e421dc6f3d17f28264d18e8b2bfdb 10-Jun-2009 Mathias Agopian <mathias@google.com> revive the copybit test.
i/SurfaceBuffer.h
eb22c5b358af775a5f1192fc248594c7a0025d56 05-Jun-2009 Mathias Agopian <mathias@google.com> cleanup Debug.h a bit
i/SharedState.h
947f4f4d384ea26eb2145cc070a3eed42c59534a 22-May-2009 Mathias Agopian <mathias@google.com> merge master to master_gl
0795272aa226f4e965968a03daddc53ce30b7cda 20-May-2009 Mathias Agopian <mathias@google.com> move libbinder's header files under includes/binder
inder/Static.h
tils/Static.h
25ba5b6564224dceefa086b5c439ef28dad530ca 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
6158b1bf0364da1582468a98ec09d004ba99deec 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
b51e18d59b6f8e44a5d3516fc3359c54fa913331 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
ac2523b161df2bb507cc88906bb070878266770d 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
6ead5d9f140529edfb744584fa5427b84b4dc13a 21-Apr-2009 Mathias Agopian <mathias@google.com> a brand new MessageQueue for SurfaceFlinger.
i/SurfaceFlingerSynchro.h
1473f46cbc82aa6f0ba744cc896a36923823d55b 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
105925376f8d0f6b318c9938c7b83ef7fef094da 19-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake_rel/...@140373
edia/AudioTrackShared.h
9066cfe9886ac131c34d59ed0e2d287b0e3c0087 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
d83a98f4ce9cfa908f5c54bbd70f03eec07e7553 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
d24b8183b93e781080b2c16c487e60d51c12da31 11-Feb-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@130745
pengles/gl_context.h
22f7dfd23490a3de2f21ff96949ba47003aac8f8 20-Jan-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@127101
edia/AudioTrackShared.h
9266c558bf1d21ff647525ff99f7dadbca417309 16-Jan-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@126645
pengles/gl_context.h
f013e1afd1e68af5e3b868c26a653bbfb39538f8 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
54b6cfa9a9e5b861a9930af873580d6dc20f773c 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