Commit Graph

463 Commits

Author SHA1 Message Date
Mathias Agopian
3094df359d First prototype atttempting to support an external display
both API and implementation will change, this is just a prototype
intended to show feasability.

SurfaceFlinger is passed an ISurfaceTexture through a new
callback, it is in turn used to create an EGLSurface which
surfaceflinger will draw into in addition to the main screen.

Change-Id: Id0bbb0b854bb7bae44d57246a90b65d4567f9a21
2012-06-28 15:51:08 -07:00
Jesse Hall
ef19414bd8 Transfer HWC release fences to BufferQueue
After a HWC set, each SurfaceFlinger Layer retrieves the release fence
HWC returned and gives it to the layer's SurfaceTexture. The
SurfaceTexture accumulates the fences into a merged fence until the
next updateTexImage, then passes the merged fence to the BufferQueue
in releaseBuffer.

In a follow-on change, BufferQueue will return the fence along with
the buffer slot in dequeueBuffer. For now, dequeueBuffer waits for the
fence to signal before returning.

The releaseFence default value for BufferQueue::releaseBuffer() is
temporary to avoid transient build breaks with a multi-project
checkin. It'll disappear in the next change.

Change-Id: Iaa9a0d5775235585d9cbf453d3a64623d08013d9
2012-06-21 22:21:12 -07:00
Mathias Agopian
aa049f0d19 am 8aaf3e47: am a67e418e: Exit boot animation cleanly.
* commit '8aaf3e47a51aa0beebecc8c536504d310d07cda9':
  Exit boot animation cleanly.
2012-06-20 13:39:58 -07:00
Mathias Agopian
a67e418e1f Exit boot animation cleanly.
The desc.txt file can now mark parts as 'must finish cleanly' by using
'c' as the part line prefix rather than 'p'.  If so indicated, if the
bootanimation is asked to quit it will do so only after waiting to
finish that part.

I considered either making init.c service killing smarter or promoting
bootanim to be a bindable service with a requestExit method.  However,
these changes are probably too big/risky given our ship date.  So
I used a property as a mailbox between SurfaceFlinger and bootanim.

Bug: 6679877
Change-Id: Id7dca22caa50b450fff25ca94f7242d971034f41
2012-06-19 17:32:00 -07:00
Jesse Hall
549646d29f Merge "Add support for HWC_DEVICE_API_VERSION_1_0" 2012-06-19 08:55:12 -07:00
Mathias Agopian
5df996211d fix typo in makefile LOCAL_CFLAGS was spelled LOCAL_CLFAGS
Change-Id: I58b96d28f608ce16fcad5ed0efb887e582779e03
2012-06-18 17:27:56 -07:00
Mathias Agopian
db403e8ff0 split-up Client.h out of SurfaceFlinger.h
Change-Id: I1993bf23e417163749d886283563a93d50b361b4
2012-06-18 16:47:56 -07:00
Jeff Brown
d50fdb0209 am bbdad819: am 7c24b1d4: Merge "SF could get stuck waiting for vsync when turning the screen off" into jb-dev
* commit 'bbdad8193ea3a16e9f65f32f4469959577b400e9':
  SF could get stuck waiting for vsync when turning the screen off
2012-06-18 10:52:34 -07:00
Mathias Agopian
d3076aca0f Merge "Implement SurfaceFlinger's ANW on top of BufferQueue" 2012-06-15 15:34:55 -07:00
Mathias Agopian
7d88647473 SF could get stuck waiting for vsync when turning the screen off
When turning the screen off we could have 2 waiters on the
vsync condition: The main vsync waiter as well as one in
onScreenReleased(). We were only signaling the condition though,
so it it would be possible to wake onScreenReleased() without waking
the main vsync thread which would then be stuck in .wait().

We fix this by just using broadcast() when receiving a vsync event.

We also add a broadcast() to signal when the state of
mUseSoftwareVSync changes.  This is important particularly for
the transition from hardware to software vsync because the main
vsync waiter might have observed mUseSoftwareVSync == false
and decided to block indefinitely pending a hardware vsync
signal that will never arrive.

Removed a potentially deadlocking wait for a signal in
onScreenReleased().  The function was trying to wait for the last
vsync event from the hardware to be delivered to clients but there
was no guarantee that another thread would signal it to wake up
again afterwards.  (As far as I can tell, the only other other
thread that might wake it up at this point would be a client
application issuing a vsync request.)  We don't really need to wait
here anyhow.  It's enough to set the mUseSoftwareVSync flag,
wake up the thread loop and go.  If there was a pending vsync
timestamp from the hardware, then the thread loop will grab
it and use it then start software vsync on the next iteration.

Bug: 6672102
Change-Id: I7c6abc23bb021d1dfc94f101bd3ce18e3a81a73e
2012-06-15 14:59:31 -07:00
Jesse Hall
5880cc5738 Add support for HWC_DEVICE_API_VERSION_1_0
The acquire and release fences aren't yet used; this is just support
for the new version and temporary backwards compatibility for older
versions.

Change-Id: Ia5ccc05a97c86f649042b9a35e11042fa0187e84
2012-06-14 12:35:32 -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
3e87601170 Implement SurfaceFlinger's ANW on top of BufferQueue
SF now has its own implementation of ANW for the
framebuffer and it uses BufferQueue. FramebufferNativeWindow
is now only used by stand-alone apps.

Change-Id: Iddeb24087df62bd92b0f78e391dda9b97ddc859c
2012-06-13 18:07:47 -07:00
Colin Cross
52cf768fc2 Merge "surfaceflinger: replace early suspend with binder call from PowerManager" 2012-06-08 14:14:18 -07:00
Mathias Agopian
0cd545f142 sometimes we would incorrectly scale the content of a surface
this would happen when a resize was pending (ie: we have received
and processed a resize transaction but have not received a buffer
with the right size) and a new transaction came in that didn't
involve a resize, for instance a translate-only transaction.

in this case, we would incorrectly update the drawing state
with the pending size, eventhough we still don't have a buffer
for it.

the solution is quite simple, we never allow the size to propagate
from current to drawing state during the regular transaction processing
(unless we are in fixed-size mode -- meaning we don't need to have
a matching size buffer), this propagation happens later once we
receive the buffer.

Bug: 6624163
Change-Id: I11a97e4b88a7f3a0571ddcfe99c86cb04ce01a4d
2012-06-07 17:12:20 -07:00
Colin Cross
8e533069e5 surfaceflinger: replace early suspend with binder call from PowerManager
SurfaceFlinger will no longer directly synchronize with early suspend.
Instead, PowerManagerService will synchronize with SurfaceFlinger to
ensure that a black frame has been drawn on the display, and then
trigger all early suspend handlers.

Change-Id: I07acdd628440d23fdb69db94319ec5d65d3f4919
2012-06-07 16:28:30 -07:00
Jamie Gennis
ba43e0a1fa Merge "SurfaceFlinger: remove all GLES scissor calls." into jb-dev 2012-06-06 15:45:10 -07:00
Jamie Gennis
a4c5b19dd7 SurfaceFlinger: remove all GLES scissor calls.
Bug: 6576505
Change-Id: I494b7627f2e271a234706bf49a9490f8ac56c77a
2012-06-05 19:14:44 -07:00
Mathias Agopian
4824d40a35 sometimes SF would not process a surface resize
this would happen when a window started with size A, was
resized to B and immediately resized to A. In this situation
the erquested and active size would be the same, and SF
would think a transaction wasn't needed.

we fix this by always comparing the requested sizes.

Also, make sure to set mRefreshPending once we're sure
we have succesfully called updateTexImage().

Bug: 6580962
Change-Id: I2c48b4df7f05fd35c9e1d2dd82095b0f3d5a0b6a
2012-06-04 18:16:30 -07:00
Mathias Agopian
e31564d8eb Fix a crasher is surfaceflinger.
this bug introduced recently would happen when the very first
buffer of a surface was rejected for not having the right size

Bug: 6577035
Change-Id: I9fabf20006019f2a6c308be7c7f5c05bdcfd5014
2012-05-29 20:41:03 -07:00
Mathias Agopian
2c8207e962 add the ability to reject buffers in SurfaceTexture::updateTexImage
SurfaceFlinger is using this new feature to reject buffers that
don't have the right size.

Bug: 6498869
Change-Id: I8a7250a47db6c082a357b703feb3b9d0fc8d3443
2012-05-23 18:01:33 -07:00
Mathias Agopian
702634a4da refactoring in preparation for bug:6498869 fix
here we just shuffle a bit the code inside lockPageFlip(),
we move the code that handles the buffer size closer to the call
to updateTexImage(). no functionality change.

Change-Id: Ie3193cd86cd32cf3c89532449fd747d145ca0ab6
2012-05-23 18:01:33 -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
419e196e63 Improve debug logs and minor clean-up
Bug: 6498869
Change-Id: I14d1b4d6960b87b5a7c4d7e20b92538edd9331ff
2012-05-23 18:01:14 -07:00
Mathias Agopian
ed9807bd7d we need to wait for vsync when doing the screen-off animation
Bug: 6511421
Change-Id: I7a85a55e66a3a8d9937df575e98a5efec01a634f
2012-05-18 14:30:40 -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
cbad735d8c SurfaceFlinger: recompute visible regions less
This change removes some visible region recomputation that was needed to handle
the SCALING_MODE_FREEZE cropping.  We've changed things to use a window crop
from the WindowManager instead, so this is no longer needed.

Bug: 6299171
Change-Id: I32fbc2b689c985837126d8ba3d9a91e79613ffbf
2012-05-14 15:41:38 -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
Jamie Gennis
51dcd581b1 SurfaceFlinger: recompute visible regions more
This change makes a change in the crop, scaling mode, transform, or buffer
dimensions trigger a recomputation of the visible regions of a window.  With
the new cropping behavior for SCALING_MODE_FREEZE all of these can now affect
the visible region.

Bug: 6470541
Change-Id: I1904e47efbd708e28bf189f637d24dbef65cd41e
2012-05-10 15:35:56 -07:00
Jamie Gennis
161534a3c5 SurfaceFlinger: SCALING_MODE_FREEZE cropping support
This change adss support for applying a buffer crop to layers with the
SCALING_MODE_FREEZE scaling mode.  These layers do not scale the image, but
rather treat all pixels outside the crop rectangle as fully transparent.

Change-Id: I762518e56a37aef7747f9b581df2f2589b232c49
Bug: 6299171
2012-05-09 12:53:13 -07:00
Jamie Gennis
cbb1a95819 SurfaceFlinger: tell SurfaceTex about filtering
This change makes SurfaceFlinger set the filtering-enable on each layer's
SurfaceTexture before querying the texture matrix to use for GLES composition.

Change-Id: I40c3defd73ebf96e3cabb3bfdb1fc97f2036753a
2012-05-09 12:53:13 -07:00
Mathias Agopian
06e51a0aaf don't actuate vsync hint when not needed
Change-Id: I61c43dd76041816ab8cbe9aeaa55c11c1479ed03
2012-04-27 13:55:05 -07:00
Mathias Agopian
03e407270c set vsync power hint
Change-Id: I28c2faf9ff584df3e74392712971cbcf75eb9e98
2012-04-26 19:52:22 -07:00
Mathias Agopian
24202f5676 update the binder protocol for connect to match that of queueBuffer
indeed, connect and queueBuffer return the same data, so it's
easier to have them use the same protocol.

Change-Id: I4f9fa3be0a80c9ab0a7a4039b282ae843aab02e1
2012-04-23 20:06:02 -07:00
Mathias Agopian
a0db308c3d remove SurfaceTexture::connect()
use BufferQueue::connect() instead

Change-Id: I04aab7cf11304bf962cde38470747f3b19ddba42
2012-04-23 20:06:02 -07:00
Mathias Agopian
7f42a9c47c triple buffering is now controled by BoardConfig and enabled by default
use TARGET_DISABLE_TRIPLE_BUFFERING := true to disable
triple buffering.

Change-Id: I9875d6ddefd23c1af9e51e7ee7dec1bacd1e6799
2012-04-23 20:00:16 -07:00
Mathias Agopian
56a2bbe708 SF needs to render even if we don't have a h/w composer
Bug: 6350574, 6361055
Change-Id: Iab92cc31bab4771fca63619c8e3105c759535f72
2012-04-18 18:36:25 -07:00
Mathias Agopian
b9494d5c9d make sure to clear the framebuffer when using overlays
Bug: 6354761, 6353719
Change-Id: I0739de3fee7c54c14b294ffd768b70ee1f541d9e
2012-04-18 02:28:45 -07:00
Mathias Agopian
0c8ecacb37 Merge "don't attempt to clip layers anymore using glScissor" 2012-04-16 16:00:11 -07:00
Mathias Agopian
160d544dbb Merge "get rid off preserve backbuffer optimization in SF" 2012-04-16 15:59:59 -07:00
Mathias Agopian
82ca93bf66 Merge "s/w rendered apps can now use n-buffering (n>2)" 2012-04-16 15:59:39 -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
8acce2046a make sure to repaint the screen when screen turns on
Bug: 6336168
Change-Id: Ic6f11b6bf6c3d849f5cb6ac95961d10d7f88e4ec
2012-04-13 16:18:55 -07:00
Mathias Agopian
ac6035a12a s/w rendered apps can now use n-buffering (n>2)
Bug: 6311881
Change-Id: I6e52e281e8d432430aad011f6d9dcf35d7b4ac7d
2012-04-13 16:04:44 -07:00
Mathias Agopian
fca660cf73 don't wake-up eventthread every 16ms if there are no vsync requests
Bug: 6332534
Change-Id: Idf79ad913770c6180969f6c95a9b125fff580231
2012-04-12 20:43:16 -07:00
Mathias Agopian
69a655caef Revert "handle surfaces posts independently from composition"
This reverts commit 562f4b2c1e.

Change-Id: I96efe11c2f0494ed2d57fc580e49c598d913830e
2012-04-11 20:43:40 -07:00
Mathias Agopian
562f4b2c1e handle surfaces posts independently from composition
surfaceflinger will now handle each surface post
as soon as possible and handle the composition
itself at VSYNC time as usual.

Change-Id: I6b1ae33fd56062d86e5419ebab8def0ca5803fbf
2012-04-11 18:17:30 -07:00
Mathias Agopian
22ffb117b0 make sure to disable VSYNC while screen is off
Change-Id: If1894c43b0a39a2851e1280a35ae77bccd6d9abd
2012-04-11 15:31:40 -07:00