Commit Graph

3091 Commits

Author SHA1 Message Date
Christopher Tate dc3d6af97d am bb686c25: Disregard alleged binder entities beyond parcel bounds
* commit 'bb686c25b214edadd1830abd056db2d570d716ff':
  Disregard alleged binder entities beyond parcel bounds
2015-07-02 01:31:09 +00:00
Christopher Tate eba7afcc14 am 2f340be3: Disregard alleged binder entities beyond parcel bounds
* commit '2f340be345612d9fc2ecb1ea2a4c9e147610a593':
  Disregard alleged binder entities beyond parcel bounds
2015-07-02 01:28:56 +00:00
Amith Dsouza bbd4f23247 Merge "Revert "Revert "Modify EGL to disconnect the window when the surface gets destroyed.""" into mnc-dev 2015-07-01 17:45:05 +00:00
Aravind Akella 8719e3b631 Merge "Enable sensor data injection mode through adb." into mnc-dev 2015-07-01 17:40:08 +00:00
Amith Dsouza 4f21a4cc22 Revert "Revert "Modify EGL to disconnect the window when the surface gets destroyed.""
This reverts commit 6e1a2fea67.

Driver level issues fixed by an updated graphics driver.

Bug: 21266976
Change-Id: I93339fb6c6bab988f3550adb49ef8e70cda6473e
2015-07-01 10:22:22 -07:00
Aravind Akella 841a5926fc Enable sensor data injection mode through adb.
Change-Id: I415cf8ff0871fa74babaf9b879c68f210298b472
2015-06-30 14:59:58 -07:00
Chad Brubaker e59cb43eda Fix writeByteArray/writeInt32Array size on x64
writeByteArray writes the size using sizeof(size_t), however it is always
read using readInt32(). On devices where sizeof(size_t) != 4 this causes
extra bytes to be written.

BUG: 22204736
Change-Id: I8d4507b6b616857ef5827f1fe9da0907d09abf0e
2015-06-30 14:50:09 -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
Christopher Tate bb686c25b2 Disregard alleged binder entities beyond parcel bounds
When appending one parcel's contents to another, ignore binder
objects within the source Parcel that appear to lie beyond the
formal bounds of that Parcel's data buffer.

Bug 17312693

Change-Id: If592a260f3fcd9a56fc160e7feb2c8b44c73f514
(cherry picked from commit 27182be9f2)
2015-06-24 20:46:58 +00:00
Christopher Tate 2f340be345 Disregard alleged binder entities beyond parcel bounds
When appending one parcel's contents to another, ignore binder
objects within the source Parcel that appear to lie beyond the
formal bounds of that Parcel's data buffer.

Bug 17312693

Change-Id: If592a260f3fcd9a56fc160e7feb2c8b44c73f514
(cherry picked from commit 27182be9f2)
2015-06-24 20:46:38 +00:00
Christopher Tate 1b8a2f82fe Disregard alleged binder entities beyond parcel bounds
When appending one parcel's contents to another, ignore binder
objects within the source Parcel that appear to lie beyond the
formal bounds of that Parcel's data buffer.

Bug 17312693

Change-Id: If592a260f3fcd9a56fc160e7feb2c8b44c73f514
(cherry picked from commit 27182be9f2)
2015-06-24 20:46:05 +00: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 6cd8771c9c Merge "GLConsumer: Fix crop math" into mnc-dev 2015-06-11 17:12:49 +00:00
Dan Stoza ec4cb38750 GLConsumer: Fix crop math
When we have excess pixels that need to be removed from (for example)
the left and right sides, we currently do something like:

  left += excess / 2;
  right -= excess / 2;

If excess is odd, however, this removes 1 too few pixels since the odd
pixel gets rounded down twice. This changes the math to effectively:

  left += excess / 2;
  right -= (excess - excess / 2);

Which removes the correct total number of pixels.

Bug: 19611086
Change-Id: I8d1ad9fe7ba67c149794c148663d12acbccccef0
2015-06-10 10:24:51 -07:00
Christopher Tate ed7a50cc7d Prevent integer overflow when calculating buffer resizes
Make sure that we don't go haywire if an exponential buffer growth
operation winds up wrapping integer range.  Along the way, fix a
bookkeeping bug in BufferedTextOutput that would cause it to keep
spuriously realloc()ing on every append().

Bug 20674694

Change-Id: Ia845b7de36b90672a151a918ffc26c7da68e20a2
2015-06-08 14:49:09 -07:00
Christopher Tate 98e67d352b Don't corrupt parcel when writeFileDescriptor() fails
We now check for fd-legality before committing binder objects to
the flattened data buffer rather than after.  Previously we would
wind up corrupting the parcel and incurring driver-level errors,
as well as potentially leaking FDs.

Bug 21428802

Change-Id: Ice0d641b3dcc41fb1b8c68ce2e2ebd744c2863a1
2015-06-08 13:13:19 -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 5b36ea44c5 Merge "Revert "libgui: Add getConsumerName"" into mnc-dev 2015-06-08 16:30:15 +00:00
Dan Stoza a2ca9bf0a9 Revert "libgui: Add getConsumerName"
This reverts commit 107fbe5599.

Change-Id: I0c2b0f7c81193b05eb3dd2f5a59f83598434b744
2015-06-08 16:30:08 +00:00
Dan Stoza 5b23b5bf45 Merge "libgui: Add getConsumerName" into mnc-dev 2015-06-08 16:21:03 +00:00
Jeff Brown 13b1604018 Enable more flexible usage of blobs in parcels.
Add functions to allow a client to take over the ashmem region
that was transferred so that it can claim it for its own and
reuse it.

Add support for mutable ashmem regions too.

Bug: 21428802
Change-Id: I16eca338cdb99b07d81fc43573d53ce86dbc60c8
2015-06-05 17:40:59 -07:00
Dan Stoza 107fbe5599 libgui: Add getConsumerName
Adds a getConsumerName method to IGraphicBufferProducer and Surface.
Currently, the name is cached inside of IGBP and is updated on connect
and dequeueBuffer, which should be good enough for most uses.

Bug: 6667401
Change-Id: Ife94bd89023fe7c00bad916932b9a19233fd2290
2015-06-05 15:01:58 -07:00
Dan Stoza 9d2c5a7c67 Merge "libgui: Add generation numbers to BufferQueue" into mnc-dev 2015-06-05 15:38:35 +00:00
Tim Kilbourn 9e6d2ee030 DO NOT MERGE Remove unused ParcelFileDescriptor methods in parcel.
Attempts to replicate Java parceling in native code is fraught with
peril.

Change-Id: I4359036c5dddd1b886d886beef1d060523e53e5f
(cherry picked from commit f47a381001)
2015-06-04 21:36:21 +00: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
Ruben Brunk 7e5bb3701a Merge "Track camera and flashlight usage in battery stats." into mnc-dev 2015-06-02 01:48:25 +00:00
Christopher Tate 5a31f1abf6 Merge "Disregard alleged binder entities beyond parcel bounds" into mnc-dev 2015-06-02 01:05:47 +00:00
Ruben Brunk d47da60836 Track camera and flashlight usage in battery stats.
Bug: 15986092

Change-Id: I272ec070113a0bfc41c637c45a6e1a2ab346e87b
2015-06-01 16:55:07 -07:00
Dan Stoza 6a04e5fcf6 libgui: Propagate error by clearing sp<GB>
Clears the sp<GraphicBuffer> returned by createGraphicBuffer when there
is an error during unflattening.

Bug: 21498231
Change-Id: I886da4474fc06853cc59188d62044b7d7549126b
2015-06-01 13:59:15 -07:00
Dan Stoza da5a3f40a7 Merge "libui: Apply GRALLOC_USAGE_ALLOC_MASK during alloc" into mnc-dev 2015-06-01 16:30:35 +00:00
Michael Lentine 04b00cea67 Fix libgui crop matrix test.
On devices that have the crop image extension the crop is not applied to the
transform matrix so we have to expect different results in this case.

Change-Id: If62dec1111fb77c9fa2c4332d121665960ce0216
2015-05-29 16:26:36 -07:00
Dan Stoza b8efdc4003 libui: Apply GRALLOC_USAGE_ALLOC_MASK during alloc
Applies GRALLOC_USAGE_ALLOC_MASK to the incoming usage bits before
calling alloc on the gralloc module. This filters out the new flag
GRALLOC_USAGE_FOREIGN_BUFFERS, which is used to send a hint to the
producer, but which does not affect the allocation of buffers.

Bug: 19801661
Change-Id: Ia37a3eddba2e97598e50ac3e10877430adfa9247
2015-05-29 19:52:43 +00:00
Michael Lentine 6e1a2fea67 Revert "Modify EGL to disconnect the window when the surface gets destroyed."
This reverts commit 00699fa641.
2015-05-28 16:48:08 -07:00
Adam Lesinski d2fb7a6e49 am 8728c390: am 2c4f5fde: am 861c3f56: am 9004e7f5: am 4ff0cb44: Verify that the native handle was created
* commit '8728c390476110857dd6b290dac3bfdf13b33e81':
  Verify that the native handle was created
2015-05-28 22:30:05 +00:00
Adam Lesinski 8728c39047 am 2c4f5fde: am 861c3f56: am 9004e7f5: am 4ff0cb44: Verify that the native handle was created
* commit '2c4f5fdeca8e7a6f672bbcb8c25e6b81bf4eaa5b':
  Verify that the native handle was created
2015-05-28 21:44:36 +00:00
Adam Lesinski 2c4f5fdeca am 861c3f56: am 9004e7f5: am 4ff0cb44: Verify that the native handle was created
* commit '861c3f56157813627467054f488ecff7d339f2b0':
  Verify that the native handle was created
2015-05-28 21:11:44 +00:00
Adam Lesinski 861c3f5615 am 9004e7f5: am 4ff0cb44: Verify that the native handle was created
* commit '9004e7f5516c5b4a1b4178fa6a8bb4b3ca4ddcd0':
  Verify that the native handle was created
2015-05-28 20:40:46 +00:00
Adam Lesinski 9004e7f551 am 4ff0cb44: Verify that the native handle was created
* commit '4ff0cb4404db31576cd8a81ca5ef3b044d492904':
  Verify that the native handle was created
2015-05-28 20:26:02 +00:00
Christopher Tate 27182be9f2 Disregard alleged binder entities beyond parcel bounds
When appending one parcel's contents to another, ignore binder
objects within the source Parcel that appear to lie beyond the
formal bounds of that Parcel's data buffer.

Bug 17312693

Change-Id: If592a260f3fcd9a56fc160e7feb2c8b44c73f514
2015-05-27 19:20:15 -07:00
Dan Stoza 0e65e6c283 libgui: Fix surface damage on rotated buffers
Flips the width and height when the buffer comes in with a 90 degree
rotation so that performing the Y-flip from GL works correctly.

Bug: 20761426
Change-Id: I41c9edc8549c6cbdb534277b996ff20c59034582
2015-05-26 13:22:27 -07:00
Michael Lentine 01f9e920b0 Merge "Fix libgui tests." into mnc-dev 2015-05-22 20:16:01 +00:00
Michael Lentine d8ead0ccd4 Fix libgui tests.
Update IGraphicsBufferProducerTest to the new maximum enum value which is now
NATIVE_WINDOW_BUFFER_AGE. Update SurfaceTextureGLToGL_test to use the correct
counts for GraphicsBuffer refs.

Buf: 18138368

Change-Id: Ie2f7e00b414d63100b16944e3ab36b1ffceecd57
2015-05-22 13:14:57 -07:00
Chong Zhang 041b945e07 Merge "fix BufferItem flatten/unflatten alignment" into mnc-dev 2015-05-22 19:04:05 +00:00
Chong Zhang 47f674dfec fix BufferItem flatten/unflatten alignment
bug: 21370100
Change-Id: Ia3991dc591c176bdbd1d78d1804aa22777525b62
2015-05-22 10:54:25 -07:00
Michael Lentine 699a32bcdf Merge "Refactor ConsumerBase and it's derived classes." into mnc-dev 2015-05-18 21:29:39 +00:00
Michael Lentine 847f11e215 Refactor ConsumerBase and it's derived classes.
Move setDefaultBufferSize, setDefaultBufferFormat, and
setDefaultBufferDataSpace into ConsumerBase and remove them from
CpuConsumer and BufferItemConsumer.

Bug: 19977701

Change-Id: Ic68992464c5da6da7a41c4063a53029a69efcd1b
2015-05-18 14:29:18 -07:00
John Reck 3db36803b2 Merge "Add ConsumerBase::isAbandoned" into mnc-dev 2015-05-14 23:27:46 +00:00
John Reck e478305181 Add ConsumerBase::isAbandoned
Bug: 20105644
Change-Id: I21526b5397ea51a15500c44a99daa9d75fc4ea67
2015-05-14 15:55:11 -07:00
Michael Lentine 51c8c502f6 Merge "Modify EGL to disconnect the window when the surface gets destroyed." into mnc-dev 2015-05-14 16:39:28 +00: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 b03f103fd4 Fix input tests to work with new MotionEvent member
Change-Id: I0dde0f91f693903f26edc116b5dbcbf33bac2b93
2015-05-14 16:29:13 +01: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 Lentine 00699fa641 Modify EGL to disconnect the window when the surface gets destroyed.
Bug: 14445579

Change-Id: I1d263ff6cffcb6e448761fca7ca4b06466ad65aa
2015-05-13 15:41:41 -07:00
Adam Lesinski 4ff0cb4404 Verify that the native handle was created
The inputs to native_handle_create can cause an overflowed allocation,
so check the return value of native_handle_create before accessing
the memory it returns.

Bug:19334482
Change-Id: I1f489382776c2a1390793a79dc27ea17baa9b2a2
(cherry picked from commit eaac99a717)
2015-05-13 17:16:00 +00:00
Dan Stoza 09d561dbee Merge "Fix PTS handling for buffer replacement" into mnc-dev 2015-05-13 16:34:07 +00:00
Adam Lesinski 4b4820db4b Merge "Verify that the native handle was created" into mnc-dev 2015-05-13 03:38:36 +00:00
Adam Lesinski eaac99a717 Verify that the native handle was created
The inputs to native_handle_create can cause an overflowed allocation,
so check the return value of native_handle_create before accessing
the memory it returns.

Bug:19334482
Change-Id: I1f489382776c2a1390793a79dc27ea17baa9b2a2
2015-05-12 17:35:48 -07:00
Dan Stoza 2b83cc920a libgui: Always allow allocation on connect
This change places BufferQueue into a predictable state where
allocation is allowed whenever a producer connects. This allows clients
to disconnect and reconnect without having to worry about being locked
out of allocation.

Bug: 20554276
Change-Id: Ic0f920a3d4204f2cafdfa69e46f3bb4204571d7e
2015-05-12 14:55:15 -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 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
Dan Stoza 79e287890d Merge "libgui: Clear frame number while freeing slot" into mnc-dev 2015-05-04 16:33:47 +00:00
Dan Stoza 52937cd9a5 libgui: Clear frame number while freeing slot
Clears the frame number of a slot when it is freed, since it is used
to determine if a released buffer is stale.

Bug: 20445852
Change-Id: I02415e7b25a1eafe7414d6eb1cedf62ac5543cd9
2015-05-01 16:42:55 -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
Taiju Tsuiki 4d0cd3f524 Close Fence FDs in error cases of Surface and GraphicBufferMapper
Surface::{cancel,queue}Buffer and GraphicBufferMapper::lockAsyncYCbCr take the
ownership of |fenceFd|s. Though they don't close it on error cases.

Change-Id: I49a7ce8837d5c510c4ac4ad4649f310d18610e80
(cherry picked from commit c7263fb432)
2015-04-30 14:50:17 -07:00
Taiju Tsuiki 84f1d9c288 Avoid closing invalid FD in Surface and GraphicBufferMapper
GraphicBufferMapper::lockAsync{,YCbCr} close the fence FD even when the FD
is invalid.

Change-Id: Ia2b4dae3b2c06426e34f623f19ba92435f486ab7
(cherry picked from commit dcfe91e1f3)
2015-04-30 09:58:31 -07:00
Svet Ganov 7a6c586161 Merge "Respect the record audio app op - frameworks native" into mnc-dev 2015-04-29 19:34:18 +00:00
Nick Kralevich e9881a3961 Parcel.cpp: use calloc instead of malloc
(cherrypicked from commit 6329f0199e)

Bug: 20669363
Change-Id: Ia4c8d8ca9d8b4b87954d7267e8b1c94cf4e570e1
2015-04-28 21:31:20 -07:00
Svet Ganov f1377f506c Respect the record audio app op - frameworks native
Change-Id: Id747767377953fd644a538aad3f603d6c50875a2
2015-04-28 16:33:28 -07:00
Dan Stoza 800b41ab84 libgui: Fix buffer age on 64-bit targets
Changes a %llu to a PRIu64 to fix compilation on 64-bit targets.

Change-Id: I8ba982662dbe8ee2e1e47c4f6ce4bbdbe2020960
2015-04-28 14:20:04 -07:00
Dan Stoza 4afd8b67f9 BufferQueue: Add NATIVE_WINDOW_BUFFER_AGE query
Adds a NATIVE_WINDOW_BUFFER_AGE query, which returns the age of the
contents of the most recently dequeued buffer as the number of frames
that have elapsed since it was last queued.

Change-Id: Ib6fd62945cb62d1e60133a65beee510363218a23
(cherry picked from commit 49f810c72df8d1d64128e376757079825c8decd4)
2015-04-28 13:46:49 -07:00
Dan Stoza 80640fca04 libgui: Implement onTransact for sideband streams
Implements the GET_SIDEBAND_STREAM case of
IGraphicBufferConsumer::onTransact

Change-Id: I46138b87ce2d70dde48b3561dcd378ce5fd8f383
(cherry picked from commit 17166698d9)
2015-04-28 13:29:19 -07:00
Dan Stoza d9c4971da2 libgui: Change detachNextBuffer to return sp<GB>
Changes Surface::detachNextBuffer to return an sp<GraphicBuffer>
instead of an ANativeWindowBuffer* to ensure that reference counting
works correctly.

Bug: 20092217
Change-Id: I3979ea6121aaf14845f0554477b778770413581e
(cherry picked from commit 8b2daa3ca29492b181fb67840640d771c4a2b3ac)
2015-04-27 11:45:58 -07:00
Aravind Akella 63a0f42823 Build fix SensorEventQueue.
Change-Id: I3e6ba031d42bd37067591771f378b7185169ab48
2015-04-24 20:30:09 -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 7536ef4f07 am 437fb850: am f96a7581: am fb6d43ff: Merge "libgui: Change BufferQueue to use free lists"
* commit '437fb850b0667be3e8655cb1ac6a8d491f59d045':
  libgui: Change BufferQueue to use free lists
2015-04-24 16:33:37 +00:00
Dan Stoza 958f501189 Merge "libgui: Allow an IGBProducer to disable allocation" 2015-04-24 15:50:10 +00:00
Dan Stoza fb6d43ff44 Merge "libgui: Change BufferQueue to use free lists" 2015-04-24 15:48:38 +00:00
Aravind Akella a9e6cc3870 Enable data injection mode in SensorService.
Change-Id: I0cd32a017235c31c54816e4a357ce3b988350ed6
2015-04-23 17:42:37 -07:00
Dan Stoza 8efa4fb370 am 65f68d5c: am fece8306: am 56f1f16c: Merge "libgui: Fix some bitrot/warnings in tests"
* commit '65f68d5cb4a758a8e6faac95817f70383748a9c0':
  libgui: Fix some bitrot/warnings in tests
2015-04-23 23:44:33 +00:00
Dan Stoza 1925bd9219 am 17df593e: am 9aae16a4: am 82e4d49b: Merge "libui/libgui: Fix errors in parceling"
* commit '17df593eb386940a26377d2db9fcb8a60e8badba':
  libui/libgui: Fix errors in parceling
2015-04-23 23:44:32 +00:00
Dan Stoza 56f1f16c7b Merge "libgui: Fix some bitrot/warnings in tests" 2015-04-23 22:56:37 +00:00
Dan Stoza 82e4d49b0e Merge "libui/libgui: Fix errors in parceling" 2015-04-23 22:51:01 +00:00
Dan Stoza 9de7293b0a libgui: Allow an IGBProducer to disable allocation
Adds a new method IGBP::allowAllocation, which controls whether
dequeueBuffer is permitted to allocate a new buffer. If allocation is
disallowed, dequeueBuffer will block or return an error as it
normally would (as controlled by *ControlledByApp).

If there are free buffers, but they are not of the correct dimensions,
format, or usage, they may be freed if a more suitable buffer is not
found first.

Bug: 19801715
Change-Id: I0d604958b78b2fd775c2547690301423f9a52165
2015-04-23 15:28:12 -07:00
Dan Stoza 0de7ea7529 libgui: Change BufferQueue to use free lists
BufferQueue used to choose free buffers by scanning through its array
of slots and picking one based on timestamp. This changes that
mechanism to use a pair of free lists: one with buffers attached and
one without. This makes it easier to choose either type of free slot
depending on the needs of the current operation.

Fixes an issue with the first version of this change, found in bugs
20482952, 20443314, and 20464549.

Bug: 13175420
Change-Id: I9b6e83cfe8f9b4329a976025cb8e291d51fb6d4a
2015-04-23 13:25:11 -07:00
Dan Stoza 83e9f6e75e am 41422980: am d2c12e4c: am 7637e35d: Merge "Revert "libgui: Change BufferQueue to use free lists""
* commit '41422980fabb087390791d951c28fef072d93be1':
  Revert "libgui: Change BufferQueue to use free lists"
2015-04-22 22:18:58 +00:00
Dan Stoza 7637e35d17 Merge "Revert "libgui: Change BufferQueue to use free lists"" 2015-04-22 18:59:02 +00:00
Dan Stoza 1fc9cc25a4 Revert "libgui: Change BufferQueue to use free lists"
This reverts commit 8dddc99010.

Change-Id: I0b0fed9f1394c6f6ae812f6c562ead4473a8226e
2015-04-22 18:57:39 +00:00
Dan Stoza 2bff43a912 am 3805a00d: am 91f16b1b: am e647ddde: Merge "libgui: Fix CPU rendering on Surface"
* commit '3805a00d6efef02535aaed96f412e0c55a9875f8':
  libgui: Fix CPU rendering on Surface
2015-04-22 00:47:35 +00:00
Wale Ogunwale 1c38c4192b Merge "Fixed build error with clang/llvm." 2015-04-22 00:27:31 +00:00
Dan Stoza c62acbd127 libgui: Fix CPU rendering on Surface
When the surface damage code went in, it incorrectly assumed that if
an application was doing CPU rendering, it would be using lock and
unlockAndPost instead of dequeue and queue, so it repurposed the dirty
region too aggressively. This change keeps it from clobbering the
dirty region if a CPU producer is attached.

Bug: 20431815
Change-Id: Id4dfd71378311ea822f0289f6de2d20a7bd84014
2015-04-21 16:56:52 -07:00
Wale Ogunwale a3206e690b Fixed build error with clang/llvm.
Change-Id: Ideacdc974ebad542df724464ccba9fcfb2b7ea91
2015-04-21 14:00:27 -07:00
Dan Sandler 8f91a6fb04 Merge "Add ashmem stats to Parcels" 2015-04-21 14:10:23 +00:00
Dan Stoza 97ef903db1 am aadb236d: am 483c76dc: am ff5c1a6b: Merge "libgui: Change BufferQueue to use free lists"
* commit 'aadb236d2e944791c1e7600eae9439fcb8a6caa9':
  libgui: Change BufferQueue to use free lists
2015-04-20 20:59:55 +00:00
Dan Stoza f8cebe5457 libgui: Fix some bitrot/warnings in tests
These tests hadn't been run in a while and had accumulated some rot.
This fixes most of the compile warnings and some tests which fail
incorrectly, but 2 failures remain on N6.

Change-Id: I7fee78cd058a32f4d7df40ec9f899ff767f68517
2015-04-20 13:17:23 -07:00
Dan Stoza eea6d682b8 libui/libgui: Fix errors in parceling
BufferItem and GraphicBuffer were not parceling correctly, which had
not been noticed because the libgui tests (specifically, one that
tests placing a BufferQueue in a separate process from the IGBP/C)
had not been run recently. This change fixes the errors found in
those classes.

Change-Id: Ie224361a534a79115a3481d83ff97f21d154d4f5
2015-04-20 13:17:22 -07:00
Dan Stoza 8dddc99010 libgui: Change BufferQueue to use free lists
BufferQueue used to choose free buffers by scanning through its array
of slots and picking one based on timestamp. This changes that
mechanism to use a pair of free lists: one with buffers attached and
one without. This makes it easier to choose either type of free slot
depending on the needs of the current operation.

Bug: 13175420
Change-Id: Ic8398e7511bd11a60a1c82e3ad2ee271c9822be1
2015-04-17 09:28:41 -07:00
Dan Sandler aa5c2346c7 Add ashmem stats to Parcels
Requires change Ifaf115da in frameworks/base.

Bug: 20079551
Change-Id: Ifaf115dabd1a59cdb1b46e2d49c41f64ac107de4
2015-04-16 04:08:53 +00:00
Dan Stoza 2992fcd0b2 am 057a561a: am 57a9f5a0: am fd5f41be: Merge "libgui: Pass surface damage through BufferQueue"
* commit '057a561afbf30ede99b5ec627deec7ee11701f6d':
  libgui: Pass surface damage through BufferQueue
2015-04-15 21:42:43 +00:00
Dan Stoza 45e51aedac am a161b6ce: am c02377e6: am 4d769d8b: Merge "libui: Clean up Fence and Region flattening"
* commit 'a161b6cee9253a17be6b8dc232b05a41fde0030a':
  libui: Clean up Fence and Region flattening
2015-04-15 21:42:36 +00:00
Dan Stoza 5065a55291 libgui: Pass surface damage through BufferQueue
This change adds support for passing surface damage all of the way
down from the EGL interface through the consumer side of the
BufferQueue. Depends on system/core change
Ie645e6a52b37b5c1b3be19481e8348570d1aa62c

Bug: 11239309
Change-Id: I4457ea826e9ade4ec187f973851d855b7b93a31b
2015-04-15 13:19:38 -07:00
Dan Stoza 4d769d8bdc Merge "libui: Clean up Fence and Region flattening" 2015-04-15 20:13:53 +00:00
Dan Stoza 6fbefbbd8e libui: Clean up Fence and Region flattening
Fence was flattening incorrectly, causing issues with any fields
flattened after it, and Region was relying on being the last object
flattened. This change addresses both.

Change-Id: If49de061de6e2f11f4d846b4d8c18627dfb7e109
2015-04-15 13:04:15 -07:00
Wale Ogunwale 376b822728 Added IPCThreadState::blockUntilThreadAvailable() method.
Will be used by the system_server watchdog to monitor the
availability of binder threads in the process to handle
incoming IPC requests.

Bug: 19297165
Change-Id: I39175f3869ad14da5620fddb47f454e6e4ee2b25
2015-04-14 13:17:25 -07:00
Dan Stoza e88e366963 am 6ea912c0: am ddabf640: am a3f8c2aa: Merge "Fix a memory corruption issue when vector resize"
* commit '6ea912c0494fe67d342224b737078dd90b991db6':
  Fix a memory corruption issue when vector resize
2015-04-14 18:38:43 +00:00
Dan Stoza a3f8c2aaf1 Merge "Fix a memory corruption issue when vector resize" 2015-04-14 17:50:39 +00:00
ywen aef0445c6f Fix a memory corruption issue when vector resize
There is memory corruption in below code

const Rect* prev = &dst[prevIndex];
dst.add(Rect(prev->right, top, right, bottom));

prev points to a memory of vector dst, when dst resize in add()
call, the memory that prev points to will be copy to the new
allocated vector memory and the old memory will become undefined

Avoid pointer in this case, use a local copy instead

Change-Id: I4d95ceedd00c8fb615ac153082ade1b1ce0d0fa8
2015-04-10 11:59:52 +05:30
Tim Kilbourn 063ff53d0b Pass through availability of audio mic for input devices.
Bug: 15374820
Change-Id: Id2ca6da10165e3a887ebfbb18f663a3bf316ac79
2015-04-09 10:02:16 -07:00
Dan Stoza 668285721b am 172ff24c: am 5977851b: am 00afb817: Merge "libgui: Plumb detachBuffer through ConsumerBase"
* commit '172ff24ccbc232cdf244a2bcbbb51df754929521':
  libgui: Plumb detachBuffer through ConsumerBase
2015-04-07 23:18:48 +00:00
Dan Stoza 634f5ee6a7 libgui: Plumb detachBuffer through ConsumerBase
Exposes IGraphicBufferConsumer::detachBuffer as a ConsumerBase
method. attachBuffer is not currently exposed, because all current
clients will be recycling buffers through the allocator.

Bug: 19628705
Change-Id: I3e519767fa43d5d880c1d5695e31b60f6ad588af
2015-04-07 15:05:40 -07:00
Dan Stoza c1487b1a60 Merge "Revert "libgui: Plumb attach/detach through CpuConsumer"" 2015-04-02 22:37:04 +00:00
Dan Stoza 921d1d7a61 Revert "libgui: Plumb attach/detach through CpuConsumer"
This reverts commit 20c5672883.
2015-04-02 13:48:15 -07:00
Dan Stoza 231832eb27 DO NOT MERGE libgui: Plumb attach/detach through Surface
Exposes the attachBuffer and detachNextBuffer calls from
IGraphicBufferProducer to the public Surface interface. Also moves
the version of connect that takes a producer callback from protected
to public.

Bug: 19628705
Change-Id: I9ebc3013c4d9c84c4e8ef150c00e03f8af80319e
(cherry picked from commit c14ecb9de2)
2015-04-02 13:35:45 -07:00
Nick Kralevich b6b1423c87 Parcel.cpp: reject size_t arguments greater than INT32_MAX
It's a security best practice for size_t values to be rejected if
they are greater than INT32_SIZE. This is intended to prevent the
common error of inadvertently passing a negative int value to a
function, which after conversion to an unsigned type, becomes a huge
number, defeating the purpose of bounds checking.

This patch also addresses a bug where the call to:
  Parcel::write(buf, (size_t) -1);
would call writeInPlace() which uses PAD_SIZE on the supplied
argument. This would then cause an integer overflow, with PAD_SIZE
returning a small value, but the memcpy in Parcel::write using the
old large length value.

Bug: 19573085
Change-Id: Ib11bfb3dae4f3be91cd17b2c676926700972c7b8
2015-04-02 10:56:12 -07:00
Marco Nelissen b1b2193680 Merge "Add backwards compatible versions of IInterface::asBinder()" 2015-03-31 22:10:48 +00:00
Marco Nelissen 5c6ec52ff8 Add backwards compatible versions of IInterface::asBinder()
This makes apps linked against the previous non-static versions
work with the new libbinder.

Bug: 19060033
Bug: 19773812

Change-Id: I3b5c78cbb4f4c0681ca1042e4d8503d98f969502
2015-03-31 20:32:30 +00:00
Aravind Akella 4949c50372 Support restricted mode in SensorService.
In restricted mode, only CTS tests can register for sensors or call flush() on them. The requests
from other applications will be ignored.

Change-Id: Ieb923df3e0cfe3390fe2d052af776da79589744b
2015-03-24 15:41:35 -07:00
Dan Stoza 1c87e474d8 DO NOT MERGE libgui: Remove IGBC::BufferItem
Removes IGraphicBufferConsumer::BufferItem. Depends on the
following changes:
    I187b3a7d05196b6289596afac8fb9a9d4aebff76
    I0ddd38df37500cfd6b21d1e768ed14e39c5cd9fc

Cherry-pick of Id1fa56d092188f2cb712768d5d2fc6a9027fb73c

Change-Id: I3edf0db8fba656fd78e18a5a7f1137f0fb6b237d
2015-03-20 12:29:04 -07:00
Ronghua Wu 2d13afdfa1 binder: add uint64 support to Parcel.
Bug: 19620911
Change-Id: Ifce5319e4e35afd344dead67ab7ba1cd399476a3
2015-03-19 16:45:04 -07:00
Dan Stoza cf3834db10 DO NOT MERGE libgui: Prepare for IGBC::BufferItem removal
Currently, there are two instances of BufferItem: one inside of
IGraphicBufferConsumer, and a standalone one inside of libgui. They
only differ in the name of one of the fields, and we want to remove
the IGBC version. This changes things so that client code may be
incrementally switched over to the libgui version.

This is a squashed commit containing the following changes:
    I64f495105f56cbf5803cea4aa6b072ea29b70cf5
    I1394e693314429ada93427889f10b7b01c948053
    I9c3bc8037fa9438d4d9080b8afb694219ef2f71f
    I699ed0a6837076867ca756b28d1ffb2238f7a0d9
    Iac8425e1241774304a131da2fb9dec6e82922f13

Change-Id: Ic4d51f5df6dbc70b376d13fceba2335b9bae4f3d
2015-03-19 13:58:07 -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
Dan Stoza ad36432de8 Merge "Surface: Permit an IProducerListener on connect" 2015-03-19 17:45:26 +00:00
Dan Stoza 744fc02fe8 libgui: Only allow one return from useFenceSync
An #ifdef was causing multiple returns in this function, which was
triggering an unreachable code error on some build targets. This
adds an #else to ensure that only one return is exposed in any given
build.

Cherry pick of I9ed7c3e769bc9094ad31d810944227d1d8302886

Change-Id: Ibddc5706159d168031d1805fcce3eedc068296cf
2015-03-19 10:32:51 -07:00
Dan Stoza 48245f0c6d Merge "libgui: Plumb attach/detach through Surface" 2015-03-19 16:48:30 +00:00
Dan Stoza 966b98bd86 Surface: Permit an IProducerListener on connect
This change allows clients of Surface to provide an IProducerListener
callback object to Surface::connect, which will be passed down to the
underlying IGraphicBufferProducer.

Cherry pick of I5ea5229bf3a329bf02c6bd20e7247039c75d136b

Change-Id: I6f8f52c72654e4cee649721383819bafe378f964
2015-03-18 16:01:20 -07:00
Dan Stoza 2632350ac8 GLConsumer: Fix unsigned subtraction during crop
Since some variables had been switched from signed to unsigned, there
was a section of code that was guaranteed to be incorrect because it
effectively did 'if (a < b) { c = a - b; }'. This change fixes it.

Cherry pick of I9cdd6c9a0179801addebb5d6dc1fbaddf8f53c62

Bug: 19346631
Change-Id: Id13a46f74c9ae7278463ce22b586f4dc21b5e453
2015-03-18 16:00:44 -07:00
Michael Lentine c168b8a5a9 Update maxNumber to be smaller.
There shouldn't be more than 4096 fds (probably signficantly smaller) and
there shouldn't be more than 4096 ints.

Cherry pick of I3a3e50ee3078a4710e9737114e65afc923ed0573

Bug: 18076253
Change-Id: I82a883572b401f115d252dcd3d00aa7252b49b0e
2015-03-18 16:00:05 -07:00
Dan Stoza 3be1c6b60a libgui: Enable -Weverything and -Werror
Enables -Weverything and -Werror, with just a few exceptions for
warnings we can't (or shouldn't need to) work around.

Cherry pick of I034abec27bf4020d84af60d7acc1939c59986dd6 plus a
couple of minor changes to CpuConsumer.cpp to make it work with a
prior change:
    Uncomment CC_LOGV on line 46
    Change C-style cast to static_cast on line 71

Change-Id: Iaec610477ea0122317b0578fb74caf2383d4cf08
2015-03-18 15:57:27 -07:00
Dan Stoza 20c5672883 libgui: Plumb attach/detach through CpuConsumer
Adds CpuConsumer::{detachNextBuffer,attachAndReleaseBuffer}, which
can be used to more carefully manage the ownership of GraphicBuffers.

Bug: 19628705
Change-Id: Ia7a7e30da6d81eb2367241998f14988db0afc3bf
2015-03-17 19:37:15 -07:00
Dan Stoza 724768f916 Revert "libgui: Plumb attach/detach through CpuConsumer"
This reverts commit 43078e2827.

Change-Id: Ifef774d9922bb90450384e810e4767b56cc29de3
2015-03-17 15:54:50 +00:00
Dan Stoza c14ecb9de2 libgui: Plumb attach/detach through Surface
Exposes the attachBuffer and detachNextBuffer calls from
IGraphicBufferProducer to the public Surface interface. Also moves
the version of connect that takes a producer callback from protected
to public.

Bug: 19628705
Change-Id: I9ebc3013c4d9c84c4e8ef150c00e03f8af80319e
2015-03-16 13:02:01 -07:00
Dan Stoza 43078e2827 libgui: Plumb attach/detach through CpuConsumer
Adds CpuConsumer::{detachNextBuffer,attachAndReleaseBuffer}, which
can be used to more carefully manage the ownership of GraphicBuffers.

Bug: 19628705
Change-Id: Ia7aa1ac59c2f768f2d8a0f35ad23067936a7427c
2015-03-16 12:58:45 -07:00
Dan Stoza 54716317b5 libgui: Remove IGBC::BufferItem
Removes IGraphicBufferConsumer::BufferItem. Depends on the
following changes:
    I187b3a7d05196b6289596afac8fb9a9d4aebff76
    I0ddd38df37500cfd6b21d1e768ed14e39c5cd9fc

Change-Id: Id1fa56d092188f2cb712768d5d2fc6a9027fb73c
2015-03-16 10:11:40 -07:00
Dan Stoza 9cf51a7c86 libgui: Fix infinite recursion
One of the overloads of BufferQueueConsumer::acquireBuffer was
calling itself infinitely instead of calling the other overload.
This fixes that issue.

Bug: 19733425
Change-Id: Iac8425e1241774304a131da2fb9dec6e82922f13
2015-03-13 15:44:59 -07:00
Dan Stoza dd26416fe1 libgui: Prepare for IGBC::BufferItem removal
Switches some dependencies from IGraphicBufferConsumer::BufferItem to
android::BufferItem and adds some methods to facilitate incrementally
changing client code to do the same.

Change-Id: I699ed0a6837076867ca756b28d1ffb2238f7a0d9
2015-03-12 14:44:28 -07:00
Dan Stoza de7100ab23 libgui: Add a BufferItem overload to IGBC::acquire
Adds an overload of IGraphicBufferConsumer::acquireBuffer which takes
an android::BufferItem instead of an IGBC::BufferItem.

Change-Id: I9c3bc8037fa9438d4d9080b8afb694219ef2f71f
2015-03-11 16:38:47 -07:00
Dan Stoza 8757c016c8 libgui: Add BufferItem(IGBC::BufferItem)
Add a constructor for building a BufferItem from an
IGraphicBufferConsumer::BufferItem.

Change-Id: I1394e693314429ada93427889f10b7b01c948053
2015-03-11 15:37:12 -07:00
Eino-Ville Talvala 94d5ac4802 Merge "Add dataSpace to buffer queues; remove old format enums." 2015-03-06 22:13:07 +00:00
Dan Stoza d8bf6e0baf Merge "Surface: Permit an IProducerListener on connect" 2015-03-06 20:50:09 +00:00
Dan Stoza abf952c1b1 GLConsumer: Fix unsigned subtraction during crop
Since some variables had been switched from signed to unsigned, there
was a section of code that was guaranteed to be incorrect because it
effectively did 'if (a < b) { c = a - b; }'. This change fixes it.

Bug: 19346631
Change-Id: I9cdd6c9a0179801addebb5d6dc1fbaddf8f53c62
2015-03-04 14:58:02 -08:00
Eino-Ville Talvala 5b75a513e4 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

Change-Id: I070bd2e7c56506055c419004c29e2e3feac725df
2015-03-04 11:58:52 -08:00
Dan Stoza f8e3c6b6d8 Surface: Permit an IProducerListener on connect
This change allows clients of Surface to provide an IProducerListener
callback object to Surface::connect, which will be passed down to the
underlying IGraphicBufferProducer.

Change-Id: I5ea5229bf3a329bf02c6bd20e7247039c75d136b
2015-03-02 22:17:27 -08:00
Elliott Hughes 700619e73e am 58573ecd: am 485d3730: am f3f22e55: Merge "Add missing <unistd.h> include for close."
* commit '58573ecdd201f3c678a68377f682e64ddaef0be6':
  Add missing <unistd.h> include for close.
2015-02-20 01:26:57 +00:00
Elliott Hughes 58573ecdd2 am 485d3730: am f3f22e55: Merge "Add missing <unistd.h> include for close."
* commit '485d3730042381ed203e312ad70fec9cb0d2d934':
  Add missing <unistd.h> include for close.
2015-02-20 01:20:21 +00:00