History log of /frameworks/native/services/vr/bufferhubd/buffer_hub.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
0728fa93c12145c2337a0033eb69056520b7bcd8 25-Apr-2018 Jiwen 'Steve' Cai <jwcai@google.com> Implement DetachedBuffer::Promote

1/ This enables a BufferHub-backed DetachedBuffer to be promoted into
the ProducerBuffer.
2/ Add DetachedBuffer::IsConnected in addition to
DetachedBuffer::IsValid.
3/ Cleaned up some using pdx:: namespace statements.

Bug: 69982239
Bug: 69981968
Bug: 70046255
Test: buffer_hub-test
Change-Id: I6ee99507b190d142647455532cdce0c2c780b2b0
/frameworks/native/services/vr/bufferhubd/buffer_hub.cpp
a8049a284ecf3eafddbacf5230b0fefe85de8446 29-Mar-2018 Jiwen 'Steve' Cai <jwcai@google.com> bufferhubd: Implement more DetachedBuffer logic

1/ Separate DetachedBuffer related logic into a dedicated subclass of
BufferHubRPC. This actually is the right thing to do as it utilizes
the PDX's client/service programming pattern better.
2/ Add IsValid() check for the DetachedBufferChannel object.
3/ Add BufferHubClient to handle general PDX operations.
4/ Add DetachedBuffer which composites a BufferHubClient.
5/ Fully functional logic of allocating a DetachedBuffer, converting it
to a BufferHub-backed GraphicBuffer, then converting it back to a
DetachedBuffer.

Bug: 38137191
Bug: 70046255
Bug: 70912269
Test: buffer_hub-test
Change-Id: I81bf9259cbbaeb29a6df2769363b5a03464e7864
/frameworks/native/services/vr/bufferhubd/buffer_hub.cpp
23c1a735b673a9310f05b893a3d01de38d8c1166 12-Mar-2018 Jiwen 'Steve' Cai <jwcai@google.com> bufferhubd: Add DetachedBufferChannel

1/ Introduces four new BufferHub RPC operations.
2/ Implements the ProducerBufferDetach with test case.
3/ Also fixes a bug that Hangup signal wasn't propogated to the client
when bufferhubd closes a producer channel.

Bug: 38137191
Bug: 70046255
Bug: 70912269
Test: buffer_hub-test
Change-Id: Ia2ba0e95abd3c1b960670c505c6fdb9c9de3a6dd
/frameworks/native/services/vr/bufferhubd/buffer_hub.cpp
2f260339e4b32f41db6699c69cf0d568c396bcf5 16-Feb-2018 Jiwen 'Steve' Cai <jwcai@google.com> Remove legacy persistent BufferHub use case

This CL cleans up unused BufferHub code path. The motivation of doing
this is multifold:

1. Reduces future maintainace cost (e.g. when moving to libgui, there
will be less code to rename and re-style).
2. Removes unnecessary code complexity so that the code base is easier
and cleaner for future new reader to understand.
3. Prepares future work for supporting standalone GraphicBuffer in
BufferHub by avoid future logical and naming conflicts between
legacy PersistentBuffer/Detach/Attach and newly proposed detached
GraphicBuffer in BufferHub.

Bug: 70046255
Bug: 70912269
Test: buffer_hub-test, buffer_hub_queue-test,
buffer_hub_queue_producer-test, dvr_api-test, libgui_test

Change-Id: Ie9a0f55e3f620769bac58c81439d840402451b82
/frameworks/native/services/vr/bufferhubd/buffer_hub.cpp
52ea25cf06cef250ec73052611b48556b3fce4d5 14-Sep-2017 Corey Tabaka <eieio@google.com> Add shared memory based buffer metadata

This CLs reduces BufferHub CPU consumption by adding asynchronous
state transition so that out-of-process VR composition can run on 2016
pixel devices smoothly. In addition, this CL addresses a couple corner
cases in the existing bufferhub logic, which fixes various blackscreen
issues.

1/ Tracks buffer transition states (gained, posted, acquired, released)
from the client side via atomic shared memory and adds
PostAsync/AcquireAsync/ReleaseAsync/GainAsync with metadata and
fence support.
2/ Adds dequeue order guarantee for buffers enqueued with
dvrWriteBufferQueuePostBuffer.
3/ Synchronous BuffeHub operations are still supported.
4/ Bump up the bufferhubd's soft limit of open file descriptor.
5/ Handle orphaned consumer in acquired state. This is a corner case
that consumer process goes aways (most likely due to a crash) leaving
buffer stuck in acquired state with inconsistent buffer state.
6/ Fixes a race condition for released buffer to be Gain'ed and
Acquire'd when a new consumer is created in released state.
7/ Improve silent consumer queue efficiency: Silent queues no longer
import buffers or receive signals about new buffers and they are
limited to only spawning other consumers and notifications about
producers hanging up.
8/ Modify PDX/UDS channel event signaling to work around epoll
behavior. PDX UDS uses a combination of an eventfd and an epoll set
to simulate the original PDX transport channel events. An odd
behavior discovered in the kernel implementation of epoll was found
that causes the epoll fd to "unsignal" itself whenever epoll_wait()
is called on it, regardless of whether it should still be
pending. This breaks the edge triggerd behavior in nested epoll sets
that channel events depend on. Since this is unlikely to ever be
fixed in the kernel we work around the behavior by using the epoll
set only as a logical OR of two eventfds and never calling
epoll_wait() on it. When polling is required we use regluar poll()
with the eventfds and data fd to avoid the bad behavior in
epoll_wait().
9/ Keep reading data after PDX hangup signal. UDS will signal hangup
when the other end of the socket closes. However, data could still be
in the kerenl buffer and should be consumed. Fix an issue where the
service misses an impulse sent right before the socket is closed.

Bug: 65455724
Bug: 65458354
Bug: 65458312
Bug: 64027135
Bug: 67424527
Test: libpdx_uds_tests
bufferhub_tests
buffer_hub_queue-test
buffer_hub_queue_producer-test
dvr_api-test

Change-Id: Id07db1f206ccf4e06f7ee3c671193334408971ca
/frameworks/native/services/vr/bufferhubd/buffer_hub.cpp
6bffc67cec8bd8ad086d5a6265dedb737073bdea 19-May-2017 Jiwen 'Steve' Cai <jwcai@google.com> Add more attribute when creating ProducerQueue

Add `is_async`, `default_width`, `default_height` and
`default_format`. Note that these attributes are currently treated as
immutable after queue gets created.

Bug: 38324405
Bug: 38430974
Bug: 36724099
Test: buffer_hub_queue_producer-test, buffer_hub_queue-test, dvr_api-test
Change-Id: Id242a15388a1f1457ad89d11336f5643685e8361
/frameworks/native/services/vr/bufferhubd/buffer_hub.cpp
cbd32bfd3a8dbac30228acbaee1daaf2466d643f 19-May-2017 Jiwen 'Steve' Cai <jwcai@google.com> Simplify ProducerQueue::Create

This is a preparation CL that simplifies ProducerQueue's constructor,
Create(), and bufferhub_rpc::CreateProducerQueue prior to introducing
more queue attributes (is_async, width, height, max_capacity, etc) on
creation.

1/ Consolidate and/or remove unnecessary ProducerQueue::Create's
overloading (we had way too many overloads of the create function and I
figured it's awfully painful to introduce new attributes).
2/ Use UsagePolicy in ProducerQueue::Create. Also added default values
for UsagePolicy, so that empty uniform initialization gives us a default
policy. This helps us removing all ProducerQueue::Create overloading on
whether default usage policy is needed.
3/ Move |meta_size_bytes| into ProducerQueueConfig.

Bug: 38430974
Test: buffer_hub_queue_producer-test, buffer_hub_queue-test, dvr_api-test
Change-Id: Ieba9f4d1bce2162bd1e6063989985afc8d014dc7
/frameworks/native/services/vr/bufferhubd/buffer_hub.cpp
108e84f7e6a9117b66dba000dcf16c6d8c862e16 08-May-2017 Hendrik Wagenaar <hendrikw@google.com> dvrapi: Pass layer_count down

* We were missing layer count, which would prevent multiview
from working

Bug: 37245304
Test: MultiLayerBufferQueue
Change-Id: I88b41f1aa7665df01e89a7386cbc23b15c9a79b0
/frameworks/native/services/vr/bufferhubd/buffer_hub.cpp
4d3590f3fd0fd65f4e8758d3228de9f55cf135d0 07-May-2017 Hendrik Wagenaar <hendrikw@google.com> Remove slices from buffers

* code no longer required, as it will be handled in vrcore

Bug: 38076195
Test: Manually ran testing
Change-Id: Id28918a3bf73b99cbb57aad4c21251b7a9623074
/frameworks/native/services/vr/bufferhubd/buffer_hub.cpp
8a4e6a90e6b7edf73fa0d79dd5b439f8e52eb9f0 20-Apr-2017 Corey Tabaka <eieio@google.com> Add support for consumer queue initial import and hangup.

- Add support for consumer queues to import buffers that are created
before the consumer queue is created, making multi-consumer queue
patterns possible. This is essential for VrFlinger operation.
- Add support for notifying consumer queues when the producer queue
hangs up.
- Correct the epoll event loop to check for hangups even when buffers
are available.
- Add method to retrieve the event fd from a queue.
- Add trace logging and minor cleanup.
- Improve bufferhubd dump state output.

Bug: 36401174
Test: build; bufferhub tests pass.
Change-Id: Idd6f38a3341c048192062734e288d11de48bc4d4
/frameworks/native/services/vr/bufferhubd/buffer_hub.cpp
0057fddc71d1c3c3de8f9d0bd45a51bb293bfa3c 02-May-2017 Jiwen 'Steve' Cai <jwcai@google.com> Deprecate producer/consumer usage: Step 2

Clean up bufferhub_rpc, display_rpc and service side producer/consumer
usage reference.

Next (final) step is to remove all remaining client side reference to
producer/consumer usage and update dvr_xxx API.

This also fixes a minor typo in dvr_named_buffer-test

Bug: 37881101
Test: Build, flash, ran particles.apk and buffer_hub_queue-test
Change-Id: Ibae4376c1fd1ed964843d8b2ad2fb27204fe5e28
/frameworks/native/services/vr/bufferhubd/buffer_hub.cpp
cd52dd9f1b301854b4e1734e3741d9cef8f784b1 08-Apr-2017 Corey Tabaka <eieio@google.com> Update BufferHub service/client with support for gralloc1 usage.

- Add support for gralloc1 usage flags.
- Mimic how GraphicBuffer supports gralloc0 usage flags: (usage, usage).
- Move to using pdx::Status<T> since we're touching signatures everywhere.

Bug: 36401174
Test: bufferhub_tests; buffer_hub_queue-test
Change-Id: I0e5184197b21eda9806bbea44f63b546b030692a
/frameworks/native/services/vr/bufferhubd/buffer_hub.cpp
1db8a5d7e3b0565b976e77859e28d77f6a451a2b 22-Mar-2017 Corey Tabaka <eieio@google.com> Update BufferHubQueue in preparation for VrFlinger refactor.

- Expose buffer hub queue id to the client. This helpful as an id
in queue enumeration in the DisplayManager API.
- Address log convention deviations.
- Clean up BufferHub service error paths.
- Clean up queue importing logic to query the service for queue
parameters to avoid accidental abuse.
- Make spawning consumer queues more efficient in RPC only cases.
- Clean up ConsumerQueue constructor logic; move to pdx::Client
base class (through BufferHubQueue) instead of pdx::ClientBase.
ConsumerQueue::Create doesn't make sense as a ConsumerQueue can
only be created from another queue.

Bug: 36401174
Test: build; run buffer_hub_queue-test
Change-Id: I0530f64ecb514d0f37bb13f9ce201b6ff51502b6
/frameworks/native/services/vr/bufferhubd/buffer_hub.cpp
f0a7bd033941e26e380232a0515e903cf8e678e5 01-Apr-2017 Alex Vakulenko <avakulenko@google.com> pdx: Rework error reporting when transfering file and channel handles

There is a lot of confusion about reporting errors when passing file
and channel handles over PDX transport between client and service.

Methods like Message::PushFileHandle return an integer which means
both a file handle reference value (if positive) and a possible error
code (if negative). But file handles could contain negative values too
(when they are empty). This is used frequently when passing buffer
fences around (when a fence is not being used, its fd is set to -1).

This results in a special case of when PushFileHandle is called with
a file handle with value of -1, the return value is actually "-errno"
which becomes dependent on a global state (errno is not set by
PushFileHandle itself in case file handle value is negative) and results
in unpredicted behavior (sometimes errno is 0, sometimes its >0).

Cleaned this all up by using Status<T> everywhere we used an int to
pass value payload along with possible error code.

Now the semantics of the calls are more clear.

Bug: 36866492
Test: `m -j32` for sailfish-eng succeeds
Ran unit tests on device (pdx_tests, libpdx_uds_tests, bufferhub_tests,
buffer_hub_queue-test, buffer_hub_queue_producer-test), all pass
Ran CubeSea, NativeTreasureHunt and Ithaca on Sailfish with vrflinger
enabled, was able to use controller and screen rendered correctly.

Change-Id: I0f40c3f356fcba8bc217d5219a0ddf9685e57fd7
/frameworks/native/services/vr/bufferhubd/buffer_hub.cpp
8a71b13127f737a46c55ba94d31ba0262e7cbf8a 16-Mar-2017 Mark Urbanus <urbanus@google.com> Refactor IonBuffer to use GraphicBuffer

- Replace gralloc0 based implementation with GraphicBuffer implementation.
- Removed incompatible ion-buffer unit-tests.
- Added libui dependencies to dependants.

Bug: 34879523
Test: Tested on Lucid, validated graphics and poses are working
Change-Id: I49a129f269d54c81bda93b44d879d4b8dee2006a
/frameworks/native/services/vr/bufferhubd/buffer_hub.cpp
3079cb7c32421099a73e1a774b228635eeb3f189 20-Jan-2017 Corey Tabaka <eieio@google.com> Use generic libpdx event bits facility in libvrflinger and bufferhubd.

Use the generic event bits abstraction to support UDS and ServiceFS
backends properly.

Bug: 34466748
Test: start/stop basicvr repeatedly; observe stable bufferhub counts.
Change-Id: I9f2ea67c25860ad7fb931938991a29a37f3391fc
/frameworks/native/services/vr/bufferhubd/buffer_hub.cpp
4fe60582f314e381098f8f3bc2e39c5880e9243a 02-Feb-2017 Alex Vakulenko <avakulenko@google.com> Remove references to libchrome

Removed dependencies on libchrome which was used mostly for logging
and switched over to standard Android log macros.

Bug: None
Test: `m -j32` still succeeds
Change-Id: I0a841c19c15c02f9a031af200e82837f9450d88a
/frameworks/native/services/vr/bufferhubd/buffer_hub.cpp
e4eec20f6263f4a42ae462456f60ea6c4518bb0a 27-Jan-2017 Alex Vakulenko <avakulenko@google.com> Add DaydreamVR native libraries and services

Upstreaming the main VR system components from master-dreamos-dev
into goog/master.

Bug: None
Test: `m -j32` succeeds. Sailfish boots and basic_vr sample app works
Change-Id: I853015872afc443aecee10411ef2d6b79184d051
/frameworks/native/services/vr/bufferhubd/buffer_hub.cpp