Commit Graph

861 Commits

Author SHA1 Message Date
Mathias Agopian 1eae0ee494 clean-up SurfaceFlinger a bit
- most methods on Layer didn't need to be virtual
- more consistency in naming drawing/current state

Change-Id: Ieb7b4951b40fc673b807994ed21ae4aea7281068
2013-06-06 13:06:10 -07:00
Mathias Agopian 2e3a7f1e3d Merge "Basic binary event-log helpers" 2013-06-06 00:01:15 +00:00
Mathias Agopian 7cc6df5957 fix a possible deadlock when removing a layer and destroying a client
generally the last reference to a Layer is released in commitTransaction()
with mStateLock held. Layer itself only holds weak references to Client,
however, ~Layer() briefly promotes this weak reference -- during that time
the all other strong references to that Client go away, ~Layer is left with
the last one... then hell breaks loose as ~Client is called, which in turn
needs to acquire mStateLock.

We fix this by holding a temporary copy of the drawing state during
the transaction so that the side-effects of copying the current
state into the drawing state are seen only after mStateLock has
been released.

Bug: 9106453
Change-Id: Ic5348ac12283500ead87286a37565e8da35f1db2
2013-06-05 14:38:23 -07:00
Mathias Agopian 85cce376cb Basic binary event-log helpers
EventLog can be used from SurfaceFlinger to log jank
statistics events to the binary event log.

Change-Id: If0fbbe7d7111f10957697166d37fd0c3418109bb
2013-06-05 13:37:49 -07:00
Mathias Agopian b2397fff6f Merge changes Id5584bc1,I8ca826d0
* changes:
  revert parts of dc5b63e40, which made gyro drift estimation unstable
  use gyro timestamp directly in fusion
2013-05-30 21:30:17 +00:00
Mathias Agopian 24f9bea8eb revert parts of dc5b63e40, which made gyro drift estimation unstable
initialize the system covariance matrix with non-zero
    values for the gyro-bias part. this improves the initial
    bias estimation speed significantly.

the initial covariance matrix should be small because the drift
changes slowly. the real problem is that we're not starting with
a good estimate of the drift, which this algorithm relies on.

so with this revert, it'll take a while for the drift to be estimated
but it won't be unstable.

Change-Id: Id5584bc114a2390d507643b2451b2650c1b90721
2013-05-30 14:26:36 -07:00
Mathias Agopian 2e2a560c4b use gyro timestamp directly in fusion
we used to estimate the gyro rate and deduce the period from that
but it turns out this is causing problems.

Bug: 5192288
Change-Id: I8ca826d0e11e488587bcaa1720de99e92b82f191
2013-05-30 14:18:23 -07:00
Jesse Hall 29c3f35279 Prevent opaque windows from making framebuffer translucent
To keep the code readable now that we have four different texenv
configurations, this change separates the decisions about what
configuration to use from the GL calls to set up the configuration.

Bug: 8963244
Change-Id: Ia07a306a7809ba8f93493d0160ccbd509e948581
2013-05-24 10:51:41 -07:00
Lajos Molnar c5d7b7d323 BufferQueue: track buffer-queue by instance vs. by reference
Instead of representing the buffer-queue as a vector of buffer
indices, represent them as a vector of BufferItems (copies).
This allows modifying the buffer slots independent of the queued
buffers.

As part of this change, BufferSlot properties that are only
been relevant in the buffer-queue have been removed.

Also, invalid scalingMode in queueBuffer now returns an error.

ConsumerBase has also changed to allow reuse of the same
buffer slots by different buffers.

Change-Id: If2a698fa142b67c69ad41b8eaca6e127eb3ef75b
Signed-off-by: Lajos Molnar <lajos@google.com>
Related-to-bug: 7093648
2013-05-23 22:17:54 +00:00
Dianne Hackborn 80d7fd86e0 Power manager now takes calling package name arg.
Change-Id: Iae57b8eb7abe4e66f0d2645db8cdf57acf7dcd3e
2013-05-20 16:50:10 -07:00
Mathias Agopian 2381033ad0 am e6eef6c1: am ea74d3b7: make the warning timout of Fence::waitForever() implicit and longer
* commit 'e6eef6c136b007f3a7e1e19884875b855c0c5f95':
  make the warning timout of Fence::waitForever() implicit and longer
2013-05-17 10:18:45 -07:00
Mathias Agopian e6eef6c136 am ea74d3b7: make the warning timout of Fence::waitForever() implicit and longer
* commit 'ea74d3b78d607cde17790a7bb83e6f68ffd34cfd':
  make the warning timout of Fence::waitForever() implicit and longer
2013-05-17 10:16:51 -07:00
Mathias Agopian 0319306670 various fixes to the sensorservice
1) "google" sensors are now reporting AOSP as the vendor string
2) don't expose the system's sensor fusion if the HAL provides it
3) use uncalibrated gyro if availble for the system's sensor fusion

Change-Id: I25140436cdb29d55e39fd6fbbf8c44a410a83d5c
2013-05-16 18:47:21 -07:00
Mathias Agopian ea74d3b78d make the warning timout of Fence::waitForever() implicit and longer
- timeout is now 3 seconds instead of 1
- simplifies the API a bit
- allows us to change/tweak this timeout globaly

Bug: 8988871

Change-Id: I8d3c6ec43a372f602fb3f29856710339f86c0ec9
2013-05-16 18:15:57 -07:00
Jesse Hall 59eaeed5fa am 28fc78bf: am e8fed71d: Merge "Abort surface composition if hw surface is invalid"
* commit '28fc78bf5fbb6288a27f3f25565a960a1873b0ef':
  Abort surface composition if hw surface is invalid
2013-05-13 23:31:54 -07:00
Jesse Hall 28fc78bf5f am e8fed71d: Merge "Abort surface composition if hw surface is invalid"
* commit 'e8fed71da2d3e03ef933d308520bab5b860f05aa':
  Abort surface composition if hw surface is invalid
2013-05-13 23:28:45 -07:00
Michael Chock c8c7109619 Abort surface composition if hw surface is invalid
If an invalid display device is detected during surface composition
(e.g., a simulated secondary display is removed), abort the
composition.

Change-Id: Ia6afb2e287882d8ae0614eb25463d3f85b687adf
2013-05-13 13:26:19 -07:00
Mathias Agopian f3e85d4327 take the "transparent region" into account for blending
until now it was only used to discard a layer entirely.
we're now reducing the size of the layer if it is still
visible, if possible.

this works for instance when a surfaceView is used and
only the menu bar is displayed over it.

Change-Id: I3f5527c5cd1e69ecc968272c8948f1513ada8c55
2013-05-10 18:35:43 -07:00
Mathias Agopian 6c7f25afb7 reformat Rect.{cpp|h}
Change-Id: I45b1f6646541a1abacce1e70df00a770e47b820e
2013-05-10 18:03:31 -07:00
Mathias Agopian b6df7d0e4c make all libsurfaceflinger and libsensorservice symbols's visibility hidden
we only export the main entry-point.
this saves about 150KB.

Change-Id: I55eb2b6705386fdfa43860deb62f9cdd2a0982aa
2013-05-09 16:51:37 -07:00
Jesse Hall c0db61966a am dda42952: am 64f3b2fd: Merge "Remove experimental HWC virtual display support" into jb-mr2-dev
* commit 'dda4295221f831560ca9d554cd9b7be1c672d0b6':
  Remove experimental HWC virtual display support
2013-05-08 15:05:15 -07:00
Jesse Hall e737c11cd8 Remove experimental HWC virtual display support
Bug: 8384764
Change-Id: I97b52ed83ad85466bd91cb9291308994048568a1
2013-05-07 11:58:47 -07:00
Mathias Agopian 0aea53ff3f use a Framebuffer Object to render all screenshots
this allows us to render into a buffer with a
pixelformat of our own choice; this is much faster
on all platform.

Bug: 8582615
Change-Id: I61298fc8e43fa6f92044c5123955cb5c7897dab7
2013-04-29 21:06:06 +02:00
Mathias Agopian 3e25fd8609 Add a --color option to dumpsys SurfaceFlinger
colorize a bit the output of dumpsys SurfaceFlinger to
make it easier to read. Right now it will bold the
title of each section and use green for the name of
each layer.

Change-Id: I0d9f18d115401cb45109d244ef3a278481f68cc6
2013-04-22 21:51:28 +02:00
Mathias Agopian 74d211ae26 clean-up/simplify all dump() APIs
remove the scratch buffer parameter and use
String8::appendFormat() instead.

Change-Id: Ib96c91617c8e7292de87433d15cf6232b7d591b0
2013-04-22 21:51:28 +02:00
Mathias Agopian bd1153382e allow dumpsys SurfaceFlinger in user builds from the shell user
Bug: 8659013
Change-Id: I1de43bb5808cb8c1103cfc73dca59ff70fc13f91
2013-04-18 16:41:04 -07:00
Jaikumar Ganesh 4c01b1ad80 Fix activation issue with auto disabled sensors.
Auto disabled sensors get auto disabled after trigger.
An activation after this wasn't working because the
state was not being reset.

b/8609561

Change-Id: If72c9f27345e91671d7ad0a7a066f6dc3d255b78
2013-04-17 14:58:22 -07:00
Mathias Agopian 48be323236 Merge "make sure to update the "current state" when we "fake" the transaction" into jb-mr2-dev 2013-04-13 00:27:32 +00:00
Jaikumar Ganesh 2ea0c67da6 Merge "Sensor changes." into jb-mr2-dev 2013-04-13 00:22:39 +00:00
Mathias Agopian 6c67f0fe45 make sure to update the "current state" when we "fake" the transaction
this mimics the code we used for the size. basically we need to
also update the "current state" because it gets copied to the
"drawing state" when a transaction occurs, and it would
"undo" our change.

Bug: 8511430
Bug: 8581533
Change-Id: I08c02abbf21b7f168f7124cd14ee717d7d3d502c
2013-04-12 16:58:11 -07:00
Jaikumar Ganesh 4342fdf14f Sensor changes.
1. Some sensors can wake up the AP. Add wakelocks.
2. Handle backward compatibility for rotation vector
   heading accuracy.
3. Cleanup auto disabled sensors.
4. Fix race condition between enable and dispatch.

Change-Id: I39dddf12e208d83cd288201986ee994312555820
2013-04-12 09:34:44 -07:00
Chet Haase 5e5bed60d0 Merge "DO NOT MERGE Make sure surfaces always have latest orientation info" into jb-mr2-dev 2013-04-12 14:11:54 +00:00
Mathias Agopian 180f10de6f Improve screenshot performance on some devices (DO NOT MERGE)
this affects devices that need a glReadPixels(). We use
a FBO instead of a GlConsumer as an intermediate render target, this
saves 2 calls to eglMakeCurrent().

On Galaxy Nexus this allows us to go from ~135ms to ~35ms for
recent's screenshots.

Bug: 8582615
Change-Id: I6b25291ecc235f1927579bbb2db3c731e985c6e8
2013-04-11 17:35:24 -07:00
Chet Haase 91d25932b6 DO NOT MERGE Make sure surfaces always have latest orientation info
When the screen is turned off, the current stack is set to -1. This causes
logic in iSurfaceFlinger's handleTransactionLocked() function to fail to
match the current stack, and the latest orientation is not set into the
layer. This causes BufferQueue, later, to potentially set an obsolete
transformHint on a created surface (such as in the case with ImageWallpaper's
Egl surface, in the bug below).

The fix is to note this situation and use a default value for the DisplayDevice,
which should have the current orientation information.

Issue #8508397 ImageWallpaper sometimes rendered in wrong orientation causing a ~30-40% drop in graphics performance

Change-Id: Ibae15d73b289a8343c67f4f6bb77fdf11dd95ee7
2013-04-11 17:06:38 -07:00
Mathias Agopian d19e519f67 Merge "fix another bug where screenshots could end-up all black" into jb-mr2-dev 2013-04-11 04:43:49 +00:00
Mathias Agopian 9eb1f0558b fix another bug where screenshots could end-up all black
SF transactions were always handled on VSYNC which allowed
the screenshot to sneak-in between closing the transaction
and vsync (before it's latched), resulting in a screenshot
with the previous state.

we now always force transactions to happen immediately
before screenhots.

Bug: 7552304
Change-Id: I0afc86b7e8366173daff5b9988bbb4d2a0f43860
2013-04-10 16:27:17 -07:00
Ying Wang 8a0cb4ee0b Add liblog
Bug: 8580410
Change-Id: I2ca4fa00dde0b574df3619134836bcb9315bd506
2013-04-09 21:55:39 -07:00
Jesse Hall 1df59c93fe Merge "Tell HWComposer the dimensions of virtual displays" into jb-mr2-dev 2013-04-06 03:32:19 +00:00
Jesse Hall d5e345b0cf Merge "Actually set the virtual display output buffer." into jb-mr2-dev 2013-04-06 03:31:49 +00:00
Jesse Hall 1c569c4d45 Tell HWComposer the dimensions of virtual displays
HWComposer queries the HWC for dimensions of physical displays, but
can't do that for virtual displays. The dimensions are used to set the
display frame of the framebuffer target layer passed to HWC, and
implicitly the dimensions of the virtual display.

Bug: 8316155
Change-Id: I9cbd2530d2fa878f86128a1472def520b5d694a5
2013-04-05 14:38:52 -07:00
Jesse Hall 6d5b8e600e Merge "Clean up HWC state when releasing a DisplayDevice" into jb-mr2-dev 2013-04-04 22:36:10 +00:00
Jesse Hall 2ba647e9f5 Actually set the virtual display output buffer.
Bug: 8316155
Change-Id: Ida1ac47e5a932fdaad3ec862e121cfe55d255699
2013-04-04 12:59:37 -07:00
Mathias Agopian 2ca79399b9 latch transparent region hint only when we get a new frame
since the transparent region hint really depends on the
content of the window containing the SurfaceView
(it's calculated by the view hierarchy based on
overlapping views), it makes sense to latch it only when
the content of the window (the app) changes.

This should help fixing drawing artifacts when changing the
layout of a window containing a SurfaceView.

Bug: 8511430
Change-Id: Ic3aa668495293cb4d82a2cd7dcf3b6a337287678
2013-04-02 18:30:32 -07:00
Mathias Agopian 33ceeb3258 Fix include paths
Change-Id: If5350a3de995cc0cb1afea067e7ce168bc00d3f5
2013-04-01 16:54:58 -07:00
Mathias Agopian ca08833d5e don't use compile-time configuration of libgui as much as possible
We now detect at runtime which sync features to use, which
allows us to remove a lot of the compile-time configuration
options. There  is still one option though, to disable
KHR_fence_sync on some devices (which are more efficient
without it).

- added a backdoor to get the vendor's EGL strings

the new logic is:
- use always ANDROID_native_fence_sync if available
- fallback to KHR_fence_sync if available and not disabled
  by the compile-time option
- use KHR_wait_sync if available and either of the above is
  enabled

Change-Id: I9c4b49d9ff1151faf902cc93bd53ea5f205aaabf
2013-03-29 15:33:47 -07:00
Mathias Agopian 8171aece3d fix uninitialized attribute in SurfaceFlinger
Change-Id: I8277f67e297a8b6a99195387060d03154a2cd929
2013-03-28 17:52:36 -07:00
Jesse Hall b1196e6356 Remove unused clz.cpp
Change-Id: Ieed91a45ba0e865a0d47d84effe9439aaab4371f
2013-03-28 12:27:01 -07:00
Jesse Hall 02d86567d9 Clean up HWC state when releasing a DisplayDevice
DisplayDevices can be released when DisplayManager removes them from
the display list, or (for virtual displays) when the surface is set to
NULL. We were only cleaning up HWC resources associated with the
display in the first case.

Bug: 8384764
Change-Id: Id3d226dd7178fbe6d0a2ac4e2660b864ee073de3
2013-03-27 14:58:09 -07:00
Jesse Hall ffe1f19ca9 Fix virtual displays for HWC<=1.1
If we're using a HWC that doesn't support virtual displays, or we have
more virtual displays than HWC supports concurrently, the
VirtualDisplaySurface should simply be a passthrough from source
(GLES) to sink.

This change also tries to distinguish between display types and HWC
display IDs a little better, though there's more to do here. Probably
needs a higher-level rethink; it's too error-prone now.

Bug: 8446838
Change-Id: I708d2cf262ec30177042304f174ca5b8da701df1
2013-03-22 15:27:58 -07:00
Jesse Hall 48bc05b56d Fix dump when virtual display exists
SurfaceFlinger::getLayerSortedByZForHwcDisplay only worked for builtin
displays.

Bug: 8384764
Change-Id: I989275407fb2f06d166a6e70321c3211e27e562e
2013-03-22 15:27:58 -07:00