Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 38235ee9 authored by Sungtak Lee's avatar Sungtak Lee
Browse files

Add observer to bufferpool clients

Bufferpool clients are notified bufferpool events via FMQ messages.
Usually the messages are processed by pipeline via piggybacking. To
ensure process FMQ messages even if the process is in idle state,
Observer hidl interface is added. Buffer invalidation caused by
pipleline completion uses Observer interface in order to invalidate
buffers after all normal operations are finished.

Bug: 112203066
Change-Id: I2a4a172d78c6bcedcc809c559321929ebc91c30d
parent eeda71a7
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -11,12 +11,14 @@ hidl_interface {
        "IAccessor.hal",
        "IClientManager.hal",
        "IConnection.hal",
        "IObserver.hal",
    ],
    interfaces: [
        "android.hidl.base@1.0",
    ],
    types: [
        "Buffer",
        "BufferInvalidationMessage",
        "BufferStatus",
        "BufferStatusMessage",
        "ResultStatus",
+9 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
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.
@@ -49,6 +50,13 @@ interface IAccessor {
     * 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.
@@ -64,7 +72,7 @@ interface IAccessor {
     * @return fromFmqDesc FMQ descriptor. The descriptor is used to
     *     receive buffer invalidation messages from the buffer pool.
     */
    connect()
    connect(IObserver observer)
        generates (ResultStatus status, IConnection connection,
                   int64_t connectionId,
                   fmq_sync<BufferStatusMessage> toFmqDesc,
+34 −0
Original line number Diff line number Diff line
/*
 * 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;

/**
 * IObserver listens on notifications from the buffer pool. On receiving
 * notifications, FMQ messages from the specific buffer pool which are already
 * in the FMQ are processed.
 */
interface IObserver {

    /**
     * The specific buffer pool sent a message to the client. Calling this
     * method from the buffer pool enforces a buffer pool client process the
     * message.
     *
     * @param connectionId the connection Id of the specific buffer pool client
     */
    oneway onMessage(int64_t connectionId);
};
+3 −0
Original line number Diff line number Diff line
@@ -65,6 +65,8 @@ enum BufferStatus : int32_t {
    TRANSFER_OK         = 7,
    /** Buffer transaction failure. */
    TRANSFER_ERROR      = 8,
    /** Buffer invalidation ack. */
    INVALIDATION_ACK    = 9,
};

/**
@@ -98,6 +100,7 @@ struct BufferStatusMessage {
 * buffers as soon as possible upon receiving the message.
 */
struct BufferInvalidationMessage {
    uint32_t messageId;
    /**
     * Buffers from fromBufferId to toBufferId must be invalidated.
     * fromBufferId is inclusive, but toBufferId is not inclusive.