Commit Graph

243 Commits

Author SHA1 Message Date
Jamie Gennis
05ca9998cd Merge "SurfaceFlinger: use async mode for video & cam" 2011-08-01 13:40:29 -07:00
Jamie Gennis
cb6c755234 SurfaceFlinger: use async mode for video & cam
This change makes SurfaceFlinger's SurfaceTexture objects default to
async mode whenever a camera or video decoder connects.  This behavior
can be disabled by #defining NEVER_DEFAULT_TO_ASYNC_MODE.

Change-Id: I8965951d1775915da180e4af298dd7af3afafecc
2011-07-30 16:47:44 -07:00
Jamie Gennis
dbe6486ca1 SurfaceFlinger: abandon Layer SurfaceTextures
This change makes the Layer::onRemoved method call
SurfaceTextures::abandon on the layer's SurfaceTexture.  This will cause
all client-initiated operations on the SurfaceTexture to fail.  In
particular, this will result in an error on the client side, rather than
a deadlock when removing a layer that used a SurfaceTexture in
synchronous mode.

Change-Id: I14014d00369f29560a21b606831edee432bb8867
Bug: 5020874
2011-07-30 14:38:20 -07:00
Jamie Gennis
db5230f444 SurfaceFlinger: fix a layer occlusion bug
This change fixes a bug where the window visibility would be computed
before any buffers were available, causing the window to be treated as
non-opaque.  When the first buffer arrived, if both mCurrentOpacity and
the opacity determined by the buffer's format were 'opaque', a
recomputation of the opacity would not be done, and the window would
continue to be treated as non-opaque.  SurfaceFlinger could then
unnecessarily draw fully occluded layers.

Change-Id: I2b95da2f4b50e68d50fc5afd8b772e26e62f58d6
Bug: 5057122
2011-07-28 16:03:28 -07:00
Mathias Agopian
3fbce7c560 remove dead code and member variables.
also fix some comments and improve debugging logs.

Change-Id: I83e55309f306332b59e1ec46104c4a7fffbf3c97
2011-07-25 20:03:43 -07:00
Mathias Agopian
ab7c13f96a fix a typo that prevented preserveRects() to work properly
this caused drawing artifacts during the screen rotation
animation of SurfaceView.

Change-Id: Idcc996b6ca2e346135dd2264959670c0b086d4cb
2011-07-25 13:57:16 -07:00
Mathias Agopian
6dc49c09bc Fix typo which caused invalid rotations to be returned with NATIVE_WINDOW_TRANSFORM_HINT
Bug: 4487161
Change-Id: Ib2dfbbef15397b6d90695bd27f25849ca20704f1
2011-07-22 15:25:20 -07:00
Mathias Agopian
bb66c9b5a9 Fix a few issues with NATIVE_WINDOW_TRANSFORM_HINT
- fixed uninitialized variable
- set hint to indentity when transform is too complex
- make sure FrameBufferNativeWindow doesn't fail on needed perform commands

Bug: 4487161
Change-Id: I7cb2b0869b72404732eca7cb2d145ff669e2ed9b
2011-07-21 14:50:29 -07:00
Mathias Agopian
c10d9d90b2 clean-up. get rid ofunused code and members in Surface[Control].cpp
Change-Id: Ia7790ae28af2c2ac99eae01c2c5044ace4a490a4
2011-07-20 16:53:13 -07:00
Mathias Agopian
97c602c5af implement: "Add an ANativeWindow API for SurfaceFlinger to suggest an optimal buffer orientation"
Bug: 4487161
Change-Id: I883f34efe542c2a566d04966f873374f40c50092
2011-07-19 15:24:46 -07:00
Mathias Agopian
933389f758 use SurfaceTexture new scaling mode in SF
SF now obeys SurfaceTexture's scaling mode instead
of inferring it from the buffer's size

Change-Id: I4d50e9851abedd7e64bfcfc8af9eefb9fb668529
2011-07-19 13:05:12 -07:00
Mathias Agopian
ad70186f80 dump GLES strings in SF dumpsys log
Change-Id: I438d511159b2bd915c84954f30574340017d4f47
2011-07-15 14:29:25 -07:00
Mathias Agopian
29a367bb7c take the state transform into account with h/w composer hal
if the state transform didn't preserve rectangles, we
would still try to use h/w composer hal using the bounds
of the transformed rect, which isn't correct.

now we correctly fall back to composition.

Change-Id: Iff78f4339ece415d4987e95a5717b04934d370ab
2011-07-12 14:51:45 -07:00
Jeff Brown
baa44b89ec Remove the simulator target from all makefiles.
Bug: 5010576

Change-Id: I04d722f258951a3078fe07899f5bbe8aac02a8e8
2011-07-11 22:12:16 -07:00
Mathias Agopian
ffcf465771 fix screen on/off animation (again)
- surfaceflinger now uses the GL-convention of
  placing the origin in the left-bottom corner

- map texture coordinates of the screen capture
  properly

- add the ability to control the animation
  speed through a debug property

Bug: 4989276

Change-Id: Ifb3297bb578078b47146fff666c01f85417e0d6f
2011-07-08 14:37:06 -07:00
Mathias Agopian
6163091a2c Fix EGLUtils::selectConfigForPixelFormat()
- renderscript now calls EGL directly instead of relying on this function
- surfaceflinger also does its own EGLConfig selection
- selectConfigForPixelFormat stays for legacy reason (many tests use it) but
it now only tries to match the alpha channel of the format rather than the
format itself.

this will allow implementations who don't support the exact formats
defined in the HAL to work properly.

Bug: 4998223

Change-Id: Ic664dfc14d5072a514b6f77a115d1521bfc1578f
2011-07-08 14:37:05 -07:00
Mathias Agopian
7e918860f9 Merge "don't kill surfaceflinger when system process dies" 2011-07-06 11:10:31 -07:00
Mathias Agopian
1f339ff387 don't kill surfaceflinger when system process dies
Change-Id: I2d3ed87b590f9ccea3fa4af41d92911de070b315
2011-07-01 17:09:24 -07:00
Mathias Agopian
d9e8c64c3d return an error code with gralloc buffer allocation failures
Change-Id: I471e5d37ea7a42fc8a0f93446ee3b4229da37807
2011-07-01 14:53:49 -07:00
Mathias Agopian
2dbf9fffb2 fix screen on/off animation, which was flipped
Bug: 4673549
Change-Id: Ia9766754687b89c1ee24b2dbe918c11290ebe038
2011-06-30 16:23:39 -07:00
Mathias Agopian
698c0873cf SF transactions are now O(1) wrt IPC instead of O(N).
Change-Id: I57669852cbf6aabae244ea86940a08a5a27ffc43
2011-06-29 15:05:41 -07:00
Jamie Gennis
67b4cff399 Merge changes I9fb59763,I8b2c6e00
* changes:
  SurfaceTexture: consume buffers after err checks
  SurfaceTexture: change onFrameAvailable behavior
2011-06-28 12:55:03 -07:00
Mathias Agopian
99b49840d3 PermissionCache caches permission checks
This is intended to absorb the cost of the IPC
to the permission controller.
Cached permission checks cost about 3us, while
full blown ones are two orders of magnitude slower.

CAVEAT: PermissionCache can only handle system
permissions safely for now, because the cache is
not purged upon global permission changes.

Change-Id: I8b8a5e71e191e3c01e8f792f253c379190eee62e
2011-06-27 17:42:15 -07:00
Jamie Gennis
3d8063b02e SurfaceTexture: change onFrameAvailable behavior
This change alters the conditions under which the onFrameAvailable
callback gets called by the C++ SurfaceTexture class.  The new behavior
is to call the callback whenever a frame gets queued that will be
visible to the buffer consumer.  This means that buffers queued in
synchronous mode always trigger the callback, as those buffers will
remain pending until they are consumed.  Buffers queued in asynchronous
mode will only trigger the callback if there was not previously an
unconsumed buffer pending.

The new behavior means that a consumer should perform a draw operation
exactly once for every onFrameAvailable call that it recieves.  This
change also modifies SurfaceFlinger and the SurfaceTexture JNI to
support of the new behavior.

Change-Id: I8b2c6e00961d3d58b11c6af50b555b6e4c5f5b40
2011-06-27 15:45:39 -07:00
Mathias Agopian
ddc31c3e2b fix RefBase so it retains binary-compatibility with gingerbread
Bug: 4595257
Change-Id: I0d5e10f497e3f39868bff58f6ded510c38b44b12
2011-06-13 18:39:45 -07:00
Mathias Agopian
a67932fe68 unify SurfaceTexture and Surface
Add the concept of synchronous dequeueBuffer in SurfaceTexture
Implement {Surface|SurfaceTextureClient}::setSwapInterval()
Add SurfaceTexture logging
fix onFrameAvailable
2011-06-13 15:51:35 -07:00
Mathias Agopian
342451d19f Merge "Fix a race that could cause GL commands to be executed from the wrong thread." 2011-05-19 19:42:20 -07:00
Mathias Agopian
ca4d3602c0 Fix a race that could cause GL commands to be executed from the wrong thread.
Change-Id: Ia3d407f7bf2f5553f46cfdade70b7b0badb35beb
2011-05-19 19:40:02 -07:00
Jamie Gennis
3629d7ff29 SurfaceFlinger: unfreeze windows for fixed size buffers.
This change makes SurfaceFlinger unfreeze a window if it ever gets a
buffer that is fixed-size.  Normally the window would not be frozen if
its in fixed-size mode, but if the window was frozen before entering
fixed-size mode then it should be unfrozen.

Change-Id: I6bc822d4b02ae51fa8914c1f60f5d24b2002b38d
2011-05-16 16:59:04 -07:00
Mathias Agopian
dea20b1f34 Fix a race in SurfaceFlinger that could cause layers to be leaked forever.
The transaction flags were atomically read-and-cleared to determine if
a transaction was needed, in the later case, mStateLock was taken to
keep the current state still during the transaction. This left a small
window open, where a layer could be removed after the transaction flags
were checked but before the transaction was started holding the lock.
In that situation eTraversalNeeded would be set but only seen during the
next transaction cycle; however, because we're handling this transaction
(because of another flag) it will be commited, "loosing" the information
about the layer being removed -- so when the next transaction cycle due
to eTraversalNeeded starts, it won't notice that layers have been removed
and won't populated the ditchedLayers array.

Change-Id: Iedea9e25fee8dd98a0c5bd5ad41a20fcadf75b47
2011-05-03 20:44:51 -07:00
Iliyan Malchev
697526bc9e frameworks/base: android_native_buffer_t -> ANativeWindowBuffer
Change-Id: Idc2eabaa805bb6d308ebb315872623f28d428417
Signed-off-by: Iliyan Malchev <malchev@google.com>
2011-05-03 16:40:14 -07:00
Mathias Agopian
e4b117ad45 Merge "Fix a race-condtion in SurfaceFlinger that could lead to a crash." 2011-05-03 16:34:06 -07:00
Mathias Agopian
4f11374018 Fix a race-condtion in SurfaceFlinger that could lead to a crash.
Client::mLayers could be accessed from different threads.
On one side from Client::attachLayer() which is currently
called from a binder thread; on the other side from
Client::detachLayer() which is always called from the main
thread.

This could lead to a corruption of Client::mLayers.

We fix this issue by adding an internal lock to Client.

Change-Id: Ib1317d7750ed5030e6f577efe34b69fc10198bd3
2011-05-03 16:21:41 -07:00
Conley Owens
5511a49d8d am 08acaec6: am a47c0d29: am 58e4a5e2: Merge "Fixed to draw texture when loadTexture() is called at first time"
* commit '08acaec6df66bd6a12b1e63016ed998abff4afdc':
  Fixed to draw texture when loadTexture() is called at first time
2011-05-02 10:12:00 -07:00
Conley Owens
7badf9c5e8 am a47c0d29: am 58e4a5e2: Merge "Fixed to draw texture when loadTexture() is called at first time"
* commit 'a47c0d29bec7c242fb8d5ffe206c4c6ff85a178a':
  Fixed to draw texture when loadTexture() is called at first time
2011-04-29 17:15:35 -07:00
Conley Owens
e85e4d4ed2 Merge "Fixed to draw texture when loadTexture() is called at first time" 2011-04-29 10:00:12 -07:00
Conley Owens
56b79aa816 Merge "Fixed to call computeVisibleRegions() when transparent value changed" 2011-04-29 09:59:30 -07:00
Conley Owens
345c6114da am ba5aebd1: am ac505b86: am f0556bb9: am 86d1d747: Merge "Add lock before calling initEglImage"
* commit 'ba5aebd106c61567ad6be905efd18902025735aa':
  Add lock before calling initEglImage
2011-04-27 13:54:08 -07:00
Conley Owens
ddc25bb92e am ac505b86: am f0556bb9: am 86d1d747: Merge "Add lock before calling initEglImage"
* commit 'ac505b86b45462d9883f9c36fad0ef85e0885ee4':
  Add lock before calling initEglImage
2011-04-27 13:41:12 -07:00
Conley Owens
a97b487178 am 86d1d747: Merge "Add lock before calling initEglImage"
* commit '86d1d74762e65b6f64c2d4758aa5fd4af6275696':
  Add lock before calling initEglImage
2011-04-27 12:43:19 -07:00
Mathias Agopian
0ef4e15a6c Get rid of the "pid" parameter from createSurface
Change-Id: I28635e3f803e6abe965d79998e305f54a202465d
2011-04-20 14:26:11 -07:00
Mathias Agopian
d9071ad304 Merge "remove support for console in SurfaceFlinger" 2011-04-19 18:19:15 -07:00
Mathias Agopian
3d031507e9 remove support for console in SurfaceFlinger
the only supported screen management api now is
/sys/power/wait_for_fb_{sleep|wake}

Change-Id: I6c7d8d54843da4980b1b38ee3d46cf19be275240
2011-04-18 18:09:53 -07:00
Mathias Agopian
3d64e738b9 fix memory corruption when retriving GL_MAX_VIEWPORT_DIMS
Change-Id: I2e0b1eac6dbc6a4ecbbaf31013aa02cf2369fce2
2011-04-18 15:59:24 -07:00
Kobi Cohen Arazi
0d11baf889 Add lock before calling initEglImage
Without that lock, there is a chance of race condition
where while composing a specific index, requestBuf with
the same index can be executed and touch the
same data that is being used in initEglImage.
(e.g. dirty flag in texture)
2011-04-15 10:38:33 -07:00
Mathias Agopian
4cb18881b5 Fix a GraphicBuffer leak in SurfaceTexture
This leak was intentional, it was there to deal with the fact that
some gralloc implementations don't track buffer handles with
file-descriptors so buffers needed to stay alive until there were
registered, which is not guaranteed by binder transactions.

In this new implementation, we use a small BBinder holding a
reference to the buffer, which with tuck into the parcel. This forces
the reference to stay alive until the parcel is destroyed, which
is guaranteed (by construction) to happen after the buffer is
registered.

this allows the public facing API to not expose the previous hack.

Change-Id: I1dd6cd83679a2b7457ad628169e2851acc027143
2011-04-08 19:28:04 -07:00
Mathias Agopian
47d8730a24 remove more unused references to ISurface
Change-Id: I2201f1ca2bb8f203a081d94a0134f798778dfbef
2011-04-05 20:11:55 -07:00
Ichitaro Kohara
dcab18c9c1 Fixed to draw texture when loadTexture() is called at first time
SW renderer of Stagefright reaches loadTexture() to draw image.
The first time loadTexture() is called, it just initializes OGL
texture, then returns. Thus, the first time call doesn't draw.
This patch fixes to move on to draw stage after the initialization.

Change-Id: I3ec1ad68fb8d376a4ad7aefded1c18a002d175c4
2011-04-05 08:58:44 +02:00
Mathias Agopian
d87f162026 merge libsurfaceflinger_client into libgui
this is the first step in unifying surfacetexture and surface.
for this reason the header files were not moved, as most of them
will eventually go away.

NOTE: currently we keep libsurfaceflinger_client.so as an empty
library to workaround prebuilt binaries wrongly linking against
it.

Change-Id: I130f0de2428e8579033dc41394d093f4e1431a00
2011-03-25 18:42:40 -07:00
Jamie Gennis
3eb70b4a51 am bd340c7b: am b368f4d8: am 38caff23: Merge "SurfaceFlinger: Fix a typo." into honeycomb-mr1
* commit 'bd340c7b492fcf7d0a6cccab8825e710c83fe76d':
  SurfaceFlinger: Fix a typo.
2011-03-18 17:38:37 -07:00