Commit Graph

73 Commits

Author SHA1 Message Date
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
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
Mathias Agopian
448f015966 attempt to work around [2155085, 2150246] stuck in closeTransaction() 2009-09-30 15:15:07 -07:00
Mathias Agopian
ba6be54876 remove unused code 2009-09-29 22:32:36 -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
Mathias Agopian
95a666b0e0 minor SurfaceFlinger code cleanup and remove unnecessary tests 2009-09-24 14:57:26 -07:00
Mathias Agopian
401c257fba turn dithering off if it's not needed 2009-09-23 19:16:27 -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
1f0ffc46fd workaround for [2113743] Sholes: frozen then runtime restart going to list view 2009-09-20 17:08:45 -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
Mathias Agopian
86f7329080 add basic time stats for surfaces lock time 2009-09-17 01:35:28 -07:00
Mathias Agopian
4790a3c1a2 fix [2117464] SF can crash when calling dumpsys 2009-09-14 15:59:16 -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
cbb288bfe8 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
0852e67412 attempt to fix [2099362] Possible SurfaceFlinger crash 2009-09-04 19:50:23 -07:00
Mathias Agopian
9795c42e55 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
1c97d2ebe1 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
5d7126b625 resolved conflicts for merge of ac38dfc5 to master 2009-07-28 14:20:21 -07:00
Mathias Agopian
970112231e fix [2017532] Partial Update leaves residual image. 2009-07-28 10:57:27 -07:00
Mathias Agopian
4860b74b47 am 4d2dbebf: fix for [1885684] E/SurfaceFlinger( 60): not enough memory for layer bitmap size=4294938624
Merge commit '4d2dbebf3d08209f751585d8cc367369e2f6e32f'

* commit '4d2dbebf3d08209f751585d8cc367369e2f6e32f':
  fix for [1885684] E/SurfaceFlinger( 60): not enough memory for layer bitmap size=4294938624
2009-07-09 20:05:11 -07:00
Mathias Agopian
6e2d6483fe fix for [1885684] E/SurfaceFlinger( 60): not enough memory for layer bitmap size=4294938624 2009-07-09 18:16:43 -07:00
Mathias Agopian
7303c6bf1a get rid of references to MemoryDealer in SurfaceFlinger 2009-07-02 18:50:51 -07:00
Mathias Agopian
759fdb2ef7 free gralloc buffers as soon as possible (when a surface is not visible any longer), client who have the buffers still mapped won't crash, btu may see garbage data 2009-07-02 18:45:29 -07:00
Mathias Agopian
29d06ac9a4 fix a bug that caused artifacts when SWAP_RECTANGLE was enabled 2009-06-29 18:49:56 -07:00
Mathias Agopian
a8d44f75e1 fix [1947273] the DimLayer causes the whole screen to update during transactions 2009-06-29 14:44:11 -07:00
Mathias Agopian
6b3287b5d4 fix [1947273] the DimLayer causes the whole screen to update during transactions 2009-06-28 02:54:16 -07:00
Mathias Agopian
b8a5560e13 fix an update bug with SHOW_UPDATE debug feature. Fix a problem with the debug binder codes too 2009-06-26 19:06:36 -07:00
Mathias Agopian
f9d932774e fix a memory corruption where a SF Client could be used after it's been destroyed 2009-06-19 17:00:27 -07:00
Mathias Agopian
cd8c5e29c2 release the last reference to surfaces explicitely instead of letting it go implicitely when the message is destroyed 2009-06-19 16:24:02 -07:00
Mathias Agopian
375f56363a new Permission class used to improve permission checks speed (by caching results) 2009-06-15 21:56:51 -07:00
Mathias Agopian
3d57964a81 fix a bunch of problems with destroying surfaces.
now, all destruction path, go through the purgatory which is emptied when ~ISurface is called, but we also make sure to remove the surface from the current list from there (in case a client forgot to request the destruction explicitely).
2009-06-04 18:46:21 -07:00
Mathias Agopian
310f8da0c3 merge master to master_gl 2009-05-22 02:16:08 -07:00
Android (Google) Code Review
bdbf6b094d am 69a6c3eb: Merge change 2292 into donut
Merge commit '69a6c3ebd46a8de0e896747757f364322c12608d'

* commit '69a6c3ebd46a8de0e896747757f364322c12608d':
  split boot animation out of SurfaceFlinger
2009-05-21 19:36:53 -07:00
Mathias Agopian
a1ecca920e split boot animation out of SurfaceFlinger
Conflicts:

	data/etc/platform.xml
2009-05-21 19:21:59 -07:00
Mathias Agopian
c5b2c0bf80 move libbinder's header files under includes/binder 2009-05-20 12:55:03 -07:00
Mathias Agopian
20f68782a4 Region now has its own implementation instead of relying on SkRegion, which allows us to break libui's dependency on libcorecg. 2009-05-17 23:34:16 -07:00
Mathias Agopian
df3ca30bf6 created an new EGL extension called ANDROID_swap_rectangle
ANDROID_swap_rectangle allows to specify the rectangle affected by eglSwapBuffers(), anything outside of this rectangle is unchanged. in particular EGL_BUFFER_DESTROYED only applies to that rectangle. This extension as well as EGL_BUFFER_PRESERVED allow major optimizations on surfaceflinger, which can redraw only the dirty area during compositing.

However, ANDROID_swap_rectangle allows further optimizations in EGL by reducing the amount of copy-back needed. ANDROID_swap_rectangle is particularily important for software implementations.
2009-05-07 15:07:33 -07:00
Mathias Agopian
0926f50664 update surfaceflinger, libui and libagl to the new gralloc api
- Currently the lock/unlock path is naive and is done for each drawing operation (glDrawElements and glDrawArrays). this should be improved eventually.
- factor all the lock/unlock code in SurfaceBuffer.
- fixed "showupdate" so it works even when we don't have preserving eglSwapBuffers().
- improved the situation with the dirty-region and fixed a problem that caused GL apps to not update.
- make use of LightRefBase() where needed, instead of duplicating its implementation
- add LightRefBase::getStrongCount()
- renamed EGLNativeWindowSurface.cpp to FramebufferNativeWindow.cpp

- disabled copybits test, since it clashes with the new gralloc api

- Camera/Video will be fixed later when we rework the overlay apis
2009-05-04 14:17:04 -07:00
Android (Google) Code Review
3f54b2ae7e am 0124a15: Merge change 626 into donut
Merge commit '0124a150157d69a9f0ea109be2390afb5399b8a7'

* commit '0124a150157d69a9f0ea109be2390afb5399b8a7':
  fix 1803886 android15 Translucent GLSurfaceView demo does not display properly
2009-04-29 13:35:37 -07:00
Mathias Agopian
b6683b58a8 make use of the perfectly fine List.h instead of our own reimplementation of a linked list. 2009-04-28 03:17:50 -07:00
Mathias Agopian
2b42fa7fdd fix 1803886 android15 Translucent GLSurfaceView demo does not display properly 2009-04-27 18:50:06 -07:00
Mathias Agopian
550b79f449 get rid of an old hack to work around a bug around glDeleteTextures() in the adreno drivers 2009-04-24 16:31:11 -07:00
Mathias Agopian
cbc93ca800 get rid of the "show fps" debug option 2009-04-24 16:31:11 -07:00
Mathias Agopian
0aa758d64a Surfaces are now destroyed properly in SurfaceFlinger.
First, the window manager tells us when a surface is no longer needed. At this point, several things happen:
- the surface is removed from the active/visible list
- it is added to a purgatory list, where it waits for all clients to release their reference
- it destroys all data/state that can be spared

Later, when all clients are done, the remains of the Surface are disposed off: it is removed from the purgatory and destroyed.
In particular its gralloc buffers are destroyed at that point (when we're sure nobody is using them anymore).
2009-04-24 16:30:38 -07:00
Mathias Agopian
f1d8e87b09 a brand new MessageQueue for SurfaceFlinger. 2009-04-24 16:22:36 -07:00
Mathias Agopian
9a11206fe7 more Surface lifetime management
Surfaces are now destroyed once all references from the clients are gone, but they go through a partial destruction as soon as the window manager requests it.
This last part is still buggy. see comments in SurfaceFlinger::destroySurface()
2009-04-24 15:00:41 -07:00
Mathias Agopian
01b766839e more splitting of Surface/SurfaceControl. Surface.java is now implemented in terms of Surface and SurfaceControl.
The WindowManager side of Surface.java holds a SurfaceControl, while the client-side holds a Surface. When the client is in the system process, Surface.java holds both (which is a problem we'll try to fix later).
2009-04-16 20:04:08 -07:00
Mathias Agopian
62b74444be fix a few typos in comments. this is really intended as a git pull/push test. 2009-04-16 12:29:34 -07:00
Mathias Agopian
0308739d0b Merge commit 'goog/master' into master_gl
Conflicts:
	libs/utils/Parcel.cpp
2009-04-10 14:36:33 -07:00
Mathias Agopian
076b1cc3a9 Integrate from //sandbox/mathias/donut/...@145728
SurfaceFlinger rework for new EGL driver model support.
2009-04-10 14:24:30 -07:00