• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2018 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.hardware.media.bufferpool@1.0;
18
19import IConnection;
20/**
21 * IAccessor creates IConnection which is used from IClientManager in order to
22 * use functionality of the specified buffer pool.
23 */
24interface IAccessor {
25
26    /**
27     * Registers a new client and creates IConnection to the buffer pool for
28     * the client. IConnection and FMQ are used by IClientManager in order to
29     * communicate with the buffer pool. Via FMQ IClientManager sends
30     * BufferStatusMesage(s) to the buffer pool.
31     *
32     * FMQ is used to send buffer ownership status changes to a buffer pool
33     * from a buffer pool client. A buffer pool synchronizes FMQ messages when
34     * there is a hidl request from the clients. Every client has its own
35     * connection and FMQ to communicate with the buffer pool. So sending an
36     * FMQ message on behalf of other clients is not possible.
37     *
38     * FMQ messages are sent when a buffer is acquired or released. Also, FMQ
39     * messages are sent when a buffer is transferred from a client to another
40     * client. FMQ has its own ID from a buffer pool. A client is specified
41     * with the ID.
42     *
43     * To transfer a buffer, a sender must send an FMQ message. The message
44     * must include a receiver's ID and a transaction ID. A receiver must send
45     * the transaction ID to fetch a buffer from a buffer pool. Since the
46     * sender already registered the receiver via an FMQ message, The buffer
47     * pool must verify the receiver with the transaction ID. In order to
48     * prevent faking a receiver, a connection to a buffer pool from client is
49     * made and kept private. Also part of transaction ID is a sender ID in
50     * order to prevent fake transactions from other clients. This must be
51     * verified with an FMQ message from a buffer pool.
52     *
53     * @return status The status of the call.
54     *     OK               - A connection is made successfully.
55     *     NO_MEMORY        - Memory allocation failure occurred.
56     *     ALREADY_EXISTS   - A connection was already made.
57     *     CRITICAL_ERROR   - Other errors.
58     * @return connection The IConnection have interfaces
59     *     to get shared buffers from the buffer pool.
60     * @return connectionId Id of IConnection. The Id identifies
61     *     sender and receiver in FMQ messages during buffer transfer.
62     * @return mqDesc FMQ descriptor. The descriptor can be used to
63     *     send/receive FMQ messages.
64     */
65    connect()
66        generates (ResultStatus status, IConnection connection,
67                   int64_t connectionId, fmq_sync<BufferStatusMessage> mqDesc);
68};
69