Commit Graph

478 Commits

Author SHA1 Message Date
Dan Stoza f10c46ef85 Enable clang for libui/libgui/surfaceflinger
Enables clang and C++11 for libui/libgui/surfaceflinger, and
eliminates all compile-time warnings.

Change-Id: Ie237fdb5ae44f2bfcddaa884f9c65ec3f08ae50f
2014-11-11 14:28:22 -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 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
Riley Andrews c3ebe66b49 Add rotation to surfaceflingers screen cap.
+ This is needed so that activity manager does not
  have to do cpu side rotations when capturing recents
  thumbnails.

Change-Id: If998008e675ad01305db8399fd643cf4608b7025
2014-09-09 03:51:16 +00:00
Jesse Hall d4548dd027 am 514e30a9: am c3d1889e: Merge "surfaceflinger: skip composition for empty frames" into klp-modular-dev
* commit '514e30a96cefad109509ce01622fa7f82f3f318c':
  surfaceflinger: skip composition for empty frames
2014-08-20 20:02:02 +00:00
Jesse Hall 514e30a96c am c3d1889e: Merge "surfaceflinger: skip composition for empty frames" into klp-modular-dev
* commit 'c3d1889e508038efe240ed1974ed377a2e12835c':
  surfaceflinger: skip composition for empty frames
2014-08-20 19:52:40 +00:00
Jesse Hall b7a0549c98 surfaceflinger: skip composition for empty frames
By not committing the results of composition for empty frames, we
avoid spitting out series of black frames for virtual displays that
don't have visible layers. We still draw one black frame when going
from having layers to not having any. In particular, this avoids
having a series of empty frames due to re-compositing the primary
display in the period between creating the virtual display and adding
layers to it.

Bug: 16786752
Change-Id: I7e9b2ed2e407d8d49c7af736b447d4c6181b0ad8
2014-08-19 22:15:43 -07:00
Riley Andrews 866399093f Take advantage of sync points during screen cap.
Do not wait for the screen capture to complete within surface flinger,
instead pass a sync point back with the captured gralloc buffer.

Change-Id: I7137c0e0fc710688d1d61f189159418fb27ea263
2014-08-19 19:27:14 +00:00
Eric Penner a02e9484be Merge "SurfaceFlinger: Prevent deadlock by updating an atomic layer set." into lmp-dev 2014-07-29 21:36:00 +00:00
Eric Penner 51c59cd1e7 SurfaceFlinger: Prevent deadlock by updating an atomic layer set.
Bug: 12934849

Change-Id: I9dede7316f1e967de4140bd731ac810115ea302f
2014-07-30 19:05:38 -07:00
Michael Lentine 9ae79d869a Build fix for size_t on 64bit.
Change-Id: Ic16895b30d78ba8a635b709adbae31a590501b20
2014-07-30 16:42:12 -07:00
Michael Lentine 7306c670eb Add error for format and make sure setActiveConfig fails with an invalid mode.
Change-Id: Iacdb5cbad125787f96c64c88d432fc541c4cad1a
2014-07-30 14:36:25 -07:00
Michael Lentine 47e45405d1 Allow for resizing of Virtual Displays.
Modify SurfaceFlinger to use VirtualDisplaySurface in all cases when a virtual
display is used. Add functionality in VirtualDisplaySurface to resize the
buffers aquired in the QueueBufferOutput. Add transaction support in
SurfaceFlinger for resize. Add the modification of the size in DisplayDevice.

Change-Id: Iae7e3556dc06fd18d470adbbd76f7255f6e6dd6b
Tested: None
2014-07-30 14:36:25 -07:00
Michael Lentine 6c9e34a98a Modified SurfaceFlinger to implment setActiveConfig and getActiveConfig.
This can be used to change the current display mode of the device.

Change-Id: Icdc3fb58389b861dc77b68102083da6f7a96eccb
Tested: None
(cherry picked from commit 2651fa9463)
2014-07-29 16:56:30 +00:00
Riley Andrews 03414a1cfe Turn on support for async cursor update in surfaceflinger.
If available, surfaceflinger will use the hwc setCursorPositionAsync()
api to change the position of supported cursor layers outside of
the usual prepare/set loop.

Change-Id: Ib3fc5c0c390b3489ddbba202379840a1d2748917
2014-07-28 22:07:41 +00:00
Jesse Hall b154c42c39 Improve memory coherence management in screenshot code [DO NOT MERGE]
The existing code worked in practice, but wasn't quite correct in
theory and relied on implementation details of other code. It's still
somewhat unusual and subtle, but now is correct-in-theory (I believe)
and a little better documented.

Bug: 16044767
Change-Id: I22b01d6640f0b7beca7cbfc74981795a3218b064
(cherry picked from commit c61576794e)
2014-07-14 19:29:09 +00:00
Jesse Hall 24cd98eef8 Compile libsurfaceflinger with Clang and -std=c++11 [DO NOT MERGE]
This is necessary to use C11/C++11 stdlib atomics, which the next
change will do. This change also fixes a couple bits of syntax that
both GCC and Clang refuse to compile in -std=c++11 mode.

Change-Id: Ia14d9d6b537a3bb106c23e19a277e48be180754c
2014-07-14 12:18:00 -07:00
Dan Stoza eac96b9bfd Merge "SurfaceFlinger: Fix rect out-of-bounds checks" 2014-06-17 21:43:29 +00:00
Andy McFadden 91b2ca8562 Add two new display info fields
This adds SurfaceFlinger's app VSYNC offset and buffer deadline
values to DisplayInfo.

Bug 14612039

Change-Id: Ie0ab21d388fe2764f2b6f71bd1cefa33dc861a73
2014-06-17 10:41:46 -07:00
Dan Stoza be31f44798 SurfaceFlinger: Fix rect out-of-bounds checks
Rects' right and bottom edges are treated as exclusive, so when
checking against maximum width and height, we should use > instead
of >=.

Change-Id: Ifcdf6813c13fcab1a55f16c21064e765e93d49f0
2014-06-11 11:20:54 -07:00
Wengang Wu 20071e5028 am e3d37a7b: Enable support RGBX_8888 for omap3
* commit 'e3d37a7b55f86f5d005dd67f828dcf51fe60c0f6':
  Enable support RGBX_8888 for omap3
2014-06-11 18:17:19 +00:00
Wengang Wu e3d37a7b55 Enable support RGBX_8888 for omap3
Bug: 14995811
Change-Id: Iaeb5a5ad0e3bcf215613f24f2570ae0d8267c016
2014-06-11 11:13:40 -07:00
Prashant Malani 7227b96a73 Merge "surfaceflinger: Replace blank/unblank with setPowerMode" 2014-06-12 03:30:50 +00:00
Wengang Wu 1210f2ab82 am 20071e50: am e3d37a7b: Enable support RGBX_8888 for omap3
* commit '20071e5028adb6d7ced81843d33e4d0baa0768ed':
  Enable support RGBX_8888 for omap3
2014-06-11 21:38:55 +00:00
Andy McFadden 645b1f7ffb Replace "lower power mode" experiment
This replaces the previous low-power mode experiment, which
discarded refresh events, with a new experiment that alters
the refresh period.

(see also I2849e5ea335c0d2509fea1c315392bce7f20451d )

The feature is enabled by specifying a nonzero value for the
"refresh skip count", which indicates the number of periods
to skip.  For example, the command:

  adb shell service call SurfaceFlinger 1016 i32 1

sets a skip count of '1', yielding a 30Hz refresh rate on a device
with a 60Hz display.  Changing the last value to '2' would set the
refresh to 20Hz.  '0' returns to the default behavior.

Bug 15523257

Change-Id: I00039c22a55750e74035644c63800e4bee1c774a
2014-06-11 10:19:08 -07:00
Andy McFadden 5167ec68fe Disable DispSync resync when not needed
If app and SF events aren't using phase offsets, we don't need
to maintain the DispSync model.  We just turn hardware VSYNC on
whenever something wants to draw.  This avoids some edge cases
where we were doing too much resync work.

Also, updated the systrace output.  The "VsyncOn" line was a
combination of SF and app event threads, and would occasionally
be very weird.  Removed VsyncOn, renamed VSYNC to VSYNC-app,
and added VSYNC-sf.

Also, added more details to the --dispsync dumpsys output.

Also, renamed global constants to not look like local variables.

Bug 15516453

Change-Id: I0da10b72f0d9a7b7eb5202d87cc18967f698adbd
2014-06-10 13:12:19 -07:00
Prashant Malani 2c9b11f029 surfaceflinger: Replace blank/unblank with setPowerMode
We replace the blank/unblank calls in surfaceFlinger with a more generic
setPowerMode() routine.

Some displays support different power modes (for example, with reduced
color palettes). Depending on the use case we should be able to toggle
these modes, so as to achieve incremental power savings.

Initially, three power modes will be supported:
- HWC_POWER_MODE_OFF
- HWC_POWER_MODE_DOZE
- HWC_POWER_MODE_NORMAL

HWC_POWER_MODE_OFF will correspond to blanking the display, while
HWC_POWER_MODE_NORMAL will correspond to unblanking. HWC_POWER_MODE_DOZE
will put the display into a low power setting, if it is supported in
hardware.

If such a low power mode is not supported, it should be treated as a
call to set the mode to HWC_POWER_MODE_NORMAL.

As a consequence of adding the mPowerMode field, the mScreenAcquired is
no longer required, and thus references to it are removed and replaced
equivalent references to mPowerMode.

We also add the glue code to connect the services invocation of setting
a power mode and the HAL implementation in HWComposer.

Bug: 13472578
Change-Id: I431595ecf16d2f2c94259272db3dd42f29636204
Signed-off-by: Prashant Malani <pmalani@google.com>
2014-06-05 16:35:52 -07:00
Dan Stoza c18790018b SurfaceFlinger: Add sourceCrop to screenshot
Adds a sourceCrop Rect parameter to screenshot commands, which allows
clients to capture only a portion of the screen instead of the whole
screen.

Bug: 15137922
Change-Id: I629447573cd34ffb96334cde7ba02490b9ea06d8
2014-05-23 09:19:03 -07:00
Andy McFadden 39cde06aee am b6601961: Merge "DO NOT MERGE Add "dumpsys SurfaceFlinger --dispsync"" into klp-modular-dev
* commit 'b66019615da8750588f1233a77b9c686b0a248c3':
  DO NOT MERGE Add "dumpsys SurfaceFlinger --dispsync"
2014-05-09 17:57:12 +00:00
Andy McFadden a7f75c0dfb Merge "Add "dumpsys SurfaceFlinger --dispsync"" 2014-05-09 17:49:33 +00:00
Andy McFadden 232f5bc675 DO NOT MERGE Add "dumpsys SurfaceFlinger --dispsync"
Dumps the current DispSync state.

Bug 14651879

(this is a near-cherrypick of Ide4e6dbd58b117bc1a6b97b57d10cd92ec86dc84)

Change-Id: I6e6c8452ede5c2d5098db1b884d28226e77d9a03
2014-05-09 10:49:11 -07:00
Andy McFadden c751e92c56 Add "dumpsys SurfaceFlinger --dispsync"
Dumps the current DispSync state.

Bug 14651879

Change-Id: Ide4e6dbd58b117bc1a6b97b57d10cd92ec86dc84
2014-05-08 16:14:41 -07:00
Dan Stoza dd02391756 Merge "Enable changing display configuration" 2014-05-06 21:08:16 +00:00
Dan Stoza 7f7da32569 Enable changing display configuration
This allows querying and switching display device configurations
through the ISurfaceComposer/SurfaceComposerClient interface.

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

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

Feature added for the low power mode.

Change-Id: I2849e5ea335c0d2509fea1c315392bce7f20451d
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
2014-05-01 18:29:33 +00:00