Commit Graph

286 Commits

Author SHA1 Message Date
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