Commit Graph

660 Commits

Author SHA1 Message Date
Mathias Agopian
495c1be363 am d8c752ef: Merge change Ib548dbb2 into eclair
Merge commit 'd8c752ef74bc6d8b412defe35caf1a19be15eb8b' into eclair-mr2

* commit 'd8c752ef74bc6d8b412defe35caf1a19be15eb8b':
  improve video performance to minimize the tearing effect seen in 720p movies
2009-12-10 16:43:09 -08:00
Mathias Agopian
8f03b47432 fix [2319255] crash in openGL : from the media recorder stress test.
never call eglCreateImageKHR() with a NULL native buffer, which can
happen in OOM conditions.
2009-12-10 15:59:08 -08:00
Kenny Root
ccb5b89029 Add string resource type inspection
Allows "aapt dump --values resource" to print out whether a string in a
ResStringPool is in UTF-8 or UTF-16 encoding.

Change-Id: I6478884a70a3b46fee862dece6cb33454fc34843
2009-12-10 14:22:08 -08:00
Mathias Agopian
c5e181f8b3 fix [2315900] Monochrome camera preview screen after launching camera
this was introduced by a recent change. when we try to figure out the size of
the yuv->rgb temporary buffer, the output resolution has not been computed yet
and an invalid buffer size is used. most of the time the allocation fails
and the system reverts to "standard" GL will uses onle the Y plane.

the allocation of the temporary buffer is moved to onDraw(), the first
time it is called, by that time, the window is positioned properly.
2009-12-09 15:26:29 -08:00
Dianne Hackborn
d0aeccebe2 Maybe really fix windows build. 2009-12-08 19:45:59 -08:00
Mathias Agopian
69ff5de1b7 improve video performance to minimize the tearing effect seen in 720p movies
always rescale videos to their target size using copybit during yuv->rgb
conversion. this improves performance of the GPU pass and doesn't require
linear filtering to be enabled. Also always use 16-bits buffers.

the average processing time for 720p dropped from ~50ms to ~30ms
2009-12-08 19:29:38 -08:00
Dianne Hackborn
c5b138995e Hopefully fix Windows build 2009-12-08 16:38:01 -08:00
Android (Google) Code Review
eb318fd88d Merge change I129483f8 into eclair-mr2
* changes:
  Optional use of UTF-8 strings in resource bundles
2009-12-08 13:41:38 -08:00
Dianne Hackborn
8c6cedc9bc Propagate background scheduling class across processes.
This is a very simply implementation: upon receiving an IPC, if the handling
thread is at a background priority (the driver will have taken care of
propagating this from the calling thread), then stick it in to the background
scheduling group.  Plus an API to turn this off for the process, which is
used by the system process.

This also pulls some of the code for managing scheduling classes out of
the Process JNI wrappers and in to some convenience methods in thread.h.
2009-12-07 19:11:14 -08:00
Kenny Root
92f5984d2c Optional use of UTF-8 strings in resource bundles
Allows the use of UTF-8 for packing resources instead of the
default of UTF-16 for Java. When strings are extracted from the
ResStringPool, they are converted to UTF-16 and the result is
cached for subsequent calls.

When using aapt to package, add in the "-8" switch to pack the
resources using UTF-8. This will result in the value, key, and
type strings as well as the compiled XML string values taking
significantly less space in the final application package in
most scenarios.

Change-Id: I129483f8b3d3b1c5869dced05cb525e494a6c83a
2009-12-07 15:14:15 -08:00
Eric Laurent
7749a90e1e am 0a08029f: Fix issue 2306779: Runtime restart - Init failed at android.media.ToneGenerator.
Merge commit '0a08029fc9a370c6ef2a2a6fd1d800d9159b61f8' into eclair-mr2

* commit '0a08029fc9a370c6ef2a2a6fd1d800d9159b61f8':
  Fix issue  2306779: Runtime restart - Init failed at android.media.ToneGenerator.
2009-12-07 12:36:30 -08:00
Eric Laurent
fed9382a6a Fix issue 2306779: Runtime restart - Init failed at android.media.ToneGenerator.
The ToneGenerator failed to initialize because no more tracks were available in AudioFlinger mixer.

All tracks were used because the duplicating output was failing to free the tracks on audio hardware output mixer when exiting due to a misplaced test on output activity: output tracks where only freed if the duplicating output was active when exiting.

The fix consists in freeing the output tracks when the duplicating thread is destroyed without condition.
2009-12-07 12:30:22 -08:00
Eric Laurent
8aaf9a21bc am 6d42d806: Merge change I9cc489a2 into eclair
Merge commit '6d42d80653f2c41f3e72a878a1d9a6f9693b89f7' into eclair-mr2

* commit '6d42d80653f2c41f3e72a878a1d9a6f9693b89f7':
  Fix issue 2304669: VoiceIME: starting and canceling voice IME yields persistent "error 8" state on future attempts and breaks voice search.
2009-12-07 11:03:17 -08:00
Android (Google) Code Review
0aa2563bb7 Merge change I9cc489a2 into eclair
* changes:
  Fix issue 2304669: VoiceIME: starting and canceling voice IME yields persistent "error 8" state on future attempts and breaks voice search.
2009-12-07 11:00:54 -08:00
Eric Laurent
5291095089 Fix issue 2304669: VoiceIME: starting and canceling voice IME yields persistent "error 8" state on future attempts and breaks voice search.
Fixed AudioFlinger::openInput() broken in change ddb78e7753be03937ad57ce7c3c842c52bdad65e
so that an invalid IO handle (0) is returned in case of failure.
Applied the same correction to openOutput().
Modified RecordThread start procedure so that a failure occuring during the first read from audio input stream is detected and causes
the record start to fail.
Modified RecordThread stop procedure to make sure that audio input stream fd is closed before we exit the stop function.

Fixed AudioRecord JAVA and JNI implementation to take status of native AudioRecord::start() into account
and not change mRecordingState to RECORDSTATE_RECORDING if start fails.
2009-12-07 05:37:47 -08:00
Dima Zavin
0fe8a9bc4b am 0019215f: Revert "When using MDP, we needed to use a texture for diming."
Merge commit '0019215fc395ef12c191049b1903eeabf70859cf' into eclair-mr2

* commit '0019215fc395ef12c191049b1903eeabf70859cf':
  Revert "When using MDP, we needed to use a texture for diming."
2009-12-07 01:36:26 -08:00
Dima Zavin
a9ec9be195 Revert "When using MDP, we needed to use a texture for diming."
This reverts commit bf0c320afbf6bf2441916755ecb443b64afbe73f.
2009-12-07 00:17:06 -08:00
Erik Gilling
19b18d75fe am cef8d031: Merge change I00d0b54a into eclair
Merge commit 'cef8d031e842b773bbd6481b517996a185391e92' into eclair-mr2

* commit 'cef8d031e842b773bbd6481b517996a185391e92':
  surfaceflinger: remove un-cached buffer hack for SGX
2009-12-03 15:35:55 -08:00
Erik Gilling
1bd48776eb surfaceflinger: remove un-cached buffer hack for SGX
Signed-off-by: Erik Gilling <konkers@android.com>
2009-12-03 14:09:31 -08:00
Mathias Agopian
fd70b7f335 am 121a31ac: Merge change Id86beb99 into eclair
Merge commit '121a31ac3901fcb81c808da2b4a9a7cf66c12b7c' into eclair-mr2

* commit '121a31ac3901fcb81c808da2b4a9a7cf66c12b7c':
  fix [2291418] Camera preview cannot work in Emulator
2009-12-02 17:50:45 -08:00
Mathias Agopian
3e8a81e354 fix [2291418] Camera preview cannot work in Emulator
The image buffer used by glTexImage2d() would be uninitialized when no copybit engine
can be found.
We now always initialize images, since the abscence of copybit is not necessarily fatal.
2009-12-02 16:23:11 -08:00
Eric Laurent
b598e9f38d am 1ac56b60: Merge change Iac196e17 into eclair
Merge commit '1ac56b602aa6a1ac54c608e5a8b76f44638db23b' into eclair-mr2

* commit '1ac56b602aa6a1ac54c608e5a8b76f44638db23b':
  Fix issue 2292062: Audio freezes for three seconds when choosing ringtones with a headset connected and music playing.
2009-12-02 09:48:52 -08:00
Mathias Agopian
ca8fa5a7bf am 33ad0f9e: Merge change I0e44976a into eclair
Merge commit '33ad0f9ec8d47660b16ced45242a45f369fe2547' into eclair-mr2

* commit '33ad0f9ec8d47660b16ced45242a45f369fe2547':
  fix [2297155] SurfaceFlinger's freeze-timeout doesn't work
2009-12-02 09:47:48 -08:00
Android (Google) Code Review
9e50912d68 Merge change Iac196e17 into eclair
* changes:
  Fix issue 2292062: Audio freezes for three seconds when choosing ringtones with a headset connected and music playing.
2009-12-01 22:39:33 -08:00
Mathias Agopian
0408772e34 fix [2297155] SurfaceFlinger's freeze-timeout doesn't work
There was bug in the logic that calculated the relative timeout, the start time was
reset each time an event was received, which caused the timeout to never occur if
an application was constantly redrawing.

Now we always check for a timeout when we come back from the waitEvent() and
process the "anti-freeze" if needed, regardless of whether an event was received.
2009-12-01 17:23:28 -08:00
Mathias Agopian
5f1cc4826c am 8e4a110b: Merge change I5469a4ac into eclair
Merge commit '8e4a110b3e146b30b804d7e2cd0825bf56bd7d0f' into eclair-mr2

* commit '8e4a110b3e146b30b804d7e2cd0825bf56bd7d0f':
  fixed [2260070] display stopped updating
2009-12-01 17:10:08 -08:00
Eric Laurent
d3fc8ac6c5 Fix issue 2292062: Audio freezes for three seconds when choosing ringtones with a headset connected and music playing.
The problem comes from a deadlock with AudioPolicyService mutex: When the second ringtone starts,
this mutex is locked by AudioPolicyService::startOutput() which in turn calls setParameters() to change the output device.
Audioflinger::ThreadBase::setParameters() signals the parameter change to the AudioFlinger mixer thread and waits for a condition
indicating that the parameter change has been processed.
At the same time, the mixer thread detects that the audio track corresponding to the first ring tone has been killed and calls its destructor.
This calls AudioPolicyService::releaseOutput() which tries to lock the AudioPolicyService mutex.
If this happens before the mixer thread can process the setParameters() command we are deadlocked.
The deadlock ends because setParameters() uses a timeout when waiting for the condition.

This regression was introduced by change 33736 fixing issue 2265163.

The fix consists in calling AudioPolicyService::releaseOutput() from Track::destroy() instead of from Track destructor: as detroy() is never called from the mixer thread loop (as opposed to the destructor) the deadlock described above cannot occur.
2009-12-01 02:17:41 -08:00
Mathias Agopian
c61de17f14 fixed [2260070] display stopped updating
always check that the visible region isn't empty after all visible regions are recomputed
clear he freeze-lock if it is.
2009-11-30 11:15:41 -08:00
Eric Laurent
760971d097 Fix A2dpAudioInterface getParameters.
A2dpAudioInterface::getParameters() was prepending a ';' to the key value pair returned from underlying AudioHardwareInterface.
2009-11-25 06:08:44 -08:00
Mathias Agopian
2f0a0a58f6 When using MDP, we needed to use a texture for diming. 2009-11-23 22:41:36 -08:00
Android (Google) Code Review
151f4f6027 Merge change I49f02be9 into eclair
* changes:
  Issue 2265163: Audio still reported routed through earpiece on sholes
2009-11-21 00:18:24 -08:00
Dianne Hackborn
7b92d7ec36 Debugging for issue #2228381 android.view.InflateException
Binary XML file line #37: Error inflating class <unknown> after adding a secondary account

Now that I have these debug logs, I want to keep them since they will make
debugging these kinds of issues a lot easier in the future.  (Note in this
case there was no problem in the framework.)

Change-Id: If2b0bbeda4706b7c5dc1ba4a5db04b74f40e1543
2009-11-20 14:26:42 -08:00
Eric Laurent
09b4ba82d7 Issue 2265163: Audio still reported routed through earpiece on sholes
This is a second attempt to fix the audio routed to earpiece syndrom.
The root cause identified this time is the crash of an application having an active AudioTrack playing on the VOICE_CALL stream type.
When this happens, the AudioTrack destructor is not called and the audio policy manager is not notified of the track stop.
Results a situation where the VOICE_CALL stream is considered as always in use by audio policy manager which makes that audio is routed to earpiece.

The fix consists in moving the track start/stop/close notification to audio policiy manager from AudioTrack to AudioFlinger Track objet.
The net result is that in the case of a client application crash, the AudioFlinger TrackHandle object (which implements the remote side of the IAudioTrack binder interface) destructor is called which in turn destroys the Track object and we can notify the audio policy manager of the track stop and removal.

The same modification is made for AudioRecord although no bug related to record has been reported yet.
Also fixed a potential problem if record stop is called while the record thread is exiting.
2009-11-19 23:57:45 -08:00
Mathias Agopian
60f5d3694b backout a workaround that is not needed anymore
we had to add a call to glFinish() before glReadPixels() because of a bug in the GL ES
driver of a certain device. This is not needed anymore.
2009-11-19 15:52:28 -08:00
Mathias Agopian
713795a2e0 fix [2269022] The raw picture displayed post shutter seems to have low-resolution
Make sure to always enable linear filtering in LayerBuffer. This change doesn't affect
devices using overlays.
2009-11-19 14:46:26 -08:00
Mathias Agopian
9e911efc10 fix [2262591] Junk on screen in ERD46
since we're using the GPU for composition, don't use a texture for dimming,
instead simply use an alpha-blended quad.

also workaround what looks like a GL driver bug by calling glFinish() before
glReadPixels().
2009-11-16 14:55:36 -08:00
Mathias Agopian
dcaf29af10 addresses several bugs: 2206097, 2166583, 2261119, 2216759
2206097: Broken suggestions while composing message
2166583: Color artifacts with MDP dithering
2261119: Passion transition animations are rough
2216759: Screen flicker when dropdown list in background window shows or hides

This is part of enabling GPU composition instead of using the MDP. This change
is dependent on another change in the vendor project.

Specifically this change disables the use of EGLImageKHR for s/w buffers
for cache coherency reasons. memcpy is used instead.
2009-11-13 18:54:14 -08:00
Mathias Agopian
963abad79a fix some aspects of [2258746] native crash in launcher2
Surface::validate() could sometimes dereference a null pointer before checking it wasn't null.
This will prevent the application to crash when given bad parameters or used incorrectly.
However, the bug above probably has another cause.
2009-11-13 15:26:29 -08:00
Android (Google) Code Review
0b9285e707 Merge change Iad79689a into eclair
* changes:
  Improvements for issue 2197683:	English IME key-press latency is noticeably higher on passion than sholes
2009-11-12 22:53:28 -08:00
Rebecca Schultz Zavin
c0c1092183 Modify the binder to request 1M - 2 pages instead of 1M. The backing store
in the kernel requires a guard page, so 1M allocations fragment memory very
badly.  Subtracting a couple of pages so that they fit in a power of
two allows the kernel to make more efficient use of its virtual address space.

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
2009-11-12 16:31:12 -08:00
Android (Google) Code Review
ad55651fe7 Merge change I31c52bef into eclair
* changes:
  Revert change incorrectly submitted as part of change #32153.
2009-11-12 13:37:30 -08:00
Mathias Agopian
bbc21b01cf fix [2143798] Need to figure out how to do video on Passion w/ GPU
This builds on the EGLImage solution. We simply use copybit to convert from the
YUV frame into an EGLImage created for that purpose and proceed with the
regular EGLImage code.
We need to do this because "regular" GL doesn't support YUV textures.

We could improve upon this by detecting exacly what the GL supports and bypass
this extra step if not required, but we'll do this later if needed.
2009-11-11 16:44:43 -08:00
Eric Laurent
0e49d35fa4 Improvements for issue 2197683: English IME key-press latency is noticeably higher on passion than sholes
This change goes with a kernel driver change that reduces the audio buffer size from 4800 bytes (~27ms) to 3072 bytes (~17ms).
- The AudioFlinger modifcations in change 0bca68cfff161abbc992fec82dc7c88079dd1a36 have been removed: the short sleep period was counter productive when the AudioTrack is using the call back thread as it causes to many preemptions.
- AudioFlinger mixer thread now detects long standby exit time and in this case anticipates start by writing 0s as soon as a track is enabled even if not ready for mixing.
- AudioTrack::start() is modified to start call back thread before starting the IAudioTrack so that thread startup time is masked by IAudioTrack start and mixer thread wakeup time.
2009-11-11 12:13:27 -08:00
Eric Laurent
7b57085a73 AudioFlinger: delete Track object when createTrack() fails due to lack of tracks in AudioMixer.
This problem was encountered as a side effect of issue 2245298.
2009-11-09 04:45:39 -08:00
Android (Google) Code Review
5dc4fb0849 Merge change Ifb9d6df3 into eclair
* changes:
  More log for issue 2242381.
2009-11-08 22:58:34 -08:00
Christopher Tate
07d69893e1 Reset binder service threads' cgroup/priority after command completion
To prevent buggy command implementations from poisoning binder threads'
scheduling class & priority for future command execution, we now reset the
cgroup and thread priority to foreground/normal when a binder service thread
finishes executing the designated command.

Change-Id: Ibc0ab2485751453f6dc96fdb4eb877fd02796e3f
2009-11-08 14:29:02 -08:00
Eric Laurent
ee47d43ed3 More log for issue 2242381.
Added more log in system dump for AudioFlinger and AudioPolicyService to help debug issue 2242381 and other issues where the audio driver hangs.
2009-11-07 01:18:20 -08:00
Evan Millar
6dfe8f1ffa Revert jparks code from IPCThreadState. 2009-11-06 11:25:23 -08:00
Romain Guy
092fa4beaf Revert change incorrectly submitted as part of change #32153.
Change-Id: I31c52beff03c0d038a257fc151eff3b8da60eddc
2009-11-05 15:49:22 -08:00
Romain Guy
471afca7fc Prevent crash in Home when using widgets whose ids collide with Home's
resources.

Bug #2228943.

Approved by mcleron, triaged by ryanpc.

Change-Id: Idf40f3b09502ae5d0d3b9a6a72c265a2de2ffca2
2009-11-05 15:40:35 -08:00
Jason Parks
b5c4135333 When a thread is about to be put back onto the thread pool ensure that it is in the foreground cgroup. 2009-11-04 14:25:26 -08:00
Android (Google) Code Review
f19995856d Merge change If2fdad3b into eclair
* changes:
  Add a warning when we leave threads in the binder thread pool in the background scheduling group.
2009-11-03 16:29:22 -05:00
Jason Parks
dcd3958c50 Add a warning when we leave threads in the binder thread pool in the background scheduling group. 2009-11-03 13:10:15 -08:00
Eric Laurent
7f698b4c5c Log for issue 2203561.
Implemented AudioPolicyService dump().
Added detailed dump for AudioPolicyManageriGeneric when AudioPolicyService is dumped.
2009-11-03 09:33:35 -08:00
Android (Google) Code Review
368ad53c54 Merge change I36d0184e into eclair
* changes:
  fix[2228133] pixelflinger ignores the "vertical stride" leading to artifacts when playing back video
2009-11-02 21:26:54 -05:00
Mathias Agopian
6fee064809 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.
2009-11-02 17:48:33 -08:00
Dima Zavin
d7f53e1945 libbinder: MemoryHeapPmem: honor the NO_CACHING flag when creating a client heap
Change-Id: Ia7beb800f5a24beaa4b7f3032b486d4ed1991b23
Signed-off-by: Dima Zavin <dima@android.com>
2009-11-02 16:36:45 -08:00
Android (Google) Code Review
1bd16a1511 Merge change Ibaef6141 into eclair
* changes:
  libbinder: add a NO_CACHING flag to MemoryHeapBase
2009-11-02 17:55:43 -05:00
Eric Laurent
134aa9c942 Fix issue 197683: English IME key-press latency is noticeably higher on passion than sholes. Part 2.
Reduce sleep time in AudioFlinger mixer thread when no data has been written to output to speed up startup time when  exiting standby.

The rest of the modifications for this issues is in kernel driver:
 commit 0dbb0ee136ed8de757df1ae26d84556c1751deae for buffer size modification from 8192 to 4800 bytes.
Another kernel improvement that is not submitted yes will reduce delay when audio output is exiting standby.
2009-11-02 00:13:56 -08:00
Iliyan Malchev
0db1a8931b libbinder: add a NO_CACHING flag to MemoryHeapBase
The NO_CACHING flag translates to opening a memory region with O_SYNC.

Signed-off-by: Iliyan Malchev <malchev@google.com>
2009-10-30 18:35:47 -07:00
Android (Google) Code Review
fa4c9b8af8 Merge change Id8b28e4f into eclair
* changes:
  fix [2225964] Android runtime restarted in surfaceflinger/BlurFilter.cpp
2009-10-30 17:54:16 -04:00
Android (Google) Code Review
bd5a0027f4 Merge change I56779290 into eclair
* changes:
  fix[2222341] Soft reset while going back from camcorder settings
2009-10-30 17:54:10 -04:00
Android (Google) Code Review
b4d8fbb1a7 Merge change If007a2fa into eclair
* changes:
  return proper error code from eglCreateImageKHR
2009-10-30 17:54:03 -04:00
Mathias Agopian
863e5fdde8 fix[2222341] Soft reset while going back from camcorder settings
add a way to convert a mapped "pushbuffer" buffer to a gralloc handle
which then can be safely used by surfaceflinger, without including
gralloc_priv.h
2009-10-30 14:48:50 -07:00
Andy McFadden
550a11455a DO NOT MERGE: Another gcc 4.0.3 workaround.
Temporarily make a function public that doesn't need to be.  When
host gcc-4.0.3 is gone from the build servers we can undo this.

(Cherry-picked from eclair-mr2.)
2009-10-30 10:24:06 -07:00
Mathias Agopian
8889a8183c fix [2225964] Android runtime restarted in surfaceflinger/BlurFilter.cpp
crash was due to an unintialized variable, which caused the wrong bluring
format to be used and caused a memory overrrun.
2009-10-29 20:24:44 -07:00
Mathias Agopian
df2d929405 return proper error code from eglCreateImageKHR 2009-10-29 16:45:41 -07:00
Mathias Agopian
54ba51dff2 fix [2143798] Need to figure out how to do video
Use EGLImageKHR instead of copybit directly.
    We now have the basis to use streaming YUV textures (well, in fact
    we already are). When/if we use the GPU instead of the MDP we'll
    need to make sure it supports the appropriate YUV format.

    Also make sure we compile if EGL_ANDROID_image_native_buffer is not supported
2009-10-27 13:13:29 -07:00
Android (Google) Code Review
730ab0bc3b Merge change Icf10db28 into eclair
* changes:
  Fix issue 2192181: AudioFlinger must provide separated methods to set VOICE_CALL stream volume and down link audio volume.
2009-10-24 04:32:28 -04:00
Mathias Agopian
57720c384a fix [2211532] improves sholes graphics performance
Instead of using glTex{Sub}Image2D() to refresh the textures, we're using an EGLImageKHR object
backed up by a gralloc buffer. The data is updated using memcpy(). This is faster than
glTex{Sub}Image2D() because the texture is not swizzled. It also uses less memory because
EGLImageKHW is not limited to power-of-two dimensions.
2009-10-23 15:37:28 -07:00
Eric Laurent
63da2b65f9 Fix issue 2192181: AudioFlinger must provide separated methods to set VOICE_CALL stream volume and down link audio volume.
Added setVoiceVolume() method to AudioSystem, AudioFlinger, IAudioFlinger, AudioPolicyService.
Removed call to AudioHardwareInterface::setVoiceVolume() from AudioFlinger::setStreamVolume().
2009-10-21 12:29:37 -07:00
Mathias Agopian
38a7fa2ae3 fix [2182249] [MR1] valgrind error in surface flinger 2009-10-15 18:08:15 -07:00
Eric Laurent
2115412564 Fix issue 2174002: After rejecting Call when device ringtone is mute and playing music, audio is not transfered to BT device.
Added a workarouond to request the A2DP output standby directly to audio hardware when the sink is suspended as it seems that the suspend request often fails.

Also take into account resume requests received while a suspend request is pending.
2009-10-08 12:03:51 -07:00
Android (Google) Code Review
c3f90813a1 Merge change I46b2df15 into eclair
* changes:
  fix [2164183] sometimes device just wants to stay asleep
2009-10-07 21:09:49 -04:00
Mathias Agopian
d3144beec6 fix [2170283] SurfaceFlinger crashes on OOM.
when running out of memory, a null handle is returned but the error code may not be set.
In that case we need to return NO_MEMORY instead of NO_ERROR, so that the calling code
won't try to dereference the null pointer.
2009-10-07 18:03:35 -07:00
Mathias Agopian
8f2d505216 fix [2164183] sometimes device just wants to stay asleep
When switching rapidily orientation back and forth, surfaces end-up
acquiring the freeze-lock when the first orientation change happens,
but never release it because by the time the 2nd orientation change
comes in, the surface size is back to its original size and
doesn't appear to have resized.

we now always release the freeze-lock when we receive a buffer of the
expected size.
2009-10-07 17:58:29 -07:00
Mathias Agopian
e700501d0e 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.
2009-10-07 16:44:10 -07:00
Mathias Agopian
67838bc112 Revert "temporarily disable the use of glTexImage2D for sw buffers on sholes."
This reverts commit c131c5671965b69b0dee3e4afa3b3dd5e3c0c405.

Approved by Hiroshi
2009-10-06 22:23:23 -07:00
Android (Google) Code Review
c87104f17c Merge change I4961c959 into eclair
* changes:
  fix [2152536] ANR in browser
2009-10-06 22:10:17 -04:00
Mathias Agopian
9ec430adae 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.
2009-10-06 19:00:57 -07:00
Eric Laurent
f5e868baf9 Fix issue 2139634: DTMF tones on Sholes popping, hissing (audio latency too high).
This change is a complement to the main fix in kernel driver for the same issue (partner change #1250).
It removes clicks sometimes heard after the end of the tones while audio flinger is sending 0s to the audio output stream.
The problem was that the sleep time between two writes was more than the duration of one audio output stream buffer which could cause some underrun.

Also fixed a recent regression in ToneGenerator that made that the end of previous tone was repeated at the beginning of current one under certain timing circumstances when the maximum tone duration was specified.
2009-10-06 18:59:35 -07:00
Mathias Agopian
cfc7010ef8 temporarily disable the use of glTexImage2D for sw buffers on sholes.
we're going to first cut a build without this change.

Approved by Dr. Hiroshi.
2009-10-06 17:59:43 -07:00
Mathias Agopian
a4b740ed89 fix [2168528] enable glTexImage2D code path in SF for software-only buffers 2009-10-06 17:24:26 -07:00
Mathias Agopian
b26af23744 fix [2168531] have software-only gralloc buffer side-step the HAL 2009-10-06 17:00:25 -07:00
Mathias Agopian
3330b20303 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.
2009-10-06 17:00:25 -07:00
Wu-cheng Li
e6a550d02f Add zoom functions and sendCommand.
b2060030
2009-10-06 13:25:10 -07:00
Mathias Agopian
0b3ad46a26 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.
2009-10-02 18:12:30 -07:00
Christopher Tate
e7e1009636 Turn off most of the backup-related debug logging
The core logging in BackupManagerService and in the Google backup transport are
still enabled at this point.

Change-Id: I10abfa565bbd1097dd3631051b6aca163e4af33a
2009-09-30 17:07:37 -07:00
Android (Google) Code Review
2b2888c356 Merge change Ibe2085be into eclair
* changes:
  Fix issue 2153835: AudioFlinger: setParameters() can remain stuck if output thread is terminated.
2009-09-30 19:19:36 -04:00
Mathias Agopian
448f015966 attempt to work around [2155085, 2150246] stuck in closeTransaction() 2009-09-30 15:15:07 -07:00
Eric Laurent
2d70c80a7f Fix issue 2153835: AudioFlinger: setParameters() can remain stuck if output thread is terminated.
Wait for the parameter set completed condition with a time out in ThreadBase::setParameters().
Also lock AudioFlinger mutex before accessing thread list in AudioFlinger::setParameters() and keep a strong reference
on the thread being used in case it is exited while processing the request.
2009-09-30 14:48:20 -07:00
Android (Google) Code Review
68624f2aa5 Merge changes I8851617a,Ie1b6f244,I70cab912,Ibd23e30d into eclair
* changes:
  fix [2152247] Windows sometimes drawn scaled up.
  invalidate the surface when the physical changes
  introduce the notion of the requested size in the Layer state
  remove unused code
2009-09-30 17:27:18 -04:00
Android (Google) Code Review
75ed8b360a Merge change I45094a34 into eclair
* changes:
  remove dead code
2009-09-30 17:12:01 -04:00
Mathias Agopian
df3e0b934f fix [2152247] Windows sometimes drawn scaled up. 2009-09-30 14:07:22 -07:00
Mathias Agopian
6656dbc812 invalidate the surface when the physical changes 2009-09-30 12:48:47 -07:00
Dave Sparks
8a95a45fd9 Reduce the log spew from AudioFlinger due to a certain device that can't meet latency timing. Bug 2142215. 2009-09-30 03:09:03 -07:00
Mathias Agopian
7e4a587f60 introduce the notion of the requested size in the Layer state 2009-09-29 22:44:28 -07:00
Mathias Agopian
ba6be54876 remove unused code 2009-09-29 22:32:36 -07:00
Mathias Agopian
85ec55f8f5 remove dead code 2009-09-29 15:26:42 -07:00
Wu-cheng Li
eb16a09f59 Change FLASH_MODE_VIDEO_LIGHT to FLASH_MODE_TORCH. 2009-09-28 13:51:59 -07:00
Mathias Agopian
8a77baaa11 don't emit GL commands when sf is in freeze mode
We were emitting GL commands, calling composition complete and releasing clients
without ever calling eglSwapBuffers(), which is completely wrong on non-direct
renders. This could cause transient drawing artifacts when unfreezing the
screen (upon orientaion change for instance) and could also block the clients
for ever as they are waiting for their previous buffer to be rendered.
2009-09-27 22:47:32 -07:00
Android (Google) Code Review
ff5054c81e Merge change 27375 into eclair
* changes:
  Allways dump the list of allocated buffers when an allocation fails.
2009-09-27 21:47:29 -04:00
Mathias Agopian
737e786acf Allways dump the list of allocated buffers when an allocation fails.
Hopefully this will help us understand cases of failures such as [2148405]
2009-09-27 18:44:09 -07:00
Doug Zongker
a4f58892d4 fix "pacakge" typo in error log message 2009-09-27 17:03:12 -07:00
Wu-cheng Li
cc6ce203be Add camera parameter key constants and documentation. 2009-09-25 14:23:56 -07:00
Mathias Agopian
95a666b0e0 minor SurfaceFlinger code cleanup and remove unnecessary tests 2009-09-24 14:57:26 -07:00
Christopher Tate
6e472890ef Clear the device's data from the transport when backup is disabled
Turning off backup in the Settings UI constitutes an opt-out of the whole
mechanism.  For privacy reasons we instruct the backend to wipe all of the data
belonging to this device when the user does this.  If the attempt fails it is
rescheduled in the future based on the transport's requestBackupTime()
suggestion.  If network connectivity changes prompt the transport to indicate a
backup pass is appropriate "now," any pending init operation is processed before
the backup schedule is resumed.

The broadcasts used internally to the backup manager are now fully protected;
third party apps can neither send nor receive them.

(Also a minor logging change; don't log 'appropriate' EOF encountered during
parsing of a backup data stream.)
2009-09-24 11:19:04 -07:00
Mathias Agopian
401c257fba turn dithering off if it's not needed 2009-09-23 19:16:27 -07:00
Mathias Agopian
a2fe0a234b fix [2142193] disable GL_LINEAR when not needed 2009-09-23 18:55:02 -07:00
Mathias Agopian
8c0a3d75c8 fix [2133214] STOPSHIP: revert I4a06bb4f: workaround for [2113743] Sholes: frozen then runtime restart going to list view
Revert "workaround for [2113743] Sholes: frozen then runtime restart going to list view"

This reverts commit 4a06bb4f3355b0ef2b76aa883704da9d154c44ae.
2009-09-23 16:59:57 -07:00
Mathias Agopian
dd3423c624 fix [2132563] stuck in boot animation (framebuffer_device_open: Failed to create flip chain) 2009-09-23 15:49:32 -07:00
Android (Google) Code Review
953eb137bc Merge change 26623 into eclair
* changes:
  fbDev wasn't initialized of hw_get_module failed, but was then used anyway.
2009-09-23 15:02:49 -04:00
Marco Nelissen
a455793a8d fbDev wasn't initialized of hw_get_module failed, but was then used anyway. 2009-09-23 10:56:51 -07:00
Eric Laurent
aef692f50f Fix issue 2116700: Ringer screwy while connected over Bluetooth.
There was a regression introduced in AudioFlinger by change 24114 for suspended output:
The suspended output was not reading and mixing audio tracks.
When the phone is ringing, the A2DP output is suspended if the SCO headset and A2DP headset are the same. As the ringtone is played over the duplicated output, the fact that the A2DP output was not reading data was causing the hardware output to be stalled from time to time.
2009-09-22 00:35:48 -07:00
Andy McFadden
2944a2b360 Work around gcc 4.0.3 bug.
This appears to fix the sim-eng build on the gDapper build machines.

Basic problem is that LayerBuffer::OverlaySource has a constructor that
calls SurfaceFlinger.signalEvent().  SurfaceFlinger lists LayerBuffer
as a friend, but that's not enough to convince gcc that the embedded
OverlaySource class is also a friend.  I don't see a way to make them
friendly, so I marked signalEvent() as public.
2009-09-21 14:33:20 -07:00
Android (Google) Code Review
a69a8eeb20 Merge change 26081 into eclair
* changes:
  workaround for [2113743] Sholes: frozen then runtime restart going to list view
2009-09-20 20:12:30 -04:00
Mathias Agopian
1f0ffc46fd workaround for [2113743] Sholes: frozen then runtime restart going to list view 2009-09-20 17:08:45 -07:00
Dianne Hackborn
cfbb735f84 Fix issue #1862317: Browser does not appear to honor anchors (#es) in links
Also a little improved debugging output of bad resource identifiers.

Change-Id: I054064ef22855608ffd722e4ccf12ce57d1992b2
2009-09-20 12:40:03 -07:00
Android (Google) Code Review
5cfbb8dd1c Merge change 25496 into eclair
* changes:
  Fix issue 2127371: Possible race condition in AudioFlinger::openRecord() when a Track is being destroyed.
2009-09-18 02:55:00 -04:00
Mathias Agopian
6d9f69843b fix [2129080] Soft reboot after clicking around and then rubbing the screen 2009-09-17 19:23:59 -07:00
Mathias Agopian
74faca212e Android side of the fix for [2121211] Sholes has stutter during animations
a new method, compostionComplete() is added to the framebuffer hal, it is used by surfaceflinger to signal the driver that the composition is complete, BEFORE it releases its client. This gives a chance to the driver to
2009-09-17 16:18:16 -07:00
Eric Laurent
0f8ab670c0 Fix issue 2127371: Possible race condition in AudioFlinger::openRecord() when a Track is being destroyed.
The fix consists in locking AudioFlinger::mLock mutex in the TrackBase destructor before clearing the strong pointer to the shared memory client. The mutex is not locked in removeclient() any more which implies that we must make sure that the Client destructor is always called from the TrackBase destructor or that we hold the mLock mutex before calling deleting the Client.
2009-09-17 09:26:04 -07:00
Mathias Agopian
86f7329080 add basic time stats for surfaces lock time 2009-09-17 01:35:28 -07:00
Benny Wong
5643261a25 Overlay could not set position or rotation immediately after created, it should be triggered by signalEvent().
Originally from: https://partner.source.android.com/g/#change,1074
2009-09-16 20:24:21 -07:00
Mathias Agopian
0928bee979 disable backbuffer preservation when possible, which may improve performance a bit 2009-09-16 20:15:42 -07:00
Mathias Agopian
caa600c4a1 fix [2119400] sholes: artifacting when switching orientation 2009-09-16 18:27:24 -07:00
Mathias Agopian
378532fdb0 fix again [2102410] Home Screen is not displayed in the background in Landscape Mode 2009-09-16 17:00:19 -07:00
Eric Laurent
bdc0f84793 Fix issue 2123668: Class scope typo in AudioFlinger.cpp. 2009-09-16 06:02:45 -07:00
Mathias Agopian
b8cfc0f9e1 revert to black video background, since we don't need the color-key anylonger 2009-09-15 19:31:28 -07:00
Mathias Agopian
68a6afeb26 fix [2122448] android_native_window_t::setUsage() only reallocates the first buffer
Take 2. We needed to check that the usage flags are "good enough" as opposed to "the same".

This reverts commit 8f17a762fe9e9f31e4e86cb60ff2bfb6b10fdee6.
2009-09-15 19:21:31 -07:00
Mathias Agopian
3910f5467a Revert "fix [2122448] android_native_window_t::setUsage() only reallocates the first buffer"
This reverts commit 486aa963b63e20b7910e1004cebb4f0afabbd80f.
2009-09-15 18:57:06 -07:00
Mathias Agopian
d18afab9d6 fix [2122448] android_native_window_t::setUsage() only reallocates the first buffer 2009-09-15 17:34:04 -07:00
Android (Google) Code Review
e5b0c94708 Merge change 25050 into eclair
* changes:
  Fix issue 2118464: cannot play ring tones and notifications after disconnecting BT headset while in call.
2009-09-15 11:29:23 -04:00
Eric Laurent
b3687ae925 Fix issue 2118464: cannot play ring tones and notifications after disconnecting BT headset while in call.
The problem comes from the fact that when the duplicated output is closed after BT headset disconnection, the OUTPUT_CLOSED notification is not sent to AudioSystem. Then the mapping between notification stream and duplicated output cached in AudioSystem is not cleared and next time a notification is played, the duplicated output is selected and the createTrack() request is refused by AudioFlinger as the selected output doesn't exist.
The notification is ignored by AudioFlinger because when it is sent by the terminating playback thread, the thread has already been removed from the playback thread list.

The fix consists in sending the notification in closeOutput() and not when exiting the playback thread.
The same fix is applied to record threads.
2009-09-15 07:10:12 -07:00
Chih-Chung Chang
00900eb354 Fix 2083478: Camera needs an auto-focus cancel API
Change-Id: I13bda991b32aee47e82b5cf9d43b3021c416a9a2
2009-09-15 18:29:03 +08:00
Android (Google) Code Review
f5733b2938 Merge change 24872 into eclair
* changes:
  Fix issue 2115450: a2dp thread is started, even though we are only connected to headset and not playing music.
2009-09-15 02:26:19 -04:00
Mathias Agopian
816d7d0268 add support for RGBX_8888 surfaces in SurfaceFlinger 2009-09-14 18:10:30 -07:00
Mathias Agopian
4790a3c1a2 fix [2117464] SF can crash when calling dumpsys 2009-09-14 15:59:16 -07:00
Mathias Agopian
c7d5601081 make sure to update the tail pointer when undoing a dequeue 2009-09-14 15:48:42 -07:00
Eric Laurent
a6e58fe316 Fix issue 2115450: a2dp thread is started, even though we are only connected to headset and not playing music.
This is due to a regression introduced by change 24114: when no audio tracks are ready for mixing, 0s are written to audio hardware. However this should only happen if tracks have already been mixed since the audio flinger thread woke up.
Also do not write 0s to audio hardware in direct output threads when audio format is not linear PCM.
2009-09-14 02:37:15 -07:00
Android (Google) Code Review
f79cbd93e6 Merge change 24337 into eclair
* changes:
  Fix issue 2107584: media server crash when AudioFlinger fails to allocate memory for track control block.
2009-09-14 02:43:52 -04:00
Mathias Agopian
40d5799622 fix [2111536] [FAST BLOCKER] Device is soft rebooted after ending the call through voice dialer 2009-09-11 19:18:20 -07:00
Mathias Agopian
48d819a131 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
2009-09-10 19:41:18 -07:00
Mathias Agopian
b58b5d72d6 make sure conditions will return when the status of a surface is not NO_ERROR 2009-09-10 16:55:13 -07:00
Mathias Agopian
a5b02e0b4d add a debug property to disable h/w composition. debug.sf.hw, when set to 0 will disable h/w composition 2009-09-09 19:20:10 -07:00
Mathias Agopian
b6a5daa3ab fix [2102410] Home Screen is not displayed in the background in Landscape Mode
the blurring code now handles NPOT textures.
2009-09-09 17:47:15 -07:00
Andy McFadden
e0a963b72e Fix sim-eng build.
Appears to have been broken by:

commit 9779b221e999583ff89e0dfc40e56398737adbb3
Author: Mathias Agopian <mathias@google.com>
Date:   Mon Sep 7 16:32:45 2009 -0700

    fix [2068105] implement queueBuffer/lockBuffer/dequeueBuffer properly

For some reason we don't like to have "-lpthread" globally -- it's a no-op
on device builds, but required for many host tools and all sim binaries --
so adding the use of pthread calls requires adding the library explicitly.
2009-09-09 08:02:54 -07:00
Eric Laurent
6ad8c64ce9 Fix issue 2107584: media server crash when AudioFlinger fails to allocate memory for track control block.
AudioFlinger: verify that mCblk is not null before using it in Track and RecordTrack contructors.
IAudioFlinger: check result of remote transaction before reading IAudioTrack and IAudioRecord.
IAudioTrack and IAudioRecord: check result of remote transaction before reading IMemory.
2009-09-09 05:16:08 -07:00
Android (Google) Code Review
1f5105cf53 Merge change 24335 into eclair
* changes:
  use broadcast() instead of signal() when signaling the condition-variable Thread::RequestExitAndWait() is waiting for
2009-09-09 03:29:19 -07:00
Android (Google) Code Review
42c3c9a8d1 Merge change 24334 into eclair
* changes:
  fix [2037525] Fail to start camera after adb sync new Camera
2009-09-09 03:29:08 -07:00