Home | History | Annotate | only in /hardware/interfaces/media/bufferpool/1.0
Up to higher level directory
NameDateSize
Android.bp21-Aug-2018517
IAccessor.hal21-Aug-20183.2K
IClientManager.hal21-Aug-20182K
IConnection.hal21-Aug-20181.7K
README.md21-Aug-20182.5K
types.hal21-Aug-20183K

README.md

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