Commit Graph

511 Commits

Author SHA1 Message Date
Dan Stoza 2311608667 libgui/SF: Propagate SECURE Layer flag changes
This allows changes to the SECURE flag to propagate down to
Layers in SurfaceFlinger so that WindowManager can change it on the fly
in response to device policy updates.

Bug: 20934462
Change-Id: I558f6d22c6273be373f1f480365e42536af18a33
2015-06-18 15:11:20 -07:00
Tatenda Chipeperekwa 23e16bb5da sf: Add a NULL check in getDisplayConfigs
Validate the display binder by adding a NULL check in getDisplayConfigs.
This will prevent a false match if the caller queries the display
configs for an inactive display (whose binder is NULL by default).

Without this change we might end up attempting to index the display
config array, which is unpopulated for inactive displays, and this will
result in a crash. (See getDisplayInfo in SurfaceComposerClient.cpp for
an example of this scenario)

Change-Id: I1a12f43b7c375b9c01998dadd5b658275c733fb2
(cherry picked from commit ac71c26e9180d9d181be5ec9e45da72d39144a8b)
2015-06-11 10:40:21 -07:00
Dan Stoza 3502416204 SF: Swap w/h when capturing rotated screenshots
Swaps width and height when capturing a screenshot that is rotated by
90 or 270 degrees.

Bug: 8433742
Change-Id: Ibf0b604f541e3cc271e56fe0ad04dc366beb5d79
2015-06-09 16:46:20 -07:00
Dan Stoza f008799d37 SF: Skip render-to-texture for color transforms
In cases where SurfaceFlinger is applying a color matrix (usually for
accessibility features), we previously would perform a render-to-
texture for the initial composition, and then apply the matrix during
a copy to the framebuffer. This changes that behavior to just apply the
matrix during composition without a render-to-texture pass.

This may result in a perceived change of the image in cases with alpha
blending, since the blending is performed at a different stage of the
pipeline and the system effectively performs non-linear blends.
However, neither this nor the prior render-to-texture pass is strictly
correct in that regard, and this approach is less error-prone and
likely faster.

Change-Id: I2110ff0374f61d76df7b087dde8a1ed98990440c
2015-05-27 13:32:51 -07:00
Michael Lentine 5a16a62950 Fix surfaceflinger tests.
Update the screenshot code and add correct return values to surface flinger's
capturescreenshot function.

Buf: 18138368

Change-Id: Ieb42d289088589f941502fbd69da7aa939265e07
2015-05-22 13:14:57 -07:00
Dan Stoza 7d89d06a6f SurfaceFlinger: Limit to 4k Layers
Sets a limit of 4k Layers which SurfaceFlinger will allow to be in
existence at any given time. An attempt to create Layers in excess of
this limit will fail with NO_MEMORY.

Bug: 20674586
Change-Id: I2dfaf59643d826f982b2fa44e8a9ed643176d972
(cherry picked from commit e7f8dde3f3)
2015-04-30 15:10:00 -07:00
Dan Stoza d5296b342e am 66dc4ee3: am b47584f4: am 2e398e64: Merge "SF: Permit changing DispSync offsets at runtime"
* commit '66dc4ee3729c4e6fea624805a1e58843ce920477':
  SF: Permit changing DispSync offsets at runtime
2015-04-15 22:16:03 +00:00
Dan Stoza 91dea34652 am 19f06de0: am 40b2a8b4: am e7d20eb0: Merge "SurfaceFlinger: Pass surface damage to HWC"
* commit '19f06de0930e0f741ed113c37faf306fceee39bd':
  SurfaceFlinger: Pass surface damage to HWC
2015-04-15 21:42:44 +00:00
Dan Stoza db4ac3ce63 SF: Permit changing DispSync offsets at runtime
This modifies EventThread such that its phase offsets for both
Choreographer and SurfaceFlinger may be modified at runtime. It also
plumbs this functionality up to the SurfaceFlinger debug interface so
that it is possible to rapidly test different offsets without
restarting the framework.

Change-Id: I426873f8553f931250dfebc9a8a4a78e9f1f4309
2015-04-15 13:56:28 -07:00
Dan Stoza ee44edd0ac SurfaceFlinger: Pass surface damage to HWC
Passes the surface damage from the incoming SurfaceFlingerConsumer
BufferQueue down to the hardware composer HAL interface, if the
HWC version number is 1.5 or greater.

Bug: 11239309
Change-Id: Ic4305210593874a8d6deba3319055b2b8c57e926
2015-04-15 13:20:01 -07:00
Jeff Brown 3bfe51d790 Bypass surface flinger permission check for calls from system.
Early during the boot, before activity manager is ready to handle
permission checks, the system needs to be able to change the display
state.  Added a hardcoded exemption for AID_SYSTEM (which already
has permission to talk to surface flinger anyhow).

Bug: 19029490
Change-Id: I6222edcab8e394e5fb6adf7a982be446e4505a1e
2015-04-10 20:26:51 -07:00
Jesse Hall 5b20fd0882 am 28c03cca: am c2a5b469: am a527c07b: Merge "Fix mistake using width instead of height."
* commit '28c03cca9835957f6e304b18358243b184fa46f8':
  Fix mistake using width instead of height.
2015-03-24 21:20:24 +00:00
Christopher Ferris 0e7497957a Fix mistake using width instead of height.
Found by rodrigo.chiossi@intel.com.

Change-Id: I49d590ed39f6b47ba58a77a75d66b2964ea1cb1d
2015-03-23 14:37:26 -07:00
Dan Stoza 35283ef01b am 105aa28e: am b275b4dc: am 3949f664: Merge "SurfaceFlinger: Fix null pointer exception"
* commit '105aa28eeff9d31eebc7645aecb7630918a09b2a':
  SurfaceFlinger: Fix null pointer exception
2015-03-10 15:48:55 +00:00
Dan Stoza b275b4dc3e am 3949f664: Merge "SurfaceFlinger: Fix null pointer exception"
* commit '3949f664c71ad1269ee0c921d176e3b4484015cc':
  SurfaceFlinger: Fix null pointer exception
2015-03-09 18:05:26 +00:00
Dan Stoza 24a42e9f54 SurfaceFlinger: Fix null pointer exception
Fixes a null pointer exception in getActiveConfig

Bug: 19416124
Change-Id: I45a01f67affb63a348866ce42a6013c5eb71fe8f
2015-03-09 10:04:11 -07:00
Dan Stoza b90cf07f8b SurfaceFlinger: Add --static-screen stats
Adds a --static-screen option to dumpsys SurfaceFlinger, which
displays screen-on time broken down by the time between the prior
frame and the current frame. An example dump looks like this:

$ adb shell dumpsys SurfaceFlinger --static-screen
Static screen stats:
  < 1 frames: 12.235 s (3.5%)
  < 2 frames: 29.898 s (8.7%)
  < 3 frames: 15.370 s (4.4%)
  < 4 frames: 13.103 s (3.8%)
  < 5 frames: 15.780 s (4.6%)
  < 6 frames: 2.022 s (0.6%)
  < 7 frames: 0.201 s (0.1%)
  7+ frames: 256.887 s (74.4%)

The buckets are exclusive, so '< 3 frames' covers the interval
[2, 3) frames

Bug: 19543586
Change-Id: I3253a54c23995d25e96016997acedd0775956b60
2015-03-05 14:43:08 -08:00
Dan Stoza 22d0bdf326 resolved conflicts for merge of 1665c8e1 to lmp-mr1-dev-plus-aosp
Change-Id: I0be2ecb8085f2cd9560138460bcc27d71c011608
2015-01-27 11:49:26 -08:00
Dan Stoza 1665c8e101 Revert "SurfaceFlinger: Attempt to attribute fds to layers"
This reverts commit 03eccb6616.

Change-Id: I4f0da7bb62bf77bb3d399aee601beae5e03928fe
2015-01-27 11:03:50 -08:00
Dan Stoza a5cbb1f18b am ef1c17ae: SurfaceFlinger: Make log message 64-bit compatible
* commit 'ef1c17ae9417abc1e21e49dbc629e448efc947dc':
  SurfaceFlinger: Make log message 64-bit compatible
2015-01-17 00:50:53 +00:00
Dan Stoza 3372cc25df resolved conflicts for merge of 03eccb66 to lmp-mr1-dev-plus-aosp
Change-Id: I1f38cbe7019b2b48b1094dee154ad97c23fd22c2
2015-01-16 16:18:51 -08:00
Dan Stoza ef1c17ae94 SurfaceFlinger: Make log message 64-bit compatible
Fixes the build on 64-bit targets that complain about using a size_t
with a %d in a format string

Change-Id: I7dfcd3a49eb0dbc5dffeb82bb7208de7f7925f08
2015-01-16 15:58:13 -08:00
Dan Stoza 03eccb6616 SurfaceFlinger: Attempt to attribute fds to layers
This tracks fds when layers are created and destroyed in an effort to
determine which specific app (if any) is active when fds are leaked

Bug: 19017008
Change-Id: I1f1d5a9cbc1399e3df3a2d350324f80b3a4e3477
2015-01-16 15:02:22 -08:00
Jesse Hall 9c22ac77e4 am 5b730570: Merge "surfaceflinger: use Mutex timedLock instead of tryLock loop"
* commit '5b730570be2bd1f90346a5921d0b70dc11351396':
  surfaceflinger: use Mutex timedLock instead of tryLock loop
2015-01-12 23:41:46 +00:00
Jesse Hall fcd15b478c surfaceflinger: use Mutex timedLock instead of tryLock loop
Rather than trying to acquire the state lock without waiting three
times at 1 second intervals in SurfaceFlinger::dump(), just try to
acquire the lock once with a 1 second timeout. Avoids spurious mutex
acquire failures that lead to flaky
com.android.cts.jank.opengl.CtsHostJankOpenGl results.

Bug: 18842510
Change-Id: I00ce6109647de2aef8831dd2f8fa98652ba7f4e0
2015-01-10 15:41:01 -08:00
Dan Stoza db5827d314 am 5878444f: SurfaceFlinger: Listen to HWC invalidate
* commit '5878444fb8da043021f30d3de739531f15390df5':
  SurfaceFlinger: Listen to HWC invalidate
2014-12-03 20:43:29 +00:00
Dan Stoza 5878444fb8 SurfaceFlinger: Listen to HWC invalidate
"Do less work when using PTS" broke the invalidate path up from HWC
to SurfaceFlinger. When HWC would signal an invalidate, SurfaceFinger
would wake up, see no new buffers, and go back to sleep. This is fine,
except when the invalidate is a result of an HDMI hotplug, in which
case the screen remains blank. This change makes that functionality
work again.

Bug: 18564815
Bug: 18558468
Change-Id: I2e2171d86839945f4e4e6555d66f7e2895bd096a
2014-12-02 16:58:17 -08:00
Dan Stoza 686c5be472 am 6b9454d1: SurfaceFlinger: Do less work when using PTS
* commit '6b9454d1fee0347711af1746642aa7820b1ea04d':
  SurfaceFlinger: Do less work when using PTS
2014-11-18 02:07:36 +00:00
Dan Stoza 6b9454d1fe SurfaceFlinger: Do less work when using PTS
Currently, SurfaceFlinger is very dumb about how it handles buffer
updates at less than 60fps. If there is a new frame pending, but its
timestamp says not to present it until later SurfaceFlinger will wake
up every vsync until it is time to present it. Even worse, if
SurfaceFlinger has woken up but nothing has changed, it still goes
through the entire composition process.

This change (mostly) fixes that inefficiency. SurfaceFlinger will
still wake up every refresh period while there is a new frame
pending, but if there is no work to do, it will almost immediately go
back to sleep.

Bug: 18111837
Change-Id: I7825bacd37f40bf26edcc6a5e0f051dce45291fb
2014-11-17 21:32:13 +00:00
Marco Nelissen e12cfc23b2 am 55f71bc0: Merge "Replace IInterface::asBinder() with a static"
* commit '55f71bc0800b9ec7a779c5d30d5a90e074c2526b':
  Replace IInterface::asBinder() with a static
2014-11-17 18:52:56 +00:00
Marco Nelissen 097ca275f4 Replace IInterface::asBinder() with a static
so we can do NULL checks again, and update calls to IInterface::asBinder()
to use the new static version.

Change-Id: Ia7b10eb38ca55b72278bfd33d3bf647f338b4e6a
2014-11-17 08:47:01 -08:00
Andreas Gampe 4037c458a7 resolved conflicts for merge of 07dffa18 to lmp-mr1-dev-plus-aosp
Change-Id: I42d8bc291f4f48f3098754b076889159c4b20e41
2014-11-13 15:16:53 -08:00
Andreas Gampe 89fd4f7fa6 Frameworks/native: Wall Werror in surfaceflinger
Turn on -Wall -Werror in services/surfaceflinger. Fix warnings.

Change-Id: Ifef830300d9d4bc657d8f1257c02bfe8c2b4d9c5
2014-11-13 14:18:56 -08:00
Naseer Ahmed ff520bb938 am 7aa0c47e: sf: Add a NULL check in getDisplayConfigs
* commit '7aa0c47e4205c6fca136c38f272d911c25c8a8fa':
  sf: Add a NULL check in getDisplayConfigs
2014-11-03 22:31:50 +00:00
Naseer Ahmed 7aa0c47e42 sf: Add a NULL check in getDisplayConfigs
Validate the display binder by adding a NULL check in getDisplayConfigs.
This will prevent a false match if the caller queries the display
configs for an inactive display (whose binder is NULL by default).

Without this change we might end up attempting to index the display
config array, which is unpopulated for inactive displays, and this will
result in a crash. (See getDisplayInfo in SurfaceComposerClient.cpp for
an example of this scenario)

Change-Id: I1a12f43b7c375b9c01998dadd5b658275c733fb2
Acked-by: Tatenda Chipeperekwa <tatendac@codeaurora.org>
2014-11-03 12:16:18 -08:00
Jesse Hall 18b846dda7 am c7636f60: Merge "surfaceflinger: fix -Wsign-compare warnings" into lmp-mr1-dev
* commit 'c7636f606270a4b79d745ec1acf049daedfa0e2f':
  surfaceflinger: fix -Wsign-compare warnings
2014-10-31 22:57:43 +00:00
Jesse Hall 7844211607 surfaceflinger: fix -Wsign-compare warnings
warning: comparison of integers of different signs: 'int' and 'size_t'
(aka 'unsigned int') [-Wsign-compare]

arning: comparison of integers of different signs: 'int32_t' (aka
'int') and 'const uint32_t' (aka 'const unsigned int')
[-Wsign-compare]

Change-Id: I823257aa7218c5fd492a3277853210db539bb2e2
(cherry picked from f9bfdc6c94)
2014-10-31 09:52:23 -07:00
Dan Stoza d77021637e am 1f3efb11: Don\'t run large virtual displays through HWC
* commit '1f3efb11ff8c884a254f4272f0d1ee0b77ceff2f':
  Don't run large virtual displays through HWC
2014-10-30 20:58:42 +00:00
Dan Stoza 1f3efb11ff Don't run large virtual displays through HWC
This change watches for a MAX_VIRTUAL_DISPLAY_DIMENSION value, which
will be set (if necessary) in BoardConfig.mk. If the value is set,
any virtual displays that have a width or a height greater than that
dimension will bypass the hardware composer HAL and be handled only
by SurfaceFlinger.

Bug: 17701816
Change-Id: Ia6ca44dfd6a7a9bc0f054493d3f13006bc32fa14
2014-10-28 16:01:47 -07:00
Riley Andrews 0b91d7e277 am 131866e1: Merge "Add glFlush in surfaceflinger screenshot code." into lmp-mr1-dev
* commit '131866e1a4cb3c592f923e95a8c1a66291e2057a':
  Add glFlush in surfaceflinger screenshot code.
2014-10-24 18:39:16 +00:00
Riley Andrews 9707f4df64 Add glFlush in surfaceflinger screenshot code.
After creating a syncKHR object with type EGL_SYNC_NATIVE_FENCE_ANDROID,
glFlush must be called before the EGL_SYNC_NATIVE_FENCE_FD_ANDROID attribute
is populated with a sync fd. We currently call eglDupNativeFenceFDANDROID
before issuing the flush.

Bug 18052459
Taken verbatim from matthew.k.gumbel@intel.com.

Change-Id: I3781d14f92862076e2bca7d27341a6dc6e7e3775
2014-10-23 16:25:17 -07:00
Jesse Hall 11f2e08a66 am 8ad8c0a7: am afe2b1fa: surfaceflinger: don\'t close fence fds after passing to queueBuffer
* commit '8ad8c0a775a1d4592479731973238b82480f76b2':
  surfaceflinger: don't close fence fds after passing to queueBuffer
2014-10-22 21:27:11 +00:00
Jesse Hall afe2b1fadd surfaceflinger: don't close fence fds after passing to queueBuffer
ANativeWindow::queueBuffer takes ownership of the fence fd passed to
it, and will close it before returning. SurfaceFlinger's screenshot
code was also closing the syncFd it passed to queueBuffer. Most of the
time this meant the second close() silently failed, but in a rare race
condition the file descriptor could be reused between the two
close()s.

Bug: 17946343
Change-Id: Ib74fcb1dce52cc21328059c99b7c4c76f41aa3a5
2014-10-21 11:11:53 -07:00
Dan Albert 27b780b517 am 9cc84950: Merge "Don\'t check if this == NULL."
* commit '9cc849500df0bba42d3ed19b90c38ff1dffd2262':
  Don't check if this == NULL.
2014-10-15 22:52:51 +00:00
Dan Albert 759115cd6d am 9cc84950: Merge "Don\'t check if this == NULL."
* commit '9cc849500df0bba42d3ed19b90c38ff1dffd2262':
  Don't check if this == NULL.
2014-10-15 22:52:43 +00:00
Dan Albert 9cc849500d Merge "Don't check if this == NULL." 2014-10-15 22:45:07 +00:00
Michael Lentine 3f121fc650 When eglMakeCurrent fails we need to fix the egl state.
Bug: 16676660

Change-Id: Ie7bee9c78378b9e9206060444319e6ee35e1ab74
2014-10-01 14:50:58 -07:00
Lajos Molnar 67d8bd66aa surfaceflinger: add getDisplayStats() method
This is used by media service to schedule video frames at the
proper time, based on precise vsync timings.

Bug: 14659809
Change-Id: I1a90603f3dc09dca9aa4f90a3aa845fab56e0a5e
2014-09-18 17:03:20 -07:00
Dan Albert 1474f8864f Don't check if this == NULL.
Entering a method with this == NULL is undefined behavior. Clang whines
about this.

Change-Id: Ibde628395ca10dfef0d2f59e81280576f104b83c
2014-09-16 17:52:06 -07:00
Dan Albert 9e0e103b65 Silence warnings about unused parameters.
Change-Id: I503aafbdeaec3f53241872dc52af9f8b73a1416c
2014-09-09 16:53:59 -07:00