• Home
Name Date Size #Lines LOC

..--

Android.bpD06-Sep-2024767 2724

IAccessor.halD06-Sep-20243.2 KiB6965

IClientManager.halD06-Sep-20242 KiB4844

IConnection.halD06-Sep-20241.7 KiB4440

README.mdD06-Sep-20242.5 KiB5542

types.halD06-Sep-20243 KiB9487

README.md

11. Overview
2
3A buffer pool enables processes to transfer buffers asynchronously.
4Without a buffer pool, a process calls a synchronous method of the other
5process and waits until the call finishes transferring a buffer. This adds
6unwanted latency due to context switching. With help from a buffer pool, a
7process can pass buffers asynchronously and reduce context switching latency.
8
9Passing an interface and a handle adds extra latency also. To mitigate the
10latency, passing IDs with local cache is used. For security concerns about
11rogue clients, FMQ is used to communicate between a buffer pool and a client
12process. FMQ is used to send buffer ownership change status from a client
13process to a buffer pool. Except FMQ, a buffer pool does not use any shared
14memory.
15
162. FMQ
17
18FMQ is used to send buffer ownership status changes to a buffer pool from a
19buffer pool client. A buffer pool synchronizes FMQ messages when there is a
20hidl request from the clients. Every client has its own connection and FMQ
21to communicate with the buffer pool. So sending an FMQ message on behalf of
22other clients is not possible.
23
24FMQ messages are sent when a buffer is acquired or released. Also, FMQ messages
25are sent when a buffer is transferred from a client to another client. FMQ has
26its own ID from a buffer pool. A client is specified with the ID.
27
28To transfer a buffer, a sender must send an FMQ message. The message must
29include a receiver's ID and a transaction ID. A receiver must send the
30transaction ID to fetch a buffer from a buffer pool. Since the sender already
31registered the receiver via an FMQ message, The buffer pool must verify the
32receiver with the transaction ID. In order to prevent faking a receiver, a
33connection to a buffer pool from client is made and kept privately. Also part of
34transaction ID is a sender ID in order to prevent fake transactions from other
35clients. This must be verified with an FMQ message from a buffer pool.
36
37FMQ messages are defined in BufferStatus and BufferStatusMessage of 'types.hal'.
38
393. Interfaces
40
41IConnection
42A connection to a buffer pool from a buffer pool client. The connection
43provides the functionalities to share buffers between buffer pool clients.
44The connection must be unique for each client.
45
46IAccessor
47An accessor to a buffer pool which makes a connection to the buffer pool.
48IAccesssor#connect creates an IConnection.
49
50IClientManager
51A manager of buffer pool clients and clients' connections to buffer pools. It
52sets up a process to be a receiver of buffers from a buffer pool. The manager
53is unique in a process.
54
55