History log of /frameworks/native/libs/vr/libpdx_uds/client_channel.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
a88e3ee3a33a60e72bd976cfb5b9fc0bd15a1078 04-Nov-2017 Jiwen 'Steve' Cai <jwcai@google.com> Make BufferHubQueue binder parcelable

The goal of this CL is to enable sending BufferHubQueue clients over
binder, so that ANativeWindow/Surface backed by BufferHub can be send
over binder just like the current binder BufferQueue based
implementation.

To enable PDX clients to be binder parcelable, this CL introduced new
DPX interface: pdx::ChannelParcelable with UDS-backed
implementation. Note that the ChannelParcelable interface is only
exposed to each implementation of PDX client (BufferHubQueue clients in
this CL) through protected pdx::Client interface. The reason for doing
that is each client implementation may require different custom clean up
logic between the client can be safely exported to another
process. Thus, we don't want to expose this export-to-binder becomes a
pdx-Client level feature, but let each client implement their own. In
addition, there is no immediate need for all types of pdx::Client
implementation being binder parcelable, thus we only implemented the
logic for BufferHubQueue.

This is the first of a seriers of CLs to eventually enable binder
parcelable ANativeSurface backed by BufferHub.

Bug: 37517761
Bug: 63909629
Test: buffer_hub_queue-test
Change-Id: I41c8a710af3095312db823ff01bc5aa526775edd
/frameworks/native/libs/vr/libpdx_uds/client_channel.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/libs/vr/libpdx_uds/client_channel.cpp
adfc42ead3921f94339372ffb561bc3e8d7f3c86 07-Sep-2017 Alex Vakulenko <avakulenko@google.com> Reduce the number of Send requests over UDS per IPC invocation

We sent up to 3 separate send requests over a socket. Now combine
then into one sendmgs() to improve performance and thread scheduling.

This improves PDX/UDS performance by up to 2x in some cases.

Bug: 65379030
Test: Sailfish works normally. Was able to run VR apps.
Change-Id: I00734d2c3f06d7d42b089569a8cc11c2273a1b7f
/frameworks/native/libs/vr/libpdx_uds/client_channel.cpp
fd22b3e5ad1aae1fc3de54801f33466db3c9b3fe 18-Apr-2017 Alex Vakulenko <avakulenko@google.com> libpdx_uds: Serialize access to connection socket between threads

Added a mutex to allow only one client thread to perform atomic
send-request/receive-responce actions.

Also added a unit test that perfroms multiple parallel client requests
to the same service to ensure it can handle multithreaded access
correctly.

Bug: 37443070
Test: `libpdx_uds_tests` pass
Change-Id: Ica516f7806f9146fb530b5cb371d2ee89146fed7
/frameworks/native/libs/vr/libpdx_uds/client_channel.cpp
09aa736ee6136787b18807d7ab459feba23cec04 06-Apr-2017 Alex Vakulenko <avakulenko@google.com> libpdx_uds: Fix RPC channel ID allocation to not recycle values as often

The value of channel ID for PDX service on UDS transport was actual file
descriptor value for the data socket. Since channels are open and closed
constantly, it is quite often that channel ID is being reused immediately,
so it is almost impossible to use `cid` as unique identifier for objects
being passed around.

Instead, we now use monotonically growing channel ID value.

To prevent the possibility of using channel ID as the socket FD and vice
versa, changed all helper functions that used to take socket_fd as an int
to explicitly use BorrowedHandle which disables implicit conversion from
int (and hence makes it impossible to mistakenly pass in the channel ID).

Bug: 37082296
Test: `m -j32` succeeds for sailfish-eng
Ran libpdx_uds_tests on the device -> all pass
Device boots and CubeSea and VrHome render correctly with vr_flinger

Change-Id: Ibb8dfee4d6c3f4b6120c0b6e20a253f1b9307c19
/frameworks/native/libs/vr/libpdx_uds/client_channel.cpp
6890d95ec8b96970202518b439bfa8ab2d9dbf77 20-Jan-2017 Corey Tabaka <eieio@google.com> libpdx: Add support for more event bits.

- Add generic abstraction for multiple event bits with an implementation-
defined mechanism to deliver the bits.
- Update ServiceFS backend to pass through event bits.
- Implement EPOLLIN, EPOLLPRI, and EPOLLHUP event bit for UDS backed.

Bug: 34466748
Test: Build/flash system; observe stable operation.

Change-Id: I86afb5645b72ec69c095734c7891a690432150a3
/frameworks/native/libs/vr/libpdx_uds/client_channel.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/libs/vr/libpdx_uds/client_channel.cpp