Commit Graph

215 Commits

Author SHA1 Message Date
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
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
Jamie Gennis
d32a694a0c Merge "SurfaceFlinger: Fix a typo." into honeycomb-mr1 2011-03-18 17:32:25 -07:00
Jamie Gennis
5fd799dab6 SurfaceFlinger: Fix a typo.
This change makes Layer skip its cleanup of its old shared memory region
when the UserClient object that owned the memory has been freed.

Bug: 3429357
Change-Id: I9e4d8eb190f6914dc043674b9bb8dd28e959901b
2011-03-18 16:35:13 -07:00
James Dong
02cc7170a2 am 14438b81: am 970bad67: am be368de7: Merge "Fix missing AOSP copyright headers for more files" into honeycomb-mr1
* commit '14438b81a1fe4d7ebdf8977f3d80a1dd1867c5ad':
  Fix missing AOSP copyright headers for more files
2011-03-17 18:06:51 -07:00
James Dong
5f7204cb66 Fix missing AOSP copyright headers for more files
o Update the copyright date on InputDispatcher_test.cpp and InputReader_test.cpp
  because these two files were moved from other places to the current location,
  and were actually created in 2010.

bug - 4119349

Change-Id: Ic93b81ddafb58e9e72a2e9e02ca3d9f173d6dca7
2011-03-17 14:43:12 -07:00
Mathias Agopian
939fee8819 am e22aa623: am 25594e19: am f40e638e: fix [4093196] Device lock up - log spam with SharedBufferStack: waitForCondition(LockCondition) timed out
* commit 'e22aa62362a3007ee59ac62d4b5969e216987995':
  fix [4093196] Device lock up - log spam with SharedBufferStack: waitForCondition(LockCondition) timed out
2011-03-17 00:13:49 -07:00
Mathias Agopian
d0b55c011a fix [4093196] Device lock up - log spam with SharedBufferStack: waitForCondition(LockCondition) timed out
a memory corruption happned when the buffer pool was resized
(like when playing a video or using camera) and there was
no current active buffer. In this case, the faulty code
would index into an array at position -1 which corrupted
24 bytes of data.

also improved region validation code (ifdef'ed out by default)

Bug: 4093196
Change-Id: I915c581d131148959d720e00e3892e9186ab733d
2011-03-17 00:04:42 -07:00
Mathias Agopian
1bbafb9610 Fix some const-ness and comments
mDrawingState doesn't need to be accessed by the
mStateLock, because by definition it's only accessed
from the main thread.

Similarily, the list of layers in the drawing state
cannot change (ie: is const).

Change-Id: I2e5da7f4d8caee7af7802b432cd45cc81c7c08b0
2011-03-11 17:01:40 -08:00
Mathias Agopian
5bf3abefb2 Fix initialization order warning.
Change-Id: I794dfaaa3a2f2645a89abc6c45de5f76e485f7d0
2011-03-11 17:01:40 -08:00
Eric Hassold
795f5ccf47 Merge "Default to NONE format in Layer" 2011-03-11 15:08:16 -08:00
Eric Hassold
7ffe380750 Default to NONE format in Layer
mFormat is not initialized with any value in Layer constructor, causing
a call to requestFormat() with no explicit format specified to fallback to
some uninitialized value. Such invalid path actually detected by valgrind.

Change-Id: Ib7faabcd61eaa26fb0ae7a9a486d9e258ba31b63
2011-03-11 12:24:23 -08:00
Jamie Gennis
7a4d0dfd43 SurfaceFlinger: Respect the PROTECTED gralloc bit.
This change makes SurfaceFlinger treat layers for which the active
buffer has the GRALLOC_USAGE_PROTECTED bit set as if they have the
'secure' flag set.

Change-Id: Ic60b6513a63e4bb92ec6ce9fd12fd39b4ba5f674
Bug: 4081304
2011-03-10 16:25:48 -08:00
Mathias Agopian
18570db84e am 33029221: Merge "revert the surface purgatory list and dependent changes." into gingerbread
* commit '33029221619f14577bd0d0e7c2f815abc8f1b8ea':
  revert the surface purgatory list and dependent changes.
2011-03-09 17:11:10 -08:00
Mathias Agopian
f7662afb76 revert the surface purgatory list and dependent changes.
6d0f6cb Revert "Fix [3513017] in lockscreen but showing empty launcher (live wallpaper) only"
6154412 Revert "partially fix [3306150] HTML5 video with H/W acceleration blackout (DO NOT MERGE)"
37c2a37 fix [3408713] Dialog window invisible sometimes

It looks like there is a surface leak, it's unclear where it is.
Without those reverts, this would cause a leak of the associated buffers
which is far more problematic. this change might hide the surface leak.

Bug: 4078032
Change-Id: Iedcda3ffcdd2f69d41047b5c3134c1e867ff90d7
2011-03-09 17:00:41 -08:00
Jamie Gennis
134f042286 ANativeWindow: add queues-to-window-composer check.
This change adds a new 'method' to the ANativeWindow interface to check
whether buffers queued to the window will be sent directly to the system
window compositor.

Change-Id: I4d4b199e328c110b68b250029aea650f03c8724d
Bug: 3495535
2011-03-08 16:49:51 -08:00
Mathias Agopian
5f1e78d730 am df6410dc: Merge "Fix [3513017] in lockscreen but showing empty launcher (live wallpaper) only" into gingerbread
* commit 'df6410dce3dae0bdb7e13118b3878079a1dcce03':
  Fix [3513017] in lockscreen but showing empty launcher (live wallpaper) only
2011-03-07 18:04:06 -08:00
Mathias Agopian
ee65ac8a71 Fix [3513017] in lockscreen but showing empty launcher (live wallpaper) only
37c2a37 fix [3408713] Dialog window invisible sometimes
d35c666 fix [3385504] Surface flinger hang when adding dim surface
1723b04 fix [3389263] OMX.Nvidia.h264.decode fails to shutdown
1b0114f fix a surface leak in SurfaceFlinger

Bug: 3513017

Change-Id: Ia13ed8c9cdcb1f484e177cdcaff687e7c88a10c3
2011-03-07 16:56:16 -08:00
Mathias Agopian
1c71a47a6d remove some logs
Change-Id: Ia476184048ee419e19330a56dc8e6553189f6a24
2011-03-02 18:45:50 -08:00
Jamie Gennis
e7809762e1 am 0dc5fdb9: am e630e5f4: am 919853ce: Merge "Prevent SurfaceFlinger from using layer token 31." into gingerbread
* commit '0dc5fdb9b2fd3b3e2ede5e9607bc21423f357a01':
  Prevent SurfaceFlinger from using layer token 31.
2011-02-27 16:04:42 -08:00
Jamie Gennis
d1ad86f66b am e630e5f4: am 919853ce: Merge "Prevent SurfaceFlinger from using layer token 31." into gingerbread
* commit 'e630e5f49ba15005172dceeda7299569b2d2351f':
  Prevent SurfaceFlinger from using layer token 31.
2011-02-27 15:55:21 -08:00
Jamie Gennis
db7b742f65 am 919853ce: Merge "Prevent SurfaceFlinger from using layer token 31." into gingerbread
* commit '919853ce244f853966817d4adb2f3b7b6e4bbe74':
  Prevent SurfaceFlinger from using layer token 31.
2011-02-27 15:44:36 -08:00
Eric Hassold
ab0225e330 Merge "Correctly handle translucency of device-specific pixel formats" 2011-02-23 14:10:04 -08:00
Ichitaro Kohara
2168e2de24 Fixed to call computeVisibleRegions() when transparent value changed
When some Surfaces are overlapping and one of them changed to
transparent or opaque, the back Surfaces should appear or
disappear. This patch calls SurfaceFlinger::computeVisibleRegions()
to re-calculate region of each Surface to implement the behavior.

Change-Id: Iffb1caf1b4ce28dff252e114fe5b9b07d9c84a6f
2011-02-17 12:31:23 +01:00
Mathias Agopian
a1f47b90ab fix a surface leak in SurfaceFlinger
SF kept a strong reference to ISurface until the
window manager removed the surface from the screen.
This fell appart when running standalone tests, that is
when the window manager wasn't involved.

When the window manager is around, it would clean-up surfaces
even when an application died.

with this change, SF is able to do its own cleanup without
relying on the window manager.

the change is very simple, we simply don't keep a reference
to ISurface and make sure no more than one of them can
be created.

Change-Id: I61f2d7473bf8d4aa651549a846c34cdbb0d0c85a
2011-02-16 15:31:07 -08:00
Eric Hassold
ac45e6bff1 Correctly handle translucency of device-specific pixel formats
Check requested format for device-specific formats, and assume (as
documented in libhardware/include/hardware/hardware.h) this is opaque
layer so no blending is necessary.

Bug: 3215931
Change-Id: Ib4dff8060ac522d201ff1e74807ac340c17d3fa7
2011-02-15 16:20:03 -08:00
Jamie Gennis
8a08392833 Prevent SurfaceFlinger from using layer token 31.
Bug: 2964479
Change-Id: I81e948924bff35b8b300d409f2c09f3779bcdeec
2011-02-10 16:18:36 -08:00
Mathias Agopian
48840800f4 am 50b029d5: am 7ba35f5a: Merge "[3418265] apply layer transformations to the DimLayer." into honeycomb
* commit '50b029d578fa06cd0733dcc7c69cb94f5f824908':
  [3418265] apply layer transformations to the DimLayer.
2011-02-02 16:46:46 -08:00
Mathias Agopian
bce26daaaf [3418265] apply layer transformations to the DimLayer.
with this change DimLayers will behave just like any other layer,
in particular they'll respect the layer transformations.

Change-Id: Icb4a1275e8bca9e3deb5f57c9f9219aaa69f9877
2011-02-02 16:05:39 -08:00
Jamie Gennis
79676ac8e6 am 09443aeb: am 62884505: Merge "Reset ANativeWindow crop on buffer geometry changes." into honeycomb
* commit '09443aeb6470d66f5bc1938b70d74b3e2f9bbbb9':
  Reset ANativeWindow crop on buffer geometry changes.
2011-01-30 15:05:42 -08:00