176 Commits

Author SHA1 Message Date
Mathias Agopian
46b2df153f 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
e05f07dffa 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
460b60c9b0 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
26fe45dcb3 Merge change I4961c959 into eclair
* changes:
  fix [2152536] ANR in browser
2009-10-06 22:10:17 -04:00
Mathias Agopian
4961c959ae 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
Mathias Agopian
c131c56719 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
351a7073fb fix [2168528] enable glTexImage2D code path in SF for software-only buffers 2009-10-06 17:24:26 -07:00
Mathias Agopian
6950e428fe 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
Mathias Agopian
0c4cec7e4d 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
Mathias Agopian
98a9c56acf attempt to work around [2155085, 2150246] stuck in closeTransaction() 2009-09-30 15:15:07 -07:00
Mathias Agopian
bd23e30de4 fix [2152247] Windows sometimes drawn scaled up. 2009-09-30 14:07:22 -07:00
Mathias Agopian
70cab91229 invalidate the surface when the physical changes 2009-09-30 12:48:47 -07:00
Mathias Agopian
e1b6f24423 introduce the notion of the requested size in the Layer state 2009-09-29 22:44:28 -07:00
Mathias Agopian
8851617aea remove unused code 2009-09-29 22:32:36 -07:00
Mathias Agopian
45094a34f0 remove dead code 2009-09-29 15:26:42 -07:00
Mathias Agopian
81384bf927 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
Mathias Agopian
c4646e654a 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
Mathias Agopian
f2d28b7485 minor SurfaceFlinger code cleanup and remove unnecessary tests 2009-09-24 14:57:26 -07:00
Mathias Agopian
cc934763c3 turn dithering off if it's not needed 2009-09-23 19:16:27 -07:00
Mathias Agopian
44cac13465 fix [2142193] disable GL_LINEAR when not needed 2009-09-23 18:55:02 -07:00
Mathias Agopian
2e4b68d57b 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
Andy McFadden
fa0a4bde3f 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
Mathias Agopian
4a06bb4f33 workaround for [2113743] Sholes: frozen then runtime restart going to list view 2009-09-20 17:08:45 -07:00
Mathias Agopian
ac7f13bc1a fix [2129080] Soft reboot after clicking around and then rubbing the screen 2009-09-17 19:23:59 -07:00
Mathias Agopian
b1a1874625 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
Mathias Agopian
bcef9ac35d add basic time stats for surfaces lock time 2009-09-17 01:35:28 -07:00
Benny Wong
e38212a22f 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
af369f6280 disable backbuffer preservation when possible, which may improve performance a bit 2009-09-16 20:15:42 -07:00
Mathias Agopian
7cf03bace8 fix [2119400] sholes: artifacting when switching orientation 2009-09-16 18:27:24 -07:00
Mathias Agopian
2c68dd0483 fix again [2102410] Home Screen is not displayed in the background in Landscape Mode 2009-09-16 17:00:19 -07:00
Mathias Agopian
8ae0384a78 revert to black video background, since we don't need the color-key anylonger 2009-09-15 19:31:28 -07:00
Mathias Agopian
64a7c6bf5b add support for RGBX_8888 surfaces in SurfaceFlinger 2009-09-14 18:10:30 -07:00
Mathias Agopian
53973fda84 fix [2117464] SF can crash when calling dumpsys 2009-09-14 15:59:16 -07:00
Mathias Agopian
248b5bd51e 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
24d237db94 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
e7c11d770a 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
Mathias Agopian
a280496bd2 fix [2037525] Fail to start camera after adb sync new Camera
we ended-up locking a Mutex that had been destroyed.
This happened because we gave an sp<Source> to the outside world,
and were called after LayerBuffer had been destroyed.

Instead we now give a wp<LayerBuffer> to the outside and have it
do the destruction.
2009-09-09 00:50:29 -07:00
Mathias Agopian
b34d143bce rename Mutexes to make the code easier to follow 2009-09-08 22:48:24 -07:00
Mathias Agopian
dc54f416a4 delete old and unused source files 2009-09-07 16:33:36 -07:00
Mathias Agopian
9779b221e9 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
2009-09-07 16:32:45 -07:00
Mathias Agopian
ffae4fcc78 attempt to fix [2099362] Possible SurfaceFlinger crash 2009-09-04 19:50:23 -07:00
Mathias Agopian
7164b8d645 fix [2098939] Smooth gradients show banding on Sholes 2009-09-04 17:27:16 -07:00
Rebecca Schultz Zavin
c8546781ff Add colorkey to gl clear operation
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
2009-09-02 15:57:42 -07:00
Mathias Agopian
a8d49178f9 dumpsys SurfaceFlinger will now always dump SF's state, even if SF is deadlocked
(in this case the state is dumped without the proper locks held which could result to a crash)

in addition, the last transaction and swap times are printed to the dump as well as the time spent
*currently* in these function. For instance, if SF is unresponsive because eglSwapBuffers() is stuck,
this will show up here.
2009-08-26 16:55:50 -07:00
Mathias Agopian
18b6b49ea5 fix a bug that caused the PixelFormat viewed by Surface to be wrong.
what happened is that the efective pixel format is calculated by SF but Surface nevew had access to it directly.
in particular this caused query(FORMAT) to return the requested format instead of the effective format.
2009-08-19 17:46:26 -07:00
Mathias Agopian
b2f8450db8 fix [2063336] Surface.lockSurface throws IllegalArgumentException when out of memory 2009-08-19 17:10:18 -07:00
Mathias Agopian
c4915de8bb fix a bug that could cause a window to be hidden in some cases.
this would happen is the window is made visible but the client didn't render yet into it. This happens often with SurfaceView.
Instead of filling the window with solid black, SF would simply ignore it which could lead to more disturbing artifacts.

in theory the window manager should not display a window before it has been drawn into, but it does happen occasionnaly.
2009-08-13 19:08:00 -07:00
Mathias Agopian
317a6280cc Surface::GPU and Surface::HARDWARE are now deprecated; they will be set automatically if needed.
this also ripples into the window manager API by making some constant there deprecated as well.
2009-08-13 18:19:32 -07:00
Mathias Agopian
42fd8050ba make sure EGL_ANDROID_swap_rectangle is actually supported before using it 2009-08-12 21:24:53 -07:00
Mathias Agopian
88e3e6bd04 Better error handling in EGL extensions 2009-08-12 21:18:15 -07:00