Commit Graph

2931 Commits

Author SHA1 Message Date
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 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