Commit Graph

53 Commits

Author SHA1 Message Date
Mathias Agopian 245e4d78c5 better fix for [2420565] Surface.lockCanvas() updates the dirty region too often
Change-Id: I83438b40effd21538f1c74396dc665254b9d5ab6
2010-04-21 22:25:35 -07:00
Mathias Agopian ca99fb8f65 fix [2594950] Flash: Zooming in on some content crashes the Nexus One and causes it to reboot (runtime restart)
We now limit the size of the surface to the maximum size supported by the GPU.
On Nexus One this will 2048 -- it could be different on other devices.
Surface creation fails if the limit is exceeded.

Change-Id: I9ecfc2e9c58c9e283782b61ebfc6b590f71df785
2010-04-14 16:43:44 -07:00
Mathias Agopian d343e3d5e3 fix [2515291] Native crash and runtime restart while trying to preview captured picture on Sapphire
if a buffer couldn't be allocated because of an OOM, SF could, in some case dereference
a null pointer.

Change-Id: I5321248c38a21e56d5278b6aada2694e64451378
2010-03-15 18:15:20 -07:00
Mathias Agopian fcfeb4b597 fixes for [2474091] Saw Poor behaviour playing a video.
- fix a bug when hacking video buffers into gralloc buffers
 where the buffer size was incorrect this was causing the
 "direct-form-texture" mode to fail

- also when the above fails, make sure to revert to the
 "mdp copy mode" before going to "slow mode"

- finally disable completely the "direct-from-texture" mode
 for now. It cannot work because the allocated buffers can't
 respect the GPU constraints (alignment and such). We'll
 have to find a solution for that.
2010-03-08 11:14:20 -08:00
Mathias Agopian 54ed4f6282 get rid off the YUV formats at the libui layer 2010-02-16 17:33:37 -08:00
Mathias Agopian 9cce325fae split libsurfaceflinger_client and libcamera_client out of libui 2010-02-11 13:16:22 -08:00
Mathias Agopian f5430db059 fix [2269582] [TOP-10][Passion_1506][APT:Camera]Sometimes camera preview screen is truncated after launching and back to home screen by home key repeatedly
When a surface is removed from the screen while it holds a "freeze lock", the
release of that lock happens in the destructor as a "safety net". However, it
doesn't trigger an update at that point.

Make sure that "freeze locks" are released from the transaction at the point
a surface is removed from the screen (if it's not on screen, it shouldn't
prevent the screen to redraw, and therefore cannot hold a freeze lock).
The refresh corresponding to that transaction will pick it up as soon as possible.
2009-12-11 00:56:10 -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
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
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
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
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 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
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 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 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
Mathias Agopian 7e4a587f60 introduce the notion of the requested size in the Layer state 2009-09-29 22:44:28 -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 6d9f69843b fix [2129080] Soft reboot after clicking around and then rubbing the screen 2009-09-17 19:23:59 -07:00
Mathias Agopian caa600c4a1 fix [2119400] sholes: artifacting when switching orientation 2009-09-16 18:27:24 -07:00
Mathias Agopian 816d7d0268 add support for RGBX_8888 surfaces in SurfaceFlinger 2009-09-14 18:10:30 -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 d66a97950e 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 ccde199f7c 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 5221271375 second take, hopefully this time it doesn't break one of the builds: "SurfaceFlinger will now allocate buffers based on the usage specified by the clients. This allows to allocate the right kind of buffer automatically, without having the user to specify anything." 2009-08-11 23:32:29 -07:00
Fred Quintana b2fd4665e6 Revert "SurfaceFlinger will now allocate buffers based on the usage specified by the clients. This allows to allocate the right kind of buffer automatically, without having the user to specify anything."
This reverts commit 8b76a0ac6fbf07254629ed1ea86af014d5abe050.
2009-08-11 20:49:35 -07:00
Mathias Agopian df37b62c62 SurfaceFlinger will now allocate buffers based on the usage specified by the clients. This allows to allocate the right kind of buffer automatically, without having the user to specify anything.
This change makes SurfaceHolder.setType(GPU) obsolete (it's now ignored).
Added an API to android_native_window_t to allow extending the functionality without ever breaking binary compatibility. This is used to implement the new set_usage() API. This API needs to be called by software renderers because the default is to use usage flags suitable for h/w.
2009-08-11 16:12:56 -07:00
Mathias Agopian 9fbeb7c6e2 remove unused and confusing comment 2009-08-07 19:08:18 -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 1fed11c86a checkpoint. bring back video/camera 2009-06-23 18:08:22 -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 310f8da0c3 merge master to master_gl 2009-05-22 02:16:08 -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
Mathias Agopian 7be3e5d2d8 Merge commit 'goog/master' into merge_master
Conflicts:
	libs/surfaceflinger/Layer.cpp
	libs/surfaceflinger/SurfaceFlinger.cpp
	opengl/libagl/egl.cpp
	opengl/libs/EGL/egl.cpp
	opengl/libs/GLES_CM/gl.cpp
	opengl/libs/GLES_CM/gl_api.in
	opengl/libs/gl_entries.in
	opengl/libs/tools/glapigen
2009-04-30 14:43:18 -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 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 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 076b1cc3a9 Integrate from //sandbox/mathias/donut/...@145728
SurfaceFlinger rework for new EGL driver model support.
2009-04-10 14:24:30 -07:00
The Android Open Source Project edbf3b6af7 auto import from //depot/cupcake/@135843 2009-03-03 19:31:44 -08:00
The Android Open Source Project d5193d9394 auto import from //depot/cupcake/@135843 2009-03-03 18:28:45 -08:00
The Android Open Source Project ac65e0b172 auto import from //branches/cupcake/...@131421 2009-02-13 12:57:50 -08:00
The Android Open Source Project a6938bab1f auto import from //branches/cupcake/...@130745 2009-02-10 15:44:00 -08:00