Commit Graph

49 Commits

Author SHA1 Message Date
Mathias Agopian db403e8ff0 split-up Client.h out of SurfaceFlinger.h
Change-Id: I1993bf23e417163749d886283563a93d50b361b4
2012-06-18 16:47:56 -07:00
Mathias Agopian 3e8b853d67 refactor HWComposer to break dependency with the HAL headers
HWComposer must abstract the HWC HAL entirely, so that the
HAL can continue to evolve (and break binary compatibility)
without breaking SurfaceFlinger. The HWC data structure had
leaked outside of HWComposer, this is now fixed.

We now have an abstract interface that provide all the
needed functionality, HWCompose provides concrete
implementations of it based on the the HWC version.

Change-Id: I40c4676dc986b682ede5520a1c60efe64037b0bb
2012-06-14 11:56:55 -07:00
Mathias Agopian 05cec9d127 improve resize transactions
use a flag instead of pre-committing the "requested" state
to prevent propagation or "requested" to "active", which makes
things a lot clearer when reading the code.

also avoid going through the "resized" code-path when requested
size is equal to "active" size.

Bug: 6498869
Change-Id: I24f893ba0ec5ca06aac5b8da9818989ae7ce4005
2012-05-23 18:01:24 -07:00
Mathias Agopian b30c415539 Fix "Battery/Status/Clock status bar area flickers when dragging down"
The crop is now handled like a resize, it's latched only when we
receive a new buffer in the case we have a resize in the same
transaction.

Bug: 6498869
Change-Id: I9f3cbbe08fb19443899461ec441c714748a4fd1a
2012-05-16 18:21:32 -07:00
Mathias Agopian 93ffb86b90 minor refactoring in praparation of crop fix
Bug: 6498869
Change-Id: I12a6f9a9fdfd2ea1db3fbe5fc8cb443aeaedb328
2012-05-16 17:07:49 -07:00
Jamie Gennis f15a83f581 SurfaceFlinger: add a crop to the layer state
This change adds a crop rectangle specified in window coordinates to the layer
state.  The all window pixels outside this crop rectangle are treated as though
they were fully transparent.  This change also adds the plumbing necessary for
WindowManager to set that crop.

Change-Id: I582bc445dc8c97d4c943d4db8d582a6ef5a66081
2012-05-11 03:16:02 -07:00
Mathias Agopian f74e8e0602 don't attempt to clip layers anymore using glScissor
this seems to hurt performance on some GPU. this change
might negatively affect performance on other GPUs though, but
probably in less time-sensitive cases. If this becomes a
problem it might become necessary to pre-clip the geometry
(so that we don't have to use glScissor).

This improves the rotation animation quite a bit.

Change-Id: I5dbe1286f7ad858ef2c1e1ad9a07ee3f26c0b1f3
2012-04-16 03:19:15 -07:00
Mathias Agopian a2f4e56fec get rid off preserve backbuffer optimization in SF
this optimization didn't improve performance and in fact
seemed to hurt more than anything else. it also made
things a lot more complex as it introduced edges cases
when switching to/from h/w composer.

Change-Id: Iaafc235e175f5740cd98bff914d706e02ab88bb8
2012-04-16 03:19:15 -07:00
Mathias Agopian c95dbdc236 improve SF dumpsys 2012-02-05 00:19:27 -08:00
Mathias Agopian 99ce5cdeb3 separate transactions from updates
with this changes, SF transactions are handled as soon as possible
but do not trigger updates. the update is delayed until the next
vsync.

this allows us to work much better without requiring triple-buffering.

Change-Id: I1fa10794d0cf742129f0877698b7b1e1f2ec7401
2012-02-01 20:43:06 -08:00
Mathias Agopian 25e66fc324 added a few more commands to SF's dumpsys
--latency-clear [name]
clears the latency data for the specified layer or for
all layers if none is specified

--list
prints the list of all layers regardless of their visibility

Change-Id: I7c07ae020f838c173b98ee50f3fb3e93da78acbb
2012-01-28 22:31:55 -08:00
Mathias Agopian 82d7ab6c7e improve SurfaceFlinger dumpsys
It is now possible to say:

dumpsys SurfaceFlinger --latency

to print latency information about all windows

dumpsys SurfaceFlinger --latency window-name

to print the latency stats of the specified window

for instance: dumpsys SurfaceFlinger --latency SurfaceView

The data consists of one line containing global stats, followed by
128 lines of tab separated timestamps in nanosecond.

The first line currently contains the refresh period in nanosecond.
Each 128 following line contains 3 timestamps, of respectively
the app draw time, the vsync timestamp just prior the call to set and
the timestamp of the call to set.

Change-Id: Ib6b6da1d7e2e6ba49c282bdbc0b56a7dc203343a
2012-01-24 18:22:56 -08:00
Glenn Kasten 99ed22412d Use the standard CC_LIKELY and CC_UNLIKELY macros
Several source files privately defined macros LIKELY and UNLIKELY in terms
of __builtin_expect. But <cutils/compiler.h> already has CC_LIKELY and
CC_UNLIKELY which are intended for this purpose.  So rename the private
uses to use the standard names.

In addition, AudioFlinger was relying on the macro expanding to extra ( ).

Change-Id: I2494e087a0c0cac0ac998335f5e9c8ad02955873
2012-01-05 07:33:45 -08:00
Mathias Agopian c492e67810 Make sure set GL state properly
when taking a screenshot, in particular, we could end up
with stale GL state when drawing LayerDim which resulted
in incortect rendering.

Bug: 5467587
Change-Id: Id9fbed2843481d31063620f3662b364c7e3ac781
2011-10-18 15:32:57 -07:00
Jamie Gennis 8d91b42507 SurfaceFlinger: fix the transform hint
This change fixes the transform hint to use only the global display
transform rather than incorporating the transient layer-specific
transform used during animations.

Bug: 5366891
Change-Id: I5408dcd3f4771d010953e8a696a484c835bfe81e
2011-09-24 11:27:20 -07:00
Mathias Agopian f9abeb956f Fix another problem with refreshing the screen when switching to/from overlay
the previous fix was incorrect. See comment in setupHardwareComposer for
full explanations.

Change-Id: Ib24a9af000b8f95cf7319f9272d34997064ceb6d
2011-09-09 01:47:48 -07:00
Mathias Agopian 22da60c3e6 Improve SF dumpsys output wrt HWC
Change-Id: Ibdb7930fa3b521bfd3f44750ed98cfd75f9a01fe
2011-09-09 00:49:44 -07:00
Mathias Agopian f384cc3008 Fix an issue is SF that caused drawing artifacts when hwc changed mode
we were not redrawing and/or clearing the FB properly when
hwc moved a layer from/to FB to/from OVERLAY.

In these cases we needed to expand the dirty region to include
the layer that changed mode.

Also split composeSurfaces() which was becoming quite large.

Change-Id: Id6fa1acfc4ff694037fddf7efd037a4405732073
2011-09-08 22:43:01 -07:00
Mathias Agopian 3f41963ccb Merge "fix Surface positions are not floats" 2011-08-30 19:24:04 -07:00
Mathias Agopian 41b6aabf35 fix Surface positions are not floats
Added Surface.setPosition(float, float) which allows to set a surface's
position in float.

Bug: 5239859
Change-Id: I903aef4ad5b5999142202fb8ea30fe216d805711
2011-08-30 18:51:54 -07:00
Mathias Agopian c7f3381c3b fix display artifacts in preview screen in timelapse video mode
We were not updating the h/w composer state when the buffer size
changed.

We also didn't update the h/w composer state when the transformation
matrix changed (which is related to the above issue, since it would
probably change when the buffer size changes).

Also moved updating the crop to setGeometry(), since we decided
that the "crop" change requires the GEOMETRY_CHANGED flag (ie:
not need to do this every frame)

Bug: 5238473

Change-Id: Ia7b47e145b48581b568d89d9aa2c14ff778be862
2011-08-30 15:31:51 -07:00
Mathias Agopian d992db3827 give the proper orientation to the h/w composer HAL
we were using the "orientation" value instead of the
real transform, which may contain arbitrary rotations for
instance, and in some case ended up with a final "orientation"
that looked valid, but wasn't.

this fixes a problem on devices with a h/w composer hal where
the rotation animation looked weird.

Change-Id: I4be8a2a1bde49c33456fcf5c8d87ab515c216763
2011-08-18 18:33:44 -07:00
Jamie Gennis 582270d69d SurfaceTexture: fix queues-to-composer
This change fixes the NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER query of
Surface and SurfaceTextureClient.  Surface now uses the inherited
SurfaceTextureClient implementation of this query.  SurfaceTextureClient
now queries SurfaceFlinger to determine whether buffers that are queued
to its ISurfaceTexture will be sent to SurfaceFlinger (as opposed to
some other process).

Change-Id: Iff187e72f30d454229f07f896b438198978270a8
2011-08-17 18:19:00 -07:00
Mathias Agopian a537c0f42e update HWC data structures even when a layer is marked for SKIP
Change-Id: I16bcf44cd617814a14a795429bde2f39f411077d
2011-08-02 15:51:37 -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 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 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 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
Jamie Gennis 68f9127e88 Reset ANativeWindow crop on buffer geometry changes.
This changes the ANativeWindow API and the two implementations to reset
the window's crop rectangle to be uncropped when the window's buffer
geometry is changed.

Bug: 3359604
Change-Id: I64283dc8382ae687787ec0bebe6a5d5b4a0dcd6b
2011-01-28 18:21:54 -08:00
Mathias Agopian 0d1561275e fix [3385504] Surface flinger hang when adding dim surface
Change-Id: I8e0cda414bcad5854d2ca5dde8370bfd8b2e5ea4
2011-01-25 20:52:46 -08:00
Mathias Agopian 2bd1d95efe clean-up unneeded code
now that we removed the notion of a "inUse" buffer in surfaceflinger
a lot of code can be simplified / removed.

noteworthy, the whole concept of "unlockClient" wrt. "compositionComplete"
is also gone.

Change-Id: I210413d4c8c0998dae05c8620ebfc895d3e6233d
2011-01-20 12:10:11 -08:00
Mathias Agopian 48b888aab9 improve SurfaceFlinger 'dumpsys' log
list the purgatory, which shows windows that have been closed,
but for which the client still has references.

Change-Id: I5168bb88cb328d5d77d71d0871deb9190f493126
2011-01-19 16:15:53 -08:00
Mathias Agopian ad456f9878 fix [3312683] Camera mirroring problem after switching from back to front camera
the crop as well as buffer orientation can change at every frame, when that happens
we need to reset the hwc HAL (ie: set the GEOMETRY_CHANGED flag).
currently we achieve this by taking the same code path than an actual geometry change
which is a bit more heavy than necessary.

Change-Id: I751f9ed1eeec0c27db7df2e77d5d17c6bcc17a24
2011-01-13 17:53:01 -08:00
Mathias Agopian a5529c8778 remove support for PUSH_BUFFER surfaces and overlays
the same functionality is now supported through
the h/w composer HAL, and YUV support in the GPU.

Change-Id: I8146605449954b8e8fd7f78810b7d873c2d8f5bf
2010-12-08 16:13:59 -08:00
Mathias Agopian a1aa18fc26 resolved conflicts for merge of a0f011ff to master
Change-Id: I4c17021fc269ce66c98cc345353600eda332f980
2010-12-07 22:53:40 -08:00
Mathias Agopian 733189d408 [3171580] Fix two typos related to fixed-size buffers
mFixedSize was never set, this bug was introduced during some "cleanup", in
practice this could cause some issues when a fixed-size buffer was used and
the window was resized.

Layer::drawForSreenShot() had a typo that had no effect.

mFixedSize was used to determine if filtering was needed, which was a bit too
conservative and created a dependency between filtering and "fixed size" states
which should exist.

Now we enable filtering based on the size of the buffer vs. the size of the layer.

Change-Id: I32044e91b0c944c1b137efdceb3f01dfaa78119d
2010-12-03 17:35:06 -08:00
Mathias Agopian c23902b27f am 5c0efef9: am 7d452f69: Merge "really fix [3118445] Transform * Transform does not work as expected" into gingerbread 2010-10-27 23:48:26 -07:00
Mathias Agopian 883dffaa00 really fix [3118445] Transform * Transform does not work as expected
Two bugs were counter acting each other.
- rotation matrices are on the left-hand side of multiplies
- the transform of the overlay is applied before that of the layer

Change-Id: Ia79bd368e9b719235c89ecf244ea263f01ce906a
2010-10-27 18:04:11 -07:00
Mathias Agopian eb8f8980d4 am 5d477279: am cf6b2765: Merge "fix a bug where FLIP_H would do a 180 rotation" into gingerbread
Merge commit '5d477279e6e41c9d61abe66dcded5c57a51e2c78'

* commit '5d477279e6e41c9d61abe66dcded5c57a51e2c78':
  fix a bug where FLIP_H would do a 180 rotation
2010-10-12 13:57:09 -07:00
Mathias Agopian 3c2c54c270 fix a bug where FLIP_H would do a 180 rotation
Change-Id: Ie2cc4a8543a5625750c8596f87edcb66fcbca31f
2010-10-11 14:19:24 -07:00
Mathias Agopian df85c455c3 refactored screenshot code
the core screenshot function now can capture the screen at any lower resolution
performing bilinear filtering.

we also now have some client code to interface with the screenshot service.

it's now possible to request a screenshot at a lower resolution.

Change-Id: I33689bba98507ab928d0898b21596d0d2fe4b953
2010-10-04 17:36:17 -07:00
Mathias Agopian 74c40c0a27 refactored screenshot code
the core screenshot function now can capture the screen at any lower resolution
performing bilinear filtering.

we also now have some client code to interface with the screenshot service.

it's now possible to request a screenshot at a lower resolution.

Change-Id: I5a3b0e431421800e3aad601d9af8f94adffbc71f
2010-09-29 16:55:15 -07:00
Mathias Agopian 4ad298c12c am bc4389ed: am 8395b462: Merge "fix [2931513] Add support for setting the orientation of an ANativeWindow" into gingerbread
Merge commit 'bc4389edfbb5777aec1a9af7863b2ca3ade2fa64'

* commit 'bc4389edfbb5777aec1a9af7863b2ca3ade2fa64':
  fix [2931513] Add support for setting the orientation of an ANativeWindow
2010-08-24 17:56:40 -07:00
Mathias Agopian b661d66013 fix [2931513] Add support for setting the orientation of an ANativeWindow
Also implement support for cropping.

Change-Id: Iba5888dd242bf2feaac9e9ce26e404c1f404c280
2010-08-24 15:40:50 -07:00
Mathias Agopian 000ca8fa9a revert hwcomposer HAL changes. DO NOT MERGE.
This reverts commit:
94364b91a2894bf037b8beb027132fbb812e1434
f8e705dea48f77f1c2532fdbadd4997dd1851af0
b59beb5ca68d0228f60dda60d85e2d0226b33215
e0d5f5bcf5a8b26f4ad75f549cbf380b2c9faf20
2010-08-17 20:22:04 -07:00
Mathias Agopian a350ff9869 call into hwcomposer HAL when present
Change-Id: I70f31c69a9436a43860e78977442863ecba6d27b
2010-08-11 16:08:45 -07:00
Mathias Agopian bc7e31a84b don't handle the transparent region of a layer in draw()
this is already taken into consideration in computeVisibleRegion
and therefore not needed at draw time.

Change-Id: I3fc7336d22f1147dfcd3a20fd71bf79b946d971f
2010-08-11 16:05:06 -07:00
Mathias Agopian f6679fc6f7 get rid of our LayerVector implementation
we now use SortedVector<> with a special compare implementation.

Change-Id: I910459cf3b3c8993b55ad0786a8c348369262de5
2010-08-11 16:05:05 -07:00
Mathias Agopian 81bac09fa6 move native services under services/
moved surfaceflinger, audioflinger, cameraservice

all native services should now reside in this location.

Change-Id: Iee42b83dd2a94c3bf5107ab0895fe2dfcd5337a8
2010-07-14 17:59:35 -07:00