Commit Graph

1600 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
Manoj Kumar AVM e04e4edcd1 sf: Fix incorrect state reporting in dumpsys
Dumpsys utility accesses layer compositionType variable
with out proper protection. These variables are modified
during hwc_prepare call. Existing HAL lock protection is not
sufficient to address this issue. Failure to do this will
result in incorrect state reporting in dumpsys.

A new displayLock mutex in HWComposer will be used in both
dumpsys and draw calls to ensure correct state is accessed.

Change-Id: I8a57de59525adc0e089b3bed95c067c01e42b666
(cherry picked from commit e54506b81a)
2015-06-12 09:48:07 -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
Aravind Akella 52720f4509 Merge "Use LOCATION_HARDWARE permission for data injection." into mnc-dev 2015-06-10 22:56:27 +00:00
Aravind Akella a8814ce478 Use LOCATION_HARDWARE permission for data injection.
Change-Id: Ie81cb0d5f537d5431f2127891cca1d39c969ee7b
2015-06-10 15:15:57 -07:00
Dan Stoza d177e044d1 Merge "SF: Swap w/h when capturing rotated screenshots" into mnc-dev 2015-06-10 17:28:33 +00:00
Michael Wright 043bd36b0d Merge "Only log dropped input when disabled for the first event." into mnc-dev 2015-06-10 17:08:03 +00:00
Michael Wright 3a98172289 Only log dropped input when disabled for the first event.
Bug: 19851495
Change-Id: I8cb8076723c1ca1732c3bc37f283d8eb48b7bee0
2015-06-10 15:26:13 +01: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 c6f30bdee1 libgui/SurfaceFlinger: Add getConsumerName
Adds a getConsumerName method to IGraphicBufferProducer and Surface.
Currently, the name is cached inside of IGBP and is update on connect
and dequeueBuffer, which should be good enough for most uses.

Bug: 6667401
Change-Id: I22c7881d778e495cf8276de7bbcd769e52429915
2015-06-08 09:40:49 -07:00
Dan Stoza 9d2c5a7c67 Merge "libgui: Add generation numbers to BufferQueue" into mnc-dev 2015-06-05 15:38:35 +00:00
Dan Stoza 17833a1b0d SF: Don't crop surface damage against viewport
Apply the display transform to surface damage, but don't intersect it
with the viewport.

Bug: 21486007
Change-Id: I94e697cea52096a960385d5f3b89609fdcf30a02
2015-06-04 19:41:06 -07:00
Dan Stoza 812ed0644f libgui: Add generation numbers to BufferQueue
This change allows producers to set a generation number on a
BufferQueue. This number will be embedded in any new GraphicBuffers
created in that BufferQueue, and attempts to attach buffers which have
a different generation number will fail.

It also plumbs the setGenerationNumber method through Surface, with the
additional effect that any buffers attached to the Surface after
setting a new generation number will automatically be updated with the
new number (as opposed to failing, as would happen on through IGBP).

Bug: 20923096
Change-Id: I32bf726b035f99c3e5834beaf76afb9f01adcbc2
2015-06-03 11:09:33 -07:00
Dan Stoza 9c64757f65 SF: Reduce resync samples without present
Reduces the number of resync samples that DispSync will attempt to
collect without an intervening present from 12 to 4. The former value
was causing excessive power draw for some vendors' implementations, and
reducing it doesn't seem to harm anything.

Bug: 20724456
Change-Id: Ifd6e0490be67756ed001d509a38e8a36953b4618
2015-05-29 13:00:23 -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 10613dc3b5 Add hotplug support for primary display.
When the primary is connected/disconnected on tv devices HWComposer updates
it's display parameters but doesn't destroy or recreate the display.

Bug: 18698244

Change-Id: I759c8f75d3e3a7462b85eb51973fb5072b71a702
2015-05-22 13:14:57 -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 4794879186 Merge "SurfaceFlinger: Handle EGL errors more cleanly" into mnc-dev 2015-05-14 17:42:21 +00:00
Dan Stoza 65476f3332 SurfaceFlinger: Handle EGL errors more cleanly
Adds some more safety checking for cases where we get an error while
trying to create the EGLImage. The checking puts the Layer into a
failed state after detecting an error, since the shadow queue may no
longer be synchronized.

Bug: 20957332
Change-Id: I68b4c40eab3e58731b875ed5752f2c7d17f14bcb
2015-05-14 09:48:19 -07:00
Michael Wright 7c000280a5 Merge changes from topic 'button_actions' into mnc-dev
* changes:
  Fix input tests to work with new MotionEvent member
  Revert "Revert "Add new MotionEvent actions for button press and release.""
2015-05-14 15:31:21 +00:00
Michael Wright 7b159c9a4f Revert "Revert "Add new MotionEvent actions for button press and release.""
This reverts commit 70b41ef580.
2015-05-14 14:48:03 +01:00
Michael Wright c921ce2681 Merge "Revert "Add new MotionEvent actions for button press and release."" into mnc-dev 2015-05-14 13:47:13 +00:00
Michael Wright 70b41ef580 Revert "Add new MotionEvent actions for button press and release."
This reverts commit 48a8a0e432.
2015-05-14 14:46:17 +01:00
Michael Wright f27e668104 Merge "Add new MotionEvent actions for button press and release." into mnc-dev 2015-05-14 13:31:25 +00:00
Michael Wright 48a8a0e432 Add new MotionEvent actions for button press and release.
Introduce ACTION_BUTTON_PRESS and ACTION_BUTTON_RELEASE as actions to
signal a button press or release. If these actions happen
simulanteously with a DOWN or UP event then they're explicitly
ordered to happen after the DOWN or preceding the UP in order to send
them to the most recently targeted view.

Also, introduce new stylus button constants that differ from the
constants we use for mouse buttons.

Bug: 20704355
Change-Id: Ib960a5004db5429ad2fc8db020704773e2978327
2015-05-14 13:25:41 +01:00
Michael Wright 4866f08718 Merge "Use previous pressure value if the current fusion data is zero." into mnc-dev 2015-05-13 16:56:07 +00:00
Michael Wright 4eed0f8f8d Merge "Synthesize events for pressure and button changes." into mnc-dev 2015-05-13 16:55:48 +00:00
Dan Stoza 09d561dbee Merge "Fix PTS handling for buffer replacement" into mnc-dev 2015-05-13 16:34:07 +00:00
Dan Stoza a4650a50a0 Fix PTS handling for buffer replacement
This changes the way that SurfaceFlinger's shadow buffer management
works such that instead of tracking the size of the shadow queue in the
BufferQueue, SF tracks the last frame number it has seen, and passes
that into the acquireBuffer call. BufferQueueConsumer then ensures that
it never returns a buffer newer than that frame number, even if that
means that it must return PRESENT_LATER for an otherwise valid buffer.

Change-Id: I3fcb45f683ed660c3f18a8b85ae1f8a962ba6f0e
2015-05-12 13:10:17 -07:00
Aravind Akella af8ed3f06c Merge "Improve logging in SensorService dump output." into mnc-dev 2015-05-12 19:12:43 +00:00
Aravind Akella 444f267572 Improve logging in SensorService dump output.
Maintain a per sensor circular buffer of last 10 sensor_events and the wall clock time
at which each event is received.

Change-Id: Ia50c825ab5a7aaf0932ce7dce7ac8b9be7071e77
2015-05-12 11:44:01 -07:00
Michael Wright 53dca3aadd Use previous pressure value if the current fusion data is zero.
Occasionally we'll receive the stylus up signal (pressure = 0) before
we receive the touch screen up signal. Rather than giving pointer a
pressure value of 0 (which is one of the signals of hovering) or
falling back to the touchscreen pressure values (which would make for
an inconsistent stream), use the previous pressure value which should
always be non-zero for a stream of fused data.

Bug: 20449776
Change-Id: I71eb97e7c4ea53e42b0eb54fc1f8ae7f89aad9d1
2015-05-12 14:17:42 +01:00
Michael Wright 43fd19fd1a Synthesize events for pressure and button changes.
Even when there isn't movement on the touchscreen we should produce
events for pressure and button state changes generated by external
stylii.

Change-Id: I9fd7ba85902d5d6bfb28d5e5ff5d8f340a94c2bf
2015-05-12 14:08:47 +01:00
Dan Stoza dc13c5b85b libgui: Hook up onFrameReplaced
This completes the plumbing from ConsumerListener::onFrameReplaced into
SurfaceFlinger (and other consumers that may care).

Change-Id: I376e78ace95d6748e8662e6b4d47c0dfa697a300
2015-05-11 15:33:01 -07:00
Aravind Akella be451b57b9 Merge "Fix the arguments to memcpy." into mnc-dev 2015-05-09 00:17:40 +00:00
Aravind Akella 08f04bf36c Fix the arguments to memcpy.
Change-Id: Ieaee26f46f43a9d412537047566178985370198b
2015-05-08 15:59:23 -07:00
Dan Stoza 98a13a1475 Merge "SF: Apply pending transactions to new sidebands" into mnc-dev 2015-05-08 16:32:27 +00:00
Ajay Dudani 4e3e30c2d5 surfaceflinger: Fix range check for getFormat
Fix potential buffer overflow error in getFormat with indices
greater than MAX_HWC_DISPLAYS.

Change-Id: I5e5b69d8d043e900f5e33ca9a62e94ae5f857b68
2015-05-07 13:23:32 -07:00
Dan Stoza 12e0a27aa3 SF: Apply pending transactions to new sidebands
When a Layer's sideband stream is set, apply any pending transactions.
Otherwise they would never be applied since sideband streams don't
trigger updates by pushing new buffers.

Bug: 20125898
Change-Id: I0c7a91cdf84e6205801f4ab64eee0b09e4c0b3e0
(cherry picked from commit 3b04e1383eca6cb1d43ebe23a421c427007690c7)
2015-05-05 16:05:32 -07:00
Sasha Levitskiy b0474e78df SensorServiceTest: Fix build, warnings.
Change-Id: I3ed5247d3eb6c43d185049cf9011c2ee01b5662e
Signed-off-by: Sasha Levitskiy <sanek@google.com>
2015-05-02 21:03:44 -07:00
Svetoslav c28fe8f5c5 Merge "Add body sensors app op - framework native" into mnc-dev 2015-05-01 23:10:56 +00:00
Svetoslav b412f6e203 Add body sensors app op - framework native
Change-Id: I727a2bb1e28ae9158f2df9c74dd0aee977dfd47f
2015-05-01 13:51:45 -07:00
Dan Stoza ecc504043f SurfaceFlinger: Fix PTS on stale buffers
SurfaceFlinger's (Layer's) shadow copy of the BufferQueue queue was
getting out of sync for a few reasons. This change fixes these by
doing the following:

- Adds a check to re-synchronize the shadow copy every time we
  successfully acquire a buffer by first dropping stale buffers before
  removing the current buffer.
- Avoids trying to perform updates for buffers which have been rejected
  (for incorrect dimensions) by SurfaceFlinger.
- Adds IGraphicBufferConsumer::setShadowQueueSize, which allows the
  consumer to notify the BufferQueue that it is maintaining a shadow
  copy of the queue and prevents it from dropping so many buffers
  during acquireBuffer that it ends up returning a buffer for which the
  consumer has not yet received an onFrameAvailable call.

Bug: 20096136
Change-Id: I78d0738428005fc19b3be85cc8f1db498043612f
(cherry picked from commit 2e36f2283f)
2015-05-01 12:23:44 -07:00
Dan Stoza 7b2fc93007 Merge "SurfaceFlinger: Limit to 4k Layers" into mnc-dev 2015-04-30 22:12:46 +00: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 aa4041f70a SurfaceFlinger: Fix integer overflow in Mesh ctor
Performs range checking on the inputs to Mesh::Mesh() before allocating
the storage array.

Bug: 20674682
Change-Id: I4fc918a8c312d967dd6d9f91a098b2e0a7081027
(cherry picked from commit ab79e33ef3)
2015-04-30 14:57:41 -07:00
Alan Viverette 3acd9f1d8f Remove gamma correction from color correction shader
Gamma correction was incorrectly skewing both color inversion and
Daltonization, which resulted in washed-out colors.

Bug: 20346301
Change-Id: I34d879f902c3be115b2d23f09c3ed3902799759e
2015-04-28 17:15:57 -07:00
Aravind Akella cc60dc2128 Merge "Enable data injection mode in SensorService." 2015-04-25 01:40:35 +00:00
Dan Stoza 6febf6c150 am 5d10894c: am ef47c080: am 958f5011: Merge "libgui: Allow an IGBProducer to disable allocation"
* commit '5d10894c9d547449cf231f02b736da9dfdebec11':
  libgui: Allow an IGBProducer to disable allocation
2015-04-24 16:33:38 +00:00
Dan Stoza 5d10894c9d am ef47c080: am 958f5011: Merge "libgui: Allow an IGBProducer to disable allocation"
* commit 'ef47c080fd0e7fb8bf1fc4b0ecadae277a22f2cf':
  libgui: Allow an IGBProducer to disable allocation
2015-04-24 16:12:30 +00:00