Commit Graph

238 Commits

Author SHA1 Message Date
Byunghun Jeon 987034b563 SurfaceFlinger: Native changes to add blur effect
Native changes to add blur-behind and blur mask effect

Change-Id: I54faf82d750e8299de6d261f6a893ab26d08df84

SurfaceFlinger: Adding template for LayerBlur files

Change-Id: I444009113b7bdd6c5284863fd1f56358e67d9fe6

SurfaceFlinger: Featurize libuiblur module for OSS build

Change-Id: Ifdc176e699434125d17b111c044b8ba954cf717c
2015-11-08 01:07:13 -08:00
Baldev Sahu dfab0ee254 SurfaceFlinger: Add support for MDP3
This change is porting of following commits related to MDP3

1) SurfaceFlinger: Change to support framebuffer flip for 2D blitters
- Surfaceflinger does not flip framebuffers when there are
  no layers marked for HWC_FRAMEBUFFER
- This change checks for the HWC_BLIT flag and will request a flip
  to a new FB_TARGET buffer even if there are no FRAMEBUFFER layers

  "Change-Id: I1cb44389a05c9ec049d7f0d39c288feccb11a91c"

2) SF: Avoid wormhole clear for BLIT calls
- Do not call GPU clear from SF when composition
  type is BLIT as it'll be taken care in HAL.

  "Change-Id: Ia613eb9b824c6484ecc8c8fa4ee883545d8541b8"

3) surfaceflinger: Allow gpu to render widevine level3
- Allow gpu to render widevine level3 but keep
  blocking screen shots.

  "Change-Id: I914232a062acbb7b17901dbf2b414973230e59d9"

Change-Id: I35eef9eb1597af21c195e07d5fe4c0c73ab3a269
2015-10-07 02:52:17 -07:00
Raj Kamal 20f9ced881 SurfaceFlinger: Add support for DisplayUtils
Add DisplayUtils class which uses the custom implementations
of ExLayer, ExSurfaceFlinger, ExHWComposer,
and ExVirtualDisplaySurface classes if needed

Change-Id: Ibdd8da5d3d0d602f42b76a15d0994c6aa98bee3f
2015-10-06 03:22:25 -06:00
Dan Stoza d87defaf48 SF: Allow present if sideband stream changed
Allows the sideband layer to be passed all the way to HWC instead of
getting blocked by the updated PTS tracking code.

Bug: 22291067
Change-Id: Ic2f20a7528e276fff054e86ca35789c26873b348
2015-07-29 16:15:50 -07:00
Dan Stoza 0eb2d39866 SF: Ignore PTS more than one second in the future
Some of this logic already existed, but when we optimized
SurfaceFlinger to avoid unnecessary wake-ups, we didn't carry the logic
over into the new readiness test. shouldPresentNow now returns true if
the timestamp is more than a second in the future (since it's likely a
bogus timestamp and should be ignored).

Bug: 21932760
Change-Id: Ib50970a4eb621588c0b60766c8d8d1a8bddf853b
2015-07-06 13:15:25 -07:00
Dan Stoza db4850c01f libgui: Fix handling of rotated surface damage
Incoming surface damage was not aware that the EGL implementation was
rotating buffers in response to SurfaceFlinger's transform hint. This
didn't affect all cases because the effect was to apply a 90 degree
rotation instead of a 270 degree rotation. For full-screen updates,
things more or less worked, but in other cases this caused corruption.

This fixes that by correctly undoing the effect of rotated buffers on
the incoming surface damage, and then passing that damage down
untouched to HWC.

Bug: 22068334
Change-Id: I226ecfc7a91fe2e16edd2aa6d9149f0d26b529d6
2015-06-25 16:10:18 -07:00
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
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 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
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
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
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 9e9b044554 SF: Always perform sideband transactions
On normal Layers, we defer applying resize transactions until a buffer
of the correct size arrives. This breaks with sideband streams, because
buffers are not seen by SurfaceFlinger. This change applies
transactions immediately for Layers which have a sideband stream
attached to avoid that problem.

Bug: 20428254
Change-Id: I379d8aaef460d467cdf8432764b4a504928fb65a
(cherry picked from commit c300b8b506536e1bf94ffd8a3b75d46e776923e0)
2015-04-22 16:53:15 -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
Dan Stoza 11611f9be5 DO NOT MERGE SurfaceFlinger: Stop using IGBC::BufferItem
Switches all uses of IGraphicBufferConsumer::BufferItem (and
BufferQueue::BufferItem) to the BufferItem in libgui. Depends on
frameworks/native I699ed0a6837076867ca756b28d1ffb2238f7a0d9.

Cherry pick of I187b3a7d05196b6289596afac8fb9a9d4aebff76

Change-Id: I5bc79fb96b6cba6021af64b20890967aa3b7fcbf
2015-03-19 13:59:12 -07:00
Eino-Ville Talvala 82c6bcc970 DO NOT MERGE Add dataSpace to buffer queues; remove old format enums.
- Wire up new dataSpace parameter through buffer queue stack
- Update tests to include the parameter
- Switch eglApi to using dataSpace to indicate sRGB gamma/linear
  difference
- Remove RAW_SENSOR in favor of RAW16
- Remove use of sRGB format enums
- Add default dataspace to buffer queue core
- Add query for default dataspace

Cherry pick of I070bd2e7c56506055c419004c29e2e3feac725df

Change-Id: I461952389c18051176c6b75e664f20ad369f5760
2015-03-19 13:56:00 -07:00
Michael Lentine 1e6116621b am b947f29a: Merge "Add clamp to Layer and update Transform inverse." into lmp-mr1-dev
* commit 'b947f29a6af1622cda16d0b7112595082750dd07':
  Add clamp to Layer and update Transform inverse.
2014-11-25 18:44:51 +00:00
Michael Lentine 28ea217ff4 Add clamp to Layer and update Transform inverse.
Ensure that the adjusted transparent region is within
the display bounds by clamping after the transformation
is applied and clean up transform's inverse function.

Bug: 18452546

Change-Id: Ia473e483ee8374177bcb84d8192eb1f0e86f022a
2014-11-21 17:05:18 -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
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
Dan Stoza 8dc55396fc Add a BufferItem parameter to onFrameAvailable
Passes the BufferItem for the queued buffer to the onFrameAvailable
callback so the consumer can track the BufferQueue's contents. Also
adds an onFrameReplaced callback, which is necessary if the consumer
wants to do anything more than simple queue length tracking.

Bug: 18111837
Change-Id: If9d07229c9b586c668e5f99074e9b63b0468feb0
2014-11-07 10:39:13 -08:00
Michael Lentine 6c925ede62 Fixed discrepancy between crop and frame transparencies.
Bug: 17662777
Change-Id: I0d65d9b912a37a60e4c1d2e2e198f7709460917c
2014-10-03 19:02:30 +00:00
Jesse Hall 5bf786d8f0 surfaceflinger: recompute visibility after sideband stream change
We normally recompute layer visibility when a layer gets its first
buffer; before then it's treated as invisible. Sideband layers never
get a buffer (as far as SurfaceFlinger knows), so never became
visible. Now we also recompute visibility when a layer gets a new
sideband stream.

Bug: 17752511
Change-Id: I84e150f196eb2eb7bcd2616248e5e3fa73624809
2014-10-01 09:00:34 -07:00
Michael Lentine 7b90258c7b Fix inverse orientation when original is not applied first.
Change-Id: I6f1a11950c77c99800acbf08a672bc1b2310b0b5
2014-08-19 18:16:01 -07:00
Michael Lentine 1440963470 Fix camera orientation by swapping horizontal and vertical flips when needed.
Bug: 16637957

Change-Id: I66de597546fdc19e0af9e6150ca20460ab36bf8b
2014-08-19 16:16:35 -07:00
Michael Lentine f755140794 Incorporate TransformToDisplayInverse into the crop calculation.
Change-Id: Ia9757b3a43d3b8f99df9fef2ed4d11c43b5abdd2
2014-08-18 16:35:43 -07:00
Michael Lentine 5af281f4ab Fix HWComposer Surface Crop when surface is rotated
Bug: 15091149

Change-Id: I97ecd8af9636da9403fafdb3f9b846f95053ebb7
2014-08-07 13:44:14 -07: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
Ruben Brunk 1681d95989 Add sticky transform to surfaceflinger.
Bug: 15116722

- Adds a sticky transform field that can be set from a
  SurfaceFlinger client Surface.  This transform is
  added to any transform applied to the Surface.

Change-Id: Idaa4311dfd027b2d2b8ea5e2c6cba2da5779d753
2014-07-14 22:14:32 +00: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
Svetoslav cf8684b206 Merge "Adding render stats APIs to UiAutomation (framework native)." 2014-04-10 19:32:44 +00:00
Svetoslav d85084b2b6 Adding render stats APIs to UiAutomation (framework native).
bug:12927198

Change-Id: Ibb1c07f7d89e11281e5c1f27f412a29ac6f9c4ab
2014-04-10 12:32:19 -07:00
Wonsik Kim 4cd47b2e0e Merge "Fix sideband stream issues" 2014-04-10 00:35:24 +00:00
Dan Stoza b3d0bdf0db BufferQueue: Remove Bn version of create*
It turns out that there's no reason to have both I* and Bn* versions
of the createBufferQueue method, so I removed the Bn* version.

Change-Id: I66aeb09e10458ae540ddf1f38d2d0154ea8f315b
2014-04-07 17:00:26 -07:00
Wonsik Kim afe3081e0e Fix sideband stream issues
- Notify a listener when sideband stream is set
- Mark a layer as visible when sideband stream is set, even though
no buffer is queued.

Change-Id: I9652bf530f2b5ce331533ec1bb3b10a815ca191c
2014-04-07 15:59:22 +09:00
Dan Stoza b9b088375d Remove deprecated BufferQueue constructor
Bug: 13415624
Change-Id: I9fe15e45daa7351f1db34ee75bfee6f19cb347d3
2014-03-18 10:08:44 -07:00
Jesse Hall 399184a4cd Add sideband streams to BufferQueue and related classes
Sideband streams are essentially a device-specific buffer queue that
bypasses the BufferQueue system. They can be used for situations with
hard real-time requirements like high-quality TV and video playback
with A/V sync. A handle to the stream is provided by the source HAL,
and attached to a BufferQueue. The sink HAL can read buffers via the
stream handle rather than acquiring individual buffers from the
BufferQueue.

Change-Id: Ib3f262eddfc520f4bbe3d9b91753ed7dd09d3a9b
2014-03-11 12:23:14 -07:00
Dan Stoza c701401f8c Allow disabling layer rotation during screenshots
Add the ability to ignore layers' transformation matrices during
screenshot capture, which will allow the window manager to capture
unrotated images for recents during the device rotation animation.

Bug: 11805195
Change-Id: I854d87bc84ca06ef9a054a454af1c080ee66fbb8
2014-02-14 23:10:42 +00:00
Andy McFadden 4125a4ffaf Allow "opaque" flag to be updated
Moves the "opaque layer" from Layer to Layer::State.  This allows
it to be updated as part of a transaction.

Bug 12387406

Change-Id: I0a114ce6adf77cd12fb08f96e0691b76c475768d
2014-01-29 17:36:49 -08:00
Mathias Agopian c1c05de415 fix camera API 2.0 orientation
we add a flag to ANativeWindow::setBufferTransform that means
"apply the inverse rotation of the display this buffer is displayed
onto to".

Bug: 10804238
Change-Id: Id2447676271950463e8dbcef1b95935c5c3f32b2
2013-09-17 23:45:22 -07:00
Mathias Agopian ff2ed70fa3 color blindness enhancement
This is an attempt at improving the experience of
users with color vision impairement.

At this time this feature can only be enabled for
debugging:

  adb shell service call SurfaceFlinger 1014 i32 PARAM

  with PARAM:
   0 : disabled
   1 : protanomaly/protanopia simulation
   2 : deuteranomaly/deuteranopia simulation
   3 : tritanopia/tritanomaly simulation
  11, 12, 13: same as above w/ attempted correction/enhancement

The enhancement algorithm tries to spread the "error"
such that tones that would otherwise appear similar can be
distinguished.

Bug: 9465644

Change-Id: I860f7eed0cb81f54ef9cf24ad78155b6395ade48
2013-09-04 22:11:15 -07:00
Mathias Agopian 19733a3279 minor clean-up of the GLESRenderer
Change-Id: I978dea25b7687fbbbb283f09c24e115d9bad49a2
2013-08-28 18:13:56 -07:00
Mathias Agopian 4ceff3d5ef screenshot layers wouldn't work in some cases
specifically when the display size and the screenshot window
size didn't match, the buffer would be rejected.
We simply fix this by setting the scalling mode to
"SCALE_TO_WINDOW".

Bug: 9992306
Change-Id: Ib821767899af330bb70d3cbbfa7d41b02794a075
2013-08-21 15:25:50 -07:00
Mathias Agopian 0e8f1443b8 Fix a bug where non-cropped layer could be scaled incorrectly
If a layer is not cropped but its bounds are outside of the
viewport (i.e.: clipped), the crop rectangle passed to
hw composer would be invalid because it started invalid
in the first place (to indicate "no crop").

Bug: 10410944
Change-Id: I4ae4d49a1adef0be7fa4304ecf84b1a5b7d03fe0
2013-08-20 21:46:45 -07:00
Mathias Agopian 49457ac092 Encapsulate textures into their own Texture class
the main reason for doing this is so that we can have
access to informations about a texture (like its dimension)
close to where we generate and use shaders in ES 2.0.
Previously, there wasn't any way to get to a texture's size
from a RenderEngine implementation.

Bug: 8679321

Change-Id: I388b338a70d07e3e8177dde248710ea1e4c82dff
2013-08-16 16:29:02 -07:00
Jesse Hall e048a4374c Merge "Add support for EGL_KHR_gl_colorspace" into klp-dev 2013-08-15 23:17:49 +00:00
Mathias Agopian 5cdc8994a0 don't reallocate the mesh each time we use it
the Mesh object can be part of each Layer (at least currently).
also reworked the Mesh code a bit to make it easier to access
the vertex data.

Change-Id: I0490851ba898f0aa2e55b62958dcd8bdb535e98b
2013-08-13 20:51:23 -07:00
Mathias Agopian 3f84483382 SurfaceFlinger now uses GLES 2.x when available
Bug: 8679321

Change-Id: I2b152d01fb4e2de2ea9fe87f1ddbd6826d7520d7
2013-08-13 16:07:45 -07:00