summaryrefslogtreecommitdiffstats
path: root/include/private
Commit message (Collapse)AuthorAgeFilesLines
* remove last traces of copybitMathias Agopian2011-05-021-16/+0
| | | | Change-Id: Ia0f13a0ee6f702256482b5eb29d7fa2aa840bfc7
* get rid of dependency on copybit HAL moduleMathias Agopian2011-04-281-2/+0
| | | | Change-Id: Ia608099a2426c11a91d33063ba53c93e1eccb428
* New fix for issue 4111672: control block flagsEric Laurent2011-04-051-4/+4
| | | | | | | | | | | | | | | 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
* Send WebView the current transform and whether we're drawing a layer.Romain Guy2011-03-171-0/+50
| | | | | | | | | Bug #3275491 These can be used by WebView to correctly apply alpha and geometric transforms. Change-Id: I2ecd4376d68df886dead3c9240317de33f56828f
* Fix issue 3439872: video chat and bluetooth SCOEric Laurent2011-03-081-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Add support for up to 32 buffers per SurfaceMathias Agopian2011-03-011-3/+3
| | | | | | Bug: 3488016 Change-Id: Ie5536ad77d42a4d0e8270e0fd87ecb73471bcbbc
* clean-up unneeded codeMathias Agopian2011-01-201-8/+1
| | | | | | | | | | 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
* fix [3259708] Graphic Buffer Mapper does not support YV12Mathias Agopian2010-12-081-83/+0
| | | | | | remove a bunch of a code that was there only to support broken gralloc implementations Change-Id: I3c1a9172224cbcc283601abfbbd695a20815451f
* Implement reducing the buffer count of a Surface.Jamie Gennis2010-11-111-0/+10
| | | | | Change-Id: I7f979c60c06d654aa8265002836277434bc1a64f Bug: 3095167
* Support extracting thumbnail from rotated video tracksJames Dong2010-11-081-0/+1
| | | | Change-Id: Ife0a2536aaac5ff1efdf1035b9d2c892773ee16c
* fix [2835280] Add support for cancelling buffers to ANativeWindowMathias Agopian2010-10-041-4/+6
| | | | | | | | | | 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
* Issue 3032913: improve AudioTrack recovery timeEric Laurent2010-09-301-2/+5
| | | | | | | | | | | | 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
* fix a race in SF buffer managementMathias Agopian2010-08-261-1/+5
| | | | | | also remove some unused code. Change-Id: Iae2c3309b7a08055f3e13a5b866c5c084993e352
* fix [2931513] Add support for setting the orientation of an ANativeWindowMathias Agopian2010-08-241-8/+10
| | | | | | Also implement support for cropping. Change-Id: Iba5888dd242bf2feaac9e9ce26e404c1f404c280
* fix [2873058] Surface::dequeueBuffer blocks on last buffer, i.e. cannot ↵Mathias Agopian2010-07-271-8/+0
| | | | | | | | | | | | | | | | | | | | | 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
* Native input dispatch rewrite work in progress.Jeff Brown2010-06-131-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* allow re-targetting of surfacesMathias Agopian2010-06-081-10/+6
| | | | | | | | | 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
* split surface management from surface's buffers managementMathias Agopian2010-06-041-1/+2
| | | | Change-Id: If3c5655d1231f8f0c49ba68f972b1b20c93b3f87
* Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack ↵Eric Laurent2010-06-032-1/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* more clean-up in preparation of bigger changesMathias Agopian2010-05-281-2/+1
| | | | | | | the most important change here is the renaming of ISurfaceFlingerClient to ISurfaceComposerClient Change-Id: I94e18b0417f50e06f21377446639c61f65f959b3
* fix [2712278] The preview buffer left some black borders in left and bottom ↵Mathias Agopian2010-05-251-1/+0
| | | | | | | | edges we were incorrectly flagging push_buffer surfaces as invalid Change-Id: I4dfd4ffbbe8a71f7e23e835db8d71966416c29bb
* added the notion of fixed-size buffersMathias Agopian2010-05-241-1/+2
| | | | | | | | | 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
* fix a bug when reallocating a window's buffers is neededMathias Agopian2010-05-241-0/+1
| | | | | | | we need to mark the buffers that need to be reallocated, NOT the buffer's indices. Change-Id: I809e2e1b03b56c4d2ab983c25523dae99aa1da74
* added native_window_set_buffer_count()Mathias Agopian2010-05-211-0/+1
| | | | | | | this method can be used to change the number of buffers associated to a native window. the default is two. Change-Id: I608b959e6b29d77f95edb23c31dc9b099a758f2f
* fix the threading issue for setBuffercount()Mathias Agopian2010-05-201-14/+29
| | | | | | | | 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"
* fix some bugs in SharedBufferStack::resizeMathias Agopian2010-05-171-4/+5
| | | | | | added buffers should now be labeled properly. Change-Id: I28aa753fbe89ab89134e7753575319478934c7fa
* Fix issue 2553359: Pandora does not work well with Passion deskdock / Cardock.Eric Laurent2010-05-171-11/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* AudioFlinger: rename variables to clarify reference to track channel count ↵Eric Laurent2010-05-141-1/+1
| | | | | | | | | | | 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
* SharedBufferStack now can grow up to 16 buffers.Mathias Agopian2010-05-121-3/+52
| | | | | | there is a new resize() api, which currently only allows growing. Change-Id: Ia37b81b73be466d2491ffed7f3a23cd8e113c6fe
* Add support for enqueuing buffers in arbitrary orderMathias Agopian2010-04-281-1/+3
| | | | | | Also added a very simple SharedBufferStack unit test. Change-Id: I253dbbe98a53c966b78d22d4d6dd59f8aefc8c40
* cleanup. waitForCondition() now uses polymorphsim instead of templtesMathias Agopian2010-04-281-49/+10
| | | | | | | | | 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
* fix a race condition in undoDequeue(), where 'tail' could be computed ↵Mathias Agopian2010-04-281-2/+2
| | | | | | | | | | | | | | | 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
* added setCrop() to android_native_window_tMathias Agopian2010-04-201-9/+20
| | | | | | | hooked up the new method up to Surface.cpp the actual crop is not implemented in SF yet Change-Id: Ic6e313c98fd880f127a051a0ccc71808bd689751
* add support for up to 16 buffers per surfaceMathias Agopian2010-04-201-8/+12
| | | | | | | also increase the dirtyregion size from 1 to 6 rectangles. Overall we now need 27KiB process instead of 4KiB Change-Id: Iebda5565015158f49d9ca8dbcf55e6ad04855be3
* split libsurfaceflinger_client and libcamera_client out of libuiMathias Agopian2010-02-112-7/+8
|
* fix [2133133] Software OpenGL ES Lighting is buggy (GL Gears washed out bug)Mathias Agopian2010-02-031-2/+2
| | | | | | | | | | 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).
* implement [2396050] Add ETC1 texture support to AGLMathias Agopian2010-02-021-1/+6
|
* fix[2228133] pixelflinger ignores the "vertical stride" leading to artifacts ↵Mathias Agopian2009-11-021-1/+3
| | | | | | | | 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.
* fix [2182249] [MR1] valgrind error in surface flingerMathias Agopian2009-10-151-6/+9
|
* fix [2170319] gmail bulk operation checkbox latency on passionMathias Agopian2009-10-072-48/+1
| | | | | | | | | | | | | | | 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.
* fix [2152536] ANR in browserMathias Agopian2009-10-061-7/+13
| | | | | | | | | | | | | | | | 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.
* fix [2168531] have software-only gralloc buffer side-step the HALMathias Agopian2009-10-061-0/+83
|
* fix [2167050] glTexImage2D code path buggy in SurfaceFlingerMathias Agopian2009-10-062-127/+1
| | | | | | | | | | | | | | 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.
* Attempt to fix [2152536] ANR in browserMathias Agopian2009-10-021-7/+9
| | | | | | | | | | | 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.
* add basic time stats for surfaces lock timeMathias Agopian2009-09-171-8/+20
|
* make sure to update the tail pointer when undoing a dequeueMathias Agopian2009-09-141-0/+2
|
* fix [2112575] stuck on DequeueCondition for a surface that doesn't exist anymoreMathias Agopian2009-09-101-2/+3
| | | | this also fixes part of [2111536] Device is soft rebooted after ending the call through voice dialer
* make sure conditions will return when the status of a surface is not NO_ERRORMathias Agopian2009-09-101-4/+12
|
* fix [2068105] implement queueBuffer/lockBuffer/dequeueBuffer properlyMathias Agopian2009-09-074-156/+331
| | | | | | | | | | | | | | | 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
* Calculate specular lighting correctlyMartin Storsjo2009-08-251-0/+1
| | | | | | 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.