Commit Graph

532 Commits

Author SHA1 Message Date
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
Andy McFadden 27ec5739bc Fix crashes after HDMI disconnect
The display was being removed from SurfaceFlinger's list before we
had a chance to reset HWComposer's layer list, so we were passing
stale data into the hardware composer (which has its own per-display
data).  This resulted in "invalid gralloc handle" complaints.
We now clear the layer list immediately after removing the display.

The display was being removed while its EGLSurface was still
"current", resulting in "cancelBuffer: BufferQueue has been
abandoned" complaints.  We now call makeCurrent on the primary
display before removing the external display.

Bug 7274254

Change-Id: Ia59e3a61d7ec46488b96bf93ec5e4ed3488b70e4
2012-10-04 02:02:23 -07:00
Mathias Agopian 135e5899f7 save/restore viewport properly when taking screenshot
Bug: 7241739
Change-Id: Iba8b9ffc75ab47fbc56169e65da26d96850a9297
2012-09-30 16:43:20 -07:00
Mathias Agopian bae92d0d60 reset GL viewport and project when caputring the screen
Bug: 7241739
Change-Id: I3bb5214b070384de9be2026647865c6c236a4331
2012-09-28 13:34:26 -07:00
Andy McFadden c01a79d77b Pass display arg to blank/unblank
This allows us to blank and unblank displays other than the built-in
display (e.g. HDMI).

Bug: 7240511
Change-Id: I89ea13f9e497be74c3e1231d0c62fb558e93e0f8
2012-09-28 13:04:16 -07:00
Jamie Gennis a4310c8be2 SurfaceFlinger: don't always set HWC_GEOM_CHGD
This change fixes a bug in SurfaceFlinger that caused the HWC_GEOMETRY_CHANGED
flag to be set every flip.

Change-Id: I4f395a2883bcbb53b23b3d14941aff108739c9f0
Bug: 7234237
2012-09-27 17:27:20 -07:00
Jesse Hall a8026d21f3 Stop using transparent region for computing visible regions
The transparent region hint is computed only from view layout
locations, ignoring post-layout translation. If a SurfaceView is layed
out with no other views above it, but a view is moved above it
post-layout, that view's layout bounds would be subtracted from the
window's transparent region instead of its drawing bounds. Prior to
this change, the view would not be visible (except where its layout
bounds and drawing bounds overlap).

With this change, composition uses visible regions computed without
regard to the transparent regions. However, if all of a layer's
visible region is transparent, it will be removed from the list of
layers to composite. This doesn't fix the root problem of incorrect
transparent regions, and doesn't prevent bad composition in all cases.
But it does avoid it for some existing apps, whiel still allowing the
transparent region hint to save power in the important
fullscreen-video-in-a-SurfaceView case.

Bug: 7179570
Change-Id: I47cf939e12129b167afa344b8b036e8827103ac8
2012-09-26 14:41:51 -07:00
Mathias Agopian 722b98f9df add support for EGL_FRAMEBUFFER_TARGET_ANDROID
we now try first with EGL_FRAMEBUFFER_TARGET_ANDROID, and
pick the first config we find. Otherwise, we revert to
the old algorithm.

Bug: 7232584

Change-Id: I8d5c5a4ce48420832c2e2828718a8f53325effb0
2012-09-25 18:38:09 -07:00
Mathias Agopian 7b19051137 fix a crasher when running out of memory
MemoryHeapBase::getBase() returns MAP_FAILED in case or
OOM, not null which is what SF was checking against.

This addresses one of the issues of bug 7230543.

Bug: 7230543
Change-Id: I763a88f64a2f9ff75eb139cfbaf9a1a9746c5577
2012-09-25 15:30:38 -07:00
Mathias Agopian bb53b0e4b9 When "show visible regions" is enabled we were missing a call to HWC
Bug: 7204034
Change-Id: I64dd78362fa75149513a7d9ff92dde175e9b4958
2012-09-25 14:40:22 -07:00
Andy McFadden 4803b74e2a Show build config in dumpsys SurfaceFlinger
This adds a line to the "dumpsys SurfaceFlinger" output that shows
build-time configuration values.

Example:
 Build configuration: [sf HAS_CONTEXT_PRIORITY] [libui] \
  [libgui USE_FENCE_SYNC]

Bug 7206633

Change-Id: Ibe1856b459d34a4be6ee83a4ebfd2807e6cc68a0
2012-09-25 11:31:46 -07:00
Mathias Agopian 2a23184e41 don't call eglMakeCurrent() before calling HWC commit() on HWC 1.1
this call is not needed and misleading on HWC 1.1; it can also have
a negative performance impact when multiple displays are used.

Bug: 7124069
Change-Id: I47cd25c9d6e69abcc9333b9ecd5044e8fb1919ec
2012-09-24 18:12:35 -07:00
Mathias Agopian 9e2463e717 add/remove displays properly on hotplug events
Bug: 7191563
Change-Id: I8f0fbf3b29658c9479443141798e6f288a1f2d52
2012-09-21 18:26:16 -07:00
Mathias Agopian 4c0751a1f6 return an error, as expected, when querying a disconnected display
Change-Id: I405a3a7bb42b9bbd2ec7bfe09e60e1b7acf7389d
2012-09-20 21:28:12 -07:00
Mathias Agopian f5a3392834 we now correctly set-up connected screens during boot
Change-Id: Ie8b1a3b97ad1821cc970e43abe96c8cec7135b66
2012-09-20 17:13:58 -07:00
Mathias Agopian 148994e5f3 We now report hotplug events to the framework
Change-Id: I2d6b7787d39e5929485a551e4982498c5053c211
2012-09-20 17:13:58 -07:00
Mathias Agopian 1604f777d1 one more step toward HDMI support
getDisplayInfo() now returns proper information for
HWC managed displays.

hotplug is sitll not supported; so this is not fully correct
as the information returned will be bogus if the HDMI screen
is not plugged in.

Bug: 7191563
Change-Id: If55d8e829fae0443571548155007f486cdf9bc9f
2012-09-20 17:13:58 -07:00
Mathias Agopian f33e4b6f13 GraphicBufferAlloc class was declared twice
this was confusing because the one in FramebufferSurface
wasn't in fact being used

Change-Id: Ied45aec20d804cfbe52440f9b2f2852a85c757cf
2012-09-20 17:13:58 -07:00
Jesse Hall f21cffa7d7 Allow 16-bit color EGLConfigs
The emulator without GPU acceleration only supports 16-bit
framebuffers.

Bug: 7185810
Change-Id: I883180367bf5b291d5e70427ab586d2e17868a96
2012-09-19 21:00:49 -07:00
Mathias Agopian 1d12d8a8e6 improve logging of external displays
Change-Id: I041aebb7fc655aeca98bbf698d15e05d7c12cac9
2012-09-18 14:42:32 -07:00
Andy McFadden 8dfa92fef9 Plumb display name into SurfaceFlinger
The Surface createDisplay() call takes a display name for debugging.
This change carries it through SurfaceFlinger and displays it in
the "dumpsys SurfaceFlinger" output.

Bug 7058158

Change-Id: I79f3474a8656ff1beb7b478e0dbf2c5de666118a
2012-09-18 09:20:23 -07:00
Mathias Agopian da27af9832 add support hwc 1.1
Bug: 7124069

Change-Id: I53d705105c4ad8954d3f50ee4f4c8b7ec936b871
2012-09-17 18:57:53 -07:00
Mathias Agopian cde87a3b9d refactor things a bit
- decouple GL and main display initialization
- ensure that each "supported" display has its own FramebufferSurface
- onScreenAcquired/Released now takes a display

Change-Id: If34a05f3dea40f6c79db77f4dde283a2580daac4
2012-09-17 12:37:10 -07:00
Andy McFadden 6905205c8d Fix transform hints
The hints were being set a little too late, so the pre-rotation stuff
wasn't quite working.

Bug 7054997

Change-Id: Id8d5c626db7a76f768ba762a145b315878ee08e6
2012-09-16 11:39:09 -07:00
Jeff Brown 6e220a6ce6 Fix display projections when translated.
There are two different translations to apply in the logical
orientation, one before scaling and one after.
So translate, scale, translate then rotate.

Bug: 7139798
Change-Id: I0726991cadb62988390e77503dbbaed54f07bfe3
2012-09-13 19:24:43 -07:00
Mathias Agopian ce3a0a541c don't call hwc with non-empty layer lists for blanked displays
we now make sure to take the blanked state of a display into
account when we build its list of visible layers, this ensures
that we won't call prepare/set with a non-empty list when the
display is blanked.

Possibly fixes 7075380, 7103553, 7130187, 7016215

Bug: 7075380
Change-Id: I9fdd2e73d1b7621eaeca3d4ac2ae60d9fb1b3631
2012-09-12 17:42:06 -07:00
Andy McFadden 43601a2dc3 Reduce failure uncertainty
This adds a trivial workaround for a one-shot boot time crash, plus
an explicit check and abort for a failure condition that currently
presents as a less obvious failure.

Bug: 7145521, 7147557
Change-Id: I548f6a9caa9f0bd5710aaecea0e1c6c7c8f2f281
2012-09-11 15:15:13 -07:00
Andy McFadden b0d1dd36f1 Reshuffle FramebufferSurface
FramebufferSurface no longer speaks directly to the FB HAL.  Now
everything goes through HWComposer (which may or may not be
connected to a hardware composer).

Added display index arg to some query methods.

Change-Id: Id3e157d2d4e3555d33afbb703e518b6e92e2d6d5
2012-09-11 09:31:34 -07:00
Jeff Brown 4c05dd175e Ensure that viewport and frame are initialized.
onInitializeDisplays() was posting a transaction with changes
to the display projection.  Unfortunately, it only set the
display orientation field and left viewport and frame
uninitialized.

The uninitialized values flowed downstream and found themselves
baked into a bogus DisplayDevice mGlobalTransform.  That transform
was then applied to some Rects which were turned into Regions
that were them combined with other Regions.

Under certain situations, the uninitialized data might have
a largish value, resulting in the creation of Regions with
components in excess of the Region max-value limit of 0x7ffffff
(note that this is not INT_MAX).  Later when performing a
binary operation using the Region, the Spanner would loop
indefinitely trying to figure out how to stuff a humongous
region inside of a max-value region.  Not content to try
just once, the Spanner would continue trying again and
again, pegging the CPU and hanging surface flinger during boot.

Insanity soon followed.

Bug: 7130713
Change-Id: I0016f0c9662185be833474c212a1dd408096ae23
2012-09-09 00:07:17 -07:00
Jeff Brown 4fb3999cea Fix display projection.
Change-Id: I0f253dc3759b99e05ff8344b0f513d8c289702e7
2012-09-07 12:55:10 -07:00
Mathias Agopian 1501d54d63 minor cleanup
Change-Id: Ied80e14878e92a506930f7a5a55adde8f260ec70
2012-09-04 21:04:09 -07:00
Mathias Agopian 00e8c7a88a display projection API now has a single function instead of 3
Change-Id: I9bf46d372b77d547486d4bbe6f1953ec8c65e98f
2012-09-04 19:30:46 -07:00
Mathias Agopian da8d0a5c0c implement display viewport and frame
note: viewport clipping is not implemented yet

Change-Id: I7fde7c4de075d409d95c48bb20ba8ee017f6f00a
2012-09-04 16:59:06 -07:00
Keun young Park 63f165fd6b add libsurfaceflinger_ddmconnection for PDK build
- the library is dlopened from libsurfaceflinger
- the library built only when libnativehelper exists

Bug: 7089510
Change-Id: Ib3ea1029d7e8f6e055f4b759d0bf68f5123fa8a1
2012-08-31 20:08:33 -07:00
Jesse Hall 9ca48916bc If there is no hwc, call eglSwapBuffers for the main display
Bug: 7068568
Change-Id: I6a0309613fe3619d065b9047af6c3fb32b510d97
2012-08-31 13:52:25 -07:00
Mathias Agopian 93997a8a75 fix a crasher when setting a display to a null surface
Bug: 7076303
Change-Id: I843dd4ee4a603b8ad51bc1ad14e429db15050bec
2012-08-29 18:22:23 -07:00
Mathias Agopian 85d751cba5 we were sometimes not setting fences properly
this would happen when the composition was handled
entirely in h/w composer, in this case, we would
not set the fences for any involved layers.

Bug: 7049373
Change-Id: I1439dc156ce23c24041cdfbbebfe8ff4fdf790f8
2012-08-29 16:59:24 -07:00
Mathias Agopian 7e7ed7f77a the layer list per display could contain non-visible layers
this happened because we didn't check that the visible
region was within the bounds of the display.

Bug: 7064121
Change-Id: I2e81850a3dc3d1474253520ad7f9e559c26d5a96
2012-08-28 14:20:00 -07:00
Mathias Agopian 55801e41e6 we were not always clearing the screen properly
Change-Id: I269dd866e965aebd9b3c4667095818202982f4a3
2012-08-27 18:54:24 -07:00
Mathias Agopian 3ee454a7be Eradicate DisplayID.
DisplayDevices are now keyed of the wp<IBinder> the client uses.
DisplayID has now become DisplayType which is just used to identify
physical displays (as opposed to virtual displays such as wifi displays).

Change-Id: I0c5968f2c902dcd699a7e0afacf833ff070c12ea
2012-08-27 17:43:43 -07:00
Jeff Brown 9d4e3d2f42 Banish DisplayID from the SurfaceFlinger API.
Use only display tokens in the API to refer to new displays.

Don't require the caller to specify the display when creating
a surface (since in general a surface could be shown on
any display).

This is intended to be a minimum change just to update the API.
Note that SurfaceFlinger still uses DisplayID in a few places
internally that might cause some features not to work properly
when there are multiple displays (LayerScreenshot, for example).

Change-Id: I3d91eec2da406eefd97bcd53655d403ad865a7e6
2012-08-27 14:40:17 -07:00
Andy McFadden 13a082e160 Added display initialization method
The primary display device was being configured to "blank" by
default, which prevented the boot animation from appearing
(unless you got lucky with the hardware composer state).

Bug 6975688

Change-Id: I0fa52e9e719c6e997c5725a7baf15d9718461b78
2012-08-24 11:50:34 -07:00
Jamie Gennis 0bceb84773 surfaceflinger: fix display id selection
This change fixes display ID selection so that it never chooses negative
numbers as display IDs.

Change-Id: I5af1acc7b1270b371595e096b18e2a6ad250c7ba
2012-08-24 11:12:28 -07:00
Andy McFadden 9b6a395e65 Revert "Added display initialization method"
Something doesn't seem right (again).

This reverts commit 53ade0853c.

Change-Id: Id5786997ca9dd2a447363e8ac95213ea37468504
2012-08-24 10:12:38 -07:00
Andy McFadden 53ade0853c Added display initialization method
The primary display device was being configured to "blank" by
default, which prevented the boot animation from appearing
(unless you got lucky with the hardware composer state).

Bug 6975688

(This reverts an earlier revert.)
2012-08-24 09:19:56 -07:00
Mathias Agopian e60b0687c8 HWComposer now has its own concept of display IDs
HWComposer can now create IDs representing a display
it can deal with. IDs MAIN and HDMI are reserved.
SurfaceFlinger associate HWComposer IDs with a
DisplayDevice and uses that when it talks to HWComposer.

A DisplayDevice doesn't have to have a HWComposer ID,
in that case it just can't use h/w composer composition.

Change-Id: Iec3d7ac92e0c22bf975052ae2847402f58bade71
2012-08-23 16:03:37 -07:00
Ramanan Rajeswaran f1bf89dd88 Revert "Added display initialization method"
This reverts commit 3f3956236a

Change-Id: Ia2a15d9a5db88add6019edf9d955cef1f73d432d
2012-08-22 14:23:50 -07:00
Andy McFadden 3f3956236a Added display initialization method
The primary display device was being configured to "blank" by
default, which prevented the boot animation from appearing
(unless you got lucky with the hardware composer state).

Bug 6975688

Change-Id: Idaa0d0b98ebb331a17d1b16774c6b05bfa1e8728
2012-08-21 13:11:51 -07:00
Mathias Agopian cd60f99aba refactor compositing code to avoid multiple eglMakeCurrent() calls
when multiple displays are connected, we ended-up having to
call eglMakeCurrent() twice per display due to a limitation
in EGL. this fixes that.

Change-Id: I11e4584df50f8c24bbecee74e37b28b3ee031d2f
2012-08-16 20:58:58 -07:00
Mathias Agopian 5f20e2d446 reimplement wifi display hack with new external display SF framework
fix a few bugs with external displays

- HWComposer doesn't really handle multiple displays yet
  so there is a lot of ugliness there

- We also need to make sure that external displays are not
  blanked by default

- due to some EGL limitations surfaces being swapped need
  to be current

Change-Id: I82bff05b43bcebd8da863c7c76b4edbc3bc223a9
2012-08-16 20:58:58 -07:00
Mathias Agopian 818b46058a display states can't share the dirty flags
Change-Id: Ifade9f2f1a0df9a36aede77a6cf5eee4be534f98
2012-08-16 20:58:57 -07:00
Mathias Agopian 111b2d8922 binder interfaces can't be compared directly
we always need to compare their binder

Change-Id: I70d554ebc5009fe81e87923235f91451f32e1a30
2012-08-16 20:55:28 -07:00
Mathias Agopian 13233e067b oopsie, missed a spot when fixing b/6970310
Change-Id: Ia320fddc7cc4b0666a4fee678af710ecf5f83ff5
2012-08-15 16:14:33 -07:00
Mathias Agopian 3559b07a88 we were mistakenly optimizing out SF's main transactions in some cases
due to a typo, SF's main transaction was conditional to having a
display transaction.

more correct fix for 6970310

Bug: 6970310
Change-Id: Iafd8c4e02afa5db829cc1c65950cfcc74754c6af
2012-08-15 13:46:03 -07:00
Jeff Brown 01eb979243 Fix layer removal transaction.
Layers were not properly being removed because we were
setting the wrong transaction type flag at the time of
removal.

When layers are removed, we must use eDisplayTransactionNeeded,
not eTransactionNeeded, to ensure that the mLayersRemoved
flag is checked and the appropriate cleanup occurs.

Bug: 6970310
Change-Id: Id4b2897a34d4ac00aa0f92349c0ec6db95c1aaf7
2012-08-15 01:16:16 -07:00
Jesse Hall ea599dfff0 Don't crash when recovering from WM death
Bug: 6956162
Change-Id: I27244b960c77187b4c4cd7297989c4c872e94a3a
2012-08-14 15:33:04 -07:00
Mathias Agopian 20128300e0 make sure to repaint the screen when unblank()ing
Change-Id: I38e3a8e6bb31ef3d2f1fcaec7490cb92a4427db2
2012-08-13 18:32:13 -07:00
Mathias Agopian 8b736f138c xdpi / ydpi were reported as 0
Bug: 6975723
Change-Id: Ia7fa37ec11e2308804f5034959a37e508d292d31
2012-08-13 17:54:26 -07:00
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 ef7b9c7eac screenshots could stop working after camera was used
once a secure window is put on screen the display
would retain its "secure" flag forever, preventing
screenshots from being taken.

Bug: 6933967
Change-Id: I5be8355145ca7d580d84552311642f8fa912fe6a
2012-08-10 15:23:41 -07:00
Mathias Agopian 3165cc21cf libgui includes refactoring
Change-Id: I1d24ec17f5003ec2abab5f7472daaff4cc4cc2d3
2012-08-10 13:18:24 -07:00
Mathias Agopian 1e26087493 Add a display parameter to HWComposer where needed
- also replace C casts with C++ casts
- only the interface is changed, HWComposer still doesn't
  fully handle multiple displays

Change-Id: I48eb89bff2edb76bf1d4d41f46802b9b2a7166a8
2012-08-10 13:18:24 -07:00
Mathias Agopian 28947d7fbf now able to set the layer stack on a DisplayDevice
Change-Id: Ia9691cf221b9444c243eb468d9e276a30e600b6b
2012-08-10 13:18:23 -07:00
Jamie Gennis 1a4d883dcc surfaceflinger: refactor FrambufferSurface
This change refactors the FramebufferSurface class to inherit from the new
ConsumerBase class.

Bug: 6620200
Change-Id: I46ec942ddb019658e3c5e79465548b171b2261f2
2012-08-06 18:55:01 -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 c1d359d42b break SF dependencies on libdvm and libandroid_runtime
these libraries are only needed for debugging and are now
linked at runtime if needed.

Change-Id: I03f138523c6de166a1e2700d4454d4a854aee145
2012-08-04 20:09:48 -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 fcb239d3da don't filter when capturing a screenshot unless needed
bug: 6919952
Change-Id: Ia6fbe9bc7e533a64cfdd6ef7f0cd6b9f11feb947
2012-08-02 22:24:12 -07:00
Mathias Agopian d3ee231edd cleanups in preparation of bigger changes
- fix typo drawForSreenshot misspelled
- get rid of DisplayDeviceBase
- removed unused or unneeded code
- always pass a DisplayDevice to Layer methods that are called
  on a per-display basis (to make it clear that this could be
  called more than once per composition).

Change-Id: Id948b7e09fe5c06db0e42d40d6ed75dd095c7f44
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 be246f86bd Layers are now sorted by layer-stack first, then by z-order
Change-Id: I7a82929df5ba87b9d88cc5be87e1a233bc4628e9
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 028508cad5 hopefully fixe a race condition in sf initialization
if we received a vsync event during SF init, we could crash
as not all objects were ready to go.

Change-Id: Ie11b46e3eb1b37a709dd8757843d444f93dd0189
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 98a121aa91 get rid of ro.sf.hwrotation, it's not used anymore
Change-Id: I2ee469ac89ecd65d7187be5cab08b5cc18f67cbe
2012-07-24 21:42:27 -07:00
Mathias Agopian 8785578391 add a layerStack attribute to Layers.
this attribute can be set through a regular transaction using
SurfaceComposerClient (just like any other attribute, eg: position or size)

Change-Id: I701a47c677ea6442ca713728a93335328cd2b172
2012-07-24 21:42:27 -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
Jesse Hall 6ee93c0d36 Increment iterator on early-out too
Bug: 6860046
Change-Id: I82f9e4062cb58d5479c9d8dc5f2f0770a1dcc605
2012-07-23 13:12:28 -07:00
Jesse Hall a6b32db164 Handle empty HWC layer list when composing
Bug: 6777877
Change-Id: I71e9b948d04dda33d45cfa986d9c7e28328cf749
2012-07-20 11:46:58 -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
Jesse Hall c5c5a14c06 Only set acquire fences on overlay layers
Change-Id: I08e8173f83580de5a4e43a0ba5ea03e5ec6e8782
2012-07-02 16:49:28 -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
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
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
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
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 a4c5b19dd7 SurfaceFlinger: remove all GLES scissor calls.
Bug: 6576505
Change-Id: I494b7627f2e271a234706bf49a9490f8ac56c77a
2012-06-05 19:14:44 -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
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 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 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 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
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 4b2ba53423 better workaround for bug: 6020860
this prevents the GPU from running when composition
is fully handled by overlays. this should improve
animations a bit.

Change-Id: If4ae584b7a3976e6bdd36e318686ac3940b6b075
2012-03-29 12:23:51 -07:00
Colin Cross 3854ed5490 surfaceflinger: disable ddms debugging on pdk builds
DDMS debugging depends on non-pdk apis, disable it when a pdk
build is selected.

Change-Id: I6376b5c4cf49f2c51f35f8d567f7c6d18daf893f
2012-03-23 15:54:21 -07:00
Mathias Agopian b5dd9c0fee rewrite density calculation code so it's understandable
Change-Id: I1016cd5fd75355abe4ab879d04f4849bd2dd4122
2012-03-22 12:20:06 -07:00
Daniel Lam b267579ba8 SurfaceTexture: Fully refactored from BufferQueue
SurfaceTexture and BufferQueue are separate objects.

Change-Id: I230bc0ae6f78d0f9b2b5df902f40ab443ed5a055
2012-03-13 14:39:07 -07:00
Mathias Agopian fddc28d871 add ATRACE logs for screenshots
Change-Id: Ie8146c4d7608159e9d28b7338f9109b8fcdf955f
2012-03-13 16:50:39 -04:00
Mathias Agopian 35aadd6be2 fix surfaceflinger's dumpsys
Change-Id: I7b95c3e04f145003f9c0eef321a21f3f36dfe835
2012-03-08 22:01:51 -08:00
Mathias Agopian 841cde5554 add more ATRACE
Change-Id: I6cc5759fb0a05427680488fd12ae797e77644f3d
2012-03-01 20:16:39 -08:00
Jamie Gennis 1c8e95cf86 Add tracing to various graphics components.
This change adds ATRACE call tracing to BufferQueue,
SurfaceTextureClient, SurfaceTexture, SurfaceFlinger, Layer, and EGL.

Change-Id: I9d75ed26f5a3f0d1af635da38289520134cfbbb7
2012-02-27 17:50:35 -08:00
Mathias Agopian 90ac799241 fix libgui header location
Change-Id: Iec71706cdd4f29c6904993648ce873e83ef9cafe
2012-02-27 13:03:08 -08:00
Mathias Agopian ff615cc7a1 deprecate L_8, LA_88 and RGB_332 in sdk
re-add support for pixelformats L_8, LA_88 and RGB_332 in libui
for backward compatibility.

This may or may not fix 6058926

Bug: 6049685
Change-Id: Ic1b8b4cc994522f7fe664da64c0ef76b98bc6d53
2012-02-24 14:58:36 -08:00
Mathias Agopian fbc7922ec8 workaround for an issue where the screen would flicker sometimes
bug: 6020860
Change-Id: I97807db66b66c5f4dcbed0df79d5d257cfc7c0bd
2012-02-23 21:20:01 -08:00
Mathias Agopian 4d143eed99 fix an issue in SF where we could miss some updates
Change-Id: I7d350bc05d1596655baddff3deaebaba58c9bcc0
2012-02-23 21:17:01 -08:00
Mathias Agopian 751d0bb9b2 Merge "SurfaceFlinger: set wrap mode on screenshot texture" 2012-02-20 22:50:36 -08:00
Dianne Hackborn 1676828d11 Merge "Return information about whether overlays are disabled." 2012-02-07 13:46:46 -08:00
Dianne Hackborn 12839bee29 Return information about whether overlays are disabled.
Change-Id: I85ae42e9f28461f5142cc6b3c8e25ff3f195805a
2012-02-06 21:21:05 -08:00
Mathias Agopian f6de1c04ff fix a crasher when starting SF with the screen off
SF could end-up in an infinite crash-loop during startup if it
was stopped while the screen was off. This happened because
the thread that manages screen blanking was started before
other important pieces of SF were initialized.

Change-Id: I0dded11dbf2395fdd57b673859a7aa0fa9eb32b6
2012-02-05 02:15:28 -08:00
Mathias Agopian 303d538bb0 ui freeze workaround: reenable triple buffering mode
we're seeing UI freezes when window updates and
composition are separated. for now we workaround this
by always doing a composition after window updates on
vsync. triple buffering is reenabled for performance.

Change-Id: I693d705000b7452489bb0b4918fbeadb9879315c
2012-02-05 01:49:16 -08:00
Mathias Agopian c95dbdc236 improve SF dumpsys 2012-02-05 00:19:27 -08:00
Mathias Agopian b048cef231 fix UI freezes
In some situations SF would mark a window as "has a pending update"
but would never process that update because the window is not
visible (fully transparent, hidden by another window, etc...), this
window would then be "stuck" until some other window updated.

Change-Id: Ifa18a9aef3a53f2593b473556702688ae62d9503
2012-02-04 15:44:04 -08:00
Mathias Agopian c9ca701150 attempt to fix an ANR in various apps
recent changes in SF introduced a hang where some windows would
stop being refreshed.
This is an attemp to fix that.

Change-Id: I6aa32ac0d6f1c0a6aea8f6195825dc4f4e6f93f9
2012-02-03 17:22:09 -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 8aedd4737d SF now synchronizes to VSYNC
Change-Id: Ic5e4f2ea9927ce133eef9499c03161325e9d02c5
2012-01-30 15:21:23 -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
Jamie Gennis e8696a40e0 hack up frame latency measurement
Change-Id: I6d9a466a23285304f0e229a5649815636ab5d6af
2012-01-24 15:41:50 -08:00
Glenn Kasten 1db13d7951 Get AID_GRAPHICS from right place
Change-Id: I97b1754dc7260fec083275c71a8f71ebfb2cefa8
2012-01-13 13:45:39 -08:00
Michael I. Gold b1d1c6d4c2 SurfaceFlinger: set wrap mode on screenshot texture
Some implementations of NPOT, particular those derived from core
GLES2, require the wrap mode to be CLAMP_TO_EDGE.  Set the required
wrap mode for the screenshot texture so it passes the completeness
check.

Change-Id: I735016123e4acaf54b40d1435bd70281cef88a31
2012-01-13 00:36:45 -08:00
Mathias Agopian 55ef343331 remove dead/usnused code
Change-Id: I6fa2bc6ee01790abd2c1533f043d61a5e5c8d26e
2012-01-11 22:03:41 -08:00
Steve Block e6f43ddce7 Rename (IF_)LOGE(_IF) to (IF_)ALOGE(_IF) DO NOT MERGE
See https://android-git.corp.google.com/g/#/c/157220

Bug: 5449033
Change-Id: Ic9c19d30693bd56755f55906127cd6bd7126096c
2012-01-08 13:19:13 +00:00
Steve Block 32397c1cd3 Rename (IF_)LOGW(_IF) to (IF_)ALOGW(_IF) DO NOT MERGE
See https://android-git.corp.google.com/g/157065

Bug: 5449033
Change-Id: I00a4b904f9449e6f93b7fd35eac28640d7929e69
2012-01-06 10:07:54 +00:00
Steve Block c267bab3d1 Merge "Rename (IF_)LOGI(_IF) to (IF_)ALOGI(_IF) DO NOT MERGE" 2012-01-05 14:07:02 -08:00
Glenn Kasten 2adea706d4 Merge "Use the standard CC_LIKELY and CC_UNLIKELY macros" 2012-01-05 07:38:29 -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
Steve Block a19954ab37 Rename (IF_)LOGI(_IF) to (IF_)ALOGI(_IF) DO NOT MERGE
See https://android-git.corp.google.com/g/156801

Bug: 5449033
Change-Id: Ib08fe86d23db91ee153e9f91a99a35c42b9208ea
2012-01-04 20:05:49 +00:00
Steve Block 9d45368352 Rename (IF_)LOGD(_IF) to (IF_)ALOGD(_IF) DO NOT MERGE
See https://android-git.corp.google.com/g/156016

Bug: 5449033
Change-Id: I4c4e33bb9df3e39e11cd985e193e6fbab4635298
2012-01-03 22:38:27 +00: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 79544364aa am e2970700: am e8ba2aba: Merge "add a way to access the version string of the h/w implementation of EGL" into ics-mr1
* commit 'e2970700e921da4226061988a6e8953b1fbfb5a9':
  add a way to access the version string of the h/w implementation of EGL
2011-11-30 13:57:46 -08:00
Mathias Agopian bc2d79ed7a add a way to access the version string of the h/w implementation of EGL
we use a hidden egl extension. the version string is printed
in SF's dumpsys log.

Change-Id: I123eb4bde6de462bb2404c67b74d6d6219a48d6a
2011-11-29 18:00:35 -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 f61c57fe2e rewrite SF's message loop on top of Looper
Change-Id: Ib56139f87a5c0b124e34da5c8151207219b2577b
2011-11-28 15:21:57 -08:00
Mathias Agopian 386aa98c4f Fix an issue where we could wait for a non-existing transaction
This fixes the issue:
"Call not sent" dialog takes too long to dismiss after hitting OK"

Note: the system would recover after a 5 second timeout.

Bug: 5534520
Change-Id: Ifa37e594b50581f498479a5858672441b3d7dd87
2011-11-07 21:58:03 -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 62f7114719 fix Corrupted graphics while playing You Tube on orientation change
Bug: 5432124
Change-Id: If948b9797b1ec6fff80ca5ea94508abcaced9f31
2011-10-26 15:11:59 -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
Mathias Agopian 7ec662c07a am 16bece04: Merge "added dpi and refresh rate info in SF\'s dumpsys" into ics-mr0
* commit '16bece04bdbac9af5228436f70267ec5763315de':
  added dpi and refresh rate info in SF's dumpsys
2011-10-20 17:48:02 -07:00
Mathias Agopian d5e4ef9e43 added dpi and refresh rate info in SF's dumpsys
Change-Id: I2327248eb1993689367e3daeaccba74c172dfceb
2011-10-20 17:22:38 -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 675370ab9a am f7613743: Merge "Don\'t call hwc set() if there is nothing new to do" into ics-mr0
* commit 'f7613743f29f38cbbaf4ae09996c380845a17daf':
  Don't call hwc set() if there is nothing new to do
2011-10-18 20:24:23 -07:00
Mathias Agopian 5ba8f366bd am 23bf2505: Merge "Make sure set GL state properly" into ics-mr0
* commit '23bf250522b7dff9acd14c5900b66b1df9c76745':
  Make sure set GL state properly
2011-10-18 20:24:21 -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 3a3cad30c4 Don't call hwc set() if there is nothing new to do
there was situations where SF's main loop would run (as if there was
an invalidate), but the dirty region was empty (so no new buffers
were retired). In this case we return early and don't swap, which
would cause drawing artifacts.

Bug: 5476838
Change-Id: Id3b7bf4b7aabec7919c50d9278eb2165973a4c3d
2011-10-18 17:39:09 -07: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
Mathias Agopian cdec8f01aa am 840b8a67: Revert "Add a LayerScreenshot"
* commit '840b8a678537519c27ddf2f818494eaa20a135d4':
  Revert "Add a LayerScreenshot"
2011-10-17 11:32:19 -07:00
Mathias Agopian 5bacca6238 am 4fb6416e: Merge "we need to guarantee that h/w comp set() is called when a buffer has been retired" into ics-mr0
* commit '4fb6416e3a21031a88921a784ae62b13d8a1a39f':
  we need to guarantee that h/w comp set() is called when a buffer has been retired
2011-10-17 11:32:16 -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
Mathias Agopian a44b041639 we need to guarantee that h/w comp set() is called when a buffer has been retired
removed a test that could violate this guarantee. note that we
have no proof tha this ever happened, but consequences could be
hard lock-ups.

the code here was intended to track the region to update for displays
that can do partial update. the logic discarded the update entirely
if that region was empty. instead we just redraw the whole thing
(note that we should never be there with an empty region and retired
buffers though).

Bug: 5466259

Change-Id: I91ccab3b1a599e729e438eb833939e2236da6854
2011-10-16 18:59:38 -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
Jamie Gennis b8d69a55f1 SurfaceFlinger: update orientation via transactions
This change merges the ISurfaceComposer::setOrientation functionality
into ISurfaceComposer::setTransactionState.  It enables the window
manager to atomically update both the display orientation and the
position and size of the windows in a single transaction with
SurfaceFlinger.

Bug: 5439574
Change-Id: I18a8ccc564d7d760ef8afb2d015ccdb7a7963900
2011-10-11 13:34:01 -07:00
Mathias Agopian f7cdd053fe fix an issue where the screen could stay off
this would happen when toggling on/off/on very fast, the screen
could stay black (while the panel is on).

Bug: 5429724
Change-Id: Ic8aa6aff066e6267923c0d47ef65e314e7bb6d41
2011-10-10 22:18:55 -07:00
Mathias Agopian a9040d0eef Fix screen off animation when in landscape
Change-Id: I4bc5b12d7a64a4bf8b9a851594be4d60b790d1ed
2011-10-10 19:02:07 -07:00
Jamie Gennis 9575f60722 SurfaceFlinger: screenshots w/ protected buffers
This change modifies SurfaceFlinger's screenshot behavior when a layer
with a protected buffer is visible.  The previous behavior was to simply
fail the screenshot.  The new behavior is to render the screenshot using
a placeholder texture where the protected buffer would have been.

Change-Id: I5e50cb2f3b31b2ea81cfe291c9b4a42e9ee71874
2011-10-07 17:53:37 -07:00
Mathias Agopian 059fd18396 Merge "don't clear the framebuffer when the framebuffer is not used" 2011-09-22 21:01:21 -07:00
Mathias Agopian cd20eb09c4 don't clear the framebuffer when the framebuffer is not used
when areas of the FB are undefined (transparent windows on top of
nothing), we clear those areas before composition.
however, it makes no sense to do this when the FB is not in use
(case where hwc handles all layers)

Bug: 5360529
Change-Id: If51bb669307e8419bbe1f3a89d1c88e0ec1f216c
2011-09-22 20:57:04 -07:00
Jeff Brown 21230c6410 Handle orientation changes more systematically.
Bug: 4981385

Simplify the orientation changing code path in the
WindowManager.  Instead of the policy calling setRotation()
when the sensor determined orientation changes, it calls
updateRotation(), which figures everything out.  For the most
part, the rotation actually passed to setRotation() was
more or less ignored and just added confusion, particularly
when handling deferred orientation changes.

Ensure that 180 degree rotations are disallowed even when
the application specifies SCREEN_ORIENTATION_SENSOR_*.
These rotations are only enabled when docked upside-down for
some reason or when the application specifies
SCREEN_ORIENTATION_FULL_SENSOR.

Ensure that special modes like HDMI connected, lid switch,
dock and rotation lock all cause the sensor to be ignored
even when the application asks for sensor-based orientation
changes.  The sensor is not relevant in these modes because
some external factor (or the user) is determining the
preferred rotation.

Currently, applications can still override the preferred
rotation even when there are special modes in play that
might say otherwise.  We could tweak this so that some
special modes trump application choices completely
(resulting in a letter-boxed application, perhaps).
I tested this sort of tweak (not included in the patch)
and it seems to work fine, including transitions between
applications with varying orientation.

Delete dead code related to animFlags.

Handle pausing/resuming orientation changes more precisely.
Ensure that a deferred orientation change is performed when
a drag completes, even if endDragLw() is not called because the
drag was aborted before the drop happened.  We pause
the orientation change in register() and resume in unregister()
because those methods appear to always be called as needed.

Change-Id: If0a31de3d057251e581fdee64819f2b19e676e9a
2011-09-21 19:26:15 -07:00
Mathias Agopian 9c6e297271 fix transition from full overlays to fb
we need to clear the whole framebuffer in that situation because
we can't trust the content of the FB when partial (fb preserving)
updates are used.

Bug: 5318492

Change-Id: I3f0e01b0fb665a34e44d88ad9f0f54a5d990060b
2011-09-20 17:53:33 -07:00
Mathias Agopian 0656a68380 rename mInvalidRegion to mSwapRegion
Change-Id: I946cbc782c0c84645843ea44c3d8b04a0a2fe658
2011-09-20 17:53:33 -07:00
Mathias Agopian fb4d5d5726 improve hwc dumpsys
we now log the buffer's format

Change-Id: I9d3ad8018e884240a153de3baefb6331cb014d0f
2011-09-20 17:53:33 -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 7ee4cd5556 fix a bug that caused the off animation to not show sometimes
this happened when the overlays were in use, since the animation
is rendered in the FB and the FB is not used.

we now have a way to turn hwc off temporarily.

Change-Id: I3385f0c25bb9cc91948e7b26e7cd31ed18c36ace
2011-09-02 12:22:39 -07:00
Mathias Agopian f914e7ffad Fix various flickering / artifacts
these were due to the "preserve backbuffer" optimization
interfering with hw composer. basically the screen needed
to be redrawn in the areas that move from GL to
overlay.

Bug: 5245513
Change-Id: I9bf75c4fe905f3ef62005e52108b94edae692304
2011-09-01 18:56:54 -07:00
Mathias Agopian b0610335d7 Fix screenshots
Change-Id: If904634e64b154bbe336d5789dd1209b8ae871fb
2011-08-25 14:36:43 -07:00
Mathias Agopian 0abe83a680 Fix Recent thumbnails aren't taken when leaving an activity via notification
When taking screenshots we need to use the full drawing state list
instead of the visible list.

Bug: 5186823
Change-Id: I214ee0203aaf8e2c038e44581f7f1ae36edf08c5
2011-08-24 17:44:41 -07:00
Mathias Agopian a45836466c Add a debug option to turn the "transformation hint" off
transformation hint is disabled with:

   adb shell service call SurfaceFlinger 1009 i32 1

Change-Id: I9aafe6f280f88ce41569ed69a06dc522b10e3a88
2011-08-23 21:10:35 -07:00
Mathias Agopian 53331da007 fix "show screen update" debug option.
Change-Id: I7d8b24124768b5f7d59d3bb0b019e9baaa0dfc4f
NOTE: from now on, this also disable the h/w composer
2011-08-22 21:44:41 -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 8afb7e39a8 as a debug option SrufaceFlinger can now connect to DDMS
this is disabled by default. To enable:
  setprop debug.sf.ddms 1

this debug option requires to restart SurfaceFlinger

Change-Id: Ic2f8050b29911b55bcd21721648b6978700c277d
2011-08-15 20:44:40 -07:00
Mathias Agopian 47d0812977 SurfaceFlinger doesn't rely on having a custom RefBase destructor
we just use a message to the main thread to
destroy our GLES state.
2011-08-11 22:33:02 -07:00
Mathias Agopian c10d9d90b2 clean-up. get rid ofunused code and members in Surface[Control].cpp
Change-Id: Ia7790ae28af2c2ac99eae01c2c5044ace4a490a4
2011-07-20 16:53:13 -07:00
Mathias Agopian ad70186f80 dump GLES strings in SF dumpsys log
Change-Id: I438d511159b2bd915c84954f30574340017d4f47
2011-07-15 14:29:25 -07:00