Commit Graph

104 Commits

Author SHA1 Message Date
Mathias Agopian e57f292595 make multi-display more real
- displays are represented by a binder on the client side
- c++ clients can now create and modify displays

Change-Id: I203ea5b4beae0819d742ec5171c27568f4e8354b
2012-08-10 17:32:33 -07:00
Mathias Agopian 4297734c11 turn DisplayDevice into a reference-counted object
it's safer this way because this object owns an
EGLSurface which cannot be easily reference-counted.

it also gives us the ability to sub-class it, which
we might want to do soon.

Change-Id: I07358bb052dc5a13b4f2196b2c2b6e6e94c4bb4f
2012-08-05 00:40:46 -07:00
Mathias Agopian 888c822c4c remove a dependency of DisplayDevice on the refresh rate
this remove a dependency (not all) on FramebufferSurface

Change-Id: Ie07ce70760cdcedfb41b5b41bea8da45637bf474
2012-08-04 21:23:47 -07:00
Mathias Agopian 92efd84f37 screen-off animation won't be handled by SF anymore
Change-Id: Idc41386804ae7d7eb981c36e1bc55c270870c8d0
2012-08-03 13:22:58 -07:00
Mathias Agopian 92a979a92c We now have a real list of displays.
displays can be dynamically added or removed, and the
list is part of the SF's transaction.

Change-Id: I4186ea39f1317c0e7c044f869004017738968fab
2012-08-02 22:24:12 -07:00
Mathias Agopian 0f2f5ff75b rename DisplayHardware to DisplayDevice
Change-Id: I3f7250cd914e0da4f9ec2c9403587bbe12f3cc62
2012-08-02 22:24:12 -07:00
Mathias Agopian 52bbb1ae23 getting closer to final main composition loop
Change-Id: Icd63782366ffd11d9ea00c925ae5783ed7440cdb
2012-08-02 22:24:12 -07:00
Mathias Agopian 87baae104a get rid of global regions that should be tracked per display
Change-Id: I3b871860cc29f1b2fdcc22b0c577a6eae65d9296
2012-08-02 22:24:12 -07:00
Jesse Hall 34a09ba1ef Move eglSwapBuffers out of HWComposer
Commit 8630320 moved the eglSwapBuffers fallback (for devices with no
HWC implementation) from DisplayHardware to HWComposer. But HWComposer
only knows about the framebuffer EGL display and surface handles if
there is a HWC, so it was always passing bogus handles.

This change moves the eglSwapBuffers fallback up to SurfaceFlinger,
which has access to the framebuffer EGL handles.

Bug: 6886613
Change-Id: Iad3f5ff7c90ee48d7053999e6a4548d6794b6ebd
2012-07-30 16:10:49 -07:00
Mathias Agopian c666cae2d5 get rid of the shared-memory control block
Change-Id: If814060aca1d2ff2619d4adcd57296983d207f7f
2012-07-25 21:13:10 -07:00
Mathias Agopian 8630320433 split HWComposer out of DisplayHardware
we will only ever have a single instance of HWComposer, so
it's now an attribute of SurfaceFlinger, instead of being part
of DisplayHardware.

DisplayHardware now just represents a "display" (it should be renamed).

Change-Id: Iec191e57686868e1df6daa8b880a286c9fefde56
2012-07-24 22:49:49 -07:00
Mathias Agopian 8b33f03232 update SF binder protocol to support setting display attributes
no change of functionality -- the old behavior is implemented
on top of this new protocol.
this new protocol will allow, eventually, to pass informations
about displays and layer stacks.

Change-Id: Ic6c2295e61ec8ecbc8ce01ab7664e35d928202fc
2012-07-24 20:43:54 -07:00
Mathias Agopian 921e6ac4b7 SurfaceFlinger cleanup
mostly refactored SurfaceFlinger.h, but also removed dead code.
cleaned-up a few includes as well.

Change-Id: Ib15f4ffe567912b61ee98aa076c6a283b72811b5
2012-07-24 00:09:35 -07:00
Mathias Agopian a49126087b factor EGL/GL and surface creation out of DisplayHardware
Change-Id: Icd85a6a4caad06f056578008af3e21666fa8b1f4
2012-07-19 14:14:58 -07:00
Mathias Agopian 3b1d2b6b2b mVisibleLayersSortedByZ is now maintained per display
Change-Id: Idcdb77eba1a3f99b3e4b2150128a82acaffcd2a8
2012-07-19 14:13:46 -07:00
Mathias Agopian 4fec873a98 one more step towards multiple display support
- remove dependency on cached state in validateVisibility
- get rid of mVertices and mTransformedBounds
- get rid of validateVisibility
- get rid of unlockPageFlip
- handleTransaction now returns a dirty region
- computevisibileregion now uses window-manager space
2012-07-10 14:29:27 -07:00
Mathias Agopian 1b03149f35 get rid of GraphicPlane
its functionality is now folded into DisplayHardware
there will be more changes in that area.
2012-06-28 17:27:19 -07:00
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
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
Mathias Agopian db403e8ff0 split-up Client.h out of SurfaceFlinger.h
Change-Id: I1993bf23e417163749d886283563a93d50b361b4
2012-06-18 16:47:56 -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
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 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 b60314a12f rework screen on/off code
Change-Id: I13f71e850592a588bbd4805b1830c503bd4decb4
2012-04-10 22:18:43 -07:00
Mathias Agopian cb9732a951 refactor / simplify EventThread
Change-Id: I3981c6fba93b7b985174b2a7045e24db2c0b4428
2012-04-03 18:28:25 -07:00
Mathias Agopian 90ac799241 fix libgui header location
Change-Id: Iec71706cdd4f29c6904993648ce873e83ef9cafe
2012-02-27 13:03:08 -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 ad8d13c885 remove unneeded code
Change-Id: I07e2fca7274d2e12bf5b4aee0050794bdb97a8b3
2012-01-29 23:11: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
Mathias Agopian 55ef343331 remove dead/usnused code
Change-Id: I6fa2bc6ee01790abd2c1533f043d61a5e5c8d26e
2012-01-11 22:03:41 -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 478ae5eb5a Improve the VSYNC api a bit.
- add the ability to set the vsync delivery rate, when the rate is
set to N>1 (ie: receive every N vsync), SF process' is woken up for
all of vsync, but clients only see the every N events.

- add the concept of one-shot vsync events, with a call-back
to request the next one. currently the call-back is a binder IPC.

Change-Id: I09f71df0b0ba0d88ed997645e2e2497d553c9a1b
2011-12-06 22:43:10 -08:00
Jesse Hall 43bfe7f047 am a91e54fe: am f57c1388: Merge "SurfaceFlinger: fix layer removal race condition" into ics-mr1
* commit 'a91e54fed6a0690d59c97bab9b081b2614880563':
  SurfaceFlinger: fix layer removal race condition
2011-12-02 18:35:54 -08:00
Jesse Hall 2f4b68d21c SurfaceFlinger: fix layer removal race condition
Layer::lockPageFlip() and layer::onRemove() could be called on
different threads and race such that lockPageFlip() successfully
called mSurfaceTexture->updateTexImage() but then gets NULL back from
mSurfaceTexture->getCurrentBuffer(), leading to a crash.

This change moves Layer::onRemove() calls to
SurfaceFlinger::commitTransaction() so they happen after the Layer is
done being drawn from and only happen on the main surfaceflinger
thread.

Change-Id: I4b550caadff4cc1878d7c3bca6129193fb0c713e
2011-12-02 10:03:25 -08:00
Mathias Agopian d0566bc26f Add support for sending VSYNC events to the framework
use gui/DisplayEvent to receive the events. Events are
dispatched through a unix pipe, so the API is compatible
with utils/Looper. see gui/DisplayEvent.h for more info.

Bug: 1475048
Change-Id: Ia720f64d1b950328b47b22c6a86042e481d35f09
2011-11-29 13:10:25 -08:00
Mathias Agopian 439cf8576d Fix build.
Revert "Add support for sending VSYNC events to the framework"

This reverts commit f3918c5bd4bc9f02f74da42995564150ca2dd382.

Change-Id: I998e3e1aa3fa310829ae973b64fe11b01f6f468f
2011-11-29 13:07:40 -08:00
Mathias Agopian 461afeb9fd Add support for sending VSYNC events to the framework
use gui/DisplayEvent to receive the events. Events are
dispatched through a unix pipe, so the API is compatible
with utils/Looper. see gui/DisplayEvent.h for more info.

Bug: 1475048
Change-Id: If4126023fc9c067e56087ec7d16a8fd542ce1794
2011-11-29 11:44:05 -08:00
Mathias Agopian 4a9ac37fe2 Fix rotation displays frame N-1 briefly while rotating
The ScreenShot layer is now created hidden. The screenshot itself
is aquired during the transaction when the layer is made visible.
This guarantees the screenshot and the layer happen atomically
with respect to screen updates.

Bug: 5534521
Change-Id: Ida23e1f13d5716ec83b78a15712e0646d6cf8729
2011-11-04 15:15:32 -07:00
Mathias Agopian 51726c381e am aa938c8d: Merge "mDirtyRegion is single threaded, but could be accessed from a hwc thread" into ics-mr0
* commit 'aa938c8d9c0e71c9b556657cb33794210ce6ebf8':
  mDirtyRegion is single threaded, but could be accessed from a hwc thread
2011-10-21 16:00:00 -07:00
Mathias Agopian 0dfb7b73a4 mDirtyRegion is single threaded, but could be accessed from a hwc thread
We now have mInvalidateRegion which holds the region to invalidate, it
can be set from any thread as long as mInvalidateLock is held. We use
fine-grained locking here because mInvalidateRegion can be set from anywhere,
in particular frmo HWC callbacks.

Bug: 5466774
Change-Id: Iafca20aa3f5b25a87755e65bde7b769aa8f997bc
2011-10-21 15:41:01 -07:00
Dave Burke 818fb24357 am 70ac412b: Merge "Add a LayerScreenshot" into ics-mr0
* commit '70ac412b2fe7be2507189a9fdfb30c43b36d56ac':
  Add a LayerScreenshot
2011-10-18 23:00:08 -07:00
Mathias Agopian 118d0245ee Add a LayerScreenshot
A LayerScreenshot is a special type of layer that contains a screenshot of
the screen acquired when its created. It works just like LayerDim.

Make sure to call compositionComplete() after rendering into a FBO.

Bug: 5446982, 5467587, 5466259
Change-Id: I5d8a1b4c327f9973d950cd4f4c0bca7f62825cd4
2011-10-18 20:21:47 -07:00
Mathias Agopian cdec8f01aa am 840b8a67: Revert "Add a LayerScreenshot"
* commit '840b8a678537519c27ddf2f818494eaa20a135d4':
  Revert "Add a LayerScreenshot"
2011-10-17 11:32:19 -07:00
Elliott Hughes 090cb44b94 Merge branch 'master' of ssh://android-git:29418/platform/frameworks/base 2011-10-17 11:32:08 -07:00
Mathias Agopian e9800c8311 Revert "Add a LayerScreenshot"
This reverts commit d6809f40cf61203573ec5dbc437f695cd132cc18.
2011-10-16 23:54:25 -07:00
Jamie Gennis a402c4c991 SurfaceFlinger: Remove display freezing code
This change removes the dead code from SurfaceFlinger that resulted from
disabling support for freezing the display.

Change-Id: I4e5ff00c94b4c7a79af2f65c9850c135210068ed
2011-10-14 16:44:08 -07:00
Jamie Gennis 28378392fd SurfaceFlinger: make sync transactions explicit
This change enables a layer or orientation update transaction sent to
SurfaceFlinger to explicitly request a synchronous transaction.

Change-Id: I97cbba610c13679849f66114b216fa6dbf12f2a9
2011-10-14 16:11:51 -07:00
Mathias Agopian f171ab6da9 Add a LayerScreenshot
A LayerScreenshot is a special type of layer that contains a screenshot of
the screen acquired when its created. It works just like LayerDim.

Bug: 5446982
Change-Id: I7814aff2380e7e146937f2b641907be2a30c76cc
2011-10-14 14:32:48 -07:00