| /* |
| * Copyright (C) 2018 The Android Open Source Project |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| |
| package android.hardware.media.bufferpool@2.0; |
| |
| import IConnection; |
| import IObserver; |
| /** |
| * IAccessor creates IConnection which is used from IClientManager in order to |
| * use functionality of the specified buffer pool. |
| */ |
| interface IAccessor { |
| |
| /** |
| * Registers a new client and creates IConnection to the buffer pool for |
| * the client. IConnection and FMQ are used by IClientManager in order to |
| * communicate with the buffer pool. Via FMQ IClientManager sends |
| * BufferStatusMesage(s) to the buffer pool. |
| * |
| * FMQ is used to send buffer ownership status changes to a buffer pool |
| * from a buffer pool client. A buffer pool synchronizes FMQ messages when |
| * there is a hidl request from the clients. Every client has its own |
| * connection and FMQ to communicate with the buffer pool. So sending an |
| * FMQ message on behalf of other clients is not possible. |
| * |
| * FMQ messages are sent when a buffer is acquired or released. Also, FMQ |
| * messages are sent when a buffer is transferred from a client to another |
| * client. FMQ has its own ID from a buffer pool. A client is specified |
| * with the ID. |
| * |
| * To transfer a buffer, a sender must send an FMQ message. The message |
| * must include a receiver's ID and a transaction ID. A receiver must send |
| * the transaction ID to fetch a buffer from a buffer pool. Since the |
| * sender already registered the receiver via an FMQ message, The buffer |
| * pool must verify the receiver with the transaction ID. In order to |
| * prevent faking a receiver, a connection to a buffer pool from client is |
| * made and kept private. Also part of transaction ID is a sender ID in |
| * order to prevent fake transactions from other clients. This must be |
| * verified with an FMQ message from a buffer pool. |
| |
| * @param observer The buffer pool event observer from the client. |
| * Observer is provided to ensure FMQ messages are processed even when |
| * client processes are idle. Buffer invalidation caused by |
| * reconfiguration does not call observer. Buffer invalidation caused |
| * by termination of pipeline call observer in order to ensure |
| * invalidation is done after pipeline completion. |
| * |
| * @return status The status of the call. |
| * OK - A connection is made successfully. |
| * NO_MEMORY - Memory allocation failure occurred. |
| * ALREADY_EXISTS - A connection was already made. |
| * CRITICAL_ERROR - Other errors. |
| * @return connection The IConnection have interfaces |
| * to get shared buffers from the buffer pool. |
| * @return connectionId Id of IConnection. The Id identifies |
| * sender and receiver in FMQ messages during buffer transfer. |
| * @return msgId Id of the most recent message from buffer pool. |
| * @return toFmqDesc FMQ descriptor. The descriptor is used to |
| * post buffer status messages. |
| * @return fromFmqDesc FMQ descriptor. The descriptor is used to |
| * receive buffer invalidation messages from the buffer pool. |
| */ |
| connect(IObserver observer) |
| generates (ResultStatus status, IConnection connection, |
| int64_t connectionId, |
| uint32_t msgId, |
| fmq_sync<BufferStatusMessage> toFmqDesc, |
| fmq_unsync<BufferInvalidationMessage> fromFmqDesc); |
| }; |