Commit Graph

532 Commits

Author SHA1 Message Date
Dan Stoza dd02391756 Merge "Enable changing display configuration" 2014-05-06 21:08:16 +00:00
Dan Stoza 7f7da32569 Enable changing display configuration
This allows querying and switching display device configurations
through the ISurfaceComposer/SurfaceComposerClient interface.

Bug: 14320401
Change-Id: I8c22165698950e5da32204c1c4da92122f91a715
2014-05-05 16:45:26 -07:00
Andy McFadden 41d67d7ab4 Improve SurfaceFlinger PTS estimation
Get the next refresh time from DispSync instead of guessing based
on the current time.

Change-Id: I8dc72a3217bfd4e9b4c905034194d1a298cad69a
2014-05-02 10:56:54 -07:00
Ruchi Kandoi f52b3c88f1 SurfaceFlinger: Adds the functionality to reduce refresh rate to half of
the default.

Feature added for the low power mode.

Change-Id: I2849e5ea335c0d2509fea1c315392bce7f20451d
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
2014-05-01 18:29:33 +00:00
Dan Stoza bba1385d1c am f3c07d4f: Fix virtual display nesting
* commit 'f3c07d4f70f33c2fe5b14ca8fbcdfa4133cc72c7':
  Fix virtual display nesting
2014-04-23 14:36:20 +00:00
Dan Stoza f3c07d4f70 Fix virtual display nesting
This fixes the cycling rendering loop caused by nesting virtual
displays by preventing them from recomposing if their contents
haven't changed.

(cherry-pick from master I600365c0fd5d3ad93e04295d26cf9de177ffc79b)

Bug: 12101046
Change-Id: I6182993d53537781aedb522f97a50f06eed8b80f
2014-04-22 16:19:02 -07:00
Svetoslav d85084b2b6 Adding render stats APIs to UiAutomation (framework native).
bug:12927198

Change-Id: Ibb1c07f7d89e11281e5c1f27f412a29ac6f9c4ab
2014-04-10 12:32:19 -07:00
Jesse Hall 8b834ffd9b am 1b751203: am 50ef8562: Merge "GraphicProducerWrapper may return false transact status"
* commit '1b7512036f3ea55cb1f62777ba6e56aad781f11c':
  GraphicProducerWrapper may return false transact status
2014-03-28 09:02:02 +00:00
Jesse Hall 1b7512036f am 50ef8562: Merge "GraphicProducerWrapper may return false transact status"
* commit '50ef8562fe7289495ad8592226f3c4d546119892':
  GraphicProducerWrapper may return false transact status
2014-03-28 08:50:09 +00:00
bdeng3X c2633ce19b GraphicProducerWrapper may return false transact status
GraphicProducerWrapper(GPW) changed how the methods of
BpGraphicBufferProducer(BpGBP) are executed.
First, "fake" BpGBP is created. Its remote is GPW. The GPW has
wrapped the real BpGBP.
All the method calls to the fake BpGPB will be intercepted by
the GPW inside it when the methods run into remote()->transact().
Then the GPW will invoke the transact() of the real BpGBP. And
Everything runs well except that the GPW forgets to store the
transact status and always return NO_ERROR to the fake BpGBP.

It would be disastrous if the binder call of the IGBP failed and
the out parameter "reply" of transact() was in unkown state.
E.g. the queueBuffer() in the fake BpGBP will try to operate on
the "reply". This will crash the SurfaceFlinger.

Change-Id: I01b31f64e1fc92804da3f16c1fb1420dcfb3b855
Signed-off-by: bdeng3X <bingx.deng@intel.com>
Signed-off-by: Guobin Zhang <guobin.zhang@intel.com>
2014-03-27 09:09:19 +08:00
Dan Stoza b9b088375d Remove deprecated BufferQueue constructor
Bug: 13415624
Change-Id: I9fe15e45daa7351f1db34ee75bfee6f19cb347d3
2014-03-18 10:08:44 -07:00
Wonsik Kim 8bf3b1a496 Merge "Revert "Implement video plane layer"" 2014-03-18 01:00:44 +00:00
Wonsik Kim 29fa9590ad Revert "Implement video plane layer"
This reverts commit f837c93a1b.

Change-Id: I6a1aa9ad0aca023267dc53d19c950b1535123ca7
2014-03-17 11:17:28 +00:00
Greg Hackmann 55886cb128 am 7429e4f7: am 112aa42e: Merge "SurfaceFlinger: fix 64-bit format string warnings"
* commit '7429e4f7d43cd42563ce77a3a4a861a392bc750f':
  SurfaceFlinger: fix 64-bit format string warnings
2014-03-08 07:28:19 +00:00
Greg Hackmann 7429e4f7d4 am 112aa42e: Merge "SurfaceFlinger: fix 64-bit format string warnings"
* commit '112aa42e91b4bb0cde334753e2ad05e3f248b377':
  SurfaceFlinger: fix 64-bit format string warnings
2014-03-08 01:56:32 +00:00
Greg Hackmann 86efcc0cbc SurfaceFlinger: fix 64-bit format string warnings
Change-Id: Idacfbf0601743fba1c5de7632201a66a307a2710
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2014-03-07 12:45:13 -08:00
Wonsik Kim f837c93a1b Implement video plane layer
Binding with video source will follow.

Change-Id: Ic14e9757f5b61f4055cbeda47c1bafae0a621abb
2014-02-27 00:08:22 +00:00
Andy McFadden 44c35ec4a9 Allow "opaque" flag to be updated. DO NOT MERGE
Moves the "opaque layer" from Layer to Layer::State.  This allows
it to be updated as part of a transaction.

Bug 12387406

Change-Id: I0a114ce6adf77cd12fb08f96e0691b76c475768d
2014-02-18 15:55:42 -08:00
Dan Stoza c701401f8c Allow disabling layer rotation during screenshots
Add the ability to ignore layers' transformation matrices during
screenshot capture, which will allow the window manager to capture
unrotated images for recents during the device rotation animation.

Bug: 11805195
Change-Id: I854d87bc84ca06ef9a054a454af1c080ee66fbb8
2014-02-14 23:10:42 +00:00
Dan Stoza 7143316af2 Fix virtual display nesting
This fixes the cycling rendering loop caused by nesting virtual
displays by preventing them from recomposing if their contents
haven't changed.

Bug: 12101046
Change-Id: I600365c0fd5d3ad93e04295d26cf9de177ffc79b
2014-02-04 16:46:54 -08:00
Andy McFadden 4125a4ffaf Allow "opaque" flag to be updated
Moves the "opaque layer" from Layer to Layer::State.  This allows
it to be updated as part of a transaction.

Bug 12387406

Change-Id: I0a114ce6adf77cd12fb08f96e0691b76c475768d
2014-01-29 17:36:49 -08:00
Jesse Hall 524672571f am 03691218: am e5f7bf74: am b6c21004: Merge "Implement per-display EGLConfig and configless EGLContext"
* commit '03691218ada2fb7e084ad4ae7ddd54f9b28d5611':
  Implement per-display EGLConfig and configless EGLContext
2014-01-03 18:36:29 +00:00
Jesse Hall 10ca42cbdc am 4c37d088: am 6c7dcfa9: am 662d3134: Merge "Move EGLConfig selection to RenderEngine"
* commit '4c37d0886ca06c290e205cad2798406361bbbf53':
  Move EGLConfig selection to RenderEngine
2014-01-03 18:36:28 +00:00
Jesse Hall 19e872912a Implement per-display EGLConfig and configless EGLContext
Bug: 12230666
Change-Id: Icca608b108cbdcab9cf01a9236d8cdbda000a836
Signed-off-by: Jesse Hall <jessehall@google.com>
2013-12-23 21:53:39 -08:00
Jesse Hall 05f8c703d4 Move EGLConfig selection to RenderEngine
Bug: 12230666
Change-Id: I8d1111a7e0fd9d9e2525e6a80da8ce46d7dd085d
Signed-off-by: Jesse Hall <jessehall@google.com>
2013-12-23 21:53:39 -08:00
Jamie Gennis cd65a2c51e am bbfbe93c: am 0a645cc5: SurfaceFlinger: give SF its own vsync phase
* commit 'bbfbe93c0d2d6c7818e23219d2925f02ddf5bd92':
  SurfaceFlinger: give SF its own vsync phase
2013-10-15 17:29:21 -07:00
Jamie Gennis 5727fc08ba am 47c772e8: am d1700756: SurfaceFlinger: Add EventControlThread
* commit '47c772e8ec28eb0a3df9c8edd252f292c7c8e152':
  SurfaceFlinger: Add EventControlThread
2013-10-15 17:29:21 -07:00
Jesse Hall c6694b4cb4 resolved conflicts for merge of e94d204a to master
Change-Id: Idb2030dbb25a2e4b972492587558b25a305e68bd
2013-10-15 17:22:33 -07:00
Jamie Gennis 0a645cc5a9 SurfaceFlinger: give SF its own vsync phase
This change allows SurfaceFlinger to run at a different vsync phase offset from
that used by external listeners.

Bug: 11175503
Change-Id: I561c53a5659fa6dc1e3e4ae30340f3c1a6adceb4
2013-10-15 14:31:41 -07:00
Jamie Gennis d1700756ec SurfaceFlinger: Add EventControlThread
This change adds a new thread for calling HWComposer's eventControl
asynchronously.  The DispSync-based vsync approach ends up enabling and
disabling HWComposer's vsync callbacks at arbitrary times, and some HWComposer
implementations do not have these calls optimized.

Bug: 11175503
Change-Id: I719be82bd200b391c61d40863b991c7b59acdfd6
2013-10-15 14:31:41 -07:00
Jesse Hall 948fe0ce74 Disable hardware vsync when blanking the screen
Bug: 11220224
Change-Id: I99d0a42e1a6bb0aaf89706f6d100e9ef2a5deaa4
2013-10-14 16:25:01 -07:00
Andy McFadden 95e4a7d9f3 am c00ab7b5: am 2d8d120d: Fix blank / partial screenshots
* commit 'c00ab7b5aafb7625ad7ebd2af107936df3efc98b':
  Fix blank / partial screenshots
2013-10-10 08:38:36 -07:00
Andy McFadden 2d8d120dc1 Fix blank / partial screenshots
The screen capture code wasn't waiting for the render to finish,
so sometimes you'd see an empty or partial image.

Bug 11131777

Change-Id: Ic64087322ce3bb15bb5f4fb1eb07579880fe6197
2013-10-09 16:38:02 -07:00
Jamie Gennis b85d2cf0a2 resolved conflicts for merge of 790b6d09 to master 2013-10-08 17:50:36 -07:00
Jamie Gennis faf77cce9d SurfaceFlinger: SW-based vsync events
This change adds the DispSync class, which models the hardware vsync event
times to allow vsync event callbacks to be done at an arbitrary phase offset
from the hardware vsync.  This can be used to reduce the minimum latency from
Choreographer wake-up to on-screen image presentation.

Bug: 10624956
Change-Id: I8c7a54ceacaa4d709726ed97b0dcae4093a7bdcf
2013-10-07 17:59:53 -07:00
Alan Viverette 794c5ba973 Simplify color adjustment using homogeneous coordinates
Change-Id: Ie31abacb134c29d82a6041fa7d521f68a1a273af
2013-10-03 16:40:52 -07:00
Dave Burke c5214289d6 am 9b4b1180: am 06993503: Merge "only clear FB when asked for the opaque layer" into klp-dev
* commit '9b4b1180941f4d2ef9d3e7bd26bc1855ff9fb141':
  only clear FB when asked for the opaque layer
2013-10-02 10:44:44 -07:00
Dave Burke 0699350336 Merge "only clear FB when asked for the opaque layer" into klp-dev 2013-10-02 17:36:40 +00:00
Jesse Hall fee52e20b9 am f3fa0712: am 93573e91: Merge "Treat composition frames with no layers as using GLES composition" into klp-dev
* commit 'f3fa0712282e760c316f44cba05f884f9399b98f':
  Treat composition frames with no layers as using GLES composition
2013-10-02 09:57:03 -07:00
Jesse Hall 93573e91c2 Merge "Treat composition frames with no layers as using GLES composition" into klp-dev 2013-10-02 14:54:03 +00:00
Jesse Hall 0c6fd94c13 am 92d7c3ee: am b65f32eb: Fix two EGLConfig selection bugs
* commit '92d7c3ee03109cf2d465a103b828b7d7d3ee9848':
  Fix two EGLConfig selection bugs
2013-10-01 20:58:49 -07:00
Mathias Agopian ac68302e1c only clear FB when asked for the opaque layer
a layer need to be considered NOT opaque if it has a
plane-alpha.

Bug: 10846930
Change-Id: Ibd8981b63ede4560c7096bacc4cff46a7eb2a8bb
2013-10-01 15:36:52 -07:00
Jesse Hall d05a17fbb3 Treat composition frames with no layers as using GLES composition
When there are no window layers for a display, SurfaceFlinger clears
the undefined region using GLES. Some of the places that check for
GLES composition weren't considering this special case, in particular:

- We were skipping the eglSwapBuffers() on these frames.
- We were putting VirtualDisplaySurface in HWC-only composition mode.

This change centralizes the logic for this special case.

Bug: 10957068
Change-Id: I2deaf2ed101e8ea76708862a6bb67751b6078794
2013-09-30 17:08:28 -07:00
Jesse Hall b65f32ebe2 Fix two EGLConfig selection bugs
This fixes two bugs introduced by
  Change-Id: Ia8cc084c02a0e3de910def024da8a08d02bbd89d

(a) There is no invalid EGLConfig value, in particular zero is valid.
    Checking return values of eglGetConfigs and eglChooseConfig is the
    only way to determine success.
(b) The "simple" EGLConfig query used as the emulator fallback should
    not include EGL_RECORDABLE; the emulator doesn't have it.

Bug: 10935622
Change-Id: Ib798a24e7cf06a679811c46eaa45d39174a715ec
2013-09-30 10:49:16 -07:00
Mathias Agopian 2b3d0c4079 am 0ff4b283: am 6da15f46: fix crashers with wifi/virtual displays
* commit '0ff4b28396d77a0ed2f191836895a891108a8b5b':
  fix crashers with wifi/virtual displays
2013-09-26 12:47:35 -07:00
Mathias Agopian 6da15f46f5 fix crashers with wifi/virtual displays
Bug: 10647742
Change-Id: I4b8ed9da52ef95af3a3b3a04b98514a3776a674d
2013-09-25 20:40:07 -07:00
Mathias Agopian 1c479c56da am 754bad45: am d555684c: reinstate black-screenshot debugging code
* commit '754bad4534e9a2de8b4e3ecbe097993c71246f91':
  reinstate black-screenshot debugging code
2013-09-20 11:20:44 -07:00
Mathias Agopian 4d5755389d am f589dd29: am e2a3e872: Merge "Fix GLES context version selection" into klp-dev
* commit 'f589dd2915587994d3dd36eff2191962fe0b71c0':
  Fix GLES context version selection
2013-09-20 11:19:58 -07:00
Mathias Agopian d555684cb3 reinstate black-screenshot debugging code
turned off by default.

Bug: 10809349
Change-Id: I3e6b8c7860e6b0e122b8f07de4020967cd1f005c
2013-09-19 17:09:26 -07:00
Mathias Agopian 2185f8b420 Fix GLES context version selection
Explicitly selects an ES 2.0 config first, then an ES 1.x config,
before attempting the fallback path for the emulator.

Bug: 10820214
Change-Id: Ia8cc084c02a0e3de910def024da8a08d02bbd89d
2013-09-18 16:20:26 -07:00
Jesse Hall cd9fd427ac am b8080d9a: am 2a36497e: Merge "Stop using default value for Surface producerControlledByApp parameter" into klp-dev
* commit 'b8080d9a3b760617c5dde7b1d2d63aa2bcecf3a7':
  Stop using default value for Surface producerControlledByApp parameter
2013-09-16 20:32:34 -07:00
Jesse Hall 83cafffeac Stop using default value for Surface producerControlledByApp parameter
Bug: 10785749
Change-Id: Ifbf9340e5eabe621a69e990ec3e05ac51f8db66a
2013-09-16 15:39:55 -07:00
Alan Viverette 9c5a333511 Add API for pushing color transforms to SurfaceFlinger
BUG: 9057596
Change-Id: Iea0953366eac875b7968897a75472c25a137edb5
2013-09-12 20:04:35 -07:00
Mathias Agopian ff2ed70fa3 color blindness enhancement
This is an attempt at improving the experience of
users with color vision impairement.

At this time this feature can only be enabled for
debugging:

  adb shell service call SurfaceFlinger 1014 i32 PARAM

  with PARAM:
   0 : disabled
   1 : protanomaly/protanopia simulation
   2 : deuteranomaly/deuteranopia simulation
   3 : tritanopia/tritanomaly simulation
  11, 12, 13: same as above w/ attempted correction/enhancement

The enhancement algorithm tries to spread the "error"
such that tones that would otherwise appear similar can be
distinguished.

Bug: 9465644

Change-Id: I860f7eed0cb81f54ef9cf24ad78155b6395ade48
2013-09-04 22:11:15 -07:00
Mathias Agopian 931bda1c47 reset the gl viewport at each frame for each display
Bug: 10097128, 9506003
Change-Id: Ie0403a631e339a9134216224f3366f46ece58b53
2013-08-28 18:11:46 -07:00
Mathias Agopian 9414d67f46 make sure SF initialization is ran at target priority and correct thread group
SF can spawn threads (indirectly) during initialization
and we want those to be spawned at URGENT_DISPLAY_PRIORITY
(in theory they should set their own, but some code lives
in vendor libraries and doesn't).

Bug: 10430209
Change-Id: I5b3a8f979297de287614c8eafd8267bef1176e4b
2013-08-23 17:10:32 -07:00
Mathias Agopian 4ceff3d5ef screenshot layers wouldn't work in some cases
specifically when the display size and the screenshot window
size didn't match, the buffer would be rejected.
We simply fix this by setting the scalling mode to
"SCALE_TO_WINDOW".

Bug: 9992306
Change-Id: Ib821767899af330bb70d3cbbfa7d41b02794a075
2013-08-21 15:25:50 -07:00
Jesse Hall d2cf8c2f07 Merge "Provide HWC prepare with a valid output buffer" into klp-dev 2013-08-21 14:38:51 +00:00
Jesse Hall 028dc8f2d7 Provide HWC prepare with a valid output buffer
We weren't dequeing and setting the output buffer until just before
set(). This didn't allow HWC to make decisions in prepare() based on
the output buffer format, dimensions, etc.

Now we dequeue the output buffer at the beginning of the composition
loop and provide it to HWC in prepare. In GLES-only rendering, we may
have to cancel the buffer and acquire a new one if GLES requests a
buffer with properties different than the one we already dequeued.

Bug: 10365313
Change-Id: I96b4b0a851920e4334ef05080d58097d46467ab8
2013-08-20 16:35:32 -07:00
Mathias Agopian 4f4f094348 SurfaceFlinger now runs in the process's main thread
it used to spawn its own thread and return the main thread
to the binder thread pool -- this was confusing the naming
of things in the kernel.

Bug: 10331839

Change-Id: I2d13a6d73409a38109300fcbe6a04b4c41cb5d00
2013-08-20 11:16:45 -07:00
Jesse Hall 9e663de4fe Use new HWC display type/count constants.
Change-Id: I774d0c68906ac6dc69268f708c30a6b0868b8816
2013-08-16 14:28:37 -07:00
Mathias Agopian 3f84483382 SurfaceFlinger now uses GLES 2.x when available
Bug: 8679321

Change-Id: I2b152d01fb4e2de2ea9fe87f1ddbd6826d7520d7
2013-08-13 16:07:45 -07:00
Mathias Agopian 5ff5a84e48 allow "system" screenshots even when the secure flag is set
we need too allow this case so that things like the rotation
animation can work.
with this change we only permit these screenshot if the
destination is SurfaceFlinger itself.

Bug: 10235036
Change-Id: I66fea5391e52b0d7f17f25827572b236f2d9eb71
2013-08-13 15:58:38 -07:00
Mathias Agopian a6bb107434 make sure we have a context when creating the 1st surface
also add an option to dump the stack trace when
calling a GL function without a context.

Change-Id: I57b72bb8c322ac4253c3077bf150621bd9863b69
2013-08-08 16:38:06 -07:00
Jesse Hall 6c913be9ca Add ISurfaceComposer::destroyDisplay
Bug: 10191053
Change-Id: Ia89286f95421344a60ffedaaca5825c4e3cd7f9e
2013-08-08 13:12:29 -07:00
Mathias Agopian 3ca76f416b remove support for glReadPixels screenshot path
this was only needed on some chipset we're not
supporting in KLP.

Change-Id: I2e8fc07f135030bd61d2e241a8e426f1a4316425
2013-08-06 16:07:33 -07:00
Mathias Agopian db89edc94b All consumers now take an IGraphicBufferConsumer instead of a BufferQueue
this means they only have access to the consumer end of
the interface. we had a lot of code that assumed consumers
where holding a BufferQueue (i.e.: both ends), so most of
this change is untangling in fix that

Bug: 9265647
Change-Id: Ic2e2596ee14c7535f51bf26d9a897a0fc036d22c
2013-08-06 20:05:36 +00:00
Mike J. Chen aaff4ef717 SurfaceFlinger: Set the result of binderized screencapture
A recent change to screencapture to have the call to
IGraphicBufferProducer happen on the incoming binder
thread didn't set the result so the result was always
returned as NO_ERROR.

This made screencap fail on some devices (e.g. Wolfie)
which relies on some kind of fallback mechanism to
generate the screencap but the fallback mechanism
doesn't get triggered because the error isn't returned.

Bug: 9989385

Change-Id: I2aee91ea1034869fcbb0f49b9a0087c3cff43bbe
Signed-off-by: Mike J. Chen <mjchen@google.com>
2013-07-30 10:24:22 -07:00
Mathias Agopian 5773d3f5b2 get rid of PixelFormatInfo and simplify things
Change-Id: I025a362cc12d5b9b794fac14be500e25aab65396
2013-07-25 19:24:31 -07:00
Jamie Gennis 6547ff4327 surfaceflinger: add frame duration logging
Change-Id: Ib414a45e7e191f23a2726cbbbeb606e9ce68a3b5
2013-07-23 17:28:47 -07:00
Jesse Hall 38efe86d94 Rewrite VirtualDisplaySurface
The previous implementation assumed that the HWC could read and write
the same buffer on frames that involved both GLES and HWC composition.
It turns out some hardware can't do this. The new implementation
maintains a scratch buffer pool to use on these mixed frames, but on
GLES-only or HWC-only frames still does composition directly into the
output buffer.

Bug: 8384764
Change-Id: I7a3addb34fad9bfcbdabbb8b635083e10223df69
2013-07-15 13:59:41 -07:00
Mathias Agopian 2ed0fe59b4 fix a bug where surfaceflinger and system_server could deadlock
because surfaceflinger handles screenshot in a different
    thread from the binder thread that requested it and because
    the IGraphicBufferProducer is a synchronous interface
    calling back into the system server; it is possible for
    the latter to run out of binder threads (b/c it holds
    a lock while calling into SF).

    The solution is to make sure all calls on IGraphicBufferProducer
    happen on the incoming binder thread. We achieve this by creating
    a IGBP wrapper which is given to the screenshot code.

    Bug: 8734824

Change-Id: I2be85660d9dc65d239d68f6d3ab3c973c13b34cc
2013-07-08 18:52:05 -07:00
Mathias Agopian 547e98f33c Merge "Refactor SF. Move all GL operations in their own class." 2013-07-08 22:50:01 +00:00
Mathias Agopian fee2b463c5 Debug code for detecting all black pixels screenshots
Bug: 9120292
Change-Id: If60db32524db973bb1f905ba3cb415c2a1cd7e71
2013-07-08 22:28:37 +00:00
Mathias Agopian 875d8e1323 Refactor SF. Move all GL operations in their own class.
this is the first step to add support for GLES 2.x, this
change breaks the dependency of SF on GLES 1.x by moving
all operation into their own class.

Bug: 8679321

Change-Id: I0d2741eca2cefe67dfd9cf837cac10c4d126928b
2013-07-03 14:39:27 -07:00
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 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
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
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 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
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 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
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
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 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
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
Mathias Agopian ed98557414 make sure screenshot are in a format supported by Bitmap.java
Change-Id: I0fb9cc4088f9c1fd27e6c017b0a7c5617adb4660
2013-03-22 00:24:39 -07:00
Mathias Agopian 50210b9a8d fix a typo that broke all screenshots
Bug: 8450197

Change-Id: I5b986cc0ff9c5e689d06a51ba68ab537d03d1f3d
2013-03-21 21:14:10 -07:00
Mathias Agopian b4b1730abb only use glReadPixels() when needed when taking screenshots
some drivers don't support this yet, so we use a system
property to enable the glReadPixels "workaround" for them:

  ro.bq.gpu_to_cpu_unsupported=1

Change-Id: I74d6a3a8f0cee8d5a507b72c760cf247e39195e0
2013-03-21 14:01:53 -07:00
Mathias Agopian abe815dd69 rework how we take screenshots for a CPU consumer
We're not using IMemoryHeap as a transport anymore,
instead we're providing a CpuConsumer and use the
IGraphicBufferProducer version of the screenshot API.

However, some GPU drivers don't support properly
a GPU to CPU path, to work around this, we use a
temporary BufferQueue on the server side for the
GL rendering, and we use glReadPixels into the
CpuConsumer (we're now using a CPU to CPU path
which is always supported).

Currently this "wrapping" is always performed,
but it can be bypassed on devices that support
the GPU to CPU path.

This also addresses a DoS attack vector on
SurfaceFlinger, where an application could
consume all of SF's filedescriptors by creating
a lot of screenshots in a row.

Bug: 8390553

Change-Id: I9e81514c2a7711b9bb393f74305be7d2abe08f1c
2013-03-19 22:22:21 -07:00
Jesse Hall fae23b8757 Merge changes I61ae54f3,I57cb668e,I7a3f1e1a,Id28a2f9b into jb-mr2-dev
* changes:
  Add BufferQueueInterposer and use it for virtual displays
  Add DisplaySurface abstraction
  Fix argument types in IGraphicBufferProducer methods
  Minor cleanups/fixes before virtual display refactoring
2013-03-19 17:45:29 +00:00
Jesse Hall 99c7dbb249 Add DisplaySurface abstraction
DisplayDevice now has a DisplaySurface instead of using
FramebufferSurface directly. FramebufferSurface implements
DisplaySurface, and so does the new VirtualDisplaySurface class.
DisplayDevice now always has a surface, not just for virtual displays.

In this change VirtualDisplaySurface is just a stub; buffers still go
directly from GLES to the final consumer.

Bug: 8384764
Change-Id: I57cb668edbc6c37bfebda90b9222d435bf589f37
2013-03-18 14:21:16 -07:00
Jesse Hall 7adb0f8a9f Minor cleanups/fixes before virtual display refactoring
None of these should change behavior, except for removing some
incorrect log messages when using a virtual display.

- HWComposer::getAndResetReleaseFenceFd() checks the HWC version, so
  no need to do that in the DisplayDevice::onSwapBuffersCompleted().
  However, it should check that mFramebufferSurface is not NULL like
  it is for virtual displays.
- Comment that FramebufferSurface::dump() overrides the non-virtual
  ConsumerBase::dump(), and fix it so the right thing happens
  regardless of the static type of the pointer/reference the callee
  has. FramebufferSurface::dump() could be removed right now, but I'd
  need to bring it back in a later change.
- Use the right enum for validating display type ids.
- Don't try to send hotplug events for virtual displays.
- Mark virtual displays as connected so HWComposer::prepare() doesn't
  think something is wrong when it gets a non-NULL layer list.
- Remove unused FramebufferSurface methods.

Bug: 8384764
Change-Id: Id28a2f9be86b45f4bb7915fdf7752157035f4294
2013-03-18 14:16:02 -07:00
Mathias Agopian 041a075262 don't allow screenshots without the READ_FRAMEBUFFER permission
the recent screenshot rework allowed the older screenshot
interface to work without that permission

Change-Id: I6c4743f4591c81106e3b823d55a055f7b4907de1
2013-03-15 18:39:16 -07:00
Mathias Agopian 7670d3cb2b Merge "get rid of purgatory and fix QueuesToWindowComposer query" into jb-mr2-dev 2013-03-16 01:14:35 +00:00
Mathias Agopian a493be5825 don't capture hidden layers in screenshots
Bug: 8389956
Change-Id: I9ed836395258732c743c6fd44092bd01020dde13
2013-03-15 16:08:10 -07:00
Mathias Agopian 6710604286 get rid of purgatory and fix QueuesToWindowComposer query
the purgatory list wasn't needed anymore; in fact it had no effect as
buffer life-time management is now handled by the BufferQueue.

For QueuesToWindowComposer we keep a list of wp<> on the IBinder
for IGraphicBufferProducers we hand over to clients so we can
easily check if an IGraphicBufferProducer is ours. We clean-up the
list when our IGraphicBufferProducer are destroyed.

Bug: 8349142
Change-Id: I1aa06652ade8c72d0004a3f5e6c3d6e8a82fc2ae
2013-03-14 19:18:13 -07:00
Mathias Agopian 6a531717cd size IMemoryHeap properly for screenshots
since we're using glReadPixels(), we only need to use
the width (as opposed to the stride) of the source
screenshot.

Bug: 8374664
Change-Id: I145c80f4fff5444df7c77c4f52e70a7203caddbd
2013-03-13 15:22:11 -07:00
Mathias Agopian 4d9b822e2c get rid of ISurface
ISurface was only used to get the IGraphicBufferProducer from
a Layer. It's now replaced by a BBinder subclass / IBinder and
is only used as a handle to the surface, to both refer to it
and manage its life-time.

Also cleaned-up a bit the ISurfaceComposer interface and
"create layer" code path.

Change-Id: I68d0e02d57b862cffb31d5168c3bc10cea0906eb
2013-03-12 17:11:48 -07:00
Mathias Agopian b7a5b05b53 Fix missing recents screenshots
We were using the "visible layer list" when taking screenshots,
which doesn't work when a layer is behind other opaque layers
and therefore hidden.

We fix this by using the full layer list, filtered by the
layerstack of the display we're looking at.

Bug: 7552304
Change-Id: I4b6f77e5511aea94f8d218975b6e22738e7e5d5b
2013-03-11 20:47:24 -07:00
Mathias Agopian d577641411 make sure to call compositionComplete after taking a screenshot
older drivers which are doing implicit synchronization need this
or they could deadlock.

Bug: 8341885
Change-Id: Icd980a6be16071678d6151e34725b3c1c547d7ee
2013-03-08 13:54:46 -08:00
Mathias Agopian 2be4e8ff23 workaround to fix screenshot leak on N4
Bug: 8322020

Change-Id: Ie60af0eb431866b8d64b2674ae7bd8b5ee05f5d6
2013-03-06 20:44:16 -08:00
Mathias Agopian 438ca07b6b Merge changes I66511c08,Ia051949f,Ic7451365,I5b571a4c into jb-mr2-dev
* changes:
  Get rid of LayerBase.
  Make LayerDim a regular Layer instead of a LayerBase
  fold LayerBaseClient into LayerBase
  Remove support for ScreenshotLayer
2013-03-07 01:47:34 +00:00
Mathias Agopian 13127d8921 Get rid of LayerBase.
The functionality of LayerBase and Layer is folded
into Layer. There wasn't a need for this abstraction
anymore.

Change-Id: I66511c08cc3d89009ba4deabf47e26cd4cfeaefb
2013-03-05 19:52:30 -08:00
Mathias Agopian b79f61d41e fold LayerBaseClient into LayerBase
Change-Id: Ic745136522df59c42f0885fd969e75ea55d09f01
2013-03-05 19:52:30 -08:00
Mathias Agopian 089a15298e Remove support for ScreenshotLayer
Change-Id: I5b571a4cf3faa77d2c4aca916fa4bd00a1065bb9
2013-03-05 19:52:29 -08:00
Jeff Sharkey 175264b09c Return NO_MEMORY when glReadPixels() fails.
Change-Id: Ic66134ef457e8442ae9135e9ec50e3d02932a253
2013-03-05 18:00:01 -08:00
Mathias Agopian 306f18c5fb Merge "rework screenshot API and implementation" into jb-mr2-dev 2013-03-05 02:30:13 +00:00
Jesse Hall eabe3140f1 Merge "Init displays to null layer stack" into jb-mr2-dev 2013-03-05 01:04:54 +00:00
Mathias Agopian 2a9fc493df rework screenshot API and implementation
- SurfaceFlinger now supports to take a screenshot
  directly into an IGraphicBufferProducer

- reimplement the IMemoryHeap screenshot on top
  of the above

- reimplement LayerScreenshot such that its
  BufferQueue is directly used as the destination
  of the screenshot. LayerScreenshot is now a thin
  wrapper around Layer

Bug: 6940974

Change-Id: I69a2096b44b91acbb99eba16f83a9c78d94e0d10
2013-03-01 22:53:39 -08:00
Jesse Hall 01e29054e6 Init displays to null layer stack
When a display is added, initialize it to use an empty layer stack, so
if it is somehow visible it will show black. It will be assigned the
real layer stack -- along with a projection and other properties -- by
window manager soon. Normally a display remains blanked until window
manager has decided what to show on it, but for HDMI connected at boot
that isn't currently the case.

Bug: 7258935
Change-Id: Ic9bb25f7a9b8d9d3772b097ab1d6fa03bc8780a1
2013-02-28 21:05:30 -08:00
Mathias Agopian 5219a06d61 set correct crop rectangle in LayerBase::setCrop
The crop always had left=top=0, because the crop position
and the layer's transform were merged together in
computeBounds() (which really used to compute the
bounds in screen space, which we usually call the
"frame" elsewhere in the code)

Note: in practice this crop value is not used by
hwc, because it's overridden in Layer::setGeometry(), which
is why this bug was never apparent.

Change-Id: I1ec6400a8fc8314408e4252708f43ea98c2fe64e
2013-02-28 18:43:04 -08:00
Jesse Hall a9a1b006e4 Initialize DisplayData fences to NO_FENCE, not NULL
Also fix another place that was checking for NULL fence rather than
Fence::isValid().

Bug 8283950

Change-Id: Ie06db327eb416828d8dac139171d96d4470b2e35
2013-02-27 16:48:41 -08:00
Mathias Agopian e3c697fb92 Refactoring: Rename SurfaceTextureClient to Surface
Change-Id: Ibed34175ae273608393aaa5f0a7df207dc40d709
2013-02-14 19:19:05 -08:00
Mathias Agopian ac9fa427d4 get rid of Surface identity and token
we use the IBinder instead.

Change-Id: I4aa0b58869ba43f19980013620051e5a261b062d
2013-02-13 15:27:08 -08:00
Jamie Gennis 4b0eba949c SurfaceFlinger: add win anim frame time tracking
This change makes the 'dumpsys SurfaceFlinger --latency' command with no extra
args dump the frame timestamp data for the most recent frames that
SurfaceFlinger generated that included window animation transaction changes.

Change-Id: I8bded1ea08a4cddefef0aa955401052bb9107c90
2013-02-08 13:32:21 -08:00
Andy McFadden c19c15174b Merge "Add some comments." 2013-01-11 15:05:40 -08:00
Andy McFadden 8f06a8c2c8 Reduce C++11 warnings
A few typecasts to fix "narrowing conversion" complaints.

Change-Id: Ib2118079a2ca33959c748d03d8c6f1722d62e8fe
2013-01-11 10:24:34 -08:00
Andy McFadden 882e3a39ed Add some comments.
Also, minor tweak to SurfaceTextureLayer.

Change-Id: If616d5ee4e8226dd0e16c5dbb0e0f80db553110e
2013-01-11 10:16:10 -08:00
Andy McFadden 2adaf04fab Rename ISurfaceTexture and SurfaceTexture
The C++ class names don't match what the classes do, so rename
ISurfaceTexture to IGraphicBufferProducer, and SurfaceTexture to
GLConsumer.

Bug 7736700

Change-Id: Ia03e468888025b5cae3c0ee1995434515dbea387
2012-12-18 13:10:48 -08:00
Jamie Gennis 392edd88cb SurfaceFlinger: Move GraphicBufferAlloc to libgui
This change moves the GraphicBufferAlloc class from SurfaceFlinger to libgui.

Change-Id: Idf31d2004efa2651b60590733f73c4a7b831e8a9
2012-12-11 17:54:29 -08:00
Mathias Agopian 9913b9941e am a7da0dda: am 98cbec81: am efd614b8: Merge "make transform hint multi-display aware" into jb-mr1.1-dev
* commit 'a7da0dda39cf1e807eea1304b48d4583e7329b72':
  make transform hint multi-display aware
2012-11-27 18:43:52 -08:00
Mathias Agopian a7da0dda39 am 98cbec81: am efd614b8: Merge "make transform hint multi-display aware" into jb-mr1.1-dev
* commit '98cbec81be1d39223e33abde9ac35e43b62918bf':
  make transform hint multi-display aware
2012-11-27 16:10:29 -08:00
Jesse Hall 6edebdf600 Create builtin display tokens on demand
For hotpluggable builtin displays (currently just HDMI), create the
display device IBinder token when the display is connected and destroy
it when the display is disconnected. Previously we created the tokens
at startup and never changed them. This made it so that when comparing
current and drawing state, we couldn't tell whether a display had been
disconnected and reconnected.

Bug: 7491120
Change-Id: I2ac82b864e10cb1cd0a308782d7e0ab9745c5d81
2012-11-27 12:30:18 -08:00
Mathias Agopian 8430095879 make transform hint multi-display aware
if a layer is not mirrored, we now use its display
as the source for the transfrom hint calculation
instead of always using the default (main) display.

this change does two thing:
1) we make updateTransformHint take a DisplayDevice
   as a parameter instead of hard-coding the
   main display.

2) each time we do a transaction that could change
   the hint, we go through all layers and
   figure out which display should be used for their
   transform hint.

Bug: 7599344
Change-Id: I9b04a95e6c372dd770bacf81d8ef6f8e31b87b83
2012-11-21 16:03:52 -08:00
Jesse Hall 692c723e84 Create builtin display tokens on demand
For hotpluggable builtin displays (currently just HDMI), create the
display device IBinder token when the display is connected and destroy
it when the display is disconnected. Previously we created the tokens
at startup and never changed them. This made it so that when comparing
current and drawing state, we couldn't tell whether a display had been
disconnected and reconnected.

Bug: 7491120
Change-Id: I23b77037dc0f548d549abf580339edd0e3c626e9
2012-11-09 11:48:25 -08:00
Mathias Agopian 2788a3526d am 731e0331: am e70fbe8b: am 02b95105: fix transitions from hwc to GLES composition
* commit '731e0331eb402ec4564b69eaeb8b605a8b800b1b':
  fix transitions from hwc to GLES composition
2012-11-05 18:19:53 -08:00
Mathias Agopian 02b9510575 fix transitions from hwc to GLES composition
If we switched from HWC to GLES but the dirty region was empty
(could happen if the dirty region is outside of the screen for instance), we
need to force a full screen composition.

In this change we ignore the dirty region for the purpose of
rejecting the whole update and we rely on the fact that it will later
be expanded to the whole screen. This was the least risky fix.

Bug: 7467760, 7452931
Change-Id: I2132f2f963b00a3ce7150adadb107b0367b3862e
2012-11-05 17:50:57 -08:00
Mathias Agopian 766dc49c17 rework a bit how we scissor the display
the scissor rect is now computed once by DisplayDevice
and is combined with the "undefined" region so that
the letter-boxed area of the screen get cleared in
drawWormhole.

Bug: 7149437
Change-Id: Id2f30516a5786f32eace7f876ff32028f954f357
2012-10-31 14:22:51 -07:00
Mathias Agopian f45c510009 partially implement external display clipping
we perform external display clipping only on the GL
side (ie: not done on the h/w composer side, which is
harder and would be too risky). in practice this means
that WFD will be clipped properly, while HDMI *may* or
may not depending on how hwc is used.

Bug: 7149437
Change-Id: I92d4d04220db72b6ffb134c7fa7a93af569723a5
2012-10-25 12:42:42 -07:00
Mathias Agopian d17e3b5f6c prevent a client from crashing surfaceflinger
a misbehaving or malicious client could cause SF to crash
by providing a "fake" IInterface. we now check the
IInterface we get is our own and local.

Bug: 7278879
Change-Id: Ia19d05902d4b2385c5a16416148378d4998833fd
2012-10-22 14:54:23 -07:00
Jamie Gennis dd3cb84cfb SurfaceFlinger: add support for secure displays
This change adds support for displays that are not allowed to display surfaces
with the eSecure flag set.  All non-virtual displays are considered secure,
while virtual displays have their secure-ness specified at creation time.

Bug: 7368436
Change-Id: I81ad535d2d1e5a7ff78269017e85b111f0098500
2012-10-22 13:41:21 -07:00
Jamie Gennis 7c41bf7092 SurfaceFlinger: change the animation timeout
This change changes the animation transaction timeout from 500us to 5s.

Bug: 7362633
Change-Id: I9bed8e74f726dae2daa398afc29babcea00d5b04
2012-10-17 09:40:07 -07:00
Mathias Agopian db9b41fd15 fix a corruption in blank/unblank
we were holding a reference (ie: pointer) to a sp<DisplayDevice>
while processing the message. Meanwhile the object itself could
go away and we would end up accessing a dead object.

the root cause of the problem is that we are accessing mDisplays[]
in a few places outside of the main thread.

Bug: 7352770
Change-Id: I89e35dd85fb30e9a6383eca9a0bbc7028363876c
2012-10-15 20:31:12 -07:00
Jamie Gennis 2d5e230292 SurfaceFlinger: add animation transactions
This change adds a transaction flag for WindowManager to indicate that a
transaction is being used to animate windows around the screen.  SurfaceFlinger
will not allow more than one of these transactions to be outstanding at a time
to prevent the animation "frames" from being dropped.

Bug: 7353840
Change-Id: I6488a6e0e1ed13d27356d2203c9dc766dc6b1759
2012-10-15 19:09:04 -07:00
Andy McFadden 9e9689c111 Fix HDMI unblank behavior
Two issues:

(1) We were announcing the hotplug event before we were ready to
handle blank/unblank events, so we were losing the initial unblank
that power manager sends us when HDMI is first plugged in.  This
left the display blank until you toggled the device power off/on.

(2) We were retaining fbTargetHandle for HDMI after the display was
disconnected.  The value didn't get updated when HDMI was reconnected
because the display was blank, so we didn't go through that code
path.  So, when HDMI was re-connected, we passed stale data into
the HWC.

Bug 7323938

Change-Id: I2335d24fd7b0f00bb23fc63aa7bcf44cb8857c73
2012-10-10 18:17:51 -07:00
Mathias Agopian 3292cae8c3 don't automatically unblank external displays
this should be handled by the display-manager. we were doing
that in SF because until recently we didn't have enough support
in the HAL. however, this is now causing other problems when
plugging hdmi while the screen is off for instance.

Bug: 7150885
Change-Id: I739b209056a765d38d05295cf202f67ee0f506ae
2012-10-09 14:49:01 -07:00
Mathias Agopian cb55857bbd fix dumpsys Layer name when using multiple displays
Bug: 7288401
Change-Id: I14beeef58fac5270cef3b611e18c163060efe6c3
2012-10-08 15:57:17 -07:00
Jesse Hall 9a14392256 Ignore display state changes for disconnected displays
When a display is disconnected, removing it from SurfaceFlinger's
display list is non-atomic with removing it from the Display Manager
and any in-flight transactions. So SurfaceFlinger might get a display
state change transaction for a display it has already forgotten about.
Just ignore these.

Bug: 7288082
Change-Id: Ic27e55377f3db40fb34e3b1cd67e43297df117a2
2012-10-04 16:40:35 -07:00
Mathias Agopian 81cd5d3b94 make sure we don't call into the HWC HAL when not needed
when enabling/disabling vsync we now make sure to
not call into the HAL if the state wouldn't change.

Bug: 7274951

Change-Id: Ie24a6d68888a51b577acf9c2a973d85437cbacaf
2012-10-04 15:25:32 -07:00